Coding Standards: Use strict comparison in some `wp-admin` files.
Props pikamander2, mukesh27, SergeyBiryukov. Fixes #49239. Built from https://develop.svn.wordpress.org/trunk@47785 git-svn-id: http://core.svn.wordpress.org/trunk@47561 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2eef7ee2ac
commit
aa69c25d5f
|
@ -44,7 +44,7 @@ if ( is_network_admin() ) {
|
||||||
$admin_title = get_bloginfo( 'name' );
|
$admin_title = get_bloginfo( 'name' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $admin_title == $title ) {
|
if ( $admin_title === $title ) {
|
||||||
/* translators: Admin screen title. %s: Admin screen name. */
|
/* translators: Admin screen title. %s: Admin screen name. */
|
||||||
$admin_title = sprintf( __( '%s — WordPress' ), $title );
|
$admin_title = sprintf( __( '%s — WordPress' ), $title );
|
||||||
} else {
|
} else {
|
||||||
|
@ -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 ( get_user_setting( 'mfold' ) === 'f' ) {
|
||||||
$admin_body_class .= ' folded';
|
$admin_body_class .= ' folded';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ if ( get_option( 'db_upgraded' ) ) {
|
||||||
* @since 2.8.0
|
* @since 2.8.0
|
||||||
*/
|
*/
|
||||||
do_action( 'after_db_upgrade' );
|
do_action( 'after_db_upgrade' );
|
||||||
} elseif ( get_option( 'db_version' ) != $wp_db_version && empty( $_POST ) ) {
|
} elseif ( get_option( 'db_version' ) !== $wp_db_version && empty( $_POST ) ) {
|
||||||
if ( ! is_multisite() ) {
|
if ( ! is_multisite() ) {
|
||||||
wp_redirect( admin_url( 'upgrade.php?_wp_http_referer=' . urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) );
|
wp_redirect( admin_url( 'upgrade.php?_wp_http_referer=' . urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) );
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -42,7 +42,7 @@ if ( ! current_user_can( 'upload_files' ) ) {
|
||||||
if ( isset( $_REQUEST['attachment_id'] ) && intval( $_REQUEST['attachment_id'] ) && $_REQUEST['fetch'] ) {
|
if ( isset( $_REQUEST['attachment_id'] ) && intval( $_REQUEST['attachment_id'] ) && $_REQUEST['fetch'] ) {
|
||||||
$id = intval( $_REQUEST['attachment_id'] );
|
$id = intval( $_REQUEST['attachment_id'] );
|
||||||
$post = get_post( $id );
|
$post = get_post( $id );
|
||||||
if ( 'attachment' != $post->post_type ) {
|
if ( 'attachment' !== $post->post_type ) {
|
||||||
wp_die( __( 'Invalid post type.' ) );
|
wp_die( __( 'Invalid post type.' ) );
|
||||||
}
|
}
|
||||||
if ( ! current_user_can( 'edit_post', $id ) ) {
|
if ( ! current_user_can( 'edit_post', $id ) ) {
|
||||||
|
|
|
@ -22,16 +22,16 @@ if ( isset( $_POST['deletecomment'] ) ) {
|
||||||
$action = 'deletecomment';
|
$action = 'deletecomment';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'cdc' == $action ) {
|
if ( 'cdc' === $action ) {
|
||||||
$action = 'delete';
|
$action = 'delete';
|
||||||
} elseif ( 'mac' == $action ) {
|
} elseif ( 'mac' === $action ) {
|
||||||
$action = 'approve';
|
$action = 'approve';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $_GET['dt'] ) ) {
|
if ( isset( $_GET['dt'] ) ) {
|
||||||
if ( 'spam' == $_GET['dt'] ) {
|
if ( 'spam' === $_GET['dt'] ) {
|
||||||
$action = 'spam';
|
$action = 'spam';
|
||||||
} elseif ( 'trash' == $_GET['dt'] ) {
|
} elseif ( 'trash' === $_GET['dt'] ) {
|
||||||
$action = 'trash';
|
$action = 'trash';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ switch ( $action ) {
|
||||||
comment_footer_die( __( 'Sorry, you are not allowed to edit this comment.' ) );
|
comment_footer_die( __( 'Sorry, you are not allowed to edit this comment.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'trash' == $comment->comment_approved ) {
|
if ( 'trash' === $comment->comment_approved ) {
|
||||||
comment_footer_die( __( 'This comment is in the Trash. Please move it out of the Trash if you want to edit it.' ) );
|
comment_footer_die( __( 'This comment is in the Trash. Please move it out of the Trash if you want to edit it.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ switch ( $action ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// No need to re-approve/re-trash/re-spam a comment.
|
// No need to re-approve/re-trash/re-spam a comment.
|
||||||
if ( str_replace( '1', 'approve', $comment->comment_approved ) == $action ) {
|
if ( str_replace( '1', 'approve', $comment->comment_approved ) === $action ) {
|
||||||
wp_redirect( admin_url( 'edit-comments.php?same=' . $comment_id ) );
|
wp_redirect( admin_url( 'edit-comments.php?same=' . $comment_id ) );
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ switch ( $action ) {
|
||||||
require_once ABSPATH . 'wp-admin/admin-header.php';
|
require_once ABSPATH . 'wp-admin/admin-header.php';
|
||||||
|
|
||||||
$formaction = $action . 'comment';
|
$formaction = $action . 'comment';
|
||||||
$nonce_action = 'approve' == $action ? 'approve-comment_' : 'delete-comment_';
|
$nonce_action = ( 'approve' === $action ) ? 'approve-comment_' : 'delete-comment_';
|
||||||
$nonce_action .= $comment_id;
|
$nonce_action .= $comment_id;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -137,7 +137,7 @@ switch ( $action ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( '0' != $comment->comment_approved ) { // If not unapproved.
|
if ( '0' !== $comment->comment_approved ) { // If not unapproved.
|
||||||
$message = '';
|
$message = '';
|
||||||
switch ( $comment->comment_approved ) {
|
switch ( $comment->comment_approved ) {
|
||||||
case '1':
|
case '1':
|
||||||
|
@ -271,9 +271,9 @@ switch ( $action ) {
|
||||||
comment_footer_die( __( 'Sorry, you are not allowed to edit comments on this post.' ) );
|
comment_footer_die( __( 'Sorry, you are not allowed to edit comments on this post.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( '' != wp_get_referer() && ! $noredir && false === strpos( wp_get_referer(), 'comment.php' ) ) {
|
if ( wp_get_referer() && ! $noredir && false === strpos( wp_get_referer(), 'comment.php' ) ) {
|
||||||
$redir = wp_get_referer();
|
$redir = wp_get_referer();
|
||||||
} elseif ( '' != wp_get_original_referer() && ! $noredir ) {
|
} elseif ( wp_get_original_referer() && ! $noredir ) {
|
||||||
$redir = wp_get_original_referer();
|
$redir = wp_get_original_referer();
|
||||||
} elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ), true ) ) {
|
} elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ), true ) ) {
|
||||||
$redir = admin_url( 'edit-comments.php?p=' . absint( $comment->comment_post_ID ) );
|
$redir = admin_url( 'edit-comments.php?p=' . absint( $comment->comment_post_ID ) );
|
||||||
|
@ -348,9 +348,9 @@ switch ( $action ) {
|
||||||
* @param int $comment_id The ID of the comment being edited.
|
* @param int $comment_id The ID of the comment being edited.
|
||||||
*/
|
*/
|
||||||
$location = apply_filters( 'comment_edit_redirect', $location, $comment_id );
|
$location = apply_filters( 'comment_edit_redirect', $location, $comment_id );
|
||||||
wp_redirect( $location );
|
|
||||||
|
|
||||||
exit();
|
wp_redirect( $location );
|
||||||
|
exit;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wp_die( __( 'Unknown action.' ) );
|
wp_die( __( 'Unknown action.' ) );
|
||||||
|
|
|
@ -24,14 +24,14 @@ $doaction = $wp_list_table->current_action();
|
||||||
if ( $doaction ) {
|
if ( $doaction ) {
|
||||||
check_admin_referer( 'bulk-comments' );
|
check_admin_referer( 'bulk-comments' );
|
||||||
|
|
||||||
if ( 'delete_all' == $doaction && ! empty( $_REQUEST['pagegen_timestamp'] ) ) {
|
if ( 'delete_all' === $doaction && ! empty( $_REQUEST['pagegen_timestamp'] ) ) {
|
||||||
$comment_status = wp_unslash( $_REQUEST['comment_status'] );
|
$comment_status = wp_unslash( $_REQUEST['comment_status'] );
|
||||||
$delete_time = wp_unslash( $_REQUEST['pagegen_timestamp'] );
|
$delete_time = wp_unslash( $_REQUEST['pagegen_timestamp'] );
|
||||||
$comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = %s AND %s > comment_date_gmt", $comment_status, $delete_time ) );
|
$comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = %s AND %s > comment_date_gmt", $comment_status, $delete_time ) );
|
||||||
$doaction = 'delete';
|
$doaction = 'delete';
|
||||||
} elseif ( isset( $_REQUEST['delete_comments'] ) ) {
|
} elseif ( isset( $_REQUEST['delete_comments'] ) ) {
|
||||||
$comment_ids = $_REQUEST['delete_comments'];
|
$comment_ids = $_REQUEST['delete_comments'];
|
||||||
$doaction = ( -1 != $_REQUEST['action'] ) ? $_REQUEST['action'] : $_REQUEST['action2'];
|
$doaction = ( '-1' !== $_REQUEST['action'] ) ? $_REQUEST['action'] : $_REQUEST['action2'];
|
||||||
} elseif ( isset( $_REQUEST['ids'] ) ) {
|
} elseif ( isset( $_REQUEST['ids'] ) ) {
|
||||||
$comment_ids = array_map( 'absint', explode( ',', $_REQUEST['ids'] ) );
|
$comment_ids = array_map( 'absint', explode( ',', $_REQUEST['ids'] ) );
|
||||||
} elseif ( wp_get_referer() ) {
|
} elseif ( wp_get_referer() ) {
|
||||||
|
|
|
@ -76,7 +76,7 @@ $post_ID = isset( $post_ID ) ? (int) $post_ID : 0;
|
||||||
$user_ID = isset( $user_ID ) ? (int) $user_ID : 0;
|
$user_ID = isset( $user_ID ) ? (int) $user_ID : 0;
|
||||||
$action = isset( $action ) ? $action : '';
|
$action = isset( $action ) ? $action : '';
|
||||||
|
|
||||||
if ( get_option( 'page_for_posts' ) == $post_ID && empty( $post->post_content ) ) {
|
if ( (int) get_option( 'page_for_posts' ) === $post_ID && empty( $post->post_content ) ) {
|
||||||
add_action( 'edit_form_after_title', '_wp_posts_page_notice' );
|
add_action( 'edit_form_after_title', '_wp_posts_page_notice' );
|
||||||
remove_post_type_support( $post_type, 'editor' );
|
remove_post_type_support( $post_type, 'editor' );
|
||||||
}
|
}
|
||||||
|
@ -228,8 +228,8 @@ if ( isset( $_GET['message'] ) ) {
|
||||||
|
|
||||||
$notice = false;
|
$notice = false;
|
||||||
$form_extra = '';
|
$form_extra = '';
|
||||||
if ( 'auto-draft' == $post->post_status ) {
|
if ( 'auto-draft' === $post->post_status ) {
|
||||||
if ( 'edit' == $action ) {
|
if ( 'edit' === $action ) {
|
||||||
$post->post_title = '';
|
$post->post_title = '';
|
||||||
}
|
}
|
||||||
$autosave = false;
|
$autosave = false;
|
||||||
|
@ -276,7 +276,7 @@ add_screen_option(
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( 'post' == $post_type ) {
|
if ( 'post' === $post_type ) {
|
||||||
$customize_display = '<p>' . __( 'The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop. You can also minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.' ) . '</p>';
|
$customize_display = '<p>' . __( 'The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop. You can also minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.' ) . '</p>';
|
||||||
|
|
||||||
get_current_screen()->add_help_tab(
|
get_current_screen()->add_help_tab(
|
||||||
|
@ -313,7 +313,7 @@ if ( 'post' == $post_type ) {
|
||||||
'<p>' . __( '<a href="https://wordpress.org/support/article/wordpress-editor/">Documentation on Writing and Editing Posts</a>' ) . '</p>' .
|
'<p>' . __( '<a href="https://wordpress.org/support/article/wordpress-editor/">Documentation on Writing and Editing Posts</a>' ) . '</p>' .
|
||||||
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
|
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
|
||||||
);
|
);
|
||||||
} elseif ( 'page' == $post_type ) {
|
} elseif ( 'page' === $post_type ) {
|
||||||
$about_pages = '<p>' . __( 'Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the “Parent” of the other, creating a group of pages.' ) . '</p>' .
|
$about_pages = '<p>' . __( 'Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the “Parent” of the other, creating a group of pages.' ) . '</p>' .
|
||||||
'<p>' . __( 'Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the distraction-free writing space, available in both the Visual and Text modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box.' ) . '</p>';
|
'<p>' . __( 'Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the distraction-free writing space, available in both the Visual and Text modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box.' ) . '</p>';
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ if ( 'post' == $post_type ) {
|
||||||
'<p>' . __( '<a href="https://wordpress.org/support/article/pages-screen/">Documentation on Editing Pages</a>' ) . '</p>' .
|
'<p>' . __( '<a href="https://wordpress.org/support/article/pages-screen/">Documentation on Editing Pages</a>' ) . '</p>' .
|
||||||
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
|
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
|
||||||
);
|
);
|
||||||
} elseif ( 'attachment' == $post_type ) {
|
} elseif ( 'attachment' === $post_type ) {
|
||||||
get_current_screen()->add_help_tab(
|
get_current_screen()->add_help_tab(
|
||||||
array(
|
array(
|
||||||
'id' => 'overview',
|
'id' => 'overview',
|
||||||
|
@ -351,7 +351,7 @@ if ( 'post' == $post_type ) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'post' == $post_type || 'page' == $post_type ) {
|
if ( 'post' === $post_type || 'page' === $post_type ) {
|
||||||
$inserting_media = '<p>' . __( 'You can upload and insert media (images, audio, documents, etc.) by clicking the Add Media button. You can select from the images and files already uploaded to the Media Library, or upload new media to add to your page or post. To create an image gallery, select the images to add and click the “Create a new gallery” button.' ) . '</p>';
|
$inserting_media = '<p>' . __( 'You can upload and insert media (images, audio, documents, etc.) by clicking the Add Media button. You can select from the images and files already uploaded to the Media Library, or upload new media to add to your page or post. To create an image gallery, select the images to add and click the “Create a new gallery” button.' ) . '</p>';
|
||||||
$inserting_media .= '<p>' . __( 'You can also embed media from many popular websites including Twitter, YouTube, Flickr and others by pasting the media URL on its own line into the content of your post/page. <a href="https://wordpress.org/support/article/embeds/">Learn more about embeds</a>.' ) . '</p>';
|
$inserting_media .= '<p>' . __( 'You can also embed media from many popular websites including Twitter, YouTube, Flickr and others by pasting the media URL on its own line into the content of your post/page. <a href="https://wordpress.org/support/article/embeds/">Learn more about embeds</a>.' ) . '</p>';
|
||||||
|
|
||||||
|
@ -364,7 +364,7 @@ if ( 'post' == $post_type || 'page' == $post_type ) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'post' == $post_type ) {
|
if ( 'post' === $post_type ) {
|
||||||
$publish_box = '<p>' . __( 'Several boxes on this screen contain settings for how your content will be published, including:' ) . '</p>';
|
$publish_box = '<p>' . __( 'Several boxes on this screen contain settings for how your content will be published, including:' ) . '</p>';
|
||||||
$publish_box .= '<ul><li>' .
|
$publish_box .= '<ul><li>' .
|
||||||
__( '<strong>Publish</strong> — You can set the terms of publishing your post in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a post or making it stay at the top of your blog indefinitely (sticky). The Password protected option allows you to set an arbitrary password for each post. The Private option hides the post from everyone except editors and administrators. Publish (immediately) allows you to set a future or past date and time, so you can schedule a post to be published in the future or backdate a post.' ) .
|
__( '<strong>Publish</strong> — You can set the terms of publishing your post in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a post or making it stay at the top of your blog indefinitely (sticky). The Password protected option allows you to set an arbitrary password for each post. The Private option hides the post from everyone except editors and administrators. Publish (immediately) allows you to set a future or past date and time, so you can schedule a post to be published in the future or backdate a post.' ) .
|
||||||
|
@ -402,7 +402,7 @@ if ( 'post' == $post_type ) {
|
||||||
'content' => $discussion_settings,
|
'content' => $discussion_settings,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
} elseif ( 'page' == $post_type ) {
|
} elseif ( 'page' === $post_type ) {
|
||||||
$page_attributes = '<p>' . __( '<strong>Parent</strong> — You can arrange your pages in hierarchies. For example, you could have an “About” page that has “Life Story” and “My Dog” pages under it. There are no limits to how many levels you can nest pages.' ) . '</p>' .
|
$page_attributes = '<p>' . __( '<strong>Parent</strong> — You can arrange your pages in hierarchies. For example, you could have an “About” page that has “Life Story” and “My Dog” pages under it. There are no limits to how many levels you can nest pages.' ) . '</p>' .
|
||||||
'<p>' . __( '<strong>Template</strong> — Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you’ll see them in this dropdown menu.' ) . '</p>' .
|
'<p>' . __( '<strong>Template</strong> — Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you’ll see them in this dropdown menu.' ) . '</p>' .
|
||||||
'<p>' . __( '<strong>Order</strong> — Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.' ) . '</p>';
|
'<p>' . __( '<strong>Order</strong> — Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.' ) . '</p>';
|
||||||
|
@ -471,7 +471,7 @@ $referer = wp_get_referer();
|
||||||
<input type="hidden" id="active_post_lock" value="<?php echo esc_attr( implode( ':', $active_post_lock ) ); ?>" />
|
<input type="hidden" id="active_post_lock" value="<?php echo esc_attr( implode( ':', $active_post_lock ) ); ?>" />
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
if ( 'draft' != get_post_status( $post ) ) {
|
if ( 'draft' !== get_post_status( $post ) ) {
|
||||||
wp_original_referer_field( true, 'previous' );
|
wp_original_referer_field( true, 'previous' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,7 +495,7 @@ do_action( 'edit_form_top', $post );
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div id="poststuff">
|
<div id="poststuff">
|
||||||
<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
|
<div id="post-body" class="metabox-holder columns-<?php echo ( 1 === get_current_screen()->get_columns() ) ? '1' : '2'; ?>">
|
||||||
<div id="post-body-content">
|
<div id="post-body-content">
|
||||||
|
|
||||||
<?php if ( post_type_supports( $post_type, 'title' ) ) { ?>
|
<?php if ( post_type_supports( $post_type, 'title' ) ) { ?>
|
||||||
|
@ -535,12 +535,17 @@ do_action( 'edit_form_top', $post );
|
||||||
$shortlink = wp_get_shortlink( $post->ID, 'post' );
|
$shortlink = wp_get_shortlink( $post->ID, 'post' );
|
||||||
|
|
||||||
if ( ! empty( $shortlink ) && $shortlink !== $permalink && home_url( '?page_id=' . $post->ID ) !== $permalink ) {
|
if ( ! empty( $shortlink ) && $shortlink !== $permalink && home_url( '?page_id=' . $post->ID ) !== $permalink ) {
|
||||||
$sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr( $shortlink ) . '" /><button type="button" class="button button-small" onclick="prompt('URL:', jQuery(\'#shortlink\').val());">' . __( 'Get Shortlink' ) . '</button>';
|
$sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr( $shortlink ) . '" />' .
|
||||||
|
'<button type="button" class="button button-small" onclick="prompt('URL:', jQuery(\'#shortlink\').val());">' .
|
||||||
|
__( 'Get Shortlink' ) .
|
||||||
|
'</button>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) {
|
if ( $post_type_object->public
|
||||||
$has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status;
|
&& ! ( 'pending' === get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) )
|
||||||
|
) {
|
||||||
|
$has_sample_permalink = $sample_permalink_html && 'auto-draft' !== $post->post_status;
|
||||||
?>
|
?>
|
||||||
<div id="edit-slug-box" class="hide-if-no-js">
|
<div id="edit-slug-box" class="hide-if-no-js">
|
||||||
<?php
|
<?php
|
||||||
|
@ -608,7 +613,7 @@ if ( post_type_supports( $post_type, 'editor' ) ) {
|
||||||
<td class="autosave-info">
|
<td class="autosave-info">
|
||||||
<span class="autosave-message"> </span>
|
<span class="autosave-message"> </span>
|
||||||
<?php
|
<?php
|
||||||
if ( 'auto-draft' != $post->post_status ) {
|
if ( 'auto-draft' !== $post->post_status ) {
|
||||||
echo '<span id="last-edit">';
|
echo '<span id="last-edit">';
|
||||||
$last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) );
|
$last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) );
|
||||||
if ( $last_user ) {
|
if ( $last_user ) {
|
||||||
|
@ -642,7 +647,7 @@ do_action( 'edit_form_after_editor', $post );
|
||||||
<div id="postbox-container-1" class="postbox-container">
|
<div id="postbox-container-1" class="postbox-container">
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if ( 'page' == $post_type ) {
|
if ( 'page' === $post_type ) {
|
||||||
/**
|
/**
|
||||||
* Fires before meta boxes with 'side' context are output for the 'page' post type.
|
* Fires before meta boxes with 'side' context are output for the 'page' post type.
|
||||||
*
|
*
|
||||||
|
@ -676,7 +681,7 @@ do_meta_boxes( $post_type, 'side', $post );
|
||||||
|
|
||||||
do_meta_boxes( null, 'normal', $post );
|
do_meta_boxes( null, 'normal', $post );
|
||||||
|
|
||||||
if ( 'page' == $post_type ) {
|
if ( 'page' === $post_type ) {
|
||||||
/**
|
/**
|
||||||
* Fires after 'normal' context meta boxes have been output for the 'page' post type.
|
* Fires after 'normal' context meta boxes have been output for the 'page' post type.
|
||||||
*
|
*
|
||||||
|
|
|
@ -118,7 +118,7 @@ switch ( $comment->comment_approved ) {
|
||||||
<label><input type="radio"<?php checked( $comment->comment_approved, 'spam' ); ?> name="comment_status" value="spam" /><?php _ex( 'Spam', 'comment status' ); ?></label>
|
<label><input type="radio"<?php checked( $comment->comment_approved, 'spam' ); ?> name="comment_status" value="spam" /><?php _ex( 'Spam', 'comment status' ); ?></label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div><!-- .misc-pub-section -->
|
</div><!-- .misc-pub-section -->
|
||||||
|
|
||||||
<div class="misc-pub-section curtime misc-pub-curtime">
|
<div class="misc-pub-section curtime misc-pub-curtime">
|
||||||
<?php
|
<?php
|
||||||
$submitted = sprintf(
|
$submitted = sprintf(
|
||||||
|
|
|
@ -108,7 +108,7 @@ wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
|
||||||
|
|
||||||
<div id="poststuff">
|
<div id="poststuff">
|
||||||
|
|
||||||
<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
|
<div id="post-body" class="metabox-holder columns-<?php echo ( 1 === get_current_screen()->get_columns() ) ? '1' : '2'; ?>">
|
||||||
<div id="post-body-content">
|
<div id="post-body-content">
|
||||||
<div id="namediv" class="stuffbox">
|
<div id="namediv" class="stuffbox">
|
||||||
<h2><label for="link_name"><?php _ex( 'Name', 'link name' ); ?></label></h2>
|
<h2><label for="link_name"><?php _ex( 'Name', 'link name' ); ?></label></h2>
|
||||||
|
|
|
@ -12,7 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Back compat hooks.
|
// Back compat hooks.
|
||||||
if ( 'category' == $taxonomy ) {
|
if ( 'category' === $taxonomy ) {
|
||||||
/**
|
/**
|
||||||
* Fires before the Edit Category form.
|
* Fires before the Edit Category form.
|
||||||
*
|
*
|
||||||
|
@ -22,7 +22,7 @@ if ( 'category' == $taxonomy ) {
|
||||||
* @param WP_Term $tag Current category term object.
|
* @param WP_Term $tag Current category term object.
|
||||||
*/
|
*/
|
||||||
do_action_deprecated( 'edit_category_form_pre', array( $tag ), '3.0.0', '{$taxonomy}_pre_edit_form' );
|
do_action_deprecated( 'edit_category_form_pre', array( $tag ), '3.0.0', '{$taxonomy}_pre_edit_form' );
|
||||||
} elseif ( 'link_category' == $taxonomy ) {
|
} elseif ( 'link_category' === $taxonomy ) {
|
||||||
/**
|
/**
|
||||||
* Fires before the Edit Link Category form.
|
* Fires before the Edit Link Category form.
|
||||||
*
|
*
|
||||||
|
@ -177,7 +177,7 @@ if ( isset( $tag->name ) ) {
|
||||||
$dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'edit' );
|
$dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'edit' );
|
||||||
wp_dropdown_categories( $dropdown_args );
|
wp_dropdown_categories( $dropdown_args );
|
||||||
?>
|
?>
|
||||||
<?php if ( 'category' == $taxonomy ) : ?>
|
<?php if ( 'category' === $taxonomy ) : ?>
|
||||||
<p class="description"><?php _e( 'Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.' ); ?></p>
|
<p class="description"><?php _e( 'Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.' ); ?></p>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<p class="description"><?php _e( 'Assign a parent term to create a hierarchy. The term Jazz, for example, would be the parent of Bebop and Big Band.' ); ?></p>
|
<p class="description"><?php _e( 'Assign a parent term to create a hierarchy. The term Jazz, for example, would be the parent of Bebop and Big Band.' ); ?></p>
|
||||||
|
@ -192,7 +192,7 @@ if ( isset( $tag->name ) ) {
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
// Back compat hooks.
|
// Back compat hooks.
|
||||||
if ( 'category' == $taxonomy ) {
|
if ( 'category' === $taxonomy ) {
|
||||||
/**
|
/**
|
||||||
* Fires after the Edit Category form fields are displayed.
|
* Fires after the Edit Category form fields are displayed.
|
||||||
*
|
*
|
||||||
|
@ -202,7 +202,7 @@ if ( isset( $tag->name ) ) {
|
||||||
* @param WP_Term $tag Current category term object.
|
* @param WP_Term $tag Current category term object.
|
||||||
*/
|
*/
|
||||||
do_action_deprecated( 'edit_category_form_fields', array( $tag ), '3.0.0', '{$taxonomy}_edit_form_fields' );
|
do_action_deprecated( 'edit_category_form_fields', array( $tag ), '3.0.0', '{$taxonomy}_edit_form_fields' );
|
||||||
} elseif ( 'link_category' == $taxonomy ) {
|
} elseif ( 'link_category' === $taxonomy ) {
|
||||||
/**
|
/**
|
||||||
* Fires after the Edit Link Category form fields are displayed.
|
* Fires after the Edit Link Category form fields are displayed.
|
||||||
*
|
*
|
||||||
|
@ -239,10 +239,10 @@ if ( isset( $tag->name ) ) {
|
||||||
</table>
|
</table>
|
||||||
<?php
|
<?php
|
||||||
// Back compat hooks.
|
// Back compat hooks.
|
||||||
if ( 'category' == $taxonomy ) {
|
if ( 'category' === $taxonomy ) {
|
||||||
/** This action is documented in wp-admin/edit-tags.php */
|
/** This action is documented in wp-admin/edit-tags.php */
|
||||||
do_action_deprecated( 'edit_category_form', array( $tag ), '3.0.0', '{$taxonomy}_add_form' );
|
do_action_deprecated( 'edit_category_form', array( $tag ), '3.0.0', '{$taxonomy}_add_form' );
|
||||||
} elseif ( 'link_category' == $taxonomy ) {
|
} elseif ( 'link_category' === $taxonomy ) {
|
||||||
/** This action is documented in wp-admin/edit-tags.php */
|
/** This action is documented in wp-admin/edit-tags.php */
|
||||||
do_action_deprecated( 'edit_link_category_form', array( $tag ), '3.0.0', '{$taxonomy}_add_form' );
|
do_action_deprecated( 'edit_link_category_form', array( $tag ), '3.0.0', '{$taxonomy}_add_form' );
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -332,7 +332,7 @@ $bulk_messages = array();
|
||||||
$bulk_messages['post'] = array(
|
$bulk_messages['post'] = array(
|
||||||
/* translators: %s: Number of posts. */
|
/* translators: %s: Number of posts. */
|
||||||
'updated' => _n( '%s post updated.', '%s posts updated.', $bulk_counts['updated'] ),
|
'updated' => _n( '%s post updated.', '%s posts updated.', $bulk_counts['updated'] ),
|
||||||
'locked' => ( 1 == $bulk_counts['locked'] ) ? __( '1 post not updated, somebody is editing it.' ) :
|
'locked' => ( 1 === $bulk_counts['locked'] ) ? __( '1 post not updated, somebody is editing it.' ) :
|
||||||
/* translators: %s: Number of posts. */
|
/* translators: %s: Number of posts. */
|
||||||
_n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $bulk_counts['locked'] ),
|
_n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $bulk_counts['locked'] ),
|
||||||
/* translators: %s: Number of posts. */
|
/* translators: %s: Number of posts. */
|
||||||
|
@ -345,7 +345,7 @@ $bulk_messages['post'] = array(
|
||||||
$bulk_messages['page'] = array(
|
$bulk_messages['page'] = array(
|
||||||
/* translators: %s: Number of pages. */
|
/* translators: %s: Number of pages. */
|
||||||
'updated' => _n( '%s page updated.', '%s pages updated.', $bulk_counts['updated'] ),
|
'updated' => _n( '%s page updated.', '%s pages updated.', $bulk_counts['updated'] ),
|
||||||
'locked' => ( 1 == $bulk_counts['locked'] ) ? __( '1 page not updated, somebody is editing it.' ) :
|
'locked' => ( 1 === $bulk_counts['locked'] ) ? __( '1 page not updated, somebody is editing it.' ) :
|
||||||
/* translators: %s: Number of pages. */
|
/* translators: %s: Number of pages. */
|
||||||
_n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $bulk_counts['locked'] ),
|
_n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $bulk_counts['locked'] ),
|
||||||
/* translators: %s: Number of pages. */
|
/* translators: %s: Number of pages. */
|
||||||
|
@ -358,7 +358,7 @@ $bulk_messages['page'] = array(
|
||||||
$bulk_messages['wp_block'] = array(
|
$bulk_messages['wp_block'] = array(
|
||||||
/* translators: %s: Number of blocks. */
|
/* translators: %s: Number of blocks. */
|
||||||
'updated' => _n( '%s block updated.', '%s blocks updated.', $bulk_counts['updated'] ),
|
'updated' => _n( '%s block updated.', '%s blocks updated.', $bulk_counts['updated'] ),
|
||||||
'locked' => ( 1 == $bulk_counts['locked'] ) ? __( '1 block not updated, somebody is editing it.' ) :
|
'locked' => ( 1 === $bulk_counts['locked'] ) ? __( '1 block not updated, somebody is editing it.' ) :
|
||||||
/* translators: %s: Number of blocks. */
|
/* translators: %s: Number of blocks. */
|
||||||
_n( '%s block not updated, somebody is editing it.', '%s blocks not updated, somebody is editing them.', $bulk_counts['locked'] ),
|
_n( '%s block not updated, somebody is editing it.', '%s blocks not updated, somebody is editing them.', $bulk_counts['locked'] ),
|
||||||
/* translators: %s: Number of blocks. */
|
/* translators: %s: Number of blocks. */
|
||||||
|
|
|
@ -62,9 +62,9 @@ get_current_screen()->set_help_sidebar(
|
||||||
if ( isset( $_GET['download'] ) ) {
|
if ( isset( $_GET['download'] ) ) {
|
||||||
$args = array();
|
$args = array();
|
||||||
|
|
||||||
if ( ! isset( $_GET['content'] ) || 'all' == $_GET['content'] ) {
|
if ( ! isset( $_GET['content'] ) || 'all' === $_GET['content'] ) {
|
||||||
$args['content'] = 'all';
|
$args['content'] = 'all';
|
||||||
} elseif ( 'posts' == $_GET['content'] ) {
|
} elseif ( 'posts' === $_GET['content'] ) {
|
||||||
$args['content'] = 'post';
|
$args['content'] = 'post';
|
||||||
|
|
||||||
if ( $_GET['cat'] ) {
|
if ( $_GET['cat'] ) {
|
||||||
|
@ -83,7 +83,7 @@ if ( isset( $_GET['download'] ) ) {
|
||||||
if ( $_GET['post_status'] ) {
|
if ( $_GET['post_status'] ) {
|
||||||
$args['status'] = $_GET['post_status'];
|
$args['status'] = $_GET['post_status'];
|
||||||
}
|
}
|
||||||
} elseif ( 'pages' == $_GET['content'] ) {
|
} elseif ( 'pages' === $_GET['content'] ) {
|
||||||
$args['content'] = 'page';
|
$args['content'] = 'page';
|
||||||
|
|
||||||
if ( $_GET['page_author'] ) {
|
if ( $_GET['page_author'] ) {
|
||||||
|
@ -98,7 +98,7 @@ if ( isset( $_GET['download'] ) ) {
|
||||||
if ( $_GET['page_status'] ) {
|
if ( $_GET['page_status'] ) {
|
||||||
$args['status'] = $_GET['page_status'];
|
$args['status'] = $_GET['page_status'];
|
||||||
}
|
}
|
||||||
} elseif ( 'attachment' == $_GET['content'] ) {
|
} elseif ( 'attachment' === $_GET['content'] ) {
|
||||||
$args['content'] = 'attachment';
|
$args['content'] = 'attachment';
|
||||||
|
|
||||||
if ( $_GET['attachment_start_date'] || $_GET['attachment_end_date'] ) {
|
if ( $_GET['attachment_start_date'] || $_GET['attachment_end_date'] ) {
|
||||||
|
@ -144,18 +144,18 @@ function export_date_options( $post_type = 'post' ) {
|
||||||
FROM $wpdb->posts
|
FROM $wpdb->posts
|
||||||
WHERE post_type = %s AND post_status != 'auto-draft'
|
WHERE post_type = %s AND post_status != 'auto-draft'
|
||||||
ORDER BY post_date DESC
|
ORDER BY post_date DESC
|
||||||
",
|
",
|
||||||
$post_type
|
$post_type
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$month_count = count( $months );
|
$month_count = count( $months );
|
||||||
if ( ! $month_count || ( 1 == $month_count && 0 == $months[0]->month ) ) {
|
if ( ! $month_count || ( 1 === $month_count && 0 === (int) $months[0]->month ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ( $months as $date ) {
|
foreach ( $months as $date ) {
|
||||||
if ( 0 == $date->year ) {
|
if ( 0 === (int) $date->year ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ if ( current_user_can( 'install_plugins' ) ) {
|
||||||
// Detect and redirect invalid importers like 'movabletype', which is registered as 'mt'.
|
// Detect and redirect invalid importers like 'movabletype', which is registered as 'mt'.
|
||||||
if ( ! empty( $_GET['invalid'] ) && isset( $popular_importers[ $_GET['invalid'] ] ) ) {
|
if ( ! empty( $_GET['invalid'] ) && isset( $popular_importers[ $_GET['invalid'] ] ) ) {
|
||||||
$importer_id = $popular_importers[ $_GET['invalid'] ]['importer-id'];
|
$importer_id = $popular_importers[ $_GET['invalid'] ]['importer-id'];
|
||||||
if ( $importer_id != $_GET['invalid'] ) { // Prevent redirect loops.
|
if ( $importer_id !== $_GET['invalid'] ) { // Prevent redirect loops.
|
||||||
wp_redirect( admin_url( 'admin.php?import=' . $importer_id ) );
|
wp_redirect( admin_url( 'admin.php?import=' . $importer_id ) );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2346,7 +2346,7 @@ function maybe_create_table( $table_name, $create_ddl ) {
|
||||||
|
|
||||||
$query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $table_name ) );
|
$query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $table_name ) );
|
||||||
|
|
||||||
if ( $wpdb->get_var( $query ) == $table_name ) {
|
if ( $wpdb->get_var( $query ) === $table_name ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2354,9 +2354,10 @@ function maybe_create_table( $table_name, $create_ddl ) {
|
||||||
$wpdb->query( $create_ddl );
|
$wpdb->query( $create_ddl );
|
||||||
|
|
||||||
// We cannot directly tell that whether this succeeded!
|
// We cannot directly tell that whether this succeeded!
|
||||||
if ( $wpdb->get_var( $query ) == $table_name ) {
|
if ( $wpdb->get_var( $query ) === $table_name ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2373,13 +2374,18 @@ function maybe_create_table( $table_name, $create_ddl ) {
|
||||||
*/
|
*/
|
||||||
function drop_index( $table, $index ) {
|
function drop_index( $table, $index ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$wpdb->hide_errors();
|
$wpdb->hide_errors();
|
||||||
|
|
||||||
$wpdb->query( "ALTER TABLE `$table` DROP INDEX `$index`" );
|
$wpdb->query( "ALTER TABLE `$table` DROP INDEX `$index`" );
|
||||||
|
|
||||||
// Now we need to take out all the extra ones we may have created.
|
// Now we need to take out all the extra ones we may have created.
|
||||||
for ( $i = 0; $i < 25; $i++ ) {
|
for ( $i = 0; $i < 25; $i++ ) {
|
||||||
$wpdb->query( "ALTER TABLE `$table` DROP INDEX `{$index}_$i`" );
|
$wpdb->query( "ALTER TABLE `$table` DROP INDEX `{$index}_$i`" );
|
||||||
}
|
}
|
||||||
|
|
||||||
$wpdb->show_errors();
|
$wpdb->show_errors();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2396,8 +2402,10 @@ function drop_index( $table, $index ) {
|
||||||
*/
|
*/
|
||||||
function add_clean_index( $table, $index ) {
|
function add_clean_index( $table, $index ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
drop_index( $table, $index );
|
drop_index( $table, $index );
|
||||||
$wpdb->query( "ALTER TABLE `$table` ADD INDEX ( `$index` )" );
|
$wpdb->query( "ALTER TABLE `$table` ADD INDEX ( `$index` )" );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2415,8 +2423,9 @@ function add_clean_index( $table, $index ) {
|
||||||
*/
|
*/
|
||||||
function maybe_add_column( $table_name, $column_name, $create_ddl ) {
|
function maybe_add_column( $table_name, $column_name, $create_ddl ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
|
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
|
||||||
if ( $column == $column_name ) {
|
if ( $column === $column_name ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2426,10 +2435,11 @@ function maybe_add_column( $table_name, $column_name, $create_ddl ) {
|
||||||
|
|
||||||
// We cannot directly tell that whether this succeeded!
|
// We cannot directly tell that whether this succeeded!
|
||||||
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
|
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
|
||||||
if ( $column == $column_name ) {
|
if ( $column === $column_name ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,20 +51,23 @@ if ( ! function_exists( 'maybe_create_table' ) ) :
|
||||||
*/
|
*/
|
||||||
function maybe_create_table( $table_name, $create_ddl ) {
|
function maybe_create_table( $table_name, $create_ddl ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
foreach ( $wpdb->get_col( 'SHOW TABLES', 0 ) as $table ) {
|
foreach ( $wpdb->get_col( 'SHOW TABLES', 0 ) as $table ) {
|
||||||
if ( $table == $table_name ) {
|
if ( $table === $table_name ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Didn't find it, so try to create it.
|
// Didn't find it, so try to create it.
|
||||||
$wpdb->query( $create_ddl );
|
$wpdb->query( $create_ddl );
|
||||||
|
|
||||||
// We cannot directly tell that whether this succeeded!
|
// We cannot directly tell that whether this succeeded!
|
||||||
foreach ( $wpdb->get_col( 'SHOW TABLES', 0 ) as $table ) {
|
foreach ( $wpdb->get_col( 'SHOW TABLES', 0 ) as $table ) {
|
||||||
if ( $table == $table_name ) {
|
if ( $table === $table_name ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
endif;
|
endif;
|
||||||
|
@ -84,9 +87,9 @@ if ( ! function_exists( 'maybe_add_column' ) ) :
|
||||||
*/
|
*/
|
||||||
function maybe_add_column( $table_name, $column_name, $create_ddl ) {
|
function maybe_add_column( $table_name, $column_name, $create_ddl ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
|
|
||||||
|
|
||||||
if ( $column == $column_name ) {
|
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
|
||||||
|
if ( $column === $column_name ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,10 +99,11 @@ if ( ! function_exists( 'maybe_add_column' ) ) :
|
||||||
|
|
||||||
// We cannot directly tell that whether this succeeded!
|
// We cannot directly tell that whether this succeeded!
|
||||||
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
|
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
|
||||||
if ( $column == $column_name ) {
|
if ( $column === $column_name ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
endif;
|
endif;
|
||||||
|
@ -118,20 +122,22 @@ endif;
|
||||||
*/
|
*/
|
||||||
function maybe_drop_column( $table_name, $column_name, $drop_ddl ) {
|
function maybe_drop_column( $table_name, $column_name, $drop_ddl ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
|
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
|
||||||
if ( $column == $column_name ) {
|
if ( $column === $column_name ) {
|
||||||
|
|
||||||
// Found it, so try to drop it.
|
// Found it, so try to drop it.
|
||||||
$wpdb->query( $drop_ddl );
|
$wpdb->query( $drop_ddl );
|
||||||
|
|
||||||
// We cannot directly tell that whether this succeeded!
|
// We cannot directly tell that whether this succeeded!
|
||||||
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
|
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
|
||||||
if ( $column == $column_name ) {
|
if ( $column === $column_name ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Else didn't find it.
|
// Else didn't find it.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -167,34 +173,38 @@ function maybe_drop_column( $table_name, $column_name, $drop_ddl ) {
|
||||||
*/
|
*/
|
||||||
function check_column( $table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null ) {
|
function check_column( $table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$diffs = 0;
|
$diffs = 0;
|
||||||
$results = $wpdb->get_results( "DESC $table_name" );
|
$results = $wpdb->get_results( "DESC $table_name" );
|
||||||
|
|
||||||
foreach ( $results as $row ) {
|
foreach ( $results as $row ) {
|
||||||
|
|
||||||
if ( $row->Field == $col_name ) {
|
if ( $row->Field === $col_name ) {
|
||||||
|
|
||||||
// Got our column, check the params.
|
// Got our column, check the params.
|
||||||
if ( ( null != $col_type ) && ( $row->Type != $col_type ) ) {
|
if ( ( null !== $col_type ) && ( $row->Type !== $col_type ) ) {
|
||||||
++$diffs;
|
++$diffs;
|
||||||
}
|
}
|
||||||
if ( ( null != $is_null ) && ( $row->Null != $is_null ) ) {
|
if ( ( null !== $is_null ) && ( $row->Null !== $is_null ) ) {
|
||||||
++$diffs;
|
++$diffs;
|
||||||
}
|
}
|
||||||
if ( ( null != $key ) && ( $row->Key != $key ) ) {
|
if ( ( null !== $key ) && ( $row->Key !== $key ) ) {
|
||||||
++$diffs;
|
++$diffs;
|
||||||
}
|
}
|
||||||
if ( ( null != $default ) && ( $row->Default != $default ) ) {
|
if ( ( null !== $default ) && ( $row->Default !== $default ) ) {
|
||||||
++$diffs;
|
++$diffs;
|
||||||
}
|
}
|
||||||
if ( ( null != $extra ) && ( $row->Extra != $extra ) ) {
|
if ( ( null !== $extra ) && ( $row->Extra !== $extra ) ) {
|
||||||
++$diffs;
|
++$diffs;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $diffs > 0 ) {
|
if ( $diffs > 0 ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} // End if found our column.
|
} // End if found our column.
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,8 +91,7 @@ function display_header( $body_classes = '' ) {
|
||||||
function display_setup_form( $error = null ) {
|
function display_setup_form( $error = null ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$sql = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->users ) );
|
$user_table = ( $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->users ) ) ) !== null );
|
||||||
$user_table = ( $wpdb->get_var( $sql ) != null );
|
|
||||||
|
|
||||||
// Ensure that sites appear in search engines by default.
|
// Ensure that sites appear in search engines by default.
|
||||||
$blog_public = 1;
|
$blog_public = 1;
|
||||||
|
@ -369,10 +368,10 @@ switch ( $step ) {
|
||||||
// TODO: Poka-yoke.
|
// TODO: Poka-yoke.
|
||||||
display_setup_form( __( 'Please provide a valid username.' ) );
|
display_setup_form( __( 'Please provide a valid username.' ) );
|
||||||
$error = true;
|
$error = true;
|
||||||
} elseif ( sanitize_user( $user_name, true ) != $user_name ) {
|
} elseif ( sanitize_user( $user_name, true ) !== $user_name ) {
|
||||||
display_setup_form( __( 'The username you provided has invalid characters.' ) );
|
display_setup_form( __( 'The username you provided has invalid characters.' ) );
|
||||||
$error = true;
|
$error = true;
|
||||||
} elseif ( $admin_password != $admin_password_check ) {
|
} elseif ( $admin_password !== $admin_password_check ) {
|
||||||
// TODO: Poka-yoke.
|
// TODO: Poka-yoke.
|
||||||
display_setup_form( __( 'Your passwords do not match. Please try again.' ) );
|
display_setup_form( __( 'Your passwords do not match. Please try again.' ) );
|
||||||
$error = true;
|
$error = true;
|
||||||
|
|
|
@ -23,7 +23,7 @@ if ( $doaction && isset( $_REQUEST['linkcheck'] ) ) {
|
||||||
$redirect_to = admin_url( 'link-manager.php' );
|
$redirect_to = admin_url( 'link-manager.php' );
|
||||||
$bulklinks = (array) $_REQUEST['linkcheck'];
|
$bulklinks = (array) $_REQUEST['linkcheck'];
|
||||||
|
|
||||||
if ( 'delete' == $doaction ) {
|
if ( 'delete' === $doaction ) {
|
||||||
foreach ( $bulklinks as $link_id ) {
|
foreach ( $bulklinks as $link_id ) {
|
||||||
$link_id = (int) $link_id;
|
$link_id = (int) $link_id;
|
||||||
|
|
||||||
|
|
|
@ -27,14 +27,14 @@ global $opml;
|
||||||
* @global array $descriptions
|
* @global array $descriptions
|
||||||
* @global array $feeds
|
* @global array $feeds
|
||||||
*
|
*
|
||||||
* @param resource $parser XML Parser resource.
|
* @param resource $parser XML Parser resource.
|
||||||
* @param string $tagName XML element name.
|
* @param string $tag_name XML element name.
|
||||||
* @param array $attrs XML element attributes.
|
* @param array $attrs XML element attributes.
|
||||||
*/
|
*/
|
||||||
function startElement( $parser, $tagName, $attrs ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
|
function startElement( $parser, $tag_name, $attrs ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
|
||||||
global $names, $urls, $targets, $descriptions, $feeds;
|
global $names, $urls, $targets, $descriptions, $feeds;
|
||||||
|
|
||||||
if ( 'OUTLINE' === $tagName ) {
|
if ( 'OUTLINE' === $tag_name ) {
|
||||||
$name = '';
|
$name = '';
|
||||||
if ( isset( $attrs['TEXT'] ) ) {
|
if ( isset( $attrs['TEXT'] ) ) {
|
||||||
$name = $attrs['TEXT'];
|
$name = $attrs['TEXT'];
|
||||||
|
@ -65,10 +65,10 @@ function startElement( $parser, $tagName, $attrs ) { // phpcs:ignore WordPress.N
|
||||||
* @since 0.71
|
* @since 0.71
|
||||||
* @access private
|
* @access private
|
||||||
*
|
*
|
||||||
* @param resource $parser XML Parser resource.
|
* @param resource $parser XML Parser resource.
|
||||||
* @param string $tagName XML tag name.
|
* @param string $tag_name XML tag name.
|
||||||
*/
|
*/
|
||||||
function endElement( $parser, $tagName ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
|
function endElement( $parser, $tag_name ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
|
||||||
// Nothing to do.
|
// Nothing to do.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ switch ( $action ) {
|
||||||
check_admin_referer( 'bulk-bookmarks' );
|
check_admin_referer( 'bulk-bookmarks' );
|
||||||
|
|
||||||
// For each link id (in $linkcheck[]) change category to selected value.
|
// For each link id (in $linkcheck[]) change category to selected value.
|
||||||
if ( count( $linkcheck ) == 0 ) {
|
if ( count( $linkcheck ) === 0 ) {
|
||||||
wp_redirect( $this_file );
|
wp_redirect( $this_file );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ switch ( $action ) {
|
||||||
check_admin_referer( 'bulk-bookmarks' );
|
check_admin_referer( 'bulk-bookmarks' );
|
||||||
|
|
||||||
// For each link id (in $linkcheck[]) change category to selected value.
|
// For each link id (in $linkcheck[]) change category to selected value.
|
||||||
if ( count( $linkcheck ) == 0 ) {
|
if ( count( $linkcheck ) === 0 ) {
|
||||||
wp_redirect( $this_file );
|
wp_redirect( $this_file );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ if ( empty( $load ) ) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$rtl = ( isset( $_GET['dir'] ) && 'rtl' == $_GET['dir'] );
|
$rtl = ( isset( $_GET['dir'] ) && 'rtl' === $_GET['dir'] );
|
||||||
$expires_offset = 31536000; // 1 year.
|
$expires_offset = 31536000; // 1 year.
|
||||||
$out = '';
|
$out = '';
|
||||||
|
|
||||||
|
|
|
@ -29,11 +29,11 @@ wp_enqueue_script( 'media-gallery' );
|
||||||
header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
|
header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
|
||||||
|
|
||||||
// IDs should be integers.
|
// IDs should be integers.
|
||||||
$ID = isset( $ID ) ? (int) $ID : 0;
|
$ID = isset( $ID ) ? (int) $ID : 0; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
|
||||||
$post_id = isset( $post_id ) ? (int) $post_id : 0;
|
$post_id = isset( $post_id ) ? (int) $post_id : 0;
|
||||||
|
|
||||||
// Require an ID for the edit screen.
|
// Require an ID for the edit screen.
|
||||||
if ( isset( $action ) && 'edit' == $action && ! $ID ) {
|
if ( isset( $action ) && 'edit' === $action && ! $ID ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName
|
||||||
wp_die(
|
wp_die(
|
||||||
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
|
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
|
||||||
'<p>' . __( 'Invalid item ID.' ) . '</p>',
|
'<p>' . __( 'Invalid item ID.' ) . '</p>',
|
||||||
|
@ -81,7 +81,7 @@ if ( isset( $_GET['tab'] ) ) {
|
||||||
$body_id = 'media-upload';
|
$body_id = 'media-upload';
|
||||||
|
|
||||||
// Let the action code decide how to handle the request.
|
// Let the action code decide how to handle the request.
|
||||||
if ( 'type' == $tab || 'type_url' == $tab || ! array_key_exists( $tab, media_upload_tabs() ) ) {
|
if ( 'type' === $tab || 'type_url' === $tab || ! array_key_exists( $tab, media_upload_tabs() ) ) {
|
||||||
/**
|
/**
|
||||||
* Fires inside specific upload-type views in the legacy (pre-3.5.0)
|
* Fires inside specific upload-type views in the legacy (pre-3.5.0)
|
||||||
* media popup based on the current tab.
|
* media popup based on the current tab.
|
||||||
|
|
|
@ -29,7 +29,7 @@ switch ( $action ) {
|
||||||
$location = 'media.php';
|
$location = 'media.php';
|
||||||
$referer = wp_get_original_referer();
|
$referer = wp_get_original_referer();
|
||||||
if ( $referer ) {
|
if ( $referer ) {
|
||||||
if ( false !== strpos( $referer, 'upload.php' ) || ( url_to_postid( $referer ) == $attachment_id ) ) {
|
if ( false !== strpos( $referer, 'upload.php' ) || ( url_to_postid( $referer ) === $attachment_id ) ) {
|
||||||
$location = $referer;
|
$location = $referer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ switch ( $action ) {
|
||||||
if ( 'attachment' !== $att->post_type ) {
|
if ( 'attachment' !== $att->post_type ) {
|
||||||
wp_die( __( 'You attempted to edit an item that isn’t an attachment. Please go back and try again.' ) );
|
wp_die( __( 'You attempted to edit an item that isn’t an attachment. Please go back and try again.' ) );
|
||||||
}
|
}
|
||||||
if ( 'trash' == $att->post_status ) {
|
if ( 'trash' === $att->post_status ) {
|
||||||
wp_die( __( 'You can’t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.' ) );
|
wp_die( __( 'You can’t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
|
||||||
$submenu_items = $submenu[ $item[2] ];
|
$submenu_items = $submenu[ $item[2] ];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ( $parent_file && $item[2] == $parent_file ) || ( empty( $typenow ) && $self == $item[2] ) ) {
|
if ( ( $parent_file && $item[2] === $parent_file ) || ( empty( $typenow ) && $self === $item[2] ) ) {
|
||||||
if ( ! empty( $submenu_items ) ) {
|
if ( ! empty( $submenu_items ) ) {
|
||||||
$class[] = 'wp-has-current-submenu wp-menu-open';
|
$class[] = 'wp-has-current-submenu wp-menu-open';
|
||||||
} else {
|
} else {
|
||||||
|
@ -154,10 +154,16 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
|
||||||
$menu_hook = get_plugin_page_hook( $submenu_items[0][2], $item[2] );
|
$menu_hook = get_plugin_page_hook( $submenu_items[0][2], $item[2] );
|
||||||
$menu_file = $submenu_items[0][2];
|
$menu_file = $submenu_items[0][2];
|
||||||
$pos = strpos( $menu_file, '?' );
|
$pos = strpos( $menu_file, '?' );
|
||||||
|
|
||||||
if ( false !== $pos ) {
|
if ( false !== $pos ) {
|
||||||
$menu_file = substr( $menu_file, 0, $pos );
|
$menu_file = substr( $menu_file, 0, $pos );
|
||||||
}
|
}
|
||||||
if ( ! empty( $menu_hook ) || ( ( 'index.php' != $submenu_items[0][2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) {
|
|
||||||
|
if ( ! empty( $menu_hook )
|
||||||
|
|| ( ( 'index.php' !== $submenu_items[0][2] )
|
||||||
|
&& file_exists( WP_PLUGIN_DIR . "/$menu_file" )
|
||||||
|
&& ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) )
|
||||||
|
) {
|
||||||
$admin_is_parent = true;
|
$admin_is_parent = true;
|
||||||
echo "<a href='admin.php?page={$submenu_items[0][2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style>$img</div><div class='wp-menu-name'>$title</div></a>";
|
echo "<a href='admin.php?page={$submenu_items[0][2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style>$img</div><div class='wp-menu-name'>$title</div></a>";
|
||||||
} else {
|
} else {
|
||||||
|
@ -167,10 +173,16 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
|
||||||
$menu_hook = get_plugin_page_hook( $item[2], 'admin.php' );
|
$menu_hook = get_plugin_page_hook( $item[2], 'admin.php' );
|
||||||
$menu_file = $item[2];
|
$menu_file = $item[2];
|
||||||
$pos = strpos( $menu_file, '?' );
|
$pos = strpos( $menu_file, '?' );
|
||||||
|
|
||||||
if ( false !== $pos ) {
|
if ( false !== $pos ) {
|
||||||
$menu_file = substr( $menu_file, 0, $pos );
|
$menu_file = substr( $menu_file, 0, $pos );
|
||||||
}
|
}
|
||||||
if ( ! empty( $menu_hook ) || ( ( 'index.php' != $item[2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) {
|
|
||||||
|
if ( ! empty( $menu_hook )
|
||||||
|
|| ( ( 'index.php' !== $item[2] )
|
||||||
|
&& file_exists( WP_PLUGIN_DIR . "/$menu_file" )
|
||||||
|
&& ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) )
|
||||||
|
) {
|
||||||
$admin_is_parent = true;
|
$admin_is_parent = true;
|
||||||
echo "\n\t<a href='admin.php?page={$item[2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style>$img</div><div class='wp-menu-name'>{$item[0]}</div></a>";
|
echo "\n\t<a href='admin.php?page={$item[2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style>$img</div><div class='wp-menu-name'>{$item[0]}</div></a>";
|
||||||
} else {
|
} else {
|
||||||
|
@ -192,14 +204,15 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
|
||||||
|
|
||||||
$class = array();
|
$class = array();
|
||||||
$aria_attributes = '';
|
$aria_attributes = '';
|
||||||
|
|
||||||
if ( $first ) {
|
if ( $first ) {
|
||||||
$class[] = 'wp-first-item';
|
$class[] = 'wp-first-item';
|
||||||
$first = false;
|
$first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$menu_file = $item[2];
|
$menu_file = $item[2];
|
||||||
|
$pos = strpos( $menu_file, '?' );
|
||||||
|
|
||||||
$pos = strpos( $menu_file, '?' );
|
|
||||||
if ( false !== $pos ) {
|
if ( false !== $pos ) {
|
||||||
$menu_file = substr( $menu_file, 0, $pos );
|
$menu_file = substr( $menu_file, 0, $pos );
|
||||||
}
|
}
|
||||||
|
@ -208,15 +221,16 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
|
||||||
$self_type = ! empty( $typenow ) ? $self . '?post_type=' . $typenow : 'nothing';
|
$self_type = ! empty( $typenow ) ? $self . '?post_type=' . $typenow : 'nothing';
|
||||||
|
|
||||||
if ( isset( $submenu_file ) ) {
|
if ( isset( $submenu_file ) ) {
|
||||||
if ( $submenu_file == $sub_item[2] ) {
|
if ( $submenu_file === $sub_item[2] ) {
|
||||||
$class[] = 'current';
|
$class[] = 'current';
|
||||||
$aria_attributes .= ' aria-current="page"';
|
$aria_attributes .= ' aria-current="page"';
|
||||||
}
|
}
|
||||||
// If plugin_page is set the parent must either match the current page or not physically exist.
|
// If plugin_page is set the parent must either match the current page or not physically exist.
|
||||||
// This allows plugin pages with the same hook to exist under different parents.
|
// This allows plugin pages with the same hook to exist under different parents.
|
||||||
} elseif (
|
} elseif (
|
||||||
( ! isset( $plugin_page ) && $self == $sub_item[2] ) ||
|
( ! isset( $plugin_page ) && $self === $sub_item[2] )
|
||||||
( isset( $plugin_page ) && $plugin_page == $sub_item[2] && ( $item[2] == $self_type || $item[2] == $self || file_exists( $menu_file ) === false ) )
|
|| ( isset( $plugin_page ) && $plugin_page === $sub_item[2]
|
||||||
|
&& ( $item[2] === $self_type || $item[2] === $self || file_exists( $menu_file ) === false ) )
|
||||||
) {
|
) {
|
||||||
$class[] = 'current';
|
$class[] = 'current';
|
||||||
$aria_attributes .= ' aria-current="page"';
|
$aria_attributes .= ' aria-current="page"';
|
||||||
|
@ -237,7 +251,11 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
|
||||||
|
|
||||||
$title = wptexturize( $sub_item[0] );
|
$title = wptexturize( $sub_item[0] );
|
||||||
|
|
||||||
if ( ! empty( $menu_hook ) || ( ( 'index.php' != $sub_item[2] ) && file_exists( WP_PLUGIN_DIR . "/$sub_file" ) && ! file_exists( ABSPATH . "/wp-admin/$sub_file" ) ) ) {
|
if ( ! empty( $menu_hook )
|
||||||
|
|| ( ( 'index.php' !== $sub_item[2] )
|
||||||
|
&& file_exists( WP_PLUGIN_DIR . "/$sub_file" )
|
||||||
|
&& ! file_exists( ABSPATH . "/wp-admin/$sub_file" ) )
|
||||||
|
) {
|
||||||
// If admin.php is the current page or if the parent exists as a file in the plugins or admin directory.
|
// If admin.php is the current page or if the parent exists as a file in the plugins or admin directory.
|
||||||
if ( ( ! $admin_is_parent && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! is_dir( WP_PLUGIN_DIR . "/{$item[2]}" ) ) || file_exists( $menu_file ) ) {
|
if ( ( ! $admin_is_parent && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! is_dir( WP_PLUGIN_DIR . "/{$item[2]}" ) ) || file_exists( $menu_file ) ) {
|
||||||
$sub_item_url = add_query_arg( array( 'page' => $sub_item[2] ), $item[2] );
|
$sub_item_url = add_query_arg( array( 'page' => $sub_item[2] ), $item[2] );
|
||||||
|
|
|
@ -17,7 +17,7 @@ if ( ! current_user_can( 'delete_site' ) ) {
|
||||||
wp_die( __( 'Sorry, you are not allowed to delete this site.' ) );
|
wp_die( __( 'Sorry, you are not allowed to delete this site.' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $_GET['h'] ) && '' != $_GET['h'] && false != get_option( 'delete_blog_hash' ) ) {
|
if ( isset( $_GET['h'] ) && '' !== $_GET['h'] && false !== get_option( 'delete_blog_hash' ) ) {
|
||||||
if ( hash_equals( get_option( 'delete_blog_hash' ), $_GET['h'] ) ) {
|
if ( hash_equals( get_option( 'delete_blog_hash' ), $_GET['h'] ) ) {
|
||||||
wpmu_delete_blog( get_current_blog_id() );
|
wpmu_delete_blog( get_current_blog_id() );
|
||||||
wp_die(
|
wp_die(
|
||||||
|
@ -42,7 +42,7 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
|
||||||
echo '<div class="wrap">';
|
echo '<div class="wrap">';
|
||||||
echo '<h1>' . esc_html( $title ) . '</h1>';
|
echo '<h1>' . esc_html( $title ) . '</h1>';
|
||||||
|
|
||||||
if ( isset( $_POST['action'] ) && 'deleteblog' == $_POST['action'] && isset( $_POST['confirmdelete'] ) && '1' == $_POST['confirmdelete'] ) {
|
if ( isset( $_POST['action'] ) && 'deleteblog' === $_POST['action'] && isset( $_POST['confirmdelete'] ) && '1' === $_POST['confirmdelete'] ) {
|
||||||
check_admin_referer( 'delete-blog' );
|
check_admin_referer( 'delete-blog' );
|
||||||
|
|
||||||
$hash = wp_generate_password( 20, false );
|
$hash = wp_generate_password( 20, false );
|
||||||
|
|
|
@ -22,7 +22,7 @@ $action = isset( $_POST['action'] ) ? $_POST['action'] : 'splash';
|
||||||
$blogs = get_blogs_of_user( $current_user->ID );
|
$blogs = get_blogs_of_user( $current_user->ID );
|
||||||
|
|
||||||
$updated = false;
|
$updated = false;
|
||||||
if ( 'updateblogsettings' == $action && isset( $_POST['primary_blog'] ) ) {
|
if ( 'updateblogsettings' === $action && isset( $_POST['primary_blog'] ) ) {
|
||||||
check_admin_referer( 'update-my-sites' );
|
check_admin_referer( 'update-my-sites' );
|
||||||
|
|
||||||
$blog = get_site( (int) $_POST['primary_blog'] );
|
$blog = get_site( (int) $_POST['primary_blog'] );
|
||||||
|
@ -107,10 +107,12 @@ else :
|
||||||
* @param string $context Context of the setting (global or site-specific). Default 'global'.
|
* @param string $context Context of the setting (global or site-specific). Default 'global'.
|
||||||
*/
|
*/
|
||||||
$settings_html = apply_filters( 'myblogs_options', '', 'global' );
|
$settings_html = apply_filters( 'myblogs_options', '', 'global' );
|
||||||
if ( '' != $settings_html ) {
|
|
||||||
|
if ( $settings_html ) {
|
||||||
echo '<h3>' . __( 'Global Settings' ) . '</h3>';
|
echo '<h3>' . __( 'Global Settings' ) . '</h3>';
|
||||||
echo $settings_html;
|
echo $settings_html;
|
||||||
}
|
}
|
||||||
|
|
||||||
reset( $blogs );
|
reset( $blogs );
|
||||||
|
|
||||||
foreach ( $blogs as $user_blog ) {
|
foreach ( $blogs as $user_blog ) {
|
||||||
|
@ -134,10 +136,12 @@ else :
|
||||||
* @param object $user_blog An object containing the site data.
|
* @param object $user_blog An object containing the site data.
|
||||||
*/
|
*/
|
||||||
$actions = apply_filters( 'myblogs_blog_actions', $actions, $user_blog );
|
$actions = apply_filters( 'myblogs_blog_actions', $actions, $user_blog );
|
||||||
|
|
||||||
echo "<p class='my-sites-actions'>" . $actions . '</p>';
|
echo "<p class='my-sites-actions'>" . $actions . '</p>';
|
||||||
|
|
||||||
/** This filter is documented in wp-admin/my-sites.php */
|
/** This filter is documented in wp-admin/my-sites.php */
|
||||||
echo apply_filters( 'myblogs_options', '', $user_blog );
|
echo apply_filters( 'myblogs_options', '', $user_blog );
|
||||||
|
|
||||||
echo '</li>';
|
echo '</li>';
|
||||||
|
|
||||||
restore_current_blog();
|
restore_current_blog();
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.5-alpha-47784';
|
$wp_version = '5.5-alpha-47785';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue