[wp-hackers] Micro optimization - is_a() vs instanceof
Justas Butkus
jbutkus at time.ly
Mon Jan 7 08:25:42 UTC 2013
Beg your pardon - that holds true for scalar _references_, not scalar
_constants_.
Modified command, to generate patch (patch, itself, attached):
$ spatch -e 's/is_a( X, '\''Y'\'' )/ ( X instanceof Y ) /'
/path/to/wordpress/
I should have over-looked something, and neither missed lunch, nor
late-night readings helped to see to it. :-)
--
Best regards,
Justas B.
-------------- next part --------------
--- ./wp-admin/includes/class-wp-users-list-table.php 2012-11-19 23:43:47.000000000 +0200
+++ /tmp/trans-5100-5622e2.php 2013-01-07 10:12:30.065171051 +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-5100-d60119.php 2013-01-07 10:12:31.653178910 +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-5100-6c83e3.php 2013-01-07 10:12:31.853179909 +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-5100-54765f.php 2013-01-07 10:12:31.905180175 +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-5100-fe5a91.php 2013-01-07 10:12:44.093240605 +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-5100-5b6755.php 2013-01-07 10:12:44.225241266 +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-5100-948866.php 2013-01-07 10:12:44.685243528 +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-5100-7ef176.php 2013-01-07 10:12:44.805244126 +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-5100-30199c.php 2013-01-07 10:12:44.945244836 +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-5100-14a729.php 2013-01-07 10:12:44.965244929 +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-5100-b4faac.php 2013-01-07 10:12:46.173250920 +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-5100-c1eb74.php 2013-01-07 10:12:46.361251838 +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-5100-14e704.php 2013-01-07 10:12:46.613253109 +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-5100-c94878.php 2013-01-07 10:12:47.629258126 +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-5100-d4c28d.php 2013-01-07 10:12:48.173260835 +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-5100-fe0395.php 2013-01-07 10:12:48.917264528 +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-5100-a65fa9.php 2013-01-07 10:12:48.957264717 +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-5100-e3b00e.php 2013-01-07 10:12:49.201265935 +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-5100-f20c59.php 2013-01-07 10:12:51.049275090 +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-5100-cc6708.php 2013-01-07 10:12:51.873279170 +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-5100-e12717.php 2013-01-07 10:12:52.569282635 +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-5100-7c4f43.php 2013-01-07 10:12:53.397286731 +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-5100-637085.php 2013-01-07 10:12:53.553287505 +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