diff --git a/wp-admin/includes/class-wp-users-list-table.php b/wp-admin/includes/class-wp-users-list-table.php index c7958e0619..be8270a67e 100644 --- a/wp-admin/includes/class-wp-users-list-table.php +++ b/wp-admin/includes/class-wp-users-list-table.php @@ -339,8 +339,9 @@ class WP_Users_List_Table extends WP_List_Table { public function single_row( $user_object, $style = '', $role = '', $numposts = 0 ) { global $wp_roles; - if ( !( is_object( $user_object ) && is_a( $user_object, 'WP_User' ) ) ) + if ( ! ( $user_object instanceof WP_User ) ) { $user_object = get_userdata( (int) $user_object ); + } $user_object->filter = 'display'; $email = $user_object->user_email; diff --git a/wp-admin/includes/screen.php b/wp-admin/includes/screen.php index ea96050b3d..e919df9ee9 100644 --- a/wp-admin/includes/screen.php +++ b/wp-admin/includes/screen.php @@ -374,8 +374,9 @@ final class WP_Screen { */ 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; $in_admin = false; diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 26c8a4a1c7..dddddbee4c 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -176,7 +176,7 @@ function wp_terms_checklist( $post_id = 0, $args = array() ) { $r = wp_parse_args( $params, $defaults ); - if ( empty( $r['walker'] ) || ! is_a( $r['walker'], 'Walker' ) ) { + if ( empty( $r['walker'] ) || ! ( $r['walker'] instanceof Walker ) ) { $walker = new Walker_Category_Checklist; } else { $walker = $r['walker']; diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php index b1d113225e..a6b9fb031a 100644 --- a/wp-admin/includes/theme.php +++ b/wp-admin/includes/theme.php @@ -149,8 +149,9 @@ function get_theme_update_available( $theme ) { if ( !isset($themes_update) ) $themes_update = get_site_transient('update_themes'); - if ( ! is_a( $theme, 'WP_Theme' ) ) + if ( ! ( $theme instanceof WP_Theme ) ) { return false; + } $stylesheet = $theme->get_stylesheet(); diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php index 160c20e89e..56ca7738a0 100644 --- a/wp-includes/capabilities.php +++ b/wp-includes/capabilities.php @@ -520,7 +520,7 @@ class WP_User { ); } - if ( is_a( $id, 'WP_User' ) ) { + if ( $id instanceof WP_User ) { $this->init( $id->data, $blog_id ); return; } elseif ( is_object( $id ) ) { diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php index 264a0d6355..3a3236a467 100644 --- a/wp-includes/category-template.php +++ b/wp-includes/category-template.php @@ -882,11 +882,11 @@ function _wp_object_count_sort_cb( $a, $b ) { 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 + } else { $walker = $args[2]['walker']; - + } return call_user_func_array(array( &$walker, 'walk' ), $args ); } diff --git a/wp-includes/class-feed.php b/wp-includes/class-feed.php index 9aa144a52b..01acff82e6 100644 --- a/wp-includes/class-feed.php +++ b/wp-includes/class-feed.php @@ -37,8 +37,9 @@ class WP_Feed_Cache_Transient { } public function save($data) { - if ( is_a($data, 'SimplePie') ) + if ( $data instanceof SimplePie ) { $data = $data->data; + } set_transient($this->name, $data, $this->lifetime); set_transient($this->mod_name, time(), $this->lifetime); diff --git a/wp-includes/class-wp-customize-manager.php b/wp-includes/class-wp-customize-manager.php index c9dc52d447..f388c53873 100644 --- a/wp-includes/class-wp-customize-manager.php +++ b/wp-includes/class-wp-customize-manager.php @@ -695,11 +695,11 @@ final class WP_Customize_Manager { * constructor. */ public function add_setting( $id, $args = array() ) { - if ( is_a( $id, 'WP_Customize_Setting' ) ) + if ( $id instanceof WP_Customize_Setting ) { $setting = $id; - else + } else { $setting = new WP_Customize_Setting( $this, $id, $args ); - + } $this->settings[ $setting->id ] = $setting; } @@ -737,10 +737,9 @@ final class WP_Customize_Manager { * @param array $args Optional. Panel arguments. Default empty array. */ public function add_panel( $id, $args = array() ) { - if ( is_a( $id, 'WP_Customize_Panel' ) ) { + if ( $id instanceof WP_Customize_Panel ) { $panel = $id; - } - else { + } else { $panel = new WP_Customize_Panel( $this, $id, $args ); } @@ -783,11 +782,11 @@ final class WP_Customize_Manager { * @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 + } else { $section = new WP_Customize_Section( $this, $id, $args ); - + } $this->sections[ $section->id ] = $section; } @@ -825,11 +824,11 @@ final class WP_Customize_Manager { * constructor. */ public function add_control( $id, $args = array() ) { - if ( is_a( $id, 'WP_Customize_Control' ) ) + if ( $id instanceof WP_Customize_Control ) { $control = $id; - else + } else { $control = new WP_Customize_Control( $this, $id, $args ); - + } $this->controls[ $control->id ] = $control; } diff --git a/wp-includes/class-wp-error.php b/wp-includes/class-wp-error.php index 448482ef7f..c1b07ab637 100644 --- a/wp-includes/class-wp-error.php +++ b/wp-includes/class-wp-error.php @@ -214,8 +214,6 @@ class WP_Error { * @param mixed $thing Check if unknown variable is a WP_Error object. * @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') ) - return true; - return false; +function is_wp_error( $thing ) { + return ( $thing instanceof WP_Error ); } diff --git a/wp-includes/class-wp-theme.php b/wp-includes/class-wp-theme.php index b4d249c14d..523c7339c4 100644 --- a/wp-includes/class-wp-theme.php +++ b/wp-includes/class-wp-theme.php @@ -274,7 +274,7 @@ final class WP_Theme implements ArrayAccess { // 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 ) ); diff --git a/wp-includes/class-wp-xmlrpc-server.php b/wp-includes/class-wp-xmlrpc-server.php index 30512b86b7..925df38a8a 100644 --- a/wp-includes/class-wp-xmlrpc-server.php +++ b/wp-includes/class-wp-xmlrpc-server.php @@ -1117,13 +1117,13 @@ class wp_xmlrpc_server extends IXR_Server { return $this->error; // convert the date field back to IXR form - if ( isset( $content_struct['post_date'] ) && ! is_a( $content_struct['post_date'], 'IXR_Date' ) ) { + if ( isset( $content_struct['post_date'] ) && ! ( $content_struct['post_date'] instanceof IXR_Date ) ) { $content_struct['post_date'] = $this->_convert_date( $content_struct['post_date'] ); } // ignore the existing GMT date if it is empty or a non-GMT date was supplied in $content_struct, // since _insert_post will ignore the non-GMT date if the GMT date is set - if ( isset( $content_struct['post_date_gmt'] ) && ! is_a( $content_struct['post_date_gmt'], 'IXR_Date' ) ) { + if ( isset( $content_struct['post_date_gmt'] ) && ! ( $content_struct['post_date_gmt'] instanceof IXR_Date ) ) { if ( $content_struct['post_date_gmt'] == '0000-00-00 00:00:00' || isset( $content_struct['post_date'] ) ) { unset( $content_struct['post_date_gmt'] ); } else { diff --git a/wp-includes/compat.php b/wp-includes/compat.php index ab4045250a..7e8fe73712 100644 --- a/wp-includes/compat.php +++ b/wp-includes/compat.php @@ -65,7 +65,7 @@ if ( !function_exists('json_encode') ) { 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 @@ if ( !function_exists('json_decode') ) { 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(); } diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php index c3d2e04e05..660df9afca 100644 --- a/wp-includes/deprecated.php +++ b/wp-includes/deprecated.php @@ -2684,7 +2684,7 @@ function sanitize_user_object($user, $context = 'display') { 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) ) diff --git a/wp-includes/functions.wp-scripts.php b/wp-includes/functions.wp-scripts.php index 638693716c..43c5c079ca 100644 --- a/wp-includes/functions.wp-scripts.php +++ b/wp-includes/functions.wp-scripts.php @@ -35,7 +35,7 @@ function wp_print_scripts( $handles = false ) { $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.' ), 'wp_enqueue_scripts', 'admin_enqueue_scripts', 'login_enqueue_scripts' ), '3.3' ); @@ -72,7 +72,7 @@ function wp_print_scripts( $handles = false ) { */ 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.' ), 'wp_enqueue_scripts', 'admin_enqueue_scripts', 'login_enqueue_scripts' ), '3.3' ); @@ -115,7 +115,7 @@ function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_f */ 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.' ), 'wp_enqueue_scripts', 'admin_enqueue_scripts', 'login_enqueue_scripts' ), '3.3' ); @@ -141,7 +141,7 @@ function wp_localize_script( $handle, $object_name, $l10n ) { */ 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.' ), 'wp_enqueue_scripts', 'admin_enqueue_scripts', 'login_enqueue_scripts' ), '3.3' ); @@ -197,7 +197,7 @@ function wp_deregister_script( $handle ) { */ 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.' ), 'wp_enqueue_scripts', 'admin_enqueue_scripts', 'login_enqueue_scripts' ), '3.3' ); @@ -229,7 +229,7 @@ function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false */ 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.' ), 'wp_enqueue_scripts', 'admin_enqueue_scripts', 'login_enqueue_scripts' ), '3.3' ); @@ -254,7 +254,7 @@ function wp_dequeue_script( $handle ) { */ 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.' ), 'wp_enqueue_scripts', 'admin_enqueue_scripts', 'login_enqueue_scripts' ), '3.3' ); diff --git a/wp-includes/functions.wp-styles.php b/wp-includes/functions.wp-styles.php index ead62965eb..eba12169b8 100644 --- a/wp-includes/functions.wp-styles.php +++ b/wp-includes/functions.wp-styles.php @@ -34,7 +34,7 @@ function wp_print_styles( $handles = false ) { 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.' ), 'wp_enqueue_scripts', 'admin_enqueue_scripts', 'login_enqueue_scripts' ), '3.3' ); @@ -67,7 +67,7 @@ function wp_print_styles( $handles = false ) { */ 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.' ), 'wp_enqueue_scripts', 'admin_enqueue_scripts', 'login_enqueue_scripts' ), '3.3' ); @@ -102,7 +102,7 @@ function wp_add_inline_style( $handle, $data ) { */ 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.' ), 'wp_enqueue_scripts', 'admin_enqueue_scripts', 'login_enqueue_scripts' ), '3.3' ); @@ -124,7 +124,7 @@ function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media */ 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.' ), 'wp_enqueue_scripts', 'admin_enqueue_scripts', 'login_enqueue_scripts' ), '3.3' ); @@ -157,7 +157,7 @@ function wp_deregister_style( $handle ) { */ 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.' ), 'wp_enqueue_scripts', 'admin_enqueue_scripts', 'login_enqueue_scripts' ), '3.3' ); @@ -183,7 +183,7 @@ function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, */ 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.' ), 'wp_enqueue_scripts', 'admin_enqueue_scripts', 'login_enqueue_scripts' ), '3.3' ); @@ -207,7 +207,7 @@ function wp_dequeue_style( $handle ) { */ 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.' ), 'wp_enqueue_scripts', 'admin_enqueue_scripts', 'login_enqueue_scripts' ), '3.3' ); diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index c7e06a5fd3..de0f921dab 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -2849,8 +2849,9 @@ function wp_admin_css_uri( $file = 'wp-admin' ) { */ 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 $handle = 0 === strpos( $file, 'css/' ) ? substr( $file, 4 ) : $file; diff --git a/wp-includes/ms-functions.php b/wp-includes/ms-functions.php index 28d2db4c71..92af129c04 100644 --- a/wp-includes/ms-functions.php +++ b/wp-includes/ms-functions.php @@ -2005,11 +2005,12 @@ function fix_phpmailer_messageid( $phpmailer ) { * @return bool */ function is_user_spammy( $user = null ) { - if ( ! is_a( $user, 'WP_User' ) ) { - if ( $user ) + if ( ! ( $user instanceof WP_User ) ) { + if ( $user ) { $user = get_user_by( 'login', $user ); - else + } else { $user = wp_get_current_user(); + } } return $user && isset( $user->spam ) && 1 == $user->spam; diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index 468b92610e..692df2f34a 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -260,7 +260,7 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() global $phpmailer; // (Re)create it, if it's gone missing - if ( !is_object( $phpmailer ) || !is_a( $phpmailer, 'PHPMailer' ) ) { + if ( ! ( $phpmailer instanceof PHPMailer ) ) { require_once ABSPATH . WPINC . '/class-phpmailer.php'; require_once ABSPATH . WPINC . '/class-smtp.php'; $phpmailer = new PHPMailer( true ); diff --git a/wp-includes/post.php b/wp-includes/post.php index 2a5bda73b7..3d1227ff9a 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -422,7 +422,7 @@ function get_post( $post = null, $output = OBJECT, $filter = 'raw' ) { 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 ) ) { diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 158499d2f1..817f4258eb 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -778,8 +778,9 @@ function print_head_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(); $wp_scripts->do_concat = $concatenate_scripts; @@ -808,9 +809,9 @@ function print_head_scripts() { 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(); $wp_scripts->do_concat = $concatenate_scripts; $wp_scripts->do_footer_items(); @@ -892,9 +893,9 @@ function wp_print_head_scripts() { 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(); } @@ -947,8 +948,9 @@ function wp_enqueue_scripts() { function print_admin_styles() { global $wp_styles, $concatenate_scripts; - if ( !is_a($wp_styles, 'WP_Styles') ) + if ( ! ( $wp_styles instanceof WP_Styles ) ) { $wp_styles = new WP_Styles(); + } script_concat_settings(); $wp_styles->do_concat = $concatenate_scripts; @@ -977,8 +979,9 @@ function print_admin_styles() { 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_styles->do_footer_items(); diff --git a/wp-includes/template.php b/wp-includes/template.php index ae2e43bb42..cfe9bb06aa 100644 --- a/wp-includes/template.php +++ b/wp-includes/template.php @@ -135,7 +135,7 @@ function get_author_template() { $templates = array(); - if ( is_a( $author, 'WP_User' ) ) { + if ( $author instanceof WP_User ) { $templates[] = "author-{$author->user_nicename}.php"; $templates[] = "author-{$author->ID}.php"; } diff --git a/wp-includes/theme.php b/wp-includes/theme.php index cc2c4cbc01..3ed557b136 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -2027,5 +2027,5 @@ function wp_customize_support_script() { function is_customize_preview() { global $wp_customize; - return is_a( $wp_customize, 'WP_Customize_Manager' ) && $wp_customize->is_preview(); + return ( $wp_customize instanceof WP_Customize_Manager ) && $wp_customize->is_preview(); } diff --git a/wp-includes/user.php b/wp-includes/user.php index 15a20f3b98..00f27a8f29 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -112,7 +112,7 @@ function wp_signon( $credentials = array(), $secure_cookie = '' ) { * @return WP_User|WP_Error WP_User on success, WP_Error on failure. */ function wp_authenticate_username_password($user, $username, $password) { - if ( is_a( $user, 'WP_User' ) ) { + if ( $user instanceof WP_User ) { return $user; } @@ -167,7 +167,7 @@ function wp_authenticate_username_password($user, $username, $password) { * @return WP_User|WP_Error WP_User on success, WP_Error on failure. */ function wp_authenticate_cookie($user, $username, $password) { - if ( is_a( $user, 'WP_User' ) ) { + if ( $user instanceof WP_User ) { return $user; } @@ -202,7 +202,7 @@ function wp_authenticate_cookie($user, $username, $password) { * @return WP_User|WP_Error WP_User on success, WP_Error if the user is considered a spammer. */ function wp_authenticate_spam_check( $user ) { - if ( $user && is_a( $user, 'WP_User' ) && is_multisite() ) { + if ( $user instanceof WP_User && is_multisite() ) { /** * Filter whether the user has been marked as a spammer. * @@ -1710,9 +1710,9 @@ function validate_username( $username ) { 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(); } // Are we updating or creating? @@ -1969,10 +1969,11 @@ function wp_insert_user( $userdata ) { * @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']; diff --git a/wp-includes/version.php b/wp-includes/version.php index b953ee3fb9..23a19c297c 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.2-alpha-31187'; +$wp_version = '4.2-alpha-31188'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index f6502d45f9..40bf54c528 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -1552,8 +1552,9 @@ function the_widget( $widget, $instance = array(), $args = array() ) { 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('
', $widget_obj->widget_options['classname'] ); $default_args = array( 'before_widget' => $before_widget, 'after_widget' => "
", 'before_title' => '

', 'after_title' => '

' );