Make WordPress Core

Changeset 12584


Ignore:
Timestamp:
12/30/2009 04:23:39 PM (14 years ago)
Author:
westi
Message:

Updates and improvements to _depreceated_argument. See #11386 props nacin.

Location:
trunk
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/image.php

    r12524 r12584  
    1818 * @param mixed $file Filename of the original image, Or attachment id.
    1919 * @param int $max_side Maximum length of a single side for the thumbnail.
     20 * @param mixed $deprecated Not used.
    2021 * @return string Thumbnail path on success, Error string on failure.
    2122 */
    2223function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
     24    if ( !empty( $deprecated ) )
     25        _deprecated_argument( __FUNCTION__, '0.0' );
    2326    $thumbpath = image_resize( $file, $max_side, $max_side );
    2427    return apply_filters( 'wp_create_thumbnail', $thumbpath );
  • trunk/wp-admin/includes/meta-boxes.php

    r12351 r12584  
    639639function xfn_check($class, $value = '', $deprecated = '') {
    640640    global $link;
     641
     642    if ( !empty( $deprecated ) )
     643        _deprecated_argument( __FUNCTION__, '0.0' );
    641644
    642645    $link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';
  • trunk/wp-admin/includes/upgrade.php

    r12560 r12584  
    3434 * @return array Array keys 'url', 'user_id', 'password', 'password_message'.
    3535 */
    36 function wp_install($blog_title, $user_name, $user_email, $public, $deprecated='') {
     36function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated = '' ) {
    3737    global $wp_rewrite;
     38
     39    if ( !empty( $deprecated ) )
     40        _deprecated_argument( __FUNCTION__, '2.6' );
    3841
    3942    wp_check_mysql_version();
  • trunk/wp-app.php

    r12515 r12584  
    885885     * @since 2.2.0
    886886     *
    887      * @param mixed $deprecated Optional, not used.
     887     * @param mixed $deprecated Not used.
    888888     * @return string
    889889     */
    890890    function get_categories_url($deprecated = '') {
     891        if ( !empty( $deprecated ) )
     892            _deprecated_argument( __FUNCTION__, '2.5' );
    891893        return $this->app_base . $this->CATEGORIES_PATH;
    892894    }
  • trunk/wp-includes/author-template.php

    r12537 r12584  
    2323function get_the_author($deprecated = '') {
    2424    global $authordata;
     25
     26    if ( !empty( $deprecated ) )
     27        _deprecated_argument( __FUNCTION__, '0.0' );
     28
    2529    return apply_filters('the_author', is_object($authordata) ? $authordata->display_name : null);
    2630}
     
    4549 * @return string The author's display name, from get_the_author().
    4650 */
    47 function the_author($deprecated = '', $deprecated_echo = true) {
    48     if ( !empty($deprecated) )
    49         _deprecated_argument(__FUNCTION__, 'deprecated', '1.5');
    50     if ( $deprecated_echo !== true )
    51         _deprecated_argument(__FUNCTION__, 'deprecated_echo', '1.5', __('Use get_the_author() instead if you do not want the value echoed.'));
     51function the_author( $deprecated = '', $deprecated_echo = true ) {
     52    if ( !empty( $deprecated ) || $deprecated_echo !== true )
     53        _deprecated_argument( __FUNCTION__, '1.5', $deprecated_echo !== true ? __('Use get_the_author() instead if you do not want the value echoed.') : null );
    5254    if ( $deprecated_echo )
    5355        echo get_the_author();
     
    183185function the_author_posts_link($deprecated = '') {
    184186    if ( !empty( $deprecated ) )
    185         _deprecated_argument(__FUNCTION__, 'deprecated', '0.0');
     187        _deprecated_argument( __FUNCTION__, '0.0' );
    186188
    187189    global $authordata;
  • trunk/wp-includes/comment-template.php

    r12537 r12584  
    504504 * @since 0.71
    505505 *
    506  * @param string $deprecated_1 Not Used
    507  * @param bool $deprecated_2 Not Used
    508  */
    509 function comments_link( $deprecated_1 = '', $deprecated_2 = '' ) {
    510     if ( !empty( $deprecated_1 ) )
    511         _deprecated_argument(__FUNCTION__, 'deprecated_1', '0.0');
    512     if ( !empty( $deprecated_2 ) )
    513         _deprecated_argument(__FUNCTION__, 'deprecated_2', '0.0');
    514 
     506 * @param string $deprecated Not Used
     507 * @param bool $deprecated Not Used
     508 */
     509function comments_link( $deprecated = '', $deprecated = '' ) {
     510    if ( !empty( $deprecated ) )
     511        _deprecated_argument( __FUNCTION__, '0.0' );
    515512    echo get_comments_link();
    516513}
     
    555552function comments_number( $zero = false, $one = false, $more = false, $deprecated = '' ) {
    556553    global $id;
     554
     555    if ( !empty( $deprecated ) )
     556        _deprecated_argument( __FUNCTION__, '0.0' );
     557
    557558    $number = get_comments_number($id);
    558559
     
    697698 * @uses get_trackback_url() Gets the trackback url for the current post
    698699 *
    699  * @param bool $deprecated Remove backwards compat in 2.5
     700 * @param bool $deprecated_echo Remove backwards compat in 2.5
    700701 * @return void|string Should only be used to echo the trackback URL, use get_trackback_url() for the result instead.
    701702 */
    702 function trackback_url($deprecated = true) {
    703     if ($deprecated) echo get_trackback_url();
    704     else return get_trackback_url();
     703function trackback_url( $deprecated_echo = true ) {
     704    if ( $deprecated_echo !== true )
     705        _deprecated_argument( __FUNCTION__, '2.5', __('Use get_trackback_url() instead if you do not want the value echoed.') );
     706    if ( $deprecated_echo )
     707        echo get_trackback_url();
     708    else
     709        return get_trackback_url();
    705710}
    706711
     
    713718 */
    714719function trackback_rdf($deprecated = '') {
     720    if ( !empty( $deprecated ) )
     721        _deprecated_argument( __FUNCTION__, '2.5' );
     722
    715723    if (stripos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') === false) {
    716724        echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  • trunk/wp-includes/comment.php

    r12537 r12584  
    15121512 * @return bool|string False on failure, string containing URI on success.
    15131513 */
    1514 function discover_pingback_server_uri($url, $deprecated = '') {
    1515     if ( !empty($deprecated) )
    1516         _deprecated_argument(__FUNCTION__, 'deprecated', '0.0');
     1514function discover_pingback_server_uri( $url, $deprecated = '' ) {
     1515    if ( !empty( $deprecated ) )
     1516        _deprecated_argument( __FUNCTION__, '0.0' );
    15171517
    15181518    $pingback_str_dquote = 'rel="pingback"';
  • trunk/wp-includes/cron.php

    r12537 r12584  
    137137    // Previously this function took the arguments as discrete vars rather than an array like the rest of the API
    138138    if ( !is_array($args) ) {
    139         _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.') );
     139        _deprecated_argument( __FUNCTION__, '3.0.0', __('This argument has changed to an array to match the behavior of the other cron functions.') );
    140140        $args = array_slice( func_get_args(), 1 );
    141141    }
  • trunk/wp-includes/formatting.php

    r12504 r12584  
    867867 */
    868868function convert_chars($content, $deprecated = '') {
     869    if ( !empty( $deprecated ) )
     870        _deprecated_argument( __FUNCTION__, '0.0' );
     871
    869872    // Translation of invalid Unicode references range to valid range
    870873    $wp_htmltranswinuni = array(
  • trunk/wp-includes/functions.php

    r12581 r12584  
    571571 */
    572572function add_option( $name, $value = '', $deprecated = '', $autoload = 'yes' ) {
     573    if ( !empty( $deprecated ) )
     574        _deprecated_argument( __FUNCTION__, '2.3' );
     575
    573576    global $wpdb;
    574577
     
    12041207 */
    12051208function wp_get_http( $url, $file_path = false, $deprecated = false ) {
     1209    if ( !empty( $deprecated ) )
     1210        _deprecated_argument( __FUNCTION__, '0.0' );
     1211
    12061212    @set_time_limit( 60 );
    12071213
     
    12461252 */
    12471253function wp_get_http_headers( $url, $deprecated = false ) {
     1254    if ( !empty( $deprecated ) )
     1255        _deprecated_argument( __FUNCTION__, '0.0' );
     1256
    12481257    $response = wp_remote_head( $url );
    12491258
     
    21882197 */
    21892198function wp_upload_bits( $name, $deprecated, $bits, $time = null ) {
     2199    if ( !empty( $deprecated ) )
     2200        _deprecated_argument( __FUNCTION__, '0.0' );
     2201
    21902202    if ( empty( $name ) )
    21912203        return array( 'error' => __( 'Empty filename' ) );
     
    30403052 * <code>
    30413053 * if ( !empty($deprecated) )
    3042  *  _deprecated_argument( __FUNCTION__, 'deprecated', '0.0' );
     3054 *  _deprecated_argument( __FUNCTION__, '0.0' );
    30433055 * </code>
    30443056 *
     
    30543066 * @access private
    30553067 *
    3056  * @uses do_action() Calls 'deprecated_argument_run' and passes the function and argument names and what to use instead.
     3068 * @uses do_action() Calls 'deprecated_argument_run' and passes the function name and what to use instead.
    30573069 * @uses apply_filters() Calls 'deprecated_argument_trigger_error' and expects boolean value of true to do trigger or false to not trigger error.
    30583070 *
    30593071 * @param string $function The function that was called
    3060  * @param string $argument The name of the deprecated argument that was used
    3061  * @param string $version The version of WordPress that deprecated the function
     3072 * @param string $version The version of WordPress that deprecated the argument used
    30623073 * @param string $message Optional. A message regarding the change.
    30633074 */
    3064 function _deprecated_argument($function, $argument, $version, $message = null) {
    3065 
    3066     do_action('deprecated_argument_run', $function, $argument, $message);
     3075function _deprecated_argument($function, $version, $message = null) {
     3076
     3077    do_action('deprecated_argument_run', $function, $message);
    30673078
    30683079    // Allow plugin to filter the output error trigger
    30693080    if( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) {
    30703081        if( !is_null($message) )
    3071             trigger_error( sprintf( __('The %1$s argument of %2$s is <strong>deprecated</strong> since version %3$s! %4$s'), $function, $argument, $version, $message ) );
     3082            trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message ) );
    30723083        else
    3073             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 ) );
     3084            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 ) );
    30743085    }
    30753086}
  • trunk/wp-includes/kses.php

    r12199 r12584  
    11981198
    11991199function safecss_filter_attr( $css, $deprecated = '' ) {
     1200    if ( !empty( $deprecated ) )
     1201        _deprecated_argument( __FUNCTION__, '0.0' );
     1202
    12001203    $css = wp_kses_no_null($css);
    12011204    $css = str_replace(array("\n","\r","\t"), '', $css);
  • trunk/wp-includes/link-template.php

    r12548 r12584  
    169169 * @return string
    170170 */
    171 function post_permalink($post_id = 0, $deprecated = '') {
     171function post_permalink( $post_id = 0, $deprecated = '' ) {
     172    if ( !empty( $deprecated ) )
     173        _deprecated_argument( __FUNCTION__, '0.0' );
     174
    172175    return get_permalink($post_id);
    173176}
  • trunk/wp-includes/post-template.php

    r12550 r12584  
    247247 * @return string
    248248 */
    249 function get_the_excerpt($deprecated = '') {
     249function get_the_excerpt( $deprecated = '' ) {
    250250    if ( !empty( $deprecated ) )
    251         _deprecated_argument(__FUNCTION__, 'deprecated', '2.3');
     251        _deprecated_argument( __FUNCTION__, '2.3' );
    252252
    253253    global $post;
     
    902902 * @param bool $permalink Optional, default is false. Whether to include permalink.
    903903 */
    904 function the_attachment_link($id = 0, $fullsize = false, $deprecated = false, $permalink = false) {
     904function the_attachment_link( $id = 0, $fullsize = false, $deprecated = false, $permalink = false ) {
     905    if ( !empty( $deprecated ) )
     906        _deprecated_argument( __FUNCTION__, '0.0' );
     907
    905908    if ( $fullsize )
    906909        echo wp_get_attachment_link($id, 'full', $permalink);
  • trunk/wp-includes/post.php

    r12571 r12584  
    35393539 * @param object $post Object type containing the post information
    35403540 */
    3541 function _future_post_hook($deprecated = '', $post) {
     3541function _future_post_hook( $deprecated = '', $post ) {
     3542    if ( !empty( $deprecated ) )
     3543        _deprecated_argument( __FUNCTION__, '0.0' );
    35423544    wp_clear_scheduled_hook( 'publish_future_post', array( $post->ID ) );
    3543     wp_schedule_single_event(strtotime($post->post_date_gmt. ' GMT'), 'publish_future_post', array($post->ID));
     3545    wp_schedule_single_event( strtotime( $post->post_date_gmt. ' GMT' ), 'publish_future_post', array( $post->ID ) );
    35443546}
    35453547
  • trunk/wp-includes/widgets.php

    r12537 r12584  
    986986function wp_get_sidebars_widgets($deprecated = true) {
    987987    if ( $deprecated !== true )
    988         _deprecated_argument(__FUNCTION__, 'deprecated', '0.0');
     988        _deprecated_argument( __FUNCTION__, '0.0' );
    989989
    990990    global $wp_registered_widgets, $wp_registered_sidebars, $_wp_sidebars_widgets;
Note: See TracChangeset for help on using the changeset viewer.