mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-04 20:54:29 +00:00
In PHP 5.0.0, is_a() became deprecated in favour of the instanceof operator. Calling is_a() would result in an E_STRICT warning.
In PHP 5.3.0, `is_a()` is no longer deprecated, and will therefore no longer throw `E_STRICT` warnings. To avoid warnings in PHP < 5.3.0, convert all `is_a()` calls to `$var instanceof WP_Class` calls. `instanceof` does not throw any error if the variable being tested is not an object, it simply returns `false`. Props markoheijnen, wonderboymusic. Fixes #25672. git-svn-id: https://develop.svn.wordpress.org/trunk@31188 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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.' ),
|
||||
'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '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.' ),
|
||||
'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '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.' ),
|
||||
'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '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.' ),
|
||||
'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '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.' ),
|
||||
'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '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.' ),
|
||||
'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '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.' ),
|
||||
'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '3.3' );
|
||||
|
||||
Reference in New Issue
Block a user