[wp-hackers] Micro optimization - is_a() vs instanceof
Justas Butkus
jbutkus at time.ly
Fri Jan 4 19:47:17 UTC 2013
What a pity would be to curtail such a lunch, or at least a sensual
impact of it, by doing a code replacement over it.
There was no offence intended, and please find my patch attached, that
would dismantle the cause of this issue, if applied, to alleviate my
good intentions.
The rationale behind my comment was just as good - to break the
discussion about time consumption, while the change itself takes less
time than thinking about it.
--
Regards,
Justas B.
On 2013.01.04 21:18, Jeff Morris wrote:
> I was just pointing out how little work is involved.
>
> Search and replace is 'error-prone' as in 'what will be grazed by this
> nuke'; and it would have curtailed my lunch, (a leisurely affair with
> Italian salad, saute veg, blue stilton and a 20-year-old port as I
> recall).
>
> No offence taken, dude. I hope you find a quicker way than mine, and
> most importantly, share it.
-------------- next part --------------
--- ./wp-admin/includes/class-wp-users-list-table.php 2012-11-19 23:43:47.000000000 +0200
+++ /tmp/trans-21323-f63ea0.php 2013-01-04 21:35:31.658811324 +0200
@@ -227,7 +227,7 @@
function single_row( $user_object, $style = '', $role = '', $numposts = 0 ) {
global $wp_roles;
- if ( !( is_object( $user_object ) && is_a( $user_object, 'WP_User' ) ) )
+ if ( !( is_object( $user_object ) && ( $user_object instanceof 'WP_User' ) ) )
$user_object = get_userdata( (int) $user_object );
$user_object->filter = 'display';
$email = $user_object->user_email;
--- ./wp-admin/includes/screen.php 2012-09-26 22:44:43.000000000 +0300
+++ /tmp/trans-21323-67cbd3.php 2013-01-04 21:35:33.246819200 +0200
@@ -388,7 +388,7 @@
*/
public static function get( $hook_name = '' ) {
- if ( is_a( $hook_name, 'WP_Screen' ) )
+ if ( ( $hook_name instanceof 'WP_Screen' ) )
return $hook_name;
$post_type = $taxonomy = null;
--- ./wp-admin/includes/template.php 2012-11-30 15:40:59.000000000 +0200
+++ /tmp/trans-21323-801fc5.php 2013-01-04 21:35:33.454820237 +0200
@@ -100,7 +100,7 @@
extract( wp_parse_args($args, $defaults), EXTR_SKIP );
- if ( empty($walker) || !is_a($walker, 'Walker') )
+ if ( empty($walker) || !( $walker instanceof 'Walker' ) )
$walker = new Walker_Category_Checklist;
$descendants_and_self = (int) $descendants_and_self;
--- ./wp-admin/includes/theme.php 2012-09-05 01:35:12.000000000 +0300
+++ /tmp/trans-21323-c036ad.php 2013-01-04 21:35:33.506820490 +0200
@@ -117,7 +117,7 @@
if ( !isset($themes_update) )
$themes_update = get_site_transient('update_themes');
- if ( ! is_a( $theme, 'WP_Theme' ) )
+ if ( ! ( $theme instanceof 'WP_Theme' ) )
return;
$stylesheet = $theme->get_stylesheet();
--- ./wp-includes/Text/Diff.php 2010-02-19 03:25:26.000000000 +0200
+++ /tmp/trans-21323-4208fa.php 2013-01-04 21:35:45.986882375 +0200
@@ -74,8 +74,8 @@
{
$count = 0;
foreach ($this->_edits as $edit) {
- if (is_a($edit, 'Text_Diff_Op_add') ||
- is_a($edit, 'Text_Diff_Op_change')) {
+ if (( $edit instanceof 'Text_Diff_Op_add' ) ||
+ ( $edit instanceof 'Text_Diff_Op_change' ) ) {
$count += $edit->nfinal();
}
}
@@ -93,8 +93,8 @@
{
$count = 0;
foreach ($this->_edits as $edit) {
- if (is_a($edit, 'Text_Diff_Op_delete') ||
- is_a($edit, 'Text_Diff_Op_change')) {
+ if (( $edit instanceof 'Text_Diff_Op_delete' ) ||
+ ( $edit instanceof 'Text_Diff_Op_change' ) ) {
$count += $edit->norig();
}
}
@@ -137,7 +137,7 @@
function isEmpty()
{
foreach ($this->_edits as $edit) {
- if (!is_a($edit, 'Text_Diff_Op_copy')) {
+ if (!( $edit instanceof 'Text_Diff_Op_copy' ) ) {
return false;
}
}
@@ -155,7 +155,7 @@
{
$lcs = 0;
foreach ($this->_edits as $edit) {
- if (is_a($edit, 'Text_Diff_Op_copy')) {
+ if (( $edit instanceof 'Text_Diff_Op_copy' ) ) {
$lcs += count($edit->orig);
}
}
--- ./wp-includes/Text/Diff/Renderer.php 2010-02-19 03:25:26.000000000 +0200
+++ /tmp/trans-21323-b99249.php 2013-01-04 21:35:46.118883028 +0200
@@ -83,7 +83,7 @@
/* If these are unchanged (copied) lines, and we want to keep
* leading or trailing context lines, extract them from the copy
* block. */
- if (is_a($edit, 'Text_Diff_Op_copy')) {
+ if (( $edit instanceof 'Text_Diff_Op_copy' ) ) {
/* Do we have any diff blocks yet? */
if (is_array($block)) {
/* How many lines to keep as context from the copy
--- ./wp-includes/capabilities.php 2012-12-07 11:53:27.000000000 +0200
+++ /tmp/trans-21323-7e911e.php 2013-01-04 21:35:46.626885554 +0200
@@ -483,7 +483,7 @@
);
}
- if ( is_a( $id, 'WP_User' ) ) {
+ if ( ( $id instanceof 'WP_User' ) ) {
$this->init( $id->data, $blog_id );
return;
} elseif ( is_object( $id ) ) {
--- ./wp-includes/category-template.php 2012-11-20 20:31:06.000000000 +0200
+++ /tmp/trans-21323-a6b79a.php 2013-01-04 21:35:46.762886223 +0200
@@ -730,7 +730,7 @@
function walk_category_tree() {
$args = func_get_args();
// the user's options are the third parameter
- if ( empty($args[2]['walker']) || !is_a($args[2]['walker'], 'Walker') )
+ if ( empty($args[2]['walker']) || !( $args[2]['walker'] instanceof 'Walker' ) )
$walker = new Walker_Category;
else
$walker = $args[2]['walker'];
@@ -748,7 +748,7 @@
function walk_category_dropdown_tree() {
$args = func_get_args();
// the user's options are the third parameter
- if ( empty($args[2]['walker']) || !is_a($args[2]['walker'], 'Walker') )
+ if ( empty($args[2]['walker']) || !( $args[2]['walker'] instanceof 'Walker' ) )
$walker = new Walker_CategoryDropdown;
else
$walker = $args[2]['walker'];
--- ./wp-includes/class-IXR.php 2012-08-15 23:12:00.000000000 +0300
+++ /tmp/trans-21323-f4c033.php 2013-01-04 21:35:46.926887037 +0200
@@ -82,10 +82,10 @@
}
// Deal with IXR object types base64 and date
- if (is_object($this->data) && is_a($this->data, 'IXR_Date')) {
+ if (is_object($this->data) && ( $this->data instanceof 'IXR_Date' ) ) {
return 'date';
}
- if (is_object($this->data) && is_a($this->data, 'IXR_Base64')) {
+ if (is_object($this->data) && ( $this->data instanceof 'IXR_Base64' ) ) {
return 'base64';
}
@@ -391,7 +391,7 @@
$result = $this->call($this->message->methodName, $this->message->params);
// Is the result an error?
- if (is_a($result, 'IXR_Error')) {
+ if (( $result instanceof 'IXR_Error' ) ) {
$this->error($result);
}
@@ -538,7 +538,7 @@
} else {
$result = $this->call($method, $params);
}
- if (is_a($result, 'IXR_Error')) {
+ if (( $result instanceof 'IXR_Error' ) ) {
$return[] = array(
'faultCode' => $result->code,
'faultString' => $result->message
@@ -976,7 +976,7 @@
break;
case 'date':
case 'dateTime.iso8601':
- if (!is_a($arg, 'IXR_Date')) {
+ if (!( $arg instanceof 'IXR_Date' ) ) {
$ok = false;
}
break;
--- ./wp-includes/class-feed.php 2012-11-22 09:23:43.000000000 +0200
+++ /tmp/trans-21323-05207c.php 2013-01-04 21:35:46.950887156 +0200
@@ -27,7 +27,7 @@
}
function save($data) {
- if ( is_a($data, 'SimplePie') )
+ if ( ( $data instanceof 'SimplePie' ) )
$data = $data->data;
set_transient($this->name, $data, $this->lifetime);
--- ./wp-includes/class-wp-customize-manager.php 2012-11-22 00:31:55.000000000 +0200
+++ /tmp/trans-21323-726d54.php 2013-01-04 21:35:48.194893321 +0200
@@ -525,7 +525,7 @@
* @param array $args Setting arguments.
*/
public function add_setting( $id, $args = array() ) {
- if ( is_a( $id, 'WP_Customize_Setting' ) )
+ if ( ( $id instanceof 'WP_Customize_Setting' ) )
$setting = $id;
else
$setting = new WP_Customize_Setting( $this, $id, $args );
@@ -566,7 +566,7 @@
* @param array $args Section arguments.
*/
public function add_section( $id, $args = array() ) {
- if ( is_a( $id, 'WP_Customize_Section' ) )
+ if ( ( $id instanceof 'WP_Customize_Section' ) )
$section = $id;
else
$section = new WP_Customize_Section( $this, $id, $args );
@@ -607,7 +607,7 @@
* @param array $args Setting arguments.
*/
public function add_control( $id, $args = array() ) {
- if ( is_a( $id, 'WP_Customize_Control' ) )
+ if ( ( $id instanceof 'WP_Customize_Control' ) )
$control = $id;
else
$control = new WP_Customize_Control( $this, $id, $args );
--- ./wp-includes/class-wp-error.php 2012-01-08 19:01:11.000000000 +0200
+++ /tmp/trans-21323-9da508.php 2013-01-04 21:35:48.346894075 +0200
@@ -204,7 +204,7 @@
* @return bool True, if WP_Error. False, if not WP_Error.
*/
function is_wp_error($thing) {
- if ( is_object($thing) && is_a($thing, 'WP_Error') )
+ if ( is_object($thing) && ( $thing instanceof 'WP_Error' ) )
return true;
return false;
}
--- ./wp-includes/class-wp-theme.php 2012-12-07 11:53:27.000000000 +0200
+++ /tmp/trans-21323-130475.php 2013-01-04 21:35:48.558895134 +0200
@@ -262,7 +262,7 @@
// Set the parent, if we're a child theme.
if ( $this->template != $this->stylesheet ) {
// If we are a parent, then there is a problem. Only two generations allowed! Cancel things out.
- if ( is_a( $_child, 'WP_Theme' ) && $_child->template == $this->stylesheet ) {
+ if ( ( $_child instanceof 'WP_Theme' ) && $_child->template == $this->stylesheet ) {
$_child->parent = null;
$_child->errors = new WP_Error( 'theme_parent_invalid', sprintf( __( 'The "%s" theme is not a valid parent theme.' ), $_child->template ) );
$_child->cache_add( 'theme', array( 'headers' => $_child->headers, 'errors' => $_child->errors, 'stylesheet' => $_child->stylesheet, 'template' => $_child->template ) );
--- ./wp-includes/compat.php 2011-07-07 02:33:05.000000000 +0300
+++ /tmp/trans-21323-851977.php 2013-01-04 21:35:49.606900326 +0200
@@ -65,7 +65,7 @@
function json_encode( $string ) {
global $wp_json;
- if ( !is_a($wp_json, 'Services_JSON') ) {
+ if ( !( $wp_json instanceof 'Services_JSON' ) ) {
require_once( ABSPATH . WPINC . '/class-json.php' );
$wp_json = new Services_JSON();
}
@@ -78,7 +78,7 @@
function json_decode( $string, $assoc_array = false ) {
global $wp_json;
- if ( !is_a($wp_json, 'Services_JSON') ) {
+ if ( !( $wp_json instanceof 'Services_JSON' ) ) {
require_once( ABSPATH . WPINC . '/class-json.php' );
$wp_json = new Services_JSON();
}
--- ./wp-includes/deprecated.php 2012-11-22 11:52:16.000000000 +0200
+++ /tmp/trans-21323-394852.php 2013-01-04 21:35:50.078902665 +0200
@@ -2684,7 +2684,7 @@
if ( is_object($user) ) {
if ( !isset($user->ID) )
$user->ID = 0;
- if ( !is_a( $user, 'WP_User' ) ) {
+ if ( !( $user instanceof 'WP_User' ) ) {
$vars = get_object_vars($user);
foreach ( array_keys($vars) as $field ) {
if ( is_string($user->$field) || is_numeric($user->$field) )
--- ./wp-includes/functions.wp-scripts.php 2012-08-30 21:57:57.000000000 +0300
+++ /tmp/trans-21323-5684d3.php 2013-01-04 21:35:50.758906036 +0200
@@ -24,7 +24,7 @@
$handles = false;
global $wp_scripts;
- if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
+ if ( ! ( $wp_scripts instanceof 'WP_Scripts' ) ) {
if ( ! did_action( 'init' ) )
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>' ), '3.3' );
@@ -51,7 +51,7 @@
*/
function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) {
global $wp_scripts;
- if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
+ if ( ! ( $wp_scripts instanceof 'WP_Scripts' ) ) {
if ( ! did_action( 'init' ) )
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>' ), '3.3' );
@@ -85,7 +85,7 @@
*/
function wp_localize_script( $handle, $object_name, $l10n ) {
global $wp_scripts;
- if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
+ if ( ! ( $wp_scripts instanceof 'WP_Scripts' ) ) {
if ( ! did_action( 'init' ) )
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>' ), '3.3' );
@@ -104,7 +104,7 @@
*/
function wp_deregister_script( $handle ) {
global $wp_scripts;
- if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
+ if ( ! ( $wp_scripts instanceof 'WP_Scripts' ) ) {
if ( ! did_action( 'init' ) )
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>' ), '3.3' );
@@ -124,7 +124,7 @@
*/
function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false, $in_footer = false ) {
global $wp_scripts;
- if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
+ if ( ! ( $wp_scripts instanceof 'WP_Scripts' ) ) {
if ( ! did_action( 'init' ) )
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>' ), '3.3' );
@@ -148,7 +148,7 @@
*/
function wp_dequeue_script( $handle ) {
global $wp_scripts;
- if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
+ if ( ! ( $wp_scripts instanceof 'WP_Scripts' ) ) {
if ( ! did_action( 'init' ) )
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>' ), '3.3' );
@@ -174,7 +174,7 @@
*/
function wp_script_is( $handle, $list = 'enqueued' ) {
global $wp_scripts;
- if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
+ if ( ! ( $wp_scripts instanceof 'WP_Scripts' ) ) {
if ( ! did_action( 'init' ) )
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>' ), '3.3' );
--- ./wp-includes/functions.wp-styles.php 2012-08-30 21:57:57.000000000 +0300
+++ /tmp/trans-21323-98859b.php 2013-01-04 21:35:50.782906155 +0200
@@ -25,7 +25,7 @@
do_action( 'wp_print_styles' );
global $wp_styles;
- if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
+ if ( ! ( $wp_styles instanceof 'WP_Styles' ) ) {
if ( ! did_action( 'init' ) )
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>' ), '3.3' );
@@ -52,7 +52,7 @@
*/
function wp_add_inline_style( $handle, $data ) {
global $wp_styles;
- if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
+ if ( ! ( $wp_styles instanceof 'WP_Styles' ) ) {
if ( ! did_action( 'init' ) )
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>' ), '3.3' );
@@ -80,7 +80,7 @@
*/
function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {
global $wp_styles;
- if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
+ if ( ! ( $wp_styles instanceof 'WP_Styles' ) ) {
if ( ! did_action( 'init' ) )
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>' ), '3.3' );
@@ -101,7 +101,7 @@
*/
function wp_deregister_style( $handle ) {
global $wp_styles;
- if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
+ if ( ! ( $wp_styles instanceof 'WP_Styles' ) ) {
if ( ! did_action( 'init' ) )
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>' ), '3.3' );
@@ -132,7 +132,7 @@
*/
function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = 'all' ) {
global $wp_styles;
- if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
+ if ( ! ( $wp_styles instanceof 'WP_Styles' ) ) {
if ( ! did_action( 'init' ) )
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>' ), '3.3' );
@@ -154,7 +154,7 @@
*/
function wp_dequeue_style( $handle ) {
global $wp_styles;
- if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
+ if ( ! ( $wp_styles instanceof 'WP_Styles' ) ) {
if ( ! did_action( 'init' ) )
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>' ), '3.3' );
@@ -181,7 +181,7 @@
*/
function wp_style_is( $handle, $list = 'enqueued' ) {
global $wp_styles;
- if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
+ if ( ! ( $wp_styles instanceof 'WP_Styles' ) ) {
if ( ! did_action( 'init' ) )
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>' ), '3.3' );
--- ./wp-includes/general-template.php 2012-11-17 17:11:29.000000000 +0200
+++ /tmp/trans-21323-d12a0a.php 2013-01-04 21:35:51.030907393 +0200
@@ -2085,7 +2085,7 @@
*/
function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {
global $wp_styles;
- if ( !is_a($wp_styles, 'WP_Styles') )
+ if ( !( $wp_styles instanceof 'WP_Styles' ) )
$wp_styles = new WP_Styles();
// For backward compatibility
--- ./wp-includes/pluggable.php 2012-11-14 07:29:56.000000000 +0200
+++ /tmp/trans-21323-c173dc.php 2013-01-04 21:35:52.666915505 +0200
@@ -221,7 +221,7 @@
global $phpmailer;
// (Re)create it, if it's gone missing
- if ( !is_object( $phpmailer ) || !is_a( $phpmailer, 'PHPMailer' ) ) {
+ if ( !is_object( $phpmailer ) || !( $phpmailer instanceof 'PHPMailer' ) ) {
require_once ABSPATH . WPINC . '/class-phpmailer.php';
require_once ABSPATH . WPINC . '/class-smtp.php';
$phpmailer = new PHPMailer( true );
--- ./wp-includes/post.php 2012-12-03 08:28:28.000000000 +0200
+++ /tmp/trans-21323-d4428b.php 2013-01-04 21:35:53.470919484 +0200
@@ -387,7 +387,7 @@
if ( empty( $post ) && isset( $GLOBALS['post'] ) )
$post = $GLOBALS['post'];
- if ( is_a( $post, 'WP_Post' ) ) {
+ if ( ( $post instanceof 'WP_Post' ) ) {
$_post = $post;
} elseif ( is_object( $post ) ) {
if ( empty( $post->filter ) ) {
--- ./wp-includes/script-loader.php 2012-12-05 20:57:56.000000000 +0200
+++ /tmp/trans-21323-d5ce25.php 2013-01-04 21:35:54.178922996 +0200
@@ -643,7 +643,7 @@
if ( ! did_action('wp_print_scripts') )
do_action('wp_print_scripts');
- if ( !is_a($wp_scripts, 'WP_Scripts') )
+ if ( !( $wp_scripts instanceof 'WP_Scripts' ) )
$wp_scripts = new WP_Scripts();
script_concat_settings();
@@ -665,7 +665,7 @@
function print_footer_scripts() {
global $wp_scripts, $concatenate_scripts;
- if ( !is_a($wp_scripts, 'WP_Scripts') )
+ if ( !( $wp_scripts instanceof 'WP_Scripts' ) )
return array(); // No need to run if not instantiated.
script_concat_settings();
@@ -724,7 +724,7 @@
global $wp_scripts;
- if ( !is_a($wp_scripts, 'WP_Scripts') )
+ if ( !( $wp_scripts instanceof 'WP_Scripts' ) )
return array(); // no need to run if nothing is queued
return print_head_scripts();
@@ -769,7 +769,7 @@
function print_admin_styles() {
global $wp_styles, $concatenate_scripts, $compress_css;
- if ( !is_a($wp_styles, 'WP_Styles') )
+ if ( !( $wp_styles instanceof 'WP_Styles' ) )
$wp_styles = new WP_Styles();
script_concat_settings();
@@ -795,7 +795,7 @@
function print_late_styles() {
global $wp_styles, $concatenate_scripts;
- if ( !is_a($wp_styles, 'WP_Styles') )
+ if ( !( $wp_styles instanceof 'WP_Styles' ) )
return;
$wp_styles->do_concat = $concatenate_scripts;
--- ./wp-includes/user.php 2012-11-06 01:11:25.000000000 +0200
+++ /tmp/trans-21323-f82e72.php 2013-01-04 21:35:54.842926292 +0200
@@ -70,7 +70,7 @@
*/
add_filter('authenticate', 'wp_authenticate_username_password', 20, 3);
function wp_authenticate_username_password($user, $username, $password) {
- if ( is_a($user, 'WP_User') ) { return $user; }
+ if ( ( $user instanceof 'WP_User' ) ) { return $user; }
if ( empty($username) || empty($password) ) {
$error = new WP_Error();
@@ -117,7 +117,7 @@
* Authenticate the user using the WordPress auth cookie.
*/
function wp_authenticate_cookie($user, $username, $password) {
- if ( is_a($user, 'WP_User') ) { return $user; }
+ if ( ( $user instanceof 'WP_User' ) ) { return $user; }
if ( empty($username) && empty($password) ) {
$user_id = wp_validate_auth_cookie();
@@ -1282,9 +1282,9 @@
function wp_insert_user( $userdata ) {
global $wpdb;
- if ( is_a( $userdata, 'stdClass' ) )
+ if ( ( $userdata instanceof 'stdClass' ) )
$userdata = get_object_vars( $userdata );
- elseif ( is_a( $userdata, 'WP_User' ) )
+ elseif ( ( $userdata instanceof 'WP_User' ) )
$userdata = $userdata->to_array();
extract( $userdata, EXTR_SKIP );
@@ -1443,9 +1443,9 @@
* @return int|WP_Error The updated user's ID or a WP_Error object if the user could not be updated.
*/
function wp_update_user($userdata) {
- if ( is_a( $userdata, 'stdClass' ) )
+ if ( ( $userdata instanceof 'stdClass' ) )
$userdata = get_object_vars( $userdata );
- elseif ( is_a( $userdata, 'WP_User' ) )
+ elseif ( ( $userdata instanceof 'WP_User' ) )
$userdata = $userdata->to_array();
$ID = (int) $userdata['ID'];
--- ./wp-includes/widgets.php 2012-10-04 23:00:16.000000000 +0300
+++ /tmp/trans-21323-2b2267.php 2013-01-04 21:35:54.966926905 +0200
@@ -1122,7 +1122,7 @@
global $wp_widget_factory;
$widget_obj = $wp_widget_factory->widgets[$widget];
- if ( !is_a($widget_obj, 'WP_Widget') )
+ if ( !( $widget_obj instanceof 'WP_Widget' ) )
return;
$before_widget = sprintf('<div class="widget %s">', $widget_obj->widget_options['classname'] );
More information about the wp-hackers
mailing list