Coding Standards: Use strict comparison where static strings are involved.
This reduces the number of `WordPress.PHP.StrictComparisons.LooseComparison` issues in half, from 1897 to 890. Includes minor code layout fixes for better readability. See #49542. Built from https://develop.svn.wordpress.org/trunk@47808 git-svn-id: http://core.svn.wordpress.org/trunk@47584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
45f7e68d54
commit
7932193708
|
@ -147,7 +147,7 @@ do_action( "admin_head-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConven
|
||||||
*/
|
*/
|
||||||
do_action( 'admin_head' );
|
do_action( 'admin_head' );
|
||||||
|
|
||||||
if ( get_user_setting( 'mfold' ) === 'f' ) {
|
if ( 'f' === get_user_setting( 'mfold' ) ) {
|
||||||
$admin_body_class .= ' folded';
|
$admin_body_class .= ' folded';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ if ( post_type_supports( $post_type, 'editor' ) && ! wp_is_mobile() &&
|
||||||
|
|
||||||
wp_enqueue_script( 'editor-expand' );
|
wp_enqueue_script( 'editor-expand' );
|
||||||
$_content_editor_dfw = true;
|
$_content_editor_dfw = true;
|
||||||
$_wp_editor_expand = ( get_user_setting( 'editor_expand', 'on' ) === 'on' );
|
$_wp_editor_expand = ( 'on' === get_user_setting( 'editor_expand', 'on' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( wp_is_mobile() ) {
|
if ( wp_is_mobile() ) {
|
||||||
|
|
|
@ -176,7 +176,7 @@ function wp_ajax_wp_compression_test() {
|
||||||
wp_die( -1 );
|
wp_die( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ini_get( 'zlib.output_compression' ) || 'ob_gzhandler' == ini_get( 'output_handler' ) ) {
|
if ( ini_get( 'zlib.output_compression' ) || 'ob_gzhandler' === ini_get( 'output_handler' ) ) {
|
||||||
update_site_option( 'can_compress_scripts', 0 );
|
update_site_option( 'can_compress_scripts', 0 );
|
||||||
wp_die( 0 );
|
wp_die( 0 );
|
||||||
}
|
}
|
||||||
|
@ -209,10 +209,10 @@ function wp_ajax_wp_compression_test() {
|
||||||
|
|
||||||
echo $out;
|
echo $out;
|
||||||
wp_die();
|
wp_die();
|
||||||
} elseif ( 'no' == $_GET['test'] ) {
|
} elseif ( 'no' === $_GET['test'] ) {
|
||||||
check_ajax_referer( 'update_can_compress_scripts' );
|
check_ajax_referer( 'update_can_compress_scripts' );
|
||||||
update_site_option( 'can_compress_scripts', 0 );
|
update_site_option( 'can_compress_scripts', 0 );
|
||||||
} elseif ( 'yes' == $_GET['test'] ) {
|
} elseif ( 'yes' === $_GET['test'] ) {
|
||||||
check_ajax_referer( 'update_can_compress_scripts' );
|
check_ajax_referer( 'update_can_compress_scripts' );
|
||||||
update_site_option( 'can_compress_scripts', 1 );
|
update_site_option( 'can_compress_scripts', 1 );
|
||||||
}
|
}
|
||||||
|
@ -704,13 +704,13 @@ function wp_ajax_delete_comment() {
|
||||||
$delta = -1;
|
$delta = -1;
|
||||||
|
|
||||||
if ( isset( $_POST['trash'] ) && 1 == $_POST['trash'] ) {
|
if ( isset( $_POST['trash'] ) && 1 == $_POST['trash'] ) {
|
||||||
if ( 'trash' == $status ) {
|
if ( 'trash' === $status ) {
|
||||||
wp_die( time() );
|
wp_die( time() );
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = wp_trash_comment( $comment );
|
$r = wp_trash_comment( $comment );
|
||||||
} elseif ( isset( $_POST['untrash'] ) && 1 == $_POST['untrash'] ) {
|
} elseif ( isset( $_POST['untrash'] ) && 1 == $_POST['untrash'] ) {
|
||||||
if ( 'trash' != $status ) {
|
if ( 'trash' !== $status ) {
|
||||||
wp_die( time() );
|
wp_die( time() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -721,13 +721,13 @@ function wp_ajax_delete_comment() {
|
||||||
$delta = 1;
|
$delta = 1;
|
||||||
}
|
}
|
||||||
} elseif ( isset( $_POST['spam'] ) && 1 == $_POST['spam'] ) {
|
} elseif ( isset( $_POST['spam'] ) && 1 == $_POST['spam'] ) {
|
||||||
if ( 'spam' == $status ) {
|
if ( 'spam' === $status ) {
|
||||||
wp_die( time() );
|
wp_die( time() );
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = wp_spam_comment( $comment );
|
$r = wp_spam_comment( $comment );
|
||||||
} elseif ( isset( $_POST['unspam'] ) && 1 == $_POST['unspam'] ) {
|
} elseif ( isset( $_POST['unspam'] ) && 1 == $_POST['unspam'] ) {
|
||||||
if ( 'spam' != $status ) {
|
if ( 'spam' !== $status ) {
|
||||||
wp_die( time() );
|
wp_die( time() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -883,7 +883,7 @@ function wp_ajax_trash_post( $action ) {
|
||||||
wp_die( 1 );
|
wp_die( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'trash-post' == $action ) {
|
if ( 'trash-post' === $action ) {
|
||||||
$done = wp_trash_post( $id );
|
$done = wp_trash_post( $id );
|
||||||
} else {
|
} else {
|
||||||
$done = wp_untrash_post( $id );
|
$done = wp_untrash_post( $id );
|
||||||
|
@ -1301,7 +1301,7 @@ function wp_ajax_replyto_comment( $action ) {
|
||||||
wp_die( __( 'Sorry, you must be logged in to reply to a comment.' ) );
|
wp_die( __( 'Sorry, you must be logged in to reply to a comment.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( '' == $comment_content ) {
|
if ( '' === $comment_content ) {
|
||||||
wp_die( __( 'Error: Please type a comment.' ) );
|
wp_die( __( 'Error: Please type a comment.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1344,11 +1344,11 @@ function wp_ajax_replyto_comment( $action ) {
|
||||||
$position = ( isset( $_POST['position'] ) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1';
|
$position = ( isset( $_POST['position'] ) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1';
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
if ( isset( $_REQUEST['mode'] ) && 'dashboard' == $_REQUEST['mode'] ) {
|
if ( isset( $_REQUEST['mode'] ) && 'dashboard' === $_REQUEST['mode'] ) {
|
||||||
require_once ABSPATH . 'wp-admin/includes/dashboard.php';
|
require_once ABSPATH . 'wp-admin/includes/dashboard.php';
|
||||||
_wp_dashboard_recent_comments_row( $comment );
|
_wp_dashboard_recent_comments_row( $comment );
|
||||||
} else {
|
} else {
|
||||||
if ( isset( $_REQUEST['mode'] ) && 'single' == $_REQUEST['mode'] ) {
|
if ( isset( $_REQUEST['mode'] ) && 'single' === $_REQUEST['mode'] ) {
|
||||||
$wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
|
$wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
|
||||||
} else {
|
} else {
|
||||||
$wp_list_table = _get_list_table( 'WP_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
|
$wp_list_table = _get_list_table( 'WP_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
|
||||||
|
@ -1403,7 +1403,7 @@ function wp_ajax_edit_comment() {
|
||||||
wp_die( -1 );
|
wp_die( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( '' == $_POST['content'] ) {
|
if ( '' === $_POST['content'] ) {
|
||||||
wp_die( __( 'Error: Please type a comment.' ) );
|
wp_die( __( 'Error: Please type a comment.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1461,7 +1461,7 @@ function wp_ajax_add_menu_item() {
|
||||||
foreach ( (array) $_POST['menu-item'] as $menu_item_data ) {
|
foreach ( (array) $_POST['menu-item'] as $menu_item_data ) {
|
||||||
if (
|
if (
|
||||||
! empty( $menu_item_data['menu-item-type'] ) &&
|
! empty( $menu_item_data['menu-item-type'] ) &&
|
||||||
'custom' != $menu_item_data['menu-item-type'] &&
|
'custom' !== $menu_item_data['menu-item-type'] &&
|
||||||
! empty( $menu_item_data['menu-item-object-id'] )
|
! empty( $menu_item_data['menu-item-object-id'] )
|
||||||
) {
|
) {
|
||||||
switch ( $menu_item_data['menu-item-type'] ) {
|
switch ( $menu_item_data['menu-item-type'] ) {
|
||||||
|
@ -1544,7 +1544,7 @@ function wp_ajax_add_meta() {
|
||||||
wp_die( -1 );
|
wp_die( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $_POST['metakeyselect'] ) && '#NONE#' == $_POST['metakeyselect'] && empty( $_POST['metakeyinput'] ) ) {
|
if ( isset( $_POST['metakeyselect'] ) && '#NONE#' === $_POST['metakeyselect'] && empty( $_POST['metakeyinput'] ) ) {
|
||||||
wp_die( 1 );
|
wp_die( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1604,7 +1604,7 @@ function wp_ajax_add_meta() {
|
||||||
$key = wp_unslash( $_POST['meta'][ $mid ]['key'] );
|
$key = wp_unslash( $_POST['meta'][ $mid ]['key'] );
|
||||||
$value = wp_unslash( $_POST['meta'][ $mid ]['value'] );
|
$value = wp_unslash( $_POST['meta'][ $mid ]['value'] );
|
||||||
|
|
||||||
if ( '' == trim( $key ) ) {
|
if ( '' === trim( $key ) ) {
|
||||||
wp_die( __( 'Please provide a custom field name.' ) );
|
wp_die( __( 'Please provide a custom field name.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1795,11 +1795,11 @@ function wp_ajax_menu_get_metabox() {
|
||||||
|
|
||||||
require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
|
require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
|
||||||
|
|
||||||
if ( isset( $_POST['item-type'] ) && 'post_type' == $_POST['item-type'] ) {
|
if ( isset( $_POST['item-type'] ) && 'post_type' === $_POST['item-type'] ) {
|
||||||
$type = 'posttype';
|
$type = 'posttype';
|
||||||
$callback = 'wp_nav_menu_item_post_type_meta_box';
|
$callback = 'wp_nav_menu_item_post_type_meta_box';
|
||||||
$items = (array) get_post_types( array( 'show_in_nav_menus' => true ), 'object' );
|
$items = (array) get_post_types( array( 'show_in_nav_menus' => true ), 'object' );
|
||||||
} elseif ( isset( $_POST['item-type'] ) && 'taxonomy' == $_POST['item-type'] ) {
|
} elseif ( isset( $_POST['item-type'] ) && 'taxonomy' === $_POST['item-type'] ) {
|
||||||
$type = 'taxonomy';
|
$type = 'taxonomy';
|
||||||
$callback = 'wp_nav_menu_item_taxonomy_meta_box';
|
$callback = 'wp_nav_menu_item_taxonomy_meta_box';
|
||||||
$items = (array) get_taxonomies( array( 'show_ui' => true ), 'object' );
|
$items = (array) get_taxonomies( array( 'show_ui' => true ), 'object' );
|
||||||
|
@ -1985,7 +1985,7 @@ function wp_ajax_inline_save() {
|
||||||
|
|
||||||
$post_ID = (int) $_POST['post_ID'];
|
$post_ID = (int) $_POST['post_ID'];
|
||||||
|
|
||||||
if ( 'page' == $_POST['post_type'] ) {
|
if ( 'page' === $_POST['post_type'] ) {
|
||||||
if ( ! current_user_can( 'edit_page', $post_ID ) ) {
|
if ( ! current_user_can( 'edit_page', $post_ID ) ) {
|
||||||
wp_die( __( 'Sorry, you are not allowed to edit this page.' ) );
|
wp_die( __( 'Sorry, you are not allowed to edit this page.' ) );
|
||||||
}
|
}
|
||||||
|
@ -2030,7 +2030,7 @@ function wp_ajax_inline_save() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Status.
|
// Status.
|
||||||
if ( isset( $data['keep_private'] ) && 'private' == $data['keep_private'] ) {
|
if ( isset( $data['keep_private'] ) && 'private' === $data['keep_private'] ) {
|
||||||
$data['visibility'] = 'private';
|
$data['visibility'] = 'private';
|
||||||
$data['post_status'] = 'private';
|
$data['post_status'] = 'private';
|
||||||
} else {
|
} else {
|
||||||
|
@ -2180,7 +2180,7 @@ function wp_ajax_find_posts() {
|
||||||
$alt = '';
|
$alt = '';
|
||||||
foreach ( $posts as $post ) {
|
foreach ( $posts as $post ) {
|
||||||
$title = trim( $post->post_title ) ? $post->post_title : __( '(no title)' );
|
$title = trim( $post->post_title ) ? $post->post_title : __( '(no title)' );
|
||||||
$alt = ( 'alternate' == $alt ) ? '' : 'alternate';
|
$alt = ( 'alternate' === $alt ) ? '' : 'alternate';
|
||||||
|
|
||||||
switch ( $post->post_status ) {
|
switch ( $post->post_status ) {
|
||||||
case 'publish':
|
case 'publish':
|
||||||
|
@ -2198,7 +2198,7 @@ function wp_ajax_find_posts() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( '0000-00-00 00:00:00' == $post->post_date ) {
|
if ( '0000-00-00 00:00:00' === $post->post_date ) {
|
||||||
$time = '';
|
$time = '';
|
||||||
} else {
|
} else {
|
||||||
/* translators: Date format in table columns, see https://www.php.net/date */
|
/* translators: Date format in table columns, see https://www.php.net/date */
|
||||||
|
@ -2883,7 +2883,7 @@ function wp_ajax_get_attachment() {
|
||||||
wp_send_json_error();
|
wp_send_json_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'attachment' != $post->post_type ) {
|
if ( 'attachment' !== $post->post_type ) {
|
||||||
wp_send_json_error();
|
wp_send_json_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2996,7 +2996,7 @@ function wp_ajax_save_attachment() {
|
||||||
$changes = $_REQUEST['changes'];
|
$changes = $_REQUEST['changes'];
|
||||||
$post = get_post( $id, ARRAY_A );
|
$post = get_post( $id, ARRAY_A );
|
||||||
|
|
||||||
if ( 'attachment' != $post['post_type'] ) {
|
if ( 'attachment' !== $post['post_type'] ) {
|
||||||
wp_send_json_error();
|
wp_send_json_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3087,7 +3087,7 @@ function wp_ajax_save_attachment_compat() {
|
||||||
|
|
||||||
$post = get_post( $id, ARRAY_A );
|
$post = get_post( $id, ARRAY_A );
|
||||||
|
|
||||||
if ( 'attachment' != $post['post_type'] ) {
|
if ( 'attachment' !== $post['post_type'] ) {
|
||||||
wp_send_json_error();
|
wp_send_json_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3154,7 +3154,7 @@ function wp_ajax_save_attachment_order() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'attachment' != $attachment->post_type ) {
|
if ( 'attachment' !== $attachment->post_type ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3190,7 +3190,7 @@ function wp_ajax_send_attachment_to_editor() {
|
||||||
wp_send_json_error();
|
wp_send_json_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'attachment' != $post->post_type ) {
|
if ( 'attachment' !== $post->post_type ) {
|
||||||
wp_send_json_error();
|
wp_send_json_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3304,7 +3304,7 @@ function wp_ajax_send_link_to_editor() {
|
||||||
$ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src );
|
$ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src );
|
||||||
if ( $ext ) {
|
if ( $ext ) {
|
||||||
$ext_type = wp_ext2type( $ext );
|
$ext_type = wp_ext2type( $ext );
|
||||||
if ( 'audio' == $ext_type || 'video' == $ext_type ) {
|
if ( 'audio' === $ext_type || 'video' === $ext_type ) {
|
||||||
$type = $ext_type;
|
$type = $ext_type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ function edit_link( $link_id = 0 ) {
|
||||||
$_POST['link_name'] = esc_html( $_POST['link_name'] );
|
$_POST['link_name'] = esc_html( $_POST['link_name'] );
|
||||||
$_POST['link_image'] = esc_html( $_POST['link_image'] );
|
$_POST['link_image'] = esc_html( $_POST['link_image'] );
|
||||||
$_POST['link_rss'] = esc_url( $_POST['link_rss'] );
|
$_POST['link_rss'] = esc_url( $_POST['link_rss'] );
|
||||||
if ( ! isset( $_POST['link_visible'] ) || 'N' != $_POST['link_visible'] ) {
|
if ( ! isset( $_POST['link_visible'] ) || 'N' !== $_POST['link_visible'] ) {
|
||||||
$_POST['link_visible'] = 'Y';
|
$_POST['link_visible'] = 'Y';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,15 +174,15 @@ function wp_insert_link( $linkdata, $wp_error = false ) {
|
||||||
$update = true;
|
$update = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( trim( $link_name ) == '' ) {
|
if ( '' === trim( $link_name ) ) {
|
||||||
if ( trim( $link_url ) != '' ) {
|
if ( '' !== trim( $link_url ) ) {
|
||||||
$link_name = $link_url;
|
$link_name = $link_url;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( trim( $link_url ) == '' ) {
|
if ( '' === trim( $link_url ) ) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,7 +309,8 @@ function wp_update_link( $linkdata ) {
|
||||||
*/
|
*/
|
||||||
function wp_link_manager_disabled_message() {
|
function wp_link_manager_disabled_message() {
|
||||||
global $pagenow;
|
global $pagenow;
|
||||||
if ( 'link-manager.php' != $pagenow && 'link-add.php' != $pagenow && 'link.php' != $pagenow ) {
|
|
||||||
|
if ( ! in_array( $pagenow, array( 'link-manager.php', 'link-add.php', 'link.php' ), true ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ class Core_Upgrader extends WP_Upgrader {
|
||||||
*/
|
*/
|
||||||
if ( $parsed_args['do_rollback'] && $current->packages->rollback ) {
|
if ( $parsed_args['do_rollback'] && $current->packages->rollback ) {
|
||||||
$to_download = 'rollback';
|
$to_download = 'rollback';
|
||||||
} elseif ( $current->packages->partial && 'reinstall' != $current->response && $wp_version == $current->partial_version && $partial ) {
|
} elseif ( $current->packages->partial && 'reinstall' !== $current->response && $wp_version == $current->partial_version && $partial ) {
|
||||||
$to_download = 'partial';
|
$to_download = 'partial';
|
||||||
} elseif ( $current->packages->new_bundled && version_compare( $wp_version, $current->new_bundled, '<' )
|
} elseif ( $current->packages->new_bundled && version_compare( $wp_version, $current->new_bundled, '<' )
|
||||||
&& ( ! defined( 'CORE_UPGRADE_SKIP_NEW_BUNDLED' ) || ! CORE_UPGRADE_SKIP_NEW_BUNDLED ) ) {
|
&& ( ! defined( 'CORE_UPGRADE_SKIP_NEW_BUNDLED' ) || ! CORE_UPGRADE_SKIP_NEW_BUNDLED ) ) {
|
||||||
|
@ -402,7 +402,7 @@ class Core_Upgrader extends WP_Upgrader {
|
||||||
|
|
||||||
foreach ( $checksums as $file => $checksum ) {
|
foreach ( $checksums as $file => $checksum ) {
|
||||||
// Skip files which get updated.
|
// Skip files which get updated.
|
||||||
if ( 'wp-content' == substr( $file, 0, 10 ) ) {
|
if ( 'wp-content' === substr( $file, 0, 10 ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( ! file_exists( ABSPATH . $file ) || md5_file( ABSPATH . $file ) !== $checksum ) {
|
if ( ! file_exists( ABSPATH . $file ) || md5_file( ABSPATH . $file ) !== $checksum ) {
|
||||||
|
|
|
@ -281,7 +281,7 @@ class Custom_Image_Header {
|
||||||
* or 'uploaded' (for the Uploaded Images control).
|
* or 'uploaded' (for the Uploaded Images control).
|
||||||
*/
|
*/
|
||||||
public function show_header_selector( $type = 'default' ) {
|
public function show_header_selector( $type = 'default' ) {
|
||||||
if ( 'default' == $type ) {
|
if ( 'default' === $type ) {
|
||||||
$headers = $this->default_headers;
|
$headers = $this->default_headers;
|
||||||
} else {
|
} else {
|
||||||
$headers = get_uploaded_header_images();
|
$headers = get_uploaded_header_images();
|
||||||
|
@ -359,7 +359,7 @@ class Custom_Image_Header {
|
||||||
if ( ! checked )
|
if ( ! checked )
|
||||||
return;
|
return;
|
||||||
text_color = $('#text-color');
|
text_color = $('#text-color');
|
||||||
if ( '' == text_color.val().replace('#', '') ) {
|
if ( '' === text_color.val().replace('#', '') ) {
|
||||||
text_color.val( default_color );
|
text_color.val( default_color );
|
||||||
pickColor( default_color );
|
pickColor( default_color );
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -188,7 +188,7 @@ class Language_Pack_Upgrader extends WP_Upgrader {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'upgrader_process_complete' == current_filter() ) {
|
if ( 'upgrader_process_complete' === current_filter() ) {
|
||||||
$this->skin->feedback( 'starting_upgrade' );
|
$this->skin->feedback( 'starting_upgrade' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,9 +232,9 @@ class Language_Pack_Upgrader extends WP_Upgrader {
|
||||||
$this->skin->language_update = $language_update;
|
$this->skin->language_update = $language_update;
|
||||||
|
|
||||||
$destination = WP_LANG_DIR;
|
$destination = WP_LANG_DIR;
|
||||||
if ( 'plugin' == $language_update->type ) {
|
if ( 'plugin' === $language_update->type ) {
|
||||||
$destination .= '/plugins';
|
$destination .= '/plugins';
|
||||||
} elseif ( 'theme' == $language_update->type ) {
|
} elseif ( 'theme' === $language_update->type ) {
|
||||||
$destination .= '/themes';
|
$destination .= '/themes';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,9 +335,9 @@ class Language_Pack_Upgrader extends WP_Upgrader {
|
||||||
$po = false;
|
$po = false;
|
||||||
$mo = false;
|
$mo = false;
|
||||||
foreach ( (array) $files as $file => $filedata ) {
|
foreach ( (array) $files as $file => $filedata ) {
|
||||||
if ( '.po' == substr( $file, -3 ) ) {
|
if ( '.po' === substr( $file, -3 ) ) {
|
||||||
$po = true;
|
$po = true;
|
||||||
} elseif ( '.mo' == substr( $file, -3 ) ) {
|
} elseif ( '.mo' === substr( $file, -3 ) ) {
|
||||||
$mo = true;
|
$mo = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,13 +60,13 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
|
||||||
|
|
||||||
$from = isset( $_GET['from'] ) ? wp_unslash( $_GET['from'] ) : 'plugins';
|
$from = isset( $_GET['from'] ) ? wp_unslash( $_GET['from'] ) : 'plugins';
|
||||||
|
|
||||||
if ( 'import' == $from ) {
|
if ( 'import' === $from ) {
|
||||||
$install_actions['activate_plugin'] = sprintf(
|
$install_actions['activate_plugin'] = sprintf(
|
||||||
'<a class="button button-primary" href="%s" target="_parent">%s</a>',
|
'<a class="button button-primary" href="%s" target="_parent">%s</a>',
|
||||||
wp_nonce_url( 'plugins.php?action=activate&from=import&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ),
|
wp_nonce_url( 'plugins.php?action=activate&from=import&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ),
|
||||||
__( 'Activate Plugin & Run Importer' )
|
__( 'Activate Plugin & Run Importer' )
|
||||||
);
|
);
|
||||||
} elseif ( 'press-this' == $from ) {
|
} elseif ( 'press-this' === $from ) {
|
||||||
$install_actions['activate_plugin'] = sprintf(
|
$install_actions['activate_plugin'] = sprintf(
|
||||||
'<a class="button button-primary" href="%s" target="_parent">%s</a>',
|
'<a class="button button-primary" href="%s" target="_parent">%s</a>',
|
||||||
wp_nonce_url( 'plugins.php?action=activate&from=press-this&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ),
|
wp_nonce_url( 'plugins.php?action=activate&from=press-this&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ),
|
||||||
|
|
|
@ -75,7 +75,7 @@ class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu {
|
||||||
global $_nav_menu_placeholder, $nav_menu_selected_id;
|
global $_nav_menu_placeholder, $nav_menu_selected_id;
|
||||||
|
|
||||||
$_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval( $_nav_menu_placeholder ) - 1 : -1;
|
$_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval( $_nav_menu_placeholder ) - 1 : -1;
|
||||||
$possible_object_id = isset( $item->post_type ) && 'nav_menu_item' == $item->post_type ? $item->object_id : $_nav_menu_placeholder;
|
$possible_object_id = isset( $item->post_type ) && 'nav_menu_item' === $item->post_type ? $item->object_id : $_nav_menu_placeholder;
|
||||||
$possible_db_id = ( ! empty( $item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $item->ID : 0;
|
$possible_db_id = ( ! empty( $item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $item->ID : 0;
|
||||||
|
|
||||||
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
|
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
|
||||||
|
|
|
@ -72,17 +72,17 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
|
||||||
|
|
||||||
$original_title = false;
|
$original_title = false;
|
||||||
|
|
||||||
if ( 'taxonomy' == $item->type ) {
|
if ( 'taxonomy' === $item->type ) {
|
||||||
$original_object = get_term( (int) $item->object_id, $item->object );
|
$original_object = get_term( (int) $item->object_id, $item->object );
|
||||||
if ( $original_object && ! is_wp_error( $original_title ) ) {
|
if ( $original_object && ! is_wp_error( $original_title ) ) {
|
||||||
$original_title = $original_object->name;
|
$original_title = $original_object->name;
|
||||||
}
|
}
|
||||||
} elseif ( 'post_type' == $item->type ) {
|
} elseif ( 'post_type' === $item->type ) {
|
||||||
$original_object = get_post( $item->object_id );
|
$original_object = get_post( $item->object_id );
|
||||||
if ( $original_object ) {
|
if ( $original_object ) {
|
||||||
$original_title = get_the_title( $original_object->ID );
|
$original_title = get_the_title( $original_object->ID );
|
||||||
}
|
}
|
||||||
} elseif ( 'post_type_archive' == $item->type ) {
|
} elseif ( 'post_type_archive' === $item->type ) {
|
||||||
$original_object = get_post_type_object( $item->object );
|
$original_object = get_post_type_object( $item->object );
|
||||||
if ( $original_object ) {
|
if ( $original_object ) {
|
||||||
$original_title = $original_object->labels->archives;
|
$original_title = $original_object->labels->archives;
|
||||||
|
@ -101,13 +101,13 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
|
||||||
$classes[] = 'menu-item-invalid';
|
$classes[] = 'menu-item-invalid';
|
||||||
/* translators: %s: Title of an invalid menu item. */
|
/* translators: %s: Title of an invalid menu item. */
|
||||||
$title = sprintf( __( '%s (Invalid)' ), $item->title );
|
$title = sprintf( __( '%s (Invalid)' ), $item->title );
|
||||||
} elseif ( isset( $item->post_status ) && 'draft' == $item->post_status ) {
|
} elseif ( isset( $item->post_status ) && 'draft' === $item->post_status ) {
|
||||||
$classes[] = 'pending';
|
$classes[] = 'pending';
|
||||||
/* translators: %s: Title of a menu item in draft status. */
|
/* translators: %s: Title of a menu item in draft status. */
|
||||||
$title = sprintf( __( '%s (Pending)' ), $item->title );
|
$title = sprintf( __( '%s (Pending)' ), $item->title );
|
||||||
}
|
}
|
||||||
|
|
||||||
$title = ( ! isset( $item->label ) || '' == $item->label ) ? $title : $item->label;
|
$title = ( ! isset( $item->label ) || '' === $item->label ) ? $title : $item->label;
|
||||||
|
|
||||||
$submenu_text = '';
|
$submenu_text = '';
|
||||||
if ( 0 == $depth ) {
|
if ( 0 == $depth ) {
|
||||||
|
@ -181,7 +181,7 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="menu-item-settings wp-clearfix" id="menu-item-settings-<?php echo $item_id; ?>">
|
<div class="menu-item-settings wp-clearfix" id="menu-item-settings-<?php echo $item_id; ?>">
|
||||||
<?php if ( 'custom' == $item->type ) : ?>
|
<?php if ( 'custom' === $item->type ) : ?>
|
||||||
<p class="field-url description description-wide">
|
<p class="field-url description description-wide">
|
||||||
<label for="edit-menu-item-url-<?php echo $item_id; ?>">
|
<label for="edit-menu-item-url-<?php echo $item_id; ?>">
|
||||||
<?php _e( 'URL' ); ?><br />
|
<?php _e( 'URL' ); ?><br />
|
||||||
|
|
|
@ -143,20 +143,20 @@ class WP_Automatic_Updater {
|
||||||
|
|
||||||
// Only relax the filesystem checks when the update doesn't include new files.
|
// Only relax the filesystem checks when the update doesn't include new files.
|
||||||
$allow_relaxed_file_ownership = false;
|
$allow_relaxed_file_ownership = false;
|
||||||
if ( 'core' == $type && isset( $item->new_files ) && ! $item->new_files ) {
|
if ( 'core' === $type && isset( $item->new_files ) && ! $item->new_files ) {
|
||||||
$allow_relaxed_file_ownership = true;
|
$allow_relaxed_file_ownership = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we can't do an auto core update, we may still be able to email the user.
|
// If we can't do an auto core update, we may still be able to email the user.
|
||||||
if ( ! $skin->request_filesystem_credentials( false, $context, $allow_relaxed_file_ownership ) || $this->is_vcs_checkout( $context ) ) {
|
if ( ! $skin->request_filesystem_credentials( false, $context, $allow_relaxed_file_ownership ) || $this->is_vcs_checkout( $context ) ) {
|
||||||
if ( 'core' == $type ) {
|
if ( 'core' === $type ) {
|
||||||
$this->send_core_update_notification_email( $item );
|
$this->send_core_update_notification_email( $item );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next up, is this an item we can update?
|
// Next up, is this an item we can update?
|
||||||
if ( 'core' == $type ) {
|
if ( 'core' === $type ) {
|
||||||
$update = Core_Upgrader::should_update_to_version( $item->current );
|
$update = Core_Upgrader::should_update_to_version( $item->current );
|
||||||
} else {
|
} else {
|
||||||
$update = ! empty( $item->autoupdate );
|
$update = ! empty( $item->autoupdate );
|
||||||
|
@ -184,14 +184,14 @@ class WP_Automatic_Updater {
|
||||||
$update = apply_filters( "auto_update_{$type}", $update, $item );
|
$update = apply_filters( "auto_update_{$type}", $update, $item );
|
||||||
|
|
||||||
if ( ! $update ) {
|
if ( ! $update ) {
|
||||||
if ( 'core' == $type ) {
|
if ( 'core' === $type ) {
|
||||||
$this->send_core_update_notification_email( $item );
|
$this->send_core_update_notification_email( $item );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it's a core update, are we actually compatible with its requirements?
|
// If it's a core update, are we actually compatible with its requirements?
|
||||||
if ( 'core' == $type ) {
|
if ( 'core' === $type ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$php_compat = version_compare( phpversion(), $item->php_version, '>=' );
|
$php_compat = version_compare( phpversion(), $item->php_version, '>=' );
|
||||||
|
@ -344,7 +344,7 @@ class WP_Automatic_Updater {
|
||||||
}
|
}
|
||||||
|
|
||||||
$allow_relaxed_file_ownership = false;
|
$allow_relaxed_file_ownership = false;
|
||||||
if ( 'core' == $type && isset( $item->new_files ) && ! $item->new_files ) {
|
if ( 'core' === $type && isset( $item->new_files ) && ! $item->new_files ) {
|
||||||
$allow_relaxed_file_ownership = true;
|
$allow_relaxed_file_ownership = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,9 +367,13 @@ class WP_Automatic_Updater {
|
||||||
$upgrade_result = new WP_Error( 'fs_unavailable', __( 'Could not access filesystem.' ) );
|
$upgrade_result = new WP_Error( 'fs_unavailable', __( 'Could not access filesystem.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'core' == $type ) {
|
if ( 'core' === $type ) {
|
||||||
if ( is_wp_error( $upgrade_result ) && ( 'up_to_date' == $upgrade_result->get_error_code() || 'locked' == $upgrade_result->get_error_code() ) ) {
|
if ( is_wp_error( $upgrade_result )
|
||||||
// These aren't actual errors, treat it as a skipped-update instead to avoid triggering the post-core update failure routines.
|
&& ( 'up_to_date' === $upgrade_result->get_error_code()
|
||||||
|
|| 'locked' === $upgrade_result->get_error_code() )
|
||||||
|
) {
|
||||||
|
// These aren't actual errors, treat it as a skipped-update instead
|
||||||
|
// to avoid triggering the post-core update failure routines.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -626,11 +630,13 @@ class WP_Automatic_Updater {
|
||||||
);
|
);
|
||||||
|
|
||||||
$next_user_core_update = get_preferred_from_update_core();
|
$next_user_core_update = get_preferred_from_update_core();
|
||||||
|
|
||||||
// If the update transient is empty, use the update we just performed.
|
// If the update transient is empty, use the update we just performed.
|
||||||
if ( ! $next_user_core_update ) {
|
if ( ! $next_user_core_update ) {
|
||||||
$next_user_core_update = $core_update;
|
$next_user_core_update = $core_update;
|
||||||
}
|
}
|
||||||
$newer_version_available = ( 'upgrade' == $next_user_core_update->response && version_compare( $next_user_core_update->version, $core_update->version, '>' ) );
|
|
||||||
|
$newer_version_available = ( 'upgrade' === $next_user_core_update->response && version_compare( $next_user_core_update->version, $core_update->version, '>' ) );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters whether to send an email following an automatic background core update.
|
* Filters whether to send an email following an automatic background core update.
|
||||||
|
@ -715,7 +721,7 @@ class WP_Automatic_Updater {
|
||||||
|
|
||||||
// Don't show this message if there is a newer version available.
|
// Don't show this message if there is a newer version available.
|
||||||
// Potential for confusion, and also not useful for them to know at this point.
|
// Potential for confusion, and also not useful for them to know at this point.
|
||||||
if ( 'fail' == $type && ! $newer_version_available ) {
|
if ( 'fail' === $type && ! $newer_version_available ) {
|
||||||
$body .= __( 'We tried but were unable to update your site automatically.' ) . ' ';
|
$body .= __( 'We tried but were unable to update your site automatically.' ) . ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -778,7 +784,7 @@ class WP_Automatic_Updater {
|
||||||
|
|
||||||
$body .= "\n\n" . __( 'The WordPress Team' ) . "\n";
|
$body .= "\n\n" . __( 'The WordPress Team' ) . "\n";
|
||||||
|
|
||||||
if ( 'critical' == $type && is_wp_error( $result ) ) {
|
if ( 'critical' === $type && is_wp_error( $result ) ) {
|
||||||
$body .= "\n***\n\n";
|
$body .= "\n***\n\n";
|
||||||
/* translators: %s: WordPress version. */
|
/* translators: %s: WordPress version. */
|
||||||
$body .= sprintf( __( 'Your site was running version %s.' ), get_bloginfo( 'version' ) );
|
$body .= sprintf( __( 'Your site was running version %s.' ), get_bloginfo( 'version' ) );
|
||||||
|
@ -787,7 +793,7 @@ class WP_Automatic_Updater {
|
||||||
|
|
||||||
// If we had a rollback and we're still critical, then the rollback failed too.
|
// If we had a rollback and we're still critical, then the rollback failed too.
|
||||||
// Loop through all errors (the main WP_Error, the update result, the rollback result) for code, data, etc.
|
// Loop through all errors (the main WP_Error, the update result, the rollback result) for code, data, etc.
|
||||||
if ( 'rollback_was_required' == $result->get_error_code() ) {
|
if ( 'rollback_was_required' === $result->get_error_code() ) {
|
||||||
$errors = array( $result, $result->get_error_data()->update, $result->get_error_data()->rollback );
|
$errors = array( $result, $result->get_error_data()->update, $result->get_error_data()->rollback );
|
||||||
} else {
|
} else {
|
||||||
$errors = array( $result );
|
$errors = array( $result );
|
||||||
|
@ -797,20 +803,25 @@ class WP_Automatic_Updater {
|
||||||
if ( ! is_wp_error( $error ) ) {
|
if ( ! is_wp_error( $error ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$error_code = $error->get_error_code();
|
$error_code = $error->get_error_code();
|
||||||
/* translators: %s: Error code. */
|
/* translators: %s: Error code. */
|
||||||
$body .= "\n\n" . sprintf( __( 'Error code: %s' ), $error_code );
|
$body .= "\n\n" . sprintf( __( 'Error code: %s' ), $error_code );
|
||||||
if ( 'rollback_was_required' == $error_code ) {
|
|
||||||
|
if ( 'rollback_was_required' === $error_code ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $error->get_error_message() ) {
|
if ( $error->get_error_message() ) {
|
||||||
$body .= "\n" . $error->get_error_message();
|
$body .= "\n" . $error->get_error_message();
|
||||||
}
|
}
|
||||||
|
|
||||||
$error_data = $error->get_error_data();
|
$error_data = $error->get_error_data();
|
||||||
if ( $error_data ) {
|
if ( $error_data ) {
|
||||||
$body .= "\n" . implode( ', ', (array) $error_data );
|
$body .= "\n" . implode( ', ', (array) $error_data );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$body .= "\n";
|
$body .= "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -276,7 +276,7 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||||
}
|
}
|
||||||
|
|
||||||
$link = admin_url( 'edit-comments.php' );
|
$link = admin_url( 'edit-comments.php' );
|
||||||
if ( ! empty( $comment_type ) && 'all' != $comment_type ) {
|
if ( ! empty( $comment_type ) && 'all' !== $comment_type ) {
|
||||||
$link = add_query_arg( 'comment_type', $comment_type, $link );
|
$link = add_query_arg( 'comment_type', $comment_type, $link );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -634,7 +634,7 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Not looking at all comments.
|
// Not looking at all comments.
|
||||||
if ( $comment_status && 'all' != $comment_status ) {
|
if ( $comment_status && 'all' !== $comment_status ) {
|
||||||
if ( 'approved' === $the_comment_status ) {
|
if ( 'approved' === $the_comment_status ) {
|
||||||
$actions['unapprove'] = sprintf(
|
$actions['unapprove'] = sprintf(
|
||||||
'<a href="%s" data-wp-lists="%s" class="vim-u vim-destructive aria-button-if-js" aria-label="%s">%s</a>',
|
'<a href="%s" data-wp-lists="%s" class="vim-u vim-destructive aria-button-if-js" aria-label="%s">%s</a>',
|
||||||
|
|
|
@ -98,7 +98,7 @@ class WP_Filesystem_Base {
|
||||||
$theme_root = get_theme_root( $theme );
|
$theme_root = get_theme_root( $theme );
|
||||||
|
|
||||||
// Account for relative theme roots.
|
// Account for relative theme roots.
|
||||||
if ( '/themes' == $theme_root || ! is_dir( $theme_root ) ) {
|
if ( '/themes' === $theme_root || ! is_dir( $theme_root ) ) {
|
||||||
$theme_root = WP_CONTENT_DIR . $theme_root;
|
$theme_root = WP_CONTENT_DIR . $theme_root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ class WP_Filesystem_Base {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ( 'direct' == $this->method ) {
|
} elseif ( 'direct' === $this->method ) {
|
||||||
$folder = str_replace( '\\', '/', $folder ); // Windows path sanitisation.
|
$folder = str_replace( '\\', '/', $folder ); // Windows path sanitisation.
|
||||||
return trailingslashit( $folder );
|
return trailingslashit( $folder );
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ class WP_Filesystem_Base {
|
||||||
* @return string|false The location of the remote path, false to cease looping.
|
* @return string|false The location of the remote path, false to cease looping.
|
||||||
*/
|
*/
|
||||||
public function search_for_folder( $folder, $base = '.', $loop = false ) {
|
public function search_for_folder( $folder, $base = '.', $loop = false ) {
|
||||||
if ( empty( $base ) || '.' == $base ) {
|
if ( empty( $base ) || '.' === $base ) {
|
||||||
$base = trailingslashit( $this->cwd() );
|
$base = trailingslashit( $this->cwd() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ class WP_Filesystem_Base {
|
||||||
|
|
||||||
// Prevent this function from looping again.
|
// Prevent this function from looping again.
|
||||||
// No need to proceed if we've just searched in `/`.
|
// No need to proceed if we've just searched in `/`.
|
||||||
if ( $loop || '/' == $base ) {
|
if ( $loop || '/' === $base ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -333,7 +333,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||||
}
|
}
|
||||||
$file = str_replace( '\\', '/', $file ); // For Win32, occasional problems deleting files otherwise.
|
$file = str_replace( '\\', '/', $file ); // For Win32, occasional problems deleting files otherwise.
|
||||||
|
|
||||||
if ( 'f' == $type || $this->is_file( $file ) ) {
|
if ( 'f' === $type || $this->is_file( $file ) ) {
|
||||||
return @unlink( $file );
|
return @unlink( $file );
|
||||||
}
|
}
|
||||||
if ( ! $recursive && $this->is_dir( $file ) ) {
|
if ( ! $recursive && $this->is_dir( $file ) ) {
|
||||||
|
@ -580,11 +580,11 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||||
$struc = array();
|
$struc = array();
|
||||||
$struc['name'] = $entry;
|
$struc['name'] = $entry;
|
||||||
|
|
||||||
if ( '.' == $struc['name'] || '..' == $struc['name'] ) {
|
if ( '.' === $struc['name'] || '..' === $struc['name'] ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $include_hidden && '.' == $struc['name'][0] ) {
|
if ( ! $include_hidden && '.' === $struc['name'][0] ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -603,7 +603,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||||
$struc['time'] = gmdate( 'h:i:s', $struc['lastmodunix'] );
|
$struc['time'] = gmdate( 'h:i:s', $struc['lastmodunix'] );
|
||||||
$struc['type'] = $this->is_dir( $path . '/' . $entry ) ? 'd' : 'f';
|
$struc['type'] = $this->is_dir( $path . '/' . $entry ) ? 'd' : 'f';
|
||||||
|
|
||||||
if ( 'd' == $struc['type'] ) {
|
if ( 'd' === $struc['type'] ) {
|
||||||
if ( $recursive ) {
|
if ( $recursive ) {
|
||||||
$struc['files'] = $this->dirlist( $path . '/' . $struc['name'], $include_hidden, $recursive );
|
$struc['files'] = $this->dirlist( $path . '/' . $struc['name'], $include_hidden, $recursive );
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -69,7 +69,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->options['ssl'] = false;
|
$this->options['ssl'] = false;
|
||||||
if ( isset( $opt['connection_type'] ) && 'ftps' == $opt['connection_type'] ) {
|
if ( isset( $opt['connection_type'] ) && 'ftps' === $opt['connection_type'] ) {
|
||||||
$this->options['ssl'] = true;
|
$this->options['ssl'] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -373,7 +373,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
||||||
if ( empty( $file ) ) {
|
if ( empty( $file ) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ( 'f' == $type || $this->is_file( $file ) ) {
|
if ( 'f' === $type || $this->is_file( $file ) ) {
|
||||||
return ftp_delete( $this->link, $file );
|
return ftp_delete( $this->link, $file );
|
||||||
}
|
}
|
||||||
if ( ! $recursive ) {
|
if ( ! $recursive ) {
|
||||||
|
@ -695,11 +695,11 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( '.' == $entry['name'] || '..' == $entry['name'] ) {
|
if ( '.' === $entry['name'] || '..' === $entry['name'] ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $include_hidden && '.' == $entry['name'][0] ) {
|
if ( ! $include_hidden && '.' === $entry['name'][0] ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -712,7 +712,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
||||||
|
|
||||||
$ret = array();
|
$ret = array();
|
||||||
foreach ( (array) $dirlist as $struc ) {
|
foreach ( (array) $dirlist as $struc ) {
|
||||||
if ( 'd' == $struc['type'] ) {
|
if ( 'd' === $struc['type'] ) {
|
||||||
if ( $recursive ) {
|
if ( $recursive ) {
|
||||||
$struc['files'] = $this->dirlist( $path . '/' . $struc['name'], $include_hidden, $recursive );
|
$struc['files'] = $this->dirlist( $path . '/' . $struc['name'], $include_hidden, $recursive );
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -383,7 +383,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
||||||
if ( empty( $file ) ) {
|
if ( empty( $file ) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ( 'f' == $type || $this->is_file( $file ) ) {
|
if ( 'f' === $type || $this->is_file( $file ) ) {
|
||||||
return $this->ftp->delete( $file );
|
return $this->ftp->delete( $file );
|
||||||
}
|
}
|
||||||
if ( ! $recursive ) {
|
if ( ! $recursive ) {
|
||||||
|
@ -615,11 +615,11 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
||||||
$ret = array();
|
$ret = array();
|
||||||
foreach ( $list as $struc ) {
|
foreach ( $list as $struc ) {
|
||||||
|
|
||||||
if ( '.' == $struc['name'] || '..' == $struc['name'] ) {
|
if ( '.' === $struc['name'] || '..' === $struc['name'] ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $include_hidden && '.' == $struc['name'][0] ) {
|
if ( ! $include_hidden && '.' === $struc['name'][0] ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -627,7 +627,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'd' == $struc['type'] ) {
|
if ( 'd' === $struc['type'] ) {
|
||||||
if ( $recursive ) {
|
if ( $recursive ) {
|
||||||
$struc['files'] = $this->dirlist( $path . '/' . $struc['name'], $include_hidden, $recursive );
|
$struc['files'] = $this->dirlist( $path . '/' . $struc['name'], $include_hidden, $recursive );
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -227,7 +227,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
|
||||||
fclose( $stream );
|
fclose( $stream );
|
||||||
|
|
||||||
if ( $returnbool ) {
|
if ( $returnbool ) {
|
||||||
return ( false === $data ) ? false : '' != trim( $data );
|
return ( false === $data ) ? false : '' !== trim( $data );
|
||||||
} else {
|
} else {
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
@ -499,7 +499,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
|
||||||
* @return bool True on success, false on failure.
|
* @return bool True on success, false on failure.
|
||||||
*/
|
*/
|
||||||
public function delete( $file, $recursive = false, $type = false ) {
|
public function delete( $file, $recursive = false, $type = false ) {
|
||||||
if ( 'f' == $type || $this->is_file( $file ) ) {
|
if ( 'f' === $type || $this->is_file( $file ) ) {
|
||||||
return ssh2_sftp_unlink( $this->sftp_link, $file );
|
return ssh2_sftp_unlink( $this->sftp_link, $file );
|
||||||
}
|
}
|
||||||
if ( ! $recursive ) {
|
if ( ! $recursive ) {
|
||||||
|
@ -725,11 +725,11 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
|
||||||
$struc = array();
|
$struc = array();
|
||||||
$struc['name'] = $entry;
|
$struc['name'] = $entry;
|
||||||
|
|
||||||
if ( '.' == $struc['name'] || '..' == $struc['name'] ) {
|
if ( '.' === $struc['name'] || '..' === $struc['name'] ) {
|
||||||
continue; // Do not care about these folders.
|
continue; // Do not care about these folders.
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $include_hidden && '.' == $struc['name'][0] ) {
|
if ( ! $include_hidden && '.' === $struc['name'][0] ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -748,7 +748,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
|
||||||
$struc['time'] = gmdate( 'h:i:s', $struc['lastmodunix'] );
|
$struc['time'] = gmdate( 'h:i:s', $struc['lastmodunix'] );
|
||||||
$struc['type'] = $this->is_dir( $path . '/' . $entry ) ? 'd' : 'f';
|
$struc['type'] = $this->is_dir( $path . '/' . $entry ) ? 'd' : 'f';
|
||||||
|
|
||||||
if ( 'd' == $struc['type'] ) {
|
if ( 'd' === $struc['type'] ) {
|
||||||
if ( $recursive ) {
|
if ( $recursive ) {
|
||||||
$struc['files'] = $this->dirlist( $path . '/' . $struc['name'], $include_hidden, $recursive );
|
$struc['files'] = $this->dirlist( $path . '/' . $struc['name'], $include_hidden, $recursive );
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -352,7 +352,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
|
||||||
$url = 'themes.php';
|
$url = 'themes.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'search' != $type ) {
|
if ( 'search' !== $type ) {
|
||||||
$status_links[ $type ] = sprintf(
|
$status_links[ $type ] = sprintf(
|
||||||
"<a href='%s'%s>%s</a>",
|
"<a href='%s'%s>%s</a>",
|
||||||
esc_url( add_query_arg( 'theme_status', $type, $url ) ),
|
esc_url( add_query_arg( 'theme_status', $type, $url ) ),
|
||||||
|
@ -374,10 +374,10 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
|
||||||
global $status;
|
global $status;
|
||||||
|
|
||||||
$actions = array();
|
$actions = array();
|
||||||
if ( 'enabled' != $status ) {
|
if ( 'enabled' !== $status ) {
|
||||||
$actions['enable-selected'] = $this->is_site_themes ? __( 'Enable' ) : __( 'Network Enable' );
|
$actions['enable-selected'] = $this->is_site_themes ? __( 'Enable' ) : __( 'Network Enable' );
|
||||||
}
|
}
|
||||||
if ( 'disabled' != $status ) {
|
if ( 'disabled' !== $status ) {
|
||||||
$actions['disable-selected'] = $this->is_site_themes ? __( 'Disable' ) : __( 'Network Disable' );
|
$actions['disable-selected'] = $this->is_site_themes ? __( 'Disable' ) : __( 'Network Disable' );
|
||||||
}
|
}
|
||||||
if ( ! $this->is_site_themes ) {
|
if ( ! $this->is_site_themes ) {
|
||||||
|
|
|
@ -517,11 +517,11 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
||||||
|
|
||||||
$actions = array();
|
$actions = array();
|
||||||
|
|
||||||
if ( 'active' != $status ) {
|
if ( 'active' !== $status ) {
|
||||||
$actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' );
|
$actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'inactive' != $status && 'recent' != $status ) {
|
if ( 'inactive' !== $status && 'recent' !== $status ) {
|
||||||
$actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' );
|
$actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -530,7 +530,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
||||||
$actions['update-selected'] = __( 'Update' );
|
$actions['update-selected'] = __( 'Update' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( current_user_can( 'delete_plugins' ) && ( 'active' != $status ) ) {
|
if ( current_user_can( 'delete_plugins' ) && ( 'active' !== $status ) ) {
|
||||||
$actions['delete-selected'] = __( 'Delete' );
|
$actions['delete-selected'] = __( 'Delete' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -565,7 +565,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
||||||
|
|
||||||
echo '<div class="alignleft actions">';
|
echo '<div class="alignleft actions">';
|
||||||
|
|
||||||
if ( 'recently_activated' == $status ) {
|
if ( 'recently_activated' === $status ) {
|
||||||
submit_button( __( 'Clear List' ), '', 'clear-recent-list', false );
|
submit_button( __( 'Clear List' ), '', 'clear-recent-list', false );
|
||||||
} elseif ( 'top' === $which && 'mustuse' === $status ) {
|
} elseif ( 'top' === $which && 'mustuse' === $status ) {
|
||||||
echo '<p>' . sprintf(
|
echo '<p>' . sprintf(
|
||||||
|
@ -858,7 +858,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
||||||
esc_attr( $plugin_file )
|
esc_attr( $plugin_file )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ( 'dropins' != $context ) {
|
if ( 'dropins' !== $context ) {
|
||||||
$description = '<p>' . ( $plugin_data['Description'] ? $plugin_data['Description'] : ' ' ) . '</p>';
|
$description = '<p>' . ( $plugin_data['Description'] ? $plugin_data['Description'] : ' ' ) . '</p>';
|
||||||
$plugin_name = $plugin_data['Name'];
|
$plugin_name = $plugin_data['Name'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1190,7 +1190,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||||
$term_links = array();
|
$term_links = array();
|
||||||
foreach ( $terms as $t ) {
|
foreach ( $terms as $t ) {
|
||||||
$posts_in_term_qv = array();
|
$posts_in_term_qv = array();
|
||||||
if ( 'post' != $post->post_type ) {
|
if ( 'post' !== $post->post_type ) {
|
||||||
$posts_in_term_qv['post_type'] = $post->post_type;
|
$posts_in_term_qv['post_type'] = $post->post_type;
|
||||||
}
|
}
|
||||||
if ( $taxonomy_object->query_var ) {
|
if ( $taxonomy_object->query_var ) {
|
||||||
|
@ -1335,7 +1335,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||||
$actions = array();
|
$actions = array();
|
||||||
$title = _draft_or_post_title();
|
$title = _draft_or_post_title();
|
||||||
|
|
||||||
if ( $can_edit_post && 'trash' != $post->post_status ) {
|
if ( $can_edit_post && 'trash' !== $post->post_status ) {
|
||||||
$actions['edit'] = sprintf(
|
$actions['edit'] = sprintf(
|
||||||
'<a href="%s" aria-label="%s">%s</a>',
|
'<a href="%s" aria-label="%s">%s</a>',
|
||||||
get_edit_post_link( $post->ID ),
|
get_edit_post_link( $post->ID ),
|
||||||
|
@ -1395,7 +1395,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||||
__( 'Preview' )
|
__( 'Preview' )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} elseif ( 'trash' != $post->post_status ) {
|
} elseif ( 'trash' !== $post->post_status ) {
|
||||||
$actions['view'] = sprintf(
|
$actions['view'] = sprintf(
|
||||||
'<a href="%s" rel="bookmark" aria-label="%s">%s</a>',
|
'<a href="%s" rel="bookmark" aria-label="%s">%s</a>',
|
||||||
get_permalink( $post->ID ),
|
get_permalink( $post->ID ),
|
||||||
|
|
|
@ -347,7 +347,7 @@ class WP_Site_Health_Auto_Updates {
|
||||||
|
|
||||||
WP_Filesystem();
|
WP_Filesystem();
|
||||||
|
|
||||||
if ( 'direct' != $wp_filesystem->method ) {
|
if ( 'direct' !== $wp_filesystem->method ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,7 +378,7 @@ class WP_Site_Health_Auto_Updates {
|
||||||
|
|
||||||
$unwritable_files = array();
|
$unwritable_files = array();
|
||||||
foreach ( array_keys( $checksums ) as $file ) {
|
foreach ( array_keys( $checksums ) as $file ) {
|
||||||
if ( 'wp-content' == substr( $file, 0, 10 ) ) {
|
if ( 'wp-content' === substr( $file, 0, 10 ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( ! file_exists( ABSPATH . $file ) ) {
|
if ( ! file_exists( ABSPATH . $file ) ) {
|
||||||
|
|
|
@ -576,7 +576,7 @@ class WP_Terms_List_Table extends WP_List_Table {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'post' != $this->screen->post_type ) {
|
if ( 'post' !== $this->screen->post_type ) {
|
||||||
$args['post_type'] = $this->screen->post_type;
|
$args['post_type'] = $this->screen->post_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -331,7 +331,7 @@ class WP_Upgrader {
|
||||||
|
|
||||||
if ( is_wp_error( $result ) ) {
|
if ( is_wp_error( $result ) ) {
|
||||||
$wp_filesystem->delete( $working_dir, true );
|
$wp_filesystem->delete( $working_dir, true );
|
||||||
if ( 'incompatible_archive' == $result->get_error_code() ) {
|
if ( 'incompatible_archive' === $result->get_error_code() ) {
|
||||||
return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], $result->get_error_data() );
|
return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], $result->get_error_data() );
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -398,7 +398,7 @@ class WP_Upgrader {
|
||||||
foreach ( $files as $filename => $file_details ) {
|
foreach ( $files as $filename => $file_details ) {
|
||||||
if ( ! $wp_filesystem->is_writable( $remote_destination . $filename ) ) {
|
if ( ! $wp_filesystem->is_writable( $remote_destination . $filename ) ) {
|
||||||
// Attempt to alter permissions to allow writes and try again.
|
// Attempt to alter permissions to allow writes and try again.
|
||||||
$wp_filesystem->chmod( $remote_destination . $filename, ( 'd' == $file_details['type'] ? FS_CHMOD_DIR : FS_CHMOD_FILE ) );
|
$wp_filesystem->chmod( $remote_destination . $filename, ( 'd' === $file_details['type'] ? FS_CHMOD_DIR : FS_CHMOD_FILE ) );
|
||||||
if ( ! $wp_filesystem->is_writable( $remote_destination . $filename ) ) {
|
if ( ! $wp_filesystem->is_writable( $remote_destination . $filename ) ) {
|
||||||
$unwritable_files[] = $filename;
|
$unwritable_files[] = $filename;
|
||||||
}
|
}
|
||||||
|
@ -603,7 +603,7 @@ class WP_Upgrader {
|
||||||
}
|
}
|
||||||
|
|
||||||
$destination_name = basename( str_replace( $local_destination, '', $destination ) );
|
$destination_name = basename( str_replace( $local_destination, '', $destination ) );
|
||||||
if ( '.' == $destination_name ) {
|
if ( '.' === $destination_name ) {
|
||||||
$destination_name = '';
|
$destination_name = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -744,7 +744,7 @@ class WP_Upgrader {
|
||||||
if ( is_wp_error( $download ) && $download->get_error_data( 'softfail-filename' ) ) {
|
if ( is_wp_error( $download ) && $download->get_error_data( 'softfail-filename' ) ) {
|
||||||
|
|
||||||
// Don't output the 'no signature could be found' failure message for now.
|
// Don't output the 'no signature could be found' failure message for now.
|
||||||
if ( 'signature_verification_no_signature' != $download->get_error_code() || WP_DEBUG ) {
|
if ( 'signature_verification_no_signature' !== $download->get_error_code() || WP_DEBUG ) {
|
||||||
// Output the failure error as a normal feedback, and not as an error.
|
// Output the failure error as a normal feedback, and not as an error.
|
||||||
$this->skin->feedback( $download->get_error_message() );
|
$this->skin->feedback( $download->get_error_message() );
|
||||||
|
|
||||||
|
|
|
@ -197,7 +197,7 @@ function floated_admin_avatar( $name ) {
|
||||||
* @since 2.7.0
|
* @since 2.7.0
|
||||||
*/
|
*/
|
||||||
function enqueue_comment_hotkeys_js() {
|
function enqueue_comment_hotkeys_js() {
|
||||||
if ( 'true' == get_user_option( 'comment_shortcuts' ) ) {
|
if ( 'true' === get_user_option( 'comment_shortcuts' ) ) {
|
||||||
wp_enqueue_script( 'jquery-table-hotkeys' );
|
wp_enqueue_script( 'jquery-table-hotkeys' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,7 +137,7 @@ function wp_dashboard_setup() {
|
||||||
wp_add_dashboard_widget( $widget_id, $name, $wp_registered_widgets[ $widget_id ]['callback'], $wp_registered_widget_controls[ $widget_id ]['callback'] );
|
wp_add_dashboard_widget( $widget_id, $name, $wp_registered_widgets[ $widget_id ]['callback'], $wp_registered_widget_controls[ $widget_id ]['callback'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget_id'] ) ) {
|
if ( 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget_id'] ) ) {
|
||||||
check_admin_referer( 'edit-dashboard-widget_' . $_POST['widget_id'], 'dashboard-widget-nonce' );
|
check_admin_referer( 'edit-dashboard-widget_' . $_POST['widget_id'], 'dashboard-widget-nonce' );
|
||||||
ob_start(); // Hack - but the same hack wp-admin/widgets.php uses.
|
ob_start(); // Hack - but the same hack wp-admin/widgets.php uses.
|
||||||
wp_dashboard_trigger_widget_control( $_POST['widget_id'] );
|
wp_dashboard_trigger_widget_control( $_POST['widget_id'] );
|
||||||
|
@ -282,7 +282,7 @@ function wp_dashboard_right_now() {
|
||||||
foreach ( array( 'post', 'page' ) as $post_type ) {
|
foreach ( array( 'post', 'page' ) as $post_type ) {
|
||||||
$num_posts = wp_count_posts( $post_type );
|
$num_posts = wp_count_posts( $post_type );
|
||||||
if ( $num_posts && $num_posts->publish ) {
|
if ( $num_posts && $num_posts->publish ) {
|
||||||
if ( 'post' == $post_type ) {
|
if ( 'post' === $post_type ) {
|
||||||
/* translators: %s: Number of posts. */
|
/* translators: %s: Number of posts. */
|
||||||
$text = _n( '%s Post', '%s Posts', $num_posts->publish );
|
$text = _n( '%s Post', '%s Posts', $num_posts->publish );
|
||||||
} else {
|
} else {
|
||||||
|
@ -758,16 +758,22 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ( $actions as $action => $link ) {
|
foreach ( $actions as $action => $link ) {
|
||||||
++$i;
|
++$i;
|
||||||
( ( ( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
|
|
||||||
|
if ( ( ( 'approve' === $action || 'unapprove' === $action ) && 2 === $i ) || 1 === $i ) {
|
||||||
|
$sep = '';
|
||||||
|
} else {
|
||||||
|
$sep = ' | ';
|
||||||
|
}
|
||||||
|
|
||||||
// Reply and quickedit need a hide-if-no-js span.
|
// Reply and quickedit need a hide-if-no-js span.
|
||||||
if ( 'reply' == $action || 'quickedit' == $action ) {
|
if ( 'reply' === $action || 'quickedit' === $action ) {
|
||||||
$action .= ' hide-if-no-js';
|
$action .= ' hide-if-no-js';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'view' === $action && '1' !== $comment->comment_approved ) {
|
if ( 'view' === $action && '1' !== $comment->comment_approved ) {
|
||||||
$action .= ' hidden';
|
$action .= ' hidden';
|
||||||
}
|
}
|
||||||
|
|
||||||
$actions_string .= "<span class='$action'>$sep$link</span>";
|
$actions_string .= "<span class='$action'>$sep$link</span>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -784,7 +790,7 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php if ( ! $comment->comment_type || 'comment' == $comment->comment_type ) : ?>
|
<?php if ( ! $comment->comment_type || 'comment' === $comment->comment_type ) : ?>
|
||||||
|
|
||||||
<div class="dashboard-comment-wrap has-row-actions <?php echo $comment_row_class; ?>">
|
<div class="dashboard-comment-wrap has-row-actions <?php echo $comment_row_class; ?>">
|
||||||
<p class="comment-meta">
|
<p class="comment-meta">
|
||||||
|
@ -1174,7 +1180,7 @@ function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) {
|
||||||
|
|
||||||
$widget_options[ $widget_id ]['number'] = $number;
|
$widget_options[ $widget_id ]['number'] = $number;
|
||||||
|
|
||||||
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget-rss'][ $number ] ) ) {
|
if ( 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget-rss'][ $number ] ) ) {
|
||||||
$_POST['widget-rss'][ $number ] = wp_unslash( $_POST['widget-rss'][ $number ] );
|
$_POST['widget-rss'][ $number ] = wp_unslash( $_POST['widget-rss'][ $number ] );
|
||||||
$widget_options[ $widget_id ] = wp_widget_rss_process( $_POST['widget-rss'][ $number ] );
|
$widget_options[ $widget_id ] = wp_widget_rss_process( $_POST['widget-rss'][ $number ] );
|
||||||
$widget_options[ $widget_id ]['number'] = $number;
|
$widget_options[ $widget_id ]['number'] = $number;
|
||||||
|
@ -1891,10 +1897,10 @@ function wp_welcome_panel() {
|
||||||
<div class="welcome-panel-column">
|
<div class="welcome-panel-column">
|
||||||
<h3><?php _e( 'Next Steps' ); ?></h3>
|
<h3><?php _e( 'Next Steps' ); ?></h3>
|
||||||
<ul>
|
<ul>
|
||||||
<?php if ( 'page' == get_option( 'show_on_front' ) && ! get_option( 'page_for_posts' ) ) : ?>
|
<?php if ( 'page' === get_option( 'show_on_front' ) && ! get_option( 'page_for_posts' ) ) : ?>
|
||||||
<li><?php printf( '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Edit your front page' ) . '</a>', get_edit_post_link( get_option( 'page_on_front' ) ) ); ?></li>
|
<li><?php printf( '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Edit your front page' ) . '</a>', get_edit_post_link( get_option( 'page_on_front' ) ) ); ?></li>
|
||||||
<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add additional pages' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
|
<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add additional pages' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
|
||||||
<?php elseif ( 'page' == get_option( 'show_on_front' ) ) : ?>
|
<?php elseif ( 'page' === get_option( 'show_on_front' ) ) : ?>
|
||||||
<li><?php printf( '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Edit your front page' ) . '</a>', get_edit_post_link( get_option( 'page_on_front' ) ) ); ?></li>
|
<li><?php printf( '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Edit your front page' ) . '</a>', get_edit_post_link( get_option( 'page_on_front' ) ) ); ?></li>
|
||||||
<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add additional pages' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
|
<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add additional pages' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
|
||||||
<li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Add a blog post' ) . '</a>', admin_url( 'post-new.php' ) ); ?></li>
|
<li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Add a blog post' ) . '</a>', admin_url( 'post-new.php' ) ); ?></li>
|
||||||
|
|
|
@ -96,7 +96,7 @@ function export_wp( $args = array() ) {
|
||||||
header( 'Content-Disposition: attachment; filename=' . $filename );
|
header( 'Content-Disposition: attachment; filename=' . $filename );
|
||||||
header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
|
header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
|
||||||
|
|
||||||
if ( 'all' != $args['content'] && post_type_exists( $args['content'] ) ) {
|
if ( 'all' !== $args['content'] && post_type_exists( $args['content'] ) ) {
|
||||||
$ptype = get_post_type_object( $args['content'] );
|
$ptype = get_post_type_object( $args['content'] );
|
||||||
if ( ! $ptype->can_export ) {
|
if ( ! $ptype->can_export ) {
|
||||||
$args['content'] = 'post';
|
$args['content'] = 'post';
|
||||||
|
@ -111,14 +111,14 @@ function export_wp( $args = array() ) {
|
||||||
$where = $wpdb->prepare( "{$wpdb->posts}.post_type IN (" . implode( ',', $esses ) . ')', $post_types );
|
$where = $wpdb->prepare( "{$wpdb->posts}.post_type IN (" . implode( ',', $esses ) . ')', $post_types );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $args['status'] && ( 'post' == $args['content'] || 'page' == $args['content'] ) ) {
|
if ( $args['status'] && ( 'post' === $args['content'] || 'page' === $args['content'] ) ) {
|
||||||
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_status = %s", $args['status'] );
|
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_status = %s", $args['status'] );
|
||||||
} else {
|
} else {
|
||||||
$where .= " AND {$wpdb->posts}.post_status != 'auto-draft'";
|
$where .= " AND {$wpdb->posts}.post_status != 'auto-draft'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$join = '';
|
$join = '';
|
||||||
if ( $args['category'] && 'post' == $args['content'] ) {
|
if ( $args['category'] && 'post' === $args['content'] ) {
|
||||||
$term = term_exists( $args['category'], 'category' );
|
$term = term_exists( $args['category'], 'category' );
|
||||||
if ( $term ) {
|
if ( $term ) {
|
||||||
$join = "INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id)";
|
$join = "INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id)";
|
||||||
|
@ -126,7 +126,7 @@ function export_wp( $args = array() ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'post' == $args['content'] || 'page' == $args['content'] || 'attachment' == $args['content'] ) {
|
if ( in_array( $args['content'], array( 'post', 'page', 'attachment' ), true ) ) {
|
||||||
if ( $args['author'] ) {
|
if ( $args['author'] ) {
|
||||||
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_author = %d", $args['author'] );
|
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_author = %d", $args['author'] );
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ function export_wp( $args = array() ) {
|
||||||
$cat = get_term( $term['term_id'], 'category' );
|
$cat = get_term( $term['term_id'], 'category' );
|
||||||
$cats = array( $cat->term_id => $cat );
|
$cats = array( $cat->term_id => $cat );
|
||||||
unset( $term, $cat );
|
unset( $term, $cat );
|
||||||
} elseif ( 'all' == $args['content'] ) {
|
} elseif ( 'all' === $args['content'] ) {
|
||||||
$categories = (array) get_categories( array( 'get' => 'all' ) );
|
$categories = (array) get_categories( array( 'get' => 'all' ) );
|
||||||
$tags = (array) get_tags( array( 'get' => 'all' ) );
|
$tags = (array) get_tags( array( 'get' => 'all' ) );
|
||||||
|
|
||||||
|
@ -428,7 +428,7 @@ function export_wp( $args = array() ) {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function wxr_filter_postmeta( $return_me, $meta_key ) {
|
function wxr_filter_postmeta( $return_me, $meta_key ) {
|
||||||
if ( '_edit_lock' == $meta_key ) {
|
if ( '_edit_lock' === $meta_key ) {
|
||||||
$return_me = true;
|
$return_me = true;
|
||||||
}
|
}
|
||||||
return $return_me;
|
return $return_me;
|
||||||
|
@ -513,7 +513,7 @@ function export_wp( $args = array() ) {
|
||||||
</wp:term>
|
</wp:term>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php
|
<?php
|
||||||
if ( 'all' == $args['content'] ) {
|
if ( 'all' === $args['content'] ) {
|
||||||
wxr_nav_menu_terms();}
|
wxr_nav_menu_terms();}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
|
@ -648,7 +648,7 @@ function wp_tempnam( $filename = '', $dir = '' ) {
|
||||||
$dir = get_temp_dir();
|
$dir = get_temp_dir();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( empty( $filename ) || '.' == $filename || '/' == $filename || '\\' == $filename ) {
|
if ( empty( $filename ) || in_array( $filename, array( '.', '/', '\\' ), true ) ) {
|
||||||
$filename = uniqid();
|
$filename = uniqid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1103,7 +1103,8 @@ function download_url( $url, $timeout = 300, $signature_verification = false ) {
|
||||||
|
|
||||||
$signature_url = false;
|
$signature_url = false;
|
||||||
$url_path = parse_url( $url, PHP_URL_PATH );
|
$url_path = parse_url( $url, PHP_URL_PATH );
|
||||||
if ( substr( $url_path, -4 ) == '.zip' || substr( $url_path, -7 ) == '.tar.gz' ) {
|
|
||||||
|
if ( '.zip' === substr( $url_path, -4 ) || '.tar.gz' === substr( $url_path, -7 ) ) {
|
||||||
$signature_url = str_replace( $url_path, $url_path . '.sig', $url );
|
$signature_url = str_replace( $url_path, $url_path . '.sig', $url );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1450,7 +1451,7 @@ function unzip_file( $file, $to ) {
|
||||||
if ( true === $result ) {
|
if ( true === $result ) {
|
||||||
return $result;
|
return $result;
|
||||||
} elseif ( is_wp_error( $result ) ) {
|
} elseif ( is_wp_error( $result ) ) {
|
||||||
if ( 'incompatible_archive' != $result->get_error_code() ) {
|
if ( 'incompatible_archive' !== $result->get_error_code() ) {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1562,7 +1563,7 @@ function _unzip_file_ziparchive( $file, $to, $needed_dirs = array() ) {
|
||||||
return new WP_Error( 'stat_failed_ziparchive', __( 'Could not retrieve file from archive.' ) );
|
return new WP_Error( 'stat_failed_ziparchive', __( 'Could not retrieve file from archive.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( '/' == substr( $info['name'], -1 ) ) { // Directory.
|
if ( '/' === substr( $info['name'], -1 ) ) { // Directory.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1732,7 +1733,7 @@ function copy_dir( $from, $to, $skip_list = array() ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'f' == $fileinfo['type'] ) {
|
if ( 'f' === $fileinfo['type'] ) {
|
||||||
if ( ! $wp_filesystem->copy( $from . $filename, $to . $filename, true, FS_CHMOD_FILE ) ) {
|
if ( ! $wp_filesystem->copy( $from . $filename, $to . $filename, true, FS_CHMOD_FILE ) ) {
|
||||||
// If copy failed, chmod file to 0644 and try again.
|
// If copy failed, chmod file to 0644 and try again.
|
||||||
$wp_filesystem->chmod( $to . $filename, FS_CHMOD_FILE );
|
$wp_filesystem->chmod( $to . $filename, FS_CHMOD_FILE );
|
||||||
|
@ -1740,7 +1741,7 @@ function copy_dir( $from, $to, $skip_list = array() ) {
|
||||||
return new WP_Error( 'copy_failed_copy_dir', __( 'Could not copy file.' ), $to . $filename );
|
return new WP_Error( 'copy_failed_copy_dir', __( 'Could not copy file.' ), $to . $filename );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ( 'd' == $fileinfo['type'] ) {
|
} elseif ( 'd' === $fileinfo['type'] ) {
|
||||||
if ( ! $wp_filesystem->is_dir( $to . $filename ) ) {
|
if ( ! $wp_filesystem->is_dir( $to . $filename ) ) {
|
||||||
if ( ! $wp_filesystem->mkdir( $to . $filename, FS_CHMOD_DIR ) ) {
|
if ( ! $wp_filesystem->mkdir( $to . $filename, FS_CHMOD_DIR ) ) {
|
||||||
return new WP_Error( 'mkdir_failed_copy_dir', __( 'Could not create directory.' ), $to . $filename );
|
return new WP_Error( 'mkdir_failed_copy_dir', __( 'Could not create directory.' ), $to . $filename );
|
||||||
|
@ -1761,6 +1762,7 @@ function copy_dir( $from, $to, $skip_list = array() ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1924,7 +1926,7 @@ function get_filesystem_method( $args = array(), $context = '', $allow_relaxed_f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $method && isset( $args['connection_type'] ) && 'ssh' == $args['connection_type'] && extension_loaded( 'ssh2' ) ) {
|
if ( ! $method && isset( $args['connection_type'] ) && 'ssh' === $args['connection_type'] && extension_loaded( 'ssh2' ) ) {
|
||||||
$method = 'ssh2';
|
$method = 'ssh2';
|
||||||
}
|
}
|
||||||
if ( ! $method && extension_loaded( 'ftp' ) ) {
|
if ( ! $method && extension_loaded( 'ftp' ) ) {
|
||||||
|
@ -2010,7 +2012,7 @@ function request_filesystem_credentials( $form_post, $type = '', $error = false,
|
||||||
$type = get_filesystem_method( array(), $context, $allow_relaxed_file_ownership );
|
$type = get_filesystem_method( array(), $context, $allow_relaxed_file_ownership );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'direct' == $type ) {
|
if ( 'direct' === $type ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2061,29 +2063,32 @@ function request_filesystem_credentials( $form_post, $type = '', $error = false,
|
||||||
unset( $credentials['port'] );
|
unset( $credentials['port'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ( defined( 'FTP_SSH' ) && FTP_SSH ) || ( defined( 'FS_METHOD' ) && 'ssh2' == FS_METHOD ) ) {
|
if ( ( defined( 'FTP_SSH' ) && FTP_SSH ) || ( defined( 'FS_METHOD' ) && 'ssh2' === FS_METHOD ) ) {
|
||||||
$credentials['connection_type'] = 'ssh';
|
$credentials['connection_type'] = 'ssh';
|
||||||
} elseif ( ( defined( 'FTP_SSL' ) && FTP_SSL ) && 'ftpext' == $type ) { // Only the FTP Extension understands SSL.
|
} elseif ( ( defined( 'FTP_SSL' ) && FTP_SSL ) && 'ftpext' === $type ) { // Only the FTP Extension understands SSL.
|
||||||
$credentials['connection_type'] = 'ftps';
|
$credentials['connection_type'] = 'ftps';
|
||||||
} elseif ( ! empty( $submitted_form['connection_type'] ) ) {
|
} elseif ( ! empty( $submitted_form['connection_type'] ) ) {
|
||||||
$credentials['connection_type'] = $submitted_form['connection_type'];
|
$credentials['connection_type'] = $submitted_form['connection_type'];
|
||||||
} elseif ( ! isset( $credentials['connection_type'] ) ) { // All else fails (and it's not defaulted to something else saved), default to FTP.
|
} elseif ( ! isset( $credentials['connection_type'] ) ) { // All else fails (and it's not defaulted to something else saved), default to FTP.
|
||||||
$credentials['connection_type'] = 'ftp';
|
$credentials['connection_type'] = 'ftp';
|
||||||
}
|
}
|
||||||
if ( ! $error &&
|
if ( ! $error
|
||||||
(
|
&& ( ( ! empty( $credentials['password'] ) && ! empty( $credentials['username'] ) && ! empty( $credentials['hostname'] ) )
|
||||||
( ! empty( $credentials['password'] ) && ! empty( $credentials['username'] ) && ! empty( $credentials['hostname'] ) ) ||
|
|| ( 'ssh' === $credentials['connection_type'] && ! empty( $credentials['public_key'] ) && ! empty( $credentials['private_key'] ) )
|
||||||
( 'ssh' == $credentials['connection_type'] && ! empty( $credentials['public_key'] ) && ! empty( $credentials['private_key'] ) )
|
)
|
||||||
) ) {
|
) {
|
||||||
$stored_credentials = $credentials;
|
$stored_credentials = $credentials;
|
||||||
|
|
||||||
if ( ! empty( $stored_credentials['port'] ) ) { // Save port as part of hostname to simplify above code.
|
if ( ! empty( $stored_credentials['port'] ) ) { // Save port as part of hostname to simplify above code.
|
||||||
$stored_credentials['hostname'] .= ':' . $stored_credentials['port'];
|
$stored_credentials['hostname'] .= ':' . $stored_credentials['port'];
|
||||||
}
|
}
|
||||||
|
|
||||||
unset( $stored_credentials['password'], $stored_credentials['port'], $stored_credentials['private_key'], $stored_credentials['public_key'] );
|
unset( $stored_credentials['password'], $stored_credentials['port'], $stored_credentials['private_key'], $stored_credentials['public_key'] );
|
||||||
|
|
||||||
if ( ! wp_installing() ) {
|
if ( ! wp_installing() ) {
|
||||||
update_option( 'ftp_credentials', $stored_credentials );
|
update_option( 'ftp_credentials', $stored_credentials );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $credentials;
|
return $credentials;
|
||||||
}
|
}
|
||||||
$hostname = isset( $credentials['hostname'] ) ? $credentials['hostname'] : '';
|
$hostname = isset( $credentials['hostname'] ) ? $credentials['hostname'] : '';
|
||||||
|
@ -2208,7 +2213,7 @@ function request_filesystem_credentials( $form_post, $type = '', $error = false,
|
||||||
<?php
|
<?php
|
||||||
if ( isset( $types['ssh'] ) ) {
|
if ( isset( $types['ssh'] ) ) {
|
||||||
$hidden_class = '';
|
$hidden_class = '';
|
||||||
if ( 'ssh' != $connection_type || empty( $connection_type ) ) {
|
if ( 'ssh' !== $connection_type || empty( $connection_type ) ) {
|
||||||
$hidden_class = ' class="hidden"';
|
$hidden_class = ' class="hidden"';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -2251,9 +2256,11 @@ function request_filesystem_credentials( $form_post, $type = '', $error = false,
|
||||||
*/
|
*/
|
||||||
function wp_print_request_filesystem_credentials_modal() {
|
function wp_print_request_filesystem_credentials_modal() {
|
||||||
$filesystem_method = get_filesystem_method();
|
$filesystem_method = get_filesystem_method();
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
$filesystem_credentials_are_stored = request_filesystem_credentials( self_admin_url() );
|
$filesystem_credentials_are_stored = request_filesystem_credentials( self_admin_url() );
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
|
||||||
$request_filesystem_credentials = ( 'direct' !== $filesystem_method && ! $filesystem_credentials_are_stored );
|
$request_filesystem_credentials = ( 'direct' !== $filesystem_method && ! $filesystem_credentials_are_stored );
|
||||||
if ( ! $request_filesystem_credentials ) {
|
if ( ! $request_filesystem_credentials ) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -776,7 +776,7 @@ function wp_save_image( $post_id ) {
|
||||||
$fwidth = ! empty( $_REQUEST['fwidth'] ) ? intval( $_REQUEST['fwidth'] ) : 0;
|
$fwidth = ! empty( $_REQUEST['fwidth'] ) ? intval( $_REQUEST['fwidth'] ) : 0;
|
||||||
$fheight = ! empty( $_REQUEST['fheight'] ) ? intval( $_REQUEST['fheight'] ) : 0;
|
$fheight = ! empty( $_REQUEST['fheight'] ) ? intval( $_REQUEST['fheight'] ) : 0;
|
||||||
$target = ! empty( $_REQUEST['target'] ) ? preg_replace( '/[^a-z0-9_-]+/i', '', $_REQUEST['target'] ) : '';
|
$target = ! empty( $_REQUEST['target'] ) ? preg_replace( '/[^a-z0-9_-]+/i', '', $_REQUEST['target'] ) : '';
|
||||||
$scale = ! empty( $_REQUEST['do'] ) && 'scale' == $_REQUEST['do'];
|
$scale = ! empty( $_REQUEST['do'] ) && 'scale' === $_REQUEST['do'];
|
||||||
|
|
||||||
if ( $scale && $fwidth > 0 && $fheight > 0 ) {
|
if ( $scale && $fwidth > 0 && $fheight > 0 ) {
|
||||||
$size = $img->get_size();
|
$size = $img->get_size();
|
||||||
|
@ -830,7 +830,7 @@ function wp_save_image( $post_id ) {
|
||||||
if ( defined( 'IMAGE_EDIT_OVERWRITE' ) && IMAGE_EDIT_OVERWRITE &&
|
if ( defined( 'IMAGE_EDIT_OVERWRITE' ) && IMAGE_EDIT_OVERWRITE &&
|
||||||
isset( $backup_sizes['full-orig'] ) && $backup_sizes['full-orig']['file'] != $basename ) {
|
isset( $backup_sizes['full-orig'] ) && $backup_sizes['full-orig']['file'] != $basename ) {
|
||||||
|
|
||||||
if ( 'thumbnail' == $target ) {
|
if ( 'thumbnail' === $target ) {
|
||||||
$new_path = "{$dirname}/{$filename}-temp.{$ext}";
|
$new_path = "{$dirname}/{$filename}-temp.{$ext}";
|
||||||
} else {
|
} else {
|
||||||
$new_path = $path;
|
$new_path = $path;
|
||||||
|
@ -880,16 +880,16 @@ function wp_save_image( $post_id ) {
|
||||||
$meta['width'] = $size['width'];
|
$meta['width'] = $size['width'];
|
||||||
$meta['height'] = $size['height'];
|
$meta['height'] = $size['height'];
|
||||||
|
|
||||||
if ( $success && ( 'nothumb' == $target || 'all' == $target ) ) {
|
if ( $success && ( 'nothumb' === $target || 'all' === $target ) ) {
|
||||||
$sizes = get_intermediate_image_sizes();
|
$sizes = get_intermediate_image_sizes();
|
||||||
if ( 'nothumb' == $target ) {
|
if ( 'nothumb' === $target ) {
|
||||||
$sizes = array_diff( $sizes, array( 'thumbnail' ) );
|
$sizes = array_diff( $sizes, array( 'thumbnail' ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$return->fw = $meta['width'];
|
$return->fw = $meta['width'];
|
||||||
$return->fh = $meta['height'];
|
$return->fh = $meta['height'];
|
||||||
} elseif ( 'thumbnail' == $target ) {
|
} elseif ( 'thumbnail' === $target ) {
|
||||||
$sizes = array( 'thumbnail' );
|
$sizes = array( 'thumbnail' );
|
||||||
$success = true;
|
$success = true;
|
||||||
$delete = true;
|
$delete = true;
|
||||||
|
@ -958,7 +958,7 @@ function wp_save_image( $post_id ) {
|
||||||
|
|
||||||
if ( 'thumbnail' === $target || 'all' === $target || 'full' === $target ) {
|
if ( 'thumbnail' === $target || 'all' === $target || 'full' === $target ) {
|
||||||
// Check if it's an image edit from attachment edit screen.
|
// Check if it's an image edit from attachment edit screen.
|
||||||
if ( ! empty( $_REQUEST['context'] ) && 'edit-attachment' == $_REQUEST['context'] ) {
|
if ( ! empty( $_REQUEST['context'] ) && 'edit-attachment' === $_REQUEST['context'] ) {
|
||||||
$thumb_url = wp_get_attachment_image_src( $post_id, array( 900, 600 ), true );
|
$thumb_url = wp_get_attachment_image_src( $post_id, array( 900, 600 ), true );
|
||||||
$return->thumbnail = $thumb_url[0];
|
$return->thumbnail = $thumb_url[0];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -680,7 +680,7 @@ function get_upload_iframe_src( $type = null, $post_id = null, $tab = null ) {
|
||||||
|
|
||||||
$upload_iframe_src = add_query_arg( 'post_id', (int) $post_id, admin_url( 'media-upload.php' ) );
|
$upload_iframe_src = add_query_arg( 'post_id', (int) $post_id, admin_url( 'media-upload.php' ) );
|
||||||
|
|
||||||
if ( $type && 'media' != $type ) {
|
if ( $type && 'media' !== $type ) {
|
||||||
$upload_iframe_src = add_query_arg( 'type', $type, $upload_iframe_src );
|
$upload_iframe_src = add_query_arg( 'type', $type, $upload_iframe_src );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -865,7 +865,7 @@ function wp_media_upload_handler() {
|
||||||
$src = "http://$src";
|
$src = "http://$src";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $_POST['media_type'] ) && 'image' != $_POST['media_type'] ) {
|
if ( isset( $_POST['media_type'] ) && 'image' !== $_POST['media_type'] ) {
|
||||||
$title = esc_html( wp_unslash( $_POST['title'] ) );
|
$title = esc_html( wp_unslash( $_POST['title'] ) );
|
||||||
if ( empty( $title ) ) {
|
if ( empty( $title ) ) {
|
||||||
$title = esc_html( wp_basename( $src ) );
|
$title = esc_html( wp_basename( $src ) );
|
||||||
|
@ -880,7 +880,7 @@ function wp_media_upload_handler() {
|
||||||
|
|
||||||
if ( $ext ) {
|
if ( $ext ) {
|
||||||
$ext_type = wp_ext2type( $ext );
|
$ext_type = wp_ext2type( $ext );
|
||||||
if ( 'audio' == $ext_type || 'video' == $ext_type ) {
|
if ( 'audio' === $ext_type || 'video' === $ext_type ) {
|
||||||
$type = $ext_type;
|
$type = $ext_type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1159,7 +1159,7 @@ function image_size_input_fields( $post, $check = '' ) {
|
||||||
$checked = '';
|
$checked = '';
|
||||||
|
|
||||||
// Is this size selectable?
|
// Is this size selectable?
|
||||||
$enabled = ( $downsize[3] || 'full' == $size );
|
$enabled = ( $downsize[3] || 'full' === $size );
|
||||||
$css_id = "image-size-{$size}-{$post->ID}";
|
$css_id = "image-size-{$size}-{$post->ID}";
|
||||||
|
|
||||||
// If this size is the default but that's not available, don't select it.
|
// If this size is the default but that's not available, don't select it.
|
||||||
|
@ -1169,7 +1169,7 @@ function image_size_input_fields( $post, $check = '' ) {
|
||||||
} else {
|
} else {
|
||||||
$check = '';
|
$check = '';
|
||||||
}
|
}
|
||||||
} elseif ( ! $check && $enabled && 'thumbnail' != $size ) {
|
} elseif ( ! $check && $enabled && 'thumbnail' !== $size ) {
|
||||||
/*
|
/*
|
||||||
* If $check is not enabled, default to the first available size
|
* If $check is not enabled, default to the first available size
|
||||||
* that's bigger than a thumbnail.
|
* that's bigger than a thumbnail.
|
||||||
|
@ -1302,7 +1302,7 @@ function media_post_single_attachment_fields_to_edit( $form_fields, $post ) {
|
||||||
* @return array Filtered attachment post object.
|
* @return array Filtered attachment post object.
|
||||||
*/
|
*/
|
||||||
function image_attachment_fields_to_save( $post, $attachment ) {
|
function image_attachment_fields_to_save( $post, $attachment ) {
|
||||||
if ( substr( $post['post_mime_type'], 0, 5 ) == 'image' ) {
|
if ( 'image' === substr( $post['post_mime_type'], 0, 5 ) ) {
|
||||||
if ( strlen( trim( $post['post_title'] ) ) == 0 ) {
|
if ( strlen( trim( $post['post_title'] ) ) == 0 ) {
|
||||||
$attachment_url = ( isset( $post['attachment_url'] ) ) ? $post['attachment_url'] : $post['guid'];
|
$attachment_url = ( isset( $post['attachment_url'] ) ) ? $post['attachment_url'] : $post['guid'];
|
||||||
$post['post_title'] = preg_replace( '/\.\w+$/', '', wp_basename( $attachment_url ) );
|
$post['post_title'] = preg_replace( '/\.\w+$/', '', wp_basename( $attachment_url ) );
|
||||||
|
@ -1326,7 +1326,7 @@ function image_attachment_fields_to_save( $post, $attachment ) {
|
||||||
function image_media_send_to_editor( $html, $attachment_id, $attachment ) {
|
function image_media_send_to_editor( $html, $attachment_id, $attachment ) {
|
||||||
$post = get_post( $attachment_id );
|
$post = get_post( $attachment_id );
|
||||||
|
|
||||||
if ( substr( $post->post_mime_type, 0, 5 ) == 'image' ) {
|
if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) {
|
||||||
$url = $attachment['url'];
|
$url = $attachment['url'];
|
||||||
$align = ! empty( $attachment['align'] ) ? $attachment['align'] : 'none';
|
$align = ! empty( $attachment['align'] ) ? $attachment['align'] : 'none';
|
||||||
$size = ! empty( $attachment['image-size'] ) ? $attachment['image-size'] : 'medium';
|
$size = ! empty( $attachment['image-size'] ) ? $attachment['image-size'] : 'medium';
|
||||||
|
@ -1437,7 +1437,7 @@ function get_attachment_fields_to_edit( $post, $errors = null ) {
|
||||||
$form_fields = array_merge_recursive( $form_fields, (array) $errors );
|
$form_fields = array_merge_recursive( $form_fields, (array) $errors );
|
||||||
|
|
||||||
// This was formerly in image_attachment_fields_to_edit().
|
// This was formerly in image_attachment_fields_to_edit().
|
||||||
if ( substr( $post->post_mime_type, 0, 5 ) == 'image' ) {
|
if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) {
|
||||||
$alt = get_post_meta( $post->ID, '_wp_attachment_image_alt', true );
|
$alt = get_post_meta( $post->ID, '_wp_attachment_image_alt', true );
|
||||||
|
|
||||||
if ( empty( $alt ) ) {
|
if ( empty( $alt ) ) {
|
||||||
|
@ -1610,11 +1610,11 @@ function get_media_item( $attachment_id, $args = null ) {
|
||||||
$display_title = ( ! empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case.
|
$display_title = ( ! empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case.
|
||||||
$display_title = $parsed_args['show_title'] ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60, '…' ) . '</span></div>' : '';
|
$display_title = $parsed_args['show_title'] ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60, '…' ) . '</span></div>' : '';
|
||||||
|
|
||||||
$gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' == $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' == $redir_tab ) );
|
$gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' === $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' === $redir_tab ) );
|
||||||
$order = '';
|
$order = '';
|
||||||
|
|
||||||
foreach ( $form_fields as $key => $val ) {
|
foreach ( $form_fields as $key => $val ) {
|
||||||
if ( 'menu_order' == $key ) {
|
if ( 'menu_order' === $key ) {
|
||||||
if ( $gallery ) {
|
if ( $gallery ) {
|
||||||
$order = "<div class='menu_order'> <input class='menu_order_input' type='text' id='attachments[$attachment_id][menu_order]' name='attachments[$attachment_id][menu_order]' value='" . esc_attr( $val['value'] ) . "' /></div>";
|
$order = "<div class='menu_order'> <input class='menu_order_input' type='text' id='attachments[$attachment_id][menu_order]' name='attachments[$attachment_id][menu_order]' value='" . esc_attr( $val['value'] ) . "' /></div>";
|
||||||
} else {
|
} else {
|
||||||
|
@ -1725,8 +1725,11 @@ function get_media_item( $attachment_id, $args = null ) {
|
||||||
$calling_post_id = $post->post_parent;
|
$calling_post_id = $post->post_parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'image' == $type && $calling_post_id && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) )
|
if ( 'image' === $type && $calling_post_id
|
||||||
&& post_type_supports( get_post_type( $calling_post_id ), 'thumbnail' ) && get_post_thumbnail_id( $calling_post_id ) != $attachment_id ) {
|
&& current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) )
|
||||||
|
&& post_type_supports( get_post_type( $calling_post_id ), 'thumbnail' )
|
||||||
|
&& get_post_thumbnail_id( $calling_post_id ) != $attachment_id
|
||||||
|
) {
|
||||||
|
|
||||||
$calling_post = get_post( $calling_post_id );
|
$calling_post = get_post( $calling_post_id );
|
||||||
$calling_post_type_object = get_post_type_object( $calling_post->post_type );
|
$calling_post_type_object = get_post_type_object( $calling_post->post_type );
|
||||||
|
@ -1769,7 +1772,7 @@ function get_media_item( $attachment_id, $args = null ) {
|
||||||
if ( ! empty( $field[ $field['input'] ] ) ) {
|
if ( ! empty( $field[ $field['input'] ] ) ) {
|
||||||
$item .= $field[ $field['input'] ];
|
$item .= $field[ $field['input'] ];
|
||||||
} elseif ( 'textarea' === $field['input'] ) {
|
} elseif ( 'textarea' === $field['input'] ) {
|
||||||
if ( 'post_content' == $id && user_can_richedit() ) {
|
if ( 'post_content' === $id && user_can_richedit() ) {
|
||||||
// Sanitize_post() skips the post_content when user_can_richedit.
|
// Sanitize_post() skips the post_content when user_can_richedit.
|
||||||
$field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES );
|
$field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES );
|
||||||
}
|
}
|
||||||
|
@ -1962,7 +1965,7 @@ function get_compat_media_markup( $attachment_id, $args = null ) {
|
||||||
if ( ! empty( $field[ $field['input'] ] ) ) {
|
if ( ! empty( $field[ $field['input'] ] ) ) {
|
||||||
$item .= $field[ $field['input'] ];
|
$item .= $field[ $field['input'] ];
|
||||||
} elseif ( 'textarea' === $field['input'] ) {
|
} elseif ( 'textarea' === $field['input'] ) {
|
||||||
if ( 'post_content' == $id && user_can_richedit() ) {
|
if ( 'post_content' === $id && user_can_richedit() ) {
|
||||||
// sanitize_post() skips the post_content when user_can_richedit.
|
// sanitize_post() skips the post_content when user_can_richedit.
|
||||||
$field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES );
|
$field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES );
|
||||||
}
|
}
|
||||||
|
@ -2383,7 +2386,7 @@ function media_upload_type_url_form( $type = null, $errors = null, $id = null )
|
||||||
insert : function() {
|
insert : function() {
|
||||||
var t = this, html, f = document.forms[0], cls, title = '', alt = '', caption = '';
|
var t = this, html, f = document.forms[0], cls, title = '', alt = '', caption = '';
|
||||||
|
|
||||||
if ( '' == f.src.value || '' == t.width )
|
if ( '' === f.src.value || '' === t.width )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( f.alt.value )
|
if ( f.alt.value )
|
||||||
|
@ -2890,7 +2893,7 @@ function wp_media_insert_url_form( $default_view = 'image' ) {
|
||||||
$default_align = 'none';
|
$default_align = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'image' == $default_view ) {
|
if ( 'image' === $default_view ) {
|
||||||
$view = 'image-only';
|
$view = 'image-only';
|
||||||
$table_class = '';
|
$table_class = '';
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -333,7 +333,7 @@ unset( $id, $data, $prev_menu_was_separator );
|
||||||
// Remove the last menu item if it is a separator.
|
// Remove the last menu item if it is a separator.
|
||||||
$last_menu_key = array_keys( $menu );
|
$last_menu_key = array_keys( $menu );
|
||||||
$last_menu_key = array_pop( $last_menu_key );
|
$last_menu_key = array_pop( $last_menu_key );
|
||||||
if ( ! empty( $menu ) && 'wp-menu-separator' == $menu[ $last_menu_key ][4] ) {
|
if ( ! empty( $menu ) && 'wp-menu-separator' === $menu[ $last_menu_key ][4] ) {
|
||||||
unset( $menu[ $last_menu_key ] );
|
unset( $menu[ $last_menu_key ] );
|
||||||
}
|
}
|
||||||
unset( $last_menu_key );
|
unset( $last_menu_key );
|
||||||
|
|
|
@ -46,15 +46,15 @@ function post_submit_meta_box( $post, $args = array() ) {
|
||||||
<div id="minor-publishing-actions">
|
<div id="minor-publishing-actions">
|
||||||
<div id="save-action">
|
<div id="save-action">
|
||||||
<?php
|
<?php
|
||||||
if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) {
|
if ( ! in_array( $post->post_status, array( 'publish', 'future', 'pending' ), true ) ) {
|
||||||
$private_style = '';
|
$private_style = '';
|
||||||
if ( 'private' == $post->post_status ) {
|
if ( 'private' === $post->post_status ) {
|
||||||
$private_style = 'style="display:none"';
|
$private_style = 'style="display:none"';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<input <?php echo $private_style; ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e( 'Save Draft' ); ?>" class="button" />
|
<input <?php echo $private_style; ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e( 'Save Draft' ); ?>" class="button" />
|
||||||
<span class="spinner"></span>
|
<span class="spinner"></span>
|
||||||
<?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?>
|
<?php } elseif ( 'pending' === $post->post_status && $can_publish ) { ?>
|
||||||
<input type="submit" name="save" id="save-post" value="<?php esc_attr_e( 'Save as Pending' ); ?>" class="button" />
|
<input type="submit" name="save" id="save-post" value="<?php esc_attr_e( 'Save as Pending' ); ?>" class="button" />
|
||||||
<span class="spinner"></span>
|
<span class="spinner"></span>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
@ -63,7 +63,7 @@ function post_submit_meta_box( $post, $args = array() ) {
|
||||||
<div id="preview-action">
|
<div id="preview-action">
|
||||||
<?php
|
<?php
|
||||||
$preview_link = esc_url( get_preview_post_link( $post ) );
|
$preview_link = esc_url( get_preview_post_link( $post ) );
|
||||||
if ( 'publish' == $post->post_status ) {
|
if ( 'publish' === $post->post_status ) {
|
||||||
$preview_button_text = __( 'Preview Changes' );
|
$preview_button_text = __( 'Preview Changes' );
|
||||||
} else {
|
} else {
|
||||||
$preview_button_text = __( 'Preview' );
|
$preview_button_text = __( 'Preview' );
|
||||||
|
@ -120,27 +120,27 @@ function post_submit_meta_box( $post, $args = array() ) {
|
||||||
?>
|
?>
|
||||||
</span>
|
</span>
|
||||||
<?php
|
<?php
|
||||||
if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) {
|
if ( 'publish' === $post->post_status || 'private' === $post->post_status || $can_publish ) {
|
||||||
$private_style = '';
|
$private_style = '';
|
||||||
if ( 'private' == $post->post_status ) {
|
if ( 'private' === $post->post_status ) {
|
||||||
$private_style = 'style="display:none"';
|
$private_style = 'style="display:none"';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<a href="#post_status" <?php echo $private_style; ?> class="edit-post-status hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit status' ); ?></span></a>
|
<a href="#post_status" <?php echo $private_style; ?> class="edit-post-status hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit status' ); ?></span></a>
|
||||||
|
|
||||||
<div id="post-status-select" class="hide-if-js">
|
<div id="post-status-select" class="hide-if-js">
|
||||||
<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr( ( 'auto-draft' == $post->post_status ) ? 'draft' : $post->post_status ); ?>" />
|
<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr( ( 'auto-draft' === $post->post_status ) ? 'draft' : $post->post_status ); ?>" />
|
||||||
<label for="post_status" class="screen-reader-text"><?php _e( 'Set status' ); ?></label>
|
<label for="post_status" class="screen-reader-text"><?php _e( 'Set status' ); ?></label>
|
||||||
<select name="post_status" id="post_status">
|
<select name="post_status" id="post_status">
|
||||||
<?php if ( 'publish' == $post->post_status ) : ?>
|
<?php if ( 'publish' === $post->post_status ) : ?>
|
||||||
<option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e( 'Published' ); ?></option>
|
<option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e( 'Published' ); ?></option>
|
||||||
<?php elseif ( 'private' == $post->post_status ) : ?>
|
<?php elseif ( 'private' === $post->post_status ) : ?>
|
||||||
<option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e( 'Privately Published' ); ?></option>
|
<option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e( 'Privately Published' ); ?></option>
|
||||||
<?php elseif ( 'future' == $post->post_status ) : ?>
|
<?php elseif ( 'future' === $post->post_status ) : ?>
|
||||||
<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e( 'Scheduled' ); ?></option>
|
<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e( 'Scheduled' ); ?></option>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e( 'Pending Review' ); ?></option>
|
<option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e( 'Pending Review' ); ?></option>
|
||||||
<?php if ( 'auto-draft' == $post->post_status ) : ?>
|
<?php if ( 'auto-draft' === $post->post_status ) : ?>
|
||||||
<option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e( 'Draft' ); ?></option>
|
<option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e( 'Draft' ); ?></option>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e( 'Draft' ); ?></option>
|
<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e( 'Draft' ); ?></option>
|
||||||
|
@ -210,13 +210,13 @@ function post_submit_meta_box( $post, $args = array() ) {
|
||||||
$time_format = _x( 'H:i', 'publish box time format' );
|
$time_format = _x( 'H:i', 'publish box time format' );
|
||||||
|
|
||||||
if ( 0 != $post->ID ) {
|
if ( 0 != $post->ID ) {
|
||||||
if ( 'future' == $post->post_status ) { // Scheduled for publishing at a future date.
|
if ( 'future' === $post->post_status ) { // Scheduled for publishing at a future date.
|
||||||
/* translators: Post date information. %s: Date on which the post is currently scheduled to be published. */
|
/* translators: Post date information. %s: Date on which the post is currently scheduled to be published. */
|
||||||
$stamp = __( 'Scheduled for: %s' );
|
$stamp = __( 'Scheduled for: %s' );
|
||||||
} elseif ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // Already published.
|
} elseif ( 'publish' === $post->post_status || 'private' === $post->post_status ) { // Already published.
|
||||||
/* translators: Post date information. %s: Date on which the post was published. */
|
/* translators: Post date information. %s: Date on which the post was published. */
|
||||||
$stamp = __( 'Published on: %s' );
|
$stamp = __( 'Published on: %s' );
|
||||||
} elseif ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // Draft, 1 or more saves, no date specified.
|
} elseif ( '0000-00-00 00:00:00' === $post->post_date_gmt ) { // Draft, 1 or more saves, no date specified.
|
||||||
$stamp = __( 'Publish <b>immediately</b>' );
|
$stamp = __( 'Publish <b>immediately</b>' );
|
||||||
} elseif ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // Draft, 1 or more saves, future date specified.
|
} elseif ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // Draft, 1 or more saves, future date specified.
|
||||||
/* translators: Post date information. %s: Date on which the post is to be published. */
|
/* translators: Post date information. %s: Date on which the post is to be published. */
|
||||||
|
@ -708,7 +708,8 @@ function post_excerpt_meta_box( $post ) {
|
||||||
function post_trackback_meta_box( $post ) {
|
function post_trackback_meta_box( $post ) {
|
||||||
$form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" value="' .
|
$form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" value="' .
|
||||||
esc_attr( str_replace( "\n", ' ', $post->to_ping ) ) . '" aria-describedby="trackback-url-desc" />';
|
esc_attr( str_replace( "\n", ' ', $post->to_ping ) ) . '" aria-describedby="trackback-url-desc" />';
|
||||||
if ( '' != $post->pinged ) {
|
|
||||||
|
if ( '' !== $post->pinged ) {
|
||||||
$pings = '<p>' . __( 'Already pinged:' ) . '</p><ul>';
|
$pings = '<p>' . __( 'Already pinged:' ) . '</p><ul>';
|
||||||
$already_pinged = explode( "\n", trim( $post->pinged ) );
|
$already_pinged = explode( "\n", trim( $post->pinged ) );
|
||||||
foreach ( $already_pinged as $pinged_url ) {
|
foreach ( $already_pinged as $pinged_url ) {
|
||||||
|
@ -1002,7 +1003,7 @@ function page_attributes_meta_box( $post ) {
|
||||||
*/
|
*/
|
||||||
do_action( 'page_attributes_misc_attributes', $post );
|
do_action( 'page_attributes_misc_attributes', $post );
|
||||||
?>
|
?>
|
||||||
<?php if ( 'page' == $post->post_type && get_current_screen()->get_help_tabs() ) : ?>
|
<?php if ( 'page' === $post->post_type && get_current_screen()->get_help_tabs() ) : ?>
|
||||||
<p class="post-attributes-help-text"><?php _e( 'Need help? Use the Help tab above the screen title.' ); ?></p>
|
<p class="post-attributes-help-text"><?php _e( 'Need help? Use the Help tab above the screen title.' ); ?></p>
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
|
@ -1055,7 +1056,7 @@ function link_submit_meta_box( $link ) {
|
||||||
?>
|
?>
|
||||||
<div id="delete-action">
|
<div id="delete-action">
|
||||||
<?php
|
<?php
|
||||||
if ( ! empty( $_GET['action'] ) && 'edit' == $_GET['action'] && current_user_can( 'manage_links' ) ) {
|
if ( ! empty( $_GET['action'] ) && 'edit' === $_GET['action'] && current_user_can( 'manage_links' ) ) {
|
||||||
printf(
|
printf(
|
||||||
'<a class="submitdelete deletion" href="%s" onclick="return confirm( \'%s\' );">%s</a>',
|
'<a class="submitdelete deletion" href="%s" onclick="return confirm( \'%s\' );">%s</a>',
|
||||||
wp_nonce_url( "link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id ),
|
wp_nonce_url( "link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id ),
|
||||||
|
@ -1182,21 +1183,21 @@ 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, true ) ) {
|
if ( '' !== $value && in_array( $value, $rels, true ) ) {
|
||||||
echo ' checked="checked"';
|
echo ' checked="checked"';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( '' == $value ) {
|
if ( '' === $value ) {
|
||||||
if ( 'family' == $class && strpos( $link_rel, 'child' ) === false && strpos( $link_rel, 'parent' ) === false && strpos( $link_rel, 'sibling' ) === false && strpos( $link_rel, 'spouse' ) === false && strpos( $link_rel, 'kin' ) === false ) {
|
if ( 'family' === $class && strpos( $link_rel, 'child' ) === false && strpos( $link_rel, 'parent' ) === false && strpos( $link_rel, 'sibling' ) === false && strpos( $link_rel, 'spouse' ) === false && strpos( $link_rel, 'kin' ) === false ) {
|
||||||
echo ' checked="checked"';
|
echo ' checked="checked"';
|
||||||
}
|
}
|
||||||
if ( 'friendship' == $class && strpos( $link_rel, 'friend' ) === false && strpos( $link_rel, 'acquaintance' ) === false && strpos( $link_rel, 'contact' ) === false ) {
|
if ( 'friendship' === $class && strpos( $link_rel, 'friend' ) === false && strpos( $link_rel, 'acquaintance' ) === false && strpos( $link_rel, 'contact' ) === false ) {
|
||||||
echo ' checked="checked"';
|
echo ' checked="checked"';
|
||||||
}
|
}
|
||||||
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, true ) ) {
|
if ( 'identity' === $class && in_array( 'me', $rels, true ) ) {
|
||||||
echo ' checked="checked"';
|
echo ' checked="checked"';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1421,7 +1422,7 @@ function register_and_do_post_meta_boxes( $post ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$publish_callback_args = array( '__back_compat_meta_box' => true );
|
$publish_callback_args = array( '__back_compat_meta_box' => true );
|
||||||
if ( post_type_supports( $post_type, 'revisions' ) && 'auto-draft' != $post->post_status ) {
|
if ( post_type_supports( $post_type, 'revisions' ) && 'auto-draft' !== $post->post_status ) {
|
||||||
$revisions = wp_get_post_revisions( $post->ID );
|
$revisions = wp_get_post_revisions( $post->ID );
|
||||||
|
|
||||||
// We should aim to show the revisions meta box only when there are revisions.
|
// We should aim to show the revisions meta box only when there are revisions.
|
||||||
|
@ -1436,7 +1437,7 @@ function register_and_do_post_meta_boxes( $post ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'attachment' == $post_type ) {
|
if ( 'attachment' === $post_type ) {
|
||||||
wp_enqueue_script( 'image-edit' );
|
wp_enqueue_script( 'image-edit' );
|
||||||
wp_enqueue_style( 'imgareaselect' );
|
wp_enqueue_style( 'imgareaselect' );
|
||||||
add_meta_box( 'submitdiv', __( 'Save' ), 'attachment_submit_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) );
|
add_meta_box( 'submitdiv', __( 'Save' ), 'attachment_submit_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) );
|
||||||
|
@ -1543,7 +1544,7 @@ function register_and_do_post_meta_boxes( $post ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) {
|
if ( ! ( 'pending' === get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) {
|
||||||
add_meta_box( 'slugdiv', __( 'Slug' ), 'post_slug_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
|
add_meta_box( 'slugdiv', __( 'Slug' ), 'post_slug_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -597,7 +597,7 @@ function wp_doc_link_parse( $content ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
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' ), true ) )
|
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] )
|
|| ( isset( $tokens[ $t - 2 ][0] ) && T_OBJECT_OPERATOR == $tokens[ $t - 1 ][0] )
|
||||||
|
|
|
@ -696,7 +696,7 @@ function site_admin_notice() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'upgrade.php' == $pagenow ) {
|
if ( 'upgrade.php' === $pagenow ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -873,7 +873,7 @@ function confirm_delete_users( $users ) {
|
||||||
<?php
|
<?php
|
||||||
$allusers = (array) $_POST['allusers'];
|
$allusers = (array) $_POST['allusers'];
|
||||||
foreach ( $allusers as $user_id ) {
|
foreach ( $allusers as $user_id ) {
|
||||||
if ( '' != $user_id && '0' != $user_id ) {
|
if ( '' !== $user_id && '0' != $user_id ) {
|
||||||
$delete_user = get_userdata( $user_id );
|
$delete_user = get_userdata( $user_id );
|
||||||
|
|
||||||
if ( ! current_user_can( 'delete_user', $delete_user->ID ) ) {
|
if ( ! current_user_can( 'delete_user', $delete_user->ID ) ) {
|
||||||
|
@ -935,7 +935,7 @@ function confirm_delete_users( $users ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( '' == $user_list ) {
|
if ( '' === $user_list ) {
|
||||||
$user_list = $admin_out;
|
$user_list = $admin_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,17 +31,17 @@ function _wp_ajax_menu_quick_search( $request = array() ) {
|
||||||
$response_format = 'json';
|
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'get-post-item' == $type ) {
|
if ( 'get-post-item' === $type ) {
|
||||||
if ( post_type_exists( $object_type ) ) {
|
if ( post_type_exists( $object_type ) ) {
|
||||||
if ( isset( $request['ID'] ) ) {
|
if ( isset( $request['ID'] ) ) {
|
||||||
$object_id = (int) $request['ID'];
|
$object_id = (int) $request['ID'];
|
||||||
if ( 'markup' == $response_format ) {
|
if ( 'markup' === $response_format ) {
|
||||||
echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', array( get_post( $object_id ) ) ), 0, (object) $args );
|
echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', array( get_post( $object_id ) ) ), 0, (object) $args );
|
||||||
} elseif ( 'json' == $response_format ) {
|
} elseif ( 'json' === $response_format ) {
|
||||||
echo wp_json_encode(
|
echo wp_json_encode(
|
||||||
array(
|
array(
|
||||||
'ID' => $object_id,
|
'ID' => $object_id,
|
||||||
|
@ -55,9 +55,9 @@ function _wp_ajax_menu_quick_search( $request = array() ) {
|
||||||
} elseif ( taxonomy_exists( $object_type ) ) {
|
} elseif ( taxonomy_exists( $object_type ) ) {
|
||||||
if ( isset( $request['ID'] ) ) {
|
if ( isset( $request['ID'] ) ) {
|
||||||
$object_id = (int) $request['ID'];
|
$object_id = (int) $request['ID'];
|
||||||
if ( 'markup' == $response_format ) {
|
if ( 'markup' === $response_format ) {
|
||||||
echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', array( get_term( $object_id, $object_type ) ) ), 0, (object) $args );
|
echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', array( get_term( $object_id, $object_type ) ) ), 0, (object) $args );
|
||||||
} elseif ( 'json' == $response_format ) {
|
} elseif ( 'json' === $response_format ) {
|
||||||
$post_obj = get_term( $object_id, $object_type );
|
$post_obj = get_term( $object_id, $object_type );
|
||||||
echo wp_json_encode(
|
echo wp_json_encode(
|
||||||
array(
|
array(
|
||||||
|
@ -71,7 +71,7 @@ function _wp_ajax_menu_quick_search( $request = array() ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ( preg_match( '/quick-search-(posttype|taxonomy)-([a-zA-Z_-]*\b)/', $type, $matches ) ) {
|
} elseif ( preg_match( '/quick-search-(posttype|taxonomy)-([a-zA-Z_-]*\b)/', $type, $matches ) ) {
|
||||||
if ( 'posttype' == $matches[1] && get_post_type_object( $matches[2] ) ) {
|
if ( 'posttype' === $matches[1] && get_post_type_object( $matches[2] ) ) {
|
||||||
$post_type_obj = _wp_nav_menu_meta_box_object( get_post_type_object( $matches[2] ) );
|
$post_type_obj = _wp_nav_menu_meta_box_object( get_post_type_object( $matches[2] ) );
|
||||||
$args = array_merge(
|
$args = array_merge(
|
||||||
$args,
|
$args,
|
||||||
|
@ -93,10 +93,10 @@ function _wp_ajax_menu_quick_search( $request = array() ) {
|
||||||
}
|
}
|
||||||
while ( $search_results_query->have_posts() ) {
|
while ( $search_results_query->have_posts() ) {
|
||||||
$post = $search_results_query->next_post();
|
$post = $search_results_query->next_post();
|
||||||
if ( 'markup' == $response_format ) {
|
if ( 'markup' === $response_format ) {
|
||||||
$var_by_ref = $post->ID;
|
$var_by_ref = $post->ID;
|
||||||
echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', array( get_post( $var_by_ref ) ) ), 0, (object) $args );
|
echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', array( get_post( $var_by_ref ) ) ), 0, (object) $args );
|
||||||
} elseif ( 'json' == $response_format ) {
|
} elseif ( 'json' === $response_format ) {
|
||||||
echo wp_json_encode(
|
echo wp_json_encode(
|
||||||
array(
|
array(
|
||||||
'ID' => $post->ID,
|
'ID' => $post->ID,
|
||||||
|
@ -107,7 +107,7 @@ function _wp_ajax_menu_quick_search( $request = array() ) {
|
||||||
echo "\n";
|
echo "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ( 'taxonomy' == $matches[1] ) {
|
} elseif ( 'taxonomy' === $matches[1] ) {
|
||||||
$terms = get_terms(
|
$terms = get_terms(
|
||||||
array(
|
array(
|
||||||
'taxonomy' => $matches[2],
|
'taxonomy' => $matches[2],
|
||||||
|
@ -120,9 +120,9 @@ function _wp_ajax_menu_quick_search( $request = array() ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
foreach ( (array) $terms as $term ) {
|
foreach ( (array) $terms as $term ) {
|
||||||
if ( 'markup' == $response_format ) {
|
if ( 'markup' === $response_format ) {
|
||||||
echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', array( $term ) ), 0, (object) $args );
|
echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', array( $term ) ), 0, (object) $args );
|
||||||
} elseif ( 'json' == $response_format ) {
|
} elseif ( 'json' === $response_format ) {
|
||||||
echo wp_json_encode(
|
echo wp_json_encode(
|
||||||
array(
|
array(
|
||||||
'ID' => $term->term_id,
|
'ID' => $term->term_id,
|
||||||
|
@ -231,7 +231,7 @@ function wp_nav_menu_post_type_meta_boxes() {
|
||||||
if ( $post_type ) {
|
if ( $post_type ) {
|
||||||
$id = $post_type->name;
|
$id = $post_type->name;
|
||||||
// Give pages a higher priority.
|
// Give pages a higher priority.
|
||||||
$priority = ( 'page' == $post_type->name ? 'core' : 'default' );
|
$priority = ( 'page' === $post_type->name ? 'core' : 'default' );
|
||||||
add_meta_box( "add-post-type-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', $priority, $post_type );
|
add_meta_box( "add-post-type-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', $priority, $post_type );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -368,11 +368,11 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) {
|
||||||
* Posts Page and Privacy Policy Page at the top of the list.
|
* Posts Page and Privacy Policy Page at the top of the list.
|
||||||
*/
|
*/
|
||||||
$important_pages = array();
|
$important_pages = array();
|
||||||
if ( 'page' == $post_type_name ) {
|
if ( 'page' === $post_type_name ) {
|
||||||
$suppress_page_ids = array();
|
$suppress_page_ids = array();
|
||||||
|
|
||||||
// Insert Front Page or custom Home link.
|
// Insert Front Page or custom Home link.
|
||||||
$front_page = 'page' == get_option( 'show_on_front' ) ? (int) get_option( 'page_on_front' ) : 0;
|
$front_page = 'page' === get_option( 'show_on_front' ) ? (int) get_option( 'page_on_front' ) : 0;
|
||||||
|
|
||||||
$front_page_obj = null;
|
$front_page_obj = null;
|
||||||
if ( ! empty( $front_page ) ) {
|
if ( ! empty( $front_page ) ) {
|
||||||
|
@ -400,7 +400,7 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert Posts Page.
|
// Insert Posts Page.
|
||||||
$posts_page = 'page' == get_option( 'show_on_front' ) ? (int) get_option( 'page_for_posts' ) : 0;
|
$posts_page = 'page' === get_option( 'show_on_front' ) ? (int) get_option( 'page_for_posts' ) : 0;
|
||||||
|
|
||||||
if ( ! empty( $posts_page ) ) {
|
if ( ! empty( $posts_page ) ) {
|
||||||
$posts_page_obj = get_post( $posts_page );
|
$posts_page_obj = get_post( $posts_page );
|
||||||
|
@ -508,24 +508,24 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) {
|
||||||
?>
|
?>
|
||||||
<div id="posttype-<?php echo $post_type_name; ?>" class="posttypediv">
|
<div id="posttype-<?php echo $post_type_name; ?>" class="posttypediv">
|
||||||
<ul id="posttype-<?php echo $post_type_name; ?>-tabs" class="posttype-tabs add-menu-item-tabs">
|
<ul id="posttype-<?php echo $post_type_name; ?>-tabs" class="posttype-tabs add-menu-item-tabs">
|
||||||
<li <?php echo ( 'most-recent' == $current_tab ? ' class="tabs"' : '' ); ?>>
|
<li <?php echo ( 'most-recent' === $current_tab ? ' class="tabs"' : '' ); ?>>
|
||||||
<a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr( $post_type_name ); ?>-most-recent" href="<?php echo $most_recent_url; ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent">
|
<a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr( $post_type_name ); ?>-most-recent" href="<?php echo $most_recent_url; ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent">
|
||||||
<?php _e( 'Most Recent' ); ?>
|
<?php _e( 'Most Recent' ); ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>>
|
<li <?php echo ( 'all' === $current_tab ? ' class="tabs"' : '' ); ?>>
|
||||||
<a class="nav-tab-link" data-type="<?php echo esc_attr( $post_type_name ); ?>-all" href="<?php echo $view_all_url; ?>#<?php echo $post_type_name; ?>-all">
|
<a class="nav-tab-link" data-type="<?php echo esc_attr( $post_type_name ); ?>-all" href="<?php echo $view_all_url; ?>#<?php echo $post_type_name; ?>-all">
|
||||||
<?php _e( 'View All' ); ?>
|
<?php _e( 'View All' ); ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>>
|
<li <?php echo ( 'search' === $current_tab ? ' class="tabs"' : '' ); ?>>
|
||||||
<a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr( $post_type_name ); ?>-search" href="<?php echo $search_url; ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-search">
|
<a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr( $post_type_name ); ?>-search" href="<?php echo $search_url; ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-search">
|
||||||
<?php _e( 'Search' ); ?>
|
<?php _e( 'Search' ); ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul><!-- .posttype-tabs -->
|
</ul><!-- .posttype-tabs -->
|
||||||
|
|
||||||
<div id="tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent" class="tabs-panel <?php echo ( 'most-recent' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" role="region" aria-label="<?php _e( 'Most Recent' ); ?>" tabindex="0">
|
<div id="tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent" class="tabs-panel <?php echo ( 'most-recent' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" role="region" aria-label="<?php _e( 'Most Recent' ); ?>" tabindex="0">
|
||||||
<ul id="<?php echo $post_type_name; ?>checklist-most-recent" class="categorychecklist form-no-clear">
|
<ul id="<?php echo $post_type_name; ?>checklist-most-recent" class="categorychecklist form-no-clear">
|
||||||
<?php
|
<?php
|
||||||
$recent_args = array_merge(
|
$recent_args = array_merge(
|
||||||
|
@ -560,7 +560,7 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) {
|
||||||
</ul>
|
</ul>
|
||||||
</div><!-- /.tabs-panel -->
|
</div><!-- /.tabs-panel -->
|
||||||
|
|
||||||
<div class="tabs-panel <?php echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" id="tabs-panel-posttype-<?php echo $post_type_name; ?>-search" role="region" aria-label="<?php echo $post_type->labels->search_items; ?>" tabindex="0">
|
<div class="tabs-panel <?php echo ( 'search' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" id="tabs-panel-posttype-<?php echo $post_type_name; ?>-search" role="region" aria-label="<?php echo $post_type->labels->search_items; ?>" tabindex="0">
|
||||||
<?php
|
<?php
|
||||||
if ( isset( $_REQUEST[ 'quick-search-posttype-' . $post_type_name ] ) ) {
|
if ( isset( $_REQUEST[ 'quick-search-posttype-' . $post_type_name ] ) ) {
|
||||||
$searched = esc_attr( $_REQUEST[ 'quick-search-posttype-' . $post_type_name ] );
|
$searched = esc_attr( $_REQUEST[ 'quick-search-posttype-' . $post_type_name ] );
|
||||||
|
@ -598,7 +598,7 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) {
|
||||||
</ul>
|
</ul>
|
||||||
</div><!-- /.tabs-panel -->
|
</div><!-- /.tabs-panel -->
|
||||||
|
|
||||||
<div id="<?php echo $post_type_name; ?>-all" class="tabs-panel tabs-panel-view-all <?php echo ( 'all' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" role="region" aria-label="<?php echo $post_type->labels->all_items; ?>" tabindex="0">
|
<div id="<?php echo $post_type_name; ?>-all" class="tabs-panel tabs-panel-view-all <?php echo ( 'all' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" role="region" aria-label="<?php echo $post_type->labels->all_items; ?>" tabindex="0">
|
||||||
<?php if ( ! empty( $page_links ) ) : ?>
|
<?php if ( ! empty( $page_links ) ) : ?>
|
||||||
<div class="add-menu-item-pagelinks">
|
<div class="add-menu-item-pagelinks">
|
||||||
<?php echo $page_links; ?>
|
<?php echo $page_links; ?>
|
||||||
|
@ -795,24 +795,24 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $box ) {
|
||||||
?>
|
?>
|
||||||
<div id="taxonomy-<?php echo $taxonomy_name; ?>" class="taxonomydiv">
|
<div id="taxonomy-<?php echo $taxonomy_name; ?>" class="taxonomydiv">
|
||||||
<ul id="taxonomy-<?php echo $taxonomy_name; ?>-tabs" class="taxonomy-tabs add-menu-item-tabs">
|
<ul id="taxonomy-<?php echo $taxonomy_name; ?>-tabs" class="taxonomy-tabs add-menu-item-tabs">
|
||||||
<li <?php echo ( 'most-used' == $current_tab ? ' class="tabs"' : '' ); ?>>
|
<li <?php echo ( 'most-used' === $current_tab ? ' class="tabs"' : '' ); ?>>
|
||||||
<a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr( $taxonomy_name ); ?>-pop" href="<?php echo $most_used_url; ?>#tabs-panel-<?php echo $taxonomy_name; ?>-pop">
|
<a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr( $taxonomy_name ); ?>-pop" href="<?php echo $most_used_url; ?>#tabs-panel-<?php echo $taxonomy_name; ?>-pop">
|
||||||
<?php echo esc_html( $taxonomy->labels->most_used ); ?>
|
<?php echo esc_html( $taxonomy->labels->most_used ); ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>>
|
<li <?php echo ( 'all' === $current_tab ? ' class="tabs"' : '' ); ?>>
|
||||||
<a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr( $taxonomy_name ); ?>-all" href="<?php echo $view_all_url; ?>#tabs-panel-<?php echo $taxonomy_name; ?>-all">
|
<a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr( $taxonomy_name ); ?>-all" href="<?php echo $view_all_url; ?>#tabs-panel-<?php echo $taxonomy_name; ?>-all">
|
||||||
<?php _e( 'View All' ); ?>
|
<?php _e( 'View All' ); ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>>
|
<li <?php echo ( 'search' === $current_tab ? ' class="tabs"' : '' ); ?>>
|
||||||
<a class="nav-tab-link" data-type="tabs-panel-search-taxonomy-<?php echo esc_attr( $taxonomy_name ); ?>" href="<?php echo $search_url; ?>#tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>">
|
<a class="nav-tab-link" data-type="tabs-panel-search-taxonomy-<?php echo esc_attr( $taxonomy_name ); ?>" href="<?php echo $search_url; ?>#tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>">
|
||||||
<?php _e( 'Search' ); ?>
|
<?php _e( 'Search' ); ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul><!-- .taxonomy-tabs -->
|
</ul><!-- .taxonomy-tabs -->
|
||||||
|
|
||||||
<div id="tabs-panel-<?php echo $taxonomy_name; ?>-pop" class="tabs-panel <?php echo ( 'most-used' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" role="region" aria-label="<?php echo $taxonomy->labels->most_used; ?>" tabindex="0">
|
<div id="tabs-panel-<?php echo $taxonomy_name; ?>-pop" class="tabs-panel <?php echo ( 'most-used' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" role="region" aria-label="<?php echo $taxonomy->labels->most_used; ?>" tabindex="0">
|
||||||
<ul id="<?php echo $taxonomy_name; ?>checklist-pop" class="categorychecklist form-no-clear" >
|
<ul id="<?php echo $taxonomy_name; ?>checklist-pop" class="categorychecklist form-no-clear" >
|
||||||
<?php
|
<?php
|
||||||
$popular_terms = get_terms(
|
$popular_terms = get_terms(
|
||||||
|
@ -830,7 +830,7 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $box ) {
|
||||||
</ul>
|
</ul>
|
||||||
</div><!-- /.tabs-panel -->
|
</div><!-- /.tabs-panel -->
|
||||||
|
|
||||||
<div id="tabs-panel-<?php echo $taxonomy_name; ?>-all" class="tabs-panel tabs-panel-view-all <?php echo ( 'all' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" role="region" aria-label="<?php echo $taxonomy->labels->all_items; ?>" tabindex="0">
|
<div id="tabs-panel-<?php echo $taxonomy_name; ?>-all" class="tabs-panel tabs-panel-view-all <?php echo ( 'all' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" role="region" aria-label="<?php echo $taxonomy->labels->all_items; ?>" tabindex="0">
|
||||||
<?php if ( ! empty( $page_links ) ) : ?>
|
<?php if ( ! empty( $page_links ) ) : ?>
|
||||||
<div class="add-menu-item-pagelinks">
|
<div class="add-menu-item-pagelinks">
|
||||||
<?php echo $page_links; ?>
|
<?php echo $page_links; ?>
|
||||||
|
@ -849,7 +849,7 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $box ) {
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div><!-- /.tabs-panel -->
|
</div><!-- /.tabs-panel -->
|
||||||
|
|
||||||
<div class="tabs-panel <?php echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" id="tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>" role="region" aria-label="<?php echo $taxonomy->labels->search_items; ?>" tabindex="0">
|
<div class="tabs-panel <?php echo ( 'search' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" id="tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>" role="region" aria-label="<?php echo $taxonomy->labels->search_items; ?>" tabindex="0">
|
||||||
<?php
|
<?php
|
||||||
if ( isset( $_REQUEST[ 'quick-search-taxonomy-' . $taxonomy_name ] ) ) {
|
if ( isset( $_REQUEST[ 'quick-search-taxonomy-' . $taxonomy_name ] ) ) {
|
||||||
$searched = esc_attr( $_REQUEST[ 'quick-search-taxonomy-' . $taxonomy_name ] );
|
$searched = esc_attr( $_REQUEST[ 'quick-search-taxonomy-' . $taxonomy_name ] );
|
||||||
|
@ -931,7 +931,7 @@ function wp_save_nav_menu_items( $menu_id = 0, $menu_data = array() ) {
|
||||||
// Or URL is the default.
|
// Or URL is the default.
|
||||||
in_array( $_item_object_data['menu-item-url'], array( 'https://', 'http://', '' ), true ) ||
|
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.
|
||||||
! empty( $_item_object_data['menu-item-db-id'] )
|
! empty( $_item_object_data['menu-item-db-id'] )
|
||||||
)
|
)
|
||||||
|
@ -987,20 +987,20 @@ function wp_save_nav_menu_items( $menu_id = 0, $menu_data = array() ) {
|
||||||
function _wp_nav_menu_meta_box_object( $object = null ) {
|
function _wp_nav_menu_meta_box_object( $object = null ) {
|
||||||
if ( isset( $object->name ) ) {
|
if ( isset( $object->name ) ) {
|
||||||
|
|
||||||
if ( 'page' == $object->name ) {
|
if ( 'page' === $object->name ) {
|
||||||
$object->_default_query = array(
|
$object->_default_query = array(
|
||||||
'orderby' => 'menu_order title',
|
'orderby' => 'menu_order title',
|
||||||
'post_status' => 'publish',
|
'post_status' => 'publish',
|
||||||
);
|
);
|
||||||
|
|
||||||
// Posts should show only published items.
|
// Posts should show only published items.
|
||||||
} elseif ( 'post' == $object->name ) {
|
} elseif ( 'post' === $object->name ) {
|
||||||
$object->_default_query = array(
|
$object->_default_query = array(
|
||||||
'post_status' => 'publish',
|
'post_status' => 'publish',
|
||||||
);
|
);
|
||||||
|
|
||||||
// Categories should be in reverse chronological order.
|
// Categories should be in reverse chronological order.
|
||||||
} elseif ( 'category' == $object->name ) {
|
} elseif ( 'category' === $object->name ) {
|
||||||
$object->_default_query = array(
|
$object->_default_query = array(
|
||||||
'orderby' => 'id',
|
'orderby' => 'id',
|
||||||
'order' => 'DESC',
|
'order' => 'DESC',
|
||||||
|
@ -1066,7 +1066,7 @@ function wp_get_nav_menu_to_edit( $menu_id = 0 ) {
|
||||||
$some_pending_menu_items = false;
|
$some_pending_menu_items = false;
|
||||||
$some_invalid_menu_items = false;
|
$some_invalid_menu_items = false;
|
||||||
foreach ( (array) $menu_items as $menu_item ) {
|
foreach ( (array) $menu_items as $menu_item ) {
|
||||||
if ( isset( $menu_item->post_status ) && 'draft' == $menu_item->post_status ) {
|
if ( isset( $menu_item->post_status ) && 'draft' === $menu_item->post_status ) {
|
||||||
$some_pending_menu_items = true;
|
$some_pending_menu_items = true;
|
||||||
}
|
}
|
||||||
if ( ! empty( $menu_item->_invalid ) ) {
|
if ( ! empty( $menu_item->_invalid ) ) {
|
||||||
|
@ -1182,7 +1182,7 @@ function wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selecte
|
||||||
foreach ( (array) $_POST['menu-item-db-id'] as $_key => $k ) {
|
foreach ( (array) $_POST['menu-item-db-id'] as $_key => $k ) {
|
||||||
|
|
||||||
// Menu item title can't be blank.
|
// Menu item title can't be blank.
|
||||||
if ( ! isset( $_POST['menu-item-title'][ $_key ] ) || '' == $_POST['menu-item-title'][ $_key ] ) {
|
if ( ! isset( $_POST['menu-item-title'][ $_key ] ) || '' === $_POST['menu-item-title'][ $_key ] ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,16 +49,17 @@ function options_general_add_js() {
|
||||||
$siteName.text( title );
|
$siteName.text( title );
|
||||||
});
|
});
|
||||||
|
|
||||||
$("input[name='date_format']").click(function(){
|
$( 'input[name="date_format"]' ).click( function() {
|
||||||
if ( "date_format_custom_radio" != $(this).attr("id") )
|
if ( 'date_format_custom_radio' !== $(this).attr( 'id' ) )
|
||||||
$( 'input[name="date_format_custom"]' ).val( $( this ).val() ).closest( 'fieldset' ).find( '.example' ).text( $( this ).parent( 'label' ).children( '.format-i18n' ).text() );
|
$( 'input[name="date_format_custom"]' ).val( $( this ).val() ).closest( 'fieldset' ).find( '.example' ).text( $( this ).parent( 'label' ).children( '.format-i18n' ).text() );
|
||||||
});
|
});
|
||||||
|
|
||||||
$( 'input[name="date_format_custom"]' ).on( 'click input', function() {
|
$( 'input[name="date_format_custom"]' ).on( 'click input', function() {
|
||||||
$( '#date_format_custom_radio' ).prop( 'checked', true );
|
$( '#date_format_custom_radio' ).prop( 'checked', true );
|
||||||
});
|
});
|
||||||
|
|
||||||
$("input[name='time_format']").click(function(){
|
$( 'input[name="time_format"]' ).click( function() {
|
||||||
if ( "time_format_custom_radio" != $(this).attr("id") )
|
if ( 'time_format_custom_radio' !== $(this).attr( 'id' ) )
|
||||||
$( 'input[name="time_format_custom"]' ).val( $( this ).val() ).closest( 'fieldset' ).find( '.example' ).text( $( this ).parent( 'label' ).children( '.format-i18n' ).text() );
|
$( 'input[name="time_format_custom"]' ).val( $( this ).val() ).closest( 'fieldset' ).find( '.example' ).text( $( this ).parent( 'label' ).children( '.format-i18n' ).text() );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -80,7 +81,7 @@ function options_general_add_js() {
|
||||||
spinner.addClass( 'is-active' );
|
spinner.addClass( 'is-active' );
|
||||||
|
|
||||||
$.post( ajaxurl, {
|
$.post( ajaxurl, {
|
||||||
action: 'date_format_custom' == format.attr( 'name' ) ? 'date_format' : 'time_format',
|
action: 'date_format_custom' === format.attr( 'name' ) ? 'date_format' : 'time_format',
|
||||||
date : format.val()
|
date : format.val()
|
||||||
}, function( d ) { spinner.removeClass( 'is-active' ); example.text( d ); } );
|
}, function( d ) { spinner.removeClass( 'is-active' ); example.text( d ); } );
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ function plugins_api( $action, $args = array() ) {
|
||||||
$args = (object) $args;
|
$args = (object) $args;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'query_plugins' == $action ) {
|
if ( 'query_plugins' === $action ) {
|
||||||
if ( ! isset( $args->per_page ) ) {
|
if ( ! isset( $args->per_page ) ) {
|
||||||
$args->per_page = 24;
|
$args->per_page = 24;
|
||||||
}
|
}
|
||||||
|
@ -462,7 +462,7 @@ function install_plugin_install_status( $api, $loop = false ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'install' == $status ) {
|
if ( 'install' === $status ) {
|
||||||
if ( is_dir( WP_PLUGIN_DIR . '/' . $api->slug ) ) {
|
if ( is_dir( WP_PLUGIN_DIR . '/' . $api->slug ) ) {
|
||||||
$installed_plugin = get_plugins( '/' . $api->slug );
|
$installed_plugin = get_plugins( '/' . $api->slug );
|
||||||
if ( empty( $installed_plugin ) ) {
|
if ( empty( $installed_plugin ) ) {
|
||||||
|
|
|
@ -91,7 +91,7 @@ function get_plugin_data( $plugin_file, $markup = true, $translate = true ) {
|
||||||
_deprecated_argument( __FUNCTION__, '3.0.0', sprintf( __( 'The %1$s plugin header is deprecated. Use %2$s instead.' ), '<code>Site Wide Only: true</code>', '<code>Network: true</code>' ) );
|
_deprecated_argument( __FUNCTION__, '3.0.0', sprintf( __( 'The %1$s plugin header is deprecated. Use %2$s instead.' ), '<code>Site Wide Only: true</code>', '<code>Network: true</code>' ) );
|
||||||
$plugin_data['Network'] = $plugin_data['_sitewide'];
|
$plugin_data['Network'] = $plugin_data['_sitewide'];
|
||||||
}
|
}
|
||||||
$plugin_data['Network'] = ( 'true' == strtolower( $plugin_data['Network'] ) );
|
$plugin_data['Network'] = ( 'true' === strtolower( $plugin_data['Network'] ) );
|
||||||
unset( $plugin_data['_sitewide'] );
|
unset( $plugin_data['_sitewide'] );
|
||||||
|
|
||||||
// If no text domain is defined fall back to the plugin slug.
|
// If no text domain is defined fall back to the plugin slug.
|
||||||
|
@ -156,7 +156,7 @@ function _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup
|
||||||
load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) );
|
load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ( 'hello.php' == basename( $plugin_file ) ) {
|
} elseif ( 'hello.php' === basename( $plugin_file ) ) {
|
||||||
$textdomain = 'default';
|
$textdomain = 'default';
|
||||||
}
|
}
|
||||||
if ( $textdomain ) {
|
if ( $textdomain ) {
|
||||||
|
@ -295,30 +295,36 @@ function get_plugins( $plugin_folder = '' ) {
|
||||||
// Files in wp-content/plugins directory.
|
// Files in wp-content/plugins directory.
|
||||||
$plugins_dir = @ opendir( $plugin_root );
|
$plugins_dir = @ opendir( $plugin_root );
|
||||||
$plugin_files = array();
|
$plugin_files = array();
|
||||||
|
|
||||||
if ( $plugins_dir ) {
|
if ( $plugins_dir ) {
|
||||||
while ( ( $file = readdir( $plugins_dir ) ) !== false ) {
|
while ( ( $file = readdir( $plugins_dir ) ) !== false ) {
|
||||||
if ( substr( $file, 0, 1 ) == '.' ) {
|
if ( '.' === substr( $file, 0, 1 ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( is_dir( $plugin_root . '/' . $file ) ) {
|
if ( is_dir( $plugin_root . '/' . $file ) ) {
|
||||||
$plugins_subdir = @ opendir( $plugin_root . '/' . $file );
|
$plugins_subdir = @ opendir( $plugin_root . '/' . $file );
|
||||||
|
|
||||||
if ( $plugins_subdir ) {
|
if ( $plugins_subdir ) {
|
||||||
while ( ( $subfile = readdir( $plugins_subdir ) ) !== false ) {
|
while ( ( $subfile = readdir( $plugins_subdir ) ) !== false ) {
|
||||||
if ( substr( $subfile, 0, 1 ) == '.' ) {
|
if ( '.' === substr( $subfile, 0, 1 ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( substr( $subfile, -4 ) == '.php' ) {
|
|
||||||
|
if ( '.php' === substr( $subfile, -4 ) ) {
|
||||||
$plugin_files[] = "$file/$subfile";
|
$plugin_files[] = "$file/$subfile";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir( $plugins_subdir );
|
closedir( $plugins_subdir );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( substr( $file, -4 ) == '.php' ) {
|
if ( '.php' === substr( $file, -4 ) ) {
|
||||||
$plugin_files[] = $file;
|
$plugin_files[] = $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir( $plugins_dir );
|
closedir( $plugins_dir );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,7 +375,7 @@ function get_mu_plugins() {
|
||||||
$plugins_dir = @opendir( WPMU_PLUGIN_DIR );
|
$plugins_dir = @opendir( WPMU_PLUGIN_DIR );
|
||||||
if ( $plugins_dir ) {
|
if ( $plugins_dir ) {
|
||||||
while ( ( $file = readdir( $plugins_dir ) ) !== false ) {
|
while ( ( $file = readdir( $plugins_dir ) ) !== false ) {
|
||||||
if ( substr( $file, -4 ) == '.php' ) {
|
if ( '.php' === substr( $file, -4 ) ) {
|
||||||
$plugin_files[] = $file;
|
$plugin_files[] = $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1444,7 +1450,7 @@ function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability,
|
||||||
* Backward-compatibility for plugins using add_management_page().
|
* Backward-compatibility for plugins using add_management_page().
|
||||||
* See wp-admin/admin.php for redirect from edit.php to tools.php.
|
* See wp-admin/admin.php for redirect from edit.php to tools.php.
|
||||||
*/
|
*/
|
||||||
if ( 'tools.php' == $parent_slug ) {
|
if ( 'tools.php' === $parent_slug ) {
|
||||||
$_registered_pages[ get_plugin_page_hookname( $menu_slug, 'edit.php' ) ] = true;
|
$_registered_pages[ get_plugin_page_hookname( $menu_slug, 'edit.php' ) ] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1836,7 +1842,7 @@ function get_admin_page_parent( $parent = '' ) {
|
||||||
global $parent_file, $menu, $submenu, $pagenow, $typenow,
|
global $parent_file, $menu, $submenu, $pagenow, $typenow,
|
||||||
$plugin_page, $_wp_real_parent_file, $_wp_menu_nopriv, $_wp_submenu_nopriv;
|
$plugin_page, $_wp_real_parent_file, $_wp_menu_nopriv, $_wp_submenu_nopriv;
|
||||||
|
|
||||||
if ( ! empty( $parent ) && 'admin.php' != $parent ) {
|
if ( ! empty( $parent ) && 'admin.php' !== $parent ) {
|
||||||
if ( isset( $_wp_real_parent_file[ $parent ] ) ) {
|
if ( isset( $_wp_real_parent_file[ $parent ] ) ) {
|
||||||
$parent = $_wp_real_parent_file[ $parent ];
|
$parent = $_wp_real_parent_file[ $parent ];
|
||||||
}
|
}
|
||||||
|
@ -2018,7 +2024,7 @@ function get_plugin_page_hookname( $plugin_page, $parent_page ) {
|
||||||
$parent = get_admin_page_parent( $parent_page );
|
$parent = get_admin_page_parent( $parent_page );
|
||||||
|
|
||||||
$page_type = 'admin';
|
$page_type = 'admin';
|
||||||
if ( empty( $parent_page ) || 'admin.php' == $parent_page || isset( $admin_page_hooks[ $plugin_page ] ) ) {
|
if ( empty( $parent_page ) || 'admin.php' === $parent_page || isset( $admin_page_hooks[ $plugin_page ] ) ) {
|
||||||
if ( isset( $admin_page_hooks[ $plugin_page ] ) ) {
|
if ( isset( $admin_page_hooks[ $plugin_page ] ) ) {
|
||||||
$page_type = 'toplevel';
|
$page_type = 'toplevel';
|
||||||
} elseif ( isset( $admin_page_hooks[ $parent ] ) ) {
|
} elseif ( isset( $admin_page_hooks[ $parent ] ) ) {
|
||||||
|
@ -2165,7 +2171,7 @@ function option_update_filter( $options ) {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function add_option_whitelist( $new_options, $options = '' ) {
|
function add_option_whitelist( $new_options, $options = '' ) {
|
||||||
if ( '' == $options ) {
|
if ( '' === $options ) {
|
||||||
global $whitelist_options;
|
global $whitelist_options;
|
||||||
} else {
|
} else {
|
||||||
$whitelist_options = $options;
|
$whitelist_options = $options;
|
||||||
|
@ -2200,7 +2206,7 @@ function add_option_whitelist( $new_options, $options = '' ) {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function remove_option_whitelist( $del_options, $options = '' ) {
|
function remove_option_whitelist( $del_options, $options = '' ) {
|
||||||
if ( '' == $options ) {
|
if ( '' === $options ) {
|
||||||
global $whitelist_options;
|
global $whitelist_options;
|
||||||
} else {
|
} else {
|
||||||
$whitelist_options = $options;
|
$whitelist_options = $options;
|
||||||
|
|
|
@ -30,13 +30,13 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
|
||||||
$ptype = get_post_type_object( $post_data['post_type'] );
|
$ptype = get_post_type_object( $post_data['post_type'] );
|
||||||
|
|
||||||
if ( $update && ! current_user_can( 'edit_post', $post_data['ID'] ) ) {
|
if ( $update && ! current_user_can( 'edit_post', $post_data['ID'] ) ) {
|
||||||
if ( 'page' == $post_data['post_type'] ) {
|
if ( 'page' === $post_data['post_type'] ) {
|
||||||
return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to edit pages as this user.' ) );
|
return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to edit pages as this user.' ) );
|
||||||
} else {
|
} else {
|
||||||
return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to edit posts as this user.' ) );
|
return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to edit posts as this user.' ) );
|
||||||
}
|
}
|
||||||
} elseif ( ! $update && ! current_user_can( $ptype->cap->create_posts ) ) {
|
} elseif ( ! $update && ! current_user_can( $ptype->cap->create_posts ) ) {
|
||||||
if ( 'page' == $post_data['post_type'] ) {
|
if ( 'page' === $post_data['post_type'] ) {
|
||||||
return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to create pages as this user.' ) );
|
return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to create pages as this user.' ) );
|
||||||
} else {
|
} else {
|
||||||
return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to create posts as this user.' ) );
|
return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to create posts as this user.' ) );
|
||||||
|
@ -75,13 +75,13 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
|
||||||
&& ! current_user_can( $ptype->cap->edit_others_posts ) ) {
|
&& ! current_user_can( $ptype->cap->edit_others_posts ) ) {
|
||||||
|
|
||||||
if ( $update ) {
|
if ( $update ) {
|
||||||
if ( 'page' == $post_data['post_type'] ) {
|
if ( 'page' === $post_data['post_type'] ) {
|
||||||
return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to edit pages as this user.' ) );
|
return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to edit pages as this user.' ) );
|
||||||
} else {
|
} else {
|
||||||
return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to edit posts as this user.' ) );
|
return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to edit posts as this user.' ) );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( 'page' == $post_data['post_type'] ) {
|
if ( 'page' === $post_data['post_type'] ) {
|
||||||
return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to create pages as this user.' ) );
|
return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to create pages as this user.' ) );
|
||||||
} else {
|
} else {
|
||||||
return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to create posts as this user.' ) );
|
return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to create posts as this user.' ) );
|
||||||
|
@ -103,19 +103,21 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// What to do based on which button they pressed.
|
// What to do based on which button they pressed.
|
||||||
if ( isset( $post_data['saveasdraft'] ) && '' != $post_data['saveasdraft'] ) {
|
if ( isset( $post_data['saveasdraft'] ) && '' !== $post_data['saveasdraft'] ) {
|
||||||
$post_data['post_status'] = 'draft';
|
$post_data['post_status'] = 'draft';
|
||||||
}
|
}
|
||||||
if ( isset( $post_data['saveasprivate'] ) && '' != $post_data['saveasprivate'] ) {
|
if ( isset( $post_data['saveasprivate'] ) && '' !== $post_data['saveasprivate'] ) {
|
||||||
$post_data['post_status'] = 'private';
|
$post_data['post_status'] = 'private';
|
||||||
}
|
}
|
||||||
if ( isset( $post_data['publish'] ) && ( '' != $post_data['publish'] ) && ( ! isset( $post_data['post_status'] ) || 'private' !== $post_data['post_status'] ) ) {
|
if ( isset( $post_data['publish'] ) && ( '' !== $post_data['publish'] )
|
||||||
|
&& ( ! isset( $post_data['post_status'] ) || 'private' !== $post_data['post_status'] )
|
||||||
|
) {
|
||||||
$post_data['post_status'] = 'publish';
|
$post_data['post_status'] = 'publish';
|
||||||
}
|
}
|
||||||
if ( isset( $post_data['advanced'] ) && '' != $post_data['advanced'] ) {
|
if ( isset( $post_data['advanced'] ) && '' !== $post_data['advanced'] ) {
|
||||||
$post_data['post_status'] = 'draft';
|
$post_data['post_status'] = 'draft';
|
||||||
}
|
}
|
||||||
if ( isset( $post_data['pending'] ) && '' != $post_data['pending'] ) {
|
if ( isset( $post_data['pending'] ) && '' !== $post_data['pending'] ) {
|
||||||
$post_data['post_status'] = 'pending';
|
$post_data['post_status'] = 'pending';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +128,7 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
|
||||||
}
|
}
|
||||||
$previous_status = $post_id ? get_post_field( 'post_status', $post_id ) : false;
|
$previous_status = $post_id ? get_post_field( 'post_status', $post_id ) : false;
|
||||||
|
|
||||||
if ( isset( $post_data['post_status'] ) && 'private' == $post_data['post_status'] && ! current_user_can( $ptype->cap->publish_posts ) ) {
|
if ( isset( $post_data['post_status'] ) && 'private' === $post_data['post_status'] && ! current_user_can( $ptype->cap->publish_posts ) ) {
|
||||||
$post_data['post_status'] = $previous_status ? $previous_status : 'pending';
|
$post_data['post_status'] = $previous_status ? $previous_status : 'pending';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,14 +249,14 @@ function edit_post( $post_data = null ) {
|
||||||
if ( ! empty( $post_data['post_status'] ) ) {
|
if ( ! empty( $post_data['post_status'] ) ) {
|
||||||
$post_data['post_status'] = sanitize_key( $post_data['post_status'] );
|
$post_data['post_status'] = sanitize_key( $post_data['post_status'] );
|
||||||
|
|
||||||
if ( 'inherit' == $post_data['post_status'] ) {
|
if ( 'inherit' === $post_data['post_status'] ) {
|
||||||
unset( $post_data['post_status'] );
|
unset( $post_data['post_status'] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$ptype = get_post_type_object( $post_data['post_type'] );
|
$ptype = get_post_type_object( $post_data['post_type'] );
|
||||||
if ( ! current_user_can( 'edit_post', $post_ID ) ) {
|
if ( ! current_user_can( 'edit_post', $post_ID ) ) {
|
||||||
if ( 'page' == $post_data['post_type'] ) {
|
if ( 'page' === $post_data['post_type'] ) {
|
||||||
wp_die( __( 'Sorry, you are not allowed to edit this page.' ) );
|
wp_die( __( 'Sorry, you are not allowed to edit this page.' ) );
|
||||||
} else {
|
} else {
|
||||||
wp_die( __( 'Sorry, you are not allowed to edit this post.' ) );
|
wp_die( __( 'Sorry, you are not allowed to edit this post.' ) );
|
||||||
|
@ -376,7 +378,7 @@ function edit_post( $post_data = null ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attachment stuff.
|
// Attachment stuff.
|
||||||
if ( 'attachment' == $post_data['post_type'] ) {
|
if ( 'attachment' === $post_data['post_type'] ) {
|
||||||
if ( isset( $post_data['_wp_attachment_image_alt'] ) ) {
|
if ( isset( $post_data['_wp_attachment_image_alt'] ) ) {
|
||||||
$image_alt = wp_unslash( $post_data['_wp_attachment_image_alt'] );
|
$image_alt = wp_unslash( $post_data['_wp_attachment_image_alt'] );
|
||||||
|
|
||||||
|
@ -467,7 +469,7 @@ function bulk_edit_posts( $post_data = null ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! current_user_can( $ptype->cap->edit_posts ) ) {
|
if ( ! current_user_can( $ptype->cap->edit_posts ) ) {
|
||||||
if ( 'page' == $ptype->name ) {
|
if ( 'page' === $ptype->name ) {
|
||||||
wp_die( __( 'Sorry, you are not allowed to edit pages.' ) );
|
wp_die( __( 'Sorry, you are not allowed to edit pages.' ) );
|
||||||
} else {
|
} else {
|
||||||
wp_die( __( 'Sorry, you are not allowed to edit posts.' ) );
|
wp_die( __( 'Sorry, you are not allowed to edit posts.' ) );
|
||||||
|
@ -485,7 +487,7 @@ function bulk_edit_posts( $post_data = null ) {
|
||||||
if ( ! empty( $post_data['post_status'] ) ) {
|
if ( ! empty( $post_data['post_status'] ) ) {
|
||||||
$post_data['post_status'] = sanitize_key( $post_data['post_status'] );
|
$post_data['post_status'] = sanitize_key( $post_data['post_status'] );
|
||||||
|
|
||||||
if ( 'inherit' == $post_data['post_status'] ) {
|
if ( 'inherit' === $post_data['post_status'] ) {
|
||||||
unset( $post_data['post_status'] );
|
unset( $post_data['post_status'] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -508,7 +510,7 @@ function bulk_edit_posts( $post_data = null ) {
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ( $reset as $field ) {
|
foreach ( $reset as $field ) {
|
||||||
if ( isset( $post_data[ $field ] ) && ( '' == $post_data[ $field ] || -1 == $post_data[ $field ] ) ) {
|
if ( isset( $post_data[ $field ] ) && ( '' === $post_data[ $field ] || -1 == $post_data[ $field ] ) ) {
|
||||||
unset( $post_data[ $field ] );
|
unset( $post_data[ $field ] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -632,7 +634,7 @@ function bulk_edit_posts( $post_data = null ) {
|
||||||
$updated[] = wp_update_post( $post_data );
|
$updated[] = wp_update_post( $post_data );
|
||||||
|
|
||||||
if ( isset( $post_data['sticky'] ) && current_user_can( $ptype->cap->edit_others_posts ) ) {
|
if ( isset( $post_data['sticky'] ) && current_user_can( $ptype->cap->edit_others_posts ) ) {
|
||||||
if ( 'sticky' == $post_data['sticky'] ) {
|
if ( 'sticky' === $post_data['sticky'] ) {
|
||||||
stick_post( $post_ID );
|
stick_post( $post_ID );
|
||||||
} else {
|
} else {
|
||||||
unstick_post( $post_ID );
|
unstick_post( $post_ID );
|
||||||
|
@ -813,7 +815,7 @@ function wp_write_post() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! current_user_can( $ptype->cap->edit_posts ) ) {
|
if ( ! current_user_can( $ptype->cap->edit_posts ) ) {
|
||||||
if ( 'page' == $ptype->name ) {
|
if ( 'page' === $ptype->name ) {
|
||||||
return new WP_Error( 'edit_pages', __( 'Sorry, you are not allowed to create pages on this site.' ) );
|
return new WP_Error( 'edit_pages', __( 'Sorry, you are not allowed to create pages on this site.' ) );
|
||||||
} else {
|
} else {
|
||||||
return new WP_Error( 'edit_posts', __( 'Sorry, you are not allowed to create posts or drafts on this site.' ) );
|
return new WP_Error( 'edit_posts', __( 'Sorry, you are not allowed to create posts or drafts on this site.' ) );
|
||||||
|
@ -912,12 +914,12 @@ function add_meta( $post_ID ) {
|
||||||
$metavalue = trim( $metavalue );
|
$metavalue = trim( $metavalue );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ( ( '#NONE#' != $metakeyselect ) && ! empty( $metakeyselect ) ) || ! empty( $metakeyinput ) ) {
|
if ( ( ( '#NONE#' !== $metakeyselect ) && ! empty( $metakeyselect ) ) || ! empty( $metakeyinput ) ) {
|
||||||
/*
|
/*
|
||||||
* We have a key/value pair. If both the select and the input
|
* We have a key/value pair. If both the select and the input
|
||||||
* for the key have data, the input takes precedence.
|
* for the key have data, the input takes precedence.
|
||||||
*/
|
*/
|
||||||
if ( '#NONE#' != $metakeyselect ) {
|
if ( '#NONE#' !== $metakeyselect ) {
|
||||||
$metakey = $metakeyselect;
|
$metakey = $metakeyselect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1143,7 +1145,7 @@ function wp_edit_posts_query( $q = false ) {
|
||||||
|
|
||||||
if ( isset( $q['order'] ) ) {
|
if ( isset( $q['order'] ) ) {
|
||||||
$order = $q['order'];
|
$order = $q['order'];
|
||||||
} elseif ( isset( $q['post_status'] ) && 'pending' == $q['post_status'] ) {
|
} elseif ( isset( $q['post_status'] ) && 'pending' === $q['post_status'] ) {
|
||||||
$order = 'ASC';
|
$order = 'ASC';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1220,8 +1222,8 @@ function wp_edit_attachments_query_vars( $q = false ) {
|
||||||
$states .= ',private';
|
$states .= ',private';
|
||||||
}
|
}
|
||||||
|
|
||||||
$q['post_status'] = isset( $q['status'] ) && 'trash' == $q['status'] ? 'trash' : $states;
|
$q['post_status'] = isset( $q['status'] ) && 'trash' === $q['status'] ? 'trash' : $states;
|
||||||
$q['post_status'] = isset( $q['attachment-filter'] ) && 'trash' == $q['attachment-filter'] ? 'trash' : $states;
|
$q['post_status'] = isset( $q['attachment-filter'] ) && 'trash' === $q['attachment-filter'] ? 'trash' : $states;
|
||||||
|
|
||||||
$media_per_page = (int) get_user_option( 'upload_per_page' );
|
$media_per_page = (int) get_user_option( 'upload_per_page' );
|
||||||
if ( empty( $media_per_page ) || $media_per_page < 1 ) {
|
if ( empty( $media_per_page ) || $media_per_page < 1 ) {
|
||||||
|
@ -1243,17 +1245,17 @@ function wp_edit_attachments_query_vars( $q = false ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ( array_keys( $post_mime_types ) as $type ) {
|
foreach ( array_keys( $post_mime_types ) as $type ) {
|
||||||
if ( isset( $q['attachment-filter'] ) && "post_mime_type:$type" == $q['attachment-filter'] ) {
|
if ( isset( $q['attachment-filter'] ) && "post_mime_type:$type" === $q['attachment-filter'] ) {
|
||||||
$q['post_mime_type'] = $type;
|
$q['post_mime_type'] = $type;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $q['detached'] ) || ( isset( $q['attachment-filter'] ) && 'detached' == $q['attachment-filter'] ) ) {
|
if ( isset( $q['detached'] ) || ( isset( $q['attachment-filter'] ) && 'detached' === $q['attachment-filter'] ) ) {
|
||||||
$q['post_parent'] = 0;
|
$q['post_parent'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $q['mine'] ) || ( isset( $q['attachment-filter'] ) && 'mine' == $q['attachment-filter'] ) ) {
|
if ( isset( $q['mine'] ) || ( isset( $q['attachment-filter'] ) && 'mine' === $q['attachment-filter'] ) ) {
|
||||||
$q['author'] = get_current_user_id();
|
$q['author'] = get_current_user_id();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1458,7 +1460,9 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encourage a pretty permalink setting.
|
// Encourage a pretty permalink setting.
|
||||||
if ( '' == get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) && ! ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $id ) ) {
|
if ( ! get_option( 'permalink_structure' ) && current_user_can( 'manage_options' )
|
||||||
|
&& ! ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $id )
|
||||||
|
) {
|
||||||
$return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __( 'Change Permalinks' ) . "</a></span>\n";
|
$return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __( 'Change Permalinks' ) . "</a></span>\n";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1682,7 +1686,7 @@ function _admin_notice_post_locked() {
|
||||||
} else {
|
} else {
|
||||||
$sendback = admin_url( 'edit.php' );
|
$sendback = admin_url( 'edit.php' );
|
||||||
|
|
||||||
if ( 'post' != $post->post_type ) {
|
if ( 'post' !== $post->post_type ) {
|
||||||
$sendback = add_query_arg( 'post_type', $post->post_type, $sendback );
|
$sendback = add_query_arg( 'post_type', $post->post_type, $sendback );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1700,7 +1704,7 @@ function _admin_notice_post_locked() {
|
||||||
if ( $locked ) {
|
if ( $locked ) {
|
||||||
$query_args = array();
|
$query_args = array();
|
||||||
if ( get_post_type_object( $post->post_type )->public ) {
|
if ( get_post_type_object( $post->post_type )->public ) {
|
||||||
if ( 'publish' == $post->post_status || $user->ID != $post->post_author ) {
|
if ( 'publish' === $post->post_status || $user->ID != $post->post_author ) {
|
||||||
// Latest content is in autosave.
|
// Latest content is in autosave.
|
||||||
$nonce = wp_create_nonce( 'post_preview_' . $post->ID );
|
$nonce = wp_create_nonce( 'post_preview_' . $post->ID );
|
||||||
$query_args['preview_id'] = $post->ID;
|
$query_args['preview_id'] = $post->ID;
|
||||||
|
@ -1888,12 +1892,14 @@ function post_preview() {
|
||||||
|
|
||||||
$is_autosave = false;
|
$is_autosave = false;
|
||||||
|
|
||||||
if ( ! wp_check_post_lock( $post->ID ) && get_current_user_id() == $post->post_author && ( 'draft' == $post->post_status || 'auto-draft' == $post->post_status ) ) {
|
if ( ! wp_check_post_lock( $post->ID ) && get_current_user_id() == $post->post_author
|
||||||
|
&& ( 'draft' === $post->post_status || 'auto-draft' === $post->post_status )
|
||||||
|
) {
|
||||||
$saved_post_id = edit_post();
|
$saved_post_id = edit_post();
|
||||||
} else {
|
} else {
|
||||||
$is_autosave = true;
|
$is_autosave = true;
|
||||||
|
|
||||||
if ( isset( $_POST['post_status'] ) && 'auto-draft' == $_POST['post_status'] ) {
|
if ( isset( $_POST['post_status'] ) && 'auto-draft' === $_POST['post_status'] ) {
|
||||||
$_POST['post_status'] = 'draft';
|
$_POST['post_status'] = 'draft';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1953,7 +1959,7 @@ function wp_autosave( $post_data ) {
|
||||||
return new WP_Error( 'edit_posts', __( 'Sorry, you are not allowed to edit this item.' ) );
|
return new WP_Error( 'edit_posts', __( 'Sorry, you are not allowed to edit this item.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'auto-draft' == $post->post_status ) {
|
if ( 'auto-draft' === $post->post_status ) {
|
||||||
$post_data['post_status'] = 'draft';
|
$post_data['post_status'] = 'draft';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1961,7 +1967,9 @@ function wp_autosave( $post_data ) {
|
||||||
$post_data['post_category'] = explode( ',', $post_data['catslist'] );
|
$post_data['post_category'] = explode( ',', $post_data['catslist'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! wp_check_post_lock( $post->ID ) && get_current_user_id() == $post->post_author && ( 'auto-draft' == $post->post_status || 'draft' == $post->post_status ) ) {
|
if ( ! wp_check_post_lock( $post->ID ) && get_current_user_id() == $post->post_author
|
||||||
|
&& ( 'auto-draft' === $post->post_status || 'draft' === $post->post_status )
|
||||||
|
) {
|
||||||
// Drafts and auto-drafts are just overwritten by autosave for the same user if the post is not locked.
|
// Drafts and auto-drafts are just overwritten by autosave for the same user if the post is not locked.
|
||||||
return edit_post( wp_slash( $post_data ) );
|
return edit_post( wp_slash( $post_data ) );
|
||||||
} else {
|
} else {
|
||||||
|
@ -1994,7 +2002,7 @@ function redirect_post( $post_id = '' ) {
|
||||||
$message = 6;
|
$message = 6;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$message = 'draft' == $status ? 10 : 1;
|
$message = 'draft' === $status ? 10 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$location = add_query_arg( 'message', $message, get_edit_post_link( $post_id, 'url' ) );
|
$location = add_query_arg( 'message', $message, get_edit_post_link( $post_id, 'url' ) );
|
||||||
|
|
|
@ -958,10 +958,10 @@ function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam
|
||||||
global $wpdb, $current_site, $wp_rewrite;
|
global $wpdb, $current_site, $wp_rewrite;
|
||||||
|
|
||||||
$errors = new WP_Error();
|
$errors = new WP_Error();
|
||||||
if ( '' == $domain ) {
|
if ( '' === $domain ) {
|
||||||
$errors->add( 'empty_domain', __( 'You must provide a domain name.' ) );
|
$errors->add( 'empty_domain', __( 'You must provide a domain name.' ) );
|
||||||
}
|
}
|
||||||
if ( '' == $site_name ) {
|
if ( '' === $site_name ) {
|
||||||
$errors->add( 'empty_sitename', __( 'You must provide a name for your network of sites.' ) );
|
$errors->add( 'empty_sitename', __( 'You must provide a name for your network of sites.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ function meta_box_prefs( $screen ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Submit box cannot be hidden.
|
// Submit box cannot be hidden.
|
||||||
if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] ) {
|
if ( 'submitdiv' === $box['id'] || 'linksubmitdiv' === $box['id'] ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,8 +161,8 @@ function get_hidden_meta_boxes( $screen ) {
|
||||||
// Hide slug boxes by default.
|
// Hide slug boxes by default.
|
||||||
if ( $use_defaults ) {
|
if ( $use_defaults ) {
|
||||||
$hidden = array();
|
$hidden = array();
|
||||||
if ( 'post' == $screen->base ) {
|
if ( 'post' === $screen->base ) {
|
||||||
if ( 'post' == $screen->post_type || 'page' == $screen->post_type || 'attachment' == $screen->post_type ) {
|
if ( in_array( $screen->post_type, array( 'post', 'page', 'attachment' ), true ) ) {
|
||||||
$hidden = array( 'slugdiv', 'trackbacksdiv', 'postcustom', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv' );
|
$hidden = array( 'slugdiv', 'trackbacksdiv', 'postcustom', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv' );
|
||||||
} else {
|
} else {
|
||||||
$hidden = array( 'slugdiv' );
|
$hidden = array( 'slugdiv' );
|
||||||
|
|
|
@ -129,7 +129,7 @@ function wp_insert_category( $catarr, $wp_error = false ) {
|
||||||
);
|
);
|
||||||
$catarr = wp_parse_args( $catarr, $cat_defaults );
|
$catarr = wp_parse_args( $catarr, $cat_defaults );
|
||||||
|
|
||||||
if ( trim( $catarr['cat_name'] ) == '' ) {
|
if ( '' === trim( $catarr['cat_name'] ) ) {
|
||||||
if ( ! $wp_error ) {
|
if ( ! $wp_error ) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2330,7 +2330,7 @@ function compression_test() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 2 == test ) {
|
if ( 2 == test ) {
|
||||||
if ( '"wpCompressionTest' == r )
|
if ( '"wpCompressionTest' === r )
|
||||||
this.get('yes');
|
this.get('yes');
|
||||||
else
|
else
|
||||||
this.get('no');
|
this.get('no');
|
||||||
|
|
|
@ -471,7 +471,7 @@ function themes_api( $action, $args = array() ) {
|
||||||
$args = (object) $args;
|
$args = (object) $args;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'query_themes' == $action ) {
|
if ( 'query_themes' === $action ) {
|
||||||
if ( ! isset( $args->per_page ) ) {
|
if ( ! isset( $args->per_page ) ) {
|
||||||
$args->per_page = 24;
|
$args->per_page = 24;
|
||||||
}
|
}
|
||||||
|
@ -583,13 +583,13 @@ function themes_api( $action, $args = array() ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Back-compat for info/1.2 API, upgrade the theme objects in query_themes to objects.
|
// Back-compat for info/1.2 API, upgrade the theme objects in query_themes to objects.
|
||||||
if ( 'query_themes' == $action ) {
|
if ( 'query_themes' === $action ) {
|
||||||
foreach ( $res->themes as $i => $theme ) {
|
foreach ( $res->themes as $i => $theme ) {
|
||||||
$res->themes[ $i ] = (object) $theme;
|
$res->themes[ $i ] = (object) $theme;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Back-compat for info/1.2 API, downgrade the feature_list result back to an array.
|
// Back-compat for info/1.2 API, downgrade the feature_list result back to an array.
|
||||||
if ( 'feature_list' == $action ) {
|
if ( 'feature_list' === $action ) {
|
||||||
$res = (array) $res;
|
$res = (array) $res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1041,7 +1041,7 @@ function update_core( $from, $to ) {
|
||||||
}
|
}
|
||||||
if ( is_array( $checksums ) ) {
|
if ( is_array( $checksums ) ) {
|
||||||
foreach ( $checksums as $file => $checksum ) {
|
foreach ( $checksums as $file => $checksum ) {
|
||||||
if ( 'wp-content' == substr( $file, 0, 10 ) ) {
|
if ( 'wp-content' === substr( $file, 0, 10 ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( ! file_exists( ABSPATH . $file ) ) {
|
if ( ! file_exists( ABSPATH . $file ) ) {
|
||||||
|
@ -1114,7 +1114,7 @@ function update_core( $from, $to ) {
|
||||||
$failed = array();
|
$failed = array();
|
||||||
if ( isset( $checksums ) && is_array( $checksums ) ) {
|
if ( isset( $checksums ) && is_array( $checksums ) ) {
|
||||||
foreach ( $checksums as $file => $checksum ) {
|
foreach ( $checksums as $file => $checksum ) {
|
||||||
if ( 'wp-content' == substr( $file, 0, 10 ) ) {
|
if ( 'wp-content' === substr( $file, 0, 10 ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( ! file_exists( $working_dir_local . $file ) ) {
|
if ( ! file_exists( $working_dir_local . $file ) ) {
|
||||||
|
@ -1187,7 +1187,7 @@ function update_core( $from, $to ) {
|
||||||
$wp_filesystem->delete( $maintenance_file );
|
$wp_filesystem->delete( $maintenance_file );
|
||||||
|
|
||||||
// 3.5 -> 3.5+ - an empty twentytwelve directory was created upon upgrade to 3.5 for some users, preventing installation of Twenty Twelve.
|
// 3.5 -> 3.5+ - an empty twentytwelve directory was created upon upgrade to 3.5 for some users, preventing installation of Twenty Twelve.
|
||||||
if ( '3.5' == $old_wp_version ) {
|
if ( '3.5' === $old_wp_version ) {
|
||||||
if ( is_dir( WP_CONTENT_DIR . '/themes/twentytwelve' ) && ! file_exists( WP_CONTENT_DIR . '/themes/twentytwelve/style.css' ) ) {
|
if ( is_dir( WP_CONTENT_DIR . '/themes/twentytwelve' ) && ! file_exists( WP_CONTENT_DIR . '/themes/twentytwelve/style.css' ) ) {
|
||||||
$wp_filesystem->delete( $wp_filesystem->wp_themes_dir() . 'twentytwelve/' );
|
$wp_filesystem->delete( $wp_filesystem->wp_themes_dir() . 'twentytwelve/' );
|
||||||
}
|
}
|
||||||
|
@ -1203,17 +1203,18 @@ function update_core( $from, $to ) {
|
||||||
foreach ( (array) $_new_bundled_files as $file => $introduced_version ) {
|
foreach ( (array) $_new_bundled_files as $file => $introduced_version ) {
|
||||||
// If a $development_build or if $introduced version is greater than what the site was previously running.
|
// If a $development_build or if $introduced version is greater than what the site was previously running.
|
||||||
if ( $development_build || version_compare( $introduced_version, $old_wp_version, '>' ) ) {
|
if ( $development_build || version_compare( $introduced_version, $old_wp_version, '>' ) ) {
|
||||||
$directory = ( '/' == $file[ strlen( $file ) - 1 ] );
|
$directory = ( '/' === $file[ strlen( $file ) - 1 ] );
|
||||||
list($type, $filename) = explode( '/', $file, 2 );
|
|
||||||
|
list( $type, $filename ) = explode( '/', $file, 2 );
|
||||||
|
|
||||||
// Check to see if the bundled items exist before attempting to copy them.
|
// Check to see if the bundled items exist before attempting to copy them.
|
||||||
if ( ! $wp_filesystem->exists( $from . $distro . 'wp-content/' . $file ) ) {
|
if ( ! $wp_filesystem->exists( $from . $distro . 'wp-content/' . $file ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'plugins' == $type ) {
|
if ( 'plugins' === $type ) {
|
||||||
$dest = $wp_filesystem->wp_plugins_dir();
|
$dest = $wp_filesystem->wp_plugins_dir();
|
||||||
} elseif ( 'themes' == $type ) {
|
} elseif ( 'themes' === $type ) {
|
||||||
// Back-compat, ::wp_themes_dir() did not return trailingslash'd pre-3.2.
|
// Back-compat, ::wp_themes_dir() did not return trailingslash'd pre-3.2.
|
||||||
$dest = trailingslashit( $wp_filesystem->wp_themes_dir() );
|
$dest = trailingslashit( $wp_filesystem->wp_themes_dir() );
|
||||||
} else {
|
} else {
|
||||||
|
@ -1343,7 +1344,7 @@ function _copy_dir( $from, $to, $skip_list = array() ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'f' == $fileinfo['type'] ) {
|
if ( 'f' === $fileinfo['type'] ) {
|
||||||
if ( ! $wp_filesystem->copy( $from . $filename, $to . $filename, true, FS_CHMOD_FILE ) ) {
|
if ( ! $wp_filesystem->copy( $from . $filename, $to . $filename, true, FS_CHMOD_FILE ) ) {
|
||||||
// If copy failed, chmod file to 0644 and try again.
|
// If copy failed, chmod file to 0644 and try again.
|
||||||
$wp_filesystem->chmod( $to . $filename, FS_CHMOD_FILE );
|
$wp_filesystem->chmod( $to . $filename, FS_CHMOD_FILE );
|
||||||
|
@ -1351,7 +1352,7 @@ function _copy_dir( $from, $to, $skip_list = array() ) {
|
||||||
return new WP_Error( 'copy_failed__copy_dir', __( 'Could not copy file.' ), $to . $filename );
|
return new WP_Error( 'copy_failed__copy_dir', __( 'Could not copy file.' ), $to . $filename );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ( 'd' == $fileinfo['type'] ) {
|
} elseif ( 'd' === $fileinfo['type'] ) {
|
||||||
if ( ! $wp_filesystem->is_dir( $to . $filename ) ) {
|
if ( ! $wp_filesystem->is_dir( $to . $filename ) ) {
|
||||||
if ( ! $wp_filesystem->mkdir( $to . $filename, FS_CHMOD_DIR ) ) {
|
if ( ! $wp_filesystem->mkdir( $to . $filename, FS_CHMOD_DIR ) ) {
|
||||||
return new WP_Error( 'mkdir_failed__copy_dir', __( 'Could not create directory.' ), $to . $filename );
|
return new WP_Error( 'mkdir_failed__copy_dir', __( 'Could not create directory.' ), $to . $filename );
|
||||||
|
@ -1399,11 +1400,11 @@ function _redirect_to_about_wordpress( $new_version ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure we only run this on the update-core.php page. The Core_Upgrader may be used in other contexts.
|
// Ensure we only run this on the update-core.php page. The Core_Upgrader may be used in other contexts.
|
||||||
if ( 'update-core.php' != $pagenow ) {
|
if ( 'update-core.php' !== $pagenow ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'do-core-upgrade' != $action && 'do-core-reinstall' != $action ) {
|
if ( 'do-core-upgrade' !== $action && 'do-core-reinstall' !== $action ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ function find_core_auto_update() {
|
||||||
$auto_update = false;
|
$auto_update = false;
|
||||||
$upgrader = new WP_Automatic_Updater;
|
$upgrader = new WP_Automatic_Updater;
|
||||||
foreach ( $updates->updates as $update ) {
|
foreach ( $updates->updates as $update ) {
|
||||||
if ( 'autoupdate' != $update->response ) {
|
if ( 'autoupdate' !== $update->response ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ function update_nag() {
|
||||||
|
|
||||||
global $pagenow;
|
global $pagenow;
|
||||||
|
|
||||||
if ( 'update-core.php' == $pagenow ) {
|
if ( 'update-core.php' === $pagenow ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -862,7 +862,7 @@ function upgrade_100() {
|
||||||
$posts = $wpdb->get_results( "SELECT ID, post_title, post_name FROM $wpdb->posts WHERE post_name = ''" );
|
$posts = $wpdb->get_results( "SELECT ID, post_title, post_name FROM $wpdb->posts WHERE post_name = ''" );
|
||||||
if ( $posts ) {
|
if ( $posts ) {
|
||||||
foreach ( $posts as $post ) {
|
foreach ( $posts as $post ) {
|
||||||
if ( '' == $post->post_name ) {
|
if ( '' === $post->post_name ) {
|
||||||
$newtitle = sanitize_title( $post->post_title );
|
$newtitle = sanitize_title( $post->post_title );
|
||||||
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_name = %s WHERE ID = %d", $newtitle, $post->ID ) );
|
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_name = %s WHERE ID = %d", $newtitle, $post->ID ) );
|
||||||
}
|
}
|
||||||
|
@ -871,7 +871,7 @@ function upgrade_100() {
|
||||||
|
|
||||||
$categories = $wpdb->get_results( "SELECT cat_ID, cat_name, category_nicename FROM $wpdb->categories" );
|
$categories = $wpdb->get_results( "SELECT cat_ID, cat_name, category_nicename FROM $wpdb->categories" );
|
||||||
foreach ( $categories as $category ) {
|
foreach ( $categories as $category ) {
|
||||||
if ( '' == $category->category_nicename ) {
|
if ( '' === $category->category_nicename ) {
|
||||||
$newtitle = sanitize_title( $category->cat_name );
|
$newtitle = sanitize_title( $category->cat_name );
|
||||||
$wpdb->update( $wpdb->categories, array( 'category_nicename' => $newtitle ), array( 'cat_ID' => $category->cat_ID ) );
|
$wpdb->update( $wpdb->categories, array( 'category_nicename' => $newtitle ), array( 'cat_ID' => $category->cat_ID ) );
|
||||||
}
|
}
|
||||||
|
@ -947,7 +947,7 @@ function upgrade_110() {
|
||||||
// Set user_nicename.
|
// Set user_nicename.
|
||||||
$users = $wpdb->get_results( "SELECT ID, user_nickname, user_nicename FROM $wpdb->users" );
|
$users = $wpdb->get_results( "SELECT ID, user_nickname, user_nicename FROM $wpdb->users" );
|
||||||
foreach ( $users as $user ) {
|
foreach ( $users as $user ) {
|
||||||
if ( '' == $user->user_nicename ) {
|
if ( '' === $user->user_nicename ) {
|
||||||
$newname = sanitize_title( $user->user_nickname );
|
$newname = sanitize_title( $user->user_nickname );
|
||||||
$wpdb->update( $wpdb->users, array( 'user_nicename' => $newname ), array( 'ID' => $user->ID ) );
|
$wpdb->update( $wpdb->users, array( 'user_nicename' => $newname ), array( 'ID' => $user->ID ) );
|
||||||
}
|
}
|
||||||
|
@ -982,7 +982,7 @@ function upgrade_110() {
|
||||||
* MAX(post_date_gmt) can't be '0000-00-00 00:00:00'.
|
* MAX(post_date_gmt) can't be '0000-00-00 00:00:00'.
|
||||||
* <michel_v> I just slapped myself silly for not thinking about it earlier.
|
* <michel_v> I just slapped myself silly for not thinking about it earlier.
|
||||||
*/
|
*/
|
||||||
$got_gmt_fields = ! ( $wpdb->get_var( "SELECT MAX(post_date_gmt) FROM $wpdb->posts" ) == '0000-00-00 00:00:00' );
|
$got_gmt_fields = ( '0000-00-00 00:00:00' !== $wpdb->get_var( "SELECT MAX(post_date_gmt) FROM $wpdb->posts" ) );
|
||||||
|
|
||||||
if ( ! $got_gmt_fields ) {
|
if ( ! $got_gmt_fields ) {
|
||||||
|
|
||||||
|
@ -1226,10 +1226,10 @@ function upgrade_210() {
|
||||||
$status = $post->post_status;
|
$status = $post->post_status;
|
||||||
$type = 'post';
|
$type = 'post';
|
||||||
|
|
||||||
if ( 'static' == $status ) {
|
if ( 'static' === $status ) {
|
||||||
$status = 'publish';
|
$status = 'publish';
|
||||||
$type = 'page';
|
$type = 'page';
|
||||||
} elseif ( 'attachment' == $status ) {
|
} elseif ( 'attachment' === $status ) {
|
||||||
$status = 'inherit';
|
$status = 'inherit';
|
||||||
$type = 'attachment';
|
$type = 'attachment';
|
||||||
}
|
}
|
||||||
|
@ -1357,7 +1357,7 @@ function upgrade_230() {
|
||||||
$post_id = (int) $post->post_id;
|
$post_id = (int) $post->post_id;
|
||||||
$term_id = (int) $post->category_id;
|
$term_id = (int) $post->category_id;
|
||||||
$taxonomy = 'category';
|
$taxonomy = 'category';
|
||||||
if ( ! empty( $post->rel_type ) && 'tag' == $post->rel_type ) {
|
if ( ! empty( $post->rel_type ) && 'tag' === $post->rel_type ) {
|
||||||
$taxonomy = 'tag';
|
$taxonomy = 'tag';
|
||||||
}
|
}
|
||||||
$tt_id = $tt_ids[ $term_id ][ $taxonomy ];
|
$tt_id = $tt_ids[ $term_id ][ $taxonomy ];
|
||||||
|
@ -1475,7 +1475,7 @@ function upgrade_230() {
|
||||||
// Recalculate all counts.
|
// Recalculate all counts.
|
||||||
$terms = $wpdb->get_results( "SELECT term_taxonomy_id, taxonomy FROM $wpdb->term_taxonomy" );
|
$terms = $wpdb->get_results( "SELECT term_taxonomy_id, taxonomy FROM $wpdb->term_taxonomy" );
|
||||||
foreach ( (array) $terms as $term ) {
|
foreach ( (array) $terms as $term ) {
|
||||||
if ( ( 'post_tag' == $term->taxonomy ) || ( 'category' == $term->taxonomy ) ) {
|
if ( 'post_tag' === $term->taxonomy || 'category' === $term->taxonomy ) {
|
||||||
$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status = 'publish' AND post_type = 'post' AND term_taxonomy_id = %d", $term->term_taxonomy_id ) );
|
$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status = 'publish' AND post_type = 'post' AND term_taxonomy_id = %d", $term->term_taxonomy_id ) );
|
||||||
} else {
|
} else {
|
||||||
$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term->term_taxonomy_id ) );
|
$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term->term_taxonomy_id ) );
|
||||||
|
@ -1815,7 +1815,7 @@ function upgrade_340() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $wp_current_db_version < 20080 ) {
|
if ( $wp_current_db_version < 20080 ) {
|
||||||
if ( 'yes' == $wpdb->get_var( "SELECT autoload FROM $wpdb->options WHERE option_name = 'uninstall_plugins'" ) ) {
|
if ( 'yes' === $wpdb->get_var( "SELECT autoload FROM $wpdb->options WHERE option_name = 'uninstall_plugins'" ) ) {
|
||||||
$uninstall_plugins = get_option( 'uninstall_plugins' );
|
$uninstall_plugins = get_option( 'uninstall_plugins' );
|
||||||
delete_option( 'uninstall_plugins' );
|
delete_option( 'uninstall_plugins' );
|
||||||
add_option( 'uninstall_plugins', $uninstall_plugins, null, 'no' );
|
add_option( 'uninstall_plugins', $uninstall_plugins, null, 'no' );
|
||||||
|
@ -2291,7 +2291,7 @@ function upgrade_network() {
|
||||||
$upgrade = false;
|
$upgrade = false;
|
||||||
$indexes = $wpdb->get_results( "SHOW INDEXES FROM $wpdb->signups" );
|
$indexes = $wpdb->get_results( "SHOW INDEXES FROM $wpdb->signups" );
|
||||||
foreach ( $indexes as $index ) {
|
foreach ( $indexes as $index ) {
|
||||||
if ( 'domain_path' == $index->Key_name && 'domain' == $index->Column_name && 140 != $index->Sub_part ) {
|
if ( 'domain_path' === $index->Key_name && 'domain' === $index->Column_name && 140 != $index->Sub_part ) {
|
||||||
$upgrade = true;
|
$upgrade = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2501,7 +2501,7 @@ function get_alloptions_110() {
|
||||||
$options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" );
|
$options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" );
|
||||||
if ( $options ) {
|
if ( $options ) {
|
||||||
foreach ( $options as $option ) {
|
foreach ( $options as $option ) {
|
||||||
if ( 'siteurl' == $option->option_name || 'home' == $option->option_name || 'category_base' == $option->option_name ) {
|
if ( 'siteurl' === $option->option_name || 'home' === $option->option_name || 'category_base' === $option->option_name ) {
|
||||||
$option->option_value = untrailingslashit( $option->option_value );
|
$option->option_value = untrailingslashit( $option->option_value );
|
||||||
}
|
}
|
||||||
$all_options->{$option->option_name} = stripslashes( $option->option_value );
|
$all_options->{$option->option_name} = stripslashes( $option->option_value );
|
||||||
|
@ -2535,11 +2535,11 @@ function __get_option( $setting ) { // phpcs:ignore WordPress.NamingConventions.
|
||||||
|
|
||||||
$option = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s", $setting ) );
|
$option = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s", $setting ) );
|
||||||
|
|
||||||
if ( 'home' === $setting && '' == $option ) {
|
if ( 'home' === $setting && '' === $option ) {
|
||||||
return __get_option( 'siteurl' );
|
return __get_option( 'siteurl' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'siteurl' === $setting || 'home' === $setting || 'category_base' === $setting || 'tag_base' === $setting ) {
|
if ( in_array( $setting, array( 'siteurl', 'home', 'category_base', 'tag_base' ), true ) ) {
|
||||||
$option = untrailingslashit( $option );
|
$option = untrailingslashit( $option );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2915,7 +2915,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
|
||||||
|
|
||||||
// For each column in the index.
|
// For each column in the index.
|
||||||
foreach ( $index_data['columns'] as $column_data ) {
|
foreach ( $index_data['columns'] as $column_data ) {
|
||||||
if ( '' != $index_columns ) {
|
if ( '' !== $index_columns ) {
|
||||||
$index_columns .= ',';
|
$index_columns .= ',';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3270,7 +3270,7 @@ function maybe_disable_automattic_widgets() {
|
||||||
$plugins = __get_option( 'active_plugins' );
|
$plugins = __get_option( 'active_plugins' );
|
||||||
|
|
||||||
foreach ( (array) $plugins as $plugin ) {
|
foreach ( (array) $plugins as $plugin ) {
|
||||||
if ( basename( $plugin ) == 'widgets.php' ) {
|
if ( 'widgets.php' === basename( $plugin ) ) {
|
||||||
array_splice( $plugins, array_search( $plugin, $plugins, true ), 1 );
|
array_splice( $plugins, array_search( $plugin, $plugins, true ), 1 );
|
||||||
update_option( 'active_plugins', $plugins );
|
update_option( 'active_plugins', $plugins );
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -132,7 +132,7 @@ function edit_user( $user_id = 0 ) {
|
||||||
$user->show_admin_bar_front = isset( $_POST['admin_bar_front'] ) ? 'true' : 'false';
|
$user->show_admin_bar_front = isset( $_POST['admin_bar_front'] ) ? 'true' : 'false';
|
||||||
}
|
}
|
||||||
|
|
||||||
$user->comment_shortcuts = isset( $_POST['comment_shortcuts'] ) && 'true' == $_POST['comment_shortcuts'] ? 'true' : '';
|
$user->comment_shortcuts = isset( $_POST['comment_shortcuts'] ) && 'true' === $_POST['comment_shortcuts'] ? 'true' : '';
|
||||||
|
|
||||||
$user->use_ssl = 0;
|
$user->use_ssl = 0;
|
||||||
if ( ! empty( $_POST['use_ssl'] ) ) {
|
if ( ! empty( $_POST['use_ssl'] ) ) {
|
||||||
|
@ -142,7 +142,7 @@ function edit_user( $user_id = 0 ) {
|
||||||
$errors = new WP_Error();
|
$errors = new WP_Error();
|
||||||
|
|
||||||
/* checking that username has been typed */
|
/* checking that username has been typed */
|
||||||
if ( '' == $user->user_login ) {
|
if ( '' === $user->user_login ) {
|
||||||
$errors->add( 'user_login', __( '<strong>Error</strong>: Please enter a username.' ) );
|
$errors->add( 'user_login', __( '<strong>Error</strong>: Please enter a username.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,7 +474,9 @@ function default_password_nag_handler( $errors = false ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// get_user_setting() = JS-saved UI setting. Else no-js-fallback code.
|
// get_user_setting() = JS-saved UI setting. Else no-js-fallback code.
|
||||||
if ( 'hide' == get_user_setting( 'default_password_nag' ) || isset( $_GET['default_password_nag'] ) && '0' == $_GET['default_password_nag'] ) {
|
if ( 'hide' === get_user_setting( 'default_password_nag' )
|
||||||
|
|| isset( $_GET['default_password_nag'] ) && '0' == $_GET['default_password_nag']
|
||||||
|
) {
|
||||||
delete_user_setting( 'default_password_nag' );
|
delete_user_setting( 'default_password_nag' );
|
||||||
update_user_option( $user_ID, 'default_password_nag', false, true );
|
update_user_option( $user_ID, 'default_password_nag', false, true );
|
||||||
}
|
}
|
||||||
|
@ -509,7 +511,7 @@ function default_password_nag_edit_user( $user_ID, $old_data ) {
|
||||||
function default_password_nag() {
|
function default_password_nag() {
|
||||||
global $pagenow;
|
global $pagenow;
|
||||||
// Short-circuit it.
|
// Short-circuit it.
|
||||||
if ( 'profile.php' == $pagenow || ! get_user_option( 'default_password_nag' ) ) {
|
if ( 'profile.php' === $pagenow || ! get_user_option( 'default_password_nag' ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -225,7 +225,7 @@ function wp_widget_control( $sidebar_args ) {
|
||||||
* We aren't showing a widget control, we're outputting a template
|
* We aren't showing a widget control, we're outputting a template
|
||||||
* for a multi-widget control.
|
* for a multi-widget control.
|
||||||
*/
|
*/
|
||||||
if ( isset( $sidebar_args['_display'] ) && 'template' == $sidebar_args['_display'] && $widget_number ) {
|
if ( isset( $sidebar_args['_display'] ) && 'template' === $sidebar_args['_display'] && $widget_number ) {
|
||||||
// number == -1 implies a template where id numbers are replaced by a generic '__i__'.
|
// number == -1 implies a template where id numbers are replaced by a generic '__i__'.
|
||||||
$control['params'][0]['number'] = -1;
|
$control['params'][0]['number'] = -1;
|
||||||
// With id_base widget id's are constructed like {$id_base}-{$id_number}.
|
// With id_base widget id's are constructed like {$id_base}-{$id_number}.
|
||||||
|
|
|
@ -96,7 +96,7 @@ if ( ! defined( 'WP_ALLOW_REPAIR' ) || ! WP_ALLOW_REPAIR ) {
|
||||||
$check = $wpdb->get_row( "CHECK TABLE $table" );
|
$check = $wpdb->get_row( "CHECK TABLE $table" );
|
||||||
|
|
||||||
echo '<p>';
|
echo '<p>';
|
||||||
if ( 'OK' == $check->Msg_text ) {
|
if ( 'OK' === $check->Msg_text ) {
|
||||||
/* translators: %s: Table name. */
|
/* translators: %s: Table name. */
|
||||||
printf( __( 'The %s table is okay.' ), "<code>$table</code>" );
|
printf( __( 'The %s table is okay.' ), "<code>$table</code>" );
|
||||||
} else {
|
} else {
|
||||||
|
@ -106,7 +106,7 @@ if ( ! defined( 'WP_ALLOW_REPAIR' ) || ! WP_ALLOW_REPAIR ) {
|
||||||
$repair = $wpdb->get_row( "REPAIR TABLE $table" );
|
$repair = $wpdb->get_row( "REPAIR TABLE $table" );
|
||||||
|
|
||||||
echo '<br /> ';
|
echo '<br /> ';
|
||||||
if ( 'OK' == $check->Msg_text ) {
|
if ( 'OK' === $check->Msg_text ) {
|
||||||
/* translators: %s: Table name. */
|
/* translators: %s: Table name. */
|
||||||
printf( __( 'Successfully repaired the %s table.' ), "<code>$table</code>" );
|
printf( __( 'Successfully repaired the %s table.' ), "<code>$table</code>" );
|
||||||
} else {
|
} else {
|
||||||
|
@ -121,14 +121,14 @@ if ( ! defined( 'WP_ALLOW_REPAIR' ) || ! WP_ALLOW_REPAIR ) {
|
||||||
$check = $wpdb->get_row( "ANALYZE TABLE $table" );
|
$check = $wpdb->get_row( "ANALYZE TABLE $table" );
|
||||||
|
|
||||||
echo '<br /> ';
|
echo '<br /> ';
|
||||||
if ( 'Table is already up to date' == $check->Msg_text ) {
|
if ( 'Table is already up to date' === $check->Msg_text ) {
|
||||||
/* translators: %s: Table name. */
|
/* translators: %s: Table name. */
|
||||||
printf( __( 'The %s table is already optimized.' ), "<code>$table</code>" );
|
printf( __( 'The %s table is already optimized.' ), "<code>$table</code>" );
|
||||||
} else {
|
} else {
|
||||||
$check = $wpdb->get_row( "OPTIMIZE TABLE $table" );
|
$check = $wpdb->get_row( "OPTIMIZE TABLE $table" );
|
||||||
|
|
||||||
echo '<br /> ';
|
echo '<br /> ';
|
||||||
if ( 'OK' == $check->Msg_text || 'Table is already up to date' == $check->Msg_text ) {
|
if ( 'OK' === $check->Msg_text || 'Table is already up to date' === $check->Msg_text ) {
|
||||||
/* translators: %s: Table name. */
|
/* translators: %s: Table name. */
|
||||||
printf( __( 'Successfully optimized the %s table.' ), "<code>$table</code>" );
|
printf( __( 'Successfully optimized the %s table.' ), "<code>$table</code>" );
|
||||||
} else {
|
} else {
|
||||||
|
@ -158,7 +158,7 @@ if ( ! defined( 'WP_ALLOW_REPAIR' ) || ! WP_ALLOW_REPAIR ) {
|
||||||
|
|
||||||
echo '<h1 class="screen-reader-text">' . __( 'WordPress database repair' ) . '</h1>';
|
echo '<h1 class="screen-reader-text">' . __( 'WordPress database repair' ) . '</h1>';
|
||||||
|
|
||||||
if ( isset( $_GET['referrer'] ) && 'is_blog_installed' == $_GET['referrer'] ) {
|
if ( isset( $_GET['referrer'] ) && 'is_blog_installed' === $_GET['referrer'] ) {
|
||||||
echo '<p>' . __( 'One or more database tables are unavailable. To allow WordPress to attempt to repair these tables, press the “Repair Database” button. Repairing can take a while, so please be patient.' ) . '</p>';
|
echo '<p>' . __( 'One or more database tables are unavailable. To allow WordPress to attempt to repair these tables, press the “Repair Database” button. Repairing can take a while, so please be patient.' ) . '</p>';
|
||||||
} else {
|
} else {
|
||||||
echo '<p>' . __( 'WordPress can automatically look for some common database problems and repair them. Repairing can take a while, so please be patient.' ) . '</p>';
|
echo '<p>' . __( 'WordPress can automatically look for some common database problems and repair them. Repairing can take a while, so please be patient.' ) . '</p>';
|
||||||
|
|
|
@ -421,7 +421,7 @@ $menu_count = count( $nav_menus );
|
||||||
// Are we on the add new screen?
|
// Are we on the add new screen?
|
||||||
$add_new_screen = ( isset( $_GET['menu'] ) && 0 == $_GET['menu'] ) ? true : false;
|
$add_new_screen = ( isset( $_GET['menu'] ) && 0 == $_GET['menu'] ) ? true : false;
|
||||||
|
|
||||||
$locations_screen = ( isset( $_GET['action'] ) && 'locations' == $_GET['action'] ) ? true : false;
|
$locations_screen = ( isset( $_GET['action'] ) && 'locations' === $_GET['action'] ) ? true : false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we have one theme location, and zero menus, we take them right
|
* If we have one theme location, and zero menus, we take them right
|
||||||
|
@ -470,7 +470,7 @@ if ( empty( $nav_menu_selected_id ) && ! isset( $_GET['menu'] ) && is_nav_menu(
|
||||||
}
|
}
|
||||||
|
|
||||||
// On deletion of menu, if another menu exists, show it.
|
// On deletion of menu, if another menu exists, show it.
|
||||||
if ( ! $add_new_screen && 0 < $menu_count && isset( $_GET['action'] ) && 'delete' == $_GET['action'] ) {
|
if ( ! $add_new_screen && 0 < $menu_count && isset( $_GET['action'] ) && 'delete' === $_GET['action'] ) {
|
||||||
$nav_menu_selected_id = $nav_menus[0]->term_id;
|
$nav_menu_selected_id = $nav_menus[0]->term_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ if ( $_POST ) {
|
||||||
if ( ! network_domain_check() ) {
|
if ( ! network_domain_check() ) {
|
||||||
$result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), wp_unslash( $_POST['sitename'] ), $base, $subdomain_install );
|
$result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), wp_unslash( $_POST['sitename'] ), $base, $subdomain_install );
|
||||||
if ( is_wp_error( $result ) ) {
|
if ( is_wp_error( $result ) ) {
|
||||||
if ( 1 == count( $result->get_error_codes() ) && 'no_wildcard_dns' == $result->get_error_code() ) {
|
if ( 1 == count( $result->get_error_codes() ) && 'no_wildcard_dns' === $result->get_error_code() ) {
|
||||||
network_step2( $result );
|
network_step2( $result );
|
||||||
} else {
|
} else {
|
||||||
network_step1( $result );
|
network_step1( $result );
|
||||||
|
|
|
@ -125,11 +125,11 @@ printf( __( 'Enable threaded (nested) comments %s levels deep' ), $thread_commen
|
||||||
<input name="page_comments" type="checkbox" id="page_comments" value="1" <?php checked( '1', get_option( 'page_comments' ) ); ?> />
|
<input name="page_comments" type="checkbox" id="page_comments" value="1" <?php checked( '1', get_option( 'page_comments' ) ); ?> />
|
||||||
<?php
|
<?php
|
||||||
$default_comments_page = '</label> <label for="default_comments_page"><select name="default_comments_page" id="default_comments_page"><option value="newest"';
|
$default_comments_page = '</label> <label for="default_comments_page"><select name="default_comments_page" id="default_comments_page"><option value="newest"';
|
||||||
if ( 'newest' == get_option( 'default_comments_page' ) ) {
|
if ( 'newest' === get_option( 'default_comments_page' ) ) {
|
||||||
$default_comments_page .= ' selected="selected"';
|
$default_comments_page .= ' selected="selected"';
|
||||||
}
|
}
|
||||||
$default_comments_page .= '>' . __( 'last' ) . '</option><option value="oldest"';
|
$default_comments_page .= '>' . __( 'last' ) . '</option><option value="oldest"';
|
||||||
if ( 'oldest' == get_option( 'default_comments_page' ) ) {
|
if ( 'oldest' === get_option( 'default_comments_page' ) ) {
|
||||||
$default_comments_page .= ' selected="selected"';
|
$default_comments_page .= ' selected="selected"';
|
||||||
}
|
}
|
||||||
$default_comments_page .= '>' . __( 'first' ) . '</option></select>';
|
$default_comments_page .= '>' . __( 'first' ) . '</option></select>';
|
||||||
|
@ -146,11 +146,11 @@ printf(
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$comment_order = '<select name="comment_order" id="comment_order"><option value="asc"';
|
$comment_order = '<select name="comment_order" id="comment_order"><option value="asc"';
|
||||||
if ( 'asc' == get_option( 'comment_order' ) ) {
|
if ( 'asc' === get_option( 'comment_order' ) ) {
|
||||||
$comment_order .= ' selected="selected"';
|
$comment_order .= ' selected="selected"';
|
||||||
}
|
}
|
||||||
$comment_order .= '>' . __( 'older' ) . '</option><option value="desc"';
|
$comment_order .= '>' . __( 'older' ) . '</option><option value="desc"';
|
||||||
if ( 'desc' == get_option( 'comment_order' ) ) {
|
if ( 'desc' === get_option( 'comment_order' ) ) {
|
||||||
$comment_order .= ' selected="selected"';
|
$comment_order .= ' selected="selected"';
|
||||||
}
|
}
|
||||||
$comment_order .= '>' . __( 'newer' ) . '</option></select>';
|
$comment_order .= '>' . __( 'newer' ) . '</option></select>';
|
||||||
|
|
|
@ -64,7 +64,7 @@ if ( ! empty( $_GET['adminhash'] ) ) {
|
||||||
}
|
}
|
||||||
wp_redirect( admin_url( $redirect ) );
|
wp_redirect( admin_url( $redirect ) );
|
||||||
exit;
|
exit;
|
||||||
} elseif ( ! empty( $_GET['dismiss'] ) && 'new_admin_email' == $_GET['dismiss'] ) {
|
} elseif ( ! empty( $_GET['dismiss'] ) && 'new_admin_email' === $_GET['dismiss'] ) {
|
||||||
check_admin_referer( 'dismiss-' . get_current_blog_id() . '-new_admin_email' );
|
check_admin_referer( 'dismiss-' . get_current_blog_id() . '-new_admin_email' );
|
||||||
delete_option( 'adminhash' );
|
delete_option( 'adminhash' );
|
||||||
delete_option( 'new_admin_email' );
|
delete_option( 'new_admin_email' );
|
||||||
|
@ -204,8 +204,8 @@ if ( ! is_multisite() ) {
|
||||||
*/
|
*/
|
||||||
$whitelist_options = apply_filters( 'whitelist_options', $whitelist_options );
|
$whitelist_options = apply_filters( 'whitelist_options', $whitelist_options );
|
||||||
|
|
||||||
if ( 'update' == $action ) { // We are saving settings sent from a settings page.
|
if ( 'update' === $action ) { // We are saving settings sent from a settings page.
|
||||||
if ( 'options' == $option_page && ! isset( $_POST['option_page'] ) ) { // This is for back compat and will eventually be removed.
|
if ( 'options' === $option_page && ! isset( $_POST['option_page'] ) ) { // This is for back compat and will eventually be removed.
|
||||||
$unregistered = true;
|
$unregistered = true;
|
||||||
check_admin_referer( 'update-options' );
|
check_admin_referer( 'update-options' );
|
||||||
} else {
|
} else {
|
||||||
|
@ -223,7 +223,7 @@ if ( 'update' == $action ) { // We are saving settings sent from a settings page
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'options' == $option_page ) {
|
if ( 'options' === $option_page ) {
|
||||||
if ( is_multisite() && ! current_user_can( 'manage_network_options' ) ) {
|
if ( is_multisite() && ! current_user_can( 'manage_network_options' ) ) {
|
||||||
wp_die( __( 'Sorry, you are not allowed to modify unregistered settings for this site.' ) );
|
wp_die( __( 'Sorry, you are not allowed to modify unregistered settings for this site.' ) );
|
||||||
}
|
}
|
||||||
|
@ -232,14 +232,20 @@ if ( 'update' == $action ) { // We are saving settings sent from a settings page
|
||||||
$options = $whitelist_options[ $option_page ];
|
$options = $whitelist_options[ $option_page ];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'general' == $option_page ) {
|
if ( 'general' === $option_page ) {
|
||||||
// Handle custom date/time formats.
|
// Handle custom date/time formats.
|
||||||
if ( ! empty( $_POST['date_format'] ) && isset( $_POST['date_format_custom'] ) && '\c\u\s\t\o\m' == wp_unslash( $_POST['date_format'] ) ) {
|
if ( ! empty( $_POST['date_format'] ) && isset( $_POST['date_format_custom'] )
|
||||||
|
&& '\c\u\s\t\o\m' === wp_unslash( $_POST['date_format'] )
|
||||||
|
) {
|
||||||
$_POST['date_format'] = $_POST['date_format_custom'];
|
$_POST['date_format'] = $_POST['date_format_custom'];
|
||||||
}
|
}
|
||||||
if ( ! empty( $_POST['time_format'] ) && isset( $_POST['time_format_custom'] ) && '\c\u\s\t\o\m' == wp_unslash( $_POST['time_format'] ) ) {
|
|
||||||
|
if ( ! empty( $_POST['time_format'] ) && isset( $_POST['time_format_custom'] )
|
||||||
|
&& '\c\u\s\t\o\m' === wp_unslash( $_POST['time_format'] )
|
||||||
|
) {
|
||||||
$_POST['time_format'] = $_POST['time_format_custom'];
|
$_POST['time_format'] = $_POST['time_format_custom'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Map UTC+- timezones to gmt_offsets and set timezone_string to empty.
|
// Map UTC+- timezones to gmt_offsets and set timezone_string to empty.
|
||||||
if ( ! empty( $_POST['timezone_string'] ) && preg_match( '/^UTC[+-]/', $_POST['timezone_string'] ) ) {
|
if ( ! empty( $_POST['timezone_string'] ) && preg_match( '/^UTC[+-]/', $_POST['timezone_string'] ) ) {
|
||||||
$_POST['gmt_offset'] = $_POST['timezone_string'];
|
$_POST['gmt_offset'] = $_POST['timezone_string'];
|
||||||
|
@ -335,9 +341,11 @@ $options = $wpdb->get_results( "SELECT * FROM $wpdb->options ORDER BY option_nam
|
||||||
|
|
||||||
foreach ( (array) $options as $option ) :
|
foreach ( (array) $options as $option ) :
|
||||||
$disabled = false;
|
$disabled = false;
|
||||||
if ( '' == $option->option_name ) {
|
|
||||||
|
if ( '' === $option->option_name ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( is_serialized( $option->option_value ) ) {
|
if ( is_serialized( $option->option_value ) ) {
|
||||||
if ( is_serialized_string( $option->option_value ) ) {
|
if ( is_serialized_string( $option->option_value ) ) {
|
||||||
// This is a serialized string, so we should display it.
|
// This is a serialized string, so we should display it.
|
||||||
|
@ -354,6 +362,7 @@ foreach ( (array) $options as $option ) :
|
||||||
$options_to_update[] = $option->option_name;
|
$options_to_update[] = $option->option_name;
|
||||||
$class = 'all-options';
|
$class = 'all-options';
|
||||||
}
|
}
|
||||||
|
|
||||||
$name = esc_attr( $option->option_name );
|
$name = esc_attr( $option->option_name );
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -161,7 +161,7 @@ if ( ! empty( $posted_content ) ) {
|
||||||
$content = file_get_contents( $real_file );
|
$content = file_get_contents( $real_file );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( '.php' == substr( $real_file, strrpos( $real_file, '.' ) ) ) {
|
if ( '.php' === substr( $real_file, strrpos( $real_file, '.' ) ) ) {
|
||||||
$functions = wp_doc_link_parse( $content );
|
$functions = wp_doc_link_parse( $content );
|
||||||
|
|
||||||
if ( ! empty( $functions ) ) {
|
if ( ! empty( $functions ) ) {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* @subpackage Administration
|
* @subpackage Administration
|
||||||
*/
|
*/
|
||||||
// TODO: Route this page via a specific iframe handler instead of the do_action below.
|
// TODO: Route this page via a specific iframe handler instead of the do_action below.
|
||||||
if ( ! defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'plugin-information' == $_GET['tab'] ) ) {
|
if ( ! defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'plugin-information' === $_GET['tab'] ) ) {
|
||||||
define( 'IFRAME_REQUEST', true );
|
define( 'IFRAME_REQUEST', true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ if ( $action ) {
|
||||||
|
|
||||||
$result = activate_plugin( $plugin, self_admin_url( 'plugins.php?error=true&plugin=' . urlencode( $plugin ) ), is_network_admin() );
|
$result = activate_plugin( $plugin, self_admin_url( 'plugins.php?error=true&plugin=' . urlencode( $plugin ) ), is_network_admin() );
|
||||||
if ( is_wp_error( $result ) ) {
|
if ( is_wp_error( $result ) ) {
|
||||||
if ( 'unexpected_output' == $result->get_error_code() ) {
|
if ( 'unexpected_output' === $result->get_error_code() ) {
|
||||||
$redirect = self_admin_url( 'plugins.php?error=true&charsout=' . strlen( $result->get_error_data() ) . '&plugin=' . urlencode( $plugin ) . "&plugin_status=$status&paged=$page&s=$s" );
|
$redirect = self_admin_url( 'plugins.php?error=true&charsout=' . strlen( $result->get_error_data() ) . '&plugin=' . urlencode( $plugin ) . "&plugin_status=$status&paged=$page&s=$s" );
|
||||||
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 ) );
|
||||||
exit;
|
exit;
|
||||||
|
@ -62,10 +62,10 @@ if ( $action ) {
|
||||||
update_site_option( 'recently_activated', $recent );
|
update_site_option( 'recently_activated', $recent );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $_GET['from'] ) && 'import' == $_GET['from'] ) {
|
if ( isset( $_GET['from'] ) && 'import' === $_GET['from'] ) {
|
||||||
// Overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix.
|
// Overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix.
|
||||||
wp_redirect( self_admin_url( 'import.php?import=' . str_replace( '-importer', '', dirname( $plugin ) ) ) );
|
wp_redirect( self_admin_url( 'import.php?import=' . str_replace( '-importer', '', dirname( $plugin ) ) ) );
|
||||||
} elseif ( isset( $_GET['from'] ) && 'press-this' == $_GET['from'] ) {
|
} elseif ( isset( $_GET['from'] ) && 'press-this' === $_GET['from'] ) {
|
||||||
wp_redirect( self_admin_url( 'press-this.php' ) );
|
wp_redirect( self_admin_url( 'press-this.php' ) );
|
||||||
} else {
|
} else {
|
||||||
// Overrides the ?error=true one above.
|
// Overrides the ?error=true one above.
|
||||||
|
@ -292,7 +292,7 @@ if ( $action ) {
|
||||||
foreach ( (array) $plugins as $plugin ) {
|
foreach ( (array) $plugins as $plugin ) {
|
||||||
$plugin_slug = dirname( $plugin );
|
$plugin_slug = dirname( $plugin );
|
||||||
|
|
||||||
if ( '.' == $plugin_slug ) {
|
if ( '.' === $plugin_slug ) {
|
||||||
$data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
|
$data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
|
||||||
if ( $data ) {
|
if ( $data ) {
|
||||||
$plugin_info[ $plugin ] = $data;
|
$plugin_info[ $plugin ] = $data;
|
||||||
|
@ -579,7 +579,7 @@ elseif ( isset( $_GET['deleted'] ) ) :
|
||||||
<div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin deactivated.' ); ?></p></div>
|
<div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin deactivated.' ); ?></p></div>
|
||||||
<?php elseif ( isset( $_GET['deactivate-multi'] ) ) : ?>
|
<?php elseif ( isset( $_GET['deactivate-multi'] ) ) : ?>
|
||||||
<div id="message" class="updated notice is-dismissible"><p><?php _e( 'Selected plugins deactivated.' ); ?></p></div>
|
<div id="message" class="updated notice is-dismissible"><p><?php _e( 'Selected plugins deactivated.' ); ?></p></div>
|
||||||
<?php elseif ( 'update-selected' == $action ) : ?>
|
<?php elseif ( 'update-selected' === $action ) : ?>
|
||||||
<div id="message" class="updated notice is-dismissible"><p><?php _e( 'All selected plugins are up to date.' ); ?></p></div>
|
<div id="message" class="updated notice is-dismissible"><p><?php _e( 'All selected plugins are up to date.' ); ?></p></div>
|
||||||
<?php elseif ( isset( $_GET['resume'] ) ) : ?>
|
<?php elseif ( isset( $_GET['resume'] ) ) : ?>
|
||||||
<div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin resumed.' ); ?></p></div>
|
<div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin resumed.' ); ?></p></div>
|
||||||
|
|
|
@ -25,10 +25,10 @@ if ( ! isset( $_GET['post_type'] ) ) {
|
||||||
}
|
}
|
||||||
$post_type_object = get_post_type_object( $post_type );
|
$post_type_object = get_post_type_object( $post_type );
|
||||||
|
|
||||||
if ( 'post' == $post_type ) {
|
if ( 'post' === $post_type ) {
|
||||||
$parent_file = 'edit.php';
|
$parent_file = 'edit.php';
|
||||||
$submenu_file = 'post-new.php';
|
$submenu_file = 'post-new.php';
|
||||||
} elseif ( 'attachment' == $post_type ) {
|
} elseif ( 'attachment' === $post_type ) {
|
||||||
if ( wp_redirect( admin_url( 'media-new.php' ) ) ) {
|
if ( wp_redirect( admin_url( 'media-new.php' ) ) ) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ if ( isset( $_POST['post_type'] ) && $post && $post_type !== $_POST['post_type']
|
||||||
|
|
||||||
if ( isset( $_POST['deletepost'] ) ) {
|
if ( isset( $_POST['deletepost'] ) ) {
|
||||||
$action = 'delete';
|
$action = 'delete';
|
||||||
} elseif ( isset( $_POST['wp-preview'] ) && 'dopreview' == $_POST['wp-preview'] ) {
|
} elseif ( isset( $_POST['wp-preview'] ) && 'dopreview' === $_POST['wp-preview'] ) {
|
||||||
$action = 'preview';
|
$action = 'preview';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ $sendback = wp_get_referer();
|
||||||
if ( ! $sendback ||
|
if ( ! $sendback ||
|
||||||
false !== strpos( $sendback, 'post.php' ) ||
|
false !== strpos( $sendback, 'post.php' ) ||
|
||||||
false !== strpos( $sendback, 'post-new.php' ) ) {
|
false !== strpos( $sendback, 'post-new.php' ) ) {
|
||||||
if ( 'attachment' == $post_type ) {
|
if ( 'attachment' === $post_type ) {
|
||||||
$sendback = admin_url( 'upload.php' );
|
$sendback = admin_url( 'upload.php' );
|
||||||
} else {
|
} else {
|
||||||
$sendback = admin_url( 'edit.php' );
|
$sendback = admin_url( 'edit.php' );
|
||||||
|
@ -111,7 +111,7 @@ switch ( $action ) {
|
||||||
case 'postajaxpost':
|
case 'postajaxpost':
|
||||||
case 'post':
|
case 'post':
|
||||||
check_admin_referer( 'add-' . $post_type );
|
check_admin_referer( 'add-' . $post_type );
|
||||||
$post_id = 'postajaxpost' == $action ? edit_post() : write_post();
|
$post_id = 'postajaxpost' === $action ? edit_post() : write_post();
|
||||||
redirect_post( $post_id );
|
redirect_post( $post_id );
|
||||||
exit();
|
exit();
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ switch ( $action ) {
|
||||||
wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
|
wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'trash' == $post->post_status ) {
|
if ( 'trash' === $post->post_status ) {
|
||||||
wp_die( __( 'You can’t edit this item because it is in the Trash. Please restore it and try again.' ) );
|
wp_die( __( 'You can’t edit this item because it is in the Trash. Please restore it and try again.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,11 +151,11 @@ switch ( $action ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$post_type = $post->post_type;
|
$post_type = $post->post_type;
|
||||||
if ( 'post' == $post_type ) {
|
if ( 'post' === $post_type ) {
|
||||||
$parent_file = 'edit.php';
|
$parent_file = 'edit.php';
|
||||||
$submenu_file = 'edit.php';
|
$submenu_file = 'edit.php';
|
||||||
$post_new_file = 'post-new.php';
|
$post_new_file = 'post-new.php';
|
||||||
} elseif ( 'attachment' == $post_type ) {
|
} elseif ( 'attachment' === $post_type ) {
|
||||||
$parent_file = 'upload.php';
|
$parent_file = 'upload.php';
|
||||||
$submenu_file = 'upload.php';
|
$submenu_file = 'upload.php';
|
||||||
$post_new_file = 'media-new.php';
|
$post_new_file = 'media-new.php';
|
||||||
|
|
|
@ -354,7 +354,7 @@ switch ( $step ) {
|
||||||
|
|
||||||
$key = 0;
|
$key = 0;
|
||||||
foreach ( $config_file as $line_num => $line ) {
|
foreach ( $config_file as $line_num => $line ) {
|
||||||
if ( '$table_prefix =' == substr( $line, 0, 15 ) ) {
|
if ( '$table_prefix =' === substr( $line, 0, 15 ) ) {
|
||||||
$config_file[ $line_num ] = '$table_prefix = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n";
|
$config_file[ $line_num ] = '$table_prefix = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ if ( ! $theme->exists() ) {
|
||||||
wp_die( __( 'The requested theme does not exist.' ) );
|
wp_die( __( 'The requested theme does not exist.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $theme->errors() && 'theme_no_stylesheet' == $theme->errors()->get_error_code() ) {
|
if ( $theme->errors() && 'theme_no_stylesheet' === $theme->errors()->get_error_code() ) {
|
||||||
wp_die( __( 'The requested theme does not exist.' ) . ' ' . $theme->errors()->get_error_message() );
|
wp_die( __( 'The requested theme does not exist.' ) . ' ' . $theme->errors()->get_error_message() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ if ( ! empty( $posted_content ) ) {
|
||||||
$f = fopen( $file, 'r' );
|
$f = fopen( $file, 'r' );
|
||||||
$content = fread( $f, filesize( $file ) );
|
$content = fread( $f, filesize( $file ) );
|
||||||
|
|
||||||
if ( '.php' == substr( $file, strrpos( $file, '.' ) ) ) {
|
if ( '.php' === substr( $file, strrpos( $file, '.' ) ) ) {
|
||||||
$functions = wp_doc_link_parse( $content );
|
$functions = wp_doc_link_parse( $content );
|
||||||
|
|
||||||
$docs_select = '<select name="docs-list" id="docs-list">';
|
$docs_select = '<select name="docs-list" id="docs-list">';
|
||||||
|
@ -228,7 +228,7 @@ if ( $file_description != $file_show ) {
|
||||||
<select name="theme" id="theme">
|
<select name="theme" id="theme">
|
||||||
<?php
|
<?php
|
||||||
foreach ( wp_get_themes( array( 'errors' => null ) ) as $a_stylesheet => $a_theme ) {
|
foreach ( wp_get_themes( array( 'errors' => null ) ) as $a_stylesheet => $a_theme ) {
|
||||||
if ( $a_theme->errors() && 'theme_no_stylesheet' == $a_theme->errors()->get_error_code() ) {
|
if ( $a_theme->errors() && 'theme_no_stylesheet' === $a_theme->errors()->get_error_code() ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_op
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( current_user_can( 'switch_themes' ) && isset( $_GET['action'] ) ) {
|
if ( current_user_can( 'switch_themes' ) && isset( $_GET['action'] ) ) {
|
||||||
if ( 'activate' == $_GET['action'] ) {
|
if ( 'activate' === $_GET['action'] ) {
|
||||||
check_admin_referer( 'switch-theme_' . $_GET['stylesheet'] );
|
check_admin_referer( 'switch-theme_' . $_GET['stylesheet'] );
|
||||||
$theme = wp_get_theme( $_GET['stylesheet'] );
|
$theme = wp_get_theme( $_GET['stylesheet'] );
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ if ( current_user_can( 'switch_themes' ) && isset( $_GET['action'] ) ) {
|
||||||
|
|
||||||
wp_redirect( admin_url( 'themes.php?resumed=true' ) );
|
wp_redirect( admin_url( 'themes.php?resumed=true' ) );
|
||||||
exit;
|
exit;
|
||||||
} elseif ( 'delete' == $_GET['action'] ) {
|
} elseif ( 'delete' === $_GET['action'] ) {
|
||||||
check_admin_referer( 'delete-theme_' . $_GET['stylesheet'] );
|
check_admin_referer( 'delete-theme_' . $_GET['stylesheet'] );
|
||||||
$theme = wp_get_theme( $_GET['stylesheet'] );
|
$theme = wp_get_theme( $_GET['stylesheet'] );
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ if ( ! $ct->errors() || ( 1 == count( $ct->errors()->get_error_codes() )
|
||||||
if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) {
|
if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) {
|
||||||
foreach ( (array) $submenu['themes.php'] as $item ) {
|
foreach ( (array) $submenu['themes.php'] as $item ) {
|
||||||
$class = '';
|
$class = '';
|
||||||
if ( 'themes.php' == $item[2] || 'theme-editor.php' == $item[2] || 0 === strpos( $item[2], 'customize.php' ) ) {
|
if ( 'themes.php' === $item[2] || 'theme-editor.php' === $item[2] || 0 === strpos( $item[2], 'customize.php' ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 0 = name, 1 = capability, 2 = file.
|
// 0 = name, 1 = capability, 2 = file.
|
||||||
|
|
|
@ -690,9 +690,9 @@ function do_undismiss_core_update() {
|
||||||
$action = isset( $_GET['action'] ) ? $_GET['action'] : 'upgrade-core';
|
$action = isset( $_GET['action'] ) ? $_GET['action'] : 'upgrade-core';
|
||||||
|
|
||||||
$upgrade_error = false;
|
$upgrade_error = false;
|
||||||
if ( ( 'do-theme-upgrade' == $action || ( 'do-plugin-upgrade' == $action && ! isset( $_GET['plugins'] ) ) )
|
if ( ( 'do-theme-upgrade' === $action || ( 'do-plugin-upgrade' === $action && ! isset( $_GET['plugins'] ) ) )
|
||||||
&& ! isset( $_POST['checked'] ) ) {
|
&& ! isset( $_POST['checked'] ) ) {
|
||||||
$upgrade_error = 'do-theme-upgrade' == $action ? 'themes' : 'plugins';
|
$upgrade_error = ( 'do-theme-upgrade' === $action ) ? 'themes' : 'plugins';
|
||||||
$action = 'upgrade-core';
|
$action = 'upgrade-core';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -731,7 +731,7 @@ get_current_screen()->set_help_sidebar(
|
||||||
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
|
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( 'upgrade-core' == $action ) {
|
if ( 'upgrade-core' === $action ) {
|
||||||
// Force a update check when requested.
|
// Force a update check when requested.
|
||||||
$force_check = ! empty( $_GET['force-check'] );
|
$force_check = ! empty( $_GET['force-check'] );
|
||||||
wp_version_check( array(), $force_check );
|
wp_version_check( array(), $force_check );
|
||||||
|
@ -795,7 +795,7 @@ if ( 'upgrade-core' == $action ) {
|
||||||
|
|
||||||
require_once ABSPATH . 'wp-admin/admin-footer.php';
|
require_once ABSPATH . 'wp-admin/admin-footer.php';
|
||||||
|
|
||||||
} elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) {
|
} elseif ( 'do-core-upgrade' === $action || 'do-core-reinstall' === $action ) {
|
||||||
|
|
||||||
if ( ! current_user_can( 'update_core' ) ) {
|
if ( ! current_user_can( 'update_core' ) ) {
|
||||||
wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
|
wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
|
||||||
|
@ -811,7 +811,7 @@ if ( 'upgrade-core' == $action ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once ABSPATH . 'wp-admin/admin-header.php';
|
require_once ABSPATH . 'wp-admin/admin-header.php';
|
||||||
if ( 'do-core-reinstall' == $action ) {
|
if ( 'do-core-reinstall' === $action ) {
|
||||||
$reinstall = true;
|
$reinstall = true;
|
||||||
} else {
|
} else {
|
||||||
$reinstall = false;
|
$reinstall = false;
|
||||||
|
@ -831,7 +831,7 @@ if ( 'upgrade-core' == $action ) {
|
||||||
|
|
||||||
require_once ABSPATH . 'wp-admin/admin-footer.php';
|
require_once ABSPATH . 'wp-admin/admin-footer.php';
|
||||||
|
|
||||||
} elseif ( 'do-plugin-upgrade' == $action ) {
|
} elseif ( 'do-plugin-upgrade' === $action ) {
|
||||||
|
|
||||||
if ( ! current_user_can( 'update_plugins' ) ) {
|
if ( ! current_user_can( 'update_plugins' ) ) {
|
||||||
wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
|
wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
|
||||||
|
@ -869,7 +869,7 @@ if ( 'upgrade-core' == $action ) {
|
||||||
|
|
||||||
require_once ABSPATH . 'wp-admin/admin-footer.php';
|
require_once ABSPATH . 'wp-admin/admin-footer.php';
|
||||||
|
|
||||||
} elseif ( 'do-theme-upgrade' == $action ) {
|
} elseif ( 'do-theme-upgrade' === $action ) {
|
||||||
|
|
||||||
if ( ! current_user_can( 'update_themes' ) ) {
|
if ( ! current_user_can( 'update_themes' ) ) {
|
||||||
wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
|
wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
|
||||||
|
@ -909,7 +909,7 @@ if ( 'upgrade-core' == $action ) {
|
||||||
|
|
||||||
require_once ABSPATH . 'wp-admin/admin-footer.php';
|
require_once ABSPATH . 'wp-admin/admin-footer.php';
|
||||||
|
|
||||||
} elseif ( 'do-translation-upgrade' == $action ) {
|
} elseif ( 'do-translation-upgrade' === $action ) {
|
||||||
|
|
||||||
if ( ! current_user_can( 'update_languages' ) ) {
|
if ( ! current_user_can( 'update_languages' ) ) {
|
||||||
wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
|
wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
|
||||||
|
|
|
@ -22,7 +22,7 @@ if ( isset( $_GET['action'] ) ) {
|
||||||
$theme = isset( $_REQUEST['theme'] ) ? urldecode( $_REQUEST['theme'] ) : '';
|
$theme = isset( $_REQUEST['theme'] ) ? urldecode( $_REQUEST['theme'] ) : '';
|
||||||
$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
|
$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
|
||||||
|
|
||||||
if ( 'update-selected' == $action ) {
|
if ( 'update-selected' === $action ) {
|
||||||
if ( ! current_user_can( 'update_plugins' ) ) {
|
if ( ! current_user_can( 'update_plugins' ) ) {
|
||||||
wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) );
|
wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) );
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ if ( isset( $_GET['action'] ) ) {
|
||||||
|
|
||||||
iframe_footer();
|
iframe_footer();
|
||||||
|
|
||||||
} elseif ( 'upgrade-plugin' == $action ) {
|
} elseif ( 'upgrade-plugin' === $action ) {
|
||||||
if ( ! current_user_can( 'update_plugins' ) ) {
|
if ( ! current_user_can( 'update_plugins' ) ) {
|
||||||
wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) );
|
wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) );
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ if ( isset( $_GET['action'] ) ) {
|
||||||
|
|
||||||
require_once ABSPATH . 'wp-admin/admin-footer.php';
|
require_once ABSPATH . 'wp-admin/admin-footer.php';
|
||||||
|
|
||||||
} elseif ( 'activate-plugin' == $action ) {
|
} elseif ( 'activate-plugin' === $action ) {
|
||||||
if ( ! current_user_can( 'update_plugins' ) ) {
|
if ( ! current_user_can( 'update_plugins' ) ) {
|
||||||
wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) );
|
wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) );
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ if ( isset( $_GET['action'] ) ) {
|
||||||
include WP_PLUGIN_DIR . '/' . $plugin;
|
include WP_PLUGIN_DIR . '/' . $plugin;
|
||||||
}
|
}
|
||||||
iframe_footer();
|
iframe_footer();
|
||||||
} elseif ( 'install-plugin' == $action ) {
|
} elseif ( 'install-plugin' === $action ) {
|
||||||
|
|
||||||
if ( ! current_user_can( 'install_plugins' ) ) {
|
if ( ! current_user_can( 'install_plugins' ) ) {
|
||||||
wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) );
|
wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) );
|
||||||
|
@ -141,7 +141,7 @@ if ( isset( $_GET['action'] ) ) {
|
||||||
|
|
||||||
require_once ABSPATH . 'wp-admin/admin-footer.php';
|
require_once ABSPATH . 'wp-admin/admin-footer.php';
|
||||||
|
|
||||||
} elseif ( 'upload-plugin' == $action ) {
|
} elseif ( 'upload-plugin' === $action ) {
|
||||||
|
|
||||||
if ( ! current_user_can( 'upload_plugins' ) ) {
|
if ( ! current_user_can( 'upload_plugins' ) ) {
|
||||||
wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) );
|
wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) );
|
||||||
|
@ -171,7 +171,7 @@ if ( isset( $_GET['action'] ) ) {
|
||||||
|
|
||||||
require_once ABSPATH . 'wp-admin/admin-footer.php';
|
require_once ABSPATH . 'wp-admin/admin-footer.php';
|
||||||
|
|
||||||
} elseif ( 'upgrade-theme' == $action ) {
|
} elseif ( 'upgrade-theme' === $action ) {
|
||||||
|
|
||||||
if ( ! current_user_can( 'update_themes' ) ) {
|
if ( ! current_user_can( 'update_themes' ) ) {
|
||||||
wp_die( __( 'Sorry, you are not allowed to update themes for this site.' ) );
|
wp_die( __( 'Sorry, you are not allowed to update themes for this site.' ) );
|
||||||
|
@ -193,7 +193,7 @@ if ( isset( $_GET['action'] ) ) {
|
||||||
$upgrader->upgrade( $theme );
|
$upgrader->upgrade( $theme );
|
||||||
|
|
||||||
require_once ABSPATH . 'wp-admin/admin-footer.php';
|
require_once ABSPATH . 'wp-admin/admin-footer.php';
|
||||||
} elseif ( 'update-selected-themes' == $action ) {
|
} elseif ( 'update-selected-themes' === $action ) {
|
||||||
if ( ! current_user_can( 'update_themes' ) ) {
|
if ( ! current_user_can( 'update_themes' ) ) {
|
||||||
wp_die( __( 'Sorry, you are not allowed to update themes for this site.' ) );
|
wp_die( __( 'Sorry, you are not allowed to update themes for this site.' ) );
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ if ( isset( $_GET['action'] ) ) {
|
||||||
$upgrader->bulk_upgrade( $themes );
|
$upgrader->bulk_upgrade( $themes );
|
||||||
|
|
||||||
iframe_footer();
|
iframe_footer();
|
||||||
} elseif ( 'install-theme' == $action ) {
|
} elseif ( 'install-theme' === $action ) {
|
||||||
|
|
||||||
if ( ! current_user_can( 'install_themes' ) ) {
|
if ( ! current_user_can( 'install_themes' ) ) {
|
||||||
wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) );
|
wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) );
|
||||||
|
@ -260,7 +260,7 @@ if ( isset( $_GET['action'] ) ) {
|
||||||
|
|
||||||
require_once ABSPATH . 'wp-admin/admin-footer.php';
|
require_once ABSPATH . 'wp-admin/admin-footer.php';
|
||||||
|
|
||||||
} elseif ( 'upload-theme' == $action ) {
|
} elseif ( 'upload-theme' === $action ) {
|
||||||
|
|
||||||
if ( ! current_user_can( 'upload_themes' ) ) {
|
if ( ! current_user_can( 'upload_themes' ) ) {
|
||||||
wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) );
|
wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) );
|
||||||
|
|
|
@ -120,7 +120,7 @@ $doaction = $wp_list_table->current_action();
|
||||||
if ( $doaction ) {
|
if ( $doaction ) {
|
||||||
check_admin_referer( 'bulk-media' );
|
check_admin_referer( 'bulk-media' );
|
||||||
|
|
||||||
if ( 'delete_all' == $doaction ) {
|
if ( 'delete_all' === $doaction ) {
|
||||||
$post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'" );
|
$post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'" );
|
||||||
$doaction = 'delete';
|
$doaction = 'delete';
|
||||||
} elseif ( isset( $_REQUEST['media'] ) ) {
|
} elseif ( isset( $_REQUEST['media'] ) ) {
|
||||||
|
|
|
@ -204,7 +204,7 @@ switch ( $action ) {
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if ( isset( $_GET['error'] ) ) : ?>
|
<?php if ( isset( $_GET['error'] ) ) : ?>
|
||||||
<div class="notice notice-error">
|
<div class="notice notice-error">
|
||||||
<?php if ( 'new-email' == $_GET['error'] ) : ?>
|
<?php if ( 'new-email' === $_GET['error'] ) : ?>
|
||||||
<p><?php _e( 'Error while saving the new email address. Please try again.' ); ?></p>
|
<p><?php _e( 'Error while saving the new email address. Please try again.' ); ?></p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -29,7 +29,7 @@ if ( is_multisite() ) {
|
||||||
add_filter( 'wpmu_signup_user_notification_email', 'admin_created_user_email' );
|
add_filter( 'wpmu_signup_user_notification_email', 'admin_created_user_email' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $_REQUEST['action'] ) && 'adduser' == $_REQUEST['action'] ) {
|
if ( isset( $_REQUEST['action'] ) && 'adduser' === $_REQUEST['action'] ) {
|
||||||
check_admin_referer( 'add-user', '_wpnonce_add-user' );
|
check_admin_referer( 'add-user', '_wpnonce_add-user' );
|
||||||
|
|
||||||
$user_details = null;
|
$user_details = null;
|
||||||
|
@ -148,7 +148,7 @@ Please click the following link to confirm the invite:
|
||||||
}
|
}
|
||||||
wp_redirect( $redirect );
|
wp_redirect( $redirect );
|
||||||
die();
|
die();
|
||||||
} elseif ( isset( $_REQUEST['action'] ) && 'createuser' == $_REQUEST['action'] ) {
|
} elseif ( isset( $_REQUEST['action'] ) && 'createuser' === $_REQUEST['action'] ) {
|
||||||
check_admin_referer( 'create-user', '_wpnonce_create-user' );
|
check_admin_referer( 'create-user', '_wpnonce_create-user' );
|
||||||
|
|
||||||
if ( ! current_user_can( 'create_users' ) ) {
|
if ( ! current_user_can( 'create_users' ) ) {
|
||||||
|
@ -331,7 +331,7 @@ if ( isset( $_GET['update'] ) ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( 'add' == $_GET['update'] ) {
|
if ( 'add' === $_GET['update'] ) {
|
||||||
$messages[] = __( 'User added.' );
|
$messages[] = __( 'User added.' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,24 +32,26 @@ global $feature_class;
|
||||||
|
|
||||||
<footer class="entry-meta">
|
<footer class="entry-meta">
|
||||||
<?php
|
<?php
|
||||||
/* translators: Used between list items, there is a space after the comma. */
|
/* translators: Used between list items, there is a space after the comma. */
|
||||||
$tag_list = get_the_tag_list( '', __( ', ', 'twentyeleven' ) );
|
$tag_list = get_the_tag_list( '', __( ', ', 'twentyeleven' ) );
|
||||||
if ( '' != $tag_list ) {
|
|
||||||
|
if ( '' !== $tag_list ) {
|
||||||
/* translators: 1: Category list, 2: Tag list, 3: Post permalink, 4: Post title. */
|
/* translators: 1: Category list, 2: Tag list, 3: Post permalink, 4: Post title. */
|
||||||
$utility_text = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyeleven' );
|
$utility_text = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyeleven' );
|
||||||
} else {
|
} else {
|
||||||
/* translators: 1: Category list, 3: Post permalink, 4: Post title. */
|
/* translators: 1: Category list, 3: Post permalink, 4: Post title. */
|
||||||
$utility_text = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyeleven' );
|
$utility_text = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyeleven' );
|
||||||
}
|
}
|
||||||
printf(
|
|
||||||
$utility_text,
|
printf(
|
||||||
/* translators: Used between list items, there is a space after the comma. */
|
$utility_text,
|
||||||
get_the_category_list( __( ', ', 'twentyeleven' ) ),
|
/* translators: Used between list items, there is a space after the comma. */
|
||||||
$tag_list,
|
get_the_category_list( __( ', ', 'twentyeleven' ) ),
|
||||||
esc_url( get_permalink() ),
|
$tag_list,
|
||||||
the_title_attribute( 'echo=0' )
|
esc_url( get_permalink() ),
|
||||||
);
|
the_title_attribute( 'echo=0' )
|
||||||
?>
|
);
|
||||||
|
?>
|
||||||
|
|
||||||
<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
|
<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
|
||||||
</footer><!-- .entry-meta -->
|
</footer><!-- .entry-meta -->
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<header class="entry-header">
|
<header class="entry-header">
|
||||||
<h1 class="entry-title"><?php the_title(); ?></h1>
|
<h1 class="entry-title"><?php the_title(); ?></h1>
|
||||||
|
|
||||||
<?php if ( 'post' == get_post_type() ) : ?>
|
<?php if ( 'post' === get_post_type() ) : ?>
|
||||||
<div class="entry-meta">
|
<div class="entry-meta">
|
||||||
<?php twentyeleven_posted_on(); ?>
|
<?php twentyeleven_posted_on(); ?>
|
||||||
</div><!-- .entry-meta -->
|
</div><!-- .entry-meta -->
|
||||||
|
@ -33,15 +33,16 @@
|
||||||
|
|
||||||
<footer class="entry-meta">
|
<footer class="entry-meta">
|
||||||
<?php
|
<?php
|
||||||
/* translators: Used between list items, there is a space after the comma. */
|
/* translators: Used between list items, there is a space after the comma. */
|
||||||
$categories_list = get_the_category_list( __( ', ', 'twentyeleven' ) );
|
$categories_list = get_the_category_list( __( ', ', 'twentyeleven' ) );
|
||||||
|
|
||||||
/* translators: Used between list items, there is a space after the comma. */
|
/* translators: Used between list items, there is a space after the comma. */
|
||||||
$tag_list = get_the_tag_list( '', __( ', ', 'twentyeleven' ) );
|
$tag_list = get_the_tag_list( '', __( ', ', 'twentyeleven' ) );
|
||||||
if ( '' != $tag_list ) {
|
|
||||||
|
if ( '' !== $tag_list ) {
|
||||||
/* translators: 1: Categories list, 2: Tag list, 3: Permalink, 4: Post title, 5: Author name, 6: Author URL. */
|
/* translators: 1: Categories list, 2: Tag list, 3: Permalink, 4: Post title, 5: Author name, 6: Author URL. */
|
||||||
$utility_text = __( 'This entry was posted in %1$s and tagged %2$s by <a href="%6$s">%5$s</a>. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyeleven' );
|
$utility_text = __( 'This entry was posted in %1$s and tagged %2$s by <a href="%6$s">%5$s</a>. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyeleven' );
|
||||||
} elseif ( '' != $categories_list ) {
|
} elseif ( '' !== $categories_list ) {
|
||||||
/* translators: 1: Categories list, 2: Tag list, 3: Permalink, 4: Post title, 5: Author name, 6: Author URL. */
|
/* translators: 1: Categories list, 2: Tag list, 3: Permalink, 4: Post title, 5: Author name, 6: Author URL. */
|
||||||
$utility_text = __( 'This entry was posted in %1$s by <a href="%6$s">%5$s</a>. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyeleven' );
|
$utility_text = __( 'This entry was posted in %1$s by <a href="%6$s">%5$s</a>. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyeleven' );
|
||||||
} else {
|
} else {
|
||||||
|
@ -49,16 +50,17 @@
|
||||||
$utility_text = __( 'This entry was posted by <a href="%6$s">%5$s</a>. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyeleven' );
|
$utility_text = __( 'This entry was posted by <a href="%6$s">%5$s</a>. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyeleven' );
|
||||||
}
|
}
|
||||||
|
|
||||||
printf(
|
printf(
|
||||||
$utility_text,
|
$utility_text,
|
||||||
$categories_list,
|
$categories_list,
|
||||||
$tag_list,
|
$tag_list,
|
||||||
esc_url( get_permalink() ),
|
esc_url( get_permalink() ),
|
||||||
the_title_attribute( 'echo=0' ),
|
the_title_attribute( 'echo=0' ),
|
||||||
get_the_author(),
|
get_the_author(),
|
||||||
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) )
|
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) )
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
|
<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<h1 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
|
<h1 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if ( 'post' == get_post_type() ) : ?>
|
<?php if ( 'post' === get_post_type() ) : ?>
|
||||||
<div class="entry-meta">
|
<div class="entry-meta">
|
||||||
<?php twentyeleven_posted_on(); ?>
|
<?php twentyeleven_posted_on(); ?>
|
||||||
</div><!-- .entry-meta -->
|
</div><!-- .entry-meta -->
|
||||||
|
|
|
@ -147,7 +147,7 @@ if ( ! function_exists( 'twentyeleven_setup' ) ) :
|
||||||
add_theme_support( 'post-formats', array( 'aside', 'link', 'gallery', 'status', 'quote', 'image' ) );
|
add_theme_support( 'post-formats', array( 'aside', 'link', 'gallery', 'status', 'quote', 'image' ) );
|
||||||
|
|
||||||
$theme_options = twentyeleven_get_theme_options();
|
$theme_options = twentyeleven_get_theme_options();
|
||||||
if ( 'dark' == $theme_options['color_scheme'] ) {
|
if ( 'dark' === $theme_options['color_scheme'] ) {
|
||||||
$default_background_color = '1d1d1d';
|
$default_background_color = '1d1d1d';
|
||||||
} else {
|
} else {
|
||||||
$default_background_color = 'e2e2e2';
|
$default_background_color = 'e2e2e2';
|
||||||
|
@ -328,7 +328,7 @@ if ( ! function_exists( 'twentyeleven_header_style' ) ) :
|
||||||
<style type="text/css" id="twentyeleven-header-css">
|
<style type="text/css" id="twentyeleven-header-css">
|
||||||
<?php
|
<?php
|
||||||
// Has the text been hidden?
|
// Has the text been hidden?
|
||||||
if ( 'blank' == $text_color ) :
|
if ( 'blank' === $text_color ) :
|
||||||
?>
|
?>
|
||||||
#site-title,
|
#site-title,
|
||||||
#site-description {
|
#site-description {
|
||||||
|
@ -719,28 +719,29 @@ if ( ! function_exists( 'twentyeleven_comment' ) ) :
|
||||||
<footer class="comment-meta">
|
<footer class="comment-meta">
|
||||||
<div class="comment-author vcard">
|
<div class="comment-author vcard">
|
||||||
<?php
|
<?php
|
||||||
$avatar_size = 68;
|
$avatar_size = 68;
|
||||||
|
|
||||||
if ( '0' != $comment->comment_parent ) {
|
if ( '0' != $comment->comment_parent ) {
|
||||||
$avatar_size = 39;
|
$avatar_size = 39;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo get_avatar( $comment, $avatar_size );
|
echo get_avatar( $comment, $avatar_size );
|
||||||
|
|
||||||
printf(
|
printf(
|
||||||
/* translators: 1: Comment author, 2: Date and time. */
|
/* translators: 1: Comment author, 2: Date and time. */
|
||||||
__( '%1$s on %2$s <span class="says">said:</span>', 'twentyeleven' ),
|
__( '%1$s on %2$s <span class="says">said:</span>', 'twentyeleven' ),
|
||||||
sprintf( '<span class="fn">%s</span>', get_comment_author_link() ),
|
sprintf( '<span class="fn">%s</span>', get_comment_author_link() ),
|
||||||
sprintf(
|
sprintf(
|
||||||
'<a href="%1$s"><time datetime="%2$s">%3$s</time></a>',
|
'<a href="%1$s"><time datetime="%2$s">%3$s</time></a>',
|
||||||
esc_url( get_comment_link( $comment->comment_ID ) ),
|
esc_url( get_comment_link( $comment->comment_ID ) ),
|
||||||
get_comment_time( 'c' ),
|
get_comment_time( 'c' ),
|
||||||
/* translators: 1: Date, 2: Time. */
|
/* translators: 1: Date, 2: Time. */
|
||||||
sprintf( __( '%1$s at %2$s', 'twentyeleven' ), get_comment_date(), get_comment_time() )
|
sprintf( __( '%1$s at %2$s', 'twentyeleven' ), get_comment_date(), get_comment_time() )
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php edit_comment_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
|
<?php edit_comment_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
|
||||||
</div><!-- .comment-author .vcard -->
|
</div><!-- .comment-author .vcard -->
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -128,7 +128,7 @@ if ( is_singular() && get_option( 'thread_comments' ) ) {
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
// Has the text been hidden?
|
// Has the text been hidden?
|
||||||
if ( 'blank' == get_header_textcolor() ) :
|
if ( 'blank' === get_header_textcolor() ) :
|
||||||
$header_image_class = '';
|
$header_image_class = '';
|
||||||
if ( $header_image ) {
|
if ( $header_image ) {
|
||||||
$header_image_class = ' with-image';
|
$header_image_class = ' with-image';
|
||||||
|
|
|
@ -418,7 +418,7 @@ function twentyeleven_enqueue_color_scheme() {
|
||||||
$options = twentyeleven_get_theme_options();
|
$options = twentyeleven_get_theme_options();
|
||||||
$color_scheme = $options['color_scheme'];
|
$color_scheme = $options['color_scheme'];
|
||||||
|
|
||||||
if ( 'dark' == $color_scheme ) {
|
if ( 'dark' === $color_scheme ) {
|
||||||
wp_enqueue_style( 'dark', get_template_directory_uri() . '/colors/dark.css', array(), '20190404' );
|
wp_enqueue_style( 'dark', get_template_directory_uri() . '/colors/dark.css', array(), '20190404' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,9 +499,9 @@ function twentyeleven_layout_classes( $existing_classes ) {
|
||||||
$classes = array( 'one-column' );
|
$classes = array( 'one-column' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'content-sidebar' == $current_layout ) {
|
if ( 'content-sidebar' === $current_layout ) {
|
||||||
$classes[] = 'right-sidebar';
|
$classes[] = 'right-sidebar';
|
||||||
} elseif ( 'sidebar-content' == $current_layout ) {
|
} elseif ( 'sidebar-content' === $current_layout ) {
|
||||||
$classes[] = 'left-sidebar';
|
$classes[] = 'left-sidebar';
|
||||||
} else {
|
} else {
|
||||||
$classes[] = $current_layout;
|
$classes[] = $current_layout;
|
||||||
|
|
|
@ -111,7 +111,7 @@ class Twenty_Eleven_Ephemera_Widget extends WP_Widget {
|
||||||
$ephemera->the_post();
|
$ephemera->the_post();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php if ( 'link' != get_post_format() ) : ?>
|
<?php if ( 'link' !== get_post_format() ) : ?>
|
||||||
|
|
||||||
<li class="widget-entry-title">
|
<li class="widget-entry-title">
|
||||||
<a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark"><?php the_title(); ?></a>
|
<a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark"><?php the_title(); ?></a>
|
||||||
|
|
|
@ -33,7 +33,7 @@ get_header(); ?>
|
||||||
* We are using a heading by rendering the_content
|
* We are using a heading by rendering the_content
|
||||||
* If we have content for this page, let's display it.
|
* If we have content for this page, let's display it.
|
||||||
*/
|
*/
|
||||||
if ( '' != get_the_content() ) {
|
if ( '' !== get_the_content() ) {
|
||||||
get_template_part( 'content', 'intro' );
|
get_template_part( 'content', 'intro' );
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
$options = twentyeleven_get_theme_options();
|
$options = twentyeleven_get_theme_options();
|
||||||
$current_layout = $options['theme_layout'];
|
$current_layout = $options['theme_layout'];
|
||||||
|
|
||||||
if ( 'content' != $current_layout ) :
|
if ( 'content' !== $current_layout ) :
|
||||||
?>
|
?>
|
||||||
<div id="secondary" class="widget-area" role="complementary">
|
<div id="secondary" class="widget-area" role="complementary">
|
||||||
<?php if ( ! dynamic_sidebar( 'sidebar-1' ) ) : ?>
|
<?php if ( ! dynamic_sidebar( 'sidebar-1' ) ) : ?>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<?php the_excerpt(); ?>
|
<?php the_excerpt(); ?>
|
||||||
</div><!-- .entry-summary -->
|
</div><!-- .entry-summary -->
|
||||||
|
|
||||||
<?php if ( 'post' == get_post_type() ) : ?>
|
<?php if ( 'post' === get_post_type() ) : ?>
|
||||||
|
|
||||||
<footer class="entry-footer">
|
<footer class="entry-footer">
|
||||||
<?php twentyfifteen_entry_meta(); ?>
|
<?php twentyfifteen_entry_meta(); ?>
|
||||||
|
|
|
@ -320,13 +320,13 @@ if ( ! function_exists( 'twentyfifteen_fonts_url' ) ) :
|
||||||
*/
|
*/
|
||||||
$subset = _x( 'no-subset', 'Add new subset (greek, cyrillic, devanagari, vietnamese)', 'twentyfifteen' );
|
$subset = _x( 'no-subset', 'Add new subset (greek, cyrillic, devanagari, vietnamese)', 'twentyfifteen' );
|
||||||
|
|
||||||
if ( 'cyrillic' == $subset ) {
|
if ( 'cyrillic' === $subset ) {
|
||||||
$subsets .= ',cyrillic,cyrillic-ext';
|
$subsets .= ',cyrillic,cyrillic-ext';
|
||||||
} elseif ( 'greek' == $subset ) {
|
} elseif ( 'greek' === $subset ) {
|
||||||
$subsets .= ',greek,greek-ext';
|
$subsets .= ',greek,greek-ext';
|
||||||
} elseif ( 'devanagari' == $subset ) {
|
} elseif ( 'devanagari' === $subset ) {
|
||||||
$subsets .= ',devanagari';
|
$subsets .= ',devanagari';
|
||||||
} elseif ( 'vietnamese' == $subset ) {
|
} elseif ( 'vietnamese' === $subset ) {
|
||||||
$subsets .= ',vietnamese';
|
$subsets .= ',vietnamese';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,7 +460,7 @@ function twentyfifteen_post_nav_background() {
|
||||||
$next = get_adjacent_post( false, '', false );
|
$next = get_adjacent_post( false, '', false );
|
||||||
$css = '';
|
$css = '';
|
||||||
|
|
||||||
if ( is_attachment() && 'attachment' == $previous->post_type ) {
|
if ( is_attachment() && 'attachment' === $previous->post_type ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -498,7 +498,7 @@ add_action( 'wp_enqueue_scripts', 'twentyfifteen_post_nav_background' );
|
||||||
* @return string Menu item with possible description.
|
* @return string Menu item with possible description.
|
||||||
*/
|
*/
|
||||||
function twentyfifteen_nav_description( $item_output, $item, $depth, $args ) {
|
function twentyfifteen_nav_description( $item_output, $item, $depth, $args ) {
|
||||||
if ( 'primary' == $args->theme_location && $item->description ) {
|
if ( 'primary' === $args->theme_location && $item->description ) {
|
||||||
$item_output = str_replace( $args->link_after . '</a>', '<div class="menu-item-description">' . $item->description . '</div>' . $args->link_after . '</a>', $item_output );
|
$item_output = str_replace( $args->link_after . '</a>', '<div class="menu-item-description">' . $item->description . '</div>' . $args->link_after . '</a>', $item_output );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ if ( ! function_exists( 'twentyfifteen_entry_meta' ) ) :
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'post' == get_post_type() ) {
|
if ( 'post' === get_post_type() ) {
|
||||||
if ( is_singular() || is_multi_author() ) {
|
if ( is_singular() || is_multi_author() ) {
|
||||||
printf(
|
printf(
|
||||||
'<span class="byline"><span class="author vcard"><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>',
|
'<span class="byline"><span class="author vcard"><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>',
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<?php
|
<?php
|
||||||
// Output the featured image.
|
// Output the featured image.
|
||||||
if ( has_post_thumbnail() ) :
|
if ( has_post_thumbnail() ) :
|
||||||
if ( 'grid' == get_theme_mod( 'featured_content_layout' ) ) {
|
if ( 'grid' === get_theme_mod( 'featured_content_layout' ) ) {
|
||||||
the_post_thumbnail();
|
the_post_thumbnail();
|
||||||
} else {
|
} else {
|
||||||
the_post_thumbnail( 'twentyfourteen-full-width' );
|
the_post_thumbnail( 'twentyfourteen-full-width' );
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
<div class="entry-meta">
|
<div class="entry-meta">
|
||||||
<?php
|
<?php
|
||||||
if ( 'post' == get_post_type() ) {
|
if ( 'post' === get_post_type() ) {
|
||||||
twentyfourteen_posted_on();
|
twentyfourteen_posted_on();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -340,7 +340,7 @@ function twentyfourteen_scripts() {
|
||||||
wp_enqueue_script( 'jquery-masonry' );
|
wp_enqueue_script( 'jquery-masonry' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) {
|
if ( is_front_page() && 'slider' === get_theme_mod( 'featured_content_layout' ) ) {
|
||||||
wp_enqueue_script( 'twentyfourteen-slider', get_template_directory_uri() . '/js/slider.js', array( 'jquery' ), '20150120', true );
|
wp_enqueue_script( 'twentyfourteen-slider', get_template_directory_uri() . '/js/slider.js', array( 'jquery' ), '20150120', true );
|
||||||
wp_localize_script(
|
wp_localize_script(
|
||||||
'twentyfourteen-slider',
|
'twentyfourteen-slider',
|
||||||
|
@ -567,7 +567,7 @@ function twentyfourteen_body_classes( $classes ) {
|
||||||
$classes[] = 'singular';
|
$classes[] = 'singular';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) {
|
if ( is_front_page() && 'slider' === get_theme_mod( 'featured_content_layout' ) ) {
|
||||||
$classes[] = 'slider';
|
$classes[] = 'slider';
|
||||||
} elseif ( is_front_page() ) {
|
} elseif ( is_front_page() ) {
|
||||||
$classes[] = 'grid';
|
$classes[] = 'grid';
|
||||||
|
|
|
@ -302,7 +302,7 @@ class Featured_Content {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bail if term objects are unavailable.
|
// Bail if term objects are unavailable.
|
||||||
if ( 'all' != $args['fields'] ) {
|
if ( 'all' !== $args['fields'] ) {
|
||||||
return $terms;
|
return $terms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,7 +339,7 @@ class Featured_Content {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure we are in the correct taxonomy.
|
// Make sure we are in the correct taxonomy.
|
||||||
if ( 'post_tag' != $taxonomy ) {
|
if ( 'post_tag' !== $taxonomy ) {
|
||||||
return $terms;
|
return $terms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,7 +466,7 @@ class Featured_Content {
|
||||||
$options = wp_parse_args( $saved, $defaults );
|
$options = wp_parse_args( $saved, $defaults );
|
||||||
$options = array_intersect_key( $options, $defaults );
|
$options = array_intersect_key( $options, $defaults );
|
||||||
|
|
||||||
if ( 'all' != $key ) {
|
if ( 'all' !== $key ) {
|
||||||
return isset( $options[ $key ] ) ? $options[ $key ] : false;
|
return isset( $options[ $key ] ) ? $options[ $key ] : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,9 @@ class TwentyNineteen_SVG_Icons {
|
||||||
* Gets the SVG code for a given icon.
|
* Gets the SVG code for a given icon.
|
||||||
*/
|
*/
|
||||||
public static function get_svg( $group, $icon, $size ) {
|
public static function get_svg( $group, $icon, $size ) {
|
||||||
if ( 'ui' == $group ) {
|
if ( 'ui' === $group ) {
|
||||||
$arr = self::$ui_icons;
|
$arr = self::$ui_icons;
|
||||||
} elseif ( 'social' == $group ) {
|
} elseif ( 'social' === $group ) {
|
||||||
$arr = self::$social_icons;
|
$arr = self::$social_icons;
|
||||||
} else {
|
} else {
|
||||||
$arr = array();
|
$arr = array();
|
||||||
|
|
|
@ -62,7 +62,7 @@ while ( have_posts() ) :
|
||||||
|
|
||||||
<?php /* How to display posts of the Gallery format. The gallery category is the old way. */ ?>
|
<?php /* How to display posts of the Gallery format. The gallery category is the old way. */ ?>
|
||||||
|
|
||||||
<?php if ( ( function_exists( 'get_post_format' ) && 'gallery' == get_post_format( $post->ID ) ) || in_category( _x( 'gallery', 'gallery category slug', 'twentyten' ) ) ) : ?>
|
<?php if ( ( function_exists( 'get_post_format' ) && 'gallery' === get_post_format( $post->ID ) ) || in_category( _x( 'gallery', 'gallery category slug', 'twentyten' ) ) ) : ?>
|
||||||
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||||
<h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
|
<h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ while ( have_posts() ) :
|
||||||
<div class="entry-utility">
|
<div class="entry-utility">
|
||||||
<?php
|
<?php
|
||||||
$gallery = get_term_by( 'slug', _x( 'gallery', 'gallery category slug', 'twentyten' ), 'category' );
|
$gallery = get_term_by( 'slug', _x( 'gallery', 'gallery category slug', 'twentyten' ), 'category' );
|
||||||
if ( function_exists( 'get_post_format' ) && 'gallery' == get_post_format( $post->ID ) ) :
|
if ( function_exists( 'get_post_format' ) && 'gallery' === get_post_format( $post->ID ) ) :
|
||||||
?>
|
?>
|
||||||
<a href="<?php echo esc_url( get_post_format_link( 'gallery' ) ); ?>" title="<?php esc_attr_e( 'View Galleries', 'twentyten' ); ?>"><?php _e( 'More Galleries', 'twentyten' ); ?></a>
|
<a href="<?php echo esc_url( get_post_format_link( 'gallery' ) ); ?>" title="<?php esc_attr_e( 'View Galleries', 'twentyten' ); ?>"><?php _e( 'More Galleries', 'twentyten' ); ?></a>
|
||||||
<span class="meta-sep">|</span>
|
<span class="meta-sep">|</span>
|
||||||
|
@ -117,7 +117,7 @@ while ( have_posts() ) :
|
||||||
|
|
||||||
<?php /* How to display posts of the Aside format. The asides category is the old way. */ ?>
|
<?php /* How to display posts of the Aside format. The asides category is the old way. */ ?>
|
||||||
|
|
||||||
<?php elseif ( ( function_exists( 'get_post_format' ) && 'aside' == get_post_format( $post->ID ) ) || in_category( _x( 'asides', 'asides category slug', 'twentyten' ) ) ) : ?>
|
<?php elseif ( ( function_exists( 'get_post_format' ) && 'aside' === get_post_format( $post->ID ) ) || in_category( _x( 'asides', 'asides category slug', 'twentyten' ) ) ) : ?>
|
||||||
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||||
|
|
||||||
<?php if ( is_archive() || is_search() ) : // Display excerpts for archives and search. ?>
|
<?php if ( is_archive() || is_search() ) : // Display excerpts for archives and search. ?>
|
||||||
|
|
|
@ -478,7 +478,7 @@ if ( ! function_exists( 'twentythirteen_entry_meta' ) ) :
|
||||||
echo '<span class="featured-post">' . esc_html__( 'Sticky', 'twentythirteen' ) . '</span>';
|
echo '<span class="featured-post">' . esc_html__( 'Sticky', 'twentythirteen' ) . '</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! has_post_format( 'link' ) && 'post' == get_post_type() ) {
|
if ( ! has_post_format( 'link' ) && 'post' === get_post_type() ) {
|
||||||
twentythirteen_entry_date();
|
twentythirteen_entry_date();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,7 +495,7 @@ if ( ! function_exists( 'twentythirteen_entry_meta' ) ) :
|
||||||
}
|
}
|
||||||
|
|
||||||
// Post author.
|
// Post author.
|
||||||
if ( 'post' == get_post_type() ) {
|
if ( 'post' === get_post_type() ) {
|
||||||
printf(
|
printf(
|
||||||
'<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>',
|
'<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>',
|
||||||
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
|
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
// Header text color.
|
// Header text color.
|
||||||
wp.customize( 'header_textcolor', function( value ) {
|
wp.customize( 'header_textcolor', function( value ) {
|
||||||
value.bind( function( to ) {
|
value.bind( function( to ) {
|
||||||
if ( 'blank' == to ) {
|
if ( 'blank' === to ) {
|
||||||
if ( 'remove-header' == wp.customize.instance( 'header_image' ).get() ) {
|
if ( 'remove-header' === wp.customize.instance( 'header_image' ).get() ) {
|
||||||
$( '.home-link' ).css( 'min-height', '0' );
|
$( '.home-link' ).css( 'min-height', '0' );
|
||||||
}
|
}
|
||||||
$( '.site-title, .site-description' ).css( {
|
$( '.site-title, .site-description' ).css( {
|
||||||
|
|
|
@ -158,11 +158,11 @@ function twentytwelve_get_font_url() {
|
||||||
*/
|
*/
|
||||||
$subset = _x( 'no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)', 'twentytwelve' );
|
$subset = _x( 'no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)', 'twentytwelve' );
|
||||||
|
|
||||||
if ( 'cyrillic' == $subset ) {
|
if ( 'cyrillic' === $subset ) {
|
||||||
$subsets .= ',cyrillic,cyrillic-ext';
|
$subsets .= ',cyrillic,cyrillic-ext';
|
||||||
} elseif ( 'greek' == $subset ) {
|
} elseif ( 'greek' === $subset ) {
|
||||||
$subsets .= ',greek,greek-ext';
|
$subsets .= ',greek,greek-ext';
|
||||||
} elseif ( 'vietnamese' == $subset ) {
|
} elseif ( 'vietnamese' === $subset ) {
|
||||||
$subsets .= ',vietnamese';
|
$subsets .= ',vietnamese';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,9 +41,9 @@
|
||||||
value.bind( function( to ) {
|
value.bind( function( to ) {
|
||||||
var body = $( 'body' );
|
var body = $( 'body' );
|
||||||
|
|
||||||
if ( ( '#ffffff' == to || '#fff' == to ) && 'none' == body.css( 'background-image' ) )
|
if ( ( '#ffffff' === to || '#fff' === to ) && 'none' === body.css( 'background-image' ) )
|
||||||
body.addClass( 'custom-background-white' );
|
body.addClass( 'custom-background-white' );
|
||||||
else if ( '' == to && 'none' == body.css( 'background-image' ) )
|
else if ( '' === to && 'none' === body.css( 'background-image' ) )
|
||||||
body.addClass( 'custom-background-empty' );
|
body.addClass( 'custom-background-empty' );
|
||||||
else
|
else
|
||||||
body.removeClass( 'custom-background-empty custom-background-white' );
|
body.removeClass( 'custom-background-empty custom-background-white' );
|
||||||
|
|
|
@ -701,19 +701,20 @@ function wp_admin_bar_edit_menu( $wp_admin_bar ) {
|
||||||
if ( is_admin() ) {
|
if ( is_admin() ) {
|
||||||
$current_screen = get_current_screen();
|
$current_screen = get_current_screen();
|
||||||
$post = get_post();
|
$post = get_post();
|
||||||
if ( 'post' == $current_screen->base ) {
|
|
||||||
|
if ( 'post' === $current_screen->base ) {
|
||||||
$post_type_object = get_post_type_object( $post->post_type );
|
$post_type_object = get_post_type_object( $post->post_type );
|
||||||
} elseif ( 'edit' == $current_screen->base ) {
|
} elseif ( 'edit' === $current_screen->base ) {
|
||||||
$post_type_object = get_post_type_object( $current_screen->post_type );
|
$post_type_object = get_post_type_object( $current_screen->post_type );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'post' == $current_screen->base
|
if ( 'post' === $current_screen->base
|
||||||
&& 'add' != $current_screen->action
|
&& 'add' !== $current_screen->action
|
||||||
&& ( $post_type_object )
|
&& ( $post_type_object )
|
||||||
&& current_user_can( 'read_post', $post->ID )
|
&& current_user_can( 'read_post', $post->ID )
|
||||||
&& ( $post_type_object->public )
|
&& ( $post_type_object->public )
|
||||||
&& ( $post_type_object->show_in_admin_bar ) ) {
|
&& ( $post_type_object->show_in_admin_bar ) ) {
|
||||||
if ( 'draft' == $post->post_status ) {
|
if ( 'draft' === $post->post_status ) {
|
||||||
$preview_link = get_preview_post_link( $post );
|
$preview_link = get_preview_post_link( $post );
|
||||||
$wp_admin_bar->add_node(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
|
@ -732,7 +733,7 @@ function wp_admin_bar_edit_menu( $wp_admin_bar ) {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} elseif ( 'edit' == $current_screen->base
|
} elseif ( 'edit' === $current_screen->base
|
||||||
&& ( $post_type_object )
|
&& ( $post_type_object )
|
||||||
&& ( $post_type_object->public )
|
&& ( $post_type_object->public )
|
||||||
&& ( $post_type_object->show_in_admin_bar )
|
&& ( $post_type_object->show_in_admin_bar )
|
||||||
|
@ -745,7 +746,7 @@ function wp_admin_bar_edit_menu( $wp_admin_bar ) {
|
||||||
'href' => get_post_type_archive_link( $current_screen->post_type ),
|
'href' => get_post_type_archive_link( $current_screen->post_type ),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
} elseif ( 'term' == $current_screen->base && isset( $tag ) && is_object( $tag ) && ! is_wp_error( $tag ) ) {
|
} elseif ( 'term' === $current_screen->base && isset( $tag ) && is_object( $tag ) && ! is_wp_error( $tag ) ) {
|
||||||
$tax = get_taxonomy( $tag->taxonomy );
|
$tax = get_taxonomy( $tag->taxonomy );
|
||||||
if ( is_taxonomy_viewable( $tax ) ) {
|
if ( is_taxonomy_viewable( $tax ) ) {
|
||||||
$wp_admin_bar->add_node(
|
$wp_admin_bar->add_node(
|
||||||
|
@ -756,7 +757,7 @@ function wp_admin_bar_edit_menu( $wp_admin_bar ) {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} elseif ( 'user-edit' == $current_screen->base && isset( $user_id ) ) {
|
} elseif ( 'user-edit' === $current_screen->base && isset( $user_id ) ) {
|
||||||
$user_object = get_userdata( $user_id );
|
$user_object = get_userdata( $user_id );
|
||||||
$view_link = get_author_posts_url( $user_object->ID );
|
$view_link = get_author_posts_url( $user_object->ID );
|
||||||
if ( $user_object->exists() && $view_link ) {
|
if ( $user_object->exists() && $view_link ) {
|
||||||
|
@ -1204,7 +1205,7 @@ function is_admin_bar_showing() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! isset( $show_admin_bar ) ) {
|
if ( ! isset( $show_admin_bar ) ) {
|
||||||
if ( ! is_user_logged_in() || 'wp-login.php' == $pagenow ) {
|
if ( ! is_user_logged_in() || 'wp-login.php' === $pagenow ) {
|
||||||
$show_admin_bar = false;
|
$show_admin_bar = false;
|
||||||
} else {
|
} else {
|
||||||
$show_admin_bar = _get_admin_bar_pref();
|
$show_admin_bar = _get_admin_bar_pref();
|
||||||
|
|
|
@ -349,7 +349,7 @@ function get_author_posts_url( $author_id, $author_nicename = '' ) {
|
||||||
$file = home_url( '/' );
|
$file = home_url( '/' );
|
||||||
$link = $file . '?author=' . $auth_ID;
|
$link = $file . '?author=' . $auth_ID;
|
||||||
} else {
|
} else {
|
||||||
if ( '' == $author_nicename ) {
|
if ( '' === $author_nicename ) {
|
||||||
$user = get_userdata( $author_id );
|
$user = get_userdata( $author_id );
|
||||||
if ( ! empty( $user->user_nicename ) ) {
|
if ( ! empty( $user->user_nicename ) ) {
|
||||||
$author_nicename = $user->user_nicename;
|
$author_nicename = $user->user_nicename;
|
||||||
|
@ -467,7 +467,7 @@ function wp_list_authors( $args = '' ) {
|
||||||
continue; // No need to go further to process HTML.
|
continue; // No need to go further to process HTML.
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'list' == $args['style'] ) {
|
if ( 'list' === $args['style'] ) {
|
||||||
$return .= '<li>';
|
$return .= '<li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,7 +513,7 @@ function wp_list_authors( $args = '' ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$return .= $link;
|
$return .= $link;
|
||||||
$return .= ( 'list' == $args['style'] ) ? '</li>' : ', ';
|
$return .= ( 'list' === $args['style'] ) ? '</li>' : ', ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$return = rtrim( $return, ', ' );
|
$return = rtrim( $return, ', ' );
|
||||||
|
|
|
@ -83,7 +83,7 @@ function _walk_bookmarks( $bookmarks, $args = '' ) {
|
||||||
$title = $desc;
|
$title = $desc;
|
||||||
|
|
||||||
if ( $parsed_args['show_updated'] ) {
|
if ( $parsed_args['show_updated'] ) {
|
||||||
if ( '00' != substr( $bookmark->link_updated_f, 0, 2 ) ) {
|
if ( '00' !== substr( $bookmark->link_updated_f, 0, 2 ) ) {
|
||||||
$title .= ' (';
|
$title .= ' (';
|
||||||
$title .= sprintf(
|
$title .= sprintf(
|
||||||
/* translators: %s: Date and time of last update. */
|
/* translators: %s: Date and time of last update. */
|
||||||
|
@ -98,15 +98,15 @@ function _walk_bookmarks( $bookmarks, $args = '' ) {
|
||||||
}
|
}
|
||||||
$alt = ' alt="' . $name . ( $parsed_args['show_description'] ? ' ' . $title : '' ) . '"';
|
$alt = ' alt="' . $name . ( $parsed_args['show_description'] ? ' ' . $title : '' ) . '"';
|
||||||
|
|
||||||
if ( '' != $title ) {
|
if ( '' !== $title ) {
|
||||||
$title = ' title="' . $title . '"';
|
$title = ' title="' . $title . '"';
|
||||||
}
|
}
|
||||||
$rel = $bookmark->link_rel;
|
$rel = $bookmark->link_rel;
|
||||||
if ( '' != $rel ) {
|
if ( '' !== $rel ) {
|
||||||
$rel = ' rel="' . esc_attr( $rel ) . '"';
|
$rel = ' rel="' . esc_attr( $rel ) . '"';
|
||||||
}
|
}
|
||||||
$target = $bookmark->link_target;
|
$target = $bookmark->link_target;
|
||||||
if ( '' != $target ) {
|
if ( '' !== $target ) {
|
||||||
$target = ' target="' . $target . '"';
|
$target = ' target="' . $target . '"';
|
||||||
}
|
}
|
||||||
$output .= '<a href="' . $the_link . '"' . $rel . $title . $target . '>';
|
$output .= '<a href="' . $the_link . '"' . $rel . $title . $target . '>';
|
||||||
|
@ -134,7 +134,7 @@ function _walk_bookmarks( $bookmarks, $args = '' ) {
|
||||||
$output .= '</em>';
|
$output .= '</em>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $parsed_args['show_description'] && '' != $desc ) {
|
if ( $parsed_args['show_description'] && '' !== $desc ) {
|
||||||
$output .= $parsed_args['between'] . $desc;
|
$output .= $parsed_args['between'] . $desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -418,29 +418,29 @@ function sanitize_bookmark_field( $field, $value, $bookmark_id, $context ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'raw' == $context ) {
|
if ( 'raw' === $context ) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'edit' == $context ) {
|
if ( 'edit' === $context ) {
|
||||||
/** This filter is documented in wp-includes/post.php */
|
/** This filter is documented in wp-includes/post.php */
|
||||||
$value = apply_filters( "edit_{$field}", $value, $bookmark_id );
|
$value = apply_filters( "edit_{$field}", $value, $bookmark_id );
|
||||||
|
|
||||||
if ( 'link_notes' == $field ) {
|
if ( 'link_notes' === $field ) {
|
||||||
$value = esc_html( $value ); // textarea_escaped
|
$value = esc_html( $value ); // textarea_escaped
|
||||||
} else {
|
} else {
|
||||||
$value = esc_attr( $value );
|
$value = esc_attr( $value );
|
||||||
}
|
}
|
||||||
} elseif ( 'db' == $context ) {
|
} elseif ( 'db' === $context ) {
|
||||||
/** This filter is documented in wp-includes/post.php */
|
/** This filter is documented in wp-includes/post.php */
|
||||||
$value = apply_filters( "pre_{$field}", $value );
|
$value = apply_filters( "pre_{$field}", $value );
|
||||||
} else {
|
} else {
|
||||||
/** This filter is documented in wp-includes/post.php */
|
/** This filter is documented in wp-includes/post.php */
|
||||||
$value = apply_filters( "{$field}", $value, $bookmark_id, $context );
|
$value = apply_filters( "{$field}", $value, $bookmark_id, $context );
|
||||||
|
|
||||||
if ( 'attribute' == $context ) {
|
if ( 'attribute' === $context ) {
|
||||||
$value = esc_attr( $value );
|
$value = esc_attr( $value );
|
||||||
} elseif ( 'js' == $context ) {
|
} elseif ( 'js' === $context ) {
|
||||||
$value = esc_js( $value );
|
$value = esc_js( $value );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ function map_meta_cap( $cap, $user_id, ...$args ) {
|
||||||
case 'edit_user':
|
case 'edit_user':
|
||||||
case 'edit_users':
|
case 'edit_users':
|
||||||
// Allow user to edit themselves.
|
// Allow user to edit themselves.
|
||||||
if ( 'edit_user' == $cap && isset( $args[0] ) && $user_id == $args[0] ) {
|
if ( 'edit_user' === $cap && isset( $args[0] ) && $user_id == $args[0] ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ function map_meta_cap( $cap, $user_id, ...$args ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'revision' == $post->post_type ) {
|
if ( 'revision' === $post->post_type ) {
|
||||||
$caps[] = 'do_not_allow';
|
$caps[] = 'do_not_allow';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ function map_meta_cap( $cap, $user_id, ...$args ) {
|
||||||
if ( ! $post_type->map_meta_cap ) {
|
if ( ! $post_type->map_meta_cap ) {
|
||||||
$caps[] = $post_type->cap->$cap;
|
$caps[] = $post_type->cap->$cap;
|
||||||
// Prior to 3.1 we would re-call map_meta_cap here.
|
// Prior to 3.1 we would re-call map_meta_cap here.
|
||||||
if ( 'delete_post' == $cap ) {
|
if ( 'delete_post' === $cap ) {
|
||||||
$cap = $post_type->cap->$cap;
|
$cap = $post_type->cap->$cap;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -105,7 +105,7 @@ function map_meta_cap( $cap, $user_id, ...$args ) {
|
||||||
// If the post is published or scheduled...
|
// If the post is published or scheduled...
|
||||||
if ( in_array( $post->post_status, array( 'publish', 'future' ), true ) ) {
|
if ( in_array( $post->post_status, array( 'publish', 'future' ), true ) ) {
|
||||||
$caps[] = $post_type->cap->delete_published_posts;
|
$caps[] = $post_type->cap->delete_published_posts;
|
||||||
} elseif ( 'trash' == $post->post_status ) {
|
} elseif ( 'trash' === $post->post_status ) {
|
||||||
$status = get_post_meta( $post->ID, '_wp_trash_meta_status', true );
|
$status = get_post_meta( $post->ID, '_wp_trash_meta_status', true );
|
||||||
if ( in_array( $status, array( 'publish', 'future' ), true ) ) {
|
if ( in_array( $status, array( 'publish', 'future' ), true ) ) {
|
||||||
$caps[] = $post_type->cap->delete_published_posts;
|
$caps[] = $post_type->cap->delete_published_posts;
|
||||||
|
@ -122,7 +122,7 @@ function map_meta_cap( $cap, $user_id, ...$args ) {
|
||||||
// The post is published or scheduled, extra cap required.
|
// The post is published or scheduled, extra cap required.
|
||||||
if ( in_array( $post->post_status, array( 'publish', 'future' ), true ) ) {
|
if ( in_array( $post->post_status, array( 'publish', 'future' ), true ) ) {
|
||||||
$caps[] = $post_type->cap->delete_published_posts;
|
$caps[] = $post_type->cap->delete_published_posts;
|
||||||
} elseif ( 'private' == $post->post_status ) {
|
} elseif ( 'private' === $post->post_status ) {
|
||||||
$caps[] = $post_type->cap->delete_private_posts;
|
$caps[] = $post_type->cap->delete_private_posts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ function map_meta_cap( $cap, $user_id, ...$args ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'revision' == $post->post_type ) {
|
if ( 'revision' === $post->post_type ) {
|
||||||
$post = get_post( $post->post_parent );
|
$post = get_post( $post->post_parent );
|
||||||
if ( ! $post ) {
|
if ( ! $post ) {
|
||||||
$caps[] = 'do_not_allow';
|
$caps[] = 'do_not_allow';
|
||||||
|
@ -165,7 +165,7 @@ function map_meta_cap( $cap, $user_id, ...$args ) {
|
||||||
if ( ! $post_type->map_meta_cap ) {
|
if ( ! $post_type->map_meta_cap ) {
|
||||||
$caps[] = $post_type->cap->$cap;
|
$caps[] = $post_type->cap->$cap;
|
||||||
// Prior to 3.1 we would re-call map_meta_cap here.
|
// Prior to 3.1 we would re-call map_meta_cap here.
|
||||||
if ( 'edit_post' == $cap ) {
|
if ( 'edit_post' === $cap ) {
|
||||||
$cap = $post_type->cap->$cap;
|
$cap = $post_type->cap->$cap;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -176,7 +176,7 @@ function map_meta_cap( $cap, $user_id, ...$args ) {
|
||||||
// If the post is published or scheduled...
|
// If the post is published or scheduled...
|
||||||
if ( in_array( $post->post_status, array( 'publish', 'future' ), true ) ) {
|
if ( in_array( $post->post_status, array( 'publish', 'future' ), true ) ) {
|
||||||
$caps[] = $post_type->cap->edit_published_posts;
|
$caps[] = $post_type->cap->edit_published_posts;
|
||||||
} elseif ( 'trash' == $post->post_status ) {
|
} elseif ( 'trash' === $post->post_status ) {
|
||||||
$status = get_post_meta( $post->ID, '_wp_trash_meta_status', true );
|
$status = get_post_meta( $post->ID, '_wp_trash_meta_status', true );
|
||||||
if ( in_array( $status, array( 'publish', 'future' ), true ) ) {
|
if ( in_array( $status, array( 'publish', 'future' ), true ) ) {
|
||||||
$caps[] = $post_type->cap->edit_published_posts;
|
$caps[] = $post_type->cap->edit_published_posts;
|
||||||
|
@ -193,7 +193,7 @@ function map_meta_cap( $cap, $user_id, ...$args ) {
|
||||||
// The post is published or scheduled, extra cap required.
|
// The post is published or scheduled, extra cap required.
|
||||||
if ( in_array( $post->post_status, array( 'publish', 'future' ), true ) ) {
|
if ( in_array( $post->post_status, array( 'publish', 'future' ), true ) ) {
|
||||||
$caps[] = $post_type->cap->edit_published_posts;
|
$caps[] = $post_type->cap->edit_published_posts;
|
||||||
} elseif ( 'private' == $post->post_status ) {
|
} elseif ( 'private' === $post->post_status ) {
|
||||||
$caps[] = $post_type->cap->edit_private_posts;
|
$caps[] = $post_type->cap->edit_private_posts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ function map_meta_cap( $cap, $user_id, ...$args ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'revision' == $post->post_type ) {
|
if ( 'revision' === $post->post_type ) {
|
||||||
$post = get_post( $post->post_parent );
|
$post = get_post( $post->post_parent );
|
||||||
if ( ! $post ) {
|
if ( ! $post ) {
|
||||||
$caps[] = 'do_not_allow';
|
$caps[] = 'do_not_allow';
|
||||||
|
@ -234,7 +234,7 @@ function map_meta_cap( $cap, $user_id, ...$args ) {
|
||||||
if ( ! $post_type->map_meta_cap ) {
|
if ( ! $post_type->map_meta_cap ) {
|
||||||
$caps[] = $post_type->cap->$cap;
|
$caps[] = $post_type->cap->$cap;
|
||||||
// Prior to 3.1 we would re-call map_meta_cap here.
|
// Prior to 3.1 we would re-call map_meta_cap here.
|
||||||
if ( 'read_post' == $cap ) {
|
if ( 'read_post' === $cap ) {
|
||||||
$cap = $post_type->cap->$cap;
|
$cap = $post_type->cap->$cap;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -155,7 +155,7 @@ function get_the_category_list( $separator = '', $parents = '', $post_id = false
|
||||||
$rel = ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) ? 'rel="category tag"' : 'rel="category"';
|
$rel = ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) ? 'rel="category tag"' : 'rel="category"';
|
||||||
|
|
||||||
$thelist = '';
|
$thelist = '';
|
||||||
if ( '' == $separator ) {
|
if ( '' === $separator ) {
|
||||||
$thelist .= '<ul class="post-categories">';
|
$thelist .= '<ul class="post-categories">';
|
||||||
foreach ( $categories as $category ) {
|
foreach ( $categories as $category ) {
|
||||||
$thelist .= "\n\t<li>";
|
$thelist .= "\n\t<li>";
|
||||||
|
@ -351,7 +351,7 @@ function wp_dropdown_categories( $args = '' ) {
|
||||||
$defaults['selected'] = ( is_category() ) ? get_query_var( 'cat' ) : 0;
|
$defaults['selected'] = ( is_category() ) ? get_query_var( 'cat' ) : 0;
|
||||||
|
|
||||||
// Back compat.
|
// Back compat.
|
||||||
if ( isset( $args['type'] ) && 'link' == $args['type'] ) {
|
if ( isset( $args['type'] ) && 'link' === $args['type'] ) {
|
||||||
_deprecated_argument(
|
_deprecated_argument(
|
||||||
__FUNCTION__,
|
__FUNCTION__,
|
||||||
'3.0.0',
|
'3.0.0',
|
||||||
|
@ -559,7 +559,7 @@ function wp_list_categories( $args = '' ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! isset( $parsed_args['class'] ) ) {
|
if ( ! isset( $parsed_args['class'] ) ) {
|
||||||
$parsed_args['class'] = ( 'category' == $parsed_args['taxonomy'] ) ? 'categories' : $parsed_args['taxonomy'];
|
$parsed_args['class'] = ( 'category' === $parsed_args['taxonomy'] ) ? 'categories' : $parsed_args['taxonomy'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! taxonomy_exists( $parsed_args['taxonomy'] ) ) {
|
if ( ! taxonomy_exists( $parsed_args['taxonomy'] ) ) {
|
||||||
|
@ -572,12 +572,16 @@ function wp_list_categories( $args = '' ) {
|
||||||
$categories = get_categories( $parsed_args );
|
$categories = get_categories( $parsed_args );
|
||||||
|
|
||||||
$output = '';
|
$output = '';
|
||||||
if ( $parsed_args['title_li'] && 'list' == $parsed_args['style'] && ( ! empty( $categories ) || ! $parsed_args['hide_title_if_empty'] ) ) {
|
|
||||||
|
if ( $parsed_args['title_li'] && 'list' === $parsed_args['style']
|
||||||
|
&& ( ! empty( $categories ) || ! $parsed_args['hide_title_if_empty'] )
|
||||||
|
) {
|
||||||
$output = '<li class="' . esc_attr( $parsed_args['class'] ) . '">' . $parsed_args['title_li'] . '<ul>';
|
$output = '<li class="' . esc_attr( $parsed_args['class'] ) . '">' . $parsed_args['title_li'] . '<ul>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( empty( $categories ) ) {
|
if ( empty( $categories ) ) {
|
||||||
if ( ! empty( $show_option_none ) ) {
|
if ( ! empty( $show_option_none ) ) {
|
||||||
if ( 'list' == $parsed_args['style'] ) {
|
if ( 'list' === $parsed_args['style'] ) {
|
||||||
$output .= '<li class="cat-item-none">' . $show_option_none . '</li>';
|
$output .= '<li class="cat-item-none">' . $show_option_none . '</li>';
|
||||||
} else {
|
} else {
|
||||||
$output .= $show_option_none;
|
$output .= $show_option_none;
|
||||||
|
@ -604,7 +608,7 @@ function wp_list_categories( $args = '' ) {
|
||||||
|
|
||||||
// Fallback for the 'All' link is the posts page.
|
// Fallback for the 'All' link is the posts page.
|
||||||
if ( ! $posts_page ) {
|
if ( ! $posts_page ) {
|
||||||
if ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) ) {
|
if ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) ) {
|
||||||
$posts_page = get_permalink( get_option( 'page_for_posts' ) );
|
$posts_page = get_permalink( get_option( 'page_for_posts' ) );
|
||||||
} else {
|
} else {
|
||||||
$posts_page = home_url( '/' );
|
$posts_page = home_url( '/' );
|
||||||
|
@ -612,7 +616,7 @@ function wp_list_categories( $args = '' ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$posts_page = esc_url( $posts_page );
|
$posts_page = esc_url( $posts_page );
|
||||||
if ( 'list' == $parsed_args['style'] ) {
|
if ( 'list' === $parsed_args['style'] ) {
|
||||||
$output .= "<li class='cat-item-all'><a href='$posts_page'>$show_option_all</a></li>";
|
$output .= "<li class='cat-item-all'><a href='$posts_page'>$show_option_all</a></li>";
|
||||||
} else {
|
} else {
|
||||||
$output .= "<a href='$posts_page'>$show_option_all</a>";
|
$output .= "<a href='$posts_page'>$show_option_all</a>";
|
||||||
|
@ -634,7 +638,9 @@ function wp_list_categories( $args = '' ) {
|
||||||
$output .= walk_category_tree( $categories, $depth, $parsed_args );
|
$output .= walk_category_tree( $categories, $depth, $parsed_args );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $parsed_args['title_li'] && 'list' == $parsed_args['style'] && ( ! empty( $categories ) || ! $parsed_args['hide_title_if_empty'] ) ) {
|
if ( $parsed_args['title_li'] && 'list' === $parsed_args['style']
|
||||||
|
&& ( ! empty( $categories ) || ! $parsed_args['hide_title_if_empty'] )
|
||||||
|
) {
|
||||||
$output .= '</ul></li>';
|
$output .= '</ul></li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -713,7 +719,7 @@ function wp_tag_cloud( $args = '' ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ( $tags as $key => $tag ) {
|
foreach ( $tags as $key => $tag ) {
|
||||||
if ( 'edit' == $args['link'] ) {
|
if ( 'edit' === $args['link'] ) {
|
||||||
$link = get_edit_term_link( $tag->term_id, $tag->taxonomy, $args['post_type'] );
|
$link = get_edit_term_link( $tag->term_id, $tag->taxonomy, $args['post_type'] );
|
||||||
} else {
|
} else {
|
||||||
$link = get_term_link( intval( $tag->term_id ), $tag->taxonomy );
|
$link = get_term_link( intval( $tag->term_id ), $tag->taxonomy );
|
||||||
|
@ -740,7 +746,7 @@ function wp_tag_cloud( $args = '' ) {
|
||||||
*/
|
*/
|
||||||
$return = apply_filters( 'wp_tag_cloud', $return, $args );
|
$return = apply_filters( 'wp_tag_cloud', $return, $args );
|
||||||
|
|
||||||
if ( 'array' == $args['format'] || empty( $args['echo'] ) ) {
|
if ( 'array' === $args['format'] || empty( $args['echo'] ) ) {
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -939,8 +945,8 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
|
||||||
|
|
||||||
$tags_data[] = array(
|
$tags_data[] = array(
|
||||||
'id' => $tag_id,
|
'id' => $tag_id,
|
||||||
'url' => '#' != $tag->link ? $tag->link : '#',
|
'url' => ( '#' !== $tag->link ) ? $tag->link : '#',
|
||||||
'role' => '#' != $tag->link ? '' : ' role="button"',
|
'role' => ( '#' !== $tag->link ) ? '' : ' role="button"',
|
||||||
'name' => $tag->name,
|
'name' => $tag->name,
|
||||||
'formatted_count' => $formatted_count,
|
'formatted_count' => $formatted_count,
|
||||||
'slug' => $tag->slug,
|
'slug' => $tag->slug,
|
||||||
|
|
|
@ -37,7 +37,7 @@ function get_categories( $args = '' ) {
|
||||||
$args['taxonomy'] = apply_filters( 'get_categories_taxonomy', $args['taxonomy'], $args );
|
$args['taxonomy'] = apply_filters( 'get_categories_taxonomy', $args['taxonomy'], $args );
|
||||||
|
|
||||||
// Back compat.
|
// Back compat.
|
||||||
if ( isset( $args['type'] ) && 'link' == $args['type'] ) {
|
if ( isset( $args['type'] ) && 'link' === $args['type'] ) {
|
||||||
_deprecated_argument(
|
_deprecated_argument(
|
||||||
__FUNCTION__,
|
__FUNCTION__,
|
||||||
'3.0.0',
|
'3.0.0',
|
||||||
|
@ -126,9 +126,11 @@ function get_category_by_path( $category_path, $full_match = true, $output = OBJ
|
||||||
$leaf_path = sanitize_title( basename( $category_paths ) );
|
$leaf_path = sanitize_title( basename( $category_paths ) );
|
||||||
$category_paths = explode( '/', $category_paths );
|
$category_paths = explode( '/', $category_paths );
|
||||||
$full_path = '';
|
$full_path = '';
|
||||||
|
|
||||||
foreach ( (array) $category_paths as $pathdir ) {
|
foreach ( (array) $category_paths as $pathdir ) {
|
||||||
$full_path .= ( '' != $pathdir ? '/' : '' ) . sanitize_title( $pathdir );
|
$full_path .= ( '' !== $pathdir ? '/' : '' ) . sanitize_title( $pathdir );
|
||||||
}
|
}
|
||||||
|
|
||||||
$categories = get_terms(
|
$categories = get_terms(
|
||||||
array(
|
array(
|
||||||
'taxonomy' => 'category',
|
'taxonomy' => 'category',
|
||||||
|
|
|
@ -216,7 +216,7 @@ class WP_Http {
|
||||||
$args = wp_parse_args( $args );
|
$args = wp_parse_args( $args );
|
||||||
|
|
||||||
// By default, HEAD requests do not cause redirections.
|
// By default, HEAD requests do not cause redirections.
|
||||||
if ( isset( $args['method'] ) && 'HEAD' == $args['method'] ) {
|
if ( isset( $args['method'] ) && 'HEAD' === $args['method'] ) {
|
||||||
$defaults['redirection'] = 0;
|
$defaults['redirection'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -739,7 +739,7 @@ class WP_Http {
|
||||||
} else {
|
} else {
|
||||||
$newheaders[ $key ] = $value;
|
$newheaders[ $key ] = $value;
|
||||||
}
|
}
|
||||||
if ( 'set-cookie' == $key ) {
|
if ( 'set-cookie' === $key ) {
|
||||||
$cookies[] = new WP_Http_Cookie( $value, $url );
|
$cookies[] = new WP_Http_Cookie( $value, $url );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -870,7 +870,7 @@ class WP_Http {
|
||||||
$home = parse_url( get_option( 'siteurl' ) );
|
$home = parse_url( get_option( 'siteurl' ) );
|
||||||
|
|
||||||
// Don't block requests back to ourselves by default.
|
// Don't block requests back to ourselves by default.
|
||||||
if ( 'localhost' == $check['host'] || ( isset( $home['host'] ) && $home['host'] == $check['host'] ) ) {
|
if ( 'localhost' === $check['host'] || ( isset( $home['host'] ) && $home['host'] == $check['host'] ) ) {
|
||||||
/**
|
/**
|
||||||
* Filters whether to block local HTTP API requests.
|
* Filters whether to block local HTTP API requests.
|
||||||
*
|
*
|
||||||
|
@ -975,7 +975,7 @@ class WP_Http {
|
||||||
$path = ! empty( $url_parts['path'] ) ? $url_parts['path'] : '/';
|
$path = ! empty( $url_parts['path'] ) ? $url_parts['path'] : '/';
|
||||||
|
|
||||||
// If it's a root-relative path, then great.
|
// If it's a root-relative path, then great.
|
||||||
if ( ! empty( $relative_url_parts['path'] ) && '/' == $relative_url_parts['path'][0] ) {
|
if ( ! empty( $relative_url_parts['path'] ) && '/' === $relative_url_parts['path'][0] ) {
|
||||||
$path = $relative_url_parts['path'];
|
$path = $relative_url_parts['path'];
|
||||||
|
|
||||||
// Else it's a relative path.
|
// Else it's a relative path.
|
||||||
|
@ -1040,7 +1040,7 @@ class WP_Http {
|
||||||
$redirect_location = WP_Http::make_absolute_url( $redirect_location, $url );
|
$redirect_location = WP_Http::make_absolute_url( $redirect_location, $url );
|
||||||
|
|
||||||
// POST requests should not POST to a redirected location.
|
// POST requests should not POST to a redirected location.
|
||||||
if ( 'POST' == $args['method'] ) {
|
if ( 'POST' === $args['method'] ) {
|
||||||
if ( in_array( $response['response']['code'], array( 302, 303 ), true ) ) {
|
if ( in_array( $response['response']['code'], array( 302, 303 ), true ) ) {
|
||||||
$args['method'] = 'GET';
|
$args['method'] = 'GET';
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ class Walker_Category extends Walker {
|
||||||
* value is 'list'. See wp_list_categories(). Default empty array.
|
* value is 'list'. See wp_list_categories(). Default empty array.
|
||||||
*/
|
*/
|
||||||
public function start_lvl( &$output, $depth = 0, $args = array() ) {
|
public function start_lvl( &$output, $depth = 0, $args = array() ) {
|
||||||
if ( 'list' != $args['style'] ) {
|
if ( 'list' !== $args['style'] ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ class Walker_Category extends Walker {
|
||||||
* value is 'list'. See wp_list_categories(). Default empty array.
|
* value is 'list'. See wp_list_categories(). Default empty array.
|
||||||
*/
|
*/
|
||||||
public function end_lvl( &$output, $depth = 0, $args = array() ) {
|
public function end_lvl( &$output, $depth = 0, $args = array() ) {
|
||||||
if ( 'list' != $args['style'] ) {
|
if ( 'list' !== $args['style'] ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ class Walker_Category extends Walker {
|
||||||
if ( ! empty( $args['show_count'] ) ) {
|
if ( ! empty( $args['show_count'] ) ) {
|
||||||
$link .= ' (' . number_format_i18n( $category->count ) . ')';
|
$link .= ' (' . number_format_i18n( $category->count ) . ')';
|
||||||
}
|
}
|
||||||
if ( 'list' == $args['style'] ) {
|
if ( 'list' === $args['style'] ) {
|
||||||
$output .= "\t<li";
|
$output .= "\t<li";
|
||||||
$css_classes = array(
|
$css_classes = array(
|
||||||
'cat-item',
|
'cat-item',
|
||||||
|
@ -258,7 +258,7 @@ class Walker_Category extends Walker {
|
||||||
* to output. See wp_list_categories(). Default empty array.
|
* to output. See wp_list_categories(). Default empty array.
|
||||||
*/
|
*/
|
||||||
public function end_el( &$output, $page, $depth = 0, $args = array() ) {
|
public function end_el( &$output, $page, $depth = 0, $args = array() ) {
|
||||||
if ( 'list' != $args['style'] ) {
|
if ( 'list' !== $args['style'] ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,7 @@ class Walker_Comment extends Walker {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) && $args['short_ping'] ) {
|
if ( ( 'pingback' === $comment->comment_type || 'trackback' === $comment->comment_type ) && $args['short_ping'] ) {
|
||||||
ob_start();
|
ob_start();
|
||||||
$this->ping( $comment, $depth, $args );
|
$this->ping( $comment, $depth, $args );
|
||||||
$output .= ob_get_clean();
|
$output .= ob_get_clean();
|
||||||
|
@ -216,7 +216,7 @@ class Walker_Comment extends Walker {
|
||||||
$output .= ob_get_clean();
|
$output .= ob_get_clean();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( 'div' == $args['style'] ) {
|
if ( 'div' === $args['style'] ) {
|
||||||
$output .= "</div><!-- #comment-## -->\n";
|
$output .= "</div><!-- #comment-## -->\n";
|
||||||
} else {
|
} else {
|
||||||
$output .= "</li><!-- #comment-## -->\n";
|
$output .= "</li><!-- #comment-## -->\n";
|
||||||
|
@ -235,7 +235,7 @@ class Walker_Comment extends Walker {
|
||||||
* @param array $args An array of arguments.
|
* @param array $args An array of arguments.
|
||||||
*/
|
*/
|
||||||
protected function ping( $comment, $depth, $args ) {
|
protected function ping( $comment, $depth, $args ) {
|
||||||
$tag = ( 'div' == $args['style'] ) ? 'div' : 'li';
|
$tag = ( 'div' === $args['style'] ) ? 'div' : 'li';
|
||||||
?>
|
?>
|
||||||
<<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( '', $comment ); ?>>
|
<<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( '', $comment ); ?>>
|
||||||
<div class="comment-body">
|
<div class="comment-body">
|
||||||
|
@ -256,7 +256,7 @@ class Walker_Comment extends Walker {
|
||||||
* @param array $args An array of arguments.
|
* @param array $args An array of arguments.
|
||||||
*/
|
*/
|
||||||
protected function comment( $comment, $depth, $args ) {
|
protected function comment( $comment, $depth, $args ) {
|
||||||
if ( 'div' == $args['style'] ) {
|
if ( 'div' === $args['style'] ) {
|
||||||
$tag = 'div';
|
$tag = 'div';
|
||||||
$add_below = 'comment';
|
$add_below = 'comment';
|
||||||
} else {
|
} else {
|
||||||
|
@ -273,7 +273,7 @@ class Walker_Comment extends Walker {
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<<?php echo $tag; ?> <?php comment_class( $this->has_children ? 'parent' : '', $comment ); ?> id="comment-<?php comment_ID(); ?>">
|
<<?php echo $tag; ?> <?php comment_class( $this->has_children ? 'parent' : '', $comment ); ?> id="comment-<?php comment_ID(); ?>">
|
||||||
<?php if ( 'div' != $args['style'] ) : ?>
|
<?php if ( 'div' !== $args['style'] ) : ?>
|
||||||
<div id="div-comment-<?php comment_ID(); ?>" class="comment-body">
|
<div id="div-comment-<?php comment_ID(); ?>" class="comment-body">
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div class="comment-author vcard">
|
<div class="comment-author vcard">
|
||||||
|
@ -334,7 +334,7 @@ class Walker_Comment extends Walker {
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php if ( 'div' != $args['style'] ) : ?>
|
<?php if ( 'div' !== $args['style'] ) : ?>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -201,7 +201,7 @@ class Walker_Page extends Walker {
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( ! empty( $args['show_date'] ) ) {
|
if ( ! empty( $args['show_date'] ) ) {
|
||||||
if ( 'modified' == $args['show_date'] ) {
|
if ( 'modified' === $args['show_date'] ) {
|
||||||
$time = $page->post_modified;
|
$time = $page->post_modified;
|
||||||
} else {
|
} else {
|
||||||
$time = $page->post_date;
|
$time = $page->post_date;
|
||||||
|
|
|
@ -388,7 +388,7 @@ class WP_Comment_Query {
|
||||||
*
|
*
|
||||||
* The expected return type from this filter depends on the value passed in the request query_vars.
|
* The expected return type from this filter depends on the value passed in the request query_vars.
|
||||||
* When `$this->query_vars['count']` is set, the filter should return the comment count as an int.
|
* When `$this->query_vars['count']` is set, the filter should return the comment count as an int.
|
||||||
* When `'ids' == $this->query_vars['fields']`, the filter should return an array of comment ids.
|
* When `'ids' === $this->query_vars['fields']`, the filter should return an array of comment ids.
|
||||||
* Otherwise the filter should return an array of WP_Comment objects.
|
* Otherwise the filter should return an array of WP_Comment objects.
|
||||||
*
|
*
|
||||||
* @since 5.3.0
|
* @since 5.3.0
|
||||||
|
@ -444,7 +444,7 @@ class WP_Comment_Query {
|
||||||
|
|
||||||
$comment_ids = array_map( 'intval', $comment_ids );
|
$comment_ids = array_map( 'intval', $comment_ids );
|
||||||
|
|
||||||
if ( 'ids' == $this->query_vars['fields'] ) {
|
if ( 'ids' === $this->query_vars['fields'] ) {
|
||||||
$this->comments = $comment_ids;
|
$this->comments = $comment_ids;
|
||||||
return $this->comments;
|
return $this->comments;
|
||||||
}
|
}
|
||||||
|
@ -570,7 +570,7 @@ class WP_Comment_Query {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$order = ( 'ASC' == strtoupper( $this->query_vars['order'] ) ) ? 'ASC' : 'DESC';
|
$order = ( 'ASC' === strtoupper( $this->query_vars['order'] ) ) ? 'ASC' : 'DESC';
|
||||||
|
|
||||||
// Disable ORDER BY with 'none', an empty array, or boolean false.
|
// Disable ORDER BY with 'none', an empty array, or boolean false.
|
||||||
if ( in_array( $this->query_vars['orderby'], array( 'none', array(), false ), true ) ) {
|
if ( in_array( $this->query_vars['orderby'], array( 'none', array(), false ), true ) ) {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue