From bf4a5241e161bc7f334c24725de16d2448373e69 Mon Sep 17 00:00:00 2001 From: westi Date: Sat, 9 Jan 2010 10:03:55 +0000 Subject: [PATCH] Add missing version numbers to _deprecated_argument() calls. Remove deprecated argument from xfn_check() calls. Pass version number to deprecated_file_included, deprecated_function_run and deprecated_argument_run actions. Fixes #11386 props nacin. git-svn-id: http://svn.automattic.com/wordpress/trunk@12680 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/image.php | 4 +-- wp-admin/includes/meta-boxes.php | 32 +++++++++--------- wp-includes/author-template.php | 10 +++--- wp-includes/comment-template.php | 10 +++--- wp-includes/comment.php | 2 +- wp-includes/formatting.php | 2 +- wp-includes/functions.php | 58 ++++++++++++++++++-------------- wp-includes/kses.php | 7 +++- wp-includes/link-template.php | 2 +- wp-includes/post-template.php | 2 +- wp-includes/widgets.php | 2 +- 11 files changed, 73 insertions(+), 58 deletions(-) diff --git a/wp-admin/includes/image.php b/wp-admin/includes/image.php index 943b2d85b..e786f0f8d 100644 --- a/wp-admin/includes/image.php +++ b/wp-admin/includes/image.php @@ -17,12 +17,12 @@ * * @param mixed $file Filename of the original image, Or attachment id. * @param int $max_side Maximum length of a single side for the thumbnail. - * @param mixed $deprecated Not used. + * @param mixed $deprecated Never used. * @return string Thumbnail path on success, Error string on failure. */ function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) { if ( !empty( $deprecated ) ) - _deprecated_argument( __FUNCTION__, '0.0' ); + _deprecated_argument( __FUNCTION__, '1.2' ); $thumbpath = image_resize( $file, $max_side, $max_side ); return apply_filters( 'wp_create_thumbnail', $thumbpath ); } diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php index 380bbeace..cd7955e9f 100644 --- a/wp-admin/includes/meta-boxes.php +++ b/wp-admin/includes/meta-boxes.php @@ -636,13 +636,13 @@ function link_target_meta_box($link) { ?> * * @param string $class * @param string $value - * @param mixed $deprecated Not used. + * @param mixed $deprecated Never used. */ -function xfn_check($class, $value = '', $deprecated = '') { +function xfn_check( $class, $value = '', $deprecated = '' ) { global $link; if ( !empty( $deprecated ) ) - _deprecated_argument( __FUNCTION__, '0.0' ); + _deprecated_argument( __FUNCTION__, '0.0' ); // Never implemented $link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: ''; $rels = preg_split('/\s+/', $link_rel); @@ -689,13 +689,13 @@ function link_xfn_meta_box($link) {
+ /> + /> + /> + />
@@ -721,13 +721,13 @@ function link_xfn_meta_box($link) {
@@ -735,22 +735,22 @@ function link_xfn_meta_box($link) {
diff --git a/wp-includes/author-template.php b/wp-includes/author-template.php index 437724ced..e726adb0c 100644 --- a/wp-includes/author-template.php +++ b/wp-includes/author-template.php @@ -24,7 +24,7 @@ function get_the_author($deprecated = '') { global $authordata; if ( !empty( $deprecated ) ) - _deprecated_argument( __FUNCTION__, '0.0' ); + _deprecated_argument( __FUNCTION__, '2.1' ); return apply_filters('the_author', is_object($authordata) ? $authordata->display_name : null); } @@ -49,8 +49,10 @@ function get_the_author($deprecated = '') { * @return string The author's display name, from get_the_author(). */ function the_author( $deprecated = '', $deprecated_echo = true ) { - if ( !empty( $deprecated ) || $deprecated_echo !== true ) - _deprecated_argument( __FUNCTION__, '1.5', $deprecated_echo !== true ? __('Use get_the_author() instead if you do not want the value echoed.') : null ); + if ( !empty( $deprecated ) ) + _deprecated_argument( __FUNCTION__, '2.1' ); + if ( $deprecated_echo !== true ) + _deprecated_argument( __FUNCTION__, '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(); @@ -184,7 +186,7 @@ function the_author_posts() { */ function the_author_posts_link($deprecated = '') { if ( !empty( $deprecated ) ) - _deprecated_argument( __FUNCTION__, '0.0' ); + _deprecated_argument( __FUNCTION__, '2.1' ); global $authordata; $link = sprintf( diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index 6b3beeed8..e8c710545 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -504,11 +504,13 @@ function get_comments_link() { * @since 0.71 * * @param string $deprecated Not Used - * @param bool $deprecated Not Used + * @param bool $deprecated_2 Not Used */ -function comments_link( $deprecated = '', $deprecated = '' ) { +function comments_link( $deprecated = '', $deprecated_2 = '' ) { if ( !empty( $deprecated ) ) - _deprecated_argument( __FUNCTION__, '0.0' ); + _deprecated_argument( __FUNCTION__, '0.72' ); + if ( !empty( $deprecated_2 ) ) + _deprecated_argument( __FUNCTION__, '1.3' ); echo get_comments_link(); } @@ -553,7 +555,7 @@ function comments_number( $zero = false, $one = false, $more = false, $deprecate global $id; if ( !empty( $deprecated ) ) - _deprecated_argument( __FUNCTION__, '0.0' ); + _deprecated_argument( __FUNCTION__, '1.3' ); $number = get_comments_number($id); diff --git a/wp-includes/comment.php b/wp-includes/comment.php index ced01b89e..6b839ac64 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -1513,7 +1513,7 @@ function wp_update_comment_count_now($post_id) { */ function discover_pingback_server_uri( $url, $deprecated = '' ) { if ( !empty( $deprecated ) ) - _deprecated_argument( __FUNCTION__, '0.0' ); + _deprecated_argument( __FUNCTION__, '2.7' ); $pingback_str_dquote = 'rel="pingback"'; $pingback_str_squote = 'rel=\'pingback\''; diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 15ab20de0..9f5b845f8 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -867,7 +867,7 @@ function sanitize_html_class($class, $fallback){ */ function convert_chars($content, $deprecated = '') { if ( !empty( $deprecated ) ) - _deprecated_argument( __FUNCTION__, '0.0' ); + _deprecated_argument( __FUNCTION__, '0.71' ); // Translation of invalid Unicode references range to valid range $wp_htmltranswinuni = array( diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 279d80b8a..eb9822184 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1170,7 +1170,7 @@ function do_enclose( $content, $post_ID ) { */ function wp_get_http( $url, $file_path = false, $deprecated = false ) { if ( !empty( $deprecated ) ) - _deprecated_argument( __FUNCTION__, '0.0' ); + _deprecated_argument( __FUNCTION__, '2.7' ); @set_time_limit( 60 ); @@ -1215,7 +1215,7 @@ function wp_get_http( $url, $file_path = false, $deprecated = false ) { */ function wp_get_http_headers( $url, $deprecated = false ) { if ( !empty( $deprecated ) ) - _deprecated_argument( __FUNCTION__, '0.0' ); + _deprecated_argument( __FUNCTION__, '2.7' ); $response = wp_remote_head( $url ); @@ -2153,14 +2153,14 @@ function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) * @since 2.0.0 * * @param string $name - * @param null $deprecated Not used. Set to null. + * @param null $deprecated Never used. Set to null. * @param mixed $bits File content * @param string $time Optional. Time formatted in 'yyyy/mm'. * @return array */ function wp_upload_bits( $name, $deprecated, $bits, $time = null ) { if ( !empty( $deprecated ) ) - _deprecated_argument( __FUNCTION__, '0.0' ); + _deprecated_argument( __FUNCTION__, '2.0' ); if ( empty( $name ) ) return array( 'error' => __( 'Empty filename' ) ); @@ -2961,24 +2961,26 @@ function atom_service_url_filter($url) * This function is to be used in every function in depreceated.php * * @package WordPress - * @package Debug + * @subpackage Debug * @since 2.5.0 * @access private * - * @uses do_action() Calls 'deprecated_function_run' and passes the function name and what to use instead. - * @uses apply_filters() Calls 'deprecated_function_trigger_error' and expects boolean value of true to do trigger or false to not trigger error. + * @uses do_action() Calls 'deprecated_function_run' and passes the function name, what to use instead, + * and the version the function was deprecated in. + * @uses apply_filters() Calls 'deprecated_function_trigger_error' and expects boolean value of true to do + * trigger or false to not trigger error. * * @param string $function The function that was called * @param string $version The version of WordPress that deprecated the function * @param string $replacement Optional. The function that should have been called */ -function _deprecated_function($function, $version, $replacement=null) { +function _deprecated_function( $function, $version, $replacement=null ) { - do_action('deprecated_function_run', $function, $replacement); + do_action( 'deprecated_function_run', $function, $replacement, $version ); // Allow plugin to filter the output error trigger - if( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true )) { - if( !is_null($replacement) ) + if ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) { + if ( ! is_null($replacement) ) trigger_error( sprintf( __('%1$s is deprecated since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) ); else trigger_error( sprintf( __('%1$s is deprecated since version %2$s with no alternative available.'), $function, $version ) ); @@ -2997,24 +2999,26 @@ function _deprecated_function($function, $version, $replacement=null) { * This function is to be used in every file that is depreceated * * @package WordPress - * @package Debug + * @subpackage Debug * @since 2.5.0 * @access private * - * @uses do_action() Calls 'deprecated_file_included' and passes the file name and what to use instead. - * @uses apply_filters() Calls 'deprecated_file_trigger_error' and expects boolean value of true to do trigger or false to not trigger error. + * @uses do_action() Calls 'deprecated_file_included' and passes the file name, what to use instead, + * and the version in which the file was deprecated. + * @uses apply_filters() Calls 'deprecated_file_trigger_error' and expects boolean value of true to do + * trigger or false to not trigger error. * * @param string $file The file that was included * @param string $version The version of WordPress that deprecated the file * @param string $replacement Optional. The file that should have been included based on ABSPATH */ -function _deprecated_file($file, $version, $replacement=null) { +function _deprecated_file( $file, $version, $replacement = null ) { - do_action('deprecated_file_included', $file, $replacement); + do_action( 'deprecated_file_included', $file, $replacement, $version ); // Allow plugin to filter the output error trigger - if( WP_DEBUG && apply_filters( 'deprecated_file_trigger_error', true ) ) { - if( !is_null($replacement) ) + if ( WP_DEBUG && apply_filters( 'deprecated_file_trigger_error', true ) ) { + if ( ! is_null( $replacement ) ) trigger_error( sprintf( __('%1$s is deprecated since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) ); else trigger_error( sprintf( __('%1$s is deprecated since version %2$s with no alternative available.'), $file, $version ) ); @@ -3029,7 +3033,7 @@ function _deprecated_file($file, $version, $replacement=null) { * For example: * * if ( !empty($deprecated) ) - * _deprecated_argument( __FUNCTION__, '0.0' ); + * _deprecated_argument( __FUNCTION__, '3.0' ); * * * There is a hook deprecated_argument_run that will be called that can be used @@ -3039,24 +3043,26 @@ function _deprecated_file($file, $version, $replacement=null) { * The current behavior is to trigger an user error if WP_DEBUG is true. * * @package WordPress - * @package Debug + * @subpackage Debug * @since 3.0.0 * @access private * - * @uses do_action() Calls 'deprecated_argument_run' and passes the function name and what to use instead. - * @uses apply_filters() Calls 'deprecated_argument_trigger_error' and expects boolean value of true to do trigger or false to not trigger error. + * @uses do_action() Calls 'deprecated_argument_run' and passes the function name, a message on the change, + * and the version in which the argument was deprecated. + * @uses apply_filters() Calls 'deprecated_argument_trigger_error' and expects boolean value of true to do + * trigger or false to not trigger error. * * @param string $function The function that was called * @param string $version The version of WordPress that deprecated the argument used * @param string $message Optional. A message regarding the change. */ -function _deprecated_argument($function, $version, $message = null) { +function _deprecated_argument( $function, $version, $message = null ) { - do_action('deprecated_argument_run', $function, $message); + do_action( 'deprecated_argument_run', $function, $message ); // Allow plugin to filter the output error trigger - if( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) { - if( !is_null($message) ) + if ( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) { + if ( ! is_null( $message ) ) trigger_error( sprintf( __('%1$s was called with an argument that is deprecated since version %2$s! %3$s'), $function, $version, $message ) ); else trigger_error( sprintf( __('%1$s was called with an argument that is deprecated since version %2$s with no alternative available.'), $function, $version ) ); diff --git a/wp-includes/kses.php b/wp-includes/kses.php index b0aa91691..b2f4748a3 100644 --- a/wp-includes/kses.php +++ b/wp-includes/kses.php @@ -1196,9 +1196,14 @@ function kses_init() { add_action('init', 'kses_init'); add_action('set_current_user', 'kses_init'); +/** + * Inline CSS filter + * + * @since 2.8.1 + */ function safecss_filter_attr( $css, $deprecated = '' ) { if ( !empty( $deprecated ) ) - _deprecated_argument( __FUNCTION__, '0.0' ); + _deprecated_argument( __FUNCTION__, '2.8.1' ); // Never implemented $css = wp_kses_no_null($css); $css = str_replace(array("\n","\r","\t"), '', $css); diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 944b2c360..d49654c3e 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -170,7 +170,7 @@ function get_permalink($id = 0, $leavename = false) { */ function post_permalink( $post_id = 0, $deprecated = '' ) { if ( !empty( $deprecated ) ) - _deprecated_argument( __FUNCTION__, '0.0' ); + _deprecated_argument( __FUNCTION__, '1.3' ); return get_permalink($post_id); } diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 790abf1b5..43ae7e4a0 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -903,7 +903,7 @@ function walk_page_dropdown_tree() { */ function the_attachment_link( $id = 0, $fullsize = false, $deprecated = false, $permalink = false ) { if ( !empty( $deprecated ) ) - _deprecated_argument( __FUNCTION__, '0.0' ); + _deprecated_argument( __FUNCTION__, '2.5' ); if ( $fullsize ) echo wp_get_attachment_link($id, 'full', $permalink); diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index b6a71973c..3c36d28fe 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -985,7 +985,7 @@ function is_active_sidebar( $index ) { */ function wp_get_sidebars_widgets($deprecated = true) { if ( $deprecated !== true ) - _deprecated_argument( __FUNCTION__, '0.0' ); + _deprecated_argument( __FUNCTION__, '2.8.1' ); global $wp_registered_widgets, $wp_registered_sidebars, $_wp_sidebars_widgets;