WordPress.org

Make WordPress Core

Ticket #10509: 10509-v2.patch

File 10509-v2.patch, 4.5 KB (added by peaceablewhale, 9 years ago)
  • feed-atom.php

     
    4242                <published><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></published>
    4343                <?php the_category_rss('atom') ?>
    4444                <summary type="<?php html_type_rss(); ?>"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary>
    45 <?php if ( !get_option('rss_use_excerpt') ) : ?>
    46                 <content type="<?php html_type_rss(); ?>" xml:base="<?php the_permalink_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content>
    47 <?php endif; ?>
    48 <?php atom_enclosure(); ?>
    49 <?php do_action('atom_entry'); ?>
     45<?php
     46                $entry_content = get_the_content(null, 0, '', true);
     47                if(get_option('rss_use_excerpt')==false && empty($entry_content)==false) {
     48                        echo "\t\t<content type=\"html\" xml:base=\"".get_the_permalink_rss()."\"><![CDATA[$entry_content]]></content>\n";
     49                }
     50                atom_enclosure();
     51                do_action('atom_entry');
     52?>
    5053                <link rel="replies" type="text/html" href="<?php the_permalink_rss() ?>#comments" thr:count="<?php echo get_comments_number()?>"/>
    5154                <link rel="replies" type="application/atom+xml" href="<?php echo get_post_comments_feed_link(0,'atom') ?>" thr:count="<?php echo get_comments_number()?>"/>
    5255                <thr:total><?php echo get_comments_number()?></thr:total>
  • feed-rss2.php

     
    4141                <?php the_category_rss() ?>
    4242
    4343                <guid isPermaLink="false"><?php the_guid(); ?></guid>
    44 <?php if (get_option('rss_use_excerpt')) : ?>
    4544                <description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
    46 <?php else : ?>
    47                 <description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
    48         <?php if ( strlen( $post->post_content ) > 0 ) : ?>
    49                 <content:encoded><![CDATA[<?php the_content() ?>]]></content:encoded>
    50         <?php else : ?>
    51                 <content:encoded><![CDATA[<?php the_excerpt_rss() ?>]]></content:encoded>
    52         <?php endif; ?>
    53 <?php endif; ?>
     45<?php
     46                $entry_content = get_the_content(null, 0, '', true);
     47                if(get_option('rss_use_excerpt')==false && empty($entry_content)==false) {
     48                        echo "\t\t<content:encoded><![CDATA[$entry_content]]></content:encoded>\n";
     49                }
     50?>
    5451                <wfw:commentRss><?php echo get_post_comments_feed_link(); ?></wfw:commentRss>
    5552                <slash:comments><?php echo get_comments_number(); ?></slash:comments>
    5653<?php rss_enclosure(); ?>
  • post-template.php

     
    161161 * @param string $more_link_text Optional. Content for when there is more text.
    162162 * @param string $stripteaser Optional. Teaser content before the more text.
    163163 * @param string $more_file Optional. Not used.
     164 * @param bool $protect_cdata. Make sure the content does not break a CDATA block. (since 2.9)
    164165 */
    165 function the_content($more_link_text = null, $stripteaser = 0, $more_file = '') {
    166         $content = get_the_content($more_link_text, $stripteaser, $more_file);
    167         $content = apply_filters('the_content', $content);
    168         $content = str_replace(']]>', ']]&gt;', $content);
    169         echo $content;
     166function the_content($more_link_text = null, $stripteaser = 0, $more_file = '', $protect_cdata = true) {
     167        echo get_the_content($more_link_text, $stripteaser, $more_file, $protect_cdata);
    170168}
    171169
    172170/**
     
    177175 * @param string $more_link_text Optional. Content for when there is more text.
    178176 * @param string $stripteaser Optional. Teaser content before the more text.
    179177 * @param string $more_file Optional. Not used.
     178 * @param bool $protect_cdata. Make sure the content does not break a CDATA block. (since 2.9)
    180179 * @return string
    181180 */
    182 function get_the_content($more_link_text = null, $stripteaser = 0, $more_file = '') {
     181function get_the_content($more_link_text = null, $stripteaser = 0, $more_file = '', $protect_cdata = false) {
    183182        global $id, $post, $more, $page, $pages, $multipage, $preview, $pagenow;
    184183
    185184        if ( null === $more_link_text )
     
    230229        }
    231230        if ( $preview ) // preview fix for javascript bug with foreign languages
    232231                $output =       preg_replace_callback('/\%u([0-9A-F]{4})/', create_function('$match', 'return "&#" . base_convert($match[1], 16, 10) . ";";'), $output);
    233 
     232               
     233        $output = apply_filters('the_content', $output);
     234        $output = apply_filters('get_the_content', $output);
     235        if($protect_cdata == true) {
     236                $output = str_replace(']]>', ']]&gt;', $output);
     237        }
    234238        return $output;
    235239}
    236240