WordPress.org

Make WordPress Core

Changeset 12203


Ignore:
Timestamp:
11/17/2009 09:11:24 PM (9 years ago)
Author:
ryan
Message:

Deprecate make_url_footnote(). fixes #4968

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/deprecated.php

    r12042 r12203  
    17571757}
    17581758
     1759/**
     1760 * Strip HTML and put links at the bottom of stripped content.
     1761 *
     1762 * Searches for all of the links, strips them out of the content, and places
     1763 * them at the bottom of the content with numbers.
     1764 *
     1765 * @since 0.71
     1766 * @deprecated 2.9.0
     1767 *
     1768 * @param string $content Content to get links
     1769 * @return string HTML stripped out of content with links at the bottom.
     1770 */
     1771function make_url_footnote( $content ) {
     1772    _deprecated_function(__FUNCTION__, '2.9', '' );
     1773    preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches );
     1774    $links_summary = "\n";
     1775    for ( $i=0; $i<count($matches[0]); $i++ ) {
     1776        $link_match = $matches[0][$i];
     1777        $link_number = '['.($i+1).']';
     1778        $link_url = $matches[2][$i];
     1779        $link_text = $matches[4][$i];
     1780        $content = str_replace( $link_match, $link_text . ' ' . $link_number, $content );
     1781        $link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url;
     1782        $links_summary .= "\n" . $link_number . ' ' . $link_url;
     1783    }
     1784    $content  = strip_tags( $content );
     1785    $content .= $links_summary;
     1786    return $content;
     1787}
     1788
    17591789?>
  • trunk/wp-includes/functions.php

    r12171 r12203  
    969969
    970970    return $data;
    971 }
    972 
    973 /**
    974  * Strip HTML and put links at the bottom of stripped content.
    975  *
    976  * Searches for all of the links, strips them out of the content, and places
    977  * them at the bottom of the content with numbers.
    978  *
    979  * @since 0.71
    980  *
    981  * @param string $content Content to get links
    982  * @return string HTML stripped out of content with links at the bottom.
    983  */
    984 function make_url_footnote( $content ) {
    985     preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches );
    986     $links_summary = "\n";
    987     for ( $i=0; $i<count($matches[0]); $i++ ) {
    988         $link_match = $matches[0][$i];
    989         $link_number = '['.($i+1).']';
    990         $link_url = $matches[2][$i];
    991         $link_text = $matches[4][$i];
    992         $content = str_replace( $link_match, $link_text . ' ' . $link_number, $content );
    993         $link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url;
    994         $links_summary .= "\n" . $link_number . ' ' . $link_url;
    995     }
    996     $content  = strip_tags( $content );
    997     $content .= $links_summary;
    998     return $content;
    999971}
    1000972
Note: See TracChangeset for help on using the changeset viewer.