Make WordPress Core

Ticket #1464: 1464.2.diff

File 1464.2.diff, 2.2 KB (added by rob1n, 19 years ago)
  • wp-includes/feed-atom.php

     
    3838<?php if ( !get_option('rss_use_excerpt') ) : ?>
    3939                <content type="<?php html_type_rss(); ?>" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content>
    4040<?php endif; ?>
    41 <?php rss_enclosure(); ?>
     41<?php atom_enclosure(); ?>
    4242<?php do_action('atom_entry'); ?>
    4343        </entry>
    4444        <?php endwhile ; ?>
    45 </feed>
     45</feed>
     46 No newline at end of file
  • wp-includes/feed.php

     
    173173        if ( !empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) )
    174174                return;
    175175
    176         $custom_fields = get_post_custom();
    177         if ( is_array($custom_fields) ) {
    178                 while ( list($key, $val) = each($custom_fields) ) {
    179                         if ( $key == 'enclosure' ) {
    180                                 if ( is_array($val) ) {
    181                                         foreach ( (array) $val as $enc ) {
    182                                                 $enclosure = split( "\n", $enc );
    183                                                 print "<enclosure url='".trim( htmlspecialchars($enclosure[ 0 ]) )."' length='".trim( $enclosure[ 1 ] )."' type='".trim( $enclosure[ 2 ] )."'/>\n";
    184                                         }
    185                                 }
     176        foreach (get_post_custom() as $k => $v) {
     177                if ($key == 'enclosure') {
     178                        foreach ((array)$val as $enc) {
     179                                $enclosure = split("\n", $enc);
     180                                echo apply_filters('rss_enclosure', '<enclosure url="' . trim(htmlspecialchars($enclosure[0])) . '" length="' . trim($enclosure[1]) . '" type="' . trim($enclosure[2]) . '" />' . "\n";
    186181                        }
    187182                }
    188183        }
    189184}
    190185
    191 ?>
     186function atom_enclosure() {
     187        global $id, $post;
     188        if ( !empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) )
     189                return;
     190
     191        foreach (get_post_custom() as $k => $v) {
     192                if ($key == 'enclosure') {
     193                        foreach ((array)$val as $enc) {
     194                                $enclosure = split("\n", $enc);
     195                                echo apply_filters('atom_enclosure', '<link href="' . trim(htmlspecialchars($enclosure[0])) . '" rel="enclosure" length="' . trim($enclosure[1]) . '" type="' . trim($enclosure[2]) . '" />' . "\n";
     196                        }
     197                }
     198        }
     199}
     200
     201?>
     202 No newline at end of file