web/wp-includes/deprecated.php
branchwordpress
changeset 132 4d4862461b8d
parent 109 03b0d1493584
equal deleted inserted replaced
131:a4642baaf829 132:4d4862461b8d
  1688 function the_author_ID() {
  1688 function the_author_ID() {
  1689 	_deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'ID\')' );
  1689 	_deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'ID\')' );
  1690 	the_author_meta('ID');
  1690 	the_author_meta('ID');
  1691 }
  1691 }
  1692 
  1692 
       
  1693 /**
       
  1694  * Display the post content for the feed.
       
  1695  *
       
  1696  * For encoding the html or the $encode_html parameter, there are three possible
       
  1697  * values. '0' will make urls footnotes and use make_url_footnote(). '1' will
       
  1698  * encode special characters and automatically display all of the content. The
       
  1699  * value of '2' will strip all HTML tags from the content.
       
  1700  *
       
  1701  * Also note that you cannot set the amount of words and not set the html
       
  1702  * encoding. If that is the case, then the html encoding will default to 2,
       
  1703  * which will strip all HTML tags.
       
  1704  *
       
  1705  * To restrict the amount of words of the content, you can use the cut
       
  1706  * parameter. If the content is less than the amount, then there won't be any
       
  1707  * dots added to the end. If there is content left over, then dots will be added
       
  1708  * and the rest of the content will be removed.
       
  1709  *
       
  1710  * @package WordPress
       
  1711  * @subpackage Feed
       
  1712  * @since 0.71
       
  1713  * @uses apply_filters() Calls 'the_content_rss' on the content before processing.
       
  1714  * @see get_the_content() For the $more_link_text, $stripteaser, and $more_file
       
  1715  *		parameters.
       
  1716  *
       
  1717  * @deprecated 2.9.0
       
  1718  *
       
  1719  * @param string $more_link_text Optional. Text to display when more content is available but not displayed.
       
  1720  * @param int|bool $stripteaser Optional. Default is 0.
       
  1721  * @param string $more_file Optional.
       
  1722  * @param int $cut Optional. Amount of words to keep for the content.
       
  1723  * @param int $encode_html Optional. How to encode the content.
       
  1724  */
       
  1725 function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) {
       
  1726 	_deprecated_function(__FUNCTION__, '2.9', 'the_content_feed' );
       
  1727 	$content = get_the_content($more_link_text, $stripteaser, $more_file);
       
  1728 	$content = apply_filters('the_content_rss', $content);
       
  1729 	if ( $cut && !$encode_html )
       
  1730 		$encode_html = 2;
       
  1731 	if ( 1== $encode_html ) {
       
  1732 		$content = esc_html($content);
       
  1733 		$cut = 0;
       
  1734 	} elseif ( 0 == $encode_html ) {
       
  1735 		$content = make_url_footnote($content);
       
  1736 	} elseif ( 2 == $encode_html ) {
       
  1737 		$content = strip_tags($content);
       
  1738 	}
       
  1739 	if ( $cut ) {
       
  1740 		$blah = explode(' ', $content);
       
  1741 		if ( count($blah) > $cut ) {
       
  1742 			$k = $cut;
       
  1743 			$use_dotdotdot = 1;
       
  1744 		} else {
       
  1745 			$k = count($blah);
       
  1746 			$use_dotdotdot = 0;
       
  1747 		}
       
  1748 
       
  1749 		/** @todo Check performance, might be faster to use array slice instead. */
       
  1750 		for ( $i=0; $i<$k; $i++ )
       
  1751 			$excerpt .= $blah[$i].' ';
       
  1752 		$excerpt .= ($use_dotdotdot) ? '...' : '';
       
  1753 		$content = $excerpt;
       
  1754 	}
       
  1755 	$content = str_replace(']]>', ']]&gt;', $content);
       
  1756 	echo $content;
       
  1757 }
       
  1758 
       
  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  */
       
  1771 function 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 
       
  1789 /**
       
  1790  * Retrieve translated string with vertical bar context
       
  1791  *
       
  1792  * Quite a few times, there will be collisions with similar translatable text
       
  1793  * found in more than two places but with different translated context.
       
  1794  *
       
  1795  * In order to use the separate contexts, the _c() function is used and the
       
  1796  * translatable string uses a pipe ('|') which has the context the string is in.
       
  1797  *
       
  1798  * When the translated string is returned, it is everything before the pipe, not
       
  1799  * including the pipe character. If there is no pipe in the translated text then
       
  1800  * everything is returned.
       
  1801  *
       
  1802  * @since 2.2.0
       
  1803  * @deprecated 2.9.0
       
  1804  *
       
  1805  * @param string $text Text to translate
       
  1806  * @param string $domain Optional. Domain to retrieve the translated text
       
  1807  * @return string Translated context string without pipe
       
  1808  */
       
  1809 function _c( $text, $domain = 'default' ) {
       
  1810 	_deprecated_function(__FUNCTION__, '2.9', '_x' );
       
  1811 	return translate_with_context( $text, $domain );
       
  1812 }
  1693 ?>
  1813 ?>