Objects no longer need to be explicitly passed by ref to call_user_func*() to be callable. Props wonderboymusic. fixes #21865

git-svn-id: http://core.svn.wordpress.org/trunk@22118 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ryan Boren 2012-10-04 20:00:16 +00:00
parent 1f9d02abc6
commit 77518e9c71
13 changed files with 28 additions and 28 deletions

View File

@ -635,7 +635,7 @@ class WP_Object_Cache {
* @todo This should be moved to the PHP4 style constructor, PHP5 * @todo This should be moved to the PHP4 style constructor, PHP5
* already calls __destruct() * already calls __destruct()
*/ */
register_shutdown_function( array( &$this, '__destruct' ) ); register_shutdown_function( array( $this, '__destruct' ) );
} }
/** /**

View File

@ -725,7 +725,7 @@ class WP_User {
//Filter out caps that are not role names and assign to $this->roles //Filter out caps that are not role names and assign to $this->roles
if ( is_array( $this->caps ) ) if ( is_array( $this->caps ) )
$this->roles = array_filter( array_keys( $this->caps ), array( &$wp_roles, 'is_role' ) ); $this->roles = array_filter( array_keys( $this->caps ), array( $wp_roles, 'is_role' ) );
//Build $allcaps from role caps, overlay user's $caps //Build $allcaps from role caps, overlay user's $caps
$this->allcaps = array(); $this->allcaps = array();
@ -1331,7 +1331,7 @@ function author_can( $post, $capability ) {
$args = array_slice( func_get_args(), 2 ); $args = array_slice( func_get_args(), 2 );
$args = array_merge( array( $capability ), $args ); $args = array_merge( array( $capability ), $args );
return call_user_func_array( array( &$author, 'has_cap' ), $args ); return call_user_func_array( array( $author, 'has_cap' ), $args );
} }
/** /**
@ -1353,7 +1353,7 @@ function user_can( $user, $capability ) {
$args = array_slice( func_get_args(), 2 ); $args = array_slice( func_get_args(), 2 );
$args = array_merge( array( $capability ), $args ); $args = array_merge( array( $capability ), $args );
return call_user_func_array( array( &$user, 'has_cap' ), $args ); return call_user_func_array( array( $user, 'has_cap' ), $args );
} }
/** /**

View File

@ -1109,7 +1109,7 @@ class WP_Http_Curl {
} }
if ( true === $r['blocking'] ) if ( true === $r['blocking'] )
curl_setopt( $handle, CURLOPT_HEADERFUNCTION, array( &$this, 'stream_headers' ) ); curl_setopt( $handle, CURLOPT_HEADERFUNCTION, array( $this, 'stream_headers' ) );
curl_setopt( $handle, CURLOPT_HEADER, false ); curl_setopt( $handle, CURLOPT_HEADER, false );

View File

@ -53,7 +53,7 @@ class WP_oEmbed {
) ); ) );
// Fix any embeds that contain new lines in the middle of the HTML which breaks wpautop(). // Fix any embeds that contain new lines in the middle of the HTML which breaks wpautop().
add_filter( 'oembed_dataparse', array(&$this, '_strip_newlines'), 10, 3 ); add_filter( 'oembed_dataparse', array($this, '_strip_newlines'), 10, 3 );
} }
/** /**

View File

@ -126,7 +126,7 @@ class Walker {
if ( is_array( $args[0] ) ) if ( is_array( $args[0] ) )
$args[0]['has_children'] = ! empty( $children_elements[$element->$id_field] ); $args[0]['has_children'] = ! empty( $children_elements[$element->$id_field] );
$cb_args = array_merge( array(&$output, $element, $depth), $args); $cb_args = array_merge( array(&$output, $element, $depth), $args);
call_user_func_array(array(&$this, 'start_el'), $cb_args); call_user_func_array(array($this, 'start_el'), $cb_args);
$id = $element->$id_field; $id = $element->$id_field;
@ -139,7 +139,7 @@ class Walker {
$newlevel = true; $newlevel = true;
//start the child delimiter //start the child delimiter
$cb_args = array_merge( array(&$output, $depth), $args); $cb_args = array_merge( array(&$output, $depth), $args);
call_user_func_array(array(&$this, 'start_lvl'), $cb_args); call_user_func_array(array($this, 'start_lvl'), $cb_args);
} }
$this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output ); $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
} }
@ -149,12 +149,12 @@ class Walker {
if ( isset($newlevel) && $newlevel ){ if ( isset($newlevel) && $newlevel ){
//end the child delimiter //end the child delimiter
$cb_args = array_merge( array(&$output, $depth), $args); $cb_args = array_merge( array(&$output, $depth), $args);
call_user_func_array(array(&$this, 'end_lvl'), $cb_args); call_user_func_array(array($this, 'end_lvl'), $cb_args);
} }
//end this element //end this element
$cb_args = array_merge( array(&$output, $element, $depth), $args); $cb_args = array_merge( array(&$output, $element, $depth), $args);
call_user_func_array(array(&$this, 'end_el'), $cb_args); call_user_func_array(array($this, 'end_el'), $cb_args);
} }
/** /**

View File

@ -606,7 +606,7 @@ class WP_MatchesMapRegex {
* @return string * @return string
*/ */
function _map() { function _map() {
$callback = array(&$this, 'callback'); $callback = array($this, 'callback');
return preg_replace_callback($this->_pattern, $callback, $this->_subject); return preg_replace_callback($this->_pattern, $callback, $this->_subject);
} }

