Ticket #25160: 25160-callables.2.patch
File 25160-callables.2.patch, 32.6 KB (added by , 11 years ago) |
---|
-
src/wp-admin/custom-background.php
67 67 if ( ! current_user_can('edit_theme_options') ) 68 68 return; 69 69 70 $this->page = $page = add_theme_page(__('Background'), __('Background'), 'edit_theme_options', 'custom-background', array( &$this, 'admin_page'));70 $this->page = $page = add_theme_page(__('Background'), __('Background'), 'edit_theme_options', 'custom-background', array($this, 'admin_page')); 71 71 72 add_action("load-$page", array( &$this, 'admin_load'));73 add_action("load-$page", array( &$this, 'take_action'), 49);74 add_action("load-$page", array( &$this, 'handle_upload'), 49);72 add_action("load-$page", array($this, 'admin_load')); 73 add_action("load-$page", array($this, 'take_action'), 49); 74 add_action("load-$page", array($this, 'handle_upload'), 49); 75 75 76 76 if ( $this->admin_header_callback ) 77 77 add_action("admin_head-$page", $this->admin_header_callback, 51); -
src/wp-admin/custom-header.php
84 84 if ( ! current_user_can('edit_theme_options') ) 85 85 return; 86 86 87 $this->page = $page = add_theme_page(__('Header'), __('Header'), 'edit_theme_options', 'custom-header', array( &$this, 'admin_page'));87 $this->page = $page = add_theme_page(__('Header'), __('Header'), 'edit_theme_options', 'custom-header', array($this, 'admin_page')); 88 88 89 add_action("admin_print_scripts-$page", array( &$this, 'js_includes'));90 add_action("admin_print_styles-$page", array( &$this, 'css_includes'));91 add_action("admin_head-$page", array( &$this, 'help') );92 add_action("admin_head-$page", array( &$this, 'take_action'), 50);93 add_action("admin_head-$page", array( &$this, 'js'), 50);89 add_action("admin_print_scripts-$page", array($this, 'js_includes')); 90 add_action("admin_print_styles-$page", array($this, 'css_includes')); 91 add_action("admin_head-$page", array($this, 'help') ); 92 add_action("admin_head-$page", array($this, 'take_action'), 50); 93 add_action("admin_head-$page", array($this, 'js'), 50); 94 94 if ( $this->admin_header_callback ) 95 95 add_action("admin_head-$page", $this->admin_header_callback, 51); 96 96 } -
src/wp-admin/includes/class-wp-importer.php
179 179 */ 180 180 function get_page( $url, $username = '', $password = '', $head = false ) { 181 181 // Increase the timeout 182 add_filter( 'http_request_timeout', array( &$this, 'bump_request_timeout' ) );182 add_filter( 'http_request_timeout', array( $this, 'bump_request_timeout' ) ); 183 183 184 184 $headers = array(); 185 185 $args = array(); -
src/wp-admin/includes/class-wp-list-table.php
87 87 88 88 $this->screen = convert_to_screen( $args['screen'] ); 89 89 90 add_filter( "manage_{$this->screen->id}_columns", array( &$this, 'get_columns' ), 0 );90 add_filter( "manage_{$this->screen->id}_columns", array( $this, 'get_columns' ), 0 ); 91 91 92 92 if ( !$args['plural'] ) 93 93 $args['plural'] = $this->screen->base; … … 99 99 100 100 if ( $args['ajax'] ) { 101 101 // wp_enqueue_script( 'list-table' ); 102 add_action( 'admin_footer', array( &$this, '_js_vars' ) );102 add_action( 'admin_footer', array( $this, '_js_vars' ) ); 103 103 } 104 104 } 105 105 … … 857 857 } 858 858 elseif ( method_exists( $this, 'column_' . $column_name ) ) { 859 859 echo "<td $attributes>"; 860 echo call_user_func( array( &$this, 'column_' . $column_name ), $item );860 echo call_user_func( array( $this, 'column_' . $column_name ), $item ); 861 861 echo "</td>"; 862 862 } 863 863 else { -
src/wp-admin/includes/class-wp-ms-themes-list-table.php
84 84 85 85 if ( $s ) { 86 86 $status = 'search'; 87 $themes['search'] = array_filter( array_merge( $themes['all'], $themes['broken'] ), array( &$this, '_search_callback' ) );87 $themes['search'] = array_filter( array_merge( $themes['all'], $themes['broken'] ), array( $this, '_search_callback' ) ); 88 88 } 89 89 90 90 $totals = array(); … … 108 108 if ( 'ASC' == $order ) 109 109 $this->items = array_reverse( $this->items ); 110 110 } else { 111 uasort( $this->items, array( &$this, '_order_callback' ) );111 uasort( $this->items, array( $this, '_order_callback' ) ); 112 112 } 113 113 } 114 114 -
src/wp-admin/includes/class-wp-plugins-list-table.php
99 99 100 100 if ( $s ) { 101 101 $status = 'search'; 102 $plugins['search'] = array_filter( $plugins['all'], array( &$this, '_search_callback' ) );102 $plugins['search'] = array_filter( $plugins['all'], array( $this, '_search_callback' ) ); 103 103 } 104 104 105 105 $totals = array(); … … 121 121 $orderby = ucfirst( $orderby ); 122 122 $order = strtoupper( $order ); 123 123 124 uasort( $this->items, array( &$this, '_order_callback' ) );124 uasort( $this->items, array( $this, '_order_callback' ) ); 125 125 } 126 126 127 127 $plugins_per_page = $this->get_items_per_page( str_replace( '-', '_', $screen->id . '_per_page' ), 999 ); -
src/wp-admin/includes/class-wp-upgrader.php
402 402 $this->init(); 403 403 $this->install_strings(); 404 404 405 add_filter('upgrader_source_selection', array( &$this, 'check_package') );405 add_filter('upgrader_source_selection', array($this, 'check_package') ); 406 406 407 407 $this->run(array( 408 408 'package' => $package, … … 412 412 'hook_extra' => array() 413 413 )); 414 414 415 remove_filter('upgrader_source_selection', array( &$this, 'check_package') );415 remove_filter('upgrader_source_selection', array($this, 'check_package') ); 416 416 417 417 if ( ! $this->result || is_wp_error($this->result) ) 418 418 return $this->result; … … 442 442 // Get the URL to the zip file 443 443 $r = $current->response[ $plugin ]; 444 444 445 add_filter('upgrader_pre_install', array( &$this, 'deactivate_plugin_before_upgrade'), 10, 2);446 add_filter('upgrader_clear_destination', array( &$this, 'delete_old_plugin'), 10, 4);447 //'source_selection' => array( &$this, 'source_selection'), //there's a trac ticket to move up the directory for zip's which are made a bit differently, useful for non-.org plugins.445 add_filter('upgrader_pre_install', array($this, 'deactivate_plugin_before_upgrade'), 10, 2); 446 add_filter('upgrader_clear_destination', array($this, 'delete_old_plugin'), 10, 4); 447 //'source_selection' => array($this, 'source_selection'), //there's a trac ticket to move up the directory for zip's which are made a bit differently, useful for non-.org plugins. 448 448 449 449 $this->run(array( 450 450 'package' => $r->package, … … 457 457 )); 458 458 459 459 // Cleanup our hooks, in case something else does a upgrade on this connection. 460 remove_filter('upgrader_pre_install', array( &$this, 'deactivate_plugin_before_upgrade'));461 remove_filter('upgrader_clear_destination', array( &$this, 'delete_old_plugin'));460 remove_filter('upgrader_pre_install', array($this, 'deactivate_plugin_before_upgrade')); 461 remove_filter('upgrader_clear_destination', array($this, 'delete_old_plugin')); 462 462 463 463 if ( ! $this->result || is_wp_error($this->result) ) 464 464 return $this->result; … … 477 477 478 478 $current = get_site_transient( 'update_plugins' ); 479 479 480 add_filter('upgrader_clear_destination', array( &$this, 'delete_old_plugin'), 10, 4);480 add_filter('upgrader_clear_destination', array($this, 'delete_old_plugin'), 10, 4); 481 481 482 482 $this->skin->header(); 483 483 … … 547 547 $this->skin->footer(); 548 548 549 549 // Cleanup our hooks, in case something else does a upgrade on this connection. 550 remove_filter('upgrader_clear_destination', array( &$this, 'delete_old_plugin'));550 remove_filter('upgrader_clear_destination', array($this, 'delete_old_plugin')); 551 551 552 552 // Force refresh of plugin update information 553 553 delete_site_transient('update_plugins'); … … 711 711 if ( ! $api || is_wp_error($api) ) { 712 712 $this->skin->feedback( 'parent_theme_not_found', $theme_info->get('Template') ); 713 713 // Don't show activate or preview actions after install 714 add_filter('install_theme_complete_actions', array( &$this, 'hide_activate_preview_actions') );714 add_filter('install_theme_complete_actions', array($this, 'hide_activate_preview_actions') ); 715 715 return $install_result; 716 716 } 717 717 … … 736 736 ) ); 737 737 738 738 if ( is_wp_error($parent_result) ) 739 add_filter('install_theme_complete_actions', array( &$this, 'hide_activate_preview_actions') );739 add_filter('install_theme_complete_actions', array($this, 'hide_activate_preview_actions') ); 740 740 741 741 // Start cleaning up after the parents installation 742 742 remove_filter('install_theme_complete_actions', '__return_false', 999); … … 759 759 $this->init(); 760 760 $this->install_strings(); 761 761 762 add_filter('upgrader_source_selection', array( &$this, 'check_package') );763 add_filter('upgrader_post_install', array( &$this, 'check_parent_theme_filter'), 10, 3);762 add_filter('upgrader_source_selection', array($this, 'check_package') ); 763 add_filter('upgrader_post_install', array($this, 'check_parent_theme_filter'), 10, 3); 764 764 765 765 $options = array( 766 766 'package' => $package, … … 771 771 772 772 $this->run($options); 773 773 774 remove_filter('upgrader_source_selection', array( &$this, 'check_package') );775 remove_filter('upgrader_post_install', array( &$this, 'check_parent_theme_filter'));774 remove_filter('upgrader_source_selection', array($this, 'check_package') ); 775 remove_filter('upgrader_post_install', array($this, 'check_parent_theme_filter')); 776 776 777 777 if ( ! $this->result || is_wp_error($this->result) ) 778 778 return $this->result; … … 801 801 802 802 $r = $current->response[ $theme ]; 803 803 804 add_filter('upgrader_pre_install', array( &$this, 'current_before'), 10, 2);805 add_filter('upgrader_post_install', array( &$this, 'current_after'), 10, 2);806 add_filter('upgrader_clear_destination', array( &$this, 'delete_old_theme'), 10, 4);804 add_filter('upgrader_pre_install', array($this, 'current_before'), 10, 2); 805 add_filter('upgrader_post_install', array($this, 'current_after'), 10, 2); 806 add_filter('upgrader_clear_destination', array($this, 'delete_old_theme'), 10, 4); 807 807 808 808 $options = array( 809 809 'package' => $r['package'], … … 817 817 818 818 $this->run($options); 819 819 820 remove_filter('upgrader_pre_install', array( &$this, 'current_before'));821 remove_filter('upgrader_post_install', array( &$this, 'current_after'));822 remove_filter('upgrader_clear_destination', array( &$this, 'delete_old_theme'));820 remove_filter('upgrader_pre_install', array($this, 'current_before')); 821 remove_filter('upgrader_post_install', array($this, 'current_after')); 822 remove_filter('upgrader_clear_destination', array($this, 'delete_old_theme')); 823 823 824 824 if ( ! $this->result || is_wp_error($this->result) ) 825 825 return $this->result; … … 839 839 840 840 $current = get_site_transient( 'update_themes' ); 841 841 842 add_filter('upgrader_pre_install', array( &$this, 'current_before'), 10, 2);843 add_filter('upgrader_post_install', array( &$this, 'current_after'), 10, 2);844 add_filter('upgrader_clear_destination', array( &$this, 'delete_old_theme'), 10, 4);842 add_filter('upgrader_pre_install', array($this, 'current_before'), 10, 2); 843 add_filter('upgrader_post_install', array($this, 'current_after'), 10, 2); 844 add_filter('upgrader_clear_destination', array($this, 'delete_old_theme'), 10, 4); 845 845 846 846 $this->skin->header(); 847 847 … … 911 911 $this->skin->footer(); 912 912 913 913 // Cleanup our hooks, in case something else does a upgrade on this connection. 914 remove_filter('upgrader_pre_install', array( &$this, 'current_before'));915 remove_filter('upgrader_post_install', array( &$this, 'current_after'));916 remove_filter('upgrader_clear_destination', array( &$this, 'delete_old_theme'));914 remove_filter('upgrader_pre_install', array($this, 'current_before')); 915 remove_filter('upgrader_post_install', array($this, 'current_after')); 916 remove_filter('upgrader_clear_destination', array($this, 'delete_old_theme')); 917 917 918 918 // Force refresh of theme update information 919 919 wp_clean_themes_cache(); -
src/wp-admin/includes/list-table.php
95 95 96 96 if ( !empty( $columns ) ) { 97 97 $this->_columns = $columns; 98 add_filter( 'manage_' . $screen->id . '_columns', array( &$this, 'get_columns' ), 0 );98 add_filter( 'manage_' . $screen->id . '_columns', array( $this, 'get_columns' ), 0 ); 99 99 } 100 100 } 101 101 -
tests/phpunit/includes/utils.php
133 133 $this->xml = xml_parser_create(); 134 134 xml_set_object($this->xml, $this); 135 135 xml_parser_set_option($this->xml,XML_OPTION_CASE_FOLDING, 0); 136 xml_set_element_handler($this->xml, array( &$this, 'startHandler'), array(&$this, 'endHandler'));137 xml_set_character_data_handler($this->xml, array( &$this, 'dataHandler'));136 xml_set_element_handler($this->xml, array($this, 'startHandler'), array($this, 'endHandler')); 137 xml_set_character_data_handler($this->xml, array($this, 'dataHandler')); 138 138 $this->parse($in); 139 139 } 140 140 -
tests/phpunit/includes/wp-profiler.php
32 32 33 33 if (!$this->stack) { 34 34 // log all actions and filters 35 add_filter('all', array( &$this, 'log_filter'));35 add_filter('all', array($this, 'log_filter')); 36 36 } 37 37 38 38 // reset the wpdb queries log, storing it on the profile stack if necessary … … 101 101 } 102 102 103 103 if (!$this->stack) { 104 remove_filter('all', array( &$this, 'log_filter'));104 remove_filter('all', array($this, 'log_filter')); 105 105 } 106 106 } 107 107 -
tests/phpunit/tests/admin/includesTheme.php
10 10 $this->orig_theme_dir = $GLOBALS['wp_theme_directories']; 11 11 $GLOBALS['wp_theme_directories'] = array( WP_CONTENT_DIR . '/themes', $this->theme_root ); 12 12 13 add_filter('theme_root', array( &$this, '_theme_root'));14 add_filter( 'stylesheet_root', array( &$this, '_theme_root') );15 add_filter( 'template_root', array( &$this, '_theme_root') );13 add_filter('theme_root', array($this, '_theme_root')); 14 add_filter( 'stylesheet_root', array($this, '_theme_root') ); 15 add_filter( 'template_root', array($this, '_theme_root') ); 16 16 17 17 // clear caches 18 18 wp_clean_themes_cache(); … … 21 21 22 22 function tearDown() { 23 23 $GLOBALS['wp_theme_directories'] = $this->orig_theme_dir; 24 remove_filter('theme_root', array( &$this, '_theme_root'));25 remove_filter( 'stylesheet_root', array( &$this, '_theme_root') );26 remove_filter( 'template_root', array( &$this, '_theme_root') );24 remove_filter('theme_root', array($this, '_theme_root')); 25 remove_filter( 'stylesheet_root', array($this, '_theme_root') ); 26 remove_filter( 'template_root', array($this, '_theme_root') ); 27 27 28 28 wp_clean_themes_cache(); 29 29 unset( $GLOBALS['wp_themes'] ); -
tests/phpunit/tests/filters.php
12 12 $tag = rand_str(); 13 13 $val = rand_str(); 14 14 15 add_filter($tag, array( &$a, 'filter'));15 add_filter($tag, array($a, 'filter')); 16 16 $this->assertEquals($val, apply_filters($tag, $val)); 17 17 18 18 // only one event occurred for the hook, with empty args … … 29 29 $tag = rand_str(); 30 30 $val = rand_str(); 31 31 32 add_filter($tag, array( &$a, 'filter'));32 add_filter($tag, array($a, 'filter')); 33 33 $this->assertEquals($val, apply_filters($tag, $val)); 34 34 35 35 // make sure our hook was called correctly … … 37 37 $this->assertEquals(array($tag), $a->get_tags()); 38 38 39 39 // now remove the filter, do it again, and make sure it's not called this time 40 remove_filter($tag, array( &$a, 'filter'));40 remove_filter($tag, array($a, 'filter')); 41 41 $this->assertEquals($val, apply_filters($tag, $val)); 42 42 $this->assertEquals(1, $a->get_call_count()); 43 43 $this->assertEquals(array($tag), $a->get_tags()); … … 66 66 $val = rand_str(); 67 67 68 68 // add both filters to the hook 69 add_filter($tag, array( &$a1, 'filter'));70 add_filter($tag, array( &$a2, 'filter'));69 add_filter($tag, array($a1, 'filter')); 70 add_filter($tag, array($a2, 'filter')); 71 71 72 72 $this->assertEquals($val, apply_filters($tag, $val)); 73 73 … … 82 82 $val = rand_str(); 83 83 $arg1 = rand_str(); 84 84 85 add_filter($tag, array( &$a, 'filter'), 10, 2);85 add_filter($tag, array($a, 'filter'), 10, 2); 86 86 // call the filter with a single argument 87 87 $this->assertEquals($val, apply_filters($tag, $val, $arg1)); 88 88 … … 99 99 $arg2 = rand_str(); 100 100 101 101 // a1 accepts two arguments, a2 doesn't 102 add_filter($tag, array( &$a1, 'filter'), 10, 3);103 add_filter($tag, array( &$a2, 'filter'));102 add_filter($tag, array($a1, 'filter'), 10, 3); 103 add_filter($tag, array($a2, 'filter')); 104 104 // call the filter with two arguments 105 105 $this->assertEquals($val, apply_filters($tag, $val, $arg1, $arg2)); 106 106 … … 119 119 $val = rand_str(); 120 120 121 121 // make two filters with different priorities 122 add_filter($tag, array( &$a, 'filter'), 10);123 add_filter($tag, array( &$a, 'filter2'), 9);122 add_filter($tag, array($a, 'filter'), 10); 123 add_filter($tag, array($a, 'filter2'), 9); 124 124 $this->assertEquals($val, apply_filters($tag, $val)); 125 125 126 126 // there should be two events, one per filter … … 151 151 $val = rand_str(); 152 152 153 153 // add an 'all' filter 154 add_filter('all', array( &$a, 'filterall'));154 add_filter('all', array($a, 'filterall')); 155 155 // do some filters 156 156 $this->assertEquals($val, apply_filters($tag1, $val)); 157 157 $this->assertEquals($val, apply_filters($tag2, $val)); … … 163 163 // the right hooks should have been called in order 164 164 $this->assertEquals(array($tag1, $tag2, $tag1, $tag1), $a->get_tags()); 165 165 166 remove_filter('all', array( &$a, 'filterall'));167 $this->assertFalse( has_filter('all', array( &$a, 'filterall')) );166 remove_filter('all', array($a, 'filterall')); 167 $this->assertFalse( has_filter('all', array($a, 'filterall')) ); 168 168 169 169 } 170 170 … … 173 173 $tag = rand_str(); 174 174 $val = rand_str(); 175 175 176 add_filter('all', array( &$a, 'filterall'));176 add_filter('all', array($a, 'filterall')); 177 177 $this->assertTrue( has_filter('all') ); 178 $this->assertEquals( 10, has_filter('all', array( &$a, 'filterall')) );178 $this->assertEquals( 10, has_filter('all', array($a, 'filterall')) ); 179 179 $this->assertEquals($val, apply_filters($tag, $val)); 180 180 181 181 // make sure our hook was called correctly … … 183 183 $this->assertEquals(array($tag), $a->get_tags()); 184 184 185 185 // now remove the filter, do it again, and make sure it's not called this time 186 remove_filter('all', array( &$a, 'filterall'));187 $this->assertFalse( has_filter('all', array( &$a, 'filterall')) );186 remove_filter('all', array($a, 'filterall')); 187 $this->assertFalse( has_filter('all', array($a, 'filterall')) ); 188 188 $this->assertFalse( has_filter('all') ); 189 189 $this->assertEquals($val, apply_filters($tag, $val)); 190 190 // call cound should remain at 1 … … 200 200 $a = new MockAction(); 201 201 $tag = rand_str(); 202 202 203 add_action($tag, array( &$a, 'filter'));203 add_action($tag, array($a, 'filter')); 204 204 205 205 apply_filters_ref_array($tag, array(&$obj)); 206 206 … … 220 220 $b = new MockAction(); 221 221 $tag = rand_str(); 222 222 223 add_action($tag, array( &$a, 'filter_append'), 10, 2);224 add_action($tag, array( &$b, 'filter_append'), 10, 2);223 add_action($tag, array($a, 'filter_append'), 10, 2); 224 add_action($tag, array($b, 'filter_append'), 10, 2); 225 225 226 226 $result = apply_filters_ref_array($tag, array('string', &$obj)); 227 227 … … 242 242 } 243 243 244 244 function _self_removal($tag) { 245 remove_action( $tag, array( &$this, '_self_removal'), 10, 1 );245 remove_action( $tag, array($this, '_self_removal'), 10, 1 ); 246 246 return $tag; 247 247 } 248 248 … … 254 254 $a = new MockAction(); 255 255 $b = new MockAction(); 256 256 257 add_action( $tag, array( &$a, 'filter_append'), 11, 1 );258 add_action( $tag, array( &$b, 'filter_append'), 12, 1 );259 add_action( $tag, array( &$this, '_self_removal'), 10, 1 );257 add_action( $tag, array($a, 'filter_append'), 11, 1 ); 258 add_action( $tag, array($b, 'filter_append'), 12, 1 ); 259 add_action( $tag, array($this, '_self_removal'), 10, 1 ); 260 260 261 261 $result = apply_filters($tag, $tag); 262 262 $this->assertEquals( 1, $a->get_call_count(), 'priority 11 filters should run after priority 10 empties itself' ); -
tests/phpunit/tests/meta.php
19 19 $meta = sanitize_meta( 'some_meta', 'unsanitized', 'post' ); 20 20 $this->assertEquals( 'unsanitized', $meta ); 21 21 22 register_meta( 'post', 'some_meta', array( &$this, '_meta_sanitize_cb' ) );22 register_meta( 'post', 'some_meta', array( $this, '_meta_sanitize_cb' ) ); 23 23 $meta = sanitize_meta( 'some_meta', 'unsanitized', 'post' ); 24 24 $this->assertEquals( 'sanitized', $meta ); 25 25 } -
tests/phpunit/tests/theme/WPTheme.php
10 10 $this->orig_theme_dir = $GLOBALS['wp_theme_directories']; 11 11 $GLOBALS['wp_theme_directories'] = array( $this->theme_root ); 12 12 13 add_filter('theme_root', array( &$this, '_theme_root'));14 add_filter( 'stylesheet_root', array( &$this, '_theme_root') );15 add_filter( 'template_root', array( &$this, '_theme_root') );13 add_filter('theme_root', array($this, '_theme_root')); 14 add_filter( 'stylesheet_root', array($this, '_theme_root') ); 15 add_filter( 'template_root', array($this, '_theme_root') ); 16 16 // clear caches 17 17 wp_clean_themes_cache(); 18 18 unset( $GLOBALS['wp_themes'] ); … … 20 20 21 21 function tearDown() { 22 22 $GLOBALS['wp_theme_directories'] = $this->orig_theme_dir; 23 remove_filter('theme_root', array( &$this, '_theme_root'));24 remove_filter( 'stylesheet_root', array( &$this, '_theme_root') );25 remove_filter( 'template_root', array( &$this, '_theme_root') );23 remove_filter('theme_root', array($this, '_theme_root')); 24 remove_filter( 'stylesheet_root', array($this, '_theme_root') ); 25 remove_filter( 'template_root', array($this, '_theme_root') ); 26 26 wp_clean_themes_cache(); 27 27 unset( $GLOBALS['wp_themes'] ); 28 28 parent::tearDown(); -
tests/phpunit/tests/theme/themeDir.php
15 15 // /themes is necessary as theme.php functions assume /themes is the root if there is only one root. 16 16 $GLOBALS['wp_theme_directories'] = array( WP_CONTENT_DIR . '/themes', $this->theme_root ); 17 17 18 add_filter('theme_root', array( &$this, '_theme_root'));19 add_filter( 'stylesheet_root', array( &$this, '_theme_root') );20 add_filter( 'template_root', array( &$this, '_theme_root') );18 add_filter('theme_root', array($this, '_theme_root')); 19 add_filter( 'stylesheet_root', array($this, '_theme_root') ); 20 add_filter( 'template_root', array($this, '_theme_root') ); 21 21 // clear caches 22 22 wp_clean_themes_cache(); 23 23 unset( $GLOBALS['wp_themes'] ); … … 25 25 26 26 function tearDown() { 27 27 $GLOBALS['wp_theme_directories'] = $this->orig_theme_dir; 28 remove_filter('theme_root', array( &$this, '_theme_root'));29 remove_filter( 'stylesheet_root', array( &$this, '_theme_root') );30 remove_filter( 'template_root', array( &$this, '_theme_root') );28 remove_filter('theme_root', array($this, '_theme_root')); 29 remove_filter( 'stylesheet_root', array($this, '_theme_root') ); 30 remove_filter( 'template_root', array($this, '_theme_root') ); 31 31 wp_clean_themes_cache(); 32 32 unset( $GLOBALS['wp_themes'] ); 33 33 parent::tearDown(); -
tests/phpunit/tests/user/capabilities.php
508 508 $this->assertFalse( $admin->has_cap('add_post_meta', $post, '_protected') ); 509 509 $this->assertFalse( $admin->has_cap('delete_post_meta', $post, '_protected') ); 510 510 511 register_meta( 'post', '_protected', array( &$this, '_meta_filter' ), array( &$this, '_meta_yes_you_can' ) );511 register_meta( 'post', '_protected', array( $this, '_meta_filter' ), array( $this, '_meta_yes_you_can' ) ); 512 512 $this->assertTrue( $admin->has_cap('edit_post_meta', $post, '_protected') ); 513 513 $this->assertTrue( $admin->has_cap('add_post_meta', $post, '_protected') ); 514 514 $this->assertTrue( $admin->has_cap('delete_post_meta', $post, '_protected') ); … … 517 517 $this->assertTrue( $admin->has_cap('add_post_meta', $post, 'not_protected') ); 518 518 $this->assertTrue( $admin->has_cap('delete_post_meta', $post, 'not_protected') ); 519 519 520 register_meta( 'post', 'not_protected', array( &$this, '_meta_filter' ), array( &$this, '_meta_no_you_cant' ) );520 register_meta( 'post', 'not_protected', array( $this, '_meta_filter' ), array( $this, '_meta_no_you_cant' ) ); 521 521 $this->assertFalse( $admin->has_cap('edit_post_meta', $post, 'not_protected') ); 522 522 $this->assertFalse( $admin->has_cap('add_post_meta', $post, 'not_protected') ); 523 523 $this->assertFalse( $admin->has_cap('delete_post_meta', $post, 'not_protected') ); -
tools/i18n/makepot.php
237 237 return $this->wp_generic( $dir, array( 238 238 'project' => 'wp-core', 'output' => $output, 239 239 'extract_not_gettexted' => true, 240 'not_gettexted_files_filter' => array( &$this, 'is_not_ms_file' ),240 'not_gettexted_files_filter' => array( $this, 'is_not_ms_file' ), 241 241 ) ); 242 242 } 243 243 … … 340 340 'includes' => $this->ms_files, 'excludes' => array(), 341 341 'default_output' => 'wordpress-ms.pot', 342 342 'extract_not_gettexted' => true, 343 'not_gettexted_files_filter' => array( &$this, 'is_ms_file' ),343 'not_gettexted_files_filter' => array( $this, 'is_ms_file' ), 344 344 ) ); 345 345 if ( !$ms_result ) { 346 346 return false; … … 557 557 if ($included_files[0] == __FILE__) { 558 558 $makepot = new MakePOT; 559 559 if ((3 == count($argv) || 4 == count($argv)) && in_array($method = str_replace('-', '_', $argv[1]), get_class_methods($makepot))) { 560 $res = call_user_func(array( &$makepot, $method), realpath($argv[2]), isset($argv[3])? $argv[3] : null);560 $res = call_user_func(array($makepot, $method), realpath($argv[2]), isset($argv[3])? $argv[3] : null); 561 561 if (false === $res) { 562 562 fwrite(STDERR, "Couldn't generate POT file!\n"); 563 563 } -
tools/i18n/not-gettexted.php
59 59 if ('.' == $item || '..' == $item) 60 60 continue; 61 61 if ('.php' == substr($item, -4)) 62 $files[] = $full_item; 62 $files[] = $full_item; 63 63 if (is_dir($full_item)) 64 64 $files += array_merge($files, NotGettexted::list_php_files($full_item, $files)); 65 65 } … … 99 99 continue; 100 100 } 101 101 if ($this->STAGE_START_COMMENT <= $stage && $stage <= $this->STAGE_WHITESPACE_AFTER && '/'.$current_comment_id == $matches[1]) { 102 $stage = $this->STAGE_END_COMMENT; 102 $stage = $this->STAGE_END_COMMENT; 103 103 $this->logmsg('end comment', $current_comment_id); 104 104 $result .= call_user_func($other_action, $token); 105 105 if (!is_null($register_action)) call_user_func($register_action, $current_string, $current_comment_id, $current_string_line); … … 152 152 foreach($filenames as $filename) { 153 153 $tokens = token_get_all(file_get_contents($filename)); 154 154 $aggregator = $this->make_string_aggregator($global_name, $filename); 155 $this->walk_tokens($tokens, array( &$this, 'ignore_token'), array(&$this, 'ignore_token'), $aggregator);155 $this->walk_tokens($tokens, array($this, 'ignore_token'), array($this, 'ignore_token'), $aggregator); 156 156 } 157 157 158 158 $potf = '-' == $pot_filename? STDOUT : @fopen($pot_filename, 'a'); … … 196 196 $source = file_get_contents($filename); 197 197 if ( strlen($source) > 150000 ) continue; 198 198 $tokens = token_get_all($source); 199 $new_file = $this->walk_tokens($tokens, $replacer, array( &$this, 'unchanged_token'));199 $new_file = $this->walk_tokens($tokens, $replacer, array($this, 'unchanged_token')); 200 200 $f = fopen($filename, 'w'); 201 201 fwrite($f, $new_file); 202 202 fclose($f); … … 218 218 $this->usage(); 219 219 exit(1); 220 220 } 221 call_user_func_array(array( &$this, $this->commands[$argv[1]]), array_slice($argv, 2));221 call_user_func_array(array($this, $this->commands[$argv[1]]), array_slice($argv, 2)); 222 222 } 223 223 } 224 224 -
tools/i18n/pot-ext-meta.php
51 51 if ( $headers ) 52 52 $this->headers = (array) $headers; 53 53 if ( is_dir( $ext_filename ) ) { 54 $pot = implode('', array_map(array( &$this, 'load_from_file'), glob("$ext_filename/*.php")));54 $pot = implode('', array_map(array($this, 'load_from_file'), glob("$ext_filename/*.php"))); 55 55 } else { 56 56 $pot = $this->load_from_file($ext_filename); 57 57 } -
tools/i18n/t/NotGettextedTest.php
9 9 require_once dirname( dirname( __FILE__ ) ) . '/not-gettexted.php'; 10 10 11 11 class NotGettextedTest extends PHPUnit_Framework_TestCase { 12 12 13 13 function __construct() { 14 14 $this->ng = new NotGettexted; 15 15 } 16 16 17 17 function test_make_string_aggregator() { 18 18 global $baba; 19 19 $f = $this->ng->make_string_aggregator( 'baba', 'baba.php' ); … … 29 29 echo /* WP_I18N_GUGU*/ "yes" /* /WP_I18N_UGU */; 30 30 if ($x == "18181") { wp_die(sprintf(/*WP_I18N_DIE*/\'We died %d times!\'/*WP_I18N_DIE*/)); } 31 31 ?>'; 32 $tokens = token_get_all($code); 33 $this->assertEquals( '', $this->ng->walk_tokens( $tokens, array( &$this->ng, 'ignore_token'), array(&$this->ng, 'ignore_token') ) );34 $this->assertEquals( '"yes"\'We died %d times!\'', $this->ng->walk_tokens( $tokens, array( &$this->ng, 'unchanged_token'), array(&$this->ng, 'ignore_token') ) );35 $this->assertEquals( $code, $this->ng->walk_tokens( $tokens, array( &$this->ng, 'unchanged_token'), array(&$this->ng, 'unchanged_token') ) );36 $this->assertEquals( $code, $this->ng->walk_tokens( $tokens, array( &$this->ng, 'unchanged_token'), array(&$this->ng, 'unchanged_token') ) );32 $tokens = token_get_all($code); 33 $this->assertEquals( '', $this->ng->walk_tokens( $tokens, array($this->ng, 'ignore_token'), array($this->ng, 'ignore_token') ) ); 34 $this->assertEquals( '"yes"\'We died %d times!\'', $this->ng->walk_tokens( $tokens, array($this->ng, 'unchanged_token'), array($this->ng, 'ignore_token') ) ); 35 $this->assertEquals( $code, $this->ng->walk_tokens( $tokens, array($this->ng, 'unchanged_token'), array($this->ng, 'unchanged_token') ) ); 36 $this->assertEquals( $code, $this->ng->walk_tokens( $tokens, array($this->ng, 'unchanged_token'), array($this->ng, 'unchanged_token') ) ); 37 37 } 38 38 39 39 function test_replace() { … … 43 43 $this->assertEquals( file_get_contents( 'data/not-gettexted-0-result.php' ), file_get_contents( 'data/not-gettexted-0-work.php' ) ); 44 44 unlink( 'data/not-gettexted-0-work.php' ); 45 45 } 46 } 47 No newline at end of file 46 }