From 47a7b1b003e5d25ef8b36b8ae1ce5570071f7335 Mon Sep 17 00:00:00 2001 From: westi Date: Thu, 24 Dec 2009 11:12:04 +0000 Subject: [PATCH] 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 --- wp-includes/author-template.php | 9 ++++++++- wp-includes/comment-template.php | 11 ++++++++--- wp-includes/comment.php | 4 +++- wp-includes/cron.php | 4 +++- wp-includes/functions.php | 2 +- wp-includes/post-template.php | 3 +++ wp-includes/widgets.php | 5 ++++- 7 files changed, 30 insertions(+), 8 deletions(-) diff --git a/wp-includes/author-template.php b/wp-includes/author-template.php index 51ff8a97a..89812324f 100644 --- a/wp-includes/author-template.php +++ b/wp-includes/author-template.php @@ -41,10 +41,14 @@ function get_the_author($deprecated = '') { * @link http://codex.wordpress.org/Template_Tags/the_author * * @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(). */ 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 ) echo get_the_author(); return get_the_author(); @@ -177,6 +181,9 @@ function the_author_posts() { * @param string $deprecated Deprecated. */ function the_author_posts_link($deprecated = '') { + if ( !empty( $deprecated ) ) + _deprecated_argument(__FUNCTION__, 'deprecated', '0.0'); + global $authordata; $link = sprintf( '%3$s', diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index 321080afb..95c28adc6 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -503,10 +503,15 @@ function get_comments_link() { * * @since 0.71 * - * @param string $deprecated Not Used - * @param bool $deprecated Not Used + * @param string $deprecated_1 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(); } diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 285142eed..3c35459c1 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -1511,7 +1511,9 @@ function wp_update_comment_count_now($post_id) { * @param int $deprecated Not Used. * @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_squote = 'rel=\'pingback\''; diff --git a/wp-includes/cron.php b/wp-includes/cron.php index b31e83565..3c7c086fe 100644 --- a/wp-includes/cron.php +++ b/wp-includes/cron.php @@ -135,8 +135,10 @@ function wp_unschedule_event( $timestamp, $hook, $args = array() ) { function wp_clear_scheduled_hook( $hook, $args = array() ) { // Backward compatibility // 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 ); + } while ( $timestamp = wp_next_scheduled( $hook, $args ) ) wp_unschedule_event( $timestamp, $hook, $args ); diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 5db3f8021..6cb67c97f 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -3045,7 +3045,7 @@ function _deprecated_argument($function, $argument, $version, $message = null) { // Allow plugin to filter the output error trigger 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 deprecated since version %3$s! %4$s'), $function, $argument, $version, $message ) ); else trigger_error( sprintf( __('The %1$s argument of %2$s is deprecated since version %3$s with no alternative available.'), $function, $argument, $version ) ); diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 91dbcd000..c2c075b80 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -246,6 +246,9 @@ function the_excerpt() { * @return string */ function get_the_excerpt($deprecated = '') { + if ( !empty( $deprecated ) ) + _deprecated_argument(__FUNCTION__, 'deprecated', '2.3'); + global $post; $output = $post->post_excerpt; if ( post_password_required($post) ) { diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index 47c0e6fcf..9a29215c9 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -980,10 +980,13 @@ function is_active_sidebar( $index ) { * @since 2.2.0 * @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. */ 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; // If loading from front page, consult $_wp_sidebars_widgets rather than options