View File

@ -536,9 +536,9 @@ class WP_Widget_Recent_Posts extends WP_Widget {
parent::__construct('recent-posts', __('Recent Posts'), $widget_ops); parent::__construct('recent-posts', __('Recent Posts'), $widget_ops);
$this->alt_option_name = 'widget_recent_entries'; $this->alt_option_name = 'widget_recent_entries';
add_action( 'save_post', array(&$this, 'flush_widget_cache') ); add_action( 'save_post', array($this, 'flush_widget_cache') );
add_action( 'deleted_post', array(&$this, 'flush_widget_cache') ); add_action( 'deleted_post', array($this, 'flush_widget_cache') );
add_action( 'switch_theme', array(&$this, 'flush_widget_cache') ); add_action( 'switch_theme', array($this, 'flush_widget_cache') );
} }
function widget($args, $instance) { function widget($args, $instance) {
@ -637,10 +637,10 @@ class WP_Widget_Recent_Comments extends WP_Widget {
$this->alt_option_name = 'widget_recent_comments'; $this->alt_option_name = 'widget_recent_comments';
if ( is_active_widget(false, false, $this->id_base) ) if ( is_active_widget(false, false, $this->id_base) )
add_action( 'wp_head', array(&$this, 'recent_comments_style') ); add_action( 'wp_head', array($this, 'recent_comments_style') );
add_action( 'comment_post', array(&$this, 'flush_widget_cache') ); add_action( 'comment_post', array($this, 'flush_widget_cache') );
add_action( 'transition_comment_status', array(&$this, 'flush_widget_cache') ); add_action( 'transition_comment_status', array($this, 'flush_widget_cache') );
} }
function recent_comments_style() { function recent_comments_style() {

View File

@ -475,7 +475,7 @@ function walk_nav_menu_tree( $items, $depth, $r ) {
$walker = ( empty($r->walker) ) ? new Walker_Nav_Menu : $r->walker; $walker = ( empty($r->walker) ) ? new Walker_Nav_Menu : $r->walker;
$args = array( $items, $depth, $r ); $args = array( $items, $depth, $r );
return call_user_func_array( array(&$walker, 'walk'), $args ); return call_user_func_array( array($walker, 'walk'), $args );
} }
/** /**

View File

@ -937,7 +937,7 @@ function walk_page_tree($pages, $depth, $current_page, $r) {
$walker = $r['walker']; $walker = $r['walker'];
$args = array($pages, $depth, $r, $current_page); $args = array($pages, $depth, $r, $current_page);
return call_user_func_array(array(&$walker, 'walk'), $args); return call_user_func_array(array($walker, 'walk'), $args);
} }
/** /**
@ -954,7 +954,7 @@ function walk_page_dropdown_tree() {
else else
$walker = $args[2]['walker']; $walker = $args[2]['walker'];
return call_user_func_array(array(&$walker, 'walk'), $args); return call_user_func_array(array($walker, 'walk'), $args);
} }
/** /**

View File

@ -1410,7 +1410,7 @@ function get_terms($taxonomies, $args = '') {
if ( $child_of ) { if ( $child_of ) {
$children = _get_term_hierarchy($taxonomies[0]); $children = _get_term_hierarchy($taxonomies[0]);
if ( ! empty($children) ) if ( ! empty($children) )
$terms = & _get_term_children($child_of, $terms, $taxonomies[0]); $terms = _get_term_children($child_of, $terms, $taxonomies[0]);
} }
// Update term counts to include children. // Update term counts to include children.

View File

@ -152,15 +152,15 @@ class WP_Widget {
} }
function _get_display_callback() { function _get_display_callback() {
return array(&$this, 'display_callback'); return array($this, 'display_callback');
} }
function _get_update_callback() { function _get_update_callback() {
return array(&$this, 'update_callback'); return array($this, 'update_callback');
} }
function _get_form_callback() { function _get_form_callback() {
return array(&$this, 'form_callback'); return array($this, 'form_callback');
} }
/** Generate the actual widget content. /** Generate the actual widget content.
@ -317,7 +317,7 @@ class WP_Widget_Factory {
var $widgets = array(); var $widgets = array();
function WP_Widget_Factory() { function WP_Widget_Factory() {
add_action( 'widgets_init', array( &$this, '_register_widgets' ), 100 ); add_action( 'widgets_init', array( $this, '_register_widgets' ), 100 );
} }
function register($widget_class) { function register($widget_class) {

View File

@ -534,7 +534,7 @@ class wpdb {
* @param string $dbhost MySQL database host * @param string $dbhost MySQL database host
*/ */
function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) { function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) {
register_shutdown_function( array( &$this, '__destruct' ) ); register_shutdown_function( array( $this, '__destruct' ) );
if ( WP_DEBUG ) if ( WP_DEBUG )
$this->show_errors(); $this->show_errors();
@ -1000,7 +1000,7 @@ class wpdb {
$query = str_replace( '"%s"', '%s', $query ); // doublequote unquoting $query = str_replace( '"%s"', '%s', $query ); // doublequote unquoting
$query = str_replace( '%f' , '%F', $query ); // Force floats to be locale unaware $query = str_replace( '%f' , '%F', $query ); // Force floats to be locale unaware
$query = preg_replace( '|(?<!%)%s|', "'%s'", $query ); // quote the strings, avoiding escaped strings like %%s $query = preg_replace( '|(?<!%)%s|', "'%s'", $query ); // quote the strings, avoiding escaped strings like %%s
array_walk( $args, array( &$this, 'escape_by_ref' ) ); array_walk( $args, array( $this, 'escape_by_ref' ) );
return @vsprintf( $query, $args ); return @vsprintf( $query, $args );
} }

View File

@ -422,7 +422,7 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
$chars2 = count_chars($string2); $chars2 = count_chars($string2);
// L1-norm of difference vector. // L1-norm of difference vector.
$difference = array_sum( array_map( array(&$this, 'difference'), $chars1, $chars2 ) ); $difference = array_sum( array_map( array($this, 'difference'), $chars1, $chars2 ) );
// $string1 has zero length? Odd. Give huge penalty by not dividing. // $string1 has zero length? Odd. Give huge penalty by not dividing.
if ( !$string1 ) if ( !$string1 )