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
This commit is contained in:
westi 2010-01-09 10:03:55 +00:00
parent 03ed98ab17
commit bf4a5241e1
11 changed files with 73 additions and 58 deletions

View File

@ -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 );
}

View File

@ -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) {
<th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friendship') ?> </th>
<td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friendship') ?> </span></legend>
<label for="contact">
<input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('contact') ?></label>
<input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('contact') ?></label>
<label for="acquaintance">
<input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('acquaintance') ?></label>
<input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('acquaintance') ?></label>
<label for="friend">
<input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friend') ?></label>
<input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friend') ?></label>
<label for="friendship">
<input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship', '', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?></label>
<input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?></label>
</fieldset></td>
</tr>
<tr>
@ -721,13 +721,13 @@ function link_xfn_meta_box($link) {
<th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('geographical') ?> </th>
<td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('geographical') ?> </span></legend>
<label for="co-resident">
<input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident', 'radio'); ?> />
<input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident'); ?> />
<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('co-resident') ?></label>
<label for="neighbor">
<input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor', 'radio'); ?> />
<input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor'); ?> />
<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('neighbor') ?></label>
<label for="geographical">
<input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> />
<input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical'); ?> />
<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?></label>
</fieldset></td>
</tr>
@ -735,22 +735,22 @@ function link_xfn_meta_box($link) {
<th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('family') ?> </th>
<td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('family') ?> </span></legend>
<label for="child">
<input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?> />
<input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child'); ?> />
<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('child') ?></label>
<label for="kin">
<input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin', 'radio'); ?> />
<input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin'); ?> />
<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('kin') ?></label>
<label for="parent">
<input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent', 'radio'); ?> />
<input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent'); ?> />
<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('parent') ?></label>
<label for="sibling">
<input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling', 'radio'); ?> />
<input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling'); ?> />
<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('sibling') ?></label>
<label for="spouse">
<input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse', 'radio'); ?> />
<input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse'); ?> />
<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('spouse') ?></label>
<label for="family">
<input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> />
<input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family'); ?> />
<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?></label>
</fieldset></td>
</tr>

View File

@ -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(

View File

@ -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);

View File

@ -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\'';

View File

@ -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(

View File

@ -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 <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );
else
trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> 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 <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) );
else
trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version ) );
@ -3029,7 +3033,7 @@ function _deprecated_file($file, $version, $replacement=null) {
* For example:
* <code>
* if ( !empty($deprecated) )
* _deprecated_argument( __FUNCTION__, '0.0' );
* _deprecated_argument( __FUNCTION__, '3.0' );
* </code>
*
* 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 <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message ) );
else
trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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;