Ticket #17559: do_deprecated_action.diff
File do_deprecated_action.diff, 12.8 KB (added by , 13 years ago) |
---|
-
wp-signup.php
210 210 } 211 211 212 212 $public = (int) $_POST['blog_public']; 213 $meta = apply_ filters( 'signup_create_blog_meta', array( 'lang_id' => 1, 'public' => $public ) ); // deprecated213 $meta = apply_deprecated_filters( 'signup_create_blog_meta', '0.0', 'add_signup_meta', array( array( 'lang_id' => 1, 'public' => $public ) ) ); 214 214 $meta = apply_filters( 'add_signup_meta', $meta ); 215 215 216 216 wpmu_create_blog( $domain, $path, $blog_title, $current_user->id, $meta, $wpdb->siteid ); -
wp-login.php
194 194 $user_login = $user_data->user_login; 195 195 $user_email = $user_data->user_email; 196 196 197 do_ action('retreive_password', $user_login); // Misspelled and deprecated197 do_deprecated_action('retreive_password', '0.0', 'retrieve_password', array( $user_login ) ); // Misspelled 198 198 do_action('retrieve_password', $user_login); 199 199 200 200 $allow = apply_filters('allow_password_reset', true, $user_data->ID); -
wp-includes/plugin.php
785 785 } 786 786 } 787 787 788 /** 789 * Fire a deprecated filter. Wraps apply_filters(). 790 * 791 * @since 3.2.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 */ 799 function 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.2.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 */ 818 function 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.2.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 */ 853 function _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 788 864 ?> -
wp-includes/post.php
4104 4104 return ' 1 = 0 '; 4105 4105 4106 4106 // This hook is deprecated. Why you'd want to use it, I dunno. 4107 if ( ! $cap = apply_ filters( 'pub_priv_sql_capability', '') )4107 if ( ! $cap = apply_deprecated_filters( 'pub_priv_sql_capability', '3.2', false, array( '' ) ) ) 4108 4108 $cap = $post_type_obj->cap->read_private_posts; 4109 4109 4110 4110 if ( $full ) { … … 4451 4451 * @since 2.3.0 4452 4452 * @access private 4453 4453 * @uses $wpdb 4454 * @uses do_action() Calls 'private_to_published' on post ID if this is a 'private_to_published' call.4455 4454 * @uses wp_clear_scheduled_hook() with 'publish_future_post' and post ID. 4456 4455 * 4457 4456 * @param string $new_status New post status … … 4465 4464 // Reset GUID if transitioning to publish and it is empty 4466 4465 if ( '' == get_the_guid($post->ID) ) 4467 4466 $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) ); 4468 do_ action('private_to_published', $post->ID); // Deprecated, use private_to_publish4467 do_deprecated_action( 'private_to_published', '0.0', 'private_to_publish', array( $post->ID ) ); 4469 4468 } 4470 4469 4471 4470 // If published posts changed clear the lastpostmodified cache -
wp-includes/functions.php
3432 3432 trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version ) . $message ); 3433 3433 } 3434 3434 } 3435 3435 3436 /** 3436 3437 * Marks a function argument as deprecated and informs when it has been used. 3437 3438 * -
wp-includes/rewrite.php
1671 1671 1672 1672 $rules .= "</IfModule>\n"; 1673 1673 1674 $rules = apply_filters( 'mod_rewrite_rules', $rules);1675 $rules = apply_ filters('rewrite_rules', $rules); // Deprecated1674 $rules = apply_filters( 'mod_rewrite_rules', $rules ); 1675 $rules = apply_deprecated_filters( 'rewrite_rules', array( $rules ), '0.0', 'mod_rewrite_rules' ); 1676 1676 1677 1677 return $rules; 1678 1678 } -
wp-includes/class-wp.php
397 397 398 398 // query_string filter deprecated. Use request filter instead. 399 399 if ( has_filter('query_string') ) { // Don't bother filtering and parsing if no plugins are hooked in. 400 $this->query_string = apply_ filters('query_string', $this->query_string);400 $this->query_string = apply_deprecated_filters( 'query_string', array( $this->query_string ), '3.2', 'request' ); 401 401 parse_str($this->query_string, $this->query_vars); 402 402 } 403 403 } -
wp-admin/includes/post.php
1637 1637 $compressed = $compress_scripts && $concatenate_scripts && isset($_SERVER['HTTP_ACCEPT_ENCODING']) 1638 1638 && false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'); 1639 1639 1640 /* *1640 /* 1641 1641 * Deprecated 1642 1642 * 1643 1643 * The tiny_mce_version filter is not needed since external plugins are loaded directly by TinyMCE. 1644 1644 * These plugins can be refreshed by appending query string to the URL passed to mce_external_plugins filter. 1645 1645 * If the plugin has a popup dialog, a query string can be added to the button action that opens it (in the plugin's code). 1646 1646 */ 1647 $version = apply_ filters('tiny_mce_version', '');1647 $version = apply_deprecated_filters( 'tiny_mce_version', array( '' ), '0.0', 'mce_external_plugins' ); 1648 1648 $version = 'ver=' . $tinymce_version . $version; 1649 1649 1650 1650 if ( 'en' != $language ) -
wp-admin/edit-tags.php
312 312 if ( current_user_can($tax->cap->edit_terms) ) { 313 313 // Back compat hooks. Deprecated in preference to {$taxonomy}_pre_add_form 314 314 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' ); 316 316 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' ); 318 318 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' ); // [sic] 320 320 321 do_action( $taxonomy . '_pre_add_form', $taxonomy);321 do_action( $taxonomy . '_pre_add_form', $taxonomy ); 322 322 ?> 323 323 324 324 <div class="form-wrap"> … … 366 366 367 367 // Back compat hooks. Deprecated in preference to {$taxonomy}_add_form 368 368 if ( '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' ); 370 370 elseif ( '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' ); 372 372 else 373 do_action( 'add_tag_form', $taxonomy);373 do_action( 'add_tag_form', array( $taxonomy ), '3.0', '{$taxonomy}_add_form' ); // [sic] 374 374 375 do_action( $taxonomy . '_add_form', $taxonomy);375 do_action( $taxonomy . '_add_form', $taxonomy ); 376 376 ?> 377 377 </form></div> 378 378 <?php } ?> -
wp-admin/edit-tag-form.php
18 18 19 19 // Back compat hooks 20 20 if ( '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' ); 22 22 elseif ( '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' ); 24 24 else 25 do_ action('edit_tag_form_pre', $tag);25 do_deprecated_action( 'edit_tag_form_pre', array( $tag ), '3.0', '{$taxonomy}_pre_edit_form' ); // [sic] 26 26 27 do_action( $taxonomy . '_pre_edit_form', $tag, $taxonomy); ?>27 do_action( $taxonomy . '_pre_edit_form', $tag, $taxonomy ); ?> 28 28 29 29 <div class="wrap"> 30 30 <?php screen_icon(); ?> … … 67 67 <?php 68 68 // Back compat hooks 69 69 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' ); 71 71 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' ); 73 73 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' ); // [sic] 75 75 76 do_action( $taxonomy . '_edit_form_fields', $tag, $taxonomy);76 do_action( $taxonomy . '_edit_form_fields', $tag, $taxonomy ); 77 77 ?> 78 78 </table> 79 79 <?php 80 80 // Back compat hooks 81 81 if ( 'category' == $taxonomy ) 82 do_ action('edit_category_form', $tag);82 do_deprecated_action( 'edit_category_form', array( $tag ), '3.0', 'category_edit_form' ); 83 83 elseif ( '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' ); 85 85 else 86 do_ action('edit_tag_form', $tag);86 do_deprecated_action( 'edit_tag_form', array( $tag ), '3.0', '{$taxonomy}_edit_form' ); // [sic] 87 87 88 do_action( $taxonomy . '_edit_form', $tag, $taxonomy);88 do_action( $taxonomy . '_edit_form', $tag, $taxonomy ); 89 89 90 90 submit_button( __('Update') ); 91 91 ?>