mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
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:
parent
1f9d02abc6
commit
77518e9c71
@ -635,7 +635,7 @@ class WP_Object_Cache {
|
||||
* @todo This should be moved to the PHP4 style constructor, PHP5
|
||||
* already calls __destruct()
|
||||
*/
|
||||
register_shutdown_function( array( &$this, '__destruct' ) );
|
||||
register_shutdown_function( array( $this, '__destruct' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -725,7 +725,7 @@ class WP_User {
|
||||
|
||||
//Filter out caps that are not role names and assign to $this->roles
|
||||
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
|
||||
$this->allcaps = array();
|
||||
@ -1331,7 +1331,7 @@ function author_can( $post, $capability ) {
|
||||
$args = array_slice( func_get_args(), 2 );
|
||||
$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_merge( array( $capability ), $args );
|
||||
|
||||
return call_user_func_array( array( &$user, 'has_cap' ), $args );
|
||||
return call_user_func_array( array( $user, 'has_cap' ), $args );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1109,7 +1109,7 @@ class WP_Http_Curl {
|
||||
}
|
||||
|
||||
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 );
|
||||
|
||||
|
@ -53,7 +53,7 @@ class WP_oEmbed {
|
||||
) );
|
||||
|
||||
// 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 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -126,7 +126,7 @@ class Walker {
|
||||
if ( is_array( $args[0] ) )
|
||||
$args[0]['has_children'] = ! empty( $children_elements[$element->$id_field] );
|
||||
$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;
|
||||
|
||||
@ -139,7 +139,7 @@ class Walker {
|
||||
$newlevel = true;
|
||||
//start the child delimiter
|
||||
$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 );
|
||||
}
|
||||
@ -149,12 +149,12 @@ class Walker {
|
||||
if ( isset($newlevel) && $newlevel ){
|
||||
//end the child delimiter
|
||||
$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
|
||||
$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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -606,7 +606,7 @@ class WP_MatchesMapRegex {
|
||||
* @return string
|
||||
*/
|
||||
function _map() {
|
||||
$callback = array(&$this, 'callback');
|
||||
$callback = array($this, 'callback');
|
||||
return preg_replace_callback($this->_pattern, $callback, $this->_subject);
|
||||
}
|
||||
|
||||
|
@ -536,9 +536,9 @@ class WP_Widget_Recent_Posts extends WP_Widget {
|
||||
parent::__construct('recent-posts', __('Recent Posts'), $widget_ops);
|
||||
$this->alt_option_name = 'widget_recent_entries';
|
||||
|
||||
add_action( 'save_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( 'save_post', array($this, 'flush_widget_cache') );
|
||||
add_action( 'deleted_post', array($this, 'flush_widget_cache') );
|
||||
add_action( 'switch_theme', array($this, 'flush_widget_cache') );
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
@ -637,10 +637,10 @@ class WP_Widget_Recent_Comments extends WP_Widget {
|
||||
$this->alt_option_name = 'widget_recent_comments';
|
||||
|
||||
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( 'transition_comment_status', array(&$this, 'flush_widget_cache') );
|
||||
add_action( 'comment_post', array($this, 'flush_widget_cache') );
|
||||
add_action( 'transition_comment_status', array($this, 'flush_widget_cache') );
|
||||
}
|
||||
|
||||
function recent_comments_style() {
|
||||
|
@ -475,7 +475,7 @@ function walk_nav_menu_tree( $items, $depth, $r ) {
|
||||
$walker = ( empty($r->walker) ) ? new Walker_Nav_Menu : $r->walker;
|
||||
$args = array( $items, $depth, $r );
|
||||
|
||||
return call_user_func_array( array(&$walker, 'walk'), $args );
|
||||
return call_user_func_array( array($walker, 'walk'), $args );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -937,7 +937,7 @@ function walk_page_tree($pages, $depth, $current_page, $r) {
|
||||
$walker = $r['walker'];
|
||||
|
||||
$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
|
||||
$walker = $args[2]['walker'];
|
||||
|
||||
return call_user_func_array(array(&$walker, 'walk'), $args);
|
||||
return call_user_func_array(array($walker, 'walk'), $args);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1410,7 +1410,7 @@ function get_terms($taxonomies, $args = '') {
|
||||
if ( $child_of ) {
|
||||
$children = _get_term_hierarchy($taxonomies[0]);
|
||||
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.
|
||||
|
@ -152,15 +152,15 @@ class WP_Widget {
|
||||
}
|
||||
|
||||
function _get_display_callback() {
|
||||
return array(&$this, 'display_callback');
|
||||
return array($this, 'display_callback');
|
||||
}
|
||||
|
||||
function _get_update_callback() {
|
||||
return array(&$this, 'update_callback');
|
||||
return array($this, 'update_callback');
|
||||
}
|
||||
|
||||
function _get_form_callback() {
|
||||
return array(&$this, 'form_callback');
|
||||
return array($this, 'form_callback');
|
||||
}
|
||||
|
||||
/** Generate the actual widget content.
|
||||
@ -317,7 +317,7 @@ class WP_Widget_Factory {
|
||||
var $widgets = array();
|
||||
|
||||
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) {
|
||||
|
@ -534,7 +534,7 @@ class wpdb {
|
||||
* @param string $dbhost MySQL database host
|
||||
*/
|
||||
function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) {
|
||||
register_shutdown_function( array( &$this, '__destruct' ) );
|
||||
register_shutdown_function( array( $this, '__destruct' ) );
|
||||
|
||||
if ( WP_DEBUG )
|
||||
$this->show_errors();
|
||||
@ -1000,7 +1000,7 @@ class wpdb {
|
||||
$query = str_replace( '"%s"', '%s', $query ); // doublequote unquoting
|
||||
$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
|
||||
array_walk( $args, array( &$this, 'escape_by_ref' ) );
|
||||
array_walk( $args, array( $this, 'escape_by_ref' ) );
|
||||
return @vsprintf( $query, $args );
|
||||
}
|
||||
|
||||
|
@ -422,7 +422,7 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
|
||||
$chars2 = count_chars($string2);
|
||||
|
||||
// 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.
|
||||
if ( !$string1 )
|
||||
|
Loading…
Reference in New Issue
Block a user