Coding Standards: Use strict type check for `in_array()` and `array_search()` where strings are involved.
This reduces the number of `WordPress.PHP.StrictInArray.MissingTrueStrict` issues from 486 to 50. Includes minor code layout fixes for better readability. See #49542. Built from https://develop.svn.wordpress.org/trunk@47550 git-svn-id: http://core.svn.wordpress.org/trunk@47325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
10e3e44219
commit
38676936ba
|
@ -57,7 +57,7 @@ if ( null === $result || ( is_wp_error( $result ) && 'invalid_key' === $result->
|
||||||
} elseif ( is_wp_error( $result ) ) {
|
} elseif ( is_wp_error( $result ) ) {
|
||||||
$error_code = $result->get_error_code();
|
$error_code = $result->get_error_code();
|
||||||
|
|
||||||
if ( ! in_array( $error_code, $valid_error_codes ) ) {
|
if ( ! in_array( $error_code, $valid_error_codes, true ) ) {
|
||||||
status_header( 400 );
|
status_header( 400 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ get_header( 'wp-activate' );
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
} else {
|
} else {
|
||||||
if ( is_wp_error( $result ) && in_array( $result->get_error_code(), $valid_error_codes ) ) {
|
if ( is_wp_error( $result ) && in_array( $result->get_error_code(), $valid_error_codes, true ) ) {
|
||||||
$signup = $result->get_error_data();
|
$signup = $result->get_error_data();
|
||||||
?>
|
?>
|
||||||
<h2><?php _e( 'Your account is now active!' ); ?></h2>
|
<h2><?php _e( 'Your account is now active!' ); ?></h2>
|
||||||
|
|
|
@ -146,11 +146,11 @@ $core_actions_post_deprecated = array( 'wp-fullscreen-save-post', 'press-this-sa
|
||||||
$core_actions_post = array_merge( $core_actions_post, $core_actions_post_deprecated );
|
$core_actions_post = array_merge( $core_actions_post, $core_actions_post_deprecated );
|
||||||
|
|
||||||
// Register core Ajax calls.
|
// Register core Ajax calls.
|
||||||
if ( ! empty( $_GET['action'] ) && in_array( $_GET['action'], $core_actions_get ) ) {
|
if ( ! empty( $_GET['action'] ) && in_array( $_GET['action'], $core_actions_get, true ) ) {
|
||||||
add_action( 'wp_ajax_' . $_GET['action'], 'wp_ajax_' . str_replace( '-', '_', $_GET['action'] ), 1 );
|
add_action( 'wp_ajax_' . $_GET['action'], 'wp_ajax_' . str_replace( '-', '_', $_GET['action'] ), 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty( $_POST['action'] ) && in_array( $_POST['action'], $core_actions_post ) ) {
|
if ( ! empty( $_POST['action'] ) && in_array( $_POST['action'], $core_actions_post, true ) ) {
|
||||||
add_action( 'wp_ajax_' . $_POST['action'], 'wp_ajax_' . str_replace( '-', '_', $_POST['action'] ), 1 );
|
add_action( 'wp_ajax_' . $_POST['action'], 'wp_ajax_' . str_replace( '-', '_', $_POST['action'] ), 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -255,7 +255,7 @@ switch ( $action ) {
|
||||||
case 'unapprovecomment':
|
case 'unapprovecomment':
|
||||||
$comment_id = absint( $_REQUEST['c'] );
|
$comment_id = absint( $_REQUEST['c'] );
|
||||||
|
|
||||||
if ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) {
|
if ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ), true ) ) {
|
||||||
check_admin_referer( 'approve-comment_' . $comment_id );
|
check_admin_referer( 'approve-comment_' . $comment_id );
|
||||||
} else {
|
} else {
|
||||||
check_admin_referer( 'delete-comment_' . $comment_id );
|
check_admin_referer( 'delete-comment_' . $comment_id );
|
||||||
|
@ -275,7 +275,7 @@ switch ( $action ) {
|
||||||
$redir = wp_get_referer();
|
$redir = wp_get_referer();
|
||||||
} elseif ( '' != wp_get_original_referer() && ! $noredir ) {
|
} elseif ( '' != wp_get_original_referer() && ! $noredir ) {
|
||||||
$redir = wp_get_original_referer();
|
$redir = wp_get_original_referer();
|
||||||
} elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) {
|
} elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ), true ) ) {
|
||||||
$redir = admin_url( 'edit-comments.php?p=' . absint( $comment->comment_post_ID ) );
|
$redir = admin_url( 'edit-comments.php?p=' . absint( $comment->comment_post_ID ) );
|
||||||
} else {
|
} else {
|
||||||
$redir = admin_url( 'edit-comments.php' );
|
$redir = admin_url( 'edit-comments.php' );
|
||||||
|
|
|
@ -19,7 +19,7 @@ if ( ! $tax ) {
|
||||||
wp_die( __( 'Invalid taxonomy.' ) );
|
wp_die( __( 'Invalid taxonomy.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! in_array( $tax->name, get_taxonomies( array( 'show_ui' => true ) ) ) ) {
|
if ( ! in_array( $tax->name, get_taxonomies( array( 'show_ui' => true ) ), true ) ) {
|
||||||
wp_die( __( 'Sorry, you are not allowed to edit terms in this taxonomy.' ) );
|
wp_die( __( 'Sorry, you are not allowed to edit terms in this taxonomy.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ if ( ! $typenow ) {
|
||||||
wp_die( __( 'Invalid post type.' ) );
|
wp_die( __( 'Invalid post type.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ) ) ) {
|
if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ), true ) ) {
|
||||||
wp_die( __( 'Sorry, you are not allowed to edit posts in this post type.' ) );
|
wp_die( __( 'Sorry, you are not allowed to edit posts in this post type.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -976,7 +976,7 @@ function wp_ajax_dim_comment() {
|
||||||
|
|
||||||
check_ajax_referer( "approve-comment_$id" );
|
check_ajax_referer( "approve-comment_$id" );
|
||||||
|
|
||||||
if ( in_array( $current, array( 'unapproved', 'spam' ) ) ) {
|
if ( in_array( $current, array( 'unapproved', 'spam' ), true ) ) {
|
||||||
$result = wp_set_comment_status( $comment, 'approve', true );
|
$result = wp_set_comment_status( $comment, 'approve', true );
|
||||||
} else {
|
} else {
|
||||||
$result = wp_set_comment_status( $comment, 'hold', true );
|
$result = wp_set_comment_status( $comment, 'hold', true );
|
||||||
|
@ -1271,7 +1271,7 @@ function wp_ajax_replyto_comment( $action ) {
|
||||||
|
|
||||||
if ( empty( $post->post_status ) ) {
|
if ( empty( $post->post_status ) ) {
|
||||||
wp_die( 1 );
|
wp_die( 1 );
|
||||||
} elseif ( in_array( $post->post_status, array( 'draft', 'pending', 'trash' ) ) ) {
|
} elseif ( in_array( $post->post_status, array( 'draft', 'pending', 'trash' ), true ) ) {
|
||||||
wp_die( __( 'Error: You are replying to a comment on a draft post.' ) );
|
wp_die( __( 'Error: You are replying to a comment on a draft post.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2057,7 +2057,7 @@ function wp_ajax_inline_save() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hack: wp_unique_post_slug() doesn't work for drafts, so we will fake that our post is published.
|
// Hack: wp_unique_post_slug() doesn't work for drafts, so we will fake that our post is published.
|
||||||
if ( ! empty( $data['post_name'] ) && in_array( $post['post_status'], array( 'draft', 'pending' ) ) ) {
|
if ( ! empty( $data['post_name'] ) && in_array( $post['post_status'], array( 'draft', 'pending' ), true ) ) {
|
||||||
$post['post_status'] = 'publish';
|
$post['post_status'] = 'publish';
|
||||||
$data['post_name'] = wp_unique_post_slug( $data['post_name'], $post['ID'], $post['post_status'], $post['post_type'], $post['post_parent'] );
|
$data['post_name'] = wp_unique_post_slug( $data['post_name'], $post['ID'], $post['post_status'], $post['post_type'], $post['post_parent'] );
|
||||||
}
|
}
|
||||||
|
@ -2525,7 +2525,7 @@ function wp_ajax_upload_attachment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the context is custom header or background, make sure the uploaded file is an image.
|
// If the context is custom header or background, make sure the uploaded file is an image.
|
||||||
if ( isset( $post_data['context'] ) && in_array( $post_data['context'], array( 'custom-header', 'custom-background' ) ) ) {
|
if ( isset( $post_data['context'] ) && in_array( $post_data['context'], array( 'custom-header', 'custom-background' ), true ) ) {
|
||||||
$wp_filetype = wp_check_filetype_and_ext( $_FILES['async-upload']['tmp_name'], $_FILES['async-upload']['name'] );
|
$wp_filetype = wp_check_filetype_and_ext( $_FILES['async-upload']['tmp_name'], $_FILES['async-upload']['name'] );
|
||||||
|
|
||||||
if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) {
|
if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) {
|
||||||
|
@ -2852,7 +2852,7 @@ function wp_ajax_dismiss_wp_pointer() {
|
||||||
|
|
||||||
$dismissed = array_filter( explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ) );
|
$dismissed = array_filter( explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ) );
|
||||||
|
|
||||||
if ( in_array( $pointer, $dismissed ) ) {
|
if ( in_array( $pointer, $dismissed, true ) ) {
|
||||||
wp_die( 0 );
|
wp_die( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -601,7 +601,7 @@ class Custom_Background {
|
||||||
);
|
);
|
||||||
|
|
||||||
$size = 'thumbnail';
|
$size = 'thumbnail';
|
||||||
if ( in_array( $_POST['size'], $sizes ) ) {
|
if ( in_array( $_POST['size'], $sizes, true ) ) {
|
||||||
$size = esc_attr( $_POST['size'] );
|
$size = esc_attr( $_POST['size'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1097,7 +1097,7 @@ endif;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( in_array( $choice, array( 'remove-header', 'random-default-image', 'random-uploaded-image' ) ) ) {
|
if ( in_array( $choice, array( 'remove-header', 'random-default-image', 'random-uploaded-image' ), true ) ) {
|
||||||
set_theme_mod( 'header_image', $choice );
|
set_theme_mod( 'header_image', $choice );
|
||||||
remove_theme_mod( 'header_image_data' );
|
remove_theme_mod( 'header_image_data' );
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -82,7 +82,8 @@ class Walker_Category_Checklist extends Walker {
|
||||||
}
|
}
|
||||||
|
|
||||||
$args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
|
$args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
|
||||||
$class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
|
|
||||||
|
$class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
|
||||||
|
|
||||||
$args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
|
$args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
|
||||||
|
|
||||||
|
|
|
@ -577,7 +577,7 @@ class WP_Automatic_Updater {
|
||||||
*/
|
*/
|
||||||
$send = true;
|
$send = true;
|
||||||
$transient_failures = array( 'incompatible_archive', 'download_failed', 'insane_distro', 'locked' );
|
$transient_failures = array( 'incompatible_archive', 'download_failed', 'insane_distro', 'locked' );
|
||||||
if ( in_array( $error_code, $transient_failures ) && ! get_site_option( 'auto_core_update_failed' ) ) {
|
if ( in_array( $error_code, $transient_failures, true ) && ! get_site_option( 'auto_core_update_failed' ) ) {
|
||||||
wp_schedule_single_event( time() + HOUR_IN_SECONDS, 'wp_maybe_auto_update' );
|
wp_schedule_single_event( time() + HOUR_IN_SECONDS, 'wp_maybe_auto_update' );
|
||||||
$send = false;
|
$send = false;
|
||||||
}
|
}
|
||||||
|
@ -596,7 +596,7 @@ class WP_Automatic_Updater {
|
||||||
'error_code' => $error_code,
|
'error_code' => $error_code,
|
||||||
'error_data' => $result->get_error_data(),
|
'error_data' => $result->get_error_data(),
|
||||||
'timestamp' => time(),
|
'timestamp' => time(),
|
||||||
'retry' => in_array( $error_code, $transient_failures ),
|
'retry' => in_array( $error_code, $transient_failures, true ),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||||
global $post_id, $comment_status, $search, $comment_type;
|
global $post_id, $comment_status, $search, $comment_type;
|
||||||
|
|
||||||
$comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all';
|
$comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all';
|
||||||
if ( ! in_array( $comment_status, array( 'all', 'mine', 'moderated', 'approved', 'spam', 'trash' ) ) ) {
|
if ( ! in_array( $comment_status, array( 'all', 'mine', 'moderated', 'approved', 'spam', 'trash' ), true ) ) {
|
||||||
$comment_status = 'all';
|
$comment_status = 'all';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,13 +344,13 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||||
global $comment_status;
|
global $comment_status;
|
||||||
|
|
||||||
$actions = array();
|
$actions = array();
|
||||||
if ( in_array( $comment_status, array( 'all', 'approved' ) ) ) {
|
if ( in_array( $comment_status, array( 'all', 'approved' ), true ) ) {
|
||||||
$actions['unapprove'] = __( 'Unapprove' );
|
$actions['unapprove'] = __( 'Unapprove' );
|
||||||
}
|
}
|
||||||
if ( in_array( $comment_status, array( 'all', 'moderated' ) ) ) {
|
if ( in_array( $comment_status, array( 'all', 'moderated' ), true ) ) {
|
||||||
$actions['approve'] = __( 'Approve' );
|
$actions['approve'] = __( 'Approve' );
|
||||||
}
|
}
|
||||||
if ( in_array( $comment_status, array( 'all', 'moderated', 'approved', 'trash' ) ) ) {
|
if ( in_array( $comment_status, array( 'all', 'moderated', 'approved', 'trash' ), true ) ) {
|
||||||
$actions['spam'] = _x( 'Mark as Spam', 'comment' );
|
$actions['spam'] = _x( 'Mark as Spam', 'comment' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||||
$actions['unspam'] = _x( 'Not Spam', 'comment' );
|
$actions['unspam'] = _x( 'Not Spam', 'comment' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( in_array( $comment_status, array( 'trash', 'spam' ) ) || ! EMPTY_TRASH_DAYS ) {
|
if ( in_array( $comment_status, array( 'trash', 'spam' ), true ) || ! EMPTY_TRASH_DAYS ) {
|
||||||
$actions['delete'] = __( 'Delete Permanently' );
|
$actions['delete'] = __( 'Delete Permanently' );
|
||||||
} else {
|
} else {
|
||||||
$actions['trash'] = __( 'Move to Trash' );
|
$actions['trash'] = __( 'Move to Trash' );
|
||||||
|
|
|
@ -466,7 +466,7 @@ class WP_Community_Events {
|
||||||
$trimmed_event_types = wp_list_pluck( $response_body['events'], 'type' );
|
$trimmed_event_types = wp_list_pluck( $response_body['events'], 'type' );
|
||||||
|
|
||||||
// Make sure the soonest upcoming WordCamp is pinned in the list.
|
// Make sure the soonest upcoming WordCamp is pinned in the list.
|
||||||
if ( ! in_array( 'wordcamp', $trimmed_event_types ) && $wordcamps ) {
|
if ( ! in_array( 'wordcamp', $trimmed_event_types, true ) && $wordcamps ) {
|
||||||
array_pop( $response_body['events'] );
|
array_pop( $response_body['events'] );
|
||||||
array_push( $response_body['events'], $wordcamps[0] );
|
array_push( $response_body['events'], $wordcamps[0] );
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,7 +181,7 @@ class WP_List_Table {
|
||||||
* @return mixed Property.
|
* @return mixed Property.
|
||||||
*/
|
*/
|
||||||
public function __get( $name ) {
|
public function __get( $name ) {
|
||||||
if ( in_array( $name, $this->compat_fields ) ) {
|
if ( in_array( $name, $this->compat_fields, true ) ) {
|
||||||
return $this->$name;
|
return $this->$name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,7 @@ class WP_List_Table {
|
||||||
* @return mixed Newly-set property.
|
* @return mixed Newly-set property.
|
||||||
*/
|
*/
|
||||||
public function __set( $name, $value ) {
|
public function __set( $name, $value ) {
|
||||||
if ( in_array( $name, $this->compat_fields ) ) {
|
if ( in_array( $name, $this->compat_fields, true ) ) {
|
||||||
return $this->$name = $value;
|
return $this->$name = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ class WP_List_Table {
|
||||||
* @return bool Whether the property is set.
|
* @return bool Whether the property is set.
|
||||||
*/
|
*/
|
||||||
public function __isset( $name ) {
|
public function __isset( $name ) {
|
||||||
if ( in_array( $name, $this->compat_fields ) ) {
|
if ( in_array( $name, $this->compat_fields, true ) ) {
|
||||||
return isset( $this->$name );
|
return isset( $this->$name );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,7 @@ class WP_List_Table {
|
||||||
* @param string $name Property to unset.
|
* @param string $name Property to unset.
|
||||||
*/
|
*/
|
||||||
public function __unset( $name ) {
|
public function __unset( $name ) {
|
||||||
if ( in_array( $name, $this->compat_fields ) ) {
|
if ( in_array( $name, $this->compat_fields, true ) ) {
|
||||||
unset( $this->$name );
|
unset( $this->$name );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -238,7 +238,7 @@ class WP_List_Table {
|
||||||
* @return mixed|bool Return value of the callback, false otherwise.
|
* @return mixed|bool Return value of the callback, false otherwise.
|
||||||
*/
|
*/
|
||||||
public function __call( $name, $arguments ) {
|
public function __call( $name, $arguments ) {
|
||||||
if ( in_array( $name, $this->compat_methods ) ) {
|
if ( in_array( $name, $this->compat_methods, true ) ) {
|
||||||
return $this->$name( ...$arguments );
|
return $this->$name( ...$arguments );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -1133,13 +1133,13 @@ class WP_List_Table {
|
||||||
foreach ( $columns as $column_key => $column_display_name ) {
|
foreach ( $columns as $column_key => $column_display_name ) {
|
||||||
$class = array( 'manage-column', "column-$column_key" );
|
$class = array( 'manage-column', "column-$column_key" );
|
||||||
|
|
||||||
if ( in_array( $column_key, $hidden ) ) {
|
if ( in_array( $column_key, $hidden, true ) ) {
|
||||||
$class[] = 'hidden';
|
$class[] = 'hidden';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'cb' === $column_key ) {
|
if ( 'cb' === $column_key ) {
|
||||||
$class[] = 'check-column';
|
$class[] = 'check-column';
|
||||||
} elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ) ) ) {
|
} elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ), true ) ) {
|
||||||
$class[] = 'num';
|
$class[] = 'num';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1329,7 +1329,7 @@ class WP_List_Table {
|
||||||
$classes .= ' has-row-actions column-primary';
|
$classes .= ' has-row-actions column-primary';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( in_array( $column_name, $hidden ) ) {
|
if ( in_array( $column_name, $hidden, true ) ) {
|
||||||
$classes .= ' hidden';
|
$classes .= ' hidden';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
|
||||||
);
|
);
|
||||||
|
|
||||||
$status = isset( $_REQUEST['theme_status'] ) ? $_REQUEST['theme_status'] : 'all';
|
$status = isset( $_REQUEST['theme_status'] ) ? $_REQUEST['theme_status'] : 'all';
|
||||||
if ( ! in_array( $status, array( 'all', 'enabled', 'disabled', 'upgrade', 'search', 'broken' ) ) ) {
|
if ( ! in_array( $status, array( 'all', 'enabled', 'disabled', 'upgrade', 'search', 'broken' ), true ) ) {
|
||||||
$status = 'all';
|
$status = 'all';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
|
||||||
$totals[ $type ] = count( $list );
|
$totals[ $type ] = count( $list );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( empty( $themes[ $status ] ) && ! in_array( $status, array( 'all', 'search' ) ) ) {
|
if ( empty( $themes[ $status ] ) && ! in_array( $status, array( 'all', 'search' ), true ) ) {
|
||||||
$status = 'all';
|
$status = 'all';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -674,7 +674,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
|
||||||
|
|
||||||
foreach ( $columns as $column_name => $column_display_name ) {
|
foreach ( $columns as $column_name => $column_display_name ) {
|
||||||
$extra_classes = '';
|
$extra_classes = '';
|
||||||
if ( in_array( $column_name, $hidden ) ) {
|
if ( in_array( $column_name, $hidden, true ) ) {
|
||||||
$extra_classes .= ' hidden';
|
$extra_classes .= ' hidden';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -281,7 +281,7 @@ class WP_MS_Users_List_Table extends WP_List_Table {
|
||||||
<?php
|
<?php
|
||||||
echo $edit;
|
echo $edit;
|
||||||
|
|
||||||
if ( in_array( $user->user_login, $super_admins ) ) {
|
if ( in_array( $user->user_login, $super_admins, true ) ) {
|
||||||
echo ' — ' . __( 'Super Admin' );
|
echo ' — ' . __( 'Super Admin' );
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -136,7 +136,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
|
||||||
$nonmenu_tabs = apply_filters( 'install_plugins_nonmenu_tabs', $nonmenu_tabs );
|
$nonmenu_tabs = apply_filters( 'install_plugins_nonmenu_tabs', $nonmenu_tabs );
|
||||||
|
|
||||||
// If a non-valid menu tab has been selected, And it's not a non-menu action.
|
// If a non-valid menu tab has been selected, And it's not a non-menu action.
|
||||||
if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs ) ) ) {
|
if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs, true ) ) ) {
|
||||||
$tab = key( $tabs );
|
$tab = key( $tabs );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,10 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$status_whitelist = array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search', 'paused' );
|
||||||
|
|
||||||
$status = 'all';
|
$status = 'all';
|
||||||
if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search', 'paused' ) ) ) {
|
if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], $status_whitelist, true ) ) {
|
||||||
$status = $_REQUEST['plugin_status'];
|
$status = $_REQUEST['plugin_status'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +245,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
||||||
$totals[ $type ] = count( $list );
|
$totals[ $type ] = count( $list );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( empty( $plugins[ $status ] ) && ! in_array( $status, array( 'all', 'search' ) ) ) {
|
if ( empty( $plugins[ $status ] ) && ! in_array( $status, array( 'all', 'search' ), true ) ) {
|
||||||
$status = 'all';
|
$status = 'all';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,7 +400,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
||||||
global $status;
|
global $status;
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'cb' => ! in_array( $status, array( 'mustuse', 'dropins' ) ) ? '<input type="checkbox" />' : '',
|
'cb' => ! in_array( $status, array( 'mustuse', 'dropins' ), true ) ? '<input type="checkbox" />' : '',
|
||||||
'name' => __( 'Plugin' ),
|
'name' => __( 'Plugin' ),
|
||||||
'description' => __( 'Description' ),
|
'description' => __( 'Description' ),
|
||||||
);
|
);
|
||||||
|
@ -542,7 +544,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
||||||
public function bulk_actions( $which = '' ) {
|
public function bulk_actions( $which = '' ) {
|
||||||
global $status;
|
global $status;
|
||||||
|
|
||||||
if ( in_array( $status, array( 'mustuse', 'dropins' ) ) ) {
|
if ( in_array( $status, array( 'mustuse', 'dropins' ), true ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,7 +558,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
||||||
protected function extra_tablenav( $which ) {
|
protected function extra_tablenav( $which ) {
|
||||||
global $status;
|
global $status;
|
||||||
|
|
||||||
if ( ! in_array( $status, array( 'recently_activated', 'mustuse', 'dropins' ) ) ) {
|
if ( ! in_array( $status, array( 'recently_activated', 'mustuse', 'dropins' ), true ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,7 +599,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
||||||
public function display_rows() {
|
public function display_rows() {
|
||||||
global $status;
|
global $status;
|
||||||
|
|
||||||
if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ) ) ) {
|
if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ), true ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -831,7 +833,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
||||||
$compatible_php = is_php_version_compatible( $requires_php );
|
$compatible_php = is_php_version_compatible( $requires_php );
|
||||||
$class = $is_active ? 'active' : 'inactive';
|
$class = $is_active ? 'active' : 'inactive';
|
||||||
$checkbox_id = 'checkbox_' . md5( $plugin_data['Name'] );
|
$checkbox_id = 'checkbox_' . md5( $plugin_data['Name'] );
|
||||||
if ( $restrict_network_active || $restrict_network_only || in_array( $status, array( 'mustuse', 'dropins' ) ) || ! $compatible_php ) {
|
if ( $restrict_network_active || $restrict_network_only || in_array( $status, array( 'mustuse', 'dropins' ), true ) || ! $compatible_php ) {
|
||||||
$checkbox = '';
|
$checkbox = '';
|
||||||
} else {
|
} else {
|
||||||
$checkbox = sprintf(
|
$checkbox = sprintf(
|
||||||
|
@ -870,7 +872,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
||||||
|
|
||||||
foreach ( $columns as $column_name => $column_display_name ) {
|
foreach ( $columns as $column_name => $column_display_name ) {
|
||||||
$extra_classes = '';
|
$extra_classes = '';
|
||||||
if ( in_array( $column_name, $hidden ) ) {
|
if ( in_array( $column_name, $hidden, true ) ) {
|
||||||
$extra_classes = ' hidden';
|
$extra_classes = ' hidden';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||||
} else {
|
} else {
|
||||||
$post_counts = (array) wp_count_posts( $post_type, 'readable' );
|
$post_counts = (array) wp_count_posts( $post_type, 'readable' );
|
||||||
|
|
||||||
if ( isset( $_REQUEST['post_status'] ) && in_array( $_REQUEST['post_status'], $avail_post_stati ) ) {
|
if ( isset( $_REQUEST['post_status'] ) && in_array( $_REQUEST['post_status'], $avail_post_stati, true ) ) {
|
||||||
$total_items = $post_counts[ $_REQUEST['post_status'] ];
|
$total_items = $post_counts[ $_REQUEST['post_status'] ];
|
||||||
} elseif ( isset( $_REQUEST['show_sticky'] ) && $_REQUEST['show_sticky'] ) {
|
} elseif ( isset( $_REQUEST['show_sticky'] ) && $_REQUEST['show_sticky'] ) {
|
||||||
$total_items = $this->sticky_posts_count;
|
$total_items = $this->sticky_posts_count;
|
||||||
|
@ -346,7 +346,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||||
|
|
||||||
$status_name = $status->name;
|
$status_name = $status->name;
|
||||||
|
|
||||||
if ( ! in_array( $status_name, $avail_post_stati ) || empty( $num_posts->$status_name ) ) {
|
if ( ! in_array( $status_name, $avail_post_stati, true ) || empty( $num_posts->$status_name ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,7 +391,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Sticky comes after Publish, or if not listed, after All.
|
// Sticky comes after Publish, or if not listed, after All.
|
||||||
$split = 1 + array_search( ( isset( $status_links['publish'] ) ? 'publish' : 'all' ), array_keys( $status_links ) );
|
$split = 1 + array_search( ( isset( $status_links['publish'] ) ? 'publish' : 'all' ), array_keys( $status_links ), true );
|
||||||
$status_links = array_merge( array_slice( $status_links, 0, $split ), $sticky_link, array_slice( $status_links, $split ) );
|
$status_links = array_merge( array_slice( $status_links, 0, $split ), $sticky_link, array_slice( $status_links, $split ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -646,7 +646,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||||
}
|
}
|
||||||
|
|
||||||
$post_status = ! empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all';
|
$post_status = ! empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all';
|
||||||
if ( post_type_supports( $post_type, 'comments' ) && ! in_array( $post_status, array( 'pending', 'draft', 'future' ) ) ) {
|
if ( post_type_supports( $post_type, 'comments' ) && ! in_array( $post_status, array( 'pending', 'draft', 'future' ), true ) ) {
|
||||||
$posts_columns['comments'] = '<span class="vers comment-grey-bubble" title="' . esc_attr__( 'Comments' ) . '"><span class="screen-reader-text">' . __( 'Comments' ) . '</span></span>';
|
$posts_columns['comments'] = '<span class="vers comment-grey-bubble" title="' . esc_attr__( 'Comments' ) . '"><span class="screen-reader-text">' . __( 'Comments' ) . '</span></span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1384,7 +1384,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( is_post_type_viewable( $post_type_object ) ) {
|
if ( is_post_type_viewable( $post_type_object ) ) {
|
||||||
if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) {
|
if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ), true ) ) {
|
||||||
if ( $can_edit_post ) {
|
if ( $can_edit_post ) {
|
||||||
$preview_link = get_preview_post_link( $post );
|
$preview_link = get_preview_post_link( $post );
|
||||||
$actions['view'] = sprintf(
|
$actions['view'] = sprintf(
|
||||||
|
|
|
@ -1157,7 +1157,7 @@ final class WP_Screen {
|
||||||
|
|
||||||
foreach ( $columns as $column => $title ) {
|
foreach ( $columns as $column => $title ) {
|
||||||
// Can't hide these for they are special.
|
// Can't hide these for they are special.
|
||||||
if ( in_array( $column, $special ) ) {
|
if ( in_array( $column, $special, true ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1174,7 +1174,7 @@ final class WP_Screen {
|
||||||
|
|
||||||
$id = "$column-hide";
|
$id = "$column-hide";
|
||||||
echo '<label>';
|
echo '<label>';
|
||||||
echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked( ! in_array( $column, $hidden ), true, false ) . ' />';
|
echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked( ! in_array( $column, $hidden, true ), true, false ) . ' />';
|
||||||
echo "$title</label>\n";
|
echo "$title</label>\n";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -1310,7 +1310,7 @@ final class WP_Screen {
|
||||||
*/
|
*/
|
||||||
$view_mode_post_types = apply_filters( 'view_mode_post_types', $view_mode_post_types );
|
$view_mode_post_types = apply_filters( 'view_mode_post_types', $view_mode_post_types );
|
||||||
|
|
||||||
if ( ! in_array( $this->post_type, $view_mode_post_types ) ) {
|
if ( ! in_array( $this->post_type, $view_mode_post_types, true ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ class WP_Terms_List_Table extends WP_List_Table {
|
||||||
$tax = get_taxonomy( $taxonomy );
|
$tax = get_taxonomy( $taxonomy );
|
||||||
|
|
||||||
// @todo Still needed? Maybe just the show_ui part.
|
// @todo Still needed? Maybe just the show_ui part.
|
||||||
if ( empty( $post_type ) || ! in_array( $post_type, get_post_types( array( 'show_ui' => true ) ) ) ) {
|
if ( empty( $post_type ) || ! in_array( $post_type, get_post_types( array( 'show_ui' => true ) ), true ) ) {
|
||||||
$post_type = 'post';
|
$post_type = 'post';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
|
||||||
$nonmenu_tabs = apply_filters( 'install_themes_nonmenu_tabs', $nonmenu_tabs );
|
$nonmenu_tabs = apply_filters( 'install_themes_nonmenu_tabs', $nonmenu_tabs );
|
||||||
|
|
||||||
// If a non-valid menu tab has been selected, And it's not a non-menu action.
|
// If a non-valid menu tab has been selected, And it's not a non-menu action.
|
||||||
if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs ) ) ) {
|
if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs, true ) ) ) {
|
||||||
$tab = key( $tabs );
|
$tab = key( $tabs );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -302,14 +302,14 @@ class WP_Themes_List_Table extends WP_List_Table {
|
||||||
public function search_theme( $theme ) {
|
public function search_theme( $theme ) {
|
||||||
// Search the features.
|
// Search the features.
|
||||||
foreach ( $this->features as $word ) {
|
foreach ( $this->features as $word ) {
|
||||||
if ( ! in_array( $word, $theme->get( 'Tags' ) ) ) {
|
if ( ! in_array( $word, $theme->get( 'Tags' ), true ) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Match all phrases.
|
// Match all phrases.
|
||||||
foreach ( $this->search_terms as $word ) {
|
foreach ( $this->search_terms as $word ) {
|
||||||
if ( in_array( $word, $theme->get( 'Tags' ) ) ) {
|
if ( in_array( $word, $theme->get( 'Tags' ), true ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -545,7 +545,7 @@ class WP_Upgrader {
|
||||||
$protected_directories = array_merge( $protected_directories, $wp_theme_directories );
|
$protected_directories = array_merge( $protected_directories, $wp_theme_directories );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( in_array( $destination, $protected_directories ) ) {
|
if ( in_array( $destination, $protected_directories, true ) ) {
|
||||||
$remote_destination = trailingslashit( $remote_destination ) . trailingslashit( basename( $source ) );
|
$remote_destination = trailingslashit( $remote_destination ) . trailingslashit( basename( $source ) );
|
||||||
$destination = trailingslashit( $destination ) . trailingslashit( basename( $source ) );
|
$destination = trailingslashit( $destination ) . trailingslashit( basename( $source ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -517,7 +517,7 @@ class WP_Users_List_Table extends WP_List_Table {
|
||||||
$classes .= ' num'; // Special case for that column.
|
$classes .= ' num'; // Special case for that column.
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( in_array( $column_name, $hidden ) ) {
|
if ( in_array( $column_name, $hidden, true ) ) {
|
||||||
$classes .= ' hidden';
|
$classes .= ' hidden';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,7 @@ function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_
|
||||||
$side_widgets = array( 'dashboard_quick_press', 'dashboard_primary' );
|
$side_widgets = array( 'dashboard_quick_press', 'dashboard_primary' );
|
||||||
|
|
||||||
$location = 'normal';
|
$location = 'normal';
|
||||||
if ( in_array( $widget_id, $side_widgets ) ) {
|
if ( in_array( $widget_id, $side_widgets, true ) ) {
|
||||||
$location = 'side';
|
$location = 'side';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1215,7 +1215,7 @@ function verify_file_signature( $filename, $signatures, $filename_for_errors = f
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check we can process signatures.
|
// Check we can process signatures.
|
||||||
if ( ! function_exists( 'sodium_crypto_sign_verify_detached' ) || ! in_array( 'sha384', array_map( 'strtolower', hash_algos() ) ) ) {
|
if ( ! function_exists( 'sodium_crypto_sign_verify_detached' ) || ! in_array( 'sha384', array_map( 'strtolower', hash_algos() ), true ) ) {
|
||||||
return new WP_Error(
|
return new WP_Error(
|
||||||
'signature_verification_unsupported',
|
'signature_verification_unsupported',
|
||||||
sprintf(
|
sprintf(
|
||||||
|
@ -1540,7 +1540,7 @@ function _unzip_file_ziparchive( $file, $to, $needed_dirs = array() ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$parent_folder = dirname( $dir );
|
$parent_folder = dirname( $dir );
|
||||||
while ( ! empty( $parent_folder ) && untrailingslashit( $to ) != $parent_folder && ! in_array( $parent_folder, $needed_dirs ) ) {
|
while ( ! empty( $parent_folder ) && untrailingslashit( $to ) != $parent_folder && ! in_array( $parent_folder, $needed_dirs, true ) ) {
|
||||||
$needed_dirs[] = $parent_folder;
|
$needed_dirs[] = $parent_folder;
|
||||||
$parent_folder = dirname( $parent_folder );
|
$parent_folder = dirname( $parent_folder );
|
||||||
}
|
}
|
||||||
|
@ -1666,7 +1666,7 @@ function _unzip_file_pclzip( $file, $to, $needed_dirs = array() ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$parent_folder = dirname( $dir );
|
$parent_folder = dirname( $dir );
|
||||||
while ( ! empty( $parent_folder ) && untrailingslashit( $to ) != $parent_folder && ! in_array( $parent_folder, $needed_dirs ) ) {
|
while ( ! empty( $parent_folder ) && untrailingslashit( $to ) != $parent_folder && ! in_array( $parent_folder, $needed_dirs, true ) ) {
|
||||||
$needed_dirs[] = $parent_folder;
|
$needed_dirs[] = $parent_folder;
|
||||||
$parent_folder = dirname( $parent_folder );
|
$parent_folder = dirname( $parent_folder );
|
||||||
}
|
}
|
||||||
|
|
|
@ -950,7 +950,7 @@ function wp_media_upload_handler() {
|
||||||
if ( isset( $_GET['tab'] ) && 'type_url' === $_GET['tab'] ) {
|
if ( isset( $_GET['tab'] ) && 'type_url' === $_GET['tab'] ) {
|
||||||
$type = 'image';
|
$type = 'image';
|
||||||
|
|
||||||
if ( isset( $_GET['type'] ) && in_array( $_GET['type'], array( 'video', 'audio', 'file' ) ) ) {
|
if ( isset( $_GET['type'] ) && in_array( $_GET['type'], array( 'video', 'audio', 'file' ), true ) ) {
|
||||||
$type = $_GET['type'];
|
$type = $_GET['type'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -334,7 +334,7 @@ endif;
|
||||||
<div id="publishing-action">
|
<div id="publishing-action">
|
||||||
<span class="spinner"></span>
|
<span class="spinner"></span>
|
||||||
<?php
|
<?php
|
||||||
if ( ! in_array( $post->post_status, array( 'publish', 'future', 'private' ) ) || 0 == $post->ID ) {
|
if ( ! in_array( $post->post_status, array( 'publish', 'future', 'private' ), true ) || 0 == $post->ID ) {
|
||||||
if ( $can_publish ) :
|
if ( $can_publish ) :
|
||||||
if ( ! empty( $post->post_date_gmt ) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) :
|
if ( ! empty( $post->post_date_gmt ) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) :
|
||||||
?>
|
?>
|
||||||
|
@ -471,7 +471,7 @@ function post_format_meta_box( $post, $box ) {
|
||||||
$post_format = '0';
|
$post_format = '0';
|
||||||
}
|
}
|
||||||
// Add in the current one if it isn't there yet, in case the current theme doesn't support it.
|
// Add in the current one if it isn't there yet, in case the current theme doesn't support it.
|
||||||
if ( $post_format && ! in_array( $post_format, $post_formats[0] ) ) {
|
if ( $post_format && ! in_array( $post_format, $post_formats[0], true ) ) {
|
||||||
$post_formats[0][] = $post_format;
|
$post_formats[0][] = $post_format;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -847,7 +847,7 @@ function post_comment_meta_box( $post ) {
|
||||||
echo '<p id="no-comments">' . __( 'No comments yet.' ) . '</p>';
|
echo '<p id="no-comments">' . __( 'No comments yet.' ) . '</p>';
|
||||||
} else {
|
} else {
|
||||||
$hidden = get_hidden_meta_boxes( get_current_screen() );
|
$hidden = get_hidden_meta_boxes( get_current_screen() );
|
||||||
if ( ! in_array( 'commentsdiv', $hidden ) ) {
|
if ( ! in_array( 'commentsdiv', $hidden, true ) ) {
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>
|
<script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>
|
||||||
<?php
|
<?php
|
||||||
|
@ -1182,7 +1182,7 @@ function xfn_check( $class, $value = '', $deprecated = '' ) {
|
||||||
$link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';
|
$link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';
|
||||||
$rels = preg_split( '/\s+/', $link_rel );
|
$rels = preg_split( '/\s+/', $link_rel );
|
||||||
|
|
||||||
if ( '' != $value && in_array( $value, $rels ) ) {
|
if ( '' != $value && in_array( $value, $rels, true ) ) {
|
||||||
echo ' checked="checked"';
|
echo ' checked="checked"';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1196,7 +1196,7 @@ function xfn_check( $class, $value = '', $deprecated = '' ) {
|
||||||
if ( 'geographical' == $class && strpos( $link_rel, 'co-resident' ) === false && strpos( $link_rel, 'neighbor' ) === false ) {
|
if ( 'geographical' == $class && strpos( $link_rel, 'co-resident' ) === false && strpos( $link_rel, 'neighbor' ) === false ) {
|
||||||
echo ' checked="checked"';
|
echo ' checked="checked"';
|
||||||
}
|
}
|
||||||
if ( 'identity' == $class && in_array( 'me', $rels ) ) {
|
if ( 'identity' == $class && in_array( 'me', $rels, true ) ) {
|
||||||
echo ' checked="checked"';
|
echo ' checked="checked"';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1535,7 +1535,7 @@ function register_and_do_post_meta_boxes( $post ) {
|
||||||
}
|
}
|
||||||
$stati[] = 'private';
|
$stati[] = 'private';
|
||||||
|
|
||||||
if ( in_array( get_post_status( $post ), $stati ) ) {
|
if ( in_array( get_post_status( $post ), $stati, true ) ) {
|
||||||
// If the post type support comments, or the post has comments,
|
// If the post type support comments, or the post has comments,
|
||||||
// allow the Comments meta box.
|
// allow the Comments meta box.
|
||||||
if ( comments_open( $post ) || pings_open( $post ) || $post->comment_count > 0 || post_type_supports( $post_type, 'comments' ) ) {
|
if ( comments_open( $post ) || pings_open( $post ) || $post->comment_count > 0 || post_type_supports( $post_type, 'comments' ) ) {
|
||||||
|
|
|
@ -599,7 +599,9 @@ function wp_doc_link_parse( $content ) {
|
||||||
|
|
||||||
if ( T_STRING == $tokens[ $t ][0] && ( '(' == $tokens[ $t + 1 ] || '(' == $tokens[ $t + 2 ] ) ) {
|
if ( T_STRING == $tokens[ $t ][0] && ( '(' == $tokens[ $t + 1 ] || '(' == $tokens[ $t + 2 ] ) ) {
|
||||||
// If it's a function or class defined locally, there's not going to be any docs available.
|
// If it's a function or class defined locally, there's not going to be any docs available.
|
||||||
if ( ( isset( $tokens[ $t - 2 ][1] ) && in_array( $tokens[ $t - 2 ][1], array( 'function', 'class' ) ) ) || ( isset( $tokens[ $t - 2 ][0] ) && T_OBJECT_OPERATOR == $tokens[ $t - 1 ][0] ) ) {
|
if ( ( isset( $tokens[ $t - 2 ][1] ) && in_array( $tokens[ $t - 2 ][1], array( 'function', 'class' ), true ) )
|
||||||
|
|| ( isset( $tokens[ $t - 2 ][0] ) && T_OBJECT_OPERATOR == $tokens[ $t - 1 ][0] )
|
||||||
|
) {
|
||||||
$ignore_functions[] = $tokens[ $t ][1];
|
$ignore_functions[] = $tokens[ $t ][1];
|
||||||
}
|
}
|
||||||
// Add this to our stack of unique references.
|
// Add this to our stack of unique references.
|
||||||
|
@ -623,7 +625,7 @@ function wp_doc_link_parse( $content ) {
|
||||||
|
|
||||||
$out = array();
|
$out = array();
|
||||||
foreach ( $functions as $function ) {
|
foreach ( $functions as $function ) {
|
||||||
if ( in_array( $function, $ignore_functions ) ) {
|
if ( in_array( $function, $ignore_functions, true ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$out[] = $function;
|
$out[] = $function;
|
||||||
|
@ -656,9 +658,9 @@ function set_screen_options() {
|
||||||
$map_option = $option;
|
$map_option = $option;
|
||||||
$type = str_replace( 'edit_', '', $map_option );
|
$type = str_replace( 'edit_', '', $map_option );
|
||||||
$type = str_replace( '_per_page', '', $type );
|
$type = str_replace( '_per_page', '', $type );
|
||||||
if ( in_array( $type, get_taxonomies() ) ) {
|
if ( in_array( $type, get_taxonomies(), true ) ) {
|
||||||
$map_option = 'edit_tags_per_page';
|
$map_option = 'edit_tags_per_page';
|
||||||
} elseif ( in_array( $type, get_post_types() ) ) {
|
} elseif ( in_array( $type, get_post_types(), true ) ) {
|
||||||
$map_option = 'edit_per_page';
|
$map_option = 'edit_per_page';
|
||||||
} else {
|
} else {
|
||||||
$option = str_replace( '-', '_', $option );
|
$option = str_replace( '-', '_', $option );
|
||||||
|
|
|
@ -886,7 +886,7 @@ function confirm_delete_users( $users ) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( in_array( $delete_user->user_login, $site_admins ) ) {
|
if ( in_array( $delete_user->user_login, $site_admins, true ) ) {
|
||||||
wp_die(
|
wp_die(
|
||||||
sprintf(
|
sprintf(
|
||||||
/* translators: %s: User login. */
|
/* translators: %s: User login. */
|
||||||
|
|
|
@ -25,7 +25,11 @@ function _wp_ajax_menu_quick_search( $request = array() ) {
|
||||||
$type = isset( $request['type'] ) ? $request['type'] : '';
|
$type = isset( $request['type'] ) ? $request['type'] : '';
|
||||||
$object_type = isset( $request['object_type'] ) ? $request['object_type'] : '';
|
$object_type = isset( $request['object_type'] ) ? $request['object_type'] : '';
|
||||||
$query = isset( $request['q'] ) ? $request['q'] : '';
|
$query = isset( $request['q'] ) ? $request['q'] : '';
|
||||||
$response_format = isset( $request['response-format'] ) && in_array( $request['response-format'], array( 'json', 'markup' ) ) ? $request['response-format'] : 'json';
|
$response_format = isset( $request['response-format'] ) ? $request['response-format'] : '';
|
||||||
|
|
||||||
|
if ( ! $response_format || ! in_array( $response_format, array( 'json', 'markup' ), true ) ) {
|
||||||
|
$response_format = 'json';
|
||||||
|
}
|
||||||
|
|
||||||
if ( 'markup' == $response_format ) {
|
if ( 'markup' == $response_format ) {
|
||||||
$args['walker'] = new Walker_Nav_Menu_Checklist;
|
$args['walker'] = new Walker_Nav_Menu_Checklist;
|
||||||
|
@ -184,7 +188,7 @@ function wp_initial_nav_menu_meta_boxes() {
|
||||||
foreach ( array_keys( $wp_meta_boxes['nav-menus'] ) as $context ) {
|
foreach ( array_keys( $wp_meta_boxes['nav-menus'] ) as $context ) {
|
||||||
foreach ( array_keys( $wp_meta_boxes['nav-menus'][ $context ] ) as $priority ) {
|
foreach ( array_keys( $wp_meta_boxes['nav-menus'][ $context ] ) as $priority ) {
|
||||||
foreach ( $wp_meta_boxes['nav-menus'][ $context ][ $priority ] as $box ) {
|
foreach ( $wp_meta_boxes['nav-menus'][ $context ][ $priority ] as $box ) {
|
||||||
if ( in_array( $box['id'], $initial_meta_boxes ) ) {
|
if ( in_array( $box['id'], $initial_meta_boxes, true ) ) {
|
||||||
unset( $box['id'] );
|
unset( $box['id'] );
|
||||||
} else {
|
} else {
|
||||||
$hidden_meta_boxes[] = $box['id'];
|
$hidden_meta_boxes[] = $box['id'];
|
||||||
|
@ -336,10 +340,11 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) {
|
||||||
|
|
||||||
$post_type_name = $box['args']->name;
|
$post_type_name = $box['args']->name;
|
||||||
$post_type = get_post_type_object( $post_type_name );
|
$post_type = get_post_type_object( $post_type_name );
|
||||||
|
$tab_name = $post_type_name . '-tab';
|
||||||
|
|
||||||
// Paginate browsing for large numbers of post objects.
|
// Paginate browsing for large numbers of post objects.
|
||||||
$per_page = 50;
|
$per_page = 50;
|
||||||
$pagenum = isset( $_REQUEST[ $post_type_name . '-tab' ] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1;
|
$pagenum = isset( $_REQUEST[ $tab_name ] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1;
|
||||||
$offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0;
|
$offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0;
|
||||||
|
|
||||||
$args = array(
|
$args = array(
|
||||||
|
@ -447,10 +452,10 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) {
|
||||||
array(
|
array(
|
||||||
'base' => add_query_arg(
|
'base' => add_query_arg(
|
||||||
array(
|
array(
|
||||||
$post_type_name . '-tab' => 'all',
|
$tab_name => 'all',
|
||||||
'paged' => '%#%',
|
'paged' => '%#%',
|
||||||
'item-type' => 'post_type',
|
'item-type' => 'post_type',
|
||||||
'item-object' => $post_type_name,
|
'item-object' => $post_type_name,
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'format' => '',
|
'format' => '',
|
||||||
|
@ -473,8 +478,9 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) {
|
||||||
$walker = new Walker_Nav_Menu_Checklist( $db_fields );
|
$walker = new Walker_Nav_Menu_Checklist( $db_fields );
|
||||||
|
|
||||||
$current_tab = 'most-recent';
|
$current_tab = 'most-recent';
|
||||||
if ( isset( $_REQUEST[ $post_type_name . '-tab' ] ) && in_array( $_REQUEST[ $post_type_name . '-tab' ], array( 'all', 'search' ) ) ) {
|
|
||||||
$current_tab = $_REQUEST[ $post_type_name . '-tab' ];
|
if ( isset( $_REQUEST[ $tab_name ] ) && in_array( $_REQUEST[ $tab_name ], array( 'all', 'search' ), true ) ) {
|
||||||
|
$current_tab = $_REQUEST[ $tab_name ];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty( $_REQUEST[ 'quick-search-posttype-' . $post_type_name ] ) ) {
|
if ( ! empty( $_REQUEST[ 'quick-search-posttype-' . $post_type_name ] ) ) {
|
||||||
|
@ -494,9 +500,9 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) {
|
||||||
$view_all_url = '';
|
$view_all_url = '';
|
||||||
$search_url = '';
|
$search_url = '';
|
||||||
if ( $nav_menu_selected_id ) {
|
if ( $nav_menu_selected_id ) {
|
||||||
$most_recent_url = esc_url( add_query_arg( $post_type_name . '-tab', 'most-recent', remove_query_arg( $removed_args ) ) );
|
$most_recent_url = esc_url( add_query_arg( $tab_name, 'most-recent', remove_query_arg( $removed_args ) ) );
|
||||||
$view_all_url = esc_url( add_query_arg( $post_type_name . '-tab', 'all', remove_query_arg( $removed_args ) ) );
|
$view_all_url = esc_url( add_query_arg( $tab_name, 'all', remove_query_arg( $removed_args ) ) );
|
||||||
$search_url = esc_url( add_query_arg( $post_type_name . '-tab', 'search', remove_query_arg( $removed_args ) ) );
|
$search_url = esc_url( add_query_arg( $tab_name, 'search', remove_query_arg( $removed_args ) ) );
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<div id="posttype-<?php echo $post_type_name; ?>" class="posttypediv">
|
<div id="posttype-<?php echo $post_type_name; ?>" class="posttypediv">
|
||||||
|
@ -652,8 +658,8 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) {
|
||||||
|
|
||||||
<p class="button-controls wp-clearfix" data-items-type="posttype-<?php echo esc_attr( $post_type_name ); ?>">
|
<p class="button-controls wp-clearfix" data-items-type="posttype-<?php echo esc_attr( $post_type_name ); ?>">
|
||||||
<span class="list-controls hide-if-no-js">
|
<span class="list-controls hide-if-no-js">
|
||||||
<input type="checkbox"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> id="<?php echo esc_attr( $post_type_name . '-tab' ); ?>" class="select-all" />
|
<input type="checkbox"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> id="<?php echo esc_attr( $tab_name ); ?>" class="select-all" />
|
||||||
<label for="<?php echo esc_attr( $post_type_name . '-tab' ); ?>"><?php _e( 'Select All' ); ?></label>
|
<label for="<?php echo esc_attr( $tab_name ); ?>"><?php _e( 'Select All' ); ?></label>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span class="add-to-menu">
|
<span class="add-to-menu">
|
||||||
|
@ -688,10 +694,11 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $box ) {
|
||||||
|
|
||||||
$taxonomy_name = $box['args']->name;
|
$taxonomy_name = $box['args']->name;
|
||||||
$taxonomy = get_taxonomy( $taxonomy_name );
|
$taxonomy = get_taxonomy( $taxonomy_name );
|
||||||
|
$tab_name = $taxonomy_name . '-tab';
|
||||||
|
|
||||||
// Paginate browsing for large numbers of objects.
|
// Paginate browsing for large numbers of objects.
|
||||||
$per_page = 50;
|
$per_page = 50;
|
||||||
$pagenum = isset( $_REQUEST[ $taxonomy_name . '-tab' ] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1;
|
$pagenum = isset( $_REQUEST[ $tab_name ] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1;
|
||||||
$offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0;
|
$offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0;
|
||||||
|
|
||||||
$args = array(
|
$args = array(
|
||||||
|
@ -732,10 +739,10 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $box ) {
|
||||||
array(
|
array(
|
||||||
'base' => add_query_arg(
|
'base' => add_query_arg(
|
||||||
array(
|
array(
|
||||||
$taxonomy_name . '-tab' => 'all',
|
$tab_name => 'all',
|
||||||
'paged' => '%#%',
|
'paged' => '%#%',
|
||||||
'item-type' => 'taxonomy',
|
'item-type' => 'taxonomy',
|
||||||
'item-object' => $taxonomy_name,
|
'item-object' => $taxonomy_name,
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'format' => '',
|
'format' => '',
|
||||||
|
@ -758,8 +765,9 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $box ) {
|
||||||
$walker = new Walker_Nav_Menu_Checklist( $db_fields );
|
$walker = new Walker_Nav_Menu_Checklist( $db_fields );
|
||||||
|
|
||||||
$current_tab = 'most-used';
|
$current_tab = 'most-used';
|
||||||
if ( isset( $_REQUEST[ $taxonomy_name . '-tab' ] ) && in_array( $_REQUEST[ $taxonomy_name . '-tab' ], array( 'all', 'most-used', 'search' ) ) ) {
|
|
||||||
$current_tab = $_REQUEST[ $taxonomy_name . '-tab' ];
|
if ( isset( $_REQUEST[ $tab_name ] ) && in_array( $_REQUEST[ $tab_name ], array( 'all', 'most-used', 'search' ), true ) ) {
|
||||||
|
$current_tab = $_REQUEST[ $tab_name ];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty( $_REQUEST[ 'quick-search-taxonomy-' . $taxonomy_name ] ) ) {
|
if ( ! empty( $_REQUEST[ 'quick-search-taxonomy-' . $taxonomy_name ] ) ) {
|
||||||
|
@ -779,9 +787,9 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $box ) {
|
||||||
$view_all_url = '';
|
$view_all_url = '';
|
||||||
$search_url = '';
|
$search_url = '';
|
||||||
if ( $nav_menu_selected_id ) {
|
if ( $nav_menu_selected_id ) {
|
||||||
$most_used_url = esc_url( add_query_arg( $taxonomy_name . '-tab', 'most-used', remove_query_arg( $removed_args ) ) );
|
$most_used_url = esc_url( add_query_arg( $tab_name, 'most-used', remove_query_arg( $removed_args ) ) );
|
||||||
$view_all_url = esc_url( add_query_arg( $taxonomy_name . '-tab', 'all', remove_query_arg( $removed_args ) ) );
|
$view_all_url = esc_url( add_query_arg( $tab_name, 'all', remove_query_arg( $removed_args ) ) );
|
||||||
$search_url = esc_url( add_query_arg( $taxonomy_name . '-tab', 'search', remove_query_arg( $removed_args ) ) );
|
$search_url = esc_url( add_query_arg( $tab_name, 'search', remove_query_arg( $removed_args ) ) );
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<div id="taxonomy-<?php echo $taxonomy_name; ?>" class="taxonomydiv">
|
<div id="taxonomy-<?php echo $taxonomy_name; ?>" class="taxonomydiv">
|
||||||
|
@ -882,8 +890,8 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $box ) {
|
||||||
|
|
||||||
<p class="button-controls wp-clearfix" data-items-type="taxonomy-<?php echo esc_attr( $taxonomy_name ); ?>">
|
<p class="button-controls wp-clearfix" data-items-type="taxonomy-<?php echo esc_attr( $taxonomy_name ); ?>">
|
||||||
<span class="list-controls hide-if-no-js">
|
<span class="list-controls hide-if-no-js">
|
||||||
<input type="checkbox"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> id="<?php echo esc_attr( $taxonomy_name . '-tab' ); ?>" class="select-all" />
|
<input type="checkbox"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> id="<?php echo esc_attr( $tab_name ); ?>" class="select-all" />
|
||||||
<label for="<?php echo esc_attr( $taxonomy_name . '-tab' ); ?>"><?php _e( 'Select All' ); ?></label>
|
<label for="<?php echo esc_attr( $tab_name ); ?>"><?php _e( 'Select All' ); ?></label>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span class="add-to-menu">
|
<span class="add-to-menu">
|
||||||
|
@ -920,7 +928,7 @@ function wp_save_nav_menu_items( $menu_id = 0, $menu_data = array() ) {
|
||||||
// And item type either isn't set.
|
// And item type either isn't set.
|
||||||
! isset( $_item_object_data['menu-item-type'] ) ||
|
! isset( $_item_object_data['menu-item-type'] ) ||
|
||||||
// Or URL is the default.
|
// Or URL is the default.
|
||||||
in_array( $_item_object_data['menu-item-url'], array( 'https://', 'http://', '' ) ) ||
|
in_array( $_item_object_data['menu-item-url'], array( 'https://', 'http://', '' ), true ) ||
|
||||||
// Or it's not a custom menu item (but not the custom home page).
|
// Or it's not a custom menu item (but not the custom home page).
|
||||||
! ( 'custom' == $_item_object_data['menu-item-type'] && ! isset( $_item_object_data['menu-item-db-id'] ) ) ||
|
! ( 'custom' == $_item_object_data['menu-item-type'] && ! isset( $_item_object_data['menu-item-db-id'] ) ) ||
|
||||||
// Or it *is* a custom menu item that already exists.
|
// Or it *is* a custom menu item that already exists.
|
||||||
|
|
|
@ -135,7 +135,7 @@ function network_step1( $errors = false ) {
|
||||||
|
|
||||||
$hostname = get_clean_basedomain();
|
$hostname = get_clean_basedomain();
|
||||||
$has_ports = strstr( $hostname, ':' );
|
$has_ports = strstr( $hostname, ':' );
|
||||||
if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ) ) ) ) {
|
if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ), true ) ) ) {
|
||||||
echo '<div class="error"><p><strong>' . __( 'Error:' ) . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>';
|
echo '<div class="error"><p><strong>' . __( 'Error:' ) . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>';
|
||||||
echo '<p>' . sprintf(
|
echo '<p>' . sprintf(
|
||||||
/* translators: %s: Port number. */
|
/* translators: %s: Port number. */
|
||||||
|
@ -162,14 +162,14 @@ function network_step1( $errors = false ) {
|
||||||
$error_codes = $errors->get_error_codes();
|
$error_codes = $errors->get_error_codes();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes ) ) {
|
if ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes, true ) ) {
|
||||||
$site_name = $_POST['sitename'];
|
$site_name = $_POST['sitename'];
|
||||||
} else {
|
} else {
|
||||||
/* translators: %s: Default network title. */
|
/* translators: %s: Default network title. */
|
||||||
$site_name = sprintf( __( '%s Sites' ), get_option( 'blogname' ) );
|
$site_name = sprintf( __( '%s Sites' ), get_option( 'blogname' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty( $_POST['email'] ) && ! in_array( 'invalid_email', $error_codes ) ) {
|
if ( ! empty( $_POST['email'] ) && ! in_array( 'invalid_email', $error_codes, true ) ) {
|
||||||
$admin_email = $_POST['email'];
|
$admin_email = $_POST['email'];
|
||||||
} else {
|
} else {
|
||||||
$admin_email = get_option( 'admin_email' );
|
$admin_email = get_option( 'admin_email' );
|
||||||
|
|
|
@ -523,7 +523,7 @@ function _get_dropins() {
|
||||||
* @return bool True, if in the active plugins list. False, not in the list.
|
* @return bool True, if in the active plugins list. False, not in the list.
|
||||||
*/
|
*/
|
||||||
function is_plugin_active( $plugin ) {
|
function is_plugin_active( $plugin ) {
|
||||||
return in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) || is_plugin_active_for_network( $plugin );
|
return in_array( $plugin, (array) get_option( 'active_plugins', array() ), true ) || is_plugin_active_for_network( $plugin );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -644,7 +644,7 @@ function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silen
|
||||||
return $requirements;
|
return $requirements;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ( $network_wide && ! isset( $current[ $plugin ] ) ) || ( ! $network_wide && ! in_array( $plugin, $current ) ) ) {
|
if ( ( $network_wide && ! isset( $current[ $plugin ] ) ) || ( ! $network_wide && ! in_array( $plugin, $current, true ) ) ) {
|
||||||
if ( ! empty( $redirect ) ) {
|
if ( ! empty( $redirect ) ) {
|
||||||
// We'll override this later if the plugin can be included without fatal error.
|
// We'll override this later if the plugin can be included without fatal error.
|
||||||
wp_redirect( add_query_arg( '_error_nonce', wp_create_nonce( 'plugin-activation-error_' . $plugin ), $redirect ) );
|
wp_redirect( add_query_arg( '_error_nonce', wp_create_nonce( 'plugin-activation-error_' . $plugin ), $redirect ) );
|
||||||
|
@ -783,7 +783,7 @@ function deactivate_plugins( $plugins, $silent = false, $network_wide = null ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( true !== $network_wide ) {
|
if ( true !== $network_wide ) {
|
||||||
$key = array_search( $plugin, $current );
|
$key = array_search( $plugin, $current, true );
|
||||||
if ( false !== $key ) {
|
if ( false !== $key ) {
|
||||||
$do_blog = true;
|
$do_blog = true;
|
||||||
unset( $current[ $key ] );
|
unset( $current[ $key ] );
|
||||||
|
|
|
@ -134,8 +134,11 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
|
||||||
|
|
||||||
// Posts 'submitted for approval' are submitted to $_POST the same as if they were being published.
|
// Posts 'submitted for approval' are submitted to $_POST the same as if they were being published.
|
||||||
// Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts.
|
// Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts.
|
||||||
if ( isset( $post_data['post_status'] ) && ( in_array( $post_data['post_status'], $published_statuses ) && ! current_user_can( $ptype->cap->publish_posts ) ) ) {
|
if ( isset( $post_data['post_status'] )
|
||||||
if ( ! in_array( $previous_status, $published_statuses ) || ! current_user_can( 'edit_post', $post_id ) ) {
|
&& ( in_array( $post_data['post_status'], $published_statuses, true )
|
||||||
|
&& ! current_user_can( $ptype->cap->publish_posts ) )
|
||||||
|
) {
|
||||||
|
if ( ! in_array( $previous_status, $published_statuses, true ) || ! current_user_can( 'edit_post', $post_id ) ) {
|
||||||
$post_data['post_status'] = 'pending';
|
$post_data['post_status'] = 'pending';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -564,7 +567,10 @@ function bulk_edit_posts( $post_data = null ) {
|
||||||
|
|
||||||
$post_type_object = get_post_type_object( get_post_type( $post_ID ) );
|
$post_type_object = get_post_type_object( get_post_type( $post_ID ) );
|
||||||
|
|
||||||
if ( ! isset( $post_type_object ) || ( isset( $children ) && in_array( $post_ID, $children ) ) || ! current_user_can( 'edit_post', $post_ID ) ) {
|
if ( ! isset( $post_type_object )
|
||||||
|
|| ( isset( $children ) && in_array( $post_ID, $children ) )
|
||||||
|
|| ! current_user_can( 'edit_post', $post_ID )
|
||||||
|
) {
|
||||||
$skipped[] = $post_ID;
|
$skipped[] = $post_ID;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -593,7 +599,7 @@ function bulk_edit_posts( $post_data = null ) {
|
||||||
$post_data['tax_input'][ $tax_name ] = array_merge( $current_terms, $new_terms );
|
$post_data['tax_input'][ $tax_name ] = array_merge( $current_terms, $new_terms );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $new_cats ) && in_array( 'category', $tax_names ) ) {
|
if ( isset( $new_cats ) && in_array( 'category', $tax_names, true ) ) {
|
||||||
$cats = (array) wp_get_post_categories( $post_ID );
|
$cats = (array) wp_get_post_categories( $post_ID );
|
||||||
$post_data['post_category'] = array_unique( array_merge( $cats, $new_cats ) );
|
$post_data['post_category'] = array_unique( array_merge( $cats, $new_cats ) );
|
||||||
unset( $post_data['tax_input']['category'] );
|
unset( $post_data['tax_input']['category'] );
|
||||||
|
@ -1037,7 +1043,7 @@ function _fix_attachment_links( $post ) {
|
||||||
$content = $post['post_content'];
|
$content = $post['post_content'];
|
||||||
|
|
||||||
// Don't run if no pretty permalinks or post is not published, scheduled, or privately published.
|
// Don't run if no pretty permalinks or post is not published, scheduled, or privately published.
|
||||||
if ( ! get_option( 'permalink_structure' ) || ! in_array( $post['post_status'], array( 'publish', 'future', 'private' ) ) ) {
|
if ( ! get_option( 'permalink_structure' ) || ! in_array( $post['post_status'], array( 'publish', 'future', 'private' ), true ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1110,7 +1116,7 @@ function wp_edit_posts_query( $q = false ) {
|
||||||
$q['cat'] = isset( $q['cat'] ) ? (int) $q['cat'] : 0;
|
$q['cat'] = isset( $q['cat'] ) ? (int) $q['cat'] : 0;
|
||||||
$post_stati = get_post_stati();
|
$post_stati = get_post_stati();
|
||||||
|
|
||||||
if ( isset( $q['post_type'] ) && in_array( $q['post_type'], get_post_types() ) ) {
|
if ( isset( $q['post_type'] ) && in_array( $q['post_type'], get_post_types(), true ) ) {
|
||||||
$post_type = $q['post_type'];
|
$post_type = $q['post_type'];
|
||||||
} else {
|
} else {
|
||||||
$post_type = 'post';
|
$post_type = 'post';
|
||||||
|
@ -1120,7 +1126,7 @@ function wp_edit_posts_query( $q = false ) {
|
||||||
$post_status = '';
|
$post_status = '';
|
||||||
$perm = '';
|
$perm = '';
|
||||||
|
|
||||||
if ( isset( $q['post_status'] ) && in_array( $q['post_status'], $post_stati ) ) {
|
if ( isset( $q['post_status'] ) && in_array( $q['post_status'], $post_stati, true ) ) {
|
||||||
$post_status = $q['post_status'];
|
$post_status = $q['post_status'];
|
||||||
$perm = 'readable';
|
$perm = 'readable';
|
||||||
}
|
}
|
||||||
|
@ -1129,7 +1135,7 @@ function wp_edit_posts_query( $q = false ) {
|
||||||
|
|
||||||
if ( isset( $q['orderby'] ) ) {
|
if ( isset( $q['orderby'] ) ) {
|
||||||
$orderby = $q['orderby'];
|
$orderby = $q['orderby'];
|
||||||
} elseif ( isset( $q['post_status'] ) && in_array( $q['post_status'], array( 'pending', 'draft' ) ) ) {
|
} elseif ( isset( $q['post_status'] ) && in_array( $q['post_status'], array( 'pending', 'draft' ), true ) ) {
|
||||||
$orderby = 'modified';
|
$orderby = 'modified';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1294,7 +1300,7 @@ function postbox_classes( $box_id, $screen_id ) {
|
||||||
if ( ! is_array( $closed ) ) {
|
if ( ! is_array( $closed ) ) {
|
||||||
$classes = array( '' );
|
$classes = array( '' );
|
||||||
} else {
|
} else {
|
||||||
$classes = in_array( $box_id, $closed ) ? array( 'closed' ) : array( '' );
|
$classes = in_array( $box_id, $closed, true ) ? array( 'closed' ) : array( '' );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$classes = array( '' );
|
$classes = array( '' );
|
||||||
|
@ -1342,7 +1348,7 @@ function get_sample_permalink( $id, $title = null, $name = null ) {
|
||||||
$original_name = $post->post_name;
|
$original_name = $post->post_name;
|
||||||
|
|
||||||
// Hack: get_permalink() would return ugly permalink for drafts, so we will fake that our post is published.
|
// Hack: get_permalink() would return ugly permalink for drafts, so we will fake that our post is published.
|
||||||
if ( in_array( $post->post_status, array( 'draft', 'pending', 'future' ) ) ) {
|
if ( in_array( $post->post_status, array( 'draft', 'pending', 'future' ), true ) ) {
|
||||||
$post->post_status = 'publish';
|
$post->post_status = 'publish';
|
||||||
$post->post_name = sanitize_title( $post->post_name ? $post->post_name : $post->post_title, $post->ID );
|
$post->post_name = sanitize_title( $post->post_name ? $post->post_name : $post->post_title, $post->ID );
|
||||||
}
|
}
|
||||||
|
|
|
@ -400,7 +400,7 @@ function populate_options( array $options = array() ) {
|
||||||
$offset_or_tz = _x( '0', 'default GMT offset or timezone string' ); // phpcs:ignore WordPress.WP.I18n.NoEmptyStrings
|
$offset_or_tz = _x( '0', 'default GMT offset or timezone string' ); // phpcs:ignore WordPress.WP.I18n.NoEmptyStrings
|
||||||
if ( is_numeric( $offset_or_tz ) ) {
|
if ( is_numeric( $offset_or_tz ) ) {
|
||||||
$gmt_offset = $offset_or_tz;
|
$gmt_offset = $offset_or_tz;
|
||||||
} elseif ( $offset_or_tz && in_array( $offset_or_tz, timezone_identifiers_list() ) ) {
|
} elseif ( $offset_or_tz && in_array( $offset_or_tz, timezone_identifiers_list(), true ) ) {
|
||||||
$timezone_string = $offset_or_tz;
|
$timezone_string = $offset_or_tz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -563,11 +563,13 @@ function populate_options( array $options = array() ) {
|
||||||
$existing_options = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name in ( $keys )" ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
$existing_options = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name in ( $keys )" ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
||||||
|
|
||||||
$insert = '';
|
$insert = '';
|
||||||
|
|
||||||
foreach ( $options as $option => $value ) {
|
foreach ( $options as $option => $value ) {
|
||||||
if ( in_array( $option, $existing_options ) ) {
|
if ( in_array( $option, $existing_options, true ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( in_array( $option, $fat_options ) ) {
|
|
||||||
|
if ( in_array( $option, $fat_options, true ) ) {
|
||||||
$autoload = 'no';
|
$autoload = 'no';
|
||||||
} else {
|
} else {
|
||||||
$autoload = 'yes';
|
$autoload = 'yes';
|
||||||
|
@ -576,9 +578,11 @@ function populate_options( array $options = array() ) {
|
||||||
if ( is_array( $value ) ) {
|
if ( is_array( $value ) ) {
|
||||||
$value = serialize( $value );
|
$value = serialize( $value );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty( $insert ) ) {
|
if ( ! empty( $insert ) ) {
|
||||||
$insert .= ', ';
|
$insert .= ', ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$insert .= $wpdb->prepare( '(%s, %s, %s)', $option, $value, $autoload );
|
$insert .= $wpdb->prepare( '(%s, %s, %s)', $option, $value, $autoload );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ function meta_box_prefs( $screen ) {
|
||||||
printf(
|
printf(
|
||||||
'<label for="%1$s-hide"><input class="hide-postbox-tog" name="%1$s-hide" type="checkbox" id="%1$s-hide" value="%1$s" %2$s />%3$s</label>',
|
'<label for="%1$s-hide"><input class="hide-postbox-tog" name="%1$s-hide" type="checkbox" id="%1$s-hide" value="%1$s" %2$s />%3$s</label>',
|
||||||
esc_attr( $box['id'] ),
|
esc_attr( $box['id'] ),
|
||||||
checked( in_array( $box['id'], $hidden ), false, false ),
|
checked( in_array( $box['id'], $hidden, true ), false, false ),
|
||||||
$widget_title
|
$widget_title
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -783,7 +783,7 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
|
||||||
$post = get_post();
|
$post = get_post();
|
||||||
|
|
||||||
if ( $for_post ) {
|
if ( $for_post ) {
|
||||||
$edit = ! ( in_array( $post->post_status, array( 'draft', 'pending' ) ) && ( ! $post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) );
|
$edit = ! ( in_array( $post->post_status, array( 'draft', 'pending' ), true ) && ( ! $post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
$tab_index_attribute = '';
|
$tab_index_attribute = '';
|
||||||
|
@ -1297,7 +1297,7 @@ function do_meta_boxes( $screen, $context, $object ) {
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
// get_hidden_meta_boxes() doesn't apply in the block editor.
|
// get_hidden_meta_boxes() doesn't apply in the block editor.
|
||||||
$hidden_class = ( ! $screen->is_block_editor() && in_array( $box['id'], $hidden ) ) ? ' hide-if-js' : '';
|
$hidden_class = ( ! $screen->is_block_editor() && in_array( $box['id'], $hidden, true ) ) ? ' hide-if-js' : '';
|
||||||
echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes( $box['id'], $page ) . $hidden_class . '" ' . '>' . "\n";
|
echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes( $box['id'], $page ) . $hidden_class . '" ' . '>' . "\n";
|
||||||
if ( 'dashboard_browser_nag' != $box['id'] ) {
|
if ( 'dashboard_browser_nag' != $box['id'] ) {
|
||||||
$widget_title = $box['title'];
|
$widget_title = $box['title'];
|
||||||
|
@ -1453,7 +1453,7 @@ function do_accordion_sections( $screen, $context, $object ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
$hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : '';
|
$hidden_class = in_array( $box['id'], $hidden, true ) ? 'hide-if-js' : '';
|
||||||
|
|
||||||
$open_class = '';
|
$open_class = '';
|
||||||
if ( ! $first_open && empty( $hidden_class ) ) {
|
if ( ! $first_open && empty( $hidden_class ) ) {
|
||||||
|
@ -1838,7 +1838,7 @@ function settings_errors( $setting = '', $sanitize = false, $hide_on_update = fa
|
||||||
$details['type'] = 'success';
|
$details['type'] = 'success';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( in_array( $details['type'], array( 'error', 'success', 'warning', 'info' ) ) ) {
|
if ( in_array( $details['type'], array( 'error', 'success', 'warning', 'info' ), true ) ) {
|
||||||
$details['type'] = 'notice-' . $details['type'];
|
$details['type'] = 'notice-' . $details['type'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2373,7 +2373,7 @@ function get_submit_button( $text = '', $type = 'primary large', $name = 'submit
|
||||||
if ( 'secondary' === $t || 'button-secondary' === $t ) {
|
if ( 'secondary' === $t || 'button-secondary' === $t ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$classes[] = in_array( $t, $button_shorthand ) ? 'button-' . $t : $t;
|
$classes[] = in_array( $t, $button_shorthand, true ) ? 'button-' . $t : $t;
|
||||||
}
|
}
|
||||||
// Remove empty items, remove duplicate items, and finally build a string.
|
// Remove empty items, remove duplicate items, and finally build a string.
|
||||||
$class = implode( ' ', array_unique( array_filter( $classes ) ) );
|
$class = implode( ' ', array_unique( array_filter( $classes ) ) );
|
||||||
|
|
|
@ -20,7 +20,7 @@ function translations_api( $type, $args = null ) {
|
||||||
// Include an unmodified $wp_version.
|
// Include an unmodified $wp_version.
|
||||||
require ABSPATH . WPINC . '/version.php';
|
require ABSPATH . WPINC . '/version.php';
|
||||||
|
|
||||||
if ( ! in_array( $type, array( 'plugins', 'themes', 'core' ) ) ) {
|
if ( ! in_array( $type, array( 'plugins', 'themes', 'core' ), true ) ) {
|
||||||
return new WP_Error( 'invalid_type', __( 'Invalid translation type.' ) );
|
return new WP_Error( 'invalid_type', __( 'Invalid translation type.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ function wp_install_language_form( $languages ) {
|
||||||
esc_attr( $language['language'] ),
|
esc_attr( $language['language'] ),
|
||||||
esc_attr( current( $language['iso'] ) ),
|
esc_attr( current( $language['iso'] ) ),
|
||||||
esc_attr( $language['strings']['continue'] ?: 'Continue' ),
|
esc_attr( $language['strings']['continue'] ?: 'Continue' ),
|
||||||
in_array( $language['language'], $installed_languages ) ? ' data-installed="1"' : '',
|
in_array( $language['language'], $installed_languages, true ) ? ' data-installed="1"' : '',
|
||||||
esc_html( $language['native_name'] )
|
esc_html( $language['native_name'] )
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ function wp_install_language_form( $languages ) {
|
||||||
esc_attr( $language['language'] ),
|
esc_attr( $language['language'] ),
|
||||||
esc_attr( current( $language['iso'] ) ),
|
esc_attr( current( $language['iso'] ) ),
|
||||||
esc_attr( $language['strings']['continue'] ?: 'Continue' ),
|
esc_attr( $language['strings']['continue'] ?: 'Continue' ),
|
||||||
in_array( $language['language'], $installed_languages ) ? ' data-installed="1"' : '',
|
in_array( $language['language'], $installed_languages, true ) ? ' data-installed="1"' : '',
|
||||||
esc_html( $language['native_name'] )
|
esc_html( $language['native_name'] )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ function wp_install_language_form( $languages ) {
|
||||||
*/
|
*/
|
||||||
function wp_download_language_pack( $download ) {
|
function wp_download_language_pack( $download ) {
|
||||||
// Check if the translation is already installed.
|
// Check if the translation is already installed.
|
||||||
if ( in_array( $download, get_available_languages() ) ) {
|
if ( in_array( $download, get_available_languages(), true ) ) {
|
||||||
return $download;
|
return $download;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1045,7 +1045,7 @@ function update_core( $from, $to ) {
|
||||||
if ( ! file_exists( $working_dir_local . $file ) ) {
|
if ( ! file_exists( $working_dir_local . $file ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( '.' === dirname( $file ) && in_array( pathinfo( $file, PATHINFO_EXTENSION ), array( 'html', 'txt' ) ) ) {
|
if ( '.' === dirname( $file ) && in_array( pathinfo( $file, PATHINFO_EXTENSION ), array( 'html', 'txt' ), true ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( md5_file( ABSPATH . $file ) === $checksum ) {
|
if ( md5_file( ABSPATH . $file ) === $checksum ) {
|
||||||
|
@ -1115,7 +1115,7 @@ function update_core( $from, $to ) {
|
||||||
if ( ! file_exists( $working_dir_local . $file ) ) {
|
if ( ! file_exists( $working_dir_local . $file ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( '.' === dirname( $file ) && in_array( pathinfo( $file, PATHINFO_EXTENSION ), array( 'html', 'txt' ) ) ) {
|
if ( '.' === dirname( $file ) && in_array( pathinfo( $file, PATHINFO_EXTENSION ), array( 'html', 'txt' ), true ) ) {
|
||||||
$skip[] = $file;
|
$skip[] = $file;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1913,7 +1913,7 @@ function upgrade_400() {
|
||||||
global $wp_current_db_version;
|
global $wp_current_db_version;
|
||||||
if ( $wp_current_db_version < 29630 ) {
|
if ( $wp_current_db_version < 29630 ) {
|
||||||
if ( ! is_multisite() && false === get_option( 'WPLANG' ) ) {
|
if ( ! is_multisite() && false === get_option( 'WPLANG' ) ) {
|
||||||
if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && in_array( WPLANG, get_available_languages() ) ) {
|
if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && in_array( WPLANG, get_available_languages(), true ) ) {
|
||||||
update_option( 'WPLANG', WPLANG );
|
update_option( 'WPLANG', WPLANG );
|
||||||
} else {
|
} else {
|
||||||
update_option( 'WPLANG', '' );
|
update_option( 'WPLANG', '' );
|
||||||
|
@ -2635,7 +2635,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
|
||||||
$global_tables = $wpdb->tables( 'global' );
|
$global_tables = $wpdb->tables( 'global' );
|
||||||
foreach ( $cqueries as $table => $qry ) {
|
foreach ( $cqueries as $table => $qry ) {
|
||||||
// Upgrade global tables only for the main site. Don't upgrade at all if conditions are not optimal.
|
// Upgrade global tables only for the main site. Don't upgrade at all if conditions are not optimal.
|
||||||
if ( in_array( $table, $global_tables ) && ! wp_should_upgrade_global_tables() ) {
|
if ( in_array( $table, $global_tables, true ) && ! wp_should_upgrade_global_tables() ) {
|
||||||
unset( $cqueries[ $table ], $for_update[ $table ] );
|
unset( $cqueries[ $table ], $for_update[ $table ] );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -2799,14 +2799,14 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
|
||||||
// Is actual field type different from the field type in query?
|
// Is actual field type different from the field type in query?
|
||||||
if ( $tablefield->Type != $fieldtype ) {
|
if ( $tablefield->Type != $fieldtype ) {
|
||||||
$do_change = true;
|
$do_change = true;
|
||||||
if ( in_array( $fieldtype_lowercased, $text_fields ) && in_array( $tablefield_type_lowercased, $text_fields ) ) {
|
if ( in_array( $fieldtype_lowercased, $text_fields, true ) && in_array( $tablefield_type_lowercased, $text_fields, true ) ) {
|
||||||
if ( array_search( $fieldtype_lowercased, $text_fields ) < array_search( $tablefield_type_lowercased, $text_fields ) ) {
|
if ( array_search( $fieldtype_lowercased, $text_fields, true ) < array_search( $tablefield_type_lowercased, $text_fields, true ) ) {
|
||||||
$do_change = false;
|
$do_change = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( in_array( $fieldtype_lowercased, $blob_fields ) && in_array( $tablefield_type_lowercased, $blob_fields ) ) {
|
if ( in_array( $fieldtype_lowercased, $blob_fields, true ) && in_array( $tablefield_type_lowercased, $blob_fields, true ) ) {
|
||||||
if ( array_search( $fieldtype_lowercased, $blob_fields ) < array_search( $tablefield_type_lowercased, $blob_fields ) ) {
|
if ( array_search( $fieldtype_lowercased, $blob_fields, true ) < array_search( $tablefield_type_lowercased, $blob_fields, true ) ) {
|
||||||
$do_change = false;
|
$do_change = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2901,7 +2901,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
|
||||||
$index_string .= " ($index_columns)";
|
$index_string .= " ($index_columns)";
|
||||||
|
|
||||||
// Check if the index definition exists, ignoring subparts.
|
// Check if the index definition exists, ignoring subparts.
|
||||||
$aindex = array_search( $index_string, $indices_without_subparts );
|
$aindex = array_search( $index_string, $indices_without_subparts, true );
|
||||||
if ( false !== $aindex ) {
|
if ( false !== $aindex ) {
|
||||||
// If the index already exists (even with different subparts), we don't need to create it.
|
// If the index already exists (even with different subparts), we don't need to create it.
|
||||||
unset( $indices_without_subparts[ $aindex ] );
|
unset( $indices_without_subparts[ $aindex ] );
|
||||||
|
@ -3245,7 +3245,7 @@ function maybe_disable_automattic_widgets() {
|
||||||
|
|
||||||
foreach ( (array) $plugins as $plugin ) {
|
foreach ( (array) $plugins as $plugin ) {
|
||||||
if ( basename( $plugin ) == 'widgets.php' ) {
|
if ( basename( $plugin ) == 'widgets.php' ) {
|
||||||
array_splice( $plugins, array_search( $plugin, $plugins ), 1 );
|
array_splice( $plugins, array_search( $plugin, $plugins, true ), 1 );
|
||||||
update_option( 'active_plugins', $plugins );
|
update_option( 'active_plugins', $plugins );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,7 +192,7 @@ function wp_widget_control( $sidebar_args ) {
|
||||||
|
|
||||||
$widget_id = $sidebar_args['widget_id'];
|
$widget_id = $sidebar_args['widget_id'];
|
||||||
$sidebar_id = isset( $sidebar_args['id'] ) ? $sidebar_args['id'] : false;
|
$sidebar_id = isset( $sidebar_args['id'] ) ? $sidebar_args['id'] : false;
|
||||||
$key = $sidebar_id ? array_search( $widget_id, $sidebars_widgets[ $sidebar_id ] ) : '-1'; // Position of widget in sidebar.
|
$key = $sidebar_id ? array_search( $widget_id, $sidebars_widgets[ $sidebar_id ], true ) : '-1'; // Position of widget in sidebar.
|
||||||
$control = isset( $wp_registered_widget_controls[ $widget_id ] ) ? $wp_registered_widget_controls[ $widget_id ] : array();
|
$control = isset( $wp_registered_widget_controls[ $widget_id ] ) ? $wp_registered_widget_controls[ $widget_id ] : array();
|
||||||
$widget = $wp_registered_widgets[ $widget_id ];
|
$widget = $wp_registered_widgets[ $widget_id ];
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||||
define( 'WPINC', 'wp-includes' );
|
define( 'WPINC', 'wp-includes' );
|
||||||
|
|
||||||
$protocol = $_SERVER['SERVER_PROTOCOL'];
|
$protocol = $_SERVER['SERVER_PROTOCOL'];
|
||||||
if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) {
|
if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ), true ) ) {
|
||||||
$protocol = 'HTTP/1.0';
|
$protocol = 'HTTP/1.0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ require ABSPATH . WPINC . '/script-loader.php';
|
||||||
require ABSPATH . WPINC . '/version.php';
|
require ABSPATH . WPINC . '/version.php';
|
||||||
|
|
||||||
$protocol = $_SERVER['SERVER_PROTOCOL'];
|
$protocol = $_SERVER['SERVER_PROTOCOL'];
|
||||||
if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) {
|
if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ), true ) ) {
|
||||||
$protocol = 'HTTP/1.0';
|
$protocol = 'HTTP/1.0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ foreach ( array_merge( $builtin, $types ) as $ptype ) {
|
||||||
} else {
|
} else {
|
||||||
$menu_icon = esc_url( $ptype_obj->menu_icon );
|
$menu_icon = esc_url( $ptype_obj->menu_icon );
|
||||||
}
|
}
|
||||||
} elseif ( in_array( $ptype, $builtin ) ) {
|
} elseif ( in_array( $ptype, $builtin, true ) ) {
|
||||||
$menu_icon = 'dashicons-admin-' . $ptype;
|
$menu_icon = 'dashicons-admin-' . $ptype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ foreach ( array_merge( $builtin, $types ) as $ptype ) {
|
||||||
$edit_tags_file = "edit-tags.php?taxonomy=%s&post_type=$ptype";
|
$edit_tags_file = "edit-tags.php?taxonomy=%s&post_type=$ptype";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( in_array( $ptype, $builtin ) ) {
|
if ( in_array( $ptype, $builtin, true ) ) {
|
||||||
$ptype_menu_id = 'menu-' . $ptype_for_id . 's';
|
$ptype_menu_id = 'menu-' . $ptype_for_id . 's';
|
||||||
} else {
|
} else {
|
||||||
$ptype_menu_id = 'menu-posts-' . $ptype_for_id;
|
$ptype_menu_id = 'menu-posts-' . $ptype_for_id;
|
||||||
|
@ -162,7 +162,7 @@ foreach ( array_merge( $builtin, $types ) as $ptype ) {
|
||||||
* by a hard-coded value below, increment the position.
|
* by a hard-coded value below, increment the position.
|
||||||
*/
|
*/
|
||||||
$core_menu_positions = array( 59, 60, 65, 70, 75, 80, 85, 99 );
|
$core_menu_positions = array( 59, 60, 65, 70, 75, 80, 85, 99 );
|
||||||
while ( isset( $menu[ $ptype_menu_position ] ) || in_array( $ptype_menu_position, $core_menu_positions ) ) {
|
while ( isset( $menu[ $ptype_menu_position ] ) || in_array( $ptype_menu_position, $core_menu_positions, true ) ) {
|
||||||
$ptype_menu_position++;
|
$ptype_menu_position++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ echo esc_html( $title );
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ( in_array( get_site_option( 'registration' ), array( 'all', 'blog' ) ) ) {
|
if ( in_array( get_site_option( 'registration' ), array( 'all', 'blog' ), true ) ) {
|
||||||
/** This filter is documented in wp-login.php */
|
/** This filter is documented in wp-login.php */
|
||||||
$sign_up_url = apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) );
|
$sign_up_url = apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) );
|
||||||
printf( ' <a href="%s" class="page-title-action">%s</a>', esc_url( $sign_up_url ), esc_html_x( 'Add New', 'site' ) );
|
printf( ' <a href="%s" class="page-title-action">%s</a>', esc_url( $sign_up_url ), esc_html_x( 'Add New', 'site' ) );
|
||||||
|
|
|
@ -416,7 +416,7 @@ if ( isset( $_GET['updated'] ) ) {
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
$lang = get_site_option( 'WPLANG' );
|
$lang = get_site_option( 'WPLANG' );
|
||||||
if ( ! in_array( $lang, $languages ) ) {
|
if ( ! in_array( $lang, $languages, true ) ) {
|
||||||
$lang = '';
|
$lang = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ if ( isset( $_REQUEST['action'] ) && 'add-site' == $_REQUEST['action'] ) {
|
||||||
if ( ! is_subdomain_install() ) {
|
if ( ! is_subdomain_install() ) {
|
||||||
$subdirectory_reserved_names = get_subdirectory_reserved_names();
|
$subdirectory_reserved_names = get_subdirectory_reserved_names();
|
||||||
|
|
||||||
if ( in_array( $domain, $subdirectory_reserved_names ) ) {
|
if ( in_array( $domain, $subdirectory_reserved_names, true ) ) {
|
||||||
wp_die(
|
wp_die(
|
||||||
sprintf(
|
sprintf(
|
||||||
/* translators: %s: Reserved names list. */
|
/* translators: %s: Reserved names list. */
|
||||||
|
@ -73,7 +73,7 @@ if ( isset( $_REQUEST['action'] ) && 'add-site' == $_REQUEST['action'] ) {
|
||||||
if ( isset( $_POST['WPLANG'] ) ) {
|
if ( isset( $_POST['WPLANG'] ) ) {
|
||||||
if ( '' === $_POST['WPLANG'] ) {
|
if ( '' === $_POST['WPLANG'] ) {
|
||||||
$meta['WPLANG'] = ''; // en_US
|
$meta['WPLANG'] = ''; // en_US
|
||||||
} elseif ( in_array( $_POST['WPLANG'], get_available_languages() ) ) {
|
} elseif ( in_array( $_POST['WPLANG'], get_available_languages(), true ) ) {
|
||||||
$meta['WPLANG'] = $_POST['WPLANG'];
|
$meta['WPLANG'] = $_POST['WPLANG'];
|
||||||
} elseif ( current_user_can( 'install_languages' ) && wp_can_install_language_pack() ) {
|
} elseif ( current_user_can( 'install_languages' ) && wp_can_install_language_pack() ) {
|
||||||
$language = wp_download_language_pack( wp_unslash( $_POST['WPLANG'] ) );
|
$language = wp_download_language_pack( wp_unslash( $_POST['WPLANG'] ) );
|
||||||
|
@ -260,7 +260,7 @@ printf(
|
||||||
$lang = get_site_option( 'WPLANG' );
|
$lang = get_site_option( 'WPLANG' );
|
||||||
|
|
||||||
// Use English if the default isn't available.
|
// Use English if the default isn't available.
|
||||||
if ( ! in_array( $lang, $languages ) ) {
|
if ( ! in_array( $lang, $languages, true ) ) {
|
||||||
$lang = '';
|
$lang = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ if ( isset( $_REQUEST['action'] ) && 'update-site' == $_REQUEST['action'] && is_
|
||||||
foreach ( (array) $_POST['option'] as $key => $val ) {
|
foreach ( (array) $_POST['option'] as $key => $val ) {
|
||||||
$key = wp_unslash( $key );
|
$key = wp_unslash( $key );
|
||||||
$val = wp_unslash( $val );
|
$val = wp_unslash( $val );
|
||||||
if ( 0 === $key || is_array( $val ) || in_array( $key, $skip_options ) ) {
|
if ( 0 === $key || is_array( $val ) || in_array( $key, $skip_options, true ) ) {
|
||||||
continue; // Avoids "0 is a protected WP option and may not be modified" error when edit blog options.
|
continue; // Avoids "0 is a protected WP option and may not be modified" error when edit blog options.
|
||||||
}
|
}
|
||||||
update_option( $key, $val );
|
update_option( $key, $val );
|
||||||
|
@ -149,7 +149,7 @@ if ( ! empty( $messages ) ) {
|
||||||
?>
|
?>
|
||||||
<tr class="form-field">
|
<tr class="form-field">
|
||||||
<th scope="row"><label for="<?php echo esc_attr( $option->option_name ); ?>"><?php echo esc_html( ucwords( str_replace( '_', ' ', $option->option_name ) ) ); ?></label></th>
|
<th scope="row"><label for="<?php echo esc_attr( $option->option_name ); ?>"><?php echo esc_html( ucwords( str_replace( '_', ' ', $option->option_name ) ) ); ?></label></th>
|
||||||
<?php if ( $is_main_site && in_array( $option->option_name, array( 'siteurl', 'home' ) ) ) { ?>
|
<?php if ( $is_main_site && in_array( $option->option_name, array( 'siteurl', 'home' ), true ) ) { ?>
|
||||||
<td><code><?php echo esc_html( $option->option_value ); ?></code></td>
|
<td><code><?php echo esc_html( $option->option_value ); ?></code></td>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<td><input class="<?php echo $class; ?>" name="option[<?php echo esc_attr( $option->option_name ); ?>]" type="text" id="<?php echo esc_attr( $option->option_name ); ?>" value="<?php echo esc_attr( $option->option_value ); ?>" size="40" <?php disabled( $disabled ); ?> /></td>
|
<td><input class="<?php echo $class; ?>" name="option[<?php echo esc_attr( $option->option_name ); ?>]" type="text" id="<?php echo esc_attr( $option->option_name ); ?>" value="<?php echo esc_attr( $option->option_value ); ?>" size="40" <?php disabled( $disabled ); ?> /></td>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* @since 3.1.0
|
* @since 3.1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) ) {
|
if ( isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ), true ) ) {
|
||||||
define( 'IFRAME_REQUEST', true );
|
define( 'IFRAME_REQUEST', true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ if ( $new_admin_email && get_option( 'admin_email' ) !== $new_admin_email ) :
|
||||||
|
|
||||||
$languages = get_available_languages();
|
$languages = get_available_languages();
|
||||||
$translations = wp_get_available_translations();
|
$translations = wp_get_available_translations();
|
||||||
if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG && ! in_array( WPLANG, $languages ) ) {
|
if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG && ! in_array( WPLANG, $languages, true ) ) {
|
||||||
$languages[] = WPLANG;
|
$languages[] = WPLANG;
|
||||||
}
|
}
|
||||||
if ( ! empty( $languages ) || ! empty( $translations ) ) {
|
if ( ! empty( $languages ) || ! empty( $translations ) ) {
|
||||||
|
@ -167,7 +167,7 @@ if ( ! empty( $languages ) || ! empty( $translations ) ) {
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
$locale = get_locale();
|
$locale = get_locale();
|
||||||
if ( ! in_array( $locale, $languages ) ) {
|
if ( ! in_array( $locale, $languages, true ) ) {
|
||||||
$locale = '';
|
$locale = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ if ( empty( $tzstring ) ) { // Create a UTC+- zone if no timezone string exists.
|
||||||
?>
|
?>
|
||||||
<br />
|
<br />
|
||||||
<?php
|
<?php
|
||||||
if ( in_array( $tzstring, timezone_identifiers_list() ) ) {
|
if ( in_array( $tzstring, timezone_identifiers_list(), true ) ) {
|
||||||
$transitions = timezone_transitions_get( timezone_open( $tzstring ), time() );
|
$transitions = timezone_transitions_get( timezone_open( $tzstring ), time() );
|
||||||
|
|
||||||
// 0 index is the state at current time, 1 index is the next transition, if any.
|
// 0 index is the state at current time, 1 index is the next transition, if any.
|
||||||
|
|
|
@ -240,7 +240,7 @@ $structures = array(
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">
|
<th scope="row">
|
||||||
<label><input name="selection" id="custom_selection" type="radio" value="custom" <?php checked( ! in_array( $permalink_structure, $structures ) ); ?> />
|
<label><input name="selection" id="custom_selection" type="radio" value="custom" <?php checked( ! in_array( $permalink_structure, $structures, true ) ); ?> />
|
||||||
<?php _e( 'Custom Structure' ); ?>
|
<?php _e( 'Custom Structure' ); ?>
|
||||||
</label>
|
</label>
|
||||||
</th>
|
</th>
|
||||||
|
|
|
@ -62,7 +62,7 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
|
||||||
<?php
|
<?php
|
||||||
settings_fields( 'reading' );
|
settings_fields( 'reading' );
|
||||||
|
|
||||||
if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) {
|
if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ), true ) ) {
|
||||||
add_settings_field( 'blog_charset', __( 'Encoding for pages and feeds' ), 'options_reading_blog_charset', 'reading', 'default', array( 'label_for' => 'blog_charset' ) );
|
add_settings_field( 'blog_charset', __( 'Encoding for pages and feeds' ), 'options_reading_blog_charset', 'reading', 'default', array( 'label_for' => 'blog_charset' ) );
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -152,7 +152,7 @@ $whitelist_options['privacy'] = array();
|
||||||
|
|
||||||
$mail_options = array( 'mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass' );
|
$mail_options = array( 'mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass' );
|
||||||
|
|
||||||
if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) {
|
if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ), true ) ) {
|
||||||
$whitelist_options['reading'][] = 'blog_charset';
|
$whitelist_options['reading'][] = 'blog_charset';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ if ( ! is_file( $real_file ) ) {
|
||||||
if ( preg_match( '/\.([^.]+)$/', $real_file, $matches ) ) {
|
if ( preg_match( '/\.([^.]+)$/', $real_file, $matches ) ) {
|
||||||
$ext = strtolower( $matches[1] );
|
$ext = strtolower( $matches[1] );
|
||||||
// If extension is not in the acceptable list, skip it.
|
// If extension is not in the acceptable list, skip it.
|
||||||
if ( ! in_array( $ext, $editable_extensions ) ) {
|
if ( ! in_array( $ext, $editable_extensions, true ) ) {
|
||||||
wp_die( sprintf( '<p>%s</p>', __( 'Files of this type are not editable.' ) ) );
|
wp_die( sprintf( '<p>%s</p>', __( 'Files of this type are not editable.' ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ $content = esc_textarea( $content );
|
||||||
<?php
|
<?php
|
||||||
$plugin_editable_files = array();
|
$plugin_editable_files = array();
|
||||||
foreach ( $plugin_files as $plugin_file ) {
|
foreach ( $plugin_files as $plugin_file ) {
|
||||||
if ( preg_match( '/\.([^.]+)$/', $plugin_file, $matches ) && in_array( $matches[1], $editable_extensions ) ) {
|
if ( preg_match( '/\.([^.]+)$/', $plugin_file, $matches ) && in_array( $matches[1], $editable_extensions, true ) ) {
|
||||||
$plugin_editable_files[] = $plugin_file;
|
$plugin_editable_files[] = $plugin_file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -277,7 +277,7 @@ $content = esc_textarea( $content );
|
||||||
|
|
||||||
<?php if ( is_writeable( $real_file ) ) : ?>
|
<?php if ( is_writeable( $real_file ) ) : ?>
|
||||||
<div class="editor-notices">
|
<div class="editor-notices">
|
||||||
<?php if ( in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) ) { ?>
|
<?php if ( in_array( $plugin, (array) get_option( 'active_plugins', array() ), true ) ) { ?>
|
||||||
<div class="notice notice-warning inline active-plugin-edit-warning">
|
<div class="notice notice-warning inline active-plugin-edit-warning">
|
||||||
<p><?php _e( '<strong>Warning:</strong> Making changes to active plugins is not recommended.' ); ?></p>
|
<p><?php _e( '<strong>Warning:</strong> Making changes to active plugins is not recommended.' ); ?></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -18,7 +18,7 @@ global $post_type, $post_type_object, $post;
|
||||||
|
|
||||||
if ( ! isset( $_GET['post_type'] ) ) {
|
if ( ! isset( $_GET['post_type'] ) ) {
|
||||||
$post_type = 'post';
|
$post_type = 'post';
|
||||||
} elseif ( in_array( $_GET['post_type'], get_post_types( array( 'show_ui' => true ) ) ) ) {
|
} elseif ( in_array( $_GET['post_type'], get_post_types( array( 'show_ui' => true ) ), true ) ) {
|
||||||
$post_type = $_GET['post_type'];
|
$post_type = $_GET['post_type'];
|
||||||
} else {
|
} else {
|
||||||
wp_die( __( 'Invalid post type.' ) );
|
wp_die( __( 'Invalid post type.' ) );
|
||||||
|
|
|
@ -131,7 +131,7 @@ switch ( $action ) {
|
||||||
wp_die( __( 'Invalid post type.' ) );
|
wp_die( __( 'Invalid post type.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ) ) ) {
|
if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ), true ) ) {
|
||||||
wp_die( __( 'Sorry, you are not allowed to edit posts in this post type.' ) );
|
wp_die( __( 'Sorry, you are not allowed to edit posts in this post type.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,9 +35,9 @@ $tax = get_taxonomy( $tag->taxonomy );
|
||||||
$taxonomy = $tax->name;
|
$taxonomy = $tax->name;
|
||||||
$title = $tax->labels->edit_item;
|
$title = $tax->labels->edit_item;
|
||||||
|
|
||||||
if ( ! in_array( $taxonomy, get_taxonomies( array( 'show_ui' => true ) ) ) ||
|
if ( ! in_array( $taxonomy, get_taxonomies( array( 'show_ui' => true ) ), true )
|
||||||
! current_user_can( 'edit_term', $tag->term_id ) ) {
|
|| ! current_user_can( 'edit_term', $tag->term_id )
|
||||||
|
) {
|
||||||
wp_die(
|
wp_die(
|
||||||
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
|
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
|
||||||
'<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',
|
'<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',
|
||||||
|
|
|
@ -177,7 +177,7 @@ if ( ! empty( $posted_content ) ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$file_description = get_file_description( $relative_file );
|
$file_description = get_file_description( $relative_file );
|
||||||
$file_show = array_search( $file, array_filter( $allowed_files ) );
|
$file_show = array_search( $file, array_filter( $allowed_files ), true );
|
||||||
$description = esc_html( $file_description );
|
$description = esc_html( $file_description );
|
||||||
if ( $file_description != $file_show ) {
|
if ( $file_description != $file_show ) {
|
||||||
$description .= ' <span>(' . esc_html( $file_show ) . ')</span>';
|
$description .= ' <span>(' . esc_html( $file_show ) . ')</span>';
|
||||||
|
|
|
@ -6,7 +6,9 @@
|
||||||
* @subpackage Administration
|
* @subpackage Administration
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'IFRAME_REQUEST' ) && isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) ) {
|
if ( ! defined( 'IFRAME_REQUEST' )
|
||||||
|
&& isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ), true )
|
||||||
|
) {
|
||||||
define( 'IFRAME_REQUEST', true );
|
define( 'IFRAME_REQUEST', true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ if ( ! current_user_can( 'upload_files' ) ) {
|
||||||
$mode = get_user_option( 'media_library_mode', get_current_user_id() ) ? get_user_option( 'media_library_mode', get_current_user_id() ) : 'grid';
|
$mode = get_user_option( 'media_library_mode', get_current_user_id() ) ? get_user_option( 'media_library_mode', get_current_user_id() ) : 'grid';
|
||||||
$modes = array( 'grid', 'list' );
|
$modes = array( 'grid', 'list' );
|
||||||
|
|
||||||
if ( isset( $_GET['mode'] ) && in_array( $_GET['mode'], $modes ) ) {
|
if ( isset( $_GET['mode'] ) && in_array( $_GET['mode'], $modes, true ) ) {
|
||||||
$mode = $_GET['mode'];
|
$mode = $_GET['mode'];
|
||||||
update_user_option( get_current_user_id(), 'media_library_mode', $mode );
|
update_user_option( get_current_user_id(), 'media_library_mode', $mode );
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ if ( 'grid' === $mode ) {
|
||||||
$vars = wp_edit_attachments_query_vars( $q );
|
$vars = wp_edit_attachments_query_vars( $q );
|
||||||
$ignore = array( 'mode', 'post_type', 'post_status', 'posts_per_page' );
|
$ignore = array( 'mode', 'post_type', 'post_status', 'posts_per_page' );
|
||||||
foreach ( $vars as $key => $value ) {
|
foreach ( $vars as $key => $value ) {
|
||||||
if ( ! $value || in_array( $key, $ignore ) ) {
|
if ( ! $value || in_array( $key, $ignore, true ) ) {
|
||||||
unset( $vars[ $key ] );
|
unset( $vars[ $key ] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -477,7 +477,7 @@ endif;
|
||||||
$public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
|
$public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! in_array( $profileuser->display_name, $public_display ) ) { // Only add this if it isn't duplicated elsewhere.
|
if ( ! in_array( $profileuser->display_name, $public_display, true ) ) { // Only add this if it isn't duplicated elsewhere.
|
||||||
$public_display = array( 'display_displayname' => $profileuser->display_name ) + $public_display;
|
$public_display = array( 'display_displayname' => $profileuser->display_name ) + $public_display;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -493,7 +493,7 @@ function twentyeleven_layout_classes( $existing_classes ) {
|
||||||
$options = twentyeleven_get_theme_options();
|
$options = twentyeleven_get_theme_options();
|
||||||
$current_layout = $options['theme_layout'];
|
$current_layout = $options['theme_layout'];
|
||||||
|
|
||||||
if ( in_array( $current_layout, array( 'content-sidebar', 'sidebar-content' ) ) ) {
|
if ( in_array( $current_layout, array( 'content-sidebar', 'sidebar-content' ), true ) ) {
|
||||||
$classes = array( 'two-column' );
|
$classes = array( 'two-column' );
|
||||||
} else {
|
} else {
|
||||||
$classes = array( 'one-column' );
|
$classes = array( 'one-column' );
|
||||||
|
|
|
@ -61,7 +61,7 @@ if ( ! function_exists( 'twentyfifteen_entry_meta' ) ) :
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( in_array( get_post_type(), array( 'post', 'attachment' ) ) ) {
|
if ( in_array( get_post_type(), array( 'post', 'attachment' ), true ) ) {
|
||||||
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
|
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
|
||||||
|
|
||||||
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
|
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<?php twentyfourteen_post_thumbnail(); ?>
|
<?php twentyfourteen_post_thumbnail(); ?>
|
||||||
|
|
||||||
<header class="entry-header">
|
<header class="entry-header">
|
||||||
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
|
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ), true ) && twentyfourteen_categorized_blog() ) : ?>
|
||||||
<div class="entry-meta">
|
<div class="entry-meta">
|
||||||
<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
|
<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
|
||||||
</div><!-- .entry-meta -->
|
</div><!-- .entry-meta -->
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<?php twentyfourteen_post_thumbnail(); ?>
|
<?php twentyfourteen_post_thumbnail(); ?>
|
||||||
|
|
||||||
<header class="entry-header">
|
<header class="entry-header">
|
||||||
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
|
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ), true ) && twentyfourteen_categorized_blog() ) : ?>
|
||||||
<div class="entry-meta">
|
<div class="entry-meta">
|
||||||
<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
|
<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
|
||||||
</div><!-- .entry-meta -->
|
</div><!-- .entry-meta -->
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<header class="entry-header">
|
<header class="entry-header">
|
||||||
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
|
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ), true ) && twentyfourteen_categorized_blog() ) : ?>
|
||||||
<div class="entry-meta">
|
<div class="entry-meta">
|
||||||
<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
|
<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
|
||||||
</div><!-- .entry-meta -->
|
</div><!-- .entry-meta -->
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<?php twentyfourteen_post_thumbnail(); ?>
|
<?php twentyfourteen_post_thumbnail(); ?>
|
||||||
|
|
||||||
<header class="entry-header">
|
<header class="entry-header">
|
||||||
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
|
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ), true ) && twentyfourteen_categorized_blog() ) : ?>
|
||||||
<div class="entry-meta">
|
<div class="entry-meta">
|
||||||
<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
|
<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
|
||||||
</div><!-- .entry-meta -->
|
</div><!-- .entry-meta -->
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<?php twentyfourteen_post_thumbnail(); ?>
|
<?php twentyfourteen_post_thumbnail(); ?>
|
||||||
|
|
||||||
<header class="entry-header">
|
<header class="entry-header">
|
||||||
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
|
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ), true ) && twentyfourteen_categorized_blog() ) : ?>
|
||||||
<div class="entry-meta">
|
<div class="entry-meta">
|
||||||
<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
|
<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
|
||||||
</div><!-- .entry-meta -->
|
</div><!-- .entry-meta -->
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<?php twentyfourteen_post_thumbnail(); ?>
|
<?php twentyfourteen_post_thumbnail(); ?>
|
||||||
|
|
||||||
<header class="entry-header">
|
<header class="entry-header">
|
||||||
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
|
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ), true ) && twentyfourteen_categorized_blog() ) : ?>
|
||||||
<div class="entry-meta">
|
<div class="entry-meta">
|
||||||
<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
|
<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
|
||||||
</div><!-- .entry-meta -->
|
</div><!-- .entry-meta -->
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<?php twentyfourteen_post_thumbnail(); ?>
|
<?php twentyfourteen_post_thumbnail(); ?>
|
||||||
|
|
||||||
<header class="entry-header">
|
<header class="entry-header">
|
||||||
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
|
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ), true ) && twentyfourteen_categorized_blog() ) : ?>
|
||||||
<div class="entry-meta">
|
<div class="entry-meta">
|
||||||
<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
|
<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
|
||||||
</div><!-- .entry-meta -->
|
</div><!-- .entry-meta -->
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<?php twentyfourteen_post_thumbnail(); ?>
|
<?php twentyfourteen_post_thumbnail(); ?>
|
||||||
|
|
||||||
<header class="entry-header">
|
<header class="entry-header">
|
||||||
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
|
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ), true ) && twentyfourteen_categorized_blog() ) : ?>
|
||||||
<div class="entry-meta">
|
<div class="entry-meta">
|
||||||
<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
|
<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
|
||||||
</div><!-- .entry-meta -->
|
</div><!-- .entry-meta -->
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<?php twentyfourteen_post_thumbnail(); ?>
|
<?php twentyfourteen_post_thumbnail(); ?>
|
||||||
|
|
||||||
<header class="entry-header">
|
<header class="entry-header">
|
||||||
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
|
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ), true ) && twentyfourteen_categorized_blog() ) : ?>
|
||||||
<div class="entry-meta">
|
<div class="entry-meta">
|
||||||
<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
|
<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -544,7 +544,7 @@ function twentyfourteen_body_classes( $classes ) {
|
||||||
|
|
||||||
if ( get_header_image() ) {
|
if ( get_header_image() ) {
|
||||||
$classes[] = 'header-image';
|
$classes[] = 'header-image';
|
||||||
} elseif ( ! in_array( $GLOBALS['pagenow'], array( 'wp-activate.php', 'wp-signup.php' ) ) ) {
|
} elseif ( ! in_array( $GLOBALS['pagenow'], array( 'wp-activate.php', 'wp-signup.php' ), true ) ) {
|
||||||
$classes[] = 'masthead-fixed';
|
$classes[] = 'masthead-fixed';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ function twentyfourteen_customize_partial_blogdescription() {
|
||||||
* @return string Filtered layout type (grid|slider).
|
* @return string Filtered layout type (grid|slider).
|
||||||
*/
|
*/
|
||||||
function twentyfourteen_sanitize_layout( $layout ) {
|
function twentyfourteen_sanitize_layout( $layout ) {
|
||||||
if ( ! in_array( $layout, array( 'grid', 'slider' ) ) ) {
|
if ( ! in_array( $layout, array( 'grid', 'slider' ), true ) ) {
|
||||||
$layout = 'grid';
|
$layout = 'grid';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -292,7 +292,7 @@ class Featured_Content {
|
||||||
}
|
}
|
||||||
|
|
||||||
// We only want to hide the featured tag.
|
// We only want to hide the featured tag.
|
||||||
if ( ! in_array( 'post_tag', $taxonomies ) ) {
|
if ( ! in_array( 'post_tag', $taxonomies, true ) ) {
|
||||||
return $terms;
|
return $terms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,11 @@ class Twenty_Fourteen_Ephemera_Widget extends WP_Widget {
|
||||||
* @param array $instance An array of settings for this widget instance.
|
* @param array $instance An array of settings for this widget instance.
|
||||||
*/
|
*/
|
||||||
public function widget( $args, $instance ) {
|
public function widget( $args, $instance ) {
|
||||||
$format = isset( $instance['format'] ) && in_array( $instance['format'], $this->formats ) ? $instance['format'] : 'aside';
|
$format = isset( $instance['format'] ) ? $instance['format'] : '';
|
||||||
|
|
||||||
|
if ( ! $format || ! in_array( $format, $this->formats, true ) ) {
|
||||||
|
$format = 'aside';
|
||||||
|
}
|
||||||
|
|
||||||
switch ( $format ) {
|
switch ( $format ) {
|
||||||
case 'image':
|
case 'image':
|
||||||
|
@ -105,8 +109,9 @@ class Twenty_Fourteen_Ephemera_Widget extends WP_Widget {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$number = empty( $instance['number'] ) ? 2 : absint( $instance['number'] );
|
$number = ! empty( $instance['number'] ) ? absint( $instance['number'] ) : 2;
|
||||||
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? $format_string : $instance['title'], $instance, $this->id_base );
|
$title = ! empty( $instance['title'] ) ? $instance['title'] : $format_string;
|
||||||
|
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
|
||||||
|
|
||||||
$ephemera = new WP_Query(
|
$ephemera = new WP_Query(
|
||||||
array(
|
array(
|
||||||
|
@ -265,7 +270,8 @@ class Twenty_Fourteen_Ephemera_Widget extends WP_Widget {
|
||||||
function update( $new_instance, $instance ) {
|
function update( $new_instance, $instance ) {
|
||||||
$instance['title'] = strip_tags( $new_instance['title'] );
|
$instance['title'] = strip_tags( $new_instance['title'] );
|
||||||
$instance['number'] = empty( $new_instance['number'] ) ? 2 : absint( $new_instance['number'] );
|
$instance['number'] = empty( $new_instance['number'] ) ? 2 : absint( $new_instance['number'] );
|
||||||
if ( in_array( $new_instance['format'], $this->formats ) ) {
|
|
||||||
|
if ( in_array( $new_instance['format'], $this->formats, true ) ) {
|
||||||
$instance['format'] = $new_instance['format'];
|
$instance['format'] = $new_instance['format'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,9 +286,13 @@ class Twenty_Fourteen_Ephemera_Widget extends WP_Widget {
|
||||||
* @param array $instance
|
* @param array $instance
|
||||||
*/
|
*/
|
||||||
function form( $instance ) {
|
function form( $instance ) {
|
||||||
$title = empty( $instance['title'] ) ? '' : esc_attr( $instance['title'] );
|
$title = ! empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
|
||||||
$number = empty( $instance['number'] ) ? 2 : absint( $instance['number'] );
|
$number = ! empty( $instance['number'] ) ? absint( $instance['number'] ) : 2;
|
||||||
$format = isset( $instance['format'] ) && in_array( $instance['format'], $this->formats ) ? $instance['format'] : 'aside';
|
$format = isset( $instance['format'] ) ? $instance['format'] : '';
|
||||||
|
|
||||||
|
if ( ! $format || ! in_array( $format, $this->formats, true ) ) {
|
||||||
|
$format = 'aside';
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'twentyfourteen' ); ?></label>
|
<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'twentyfourteen' ); ?></label>
|
||||||
<input id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>"></p>
|
<input id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>"></p>
|
||||||
|
|
|
@ -165,7 +165,7 @@ add_filter( 'wp_nav_menu', 'twentynineteen_add_ellipses_to_nav', 10, 2 );
|
||||||
function twentynineteen_nav_menu_link_attributes( $atts, $item, $args, $depth ) {
|
function twentynineteen_nav_menu_link_attributes( $atts, $item, $args, $depth ) {
|
||||||
|
|
||||||
// Add [aria-haspopup] and [aria-expanded] to menu items that have children.
|
// Add [aria-haspopup] and [aria-expanded] to menu items that have children.
|
||||||
$item_has_children = in_array( 'menu-item-has-children', $item->classes );
|
$item_has_children = in_array( 'menu-item-has-children', $item->classes, true );
|
||||||
if ( $item_has_children ) {
|
if ( $item_has_children ) {
|
||||||
$atts['aria-haspopup'] = 'true';
|
$atts['aria-haspopup'] = 'true';
|
||||||
$atts['aria-expanded'] = 'false';
|
$atts['aria-expanded'] = 'false';
|
||||||
|
|
|
@ -29,7 +29,7 @@ if ( ! function_exists( 'twentysixteen_entry_meta' ) ) :
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( in_array( get_post_type(), array( 'post', 'attachment' ) ) ) {
|
if ( in_array( get_post_type(), array( 'post', 'attachment' ), true ) ) {
|
||||||
twentysixteen_entry_date();
|
twentysixteen_entry_date();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -578,7 +578,7 @@ function twentytwelve_body_class( $classes ) {
|
||||||
if ( empty( $background_image ) ) {
|
if ( empty( $background_image ) ) {
|
||||||
if ( empty( $background_color ) ) {
|
if ( empty( $background_color ) ) {
|
||||||
$classes[] = 'custom-background-empty';
|
$classes[] = 'custom-background-empty';
|
||||||
} elseif ( in_array( $background_color, array( 'fff', 'ffffff' ) ) ) {
|
} elseif ( in_array( $background_color, array( 'fff', 'ffffff' ), true ) ) {
|
||||||
$classes[] = 'custom-background-white';
|
$classes[] = 'custom-background-white';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,7 @@ function get_the_author_meta( $field = '', $user_id = false ) {
|
||||||
$authordata = get_userdata( $user_id );
|
$authordata = get_userdata( $user_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( in_array( $field, array( 'login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status' ) ) ) {
|
if ( in_array( $field, array( 'login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status' ), true ) ) {
|
||||||
$field = 'user_' . $field;
|
$field = 'user_' . $field;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -279,9 +279,9 @@ function get_bookmarks( $args = '' ) {
|
||||||
foreach ( explode( ',', $orderby ) as $ordparam ) {
|
foreach ( explode( ',', $orderby ) as $ordparam ) {
|
||||||
$ordparam = trim( $ordparam );
|
$ordparam = trim( $ordparam );
|
||||||
|
|
||||||
if ( in_array( 'link_' . $ordparam, $keys ) ) {
|
if ( in_array( 'link_' . $ordparam, $keys, true ) ) {
|
||||||
$orderparams[] = 'link_' . $ordparam;
|
$orderparams[] = 'link_' . $ordparam;
|
||||||
} elseif ( in_array( $ordparam, $keys ) ) {
|
} elseif ( in_array( $ordparam, $keys, true ) ) {
|
||||||
$orderparams[] = $ordparam;
|
$orderparams[] = $ordparam;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -293,7 +293,7 @@ function get_bookmarks( $args = '' ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$order = strtoupper( $parsed_args['order'] );
|
$order = strtoupper( $parsed_args['order'] );
|
||||||
if ( '' !== $order && ! in_array( $order, array( 'ASC', 'DESC' ) ) ) {
|
if ( '' !== $order && ! in_array( $order, array( 'ASC', 'DESC' ), true ) ) {
|
||||||
$order = 'ASC';
|
$order = 'ASC';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,7 +412,7 @@ function sanitize_bookmark_field( $field, $value, $bookmark_id, $context ) {
|
||||||
break;
|
break;
|
||||||
case 'link_target': // "enum"
|
case 'link_target': // "enum"
|
||||||
$targets = array( '_top', '_blank' );
|
$targets = array( '_top', '_blank' );
|
||||||
if ( ! in_array( $value, $targets ) ) {
|
if ( ! in_array( $value, $targets, true ) ) {
|
||||||
$value = '';
|
$value = '';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
||||||
global $wp_rewrite, $is_IIS, $wp_query, $wpdb, $wp;
|
global $wp_rewrite, $is_IIS, $wp_query, $wpdb, $wp;
|
||||||
|
|
||||||
if ( isset( $_SERVER['REQUEST_METHOD'] ) && ! in_array( strtoupper( $_SERVER['REQUEST_METHOD'] ), array( 'GET', 'HEAD' ) ) ) {
|
if ( isset( $_SERVER['REQUEST_METHOD'] ) && ! in_array( strtoupper( $_SERVER['REQUEST_METHOD'] ), array( 'GET', 'HEAD' ), true ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$addl_path = '';
|
$addl_path = '';
|
||||||
if ( is_feed() && in_array( get_query_var( 'feed' ), $wp_rewrite->feeds ) ) {
|
if ( is_feed() && in_array( get_query_var( 'feed' ), $wp_rewrite->feeds, true ) ) {
|
||||||
$addl_path = ! empty( $addl_path ) ? trailingslashit( $addl_path ) : '';
|
$addl_path = ! empty( $addl_path ) ? trailingslashit( $addl_path ) : '';
|
||||||
if ( ! is_singular() && get_query_var( 'withcomments' ) ) {
|
if ( ! is_singular() && get_query_var( 'withcomments' ) ) {
|
||||||
$addl_path .= 'comments/';
|
$addl_path .= 'comments/';
|
||||||
|
@ -751,7 +751,7 @@ function wp_redirect_admin_locations() {
|
||||||
site_url( 'dashboard', 'relative' ),
|
site_url( 'dashboard', 'relative' ),
|
||||||
site_url( 'admin', 'relative' ),
|
site_url( 'admin', 'relative' ),
|
||||||
);
|
);
|
||||||
if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $admins ) ) {
|
if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $admins, true ) ) {
|
||||||
wp_redirect( admin_url() );
|
wp_redirect( admin_url() );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -761,7 +761,7 @@ function wp_redirect_admin_locations() {
|
||||||
home_url( 'login', 'relative' ),
|
home_url( 'login', 'relative' ),
|
||||||
site_url( 'login', 'relative' ),
|
site_url( 'login', 'relative' ),
|
||||||
);
|
);
|
||||||
if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $logins ) ) {
|
if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $logins, true ) ) {
|
||||||
wp_redirect( wp_login_url() );
|
wp_redirect( wp_login_url() );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -879,7 +879,7 @@ function is_super_admin( $user_id = false ) {
|
||||||
|
|
||||||
if ( is_multisite() ) {
|
if ( is_multisite() ) {
|
||||||
$super_admins = get_super_admins();
|
$super_admins = get_super_admins();
|
||||||
if ( is_array( $super_admins ) && in_array( $user->user_login, $super_admins ) ) {
|
if ( is_array( $super_admins ) && in_array( $user->user_login, $super_admins, true ) ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -921,7 +921,7 @@ function grant_super_admin( $user_id ) {
|
||||||
$super_admins = get_site_option( 'site_admins', array( 'admin' ) );
|
$super_admins = get_site_option( 'site_admins', array( 'admin' ) );
|
||||||
|
|
||||||
$user = get_userdata( $user_id );
|
$user = get_userdata( $user_id );
|
||||||
if ( $user && ! in_array( $user->user_login, $super_admins ) ) {
|
if ( $user && ! in_array( $user->user_login, $super_admins, true ) ) {
|
||||||
$super_admins[] = $user->user_login;
|
$super_admins[] = $user->user_login;
|
||||||
update_site_option( 'site_admins', $super_admins );
|
update_site_option( 'site_admins', $super_admins );
|
||||||
|
|
||||||
|
@ -969,7 +969,7 @@ function revoke_super_admin( $user_id ) {
|
||||||
|
|
||||||
$user = get_userdata( $user_id );
|
$user = get_userdata( $user_id );
|
||||||
if ( $user && 0 !== strcasecmp( $user->user_email, get_site_option( 'admin_email' ) ) ) {
|
if ( $user && 0 !== strcasecmp( $user->user_email, get_site_option( 'admin_email' ) ) ) {
|
||||||
$key = array_search( $user->user_login, $super_admins );
|
$key = array_search( $user->user_login, $super_admins, true );
|
||||||
if ( false !== $key ) {
|
if ( false !== $key ) {
|
||||||
unset( $super_admins[ $key ] );
|
unset( $super_admins[ $key ] );
|
||||||
update_site_option( 'site_admins', $super_admins );
|
update_site_option( 'site_admins', $super_admins );
|
||||||
|
|
|
@ -590,7 +590,7 @@ function wp_list_categories( $args = '' ) {
|
||||||
|
|
||||||
// For taxonomies that belong only to custom post types, point to a valid archive.
|
// For taxonomies that belong only to custom post types, point to a valid archive.
|
||||||
$taxonomy_object = get_taxonomy( $parsed_args['taxonomy'] );
|
$taxonomy_object = get_taxonomy( $parsed_args['taxonomy'] );
|
||||||
if ( ! in_array( 'post', $taxonomy_object->object_type ) && ! in_array( 'page', $taxonomy_object->object_type ) ) {
|
if ( ! in_array( 'post', $taxonomy_object->object_type, true ) && ! in_array( 'page', $taxonomy_object->object_type, true ) ) {
|
||||||
foreach ( $taxonomy_object->object_type as $object_type ) {
|
foreach ( $taxonomy_object->object_type as $object_type ) {
|
||||||
$_object_type = get_post_type_object( $object_type );
|
$_object_type = get_post_type_object( $object_type );
|
||||||
|
|
||||||
|
|
|
@ -532,7 +532,7 @@ class WP_Http {
|
||||||
|
|
||||||
// Loop over each transport on each HTTP request looking for one which will serve this request's needs.
|
// Loop over each transport on each HTTP request looking for one which will serve this request's needs.
|
||||||
foreach ( $request_order as $transport ) {
|
foreach ( $request_order as $transport ) {
|
||||||
if ( in_array( $transport, $transports ) ) {
|
if ( in_array( $transport, $transports, true ) ) {
|
||||||
$transport = ucfirst( $transport );
|
$transport = ucfirst( $transport );
|
||||||
}
|
}
|
||||||
$class = 'WP_Http_' . $transport;
|
$class = 'WP_Http_' . $transport;
|
||||||
|
@ -904,7 +904,7 @@ class WP_Http {
|
||||||
if ( ! empty( $wildcard_regex ) ) {
|
if ( ! empty( $wildcard_regex ) ) {
|
||||||
return ! preg_match( $wildcard_regex, $check['host'] );
|
return ! preg_match( $wildcard_regex, $check['host'] );
|
||||||
} else {
|
} else {
|
||||||
return ! in_array( $check['host'], $accessible_hosts ); // Inverse logic, if it's in the array, then don't block it.
|
return ! in_array( $check['host'], $accessible_hosts, true ); // Inverse logic, if it's in the array, then don't block it.
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -516,7 +516,7 @@ class WP_Comment_Query {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 'any' overrides other statuses.
|
// 'any' overrides other statuses.
|
||||||
if ( ! in_array( 'any', $statuses ) ) {
|
if ( ! in_array( 'any', $statuses, true ) ) {
|
||||||
foreach ( $statuses as $status ) {
|
foreach ( $statuses as $status ) {
|
||||||
switch ( $status ) {
|
switch ( $status ) {
|
||||||
case 'hold':
|
case 'hold':
|
||||||
|
@ -595,7 +595,7 @@ class WP_Comment_Query {
|
||||||
$_order = $_value;
|
$_order = $_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $found_orderby_comment_id && in_array( $_orderby, array( 'comment_ID', 'comment__in' ) ) ) {
|
if ( ! $found_orderby_comment_id && in_array( $_orderby, array( 'comment_ID', 'comment__in' ), true ) ) {
|
||||||
$found_orderby_comment_id = true;
|
$found_orderby_comment_id = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1145,7 +1145,7 @@ class WP_Comment_Query {
|
||||||
} elseif ( 'comment__in' === $orderby ) {
|
} elseif ( 'comment__in' === $orderby ) {
|
||||||
$comment__in = implode( ',', array_map( 'absint', $this->query_vars['comment__in'] ) );
|
$comment__in = implode( ',', array_map( 'absint', $this->query_vars['comment__in'] ) );
|
||||||
$parsed = "FIELD( {$wpdb->comments}.comment_ID, $comment__in )";
|
$parsed = "FIELD( {$wpdb->comments}.comment_ID, $comment__in )";
|
||||||
} elseif ( in_array( $orderby, $allowed_keys ) ) {
|
} elseif ( in_array( $orderby, $allowed_keys, true ) ) {
|
||||||
|
|
||||||
if ( isset( $meta_query_clauses[ $orderby ] ) ) {
|
if ( isset( $meta_query_clauses[ $orderby ] ) ) {
|
||||||
$meta_clause = $meta_query_clauses[ $orderby ];
|
$meta_clause = $meta_query_clauses[ $orderby ];
|
||||||
|
|
|
@ -343,7 +343,7 @@ final class WP_Comment {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function __isset( $name ) {
|
public function __isset( $name ) {
|
||||||
if ( in_array( $name, $this->post_fields ) && 0 !== (int) $this->comment_post_ID ) {
|
if ( in_array( $name, $this->post_fields, true ) && 0 !== (int) $this->comment_post_ID ) {
|
||||||
$post = get_post( $this->comment_post_ID );
|
$post = get_post( $this->comment_post_ID );
|
||||||
return property_exists( $post, $name );
|
return property_exists( $post, $name );
|
||||||
}
|
}
|
||||||
|
@ -360,7 +360,7 @@ final class WP_Comment {
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function __get( $name ) {
|
public function __get( $name ) {
|
||||||
if ( in_array( $name, $this->post_fields ) ) {
|
if ( in_array( $name, $this->post_fields, true ) ) {
|
||||||
$post = get_post( $this->comment_post_ID );
|
$post = get_post( $this->comment_post_ID );
|
||||||
return $post->$name;
|
return $post->$name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5899,11 +5899,11 @@ final class WP_Customize_Manager {
|
||||||
*/
|
*/
|
||||||
public function _sanitize_background_setting( $value, $setting ) {
|
public function _sanitize_background_setting( $value, $setting ) {
|
||||||
if ( 'background_repeat' === $setting->id ) {
|
if ( 'background_repeat' === $setting->id ) {
|
||||||
if ( ! in_array( $value, array( 'repeat-x', 'repeat-y', 'repeat', 'no-repeat' ) ) ) {
|
if ( ! in_array( $value, array( 'repeat-x', 'repeat-y', 'repeat', 'no-repeat' ), true ) ) {
|
||||||
return new WP_Error( 'invalid_value', __( 'Invalid value for background repeat.' ) );
|
return new WP_Error( 'invalid_value', __( 'Invalid value for background repeat.' ) );
|
||||||
}
|
}
|
||||||
} elseif ( 'background_attachment' === $setting->id ) {
|
} elseif ( 'background_attachment' === $setting->id ) {
|
||||||
if ( ! in_array( $value, array( 'fixed', 'scroll' ) ) ) {
|
if ( ! in_array( $value, array( 'fixed', 'scroll' ), true ) ) {
|
||||||
return new WP_Error( 'invalid_value', __( 'Invalid value for background attachment.' ) );
|
return new WP_Error( 'invalid_value', __( 'Invalid value for background attachment.' ) );
|
||||||
}
|
}
|
||||||
} elseif ( 'background_position_x' === $setting->id ) {
|
} elseif ( 'background_position_x' === $setting->id ) {
|
||||||
|
|
|
@ -450,7 +450,7 @@ final class WP_Customize_Widgets {
|
||||||
$section_args = array(
|
$section_args = array(
|
||||||
'title' => $wp_registered_sidebars[ $sidebar_id ]['name'],
|
'title' => $wp_registered_sidebars[ $sidebar_id ]['name'],
|
||||||
'description' => $wp_registered_sidebars[ $sidebar_id ]['description'],
|
'description' => $wp_registered_sidebars[ $sidebar_id ]['description'],
|
||||||
'priority' => array_search( $sidebar_id, array_keys( $wp_registered_sidebars ) ),
|
'priority' => array_search( $sidebar_id, array_keys( $wp_registered_sidebars ), true ),
|
||||||
'panel' => 'widgets',
|
'panel' => 'widgets',
|
||||||
'sidebar_id' => $sidebar_id,
|
'sidebar_id' => $sidebar_id,
|
||||||
);
|
);
|
||||||
|
@ -577,7 +577,7 @@ final class WP_Customize_Widgets {
|
||||||
|
|
||||||
$parsed_widget_id = $this->parse_widget_id( $widget_id );
|
$parsed_widget_id = $this->parse_widget_id( $widget_id );
|
||||||
$width = $wp_registered_widget_controls[ $widget_id ]['width'];
|
$width = $wp_registered_widget_controls[ $widget_id ]['width'];
|
||||||
$is_core = in_array( $parsed_widget_id['id_base'], $this->core_widget_id_bases );
|
$is_core = in_array( $parsed_widget_id['id_base'], $this->core_widget_id_bases, true );
|
||||||
$is_wide = ( $width > 250 && ! $is_core );
|
$is_wide = ( $width > 250 && ! $is_core );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1220,7 +1220,7 @@ final class WP_Customize_Widgets {
|
||||||
* @return bool Whether the widget is rendered.
|
* @return bool Whether the widget is rendered.
|
||||||
*/
|
*/
|
||||||
public function is_widget_rendered( $widget_id ) {
|
public function is_widget_rendered( $widget_id ) {
|
||||||
return in_array( $widget_id, $this->rendered_widgets );
|
return in_array( $widget_id, $this->rendered_widgets, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1232,7 +1232,7 @@ final class WP_Customize_Widgets {
|
||||||
* @return bool Whether the sidebar is rendered.
|
* @return bool Whether the sidebar is rendered.
|
||||||
*/
|
*/
|
||||||
public function is_sidebar_rendered( $sidebar_id ) {
|
public function is_sidebar_rendered( $sidebar_id ) {
|
||||||
return in_array( $sidebar_id, $this->rendered_sidebars );
|
return in_array( $sidebar_id, $this->rendered_sidebars, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -259,7 +259,9 @@ class WP_Date_Query {
|
||||||
* @return string The comparison operator.
|
* @return string The comparison operator.
|
||||||
*/
|
*/
|
||||||
public function get_compare( $query ) {
|
public function get_compare( $query ) {
|
||||||
if ( ! empty( $query['compare'] ) && in_array( $query['compare'], array( '=', '!=', '>', '>=', '<', '<=', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ) ) ) {
|
if ( ! empty( $query['compare'] )
|
||||||
|
&& in_array( $query['compare'], array( '=', '!=', '>', '>=', '<', '<=', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ), true )
|
||||||
|
) {
|
||||||
return strtoupper( $query['compare'] );
|
return strtoupper( $query['compare'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,7 +502,7 @@ class WP_Date_Query {
|
||||||
* 'post_modified_gmt', 'comment_date', 'comment_date_gmt',
|
* 'post_modified_gmt', 'comment_date', 'comment_date_gmt',
|
||||||
* 'user_registered'
|
* 'user_registered'
|
||||||
*/
|
*/
|
||||||
if ( ! in_array( $column, apply_filters( 'date_query_valid_columns', $valid_columns ) ) ) {
|
if ( ! in_array( $column, apply_filters( 'date_query_valid_columns', $valid_columns ), true ) ) {
|
||||||
$column = 'post_date';
|
$column = 'post_date';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -526,7 +528,7 @@ class WP_Date_Query {
|
||||||
|
|
||||||
// If it's a known column name, add the appropriate table prefix.
|
// If it's a known column name, add the appropriate table prefix.
|
||||||
foreach ( $known_columns as $table_name => $table_columns ) {
|
foreach ( $known_columns as $table_name => $table_columns ) {
|
||||||
if ( in_array( $column, $table_columns ) ) {
|
if ( in_array( $column, $table_columns, true ) ) {
|
||||||
$column = $table_name . '.' . $column;
|
$column = $table_name . '.' . $column;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -972,7 +974,7 @@ class WP_Date_Query {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Complex combined queries aren't supported for multi-value queries.
|
// Complex combined queries aren't supported for multi-value queries.
|
||||||
if ( in_array( $compare, array( 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ) ) ) {
|
if ( in_array( $compare, array( 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ), true ) ) {
|
||||||
$return = array();
|
$return = array();
|
||||||
|
|
||||||
$value = $this->build_value( $compare, $hour );
|
$value = $this->build_value( $compare, $hour );
|
||||||
|
|
|
@ -459,7 +459,7 @@ final class _WP_Editors {
|
||||||
*/
|
*/
|
||||||
$plugins = array_unique( apply_filters( 'tiny_mce_plugins', $plugins, $editor_id ) );
|
$plugins = array_unique( apply_filters( 'tiny_mce_plugins', $plugins, $editor_id ) );
|
||||||
|
|
||||||
$key = array_search( 'spellchecker', $plugins );
|
$key = array_search( 'spellchecker', $plugins, true );
|
||||||
if ( false !== $key ) {
|
if ( false !== $key ) {
|
||||||
// Remove 'spellchecker' from the internal plugins if added with 'tiny_mce_plugins' filter to prevent errors.
|
// Remove 'spellchecker' from the internal plugins if added with 'tiny_mce_plugins' filter to prevent errors.
|
||||||
// It can be added with 'mce_external_plugins'.
|
// It can be added with 'mce_external_plugins'.
|
||||||
|
|
|
@ -370,6 +370,7 @@ class WP_Embed {
|
||||||
$post = get_post( $post_ID );
|
$post = get_post( $post_ID );
|
||||||
|
|
||||||
$post_types = get_post_types( array( 'show_ui' => true ) );
|
$post_types = get_post_types( array( 'show_ui' => true ) );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the array of post types to cache oEmbed results for.
|
* Filters the array of post types to cache oEmbed results for.
|
||||||
*
|
*
|
||||||
|
@ -377,7 +378,9 @@ class WP_Embed {
|
||||||
*
|
*
|
||||||
* @param string[] $post_types Array of post type names to cache oEmbed results for. Defaults to post types with `show_ui` set to true.
|
* @param string[] $post_types Array of post type names to cache oEmbed results for. Defaults to post types with `show_ui` set to true.
|
||||||
*/
|
*/
|
||||||
if ( empty( $post->ID ) || ! in_array( $post->post_type, apply_filters( 'embed_cache_oembed_types', $post_types ) ) ) {
|
$cache_oembed_types = apply_filters( 'embed_cache_oembed_types', $post_types );
|
||||||
|
|
||||||
|
if ( empty( $post->ID ) || ! in_array( $post->post_type, $cache_oembed_types, true ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -400,7 +400,7 @@ class WP_Http_Streams {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exact hostname/IP matches.
|
// Exact hostname/IP matches.
|
||||||
if ( in_array( strtolower( $host ), $certificate_hostnames ) ) {
|
if ( in_array( strtolower( $host ), $certificate_hostnames, true ) ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ class WP_Http_Streams {
|
||||||
// Wildcard subdomains certs (*.example.com) are valid for a.example.com but not a.b.example.com.
|
// Wildcard subdomains certs (*.example.com) are valid for a.example.com but not a.b.example.com.
|
||||||
$wildcard_host = preg_replace( '/^[^.]+\./', '*.', $host );
|
$wildcard_host = preg_replace( '/^[^.]+\./', '*.', $host );
|
||||||
|
|
||||||
return in_array( strtolower( $wildcard_host ), $certificate_hostnames );
|
return in_array( strtolower( $wildcard_host ), $certificate_hostnames, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -545,7 +545,7 @@ abstract class WP_Image_Editor {
|
||||||
* @return string|false
|
* @return string|false
|
||||||
*/
|
*/
|
||||||
protected static function get_extension( $mime_type = null ) {
|
protected static function get_extension( $mime_type = null ) {
|
||||||
$extensions = explode( '|', array_search( $mime_type, wp_get_mime_types() ) );
|
$extensions = explode( '|', array_search( $mime_type, wp_get_mime_types(), true ) );
|
||||||
|
|
||||||
if ( empty( $extensions[0] ) ) {
|
if ( empty( $extensions[0] ) ) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -687,7 +687,7 @@ class WP_Meta_Query {
|
||||||
if ( array_key_exists( 'value', $clause ) ) {
|
if ( array_key_exists( 'value', $clause ) ) {
|
||||||
$meta_value = $clause['value'];
|
$meta_value = $clause['value'];
|
||||||
|
|
||||||
if ( in_array( $meta_compare, array( 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ) ) ) {
|
if ( in_array( $meta_compare, array( 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ), true ) ) {
|
||||||
if ( ! is_array( $meta_value ) ) {
|
if ( ! is_array( $meta_value ) ) {
|
||||||
$meta_value = preg_split( '/[,\s]+/', $meta_value );
|
$meta_value = preg_split( '/[,\s]+/', $meta_value );
|
||||||
}
|
}
|
||||||
|
@ -811,7 +811,7 @@ class WP_Meta_Query {
|
||||||
|
|
||||||
$clause_compare = strtoupper( $clause['compare'] );
|
$clause_compare = strtoupper( $clause['compare'] );
|
||||||
$sibling_compare = strtoupper( $sibling['compare'] );
|
$sibling_compare = strtoupper( $sibling['compare'] );
|
||||||
if ( in_array( $clause_compare, $compatible_compares ) && in_array( $sibling_compare, $compatible_compares ) ) {
|
if ( in_array( $clause_compare, $compatible_compares, true ) && in_array( $sibling_compare, $compatible_compares, true ) ) {
|
||||||
$alias = $sibling['alias'];
|
$alias = $sibling['alias'];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -551,7 +551,7 @@ class WP_Network_Query {
|
||||||
} elseif ( 'domain_length' === $orderby || 'path_length' === $orderby ) {
|
} elseif ( 'domain_length' === $orderby || 'path_length' === $orderby ) {
|
||||||
$field = substr( $orderby, 0, -7 );
|
$field = substr( $orderby, 0, -7 );
|
||||||
$parsed = "CHAR_LENGTH($wpdb->site.$field)";
|
$parsed = "CHAR_LENGTH($wpdb->site.$field)";
|
||||||
} elseif ( in_array( $orderby, $allowed_keys ) ) {
|
} elseif ( in_array( $orderby, $allowed_keys, true ) ) {
|
||||||
$parsed = "$wpdb->site.$orderby";
|
$parsed = "$wpdb->site.$orderby";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -235,7 +235,7 @@ class WP_oEmbed {
|
||||||
* @return mixed|bool Return value of the callback, false otherwise.
|
* @return mixed|bool Return value of the callback, false otherwise.
|
||||||
*/
|
*/
|
||||||
public function __call( $name, $arguments ) {
|
public function __call( $name, $arguments ) {
|
||||||
if ( in_array( $name, $this->compat_methods ) ) {
|
if ( in_array( $name, $this->compat_methods, true ) ) {
|
||||||
return $this->$name( ...$arguments );
|
return $this->$name( ...$arguments );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -454,7 +454,9 @@ final class WP_Post_Type {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Back compat with quirky handling in version 3.0. #14122.
|
// Back compat with quirky handling in version 3.0. #14122.
|
||||||
if ( empty( $args['capabilities'] ) && null === $args['map_meta_cap'] && in_array( $args['capability_type'], array( 'post', 'page' ) ) ) {
|
if ( empty( $args['capabilities'] )
|
||||||
|
&& null === $args['map_meta_cap'] && in_array( $args['capability_type'], array( 'post', 'page' ), true )
|
||||||
|
) {
|
||||||
$args['map_meta_cap'] = true;
|
$args['map_meta_cap'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2156,7 +2156,7 @@ class WP_Query {
|
||||||
}
|
}
|
||||||
|
|
||||||
$post_status_join = true;
|
$post_status_join = true;
|
||||||
} elseif ( in_array( 'attachment', (array) $post_type ) ) {
|
} elseif ( in_array( 'attachment', (array) $post_type, true ) ) {
|
||||||
$post_status_join = true;
|
$post_status_join = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2177,7 +2177,7 @@ class WP_Query {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! in_array( $queried_taxonomy, array( 'category', 'post_tag' ) ) ) {
|
if ( ! in_array( $queried_taxonomy, array( 'category', 'post_tag' ), true ) ) {
|
||||||
$q['taxonomy'] = $queried_taxonomy;
|
$q['taxonomy'] = $queried_taxonomy;
|
||||||
|
|
||||||
if ( 'slug' === $queried_items['field'] ) {
|
if ( 'slug' === $queried_items['field'] ) {
|
||||||
|
@ -2463,15 +2463,15 @@ class WP_Query {
|
||||||
$r_status = array();
|
$r_status = array();
|
||||||
$p_status = array();
|
$p_status = array();
|
||||||
$e_status = array();
|
$e_status = array();
|
||||||
if ( in_array( 'any', $q_status ) ) {
|
if ( in_array( 'any', $q_status, true ) ) {
|
||||||
foreach ( get_post_stati( array( 'exclude_from_search' => true ) ) as $status ) {
|
foreach ( get_post_stati( array( 'exclude_from_search' => true ) ) as $status ) {
|
||||||
if ( ! in_array( $status, $q_status ) ) {
|
if ( ! in_array( $status, $q_status, true ) ) {
|
||||||
$e_status[] = "{$wpdb->posts}.post_status <> '$status'";
|
$e_status[] = "{$wpdb->posts}.post_status <> '$status'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ( get_post_stati() as $status ) {
|
foreach ( get_post_stati() as $status ) {
|
||||||
if ( in_array( $status, $q_status ) ) {
|
if ( in_array( $status, $q_status, true ) ) {
|
||||||
if ( 'private' == $status ) {
|
if ( 'private' == $status ) {
|
||||||
$p_status[] = "{$wpdb->posts}.post_status = '$status'";
|
$p_status[] = "{$wpdb->posts}.post_status = '$status'";
|
||||||
} else {
|
} else {
|
||||||
|
@ -3083,7 +3083,7 @@ class WP_Query {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the post_status was specifically requested, let it pass through.
|
// If the post_status was specifically requested, let it pass through.
|
||||||
if ( ! in_array( $status, $q_status ) ) {
|
if ( ! in_array( $status, $q_status, true ) ) {
|
||||||
$post_status_obj = get_post_status_object( $status );
|
$post_status_obj = get_post_status_object( $status );
|
||||||
|
|
||||||
if ( $post_status_obj && ! $post_status_obj->public ) {
|
if ( $post_status_obj && ! $post_status_obj->public ) {
|
||||||
|
@ -3564,7 +3564,7 @@ class WP_Query {
|
||||||
* @return mixed Property.
|
* @return mixed Property.
|
||||||
*/
|
*/
|
||||||
public function __get( $name ) {
|
public function __get( $name ) {
|
||||||
if ( in_array( $name, $this->compat_fields ) ) {
|
if ( in_array( $name, $this->compat_fields, true ) ) {
|
||||||
return $this->$name;
|
return $this->$name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3578,7 +3578,7 @@ class WP_Query {
|
||||||
* @return bool Whether the property is set.
|
* @return bool Whether the property is set.
|
||||||
*/
|
*/
|
||||||
public function __isset( $name ) {
|
public function __isset( $name ) {
|
||||||
if ( in_array( $name, $this->compat_fields ) ) {
|
if ( in_array( $name, $this->compat_fields, true ) ) {
|
||||||
return isset( $this->$name );
|
return isset( $this->$name );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3593,7 +3593,7 @@ class WP_Query {
|
||||||
* @return mixed|false Return value of the callback, false otherwise.
|
* @return mixed|false Return value of the callback, false otherwise.
|
||||||
*/
|
*/
|
||||||
public function __call( $name, $arguments ) {
|
public function __call( $name, $arguments ) {
|
||||||
if ( in_array( $name, $this->compat_methods ) ) {
|
if ( in_array( $name, $this->compat_methods, true ) ) {
|
||||||
return $this->$name( ...$arguments );
|
return $this->$name( ...$arguments );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -3632,7 +3632,7 @@ class WP_Query {
|
||||||
}
|
}
|
||||||
$post_type_object = get_post_type_object( $post_type );
|
$post_type_object = get_post_type_object( $post_type );
|
||||||
|
|
||||||
return in_array( $post_type_object->name, (array) $post_types );
|
return in_array( $post_type_object->name, (array) $post_types, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3657,11 +3657,11 @@ class WP_Query {
|
||||||
|
|
||||||
$post_obj = $this->get_queried_object();
|
$post_obj = $this->get_queried_object();
|
||||||
|
|
||||||
if ( in_array( (string) $post_obj->ID, $attachment ) ) {
|
if ( in_array( (string) $post_obj->ID, $attachment, true ) ) {
|
||||||
return true;
|
return true;
|
||||||
} elseif ( in_array( $post_obj->post_title, $attachment ) ) {
|
} elseif ( in_array( $post_obj->post_title, $attachment, true ) ) {
|
||||||
return true;
|
return true;
|
||||||
} elseif ( in_array( $post_obj->post_name, $attachment ) ) {
|
} elseif ( in_array( $post_obj->post_name, $attachment, true ) ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -3692,11 +3692,11 @@ class WP_Query {
|
||||||
|
|
||||||
$author = array_map( 'strval', (array) $author );
|
$author = array_map( 'strval', (array) $author );
|
||||||
|
|
||||||
if ( in_array( (string) $author_obj->ID, $author ) ) {
|
if ( in_array( (string) $author_obj->ID, $author, true ) ) {
|
||||||
return true;
|
return true;
|
||||||
} elseif ( in_array( $author_obj->nickname, $author ) ) {
|
} elseif ( in_array( $author_obj->nickname, $author, true ) ) {
|
||||||
return true;
|
return true;
|
||||||
} elseif ( in_array( $author_obj->user_nicename, $author ) ) {
|
} elseif ( in_array( $author_obj->user_nicename, $author, true ) ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3728,11 +3728,11 @@ class WP_Query {
|
||||||
|
|
||||||
$category = array_map( 'strval', (array) $category );
|
$category = array_map( 'strval', (array) $category );
|
||||||
|
|
||||||
if ( in_array( (string) $cat_obj->term_id, $category ) ) {
|
if ( in_array( (string) $cat_obj->term_id, $category, true ) ) {
|
||||||
return true;
|
return true;
|
||||||
} elseif ( in_array( $cat_obj->name, $category ) ) {
|
} elseif ( in_array( $cat_obj->name, $category, true ) ) {
|
||||||
return true;
|
return true;
|
||||||
} elseif ( in_array( $cat_obj->slug, $category ) ) {
|
} elseif ( in_array( $cat_obj->slug, $category, true ) ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3764,11 +3764,11 @@ class WP_Query {
|
||||||
|
|
||||||
$tag = array_map( 'strval', (array) $tag );
|
$tag = array_map( 'strval', (array) $tag );
|
||||||
|
|
||||||
if ( in_array( (string) $tag_obj->term_id, $tag ) ) {
|
if ( in_array( (string) $tag_obj->term_id, $tag, true ) ) {
|
||||||
return true;
|
return true;
|
||||||
} elseif ( in_array( $tag_obj->name, $tag ) ) {
|
} elseif ( in_array( $tag_obj->name, $tag, true ) ) {
|
||||||
return true;
|
return true;
|
||||||
} elseif ( in_array( $tag_obj->slug, $tag ) ) {
|
} elseif ( in_array( $tag_obj->slug, $tag, true ) ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3812,7 +3812,7 @@ class WP_Query {
|
||||||
$term_array = (array) $term;
|
$term_array = (array) $term;
|
||||||
|
|
||||||
// Check that the taxonomy matches.
|
// Check that the taxonomy matches.
|
||||||
if ( ! ( isset( $queried_object->taxonomy ) && count( $tax_array ) && in_array( $queried_object->taxonomy, $tax_array ) ) ) {
|
if ( ! ( isset( $queried_object->taxonomy ) && count( $tax_array ) && in_array( $queried_object->taxonomy, $tax_array, true ) ) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3883,7 +3883,7 @@ class WP_Query {
|
||||||
if ( 'feed' == $qv ) {
|
if ( 'feed' == $qv ) {
|
||||||
$qv = get_default_feed();
|
$qv = get_default_feed();
|
||||||
}
|
}
|
||||||
return in_array( $qv, (array) $feeds );
|
return in_array( $qv, (array) $feeds, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4004,11 +4004,11 @@ class WP_Query {
|
||||||
|
|
||||||
$page = array_map( 'strval', (array) $page );
|
$page = array_map( 'strval', (array) $page );
|
||||||
|
|
||||||
if ( in_array( (string) $page_obj->ID, $page ) ) {
|
if ( in_array( (string) $page_obj->ID, $page, true ) ) {
|
||||||
return true;
|
return true;
|
||||||
} elseif ( in_array( $page_obj->post_title, $page ) ) {
|
} elseif ( in_array( $page_obj->post_title, $page, true ) ) {
|
||||||
return true;
|
return true;
|
||||||
} elseif ( in_array( $page_obj->post_name, $page ) ) {
|
} elseif ( in_array( $page_obj->post_name, $page, true ) ) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
foreach ( $page as $pagepath ) {
|
foreach ( $page as $pagepath ) {
|
||||||
|
@ -4111,11 +4111,11 @@ class WP_Query {
|
||||||
|
|
||||||
$post = array_map( 'strval', (array) $post );
|
$post = array_map( 'strval', (array) $post );
|
||||||
|
|
||||||
if ( in_array( (string) $post_obj->ID, $post ) ) {
|
if ( in_array( (string) $post_obj->ID, $post, true ) ) {
|
||||||
return true;
|
return true;
|
||||||
} elseif ( in_array( $post_obj->post_title, $post ) ) {
|
} elseif ( in_array( $post_obj->post_title, $post, true ) ) {
|
||||||
return true;
|
return true;
|
||||||
} elseif ( in_array( $post_obj->post_name, $post ) ) {
|
} elseif ( in_array( $post_obj->post_name, $post, true ) ) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
foreach ( $post as $postpath ) {
|
foreach ( $post as $postpath ) {
|
||||||
|
@ -4156,7 +4156,7 @@ class WP_Query {
|
||||||
|
|
||||||
$post_obj = $this->get_queried_object();
|
$post_obj = $this->get_queried_object();
|
||||||
|
|
||||||
return in_array( $post_obj->post_type, (array) $post_types );
|
return in_array( $post_obj->post_type, (array) $post_types, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -797,7 +797,7 @@ class WP_Rewrite {
|
||||||
* @param string $query String to append to the rewritten query. Must end in '='.
|
* @param string $query String to append to the rewritten query. Must end in '='.
|
||||||
*/
|
*/
|
||||||
public function add_rewrite_tag( $tag, $regex, $query ) {
|
public function add_rewrite_tag( $tag, $regex, $query ) {
|
||||||
$position = array_search( $tag, $this->rewritecode );
|
$position = array_search( $tag, $this->rewritecode, true );
|
||||||
if ( false !== $position && null !== $position ) {
|
if ( false !== $position && null !== $position ) {
|
||||||
$this->rewritereplace[ $position ] = $regex;
|
$this->rewritereplace[ $position ] = $regex;
|
||||||
$this->queryreplace[ $position ] = $query;
|
$this->queryreplace[ $position ] = $query;
|
||||||
|
@ -821,7 +821,7 @@ class WP_Rewrite {
|
||||||
* @param string $tag Name of the rewrite tag to remove.
|
* @param string $tag Name of the rewrite tag to remove.
|
||||||
*/
|
*/
|
||||||
public function remove_rewrite_tag( $tag ) {
|
public function remove_rewrite_tag( $tag ) {
|
||||||
$position = array_search( $tag, $this->rewritecode );
|
$position = array_search( $tag, $this->rewritecode, true );
|
||||||
if ( false !== $position && null !== $position ) {
|
if ( false !== $position && null !== $position ) {
|
||||||
unset( $this->rewritecode[ $position ] );
|
unset( $this->rewritecode[ $position ] );
|
||||||
unset( $this->rewritereplace[ $position ] );
|
unset( $this->rewritereplace[ $position ] );
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue