WordPress.org

Make WordPress Core

Ticket #4968: 4968.2.patch

File 4968.2.patch, 3.7 KB (added by hakre, 9 years ago)

no more deprecated function calls in the_content_rss() plus better docblock comments.

  • wp-includes/deprecated.php

     
    16901690        the_author_meta('ID');
    16911691}
    16921692
     1693/**
     1694 * Strip HTML and put links at the bottom of stripped content.
     1695 *
     1696 * Searches for all of the links, strips them out of the content, and places
     1697 * them at the bottom of the content with numbers.
     1698 *
     1699 * @since 0.71
     1700 * @deprecated 2.9
     1701 *
     1702 * @param string $content Content to get links
     1703 * @return string HTML stripped out of content with links at the bottom.
     1704 */
     1705function make_url_footnote( $content ) {
     1706        _deprecated_function(__FUNCTION__, '2.9' );     
     1707}
     1708
    16931709?>
     1710 No newline at end of file
  • wp-includes/feed.php

     
    153153 * @see get_the_content() For the $more_link_text, $stripteaser, and $more_file
    154154 *              parameters.
    155155 *
    156  * @param string $more_link_text Optional. Text to display when more content is available but not displayed.
    157  * @param int|bool $stripteaser Optional. Default is 0.
    158  * @param string $more_file Optional.
    159  * @param int $cut Optional. Amount of words to keep for the content.
    160  * @param int $encode_html Optional. How to encode the content.
     156 * @param string $more_link_text (optional) Text to display when more content is available but not displayed.
     157 * @param int|bool $stripteaser (optional) Default is 0.
     158 * @param string $more_file (optional)
     159 * @param int $cut (optional) Amount of words to keep for the content.
     160 * @param int $encode_html (optional) How to encode the content. 0: as-is, 1: esc_html, 2: strip_tags defaults to 0
    161161 */
    162162function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) {
    163163        $content = get_the_content($more_link_text, $stripteaser, $more_file);
    164164        $content = apply_filters('the_content_rss', $content);
    165165        if ( $cut && !$encode_html )
    166166                $encode_html = 2;
    167         if ( 1== $encode_html ) {
     167        if ( 1 == $encode_html ) {
    168168                $content = esc_html($content);
    169169                $cut = 0;
    170         } elseif ( 0 == $encode_html ) {
    171                 $content = make_url_footnote($content);
    172170        } elseif ( 2 == $encode_html ) {
    173171                $content = strip_tags($content);
    174172        }
  • wp-includes/functions.php

     
    965965}
    966966
    967967/**
    968  * Strip HTML and put links at the bottom of stripped content.
    969  *
    970  * Searches for all of the links, strips them out of the content, and places
    971  * them at the bottom of the content with numbers.
    972  *
    973  * @since 0.71
    974  *
    975  * @param string $content Content to get links
    976  * @return string HTML stripped out of content with links at the bottom.
    977  */
    978 function make_url_footnote( $content ) {
    979         preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches );
    980         $links_summary = "\n";
    981         for ( $i=0; $i<count($matches[0]); $i++ ) {
    982                 $link_match = $matches[0][$i];
    983                 $link_number = '['.($i+1).']';
    984                 $link_url = $matches[2][$i];
    985                 $link_text = $matches[4][$i];
    986                 $content = str_replace( $link_match, $link_text . ' ' . $link_number, $content );
    987                 $link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url;
    988                 $links_summary .= "\n" . $link_number . ' ' . $link_url;
    989         }
    990         $content  = strip_tags( $content );
    991         $content .= $links_summary;
    992         return $content;
    993 }
    994 
    995 /**
    996968 * Retrieve post title from XMLRPC XML.
    997969 *
    998970 * If the title element is not part of the XML, then the default post title from