Make WordPress Core

Ticket #11386: function-deprecated_argument-sample-uses.diff

File function-deprecated_argument-sample-uses.diff, 4.3 KB (added by nacin, 15 years ago)

Sample uses of _deprecated_argument()

  • author-template.php

     
    4141 * @link http://codex.wordpress.org/Template_Tags/the_author
    4242 *
    4343 * @param string $deprecated Deprecated.
    44  * @param string $deprecated_echo Echo the string or return it.
     44 * @param string $deprecated_echo Deprecated. Use get_the_author(). Echo the string or return it.
    4545 * @return string The author's display name, from get_the_author().
    4646 */
    4747function 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', 'get_the_author');
    4852        if ( $deprecated_echo )
    4953                echo get_the_author();
    5054        return get_the_author();
     
    177181 * @param string $deprecated Deprecated.
    178182 */
    179183function the_author_posts_link($deprecated = '') {
     184        if ( !empty( $deprecated ) )
     185                _deprecated_argument(__FUNCTION__, 'deprecated', '0.0');
     186
    180187        global $authordata;
    181188        $link = sprintf(
    182189                '<a href="%1$s" title="%2$s">%3$s</a>',
  • comment-template.php

     
    503503 *
    504504 * @since 0.71
    505505 *
    506  * @param string $deprecated Not Used
    507  * @param bool $deprecated Not Used
     506 * @param string $deprecated_1 Not Used
     507 * @param bool $deprecated_2 Not Used
    508508 */
    509 function comments_link( $deprecated = '', $deprecated = '' ) {
     509function 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
    510515        echo get_comments_link();
    511516}
    512517
  • comment.php

     
    15111511 * @param int $deprecated Not Used.
    15121512 * @return bool|string False on failure, string containing URI on success.
    15131513 */
    1514 function discover_pingback_server_uri($url, $deprecated = 2048) {
     1514function discover_pingback_server_uri($url, $deprecated = '') {
     1515        if ( !empty($deprecated) )
     1516                _deprecated_argument(__FUNCTION__, 'deprecated', '0.0');
    15151517
    15161518        $pingback_str_dquote = 'rel="pingback"';
    15171519        $pingback_str_squote = 'rel=\'pingback\'';
  • cron.php

     
    135135function wp_clear_scheduled_hook( $hook, $args = array() ) {
    136136        // Backward compatibility
    137137        // Previously this function took the arguments as discrete vars rather than an array like the rest of the API
    138         if ( !is_array($args) )
     138        if ( !is_array($args) ) {
     139                _deprecated_argument(__FUNCTION__, 'args', '3.0.0', 'array');
    139140                $args = array_slice( func_get_args(), 1 );
     141        }
    140142
    141143        while ( $timestamp = wp_next_scheduled( $hook, $args ) )
    142144                wp_unschedule_event( $timestamp, $hook, $args );
  • post-template.php

     
    246246 * @return string
    247247 */
    248248function get_the_excerpt($deprecated = '') {
     249        if ( !empty( $deprecated ) )
     250                _deprecated_argument(__FUNCTION__, 'deprecated', '2.3');
     251
    249252        global $post;
    250253        $output = $post->post_excerpt;
    251254        if ( post_password_required($post) ) {
  • widgets.php

     
    980980 * @since 2.2.0
    981981 * @access private
    982982 *
    983  * @param bool $update Optional, deprecated.
     983 * @param bool $deprecated. Not used.
    984984 * @return array Upgraded list of widgets to version 3 array format when called from the admin.
    985985 */
    986986function wp_get_sidebars_widgets($deprecated = true) {
     987        if ( $deprecated !== true )
     988                _deprecated_argument(__FUNCTION__, 'deprecated', '0.0');
     989
    987990        global $wp_registered_widgets, $wp_registered_sidebars, $_wp_sidebars_widgets;
    988991
    989992        // If loading from front page, consult $_wp_sidebars_widgets rather than options