WordPress.org

Make WordPress Core

Ticket #10441: 10441.do_deprecated_action.2.patch

File 10441.do_deprecated_action.2.patch, 11.5 KB (added by SergeyBiryukov, 3 years ago)

Updated @since and expanded [sic] comments

  • wp-admin/edit-tag-form.php

     
    1818 
    1919// Back compat hooks 
    2020if ( 'category' == $taxonomy ) 
    21         do_action('edit_category_form_pre', $tag ); 
     21        do_deprecated_action( 'edit_category_form_pre', array( $tag ), '3.0', 'category_pre_edit_form' ); 
    2222elseif ( 'link_category' == $taxonomy ) 
    23         do_action('edit_link_category_form_pre', $tag ); 
     23        do_deprecated_action( 'edit_link_category_form_pre', array( $tag ), '3.1', 'link_category_pre_edit_form' ); 
    2424else 
    25         do_action('edit_tag_form_pre', $tag); 
     25        do_deprecated_action( 'edit_tag_form_pre', array( $tag ), '3.0', '{$taxonomy}_pre_edit_form' ); // single quotes are correct 
    2626 
    27 do_action($taxonomy . '_pre_edit_form', $tag, $taxonomy);  ?> 
     27do_action( $taxonomy . '_pre_edit_form', $tag, $taxonomy );  ?> 
    2828 
    2929<div class="wrap"> 
    3030<?php screen_icon(); ?> 
     
    6767                <?php 
    6868                // Back compat hooks 
    6969                if ( 'category' == $taxonomy ) 
    70                         do_action('edit_category_form_fields', $tag); 
     70                        do_deprecated_action( 'edit_category_form_fields', array( $tag ), '3.0', 'category_edit_form_fields' ); 
    7171                elseif ( 'link_category' == $taxonomy ) 
    72                         do_action('edit_link_category_form_fields', $tag); 
     72                        do_deprecated_action( 'edit_link_category_form_fields', array( $tag ), '3.1', 'link_category_edit_form_fields' ); 
    7373                else 
    74                         do_action('edit_tag_form_fields', $tag); 
     74                        do_deprecated_action( 'edit_tag_form_fields', array( $tag ), '3.0', '{$taxonomy}_edit_form_fields' ); // single quotes are correct 
    7575 
    76                 do_action($taxonomy . '_edit_form_fields', $tag, $taxonomy); 
     76                do_action( $taxonomy . '_edit_form_fields', $tag, $taxonomy ); 
    7777                ?> 
    7878        </table> 
    7979<?php 
    8080// Back compat hooks 
    8181if ( 'category' == $taxonomy ) 
    82         do_action('edit_category_form', $tag); 
     82        do_deprecated_action( 'edit_category_form', array( $tag ), '3.0', 'category_edit_form' ); 
    8383elseif ( 'link_category' == $taxonomy ) 
    84         do_action('edit_link_category_form', $tag); 
     84        do_deprecated_action( 'edit_link_category_form', array( $tag ), '3.1', 'link_category_edit_form' ); 
    8585else 
    86         do_action('edit_tag_form', $tag); 
     86        do_deprecated_action( 'edit_tag_form', array( $tag ), '3.0', '{$taxonomy}_edit_form' ); // single quotes are correct 
    8787 
    88 do_action($taxonomy . '_edit_form', $tag, $taxonomy); 
     88do_action( $taxonomy . '_edit_form', $tag, $taxonomy ); 
    8989 
    9090submit_button( __('Update') ); 
    9191?> 
  • wp-admin/edit-tags.php

     
    312312if ( current_user_can($tax->cap->edit_terms) ) { 
    313313        // Back compat hooks. Deprecated in preference to {$taxonomy}_pre_add_form 
    314314        if ( 'category' == $taxonomy ) 
    315                 do_action('add_category_form_pre', (object)array('parent' => 0) ); 
     315                do_deprecated_action( 'add_category_form_pre', array( (object)array('parent' => 0) ), '3.0', 'category_pre_add_form' ); 
    316316        elseif ( 'link_category' == $taxonomy ) 
    317                 do_action('add_link_category_form_pre', (object)array('parent' => 0) ); 
     317                do_deprecated_action( 'add_link_category_form_pre', array( (object)array('parent' => 0) ), '3.1', 'link_category_pre_add_form' ); 
    318318        else 
    319                 do_action('add_tag_form_pre', $taxonomy); 
     319                do_deprecated_action( 'add_tag_form_pre', array( $taxonomy ), '3.0', '{$taxonomy}_pre_add_form' ); // single quotes are correct 
    320320 
    321         do_action($taxonomy . '_pre_add_form', $taxonomy); 
     321        do_action( $taxonomy . '_pre_add_form', $taxonomy ); 
    322322?> 
    323323 
    324324<div class="form-wrap"> 
     
    366366 
    367367// Back compat hooks. Deprecated in preference to {$taxonomy}_add_form 
    368368if ( 'category' == $taxonomy ) 
    369         do_action('edit_category_form', (object)array('parent' => 0) ); 
     369        do_deprecated_action( 'edit_category_form', array( (object)array('parent' => 0) ), '3.0', 'category_add_form' ); 
    370370elseif ( 'link_category' == $taxonomy ) 
    371         do_action('edit_link_category_form', (object)array('parent' => 0) ); 
     371        do_deprecated_action( 'edit_link_category_form', array( (object)array('parent' => 0) ), '3.1', 'link_category_add_form' ); 
    372372else 
    373         do_action('add_tag_form', $taxonomy); 
     373        do_action( 'add_tag_form', array( $taxonomy ), '3.0', '{$taxonomy}_add_form' ); // single quotes are correct 
    374374 
    375 do_action($taxonomy . '_add_form', $taxonomy); 
     375do_action( $taxonomy . '_add_form', $taxonomy ); 
    376376?> 
    377377</form></div> 
    378378<?php } ?> 
  • wp-includes/class-wp.php

     
    403403 
    404404                // query_string filter deprecated.  Use request filter instead. 
    405405                if ( has_filter('query_string') ) {  // Don't bother filtering and parsing if no plugins are hooked in. 
    406                         $this->query_string = apply_filters('query_string', $this->query_string); 
     406                        $this->query_string = apply_deprecated_filters( 'query_string', array( $this->query_string ), '3.2', 'request' ); 
    407407                        parse_str($this->query_string, $this->query_vars); 
    408408                } 
    409409        } 
  • wp-includes/plugin.php

     
    785785        } 
    786786} 
    787787 
     788/** 
     789 * Fire a deprecated filter. Wraps apply_filters(). 
     790 * 
     791 * @since 3.3.0 
     792 * 
     793 * @param string $tag The name of the filter hook. 
     794 * @param array $args Array of additional function arguments to be passed to apply_filters(). 
     795 * @param string $version The version of WordPress that deprecated the hook 
     796 * @param string $replacement Optional. The hook that should have been used 
     797 * @param string $message Optional. A message regarding the change 
     798 */ 
     799function apply_deprecated_filters( $tag, $args, $version, $replacement = false, $message = null ) { 
     800        if ( ! has_filter( $tag ) ) 
     801                return; 
     802        _deprecated_hook( $tag, $version, $replacement, $message ); 
     803        array_unshift( $args, $tag ); 
     804        return call_user_func_array( 'apply_filters', $args ); 
     805} 
     806 
     807/** 
     808 * Fire a deprecated action. Wraps do_action(). 
     809 * 
     810 * @since 3.3.0 
     811 * 
     812 * @param string $tag The name of the filter hook. 
     813 * @param array $args Array of additional function arguments to be passed to do_action(). 
     814 * @param string $version The version of WordPress that deprecated the hook 
     815 * @param string $replacement Optional. The hook that should have been used 
     816 * @param string $message Optional. A message regarding the change 
     817 */ 
     818function do_deprecated_action( $tag, $args, $version, $replacement = false, $message = null ) { 
     819        if ( ! has_action( $tag ) ) 
     820                return; 
     821        _deprecated_hook( $tag, $version, $replacement, $message ); 
     822        array_unshift( $args, $tag ); 
     823        call_user_func_array( 'do_action', $args ); 
     824} 
     825 
     826/** 
     827 * Marks a hook as deprecated and informs when it has been used. 
     828 * 
     829 * There is a hook deprecated_hook_used that will be called that can be used 
     830 * to get the backtrace up to what file and function was used for the callback. 
     831 * 
     832 * The current behavior is to trigger a user error if WP_DEBUG is true. 
     833 * 
     834 * This function is to be used for every hook that is deprecated, when any callback is 
     835 * attacked to the hook, as determined by has_action() or has_filter(), and shall be 
     836 * called before the hook is fired. 
     837 * 
     838 * @package WordPress 
     839 * @subpackage Debug 
     840 * @since 3.3.0 
     841 * @access private 
     842 * 
     843 * @uses do_action() Calls 'deprecated_hook_used' and passes the hook name, what to use instead, 
     844 *   the version in which the file was deprecated, and any message regarding the change. 
     845 * @uses apply_filters() Calls 'deprecated_hook_trigger_error' and expects boolean value of true to do 
     846 *   trigger or false to not trigger error. 
     847 * 
     848 * @param string $hook The hook that was used 
     849 * @param string $version The version of WordPress that deprecated the hook 
     850 * @param string $replacement Optional. The hook that should have been used 
     851 * @param string $message Optional. A message regarding the change 
     852 */ 
     853function _deprecated_hook( $hook, $version, $replacement = null, $message = null ) { 
     854        // Allow plugin to filter the output error trigger 
     855        if ( WP_DEBUG && apply_filters( 'deprecated_hook_trigger_error', true ) ) { 
     856                $message = empty( $message ) ? '' : ' ' . $message; 
     857                if ( ! is_null( $replacement ) ) 
     858                        trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $hook, $version, $replacement ) . $message ); 
     859                else 
     860                        trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $hook, $version ) . $message ); 
     861        } 
     862} 
     863 
    788864?> 
  • wp-includes/post.php

     
    41604160                return ' 1 = 0 '; 
    41614161 
    41624162        // This hook is deprecated. Why you'd want to use it, I dunno. 
    4163         if ( ! $cap = apply_filters( 'pub_priv_sql_capability', '' ) ) 
     4163        if ( ! $cap = apply_deprecated_filters( 'pub_priv_sql_capability', array( '' ), '3.2' ) ) 
    41644164                $cap = $post_type_obj->cap->read_private_posts; 
    41654165 
    41664166        if ( $full ) { 
     
    45074507 * @since 2.3.0 
    45084508 * @access private 
    45094509 * @uses $wpdb 
    4510  * @uses do_action() Calls 'private_to_published' on post ID if this is a 'private_to_published' call. 
    45114510 * @uses wp_clear_scheduled_hook() with 'publish_future_post' and post ID. 
    45124511 * 
    45134512 * @param string $new_status New post status 
     
    45214520                // Reset GUID if transitioning to publish and it is empty 
    45224521                if ( '' == get_the_guid($post->ID) ) 
    45234522                        $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) ); 
    4524                 do_action('private_to_published', $post->ID);  // Deprecated, use private_to_publish 
     4523                do_deprecated_action( 'private_to_published', array( $post->ID ), '2.3', 'private_to_publish' ); 
    45254524        } 
    45264525 
    45274526        // If published posts changed clear the lastpostmodified cache 
  • wp-includes/rewrite.php

     
    16541654 
    16551655                $rules .= "</IfModule>\n"; 
    16561656 
    1657                 $rules = apply_filters('mod_rewrite_rules', $rules); 
    1658                 $rules = apply_filters('rewrite_rules', $rules);  // Deprecated 
     1657                $rules = apply_filters( 'mod_rewrite_rules', $rules ); 
     1658                $rules = apply_deprecated_filters( 'rewrite_rules', array( $rules ), '1.5', 'mod_rewrite_rules' ); 
    16591659 
    16601660                return $rules; 
    16611661        } 
  • wp-login.php

     
    194194        $user_login = $user_data->user_login; 
    195195        $user_email = $user_data->user_email; 
    196196 
    197         do_action('retreive_password', $user_login);  // Misspelled and deprecated 
     197        do_deprecated_action( 'retreive_password', array( $user_login ), '1.5.1', 'retrieve_password' ); // Misspelled 
    198198        do_action('retrieve_password', $user_login); 
    199199 
    200200        $allow = apply_filters('allow_password_reset', true, $user_data->ID); 
  • wp-signup.php

     
    210210        } 
    211211 
    212212        $public = (int) $_POST['blog_public']; 
    213         $meta = apply_filters( 'signup_create_blog_meta', array( 'lang_id' => 1, 'public' => $public ) ); // deprecated 
     213        $meta = apply_deprecated_filters( 'signup_create_blog_meta', array( array( 'lang_id' => 1, 'public' => $public ) ), 'MU', 'add_signup_meta' ); 
    214214        $meta = apply_filters( 'add_signup_meta', $meta ); 
    215215 
    216216        wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid );