Fix typo in _deprecated_argument() and start using _deprecated_argument() in wp-includes files. See #11386 props nacin.

git-svn-id: http://svn.automattic.com/wordpress/trunk@12537 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2009-12-24 11:12:04 +00:00
parent fc38ae1d5b
commit 47a7b1b003
7 changed files with 30 additions and 8 deletions

View File

@ -41,10 +41,14 @@ function get_the_author($deprecated = '') {
* @link http://codex.wordpress.org/Template_Tags/the_author * @link http://codex.wordpress.org/Template_Tags/the_author
* *
* @param string $deprecated Deprecated. * @param string $deprecated Deprecated.
* @param string $deprecated_echo Echo the string or return it. * @param string $deprecated_echo Deprecated. Use get_the_author(). Echo the string or return it.
* @return string The author's display name, from get_the_author(). * @return string The author's display name, from get_the_author().
*/ */
function the_author($deprecated = '', $deprecated_echo = true) { function the_author($deprecated = '', $deprecated_echo = true) {
if ( !empty($deprecated) )
_deprecated_argument(__FUNCTION__, 'deprecated', '1.5');
if ( $deprecated_echo !== true )
_deprecated_argument(__FUNCTION__, 'deprecated_echo', '1.5', __('Use get_the_author() instead if you do not want the value echoed.'));
if ( $deprecated_echo ) if ( $deprecated_echo )
echo get_the_author(); echo get_the_author();
return get_the_author(); return get_the_author();
@ -177,6 +181,9 @@ function the_author_posts() {
* @param string $deprecated Deprecated. * @param string $deprecated Deprecated.
*/ */
function the_author_posts_link($deprecated = '') { function the_author_posts_link($deprecated = '') {
if ( !empty( $deprecated ) )
_deprecated_argument(__FUNCTION__, 'deprecated', '0.0');
global $authordata; global $authordata;
$link = sprintf( $link = sprintf(
'<a href="%1$s" title="%2$s">%3$s</a>', '<a href="%1$s" title="%2$s">%3$s</a>',

View File

@ -503,10 +503,15 @@ function get_comments_link() {
* *
* @since 0.71 * @since 0.71
* *
* @param string $deprecated Not Used * @param string $deprecated_1 Not Used
* @param bool $deprecated Not Used * @param bool $deprecated_2 Not Used
*/ */
function comments_link( $deprecated = '', $deprecated = '' ) { function comments_link( $deprecated_1 = '', $deprecated_2 = '' ) {
if ( !empty( $deprecated_1 ) )
_deprecated_argument(__FUNCTION__, 'deprecated_1', '0.0');
if ( !empty( $deprecated_2 ) )
_deprecated_argument(__FUNCTION__, 'deprecated_2', '0.0');
echo get_comments_link(); echo get_comments_link();
} }

View File

@ -1511,7 +1511,9 @@ function wp_update_comment_count_now($post_id) {
* @param int $deprecated Not Used. * @param int $deprecated Not Used.
* @return bool|string False on failure, string containing URI on success. * @return bool|string False on failure, string containing URI on success.
*/ */
function discover_pingback_server_uri($url, $deprecated = 2048) { function discover_pingback_server_uri($url, $deprecated = '') {
if ( !empty($deprecated) )
_deprecated_argument(__FUNCTION__, 'deprecated', '0.0');
$pingback_str_dquote = 'rel="pingback"'; $pingback_str_dquote = 'rel="pingback"';
$pingback_str_squote = 'rel=\'pingback\''; $pingback_str_squote = 'rel=\'pingback\'';

View File

@ -135,8 +135,10 @@ function wp_unschedule_event( $timestamp, $hook, $args = array() ) {
function wp_clear_scheduled_hook( $hook, $args = array() ) { function wp_clear_scheduled_hook( $hook, $args = array() ) {
// Backward compatibility // Backward compatibility
// Previously this function took the arguments as discrete vars rather than an array like the rest of the API // Previously this function took the arguments as discrete vars rather than an array like the rest of the API
if ( !is_array($args) ) if ( !is_array($args) ) {
_deprecated_argument(__FUNCTION__, 'args', '3.0.0', __('This argument has changed to an array so as to match with the behaviour of all the other cron functions.') );
$args = array_slice( func_get_args(), 1 ); $args = array_slice( func_get_args(), 1 );
}
while ( $timestamp = wp_next_scheduled( $hook, $args ) ) while ( $timestamp = wp_next_scheduled( $hook, $args ) )
wp_unschedule_event( $timestamp, $hook, $args ); wp_unschedule_event( $timestamp, $hook, $args );

View File

@ -3045,7 +3045,7 @@ function _deprecated_argument($function, $argument, $version, $message = null) {
// Allow plugin to filter the output error trigger // Allow plugin to filter the output error trigger
if( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) { if( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) {
if( !is_null($replacement) ) if( !is_null($message) )
trigger_error( sprintf( __('The %1$s argument of %2$s is <strong>deprecated</strong> since version %3$s! %4$s'), $function, $argument, $version, $message ) ); trigger_error( sprintf( __('The %1$s argument of %2$s is <strong>deprecated</strong> since version %3$s! %4$s'), $function, $argument, $version, $message ) );
else else
trigger_error( sprintf( __('The %1$s argument of %2$s is <strong>deprecated</strong> since version %3$s with no alternative available.'), $function, $argument, $version ) ); trigger_error( sprintf( __('The %1$s argument of %2$s is <strong>deprecated</strong> since version %3$s with no alternative available.'), $function, $argument, $version ) );

View File

@ -246,6 +246,9 @@ function the_excerpt() {
* @return string * @return string
*/ */
function get_the_excerpt($deprecated = '') { function get_the_excerpt($deprecated = '') {
if ( !empty( $deprecated ) )
_deprecated_argument(__FUNCTION__, 'deprecated', '2.3');
global $post; global $post;
$output = $post->post_excerpt; $output = $post->post_excerpt;
if ( post_password_required($post) ) { if ( post_password_required($post) ) {

View File

@ -980,10 +980,13 @@ function is_active_sidebar( $index ) {
* @since 2.2.0 * @since 2.2.0
* @access private * @access private
* *
* @param bool $update Optional, deprecated. * @param bool $deprecated. Not used.
* @return array Upgraded list of widgets to version 3 array format when called from the admin. * @return array Upgraded list of widgets to version 3 array format when called from the admin.
*/ */
function wp_get_sidebars_widgets($deprecated = true) { function wp_get_sidebars_widgets($deprecated = true) {
if ( $deprecated !== true )
_deprecated_argument(__FUNCTION__, 'deprecated', '0.0');
global $wp_registered_widgets, $wp_registered_sidebars, $_wp_sidebars_widgets; global $wp_registered_widgets, $wp_registered_sidebars, $_wp_sidebars_widgets;
// If loading from front page, consult $_wp_sidebars_widgets rather than options // If loading from front page, consult $_wp_sidebars_widgets rather than options