mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 09:07:59 +01:00
Docs: Improve inline comments per the documentation standards.
Includes minor code layout fixes for better readability. See #48303. Built from https://develop.svn.wordpress.org/trunk@47122 git-svn-id: http://core.svn.wordpress.org/trunk@46922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e336b24edd
commit
001ffe81fb
@ -68,7 +68,7 @@ if ( is_object( $wp_object_cache ) ) {
|
||||
$wp_object_cache->cache_enabled = false;
|
||||
}
|
||||
|
||||
// Fix for page title
|
||||
// Fix for page title.
|
||||
$wp_query->is_404 = false;
|
||||
|
||||
/**
|
||||
|
@ -27,7 +27,7 @@ send_origin_headers();
|
||||
header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
|
||||
header( 'X-Robots-Tag: noindex' );
|
||||
|
||||
// Require an action parameter
|
||||
// Require an action parameter.
|
||||
if ( empty( $_REQUEST['action'] ) ) {
|
||||
wp_die( '0', 400 );
|
||||
}
|
||||
@ -141,7 +141,7 @@ $core_actions_post = array(
|
||||
'health-check-get-sizes',
|
||||
);
|
||||
|
||||
// Deprecated
|
||||
// Deprecated.
|
||||
$core_actions_post_deprecated = array( 'wp-fullscreen-save-post', 'press-this-save-post', 'press-this-add-category' );
|
||||
$core_actions_post = array_merge( $core_actions_post, $core_actions_post_deprecated );
|
||||
|
||||
@ -189,5 +189,5 @@ if ( is_user_logged_in() ) {
|
||||
*/
|
||||
do_action( "wp_ajax_nopriv_{$action}" );
|
||||
}
|
||||
// Default status
|
||||
// Default status.
|
||||
wp_die( '0' );
|
||||
|
@ -6,7 +6,7 @@
|
||||
* @subpackage Administration
|
||||
*/
|
||||
|
||||
// don't load directly
|
||||
// Don't load directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
@ -104,7 +104,7 @@ do_action( 'admin_print_footer_scripts' );
|
||||
*/
|
||||
do_action( "admin_footer-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
|
||||
|
||||
// get_site_option() won't exist when auto upgrading from <= 2.7
|
||||
// get_site_option() won't exist when auto upgrading from <= 2.7.
|
||||
if ( function_exists( 'get_site_option' ) ) {
|
||||
if ( false === get_site_option( 'can_compress_scripts' ) ) {
|
||||
compression_test();
|
||||
|
@ -93,12 +93,12 @@ require_once( ABSPATH . 'wp-admin/includes/admin.php' );
|
||||
|
||||
auth_redirect();
|
||||
|
||||
// Schedule trash collection
|
||||
// Schedule trash collection.
|
||||
if ( ! wp_next_scheduled( 'wp_scheduled_delete' ) && ! wp_installing() ) {
|
||||
wp_schedule_event( time(), 'daily', 'wp_scheduled_delete' );
|
||||
}
|
||||
|
||||
// Schedule Transient cleanup.
|
||||
// Schedule transient cleanup.
|
||||
if ( ! wp_next_scheduled( 'delete_expired_transients' ) && ! wp_installing() ) {
|
||||
wp_schedule_event( time(), 'daily', 'delete_expired_transients' );
|
||||
}
|
||||
@ -182,7 +182,7 @@ if ( isset( $plugin_page ) ) {
|
||||
|
||||
// Back-compat for plugins using add_management_page().
|
||||
if ( empty( $page_hook ) && 'edit.php' == $pagenow && '' != get_plugin_page_hook( $plugin_page, 'tools.php' ) ) {
|
||||
// There could be plugin specific params on the URL, so we need the whole query string
|
||||
// There could be plugin specific params on the URL, so we need the whole query string.
|
||||
if ( ! empty( $_SERVER['QUERY_STRING'] ) ) {
|
||||
$query_string = $_SERVER['QUERY_STRING'];
|
||||
} else {
|
||||
@ -347,7 +347,7 @@ if ( isset( $plugin_page ) ) {
|
||||
|
||||
include( ABSPATH . 'wp-admin/admin-footer.php' );
|
||||
|
||||
// Make sure rules are flushed
|
||||
// Make sure rules are flushed.
|
||||
flush_rewrite_rules( false );
|
||||
|
||||
exit();
|
||||
|
@ -38,7 +38,7 @@ if ( ! current_user_can( 'upload_files' ) ) {
|
||||
wp_die( __( 'Sorry, you are not allowed to upload files.' ) );
|
||||
}
|
||||
|
||||
// just fetch the detail form for that attachment
|
||||
// Just fetch the detail form for that attachment.
|
||||
if ( isset( $_REQUEST['attachment_id'] ) && intval( $_REQUEST['attachment_id'] ) && $_REQUEST['fetch'] ) {
|
||||
$id = intval( $_REQUEST['attachment_id'] );
|
||||
$post = get_post( $id );
|
||||
@ -112,7 +112,7 @@ if ( $_REQUEST['short'] ) {
|
||||
// Short form response - attachment ID only.
|
||||
echo $id;
|
||||
} else {
|
||||
// Long form response - big chunk of html.
|
||||
// Long form response - big chunk of HTML.
|
||||
$type = $_REQUEST['type'];
|
||||
|
||||
/**
|
||||
|
@ -137,7 +137,7 @@ switch ( $action ) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ( $comment->comment_approved != '0' ) { // if not unapproved
|
||||
if ( $comment->comment_approved != '0' ) { // If not unapproved.
|
||||
$message = '';
|
||||
switch ( $comment->comment_approved ) {
|
||||
case '1':
|
||||
@ -355,6 +355,6 @@ switch ( $action ) {
|
||||
default:
|
||||
wp_die( __( 'Unknown action.' ) );
|
||||
|
||||
} // end switch
|
||||
} // End switch.
|
||||
|
||||
include( ABSPATH . 'wp-admin/admin-footer.php' );
|
||||
|
@ -133,7 +133,7 @@ include( ABSPATH . 'wp-admin/admin-footer.php' );
|
||||
|
||||
return;
|
||||
|
||||
// These are strings returned by the API that we want to be translatable
|
||||
// These are strings returned by the API that we want to be translatable.
|
||||
__( 'Project Leaders' );
|
||||
/* translators: %s: The current WordPress version number. */
|
||||
__( 'Core Contributors to WordPress %s' );
|
||||
|
@ -52,7 +52,7 @@ if ( $doaction ) {
|
||||
|
||||
wp_defer_comment_counting( true );
|
||||
|
||||
foreach ( $comment_ids as $comment_id ) { // Check the permissions on each
|
||||
foreach ( $comment_ids as $comment_id ) { // Check the permissions on each.
|
||||
if ( ! current_user_can( 'edit_comment', $comment_id ) ) {
|
||||
continue;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
* @subpackage Administration
|
||||
*/
|
||||
|
||||
// don't load directly
|
||||
// Don't load directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
@ -95,7 +95,7 @@ if ( $thumbnail_support ) {
|
||||
wp_enqueue_media( array( 'post' => $post_ID ) );
|
||||
}
|
||||
|
||||
// Add the local autosave notice HTML
|
||||
// Add the local autosave notice HTML.
|
||||
add_action( 'admin_footer', '_local_storage_notice' );
|
||||
|
||||
/*
|
||||
@ -242,7 +242,7 @@ $form_action = 'editpost';
|
||||
$nonce_action = 'update-post_' . $post_ID;
|
||||
$form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr( $post_ID ) . "' />";
|
||||
|
||||
// Detect if there exists an autosave newer than the post and if that autosave is different than the post
|
||||
// Detect if there exists an autosave newer than the post and if that autosave is different than the post.
|
||||
if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) {
|
||||
foreach ( _wp_post_revision_fields( $post ) as $autosave_field => $_autosave_field ) {
|
||||
if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) {
|
||||
|
@ -8,7 +8,7 @@
|
||||
* @subpackage Administration
|
||||
*/
|
||||
|
||||
// don't load directly
|
||||
// Don't load directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
@ -148,10 +148,12 @@ $font_sizes = current( (array) get_theme_support( 'editor-font-sizes' ) );
|
||||
*/
|
||||
$allowed_block_types = apply_filters( 'allowed_block_types', true, $post );
|
||||
|
||||
// Get all available templates for the post/page attributes meta-box.
|
||||
// The "Default template" array element should only be added if the array is
|
||||
// not empty so we do not trigger the template select element without any options
|
||||
// besides the default value.
|
||||
/*
|
||||
* Get all available templates for the post/page attributes meta-box.
|
||||
* The "Default template" array element should only be added if the array is
|
||||
* not empty so we do not trigger the template select element without any options
|
||||
* besides the default value.
|
||||
*/
|
||||
$available_templates = wp_get_theme()->get_page_templates( get_post( $post->ID ) );
|
||||
$available_templates = ! empty( $available_templates ) ? array_merge(
|
||||
array(
|
||||
|
@ -6,7 +6,7 @@
|
||||
* @subpackage Administration
|
||||
*/
|
||||
|
||||
// don't load directly
|
||||
// Don't load directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
* @subpackage Administration
|
||||
*/
|
||||
|
||||
// don't load directly
|
||||
// Don't load directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
@ -6,12 +6,12 @@
|
||||
* @subpackage Administration
|
||||
*/
|
||||
|
||||
// don't load directly
|
||||
// Don't load directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
|
||||
// Back compat hooks
|
||||
// Back compat hooks.
|
||||
if ( 'category' == $taxonomy ) {
|
||||
/**
|
||||
* Fires before the Edit Category form.
|
||||
@ -191,7 +191,7 @@ if ( isset( $tag->name ) ) {
|
||||
<p class="description"><?php _e( 'The description is not prominent by default; however, some themes may show it.' ); ?></p></td>
|
||||
</tr>
|
||||
<?php
|
||||
// Back compat hooks
|
||||
// Back compat hooks.
|
||||
if ( 'category' == $taxonomy ) {
|
||||
/**
|
||||
* Fires after the Edit Category form fields are displayed.
|
||||
@ -238,7 +238,7 @@ if ( isset( $tag->name ) ) {
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
// Back compat hooks
|
||||
// Back compat hooks.
|
||||
if ( 'category' == $taxonomy ) {
|
||||
/** This action is documented in wp-admin/edit-tags.php */
|
||||
do_action_deprecated( 'edit_category_form', array( $tag ), '3.0.0', '{$taxonomy}_add_form' );
|
||||
|
@ -47,7 +47,7 @@ if ( ! current_user_can( $post_type_object->cap->edit_posts ) ) {
|
||||
$wp_list_table = _get_list_table( 'WP_Posts_List_Table' );
|
||||
$pagenum = $wp_list_table->get_pagenum();
|
||||
|
||||
// Back-compat for viewing comments of an entry
|
||||
// Back-compat for viewing comments of an entry.
|
||||
foreach ( array( 'p', 'attachment_id', 'page_id' ) as $_redirect ) {
|
||||
if ( ! empty( $_REQUEST[ $_redirect ] ) ) {
|
||||
wp_redirect( admin_url( 'edit-comments.php?p=' . absint( $_REQUEST[ $_redirect ] ) ) );
|
||||
|
@ -39,7 +39,7 @@ if ( current_user_can( 'install_plugins' ) ) {
|
||||
$popular_importers = array();
|
||||
}
|
||||
|
||||
// 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'] ] ) ) {
|
||||
$importer_id = $popular_importers[ $_GET['invalid'] ]['importer-id'];
|
||||
if ( $importer_id != $_GET['invalid'] ) { // Prevent redirect loops.
|
||||
@ -93,7 +93,7 @@ foreach ( $popular_importers as $pop_importer => $pop_data ) {
|
||||
}
|
||||
|
||||
if ( empty( $importers ) ) {
|
||||
echo '<p>' . __( 'No importers are available.' ) . '</p>'; // TODO: make more helpful
|
||||
echo '<p>' . __( 'No importers are available.' ) . '</p>'; // TODO: Make more helpful.
|
||||
} else {
|
||||
uasort( $importers, '_usort_by_first_member' );
|
||||
?>
|
||||
|
@ -128,7 +128,7 @@ add_action( 'upgrader_process_complete', 'wp_version_check', 10, 0 );
|
||||
add_action( 'upgrader_process_complete', 'wp_update_plugins', 10, 0 );
|
||||
add_action( 'upgrader_process_complete', 'wp_update_themes', 10, 0 );
|
||||
|
||||
// Privacy hooks
|
||||
// Privacy hooks.
|
||||
add_filter( 'wp_privacy_personal_data_erasure_page', 'wp_privacy_process_personal_data_erasure_page', 10, 5 );
|
||||
add_filter( 'wp_privacy_personal_data_export_page', 'wp_privacy_process_personal_data_export_page', 10, 7 );
|
||||
add_action( 'wp_privacy_personal_data_export_file', 'wp_privacy_generate_personal_data_export_file', 10 );
|
||||
|
@ -74,7 +74,7 @@ require_once( ABSPATH . 'wp-admin/includes/theme.php' );
|
||||
require_once( ABSPATH . 'wp-admin/includes/privacy-tools.php' );
|
||||
|
||||
/** WordPress Privacy List Table classes. */
|
||||
// Previously in wp-admin/includes/user.php. Need to be loaded for backwards compatibility.
|
||||
// Previously in wp-admin/includes/user.php. Need to be loaded for backward compatibility.
|
||||
require_once( ABSPATH . 'wp-admin/includes/class-wp-privacy-requests-table.php' );
|
||||
require_once( ABSPATH . 'wp-admin/includes/class-wp-privacy-data-export-requests-list-table.php' );
|
||||
require_once( ABSPATH . 'wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php' );
|
||||
|
@ -22,7 +22,7 @@
|
||||
function wp_ajax_nopriv_heartbeat() {
|
||||
$response = array();
|
||||
|
||||
// screen_id is the same as $current_screen->id and the JS global 'pagenow'.
|
||||
// 'screen_id' is the same as $current_screen->id and the JS global 'pagenow'.
|
||||
if ( ! empty( $_POST['screen_id'] ) ) {
|
||||
$screen_id = sanitize_key( $_POST['screen_id'] );
|
||||
} else {
|
||||
@ -272,23 +272,23 @@ function wp_ajax_autocomplete_user() {
|
||||
|
||||
$return = array();
|
||||
|
||||
// Check the type of request
|
||||
// Current allowed values are `add` and `search`
|
||||
// Check the type of request.
|
||||
// Current allowed values are `add` and `search`.
|
||||
if ( isset( $_REQUEST['autocomplete_type'] ) && 'search' === $_REQUEST['autocomplete_type'] ) {
|
||||
$type = $_REQUEST['autocomplete_type'];
|
||||
} else {
|
||||
$type = 'add';
|
||||
}
|
||||
|
||||
// Check the desired field for value
|
||||
// Current allowed values are `user_email` and `user_login`
|
||||
// Check the desired field for value.
|
||||
// Current allowed values are `user_email` and `user_login`.
|
||||
if ( isset( $_REQUEST['autocomplete_field'] ) && 'user_email' === $_REQUEST['autocomplete_field'] ) {
|
||||
$field = $_REQUEST['autocomplete_field'];
|
||||
} else {
|
||||
$field = 'user_login';
|
||||
}
|
||||
|
||||
// Exclude current users of this blog
|
||||
// Exclude current users of this blog.
|
||||
if ( isset( $_REQUEST['site_id'] ) ) {
|
||||
$id = absint( $_REQUEST['site_id'] );
|
||||
} else {
|
||||
@ -433,7 +433,7 @@ function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) {
|
||||
$page = isset( $_POST['_page'] ) ? (int) $_POST['_page'] : 0;
|
||||
$url = isset( $_POST['_url'] ) ? esc_url_raw( $_POST['_url'] ) : '';
|
||||
|
||||
// JS didn't send us everything we need to know. Just die with success message
|
||||
// JS didn't send us everything we need to know. Just die with success message.
|
||||
if ( ! $total || ! $per_page || ! $page || ! $url ) {
|
||||
$time = time();
|
||||
$comment = get_comment( $comment_id );
|
||||
@ -482,7 +482,7 @@ function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) {
|
||||
$total = 0;
|
||||
}
|
||||
|
||||
// Only do the expensive stuff on a page-break, and about 1 other time per page
|
||||
// Only do the expensive stuff on a page-break, and about 1 other time per page.
|
||||
if ( 0 == $total % $per_page || 1 == mt_rand( 1, $per_page ) ) {
|
||||
$post_id = 0;
|
||||
// What type of comment count are we looking for?
|
||||
@ -600,7 +600,7 @@ function _wp_ajax_add_hierarchical_term() {
|
||||
|
||||
$checked_categories[] = $cat_id;
|
||||
|
||||
if ( $parent ) { // Do these all at once in a second
|
||||
if ( $parent ) { // Do these all at once in a second.
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -626,11 +626,11 @@ function _wp_ajax_add_hierarchical_term() {
|
||||
);
|
||||
}
|
||||
|
||||
if ( $parent ) { // Foncy - replace the parent and all its children
|
||||
if ( $parent ) { // Foncy - replace the parent and all its children.
|
||||
$parent = get_term( $parent, $taxonomy->name );
|
||||
$term_id = $parent->term_id;
|
||||
|
||||
while ( $parent->parent ) { // get the top parent
|
||||
while ( $parent->parent ) { // Get the top parent.
|
||||
$parent = get_term( $parent->parent, $taxonomy->name );
|
||||
if ( is_wp_error( $parent ) ) {
|
||||
break;
|
||||
@ -716,7 +716,8 @@ function wp_ajax_delete_comment() {
|
||||
|
||||
$r = wp_untrash_comment( $comment );
|
||||
|
||||
if ( ! isset( $_POST['comment_status'] ) || $_POST['comment_status'] != 'trash' ) { // undo trash, not in trash
|
||||
// Undo trash, not in trash.
|
||||
if ( ! isset( $_POST['comment_status'] ) || $_POST['comment_status'] != 'trash' ) {
|
||||
$delta = 1;
|
||||
}
|
||||
} elseif ( isset( $_POST['spam'] ) && 1 == $_POST['spam'] ) {
|
||||
@ -732,7 +733,8 @@ function wp_ajax_delete_comment() {
|
||||
|
||||
$r = wp_unspam_comment( $comment );
|
||||
|
||||
if ( ! isset( $_POST['comment_status'] ) || $_POST['comment_status'] != 'spam' ) { // undo spam, not in spam
|
||||
// Undo spam, not in spam.
|
||||
if ( ! isset( $_POST['comment_status'] ) || $_POST['comment_status'] != 'spam' ) {
|
||||
$delta = 1;
|
||||
}
|
||||
} elseif ( isset( $_POST['delete'] ) && 1 == $_POST['delete'] ) {
|
||||
@ -741,7 +743,8 @@ function wp_ajax_delete_comment() {
|
||||
wp_die( -1 );
|
||||
}
|
||||
|
||||
if ( $r ) { // Decide if we need to send back '1' or a more complicated response including page links and comment counts
|
||||
if ( $r ) {
|
||||
// Decide if we need to send back '1' or a more complicated response including page links and comment counts.
|
||||
_wp_ajax_delete_comment_response( $comment->comment_ID, $delta );
|
||||
}
|
||||
|
||||
@ -989,7 +992,7 @@ function wp_ajax_dim_comment() {
|
||||
$x->send();
|
||||
}
|
||||
|
||||
// Decide if we need to send back '1' or a more complicated response including page links and comment counts
|
||||
// Decide if we need to send back '1' or a more complicated response including page links and comment counts.
|
||||
_wp_ajax_delete_comment_response( $comment->comment_ID );
|
||||
wp_die( 0 );
|
||||
}
|
||||
@ -1161,7 +1164,7 @@ function wp_ajax_get_tagcloud() {
|
||||
$tags[ $key ]->id = $tag->term_id;
|
||||
}
|
||||
|
||||
// We need raw tag names here, so don't filter the output
|
||||
// We need raw tag names here, so don't filter the output.
|
||||
$return = wp_generate_tag_cloud(
|
||||
$tags,
|
||||
array(
|
||||
@ -1288,8 +1291,8 @@ function wp_ajax_replyto_comment( $action ) {
|
||||
}
|
||||
|
||||
if ( wp_create_nonce( 'unfiltered-html-comment' ) != $_POST['_wp_unfiltered_html_comment'] ) {
|
||||
kses_remove_filters(); // start with a clean slate
|
||||
kses_init_filters(); // set up the filters
|
||||
kses_remove_filters(); // Start with a clean slate.
|
||||
kses_init_filters(); // Set up the filters.
|
||||
remove_filter( 'pre_comment_content', 'wp_filter_post_kses' );
|
||||
add_filter( 'pre_comment_content', 'wp_filter_kses' );
|
||||
}
|
||||
@ -1478,7 +1481,7 @@ function wp_ajax_add_menu_item() {
|
||||
$_menu_items = array_map( 'wp_setup_nav_menu_item', array( $_object ) );
|
||||
$_menu_item = reset( $_menu_items );
|
||||
|
||||
// Restore the missing menu item properties
|
||||
// Restore the missing menu item properties.
|
||||
$menu_item_data['menu-item-description'] = $_menu_item->description;
|
||||
}
|
||||
|
||||
@ -1498,7 +1501,7 @@ function wp_ajax_add_menu_item() {
|
||||
if ( ! empty( $menu_obj->ID ) ) {
|
||||
$menu_obj = wp_setup_nav_menu_item( $menu_obj );
|
||||
$menu_obj->title = empty( $menu_obj->title ) ? __( 'Menu Item' ) : $menu_obj->title;
|
||||
$menu_obj->label = $menu_obj->title; // don't show "(pending)" in ajax-added items
|
||||
$menu_obj->label = $menu_obj->title; // Don't show "(pending)" in ajax-added items.
|
||||
$menu_items[] = $menu_obj;
|
||||
}
|
||||
}
|
||||
@ -1548,7 +1551,7 @@ function wp_ajax_add_meta() {
|
||||
// If the post is an autodraft, save the post as a draft and then attempt to save the meta.
|
||||
if ( $post->post_status == 'auto-draft' ) {
|
||||
$post_data = array();
|
||||
$post_data['action'] = 'draft'; // Warning fix
|
||||
$post_data['action'] = 'draft'; // Warning fix.
|
||||
$post_data['post_ID'] = $pid;
|
||||
$post_data['post_type'] = $post->post_type;
|
||||
$post_data['post_status'] = 'draft';
|
||||
@ -1608,7 +1611,7 @@ function wp_ajax_add_meta() {
|
||||
$meta = get_metadata_by_mid( 'post', $mid );
|
||||
|
||||
if ( ! $meta ) {
|
||||
wp_die( 0 ); // if meta doesn't exist
|
||||
wp_die( 0 ); // If meta doesn't exist.
|
||||
}
|
||||
|
||||
if (
|
||||
@ -1731,7 +1734,8 @@ function wp_ajax_closed_postboxes() {
|
||||
}
|
||||
|
||||
if ( is_array( $hidden ) ) {
|
||||
$hidden = array_diff( $hidden, array( 'submitdiv', 'linksubmitdiv', 'manage-menu', 'create-menu' ) ); // postboxes that are always shown
|
||||
// Postboxes that are always shown.
|
||||
$hidden = array_diff( $hidden, array( 'submitdiv', 'linksubmitdiv', 'manage-menu', 'create-menu' ) );
|
||||
update_user_option( $user->ID, "metaboxhidden_$page", $hidden, true );
|
||||
}
|
||||
|
||||
@ -2620,7 +2624,7 @@ function wp_ajax_image_editor() {
|
||||
* @since 3.1.0
|
||||
*/
|
||||
function wp_ajax_set_post_thumbnail() {
|
||||
$json = ! empty( $_REQUEST['json'] ); // New-style request
|
||||
$json = ! empty( $_REQUEST['json'] ); // New-style request.
|
||||
|
||||
$post_ID = intval( $_POST['post_id'] );
|
||||
if ( ! current_user_can( 'edit_post', $post_ID ) ) {
|
||||
@ -3226,7 +3230,7 @@ function wp_ajax_send_attachment_to_editor() {
|
||||
$html = stripslashes_deep( $_POST['html'] );
|
||||
} else {
|
||||
$html = isset( $attachment['post_title'] ) ? $attachment['post_title'] : '';
|
||||
$rel = $rel ? ' rel="attachment wp-att-' . $id . '"' : ''; // Hard-coded string, $id is already sanitized
|
||||
$rel = $rel ? ' rel="attachment wp-att-' . $id . '"' : ''; // Hard-coded string, $id is already sanitized.
|
||||
|
||||
if ( ! empty( $url ) ) {
|
||||
$html = '<a href="' . esc_url( $url ) . '"' . $rel . '>' . $html . '</a>';
|
||||
@ -3287,7 +3291,7 @@ function wp_ajax_send_link_to_editor() {
|
||||
$fallback = $wp_embed->maybe_make_link( $src );
|
||||
|
||||
if ( $check_embed !== $fallback ) {
|
||||
// TinyMCE view for [embed] will parse this
|
||||
// TinyMCE view for [embed] will parse this.
|
||||
$html = '[embed]' . $src . '[/embed]';
|
||||
} elseif ( $link_text ) {
|
||||
$html = '<a href="' . esc_url( $src ) . '">' . $link_text . '</a>';
|
||||
@ -3327,7 +3331,7 @@ function wp_ajax_heartbeat() {
|
||||
$data = array();
|
||||
$nonce_state = wp_verify_nonce( $_POST['_nonce'], 'heartbeat-nonce' );
|
||||
|
||||
// screen_id is the same as $current_screen->id and the JS global 'pagenow'.
|
||||
// 'screen_id' is the same as $current_screen->id and the JS global 'pagenow'.
|
||||
if ( ! empty( $_POST['screen_id'] ) ) {
|
||||
$screen_id = sanitize_key( $_POST['screen_id'] );
|
||||
} else {
|
||||
@ -3392,7 +3396,7 @@ function wp_ajax_heartbeat() {
|
||||
*/
|
||||
do_action( 'heartbeat_tick', $response, $screen_id );
|
||||
|
||||
// Send the current time according to the server
|
||||
// Send the current time according to the server.
|
||||
$response['server_time'] = time();
|
||||
|
||||
wp_send_json( $response );
|
||||
@ -3735,7 +3739,7 @@ function wp_ajax_parse_media_shortcode() {
|
||||
$post = get_post( (int) $_POST['post_ID'] );
|
||||
}
|
||||
|
||||
// the embed shortcode requires a post
|
||||
// The embed shortcode requires a post.
|
||||
if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) {
|
||||
if ( 'embed' === $shortcode ) {
|
||||
wp_send_json_error();
|
||||
|
@ -41,8 +41,10 @@ class Automatic_Upgrader_Skin extends WP_Upgrader_Skin {
|
||||
if ( $context ) {
|
||||
$this->options['context'] = $context;
|
||||
}
|
||||
// TODO: fix up request_filesystem_credentials(), or split it, to allow us to request a no-output version
|
||||
// This will output a credentials form in event of failure, We don't want that, so just hide with a buffer
|
||||
/*
|
||||
* TODO: Fix up request_filesystem_credentials(), or split it, to allow us to request a no-output version.
|
||||
* This will output a credentials form in event of failure. We don't want that, so just hide with a buffer.
|
||||
*/
|
||||
ob_start();
|
||||
$result = parent::request_filesystem_credentials( $error, $context, $allow_relaxed_file_ownership );
|
||||
ob_end_clean();
|
||||
|
@ -115,7 +115,7 @@ class Core_Upgrader extends WP_Upgrader {
|
||||
$to_download = 'full';
|
||||
}
|
||||
|
||||
// Lock to prevent multiple Core Updates occurring
|
||||
// Lock to prevent multiple Core Updates occurring.
|
||||
$lock = WP_Upgrader::create_lock( 'core_updater', 15 * MINUTE_IN_SECONDS );
|
||||
if ( ! $lock ) {
|
||||
return new WP_Error( 'locked', $this->strings['locked'] );
|
||||
@ -220,7 +220,7 @@ class Core_Upgrader extends WP_Upgrader {
|
||||
)
|
||||
);
|
||||
|
||||
// Clear the current updates
|
||||
// Clear the current updates.
|
||||
delete_site_transient( 'update_core' );
|
||||
|
||||
if ( ! $parsed_args['do_rollback'] ) {
|
||||
@ -274,6 +274,7 @@ class Core_Upgrader extends WP_Upgrader {
|
||||
|
||||
$current_branch = implode( '.', array_slice( preg_split( '/[.-]/', $wp_version ), 0, 2 ) ); // x.y
|
||||
$new_branch = implode( '.', array_slice( preg_split( '/[.-]/', $offered_ver ), 0, 2 ) ); // x.y
|
||||
|
||||
$current_is_development_version = (bool) strpos( $wp_version, '-' );
|
||||
|
||||
// Defaults:
|
||||
@ -284,17 +285,17 @@ class Core_Upgrader extends WP_Upgrader {
|
||||
// WP_AUTO_UPDATE_CORE = true (all), 'minor', false.
|
||||
if ( defined( 'WP_AUTO_UPDATE_CORE' ) ) {
|
||||
if ( false === WP_AUTO_UPDATE_CORE ) {
|
||||
// Defaults to turned off, unless a filter allows it
|
||||
// Defaults to turned off, unless a filter allows it.
|
||||
$upgrade_dev = false;
|
||||
$upgrade_minor = false;
|
||||
$upgrade_major = false;
|
||||
} elseif ( true === WP_AUTO_UPDATE_CORE ) {
|
||||
// ALL updates for core
|
||||
// ALL updates for core.
|
||||
$upgrade_dev = true;
|
||||
$upgrade_minor = true;
|
||||
$upgrade_major = true;
|
||||
} elseif ( 'minor' === WP_AUTO_UPDATE_CORE ) {
|
||||
// Only minor updates for core
|
||||
// Only minor updates for core.
|
||||
$upgrade_dev = false;
|
||||
$upgrade_minor = true;
|
||||
$upgrade_major = false;
|
||||
@ -306,7 +307,7 @@ class Core_Upgrader extends WP_Upgrader {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 2: If we're running a newer version, that's a nope
|
||||
// 2: If we're running a newer version, that's a nope.
|
||||
if ( version_compare( $wp_version, $offered_ver, '>' ) ) {
|
||||
return false;
|
||||
}
|
||||
@ -323,15 +324,17 @@ class Core_Upgrader extends WP_Upgrader {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Cannot update if we're retrying the same A to B update that caused a non-critical failure.
|
||||
// Some non-critical failures do allow retries, like download_failed.
|
||||
// 3.7.1 => 3.7.2 resulted in files_not_writable, if we are still on 3.7.1 and still trying to update to 3.7.2.
|
||||
/*
|
||||
* Cannot update if we're retrying the same A to B update that caused a non-critical failure.
|
||||
* Some non-critical failures do allow retries, like download_failed.
|
||||
* 3.7.1 => 3.7.2 resulted in files_not_writable, if we are still on 3.7.1 and still trying to update to 3.7.2.
|
||||
*/
|
||||
if ( empty( $failure_data['retry'] ) && $wp_version == $failure_data['current'] && $offered_ver == $failure_data['attempted'] ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 3: 3.7-alpha-25000 -> 3.7-alpha-25678 -> 3.7-beta1 -> 3.7-beta2
|
||||
// 3: 3.7-alpha-25000 -> 3.7-alpha-25678 -> 3.7-beta1 -> 3.7-beta2.
|
||||
if ( $current_is_development_version ) {
|
||||
|
||||
/**
|
||||
@ -348,7 +351,7 @@ class Core_Upgrader extends WP_Upgrader {
|
||||
// Else fall through to minor + major branches below.
|
||||
}
|
||||
|
||||
// 4: Minor In-branch updates (3.7.0 -> 3.7.1 -> 3.7.2 -> 3.7.4)
|
||||
// 4: Minor in-branch updates (3.7.0 -> 3.7.1 -> 3.7.2 -> 3.7.4).
|
||||
if ( $current_branch == $new_branch ) {
|
||||
|
||||
/**
|
||||
@ -361,7 +364,7 @@ class Core_Upgrader extends WP_Upgrader {
|
||||
return apply_filters( 'allow_minor_auto_core_updates', $upgrade_minor );
|
||||
}
|
||||
|
||||
// 5: Major version updates (3.7.0 -> 3.8.0 -> 3.9.1)
|
||||
// 5: Major version updates (3.7.0 -> 3.8.0 -> 3.9.1).
|
||||
if ( version_compare( $new_branch, $current_branch, '>' ) ) {
|
||||
|
||||
/**
|
||||
@ -374,7 +377,7 @@ class Core_Upgrader extends WP_Upgrader {
|
||||
return apply_filters( 'allow_major_auto_core_updates', $upgrade_major );
|
||||
}
|
||||
|
||||
// If we're not sure, we don't want it
|
||||
// If we're not sure, we don't want it.
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -398,7 +401,7 @@ class Core_Upgrader extends WP_Upgrader {
|
||||
}
|
||||
|
||||
foreach ( $checksums as $file => $checksum ) {
|
||||
// Skip files which get updated
|
||||
// Skip files which get updated.
|
||||
if ( 'wp-content' == substr( $file, 0, 10 ) ) {
|
||||
continue;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ class Custom_Background {
|
||||
}
|
||||
|
||||
if ( isset( $_POST['remove-background'] ) ) {
|
||||
// @TODO: Uploaded files are not removed here.
|
||||
// @todo Uploaded files are not removed here.
|
||||
check_admin_referer( 'custom-background-remove', '_wpnonce-custom-background-remove' );
|
||||
set_theme_mod( 'background_image', '' );
|
||||
set_theme_mod( 'background_image_thumb', '' );
|
||||
@ -284,7 +284,7 @@ class Custom_Background {
|
||||
. " background-attachment: $background_attachment;";
|
||||
}
|
||||
?>
|
||||
<div id="custom-background-image" style="<?php echo $background_styles; ?>"><?php // must be double quote, see above ?>
|
||||
<div id="custom-background-image" style="<?php echo $background_styles; ?>"><?php // Must be double quote, see above. ?>
|
||||
<?php if ( $background_image_thumb ) { ?>
|
||||
<img class="custom-background-image" src="<?php echo $background_image_thumb; ?>" style="visibility:hidden;" alt="" /><br />
|
||||
<img class="custom-background-image" src="<?php echo $background_image_thumb; ?>" style="visibility:hidden;" alt="" />
|
||||
@ -503,7 +503,7 @@ class Custom_Background {
|
||||
$file = $file['file'];
|
||||
$filename = wp_basename( $file );
|
||||
|
||||
// Construct the object array
|
||||
// Construct the object array.
|
||||
$object = array(
|
||||
'post_title' => $filename,
|
||||
'post_content' => $url,
|
||||
@ -512,10 +512,10 @@ class Custom_Background {
|
||||
'context' => 'custom-background',
|
||||
);
|
||||
|
||||
// Save the data
|
||||
// Save the data.
|
||||
$id = wp_insert_attachment( $object, $file );
|
||||
|
||||
// Add the meta-data
|
||||
// Add the metadata.
|
||||
wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
|
||||
update_post_meta( $id, '_wp_attachment_is_custom_background', get_option( 'stylesheet' ) );
|
||||
|
||||
@ -525,7 +525,7 @@ class Custom_Background {
|
||||
set_theme_mod( 'background_image_thumb', esc_url_raw( $thumbnail[0] ) );
|
||||
|
||||
/** This action is documented in wp-admin/includes/class-custom-image-header.php */
|
||||
do_action( 'wp_create_file_in_uploads', $file, $id ); // For replication
|
||||
do_action( 'wp_create_file_in_uploads', $file, $id ); // For replication.
|
||||
$this->updated = true;
|
||||
}
|
||||
|
||||
|
@ -800,7 +800,7 @@ endif;
|
||||
}
|
||||
|
||||
$max_width = 0;
|
||||
// For flex, limit size of image displayed to 1500px unless theme says otherwise
|
||||
// For flex, limit size of image displayed to 1500px unless theme says otherwise.
|
||||
if ( current_theme_supports( 'custom-header', 'flex-width' ) ) {
|
||||
$max_width = 1500;
|
||||
}
|
||||
@ -810,10 +810,10 @@ endif;
|
||||
}
|
||||
$max_width = max( $max_width, get_theme_support( 'custom-header', 'width' ) );
|
||||
|
||||
// If flexible height isn't supported and the image is the exact right size
|
||||
// If flexible height isn't supported and the image is the exact right size.
|
||||
if ( ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' )
|
||||
&& $width == get_theme_support( 'custom-header', 'width' ) && $height == get_theme_support( 'custom-header', 'height' ) ) {
|
||||
// Add the meta-data
|
||||
// Add the metadata.
|
||||
if ( file_exists( $file ) ) {
|
||||
wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) );
|
||||
}
|
||||
@ -828,7 +828,7 @@ endif;
|
||||
* @param string $file Path to the file.
|
||||
* @param int $attachment_id Attachment ID.
|
||||
*/
|
||||
do_action( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication
|
||||
do_action( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication.
|
||||
|
||||
return $this->finished();
|
||||
} elseif ( $width > $max_width ) {
|
||||
@ -839,7 +839,7 @@ endif;
|
||||
}
|
||||
|
||||
/** This filter is documented in wp-admin/includes/class-custom-image-header.php */
|
||||
$image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication
|
||||
$image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication.
|
||||
|
||||
$url = str_replace( wp_basename( $url ), wp_basename( $image ), $url );
|
||||
$width = $width / $oitar;
|
||||
@ -910,7 +910,7 @@ endif;
|
||||
$file = $file['file'];
|
||||
$filename = wp_basename( $file );
|
||||
|
||||
// Construct the object array
|
||||
// Construct the object array.
|
||||
$object = array(
|
||||
'post_title' => $filename,
|
||||
'post_content' => $url,
|
||||
@ -919,7 +919,7 @@ endif;
|
||||
'context' => 'custom-header',
|
||||
);
|
||||
|
||||
// Save the data
|
||||
// Save the data.
|
||||
$attachment_id = wp_insert_attachment( $object, $file );
|
||||
return compact( 'attachment_id', 'file', 'filename', 'url', 'type' );
|
||||
}
|
||||
@ -982,7 +982,7 @@ endif;
|
||||
}
|
||||
|
||||
/** This filter is documented in wp-admin/includes/class-custom-image-header.php */
|
||||
$cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication
|
||||
$cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication.
|
||||
|
||||
$object = $this->create_attachment_object( $cropped, $attachment_id );
|
||||
|
||||
@ -990,7 +990,7 @@ endif;
|
||||
unset( $object['ID'] );
|
||||
}
|
||||
|
||||
// Update the attachment
|
||||
// Update the attachment.
|
||||
$attachment_id = $this->insert_attachment( $object, $cropped );
|
||||
|
||||
$url = wp_get_attachment_url( $attachment_id );
|
||||
@ -1180,7 +1180,7 @@ endif;
|
||||
'dst_width' => null,
|
||||
);
|
||||
|
||||
// For flex, limit size of image displayed to 1500px unless theme says otherwise
|
||||
// For flex, limit size of image displayed to 1500px unless theme says otherwise.
|
||||
if ( $has_flex_width ) {
|
||||
$max_width = 1500;
|
||||
}
|
||||
@ -1318,7 +1318,7 @@ endif;
|
||||
}
|
||||
|
||||
/** This filter is documented in wp-admin/includes/class-custom-image-header.php */
|
||||
$cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication
|
||||
$cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication.
|
||||
|
||||
$object = $this->create_attachment_object( $cropped, $attachment_id );
|
||||
|
||||
@ -1434,8 +1434,8 @@ endif;
|
||||
// Get the default image if there is one.
|
||||
$default = get_theme_support( 'custom-header', 'default-image' );
|
||||
|
||||
if ( ! $default ) { // If not,
|
||||
return $this->default_headers; // easy peasy.
|
||||
if ( ! $default ) { // If not, easy peasy.
|
||||
return $this->default_headers;
|
||||
}
|
||||
|
||||
$default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() );
|
||||
|
@ -56,7 +56,7 @@ class File_Upload_Upgrader {
|
||||
wp_die( __( 'Please select a file' ) );
|
||||
}
|
||||
|
||||
//Handle a newly uploaded file, Else assume it's already been uploaded
|
||||
// Handle a newly uploaded file. Else, assume it's already been uploaded.
|
||||
if ( ! empty( $_FILES ) ) {
|
||||
$overrides = array(
|
||||
'test_form' => false,
|
||||
@ -71,7 +71,7 @@ class File_Upload_Upgrader {
|
||||
$this->filename = $_FILES[ $form ]['name'];
|
||||
$this->package = $file['file'];
|
||||
|
||||
// Construct the object array
|
||||
// Construct the object array.
|
||||
$object = array(
|
||||
'post_title' => $this->filename,
|
||||
'post_content' => $file['url'],
|
||||
|
@ -192,7 +192,7 @@ class Language_Pack_Upgrader extends WP_Upgrader {
|
||||
$this->skin->feedback( 'starting_upgrade' );
|
||||
}
|
||||
|
||||
// Remove any existing upgrade filters from the plugin/theme upgraders #WP29425 & #WP29230
|
||||
// Remove any existing upgrade filters from the plugin/theme upgraders #WP29425 & #WP29230.
|
||||
remove_all_filters( 'upgrader_pre_install' );
|
||||
remove_all_filters( 'upgrader_clear_destination' );
|
||||
remove_all_filters( 'upgrader_post_install' );
|
||||
@ -202,7 +202,7 @@ class Language_Pack_Upgrader extends WP_Upgrader {
|
||||
|
||||
$this->skin->header();
|
||||
|
||||
// Connect to the Filesystem first.
|
||||
// Connect to the filesystem first.
|
||||
$res = $this->fs_connect( array( WP_CONTENT_DIR, WP_LANG_DIR ) );
|
||||
if ( ! $res ) {
|
||||
$this->skin->footer();
|
||||
@ -369,7 +369,7 @@ class Language_Pack_Upgrader extends WP_Upgrader {
|
||||
public function get_name_for_update( $update ) {
|
||||
switch ( $update->type ) {
|
||||
case 'core':
|
||||
return 'WordPress'; // Not translated
|
||||
return 'WordPress'; // Not translated.
|
||||
|
||||
case 'theme':
|
||||
$theme = wp_get_theme( $update->slug );
|
||||
|
@ -123,7 +123,7 @@ class Plugin_Upgrader extends WP_Upgrader {
|
||||
return $this->result;
|
||||
}
|
||||
|
||||
// Force refresh of plugin update information
|
||||
// Force refresh of plugin update information.
|
||||
wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
|
||||
|
||||
return true;
|
||||
@ -163,12 +163,13 @@ class Plugin_Upgrader extends WP_Upgrader {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the URL to the zip file
|
||||
// Get the URL to the zip file.
|
||||
$r = $current->response[ $plugin ];
|
||||
|
||||
add_filter( 'upgrader_pre_install', array( $this, 'deactivate_plugin_before_upgrade' ), 10, 2 );
|
||||
add_filter( 'upgrader_clear_destination', array( $this, 'delete_old_plugin' ), 10, 4 );
|
||||
//'source_selection' => array($this, 'source_selection'), //there's a trac ticket to move up the directory for zip's which are made a bit differently, useful for non-.org plugins.
|
||||
// There's a Trac ticket to move up the directory for zips which are made a bit differently, useful for non-.org plugins.
|
||||
// 'source_selection' => array( $this, 'source_selection' ),
|
||||
if ( $parsed_args['clear_update_cache'] ) {
|
||||
// Clear cache so wp_update_plugins() knows about the new plugin.
|
||||
add_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9, 0 );
|
||||
@ -197,7 +198,7 @@ class Plugin_Upgrader extends WP_Upgrader {
|
||||
return $this->result;
|
||||
}
|
||||
|
||||
// Force refresh of plugin update information
|
||||
// Force refresh of plugin update information.
|
||||
wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
|
||||
|
||||
return true;
|
||||
@ -234,7 +235,7 @@ class Plugin_Upgrader extends WP_Upgrader {
|
||||
|
||||
$this->skin->header();
|
||||
|
||||
// Connect to the Filesystem first.
|
||||
// Connect to the filesystem first.
|
||||
$res = $this->fs_connect( array( WP_CONTENT_DIR, WP_PLUGIN_DIR ) );
|
||||
if ( ! $res ) {
|
||||
$this->skin->footer();
|
||||
@ -247,7 +248,7 @@ class Plugin_Upgrader extends WP_Upgrader {
|
||||
* Only start maintenance mode if:
|
||||
* - running Multisite and there are one or more plugins specified, OR
|
||||
* - a plugin with an update available is currently active.
|
||||
* @TODO: For multisite, maintenance mode should only kick in for individual sites if at all possible.
|
||||
* @todo For multisite, maintenance mode should only kick in for individual sites if at all possible.
|
||||
*/
|
||||
$maintenance = ( is_multisite() && ! empty( $plugins ) );
|
||||
foreach ( $plugins as $plugin ) {
|
||||
@ -294,11 +295,11 @@ class Plugin_Upgrader extends WP_Upgrader {
|
||||
|
||||
$results[ $plugin ] = $this->result;
|
||||
|
||||
// Prevent credentials auth screen from displaying multiple times
|
||||
// Prevent credentials auth screen from displaying multiple times.
|
||||
if ( false === $result ) {
|
||||
break;
|
||||
}
|
||||
} //end foreach $plugins
|
||||
} // End foreach $plugins.
|
||||
|
||||
$this->maintenance_mode( false );
|
||||
|
||||
@ -353,7 +354,7 @@ class Plugin_Upgrader extends WP_Upgrader {
|
||||
return $source;
|
||||
}
|
||||
|
||||
// Check the folder contains at least 1 valid plugin.
|
||||
// Check that the folder contains at least 1 valid plugin.
|
||||
$plugins_found = false;
|
||||
$files = glob( $working_directory . '*.php' );
|
||||
if ( $files ) {
|
||||
@ -390,12 +391,14 @@ class Plugin_Upgrader extends WP_Upgrader {
|
||||
return false;
|
||||
}
|
||||
|
||||
$plugin = get_plugins( '/' . $this->result['destination_name'] ); //Ensure to pass with leading slash
|
||||
// Ensure to pass with leading slash.
|
||||
$plugin = get_plugins( '/' . $this->result['destination_name'] );
|
||||
if ( empty( $plugin ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$pluginfiles = array_keys( $plugin ); //Assume the requested plugin is the first in the list
|
||||
// Assume the requested plugin is the first in the list.
|
||||
$pluginfiles = array_keys( $plugin );
|
||||
|
||||
return $this->result['destination_name'] . '/' . $pluginfiles[0];
|
||||
}
|
||||
@ -418,7 +421,7 @@ class Plugin_Upgrader extends WP_Upgrader {
|
||||
return $return;
|
||||
}
|
||||
|
||||
// When in cron (background updates) don't deactivate the plugin, as we require a browser to reactivate it
|
||||
// When in cron (background updates) don't deactivate the plugin, as we require a browser to reactivate it.
|
||||
if ( wp_doing_cron() ) {
|
||||
return $return;
|
||||
}
|
||||
@ -472,7 +475,8 @@ class Plugin_Upgrader extends WP_Upgrader {
|
||||
}
|
||||
|
||||
// If plugin is in its own directory, recursively delete the directory.
|
||||
if ( strpos( $plugin, '/' ) && $this_plugin_dir != $plugins_dir ) { //base check on if plugin includes directory separator AND that it's not the root plugin folder
|
||||
// Base check on if plugin includes directory separator AND that it's not the root plugin folder.
|
||||
if ( strpos( $plugin, '/' ) && $this_plugin_dir != $plugins_dir ) {
|
||||
$deleted = $wp_filesystem->delete( $this_plugin_dir, true );
|
||||
} else {
|
||||
$deleted = $wp_filesystem->delete( $plugins_dir . $plugin );
|
||||
|
@ -94,7 +94,7 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||
* @return bool
|
||||
*/
|
||||
public function check_parent_theme_filter( $install_result, $hook_extra, $child_result ) {
|
||||
// Check to see if we need to install a parent theme
|
||||
// Check to see if we need to install a parent theme.
|
||||
$theme_info = $this->theme_info();
|
||||
|
||||
if ( ! $theme_info->parent() ) {
|
||||
@ -123,7 +123,7 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||
|
||||
if ( ! $api || is_wp_error( $api ) ) {
|
||||
$this->skin->feedback( 'parent_theme_not_found', $theme_info->get( 'Template' ) );
|
||||
// Don't show activate or preview actions after installation
|
||||
// Don't show activate or preview actions after installation.
|
||||
add_filter( 'install_theme_complete_actions', array( $this, 'hide_activate_preview_actions' ) );
|
||||
return $install_result;
|
||||
}
|
||||
@ -132,15 +132,16 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||
$child_api = $this->skin->api;
|
||||
$child_success_message = $this->strings['process_success'];
|
||||
|
||||
// Override them
|
||||
// Override them.
|
||||
$this->skin->api = $api;
|
||||
|
||||
$this->strings['process_success_specific'] = $this->strings['parent_theme_install_success']; //, $api->name, $api->version );
|
||||
|
||||
$this->skin->feedback( 'parent_theme_prepare_install', $api->name, $api->version );
|
||||
|
||||
add_filter( 'install_theme_complete_actions', '__return_false', 999 ); // Don't show any actions after installing the theme.
|
||||
|
||||
// Install the parent theme
|
||||
// Install the parent theme.
|
||||
$parent_result = $this->run(
|
||||
array(
|
||||
'package' => $api->download_link,
|
||||
@ -154,10 +155,10 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||
add_filter( 'install_theme_complete_actions', array( $this, 'hide_activate_preview_actions' ) );
|
||||
}
|
||||
|
||||
// Start cleaning up after the parents installation
|
||||
// Start cleaning up after the parent's installation.
|
||||
remove_filter( 'install_theme_complete_actions', '__return_false', 999 );
|
||||
|
||||
// Reset child's result and data
|
||||
// Reset child's result and data.
|
||||
$this->result = $child_result;
|
||||
$this->skin->api = $child_api;
|
||||
$this->strings['process_success'] = $child_success_message;
|
||||
@ -236,7 +237,7 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||
return $this->result;
|
||||
}
|
||||
|
||||
// Refresh the Theme Update information
|
||||
// Refresh the Theme Update information.
|
||||
wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
|
||||
|
||||
return true;
|
||||
@ -349,7 +350,7 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||
|
||||
$this->skin->header();
|
||||
|
||||
// Connect to the Filesystem first.
|
||||
// Connect to the filesystem first.
|
||||
$res = $this->fs_connect( array( WP_CONTENT_DIR ) );
|
||||
if ( ! $res ) {
|
||||
$this->skin->footer();
|
||||
@ -358,10 +359,12 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||
|
||||
$this->skin->bulk_header();
|
||||
|
||||
// Only start maintenance mode if:
|
||||
// - running Multisite and there are one or more themes specified, OR
|
||||
// - a theme with an update available is currently in use.
|
||||
// @TODO: For multisite, maintenance mode should only kick in for individual sites if at all possible.
|
||||
/*
|
||||
* Only start maintenance mode if:
|
||||
* - running Multisite and there are one or more themes specified, OR
|
||||
* - a theme with an update available is currently in use.
|
||||
* @todo For multisite, maintenance mode should only kick in for individual sites if at all possible.
|
||||
*/
|
||||
$maintenance = ( is_multisite() && ! empty( $themes ) );
|
||||
foreach ( $themes as $theme ) {
|
||||
$maintenance = $maintenance || $theme == get_stylesheet() || $theme == get_template();
|
||||
@ -388,7 +391,7 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get the URL to the zip file
|
||||
// Get the URL to the zip file.
|
||||
$r = $current->response[ $theme ];
|
||||
|
||||
$result = $this->run(
|
||||
@ -406,15 +409,15 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||
|
||||
$results[ $theme ] = $this->result;
|
||||
|
||||
// Prevent credentials auth screen from displaying multiple times
|
||||
// Prevent credentials auth screen from displaying multiple times.
|
||||
if ( false === $result ) {
|
||||
break;
|
||||
}
|
||||
} //end foreach $plugins
|
||||
} // End foreach $themes.
|
||||
|
||||
$this->maintenance_mode( false );
|
||||
|
||||
// Refresh the Theme Update information
|
||||
// Refresh the Theme Update information.
|
||||
wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
|
||||
|
||||
/** This action is documented in wp-admin/includes/class-wp-upgrader.php */
|
||||
@ -462,13 +465,13 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||
return $source;
|
||||
}
|
||||
|
||||
// Check the folder contains a valid theme
|
||||
// Check that the folder contains a valid theme.
|
||||
$working_directory = str_replace( $wp_filesystem->wp_content_dir(), trailingslashit( WP_CONTENT_DIR ), $source );
|
||||
if ( ! is_dir( $working_directory ) ) { // Sanity check, if the above fails, let's not prevent installation.
|
||||
return $source;
|
||||
}
|
||||
|
||||
// A proper archive should have a style.css file in the single subdirectory
|
||||
// A proper archive should have a style.css file in the single subdirectory.
|
||||
if ( ! file_exists( $working_directory . 'style.css' ) ) {
|
||||
return new WP_Error(
|
||||
'incompatible_archive_theme_no_style',
|
||||
@ -536,9 +539,10 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||
|
||||
$theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
|
||||
|
||||
if ( $theme != get_stylesheet() ) { //If not current
|
||||
if ( $theme != get_stylesheet() ) { // If not current.
|
||||
return $return;
|
||||
}
|
||||
|
||||
// Change to maintenance mode now.
|
||||
if ( ! $this->bulk ) {
|
||||
$this->maintenance_mode( true );
|
||||
@ -566,7 +570,7 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||
|
||||
$theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
|
||||
|
||||
if ( $theme != get_stylesheet() ) { // If not current
|
||||
if ( $theme != get_stylesheet() ) { // If not current.
|
||||
return $return;
|
||||
}
|
||||
|
||||
@ -577,7 +581,7 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||
switch_theme( $stylesheet );
|
||||
}
|
||||
|
||||
//Time to remove maintenance mode
|
||||
// Time to remove maintenance mode.
|
||||
if ( ! $this->bulk ) {
|
||||
$this->maintenance_mode( false );
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ class Walker_Category_Checklist extends Walker {
|
||||
public $db_fields = array(
|
||||
'parent' => 'parent',
|
||||
'id' => 'term_id',
|
||||
); //TODO: decouple this
|
||||
); // TODO: Decouple this.
|
||||
|
||||
/**
|
||||
* Starts the list before the elements are added.
|
||||
|
@ -106,7 +106,7 @@ class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu {
|
||||
|
||||
$output .= '</label>';
|
||||
|
||||
// Menu item hidden fields
|
||||
// Menu item hidden fields.
|
||||
$output .= '<input type="hidden" class="menu-item-db-id" name="menu-item[' . $possible_object_id . '][menu-item-db-id]" value="' . $possible_db_id . '" />';
|
||||
$output .= '<input type="hidden" class="menu-item-object" name="menu-item[' . $possible_object_id . '][menu-item-object]" value="' . esc_attr( $item->object ) . '" />';
|
||||
$output .= '<input type="hidden" class="menu-item-parent-id" name="menu-item[' . $possible_object_id . '][menu-item-parent-id]" value="' . esc_attr( $item->menu_item_parent ) . '" />';
|
||||
@ -119,4 +119,4 @@ class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu {
|
||||
$output .= '<input type="hidden" class="menu-item-xfn" name="menu-item[' . $possible_object_id . '][menu-item-xfn]" value="' . esc_attr( $item->xfn ) . '" />';
|
||||
}
|
||||
|
||||
} // Walker_Nav_Menu_Checklist
|
||||
}
|
||||
|
@ -295,4 +295,4 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
|
||||
$output .= ob_get_clean();
|
||||
}
|
||||
|
||||
} // Walker_Nav_Menu_Edit
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ class WP_Automatic_Updater {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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;
|
||||
if ( 'core' == $type && isset( $item->new_files ) && ! $item->new_files ) {
|
||||
$allow_relaxed_file_ownership = true;
|
||||
@ -283,7 +283,7 @@ class WP_Automatic_Updater {
|
||||
break;
|
||||
case 'plugin':
|
||||
$upgrader = new Plugin_Upgrader( $skin );
|
||||
$context = WP_PLUGIN_DIR; // We don't support custom Plugin directories, or updates for WPMU_PLUGIN_DIR
|
||||
$context = WP_PLUGIN_DIR; // We don't support custom Plugin directories, or updates for WPMU_PLUGIN_DIR.
|
||||
break;
|
||||
case 'theme':
|
||||
$upgrader = new Theme_Upgrader( $skin );
|
||||
@ -357,7 +357,7 @@ class WP_Automatic_Updater {
|
||||
'pre_check_md5' => false,
|
||||
// Only available for core updates.
|
||||
'attempt_rollback' => true,
|
||||
// Allow relaxed file ownership in some scenarios
|
||||
// Allow relaxed file ownership in some scenarios.
|
||||
'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership,
|
||||
)
|
||||
);
|
||||
@ -409,51 +409,51 @@ class WP_Automatic_Updater {
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't automatically run these thins, as we'll handle it ourselves
|
||||
// Don't automatically run these things, as we'll handle it ourselves.
|
||||
remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
|
||||
remove_action( 'upgrader_process_complete', 'wp_version_check' );
|
||||
remove_action( 'upgrader_process_complete', 'wp_update_plugins' );
|
||||
remove_action( 'upgrader_process_complete', 'wp_update_themes' );
|
||||
|
||||
// Next, Plugins
|
||||
wp_update_plugins(); // Check for Plugin updates
|
||||
// Next, plugins.
|
||||
wp_update_plugins(); // Check for plugin updates.
|
||||
$plugin_updates = get_site_transient( 'update_plugins' );
|
||||
if ( $plugin_updates && ! empty( $plugin_updates->response ) ) {
|
||||
foreach ( $plugin_updates->response as $plugin ) {
|
||||
$this->update( 'plugin', $plugin );
|
||||
}
|
||||
// Force refresh of plugin update information
|
||||
// Force refresh of plugin update information.
|
||||
wp_clean_plugins_cache();
|
||||
}
|
||||
|
||||
// Next, those themes we all love
|
||||
wp_update_themes(); // Check for Theme updates
|
||||
// Next, those themes we all love.
|
||||
wp_update_themes(); // Check for theme updates.
|
||||
$theme_updates = get_site_transient( 'update_themes' );
|
||||
if ( $theme_updates && ! empty( $theme_updates->response ) ) {
|
||||
foreach ( $theme_updates->response as $theme ) {
|
||||
$this->update( 'theme', (object) $theme );
|
||||
}
|
||||
// Force refresh of theme update information
|
||||
// Force refresh of theme update information.
|
||||
wp_clean_themes_cache();
|
||||
}
|
||||
|
||||
// Next, Process any core update
|
||||
wp_version_check(); // Check for Core updates
|
||||
// Next, process any core update.
|
||||
wp_version_check(); // Check for core updates.
|
||||
$core_update = find_core_auto_update();
|
||||
|
||||
if ( $core_update ) {
|
||||
$this->update( 'core', $core_update );
|
||||
}
|
||||
|
||||
// Clean up, and check for any pending translations
|
||||
// (Core_Upgrader checks for core updates)
|
||||
// Clean up, and check for any pending translations.
|
||||
// (Core_Upgrader checks for core updates.)
|
||||
$theme_stats = array();
|
||||
if ( isset( $this->update_results['theme'] ) ) {
|
||||
foreach ( $this->update_results['theme'] as $upgrade ) {
|
||||
$theme_stats[ $upgrade->item->theme ] = ( true === $upgrade->result );
|
||||
}
|
||||
}
|
||||
wp_update_themes( $theme_stats ); // Check for Theme updates
|
||||
wp_update_themes( $theme_stats ); // Check for theme updates.
|
||||
|
||||
$plugin_stats = array();
|
||||
if ( isset( $this->update_results['plugin'] ) ) {
|
||||
@ -461,21 +461,21 @@ class WP_Automatic_Updater {
|
||||
$plugin_stats[ $upgrade->item->plugin ] = ( true === $upgrade->result );
|
||||
}
|
||||
}
|
||||
wp_update_plugins( $plugin_stats ); // Check for Plugin updates
|
||||
wp_update_plugins( $plugin_stats ); // Check for plugin updates.
|
||||
|
||||
// Finally, Process any new translations
|
||||
// Finally, process any new translations.
|
||||
$language_updates = wp_get_translation_updates();
|
||||
if ( $language_updates ) {
|
||||
foreach ( $language_updates as $update ) {
|
||||
$this->update( 'translation', $update );
|
||||
}
|
||||
|
||||
// Clear existing caches
|
||||
// Clear existing caches.
|
||||
wp_clean_update_cache();
|
||||
|
||||
wp_version_check(); // check for Core updates
|
||||
wp_update_themes(); // Check for Theme updates
|
||||
wp_update_plugins(); // Check for Plugin updates
|
||||
wp_version_check(); // Check for core updates.
|
||||
wp_update_themes(); // Check for theme updates.
|
||||
wp_update_plugins(); // Check for plugin updates.
|
||||
}
|
||||
|
||||
// Send debugging email to admin for all development installations.
|
||||
@ -626,7 +626,7 @@ class WP_Automatic_Updater {
|
||||
);
|
||||
|
||||
$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 ) {
|
||||
$next_user_core_update = $core_update;
|
||||
}
|
||||
@ -860,7 +860,7 @@ class WP_Automatic_Updater {
|
||||
/* translators: %s: Network home URL. */
|
||||
$body[] = sprintf( __( 'WordPress site: %s' ), network_home_url( '/' ) );
|
||||
|
||||
// Core
|
||||
// Core.
|
||||
if ( isset( $this->update_results['core'] ) ) {
|
||||
$result = $this->update_results['core'][0];
|
||||
if ( $result->result && ! is_wp_error( $result->result ) ) {
|
||||
@ -874,7 +874,7 @@ class WP_Automatic_Updater {
|
||||
$body[] = '';
|
||||
}
|
||||
|
||||
// Plugins, Themes, Translations
|
||||
// Plugins, Themes, Translations.
|
||||
foreach ( array( 'plugin', 'theme', 'translation' ) as $type ) {
|
||||
if ( ! isset( $this->update_results[ $type ] ) ) {
|
||||
continue;
|
||||
@ -894,7 +894,7 @@ class WP_Automatic_Updater {
|
||||
}
|
||||
}
|
||||
if ( $success_items != $this->update_results[ $type ] ) {
|
||||
// Failed updates
|
||||
// Failed updates.
|
||||
$messages = array(
|
||||
'plugin' => __( 'The following plugins failed to update:' ),
|
||||
'theme' => __( 'The following themes failed to update:' ),
|
||||
|
@ -100,7 +100,7 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||
if ( isset( $_REQUEST['number'] ) ) {
|
||||
$number = (int) $_REQUEST['number'];
|
||||
} else {
|
||||
$number = $comments_per_page + min( 8, $comments_per_page ); // Grab a few extra
|
||||
$number = $comments_per_page + min( 8, $comments_per_page ); // Grab a few extra.
|
||||
}
|
||||
|
||||
$page = $this->get_pagenum();
|
||||
@ -222,7 +222,7 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||
'All <span class="count">(%s)</span>',
|
||||
'All <span class="count">(%s)</span>',
|
||||
'comments'
|
||||
), // singular not used
|
||||
), // Singular not used.
|
||||
|
||||
/* translators: %s: Number of comments. */
|
||||
'mine' => _nx_noop(
|
||||
@ -746,7 +746,7 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||
++$i;
|
||||
( ( ( 'approve' === $action || 'unapprove' === $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
|
||||
|
||||
// Reply and quickedit need a hide-if-no-js span when not added with ajax
|
||||
// Reply and quickedit need a hide-if-no-js span when not added with ajax.
|
||||
if ( ( 'reply' === $action || 'quickedit' === $action ) && ! wp_doing_ajax() ) {
|
||||
$action .= ' hide-if-no-js';
|
||||
} elseif ( ( $action === 'untrash' && $the_comment_status === 'trash' ) || ( $action === 'unspam' && $the_comment_status === 'spam' ) ) {
|
||||
|
@ -92,7 +92,7 @@ class WP_Community_Events {
|
||||
return $cached_events;
|
||||
}
|
||||
|
||||
// include an unmodified $wp_version
|
||||
// Include an unmodified $wp_version.
|
||||
include( ABSPATH . WPINC . '/version.php' );
|
||||
|
||||
$api_url = 'http://api.wordpress.org/events/1.0/';
|
||||
|
@ -580,7 +580,7 @@ class WP_Debug_Data {
|
||||
|
||||
if ( function_exists( 'phpversion' ) ) {
|
||||
$php_version_debug = phpversion();
|
||||
// Whether PHP supports 64bit
|
||||
// Whether PHP supports 64-bit.
|
||||
$php64bit = ( PHP_INT_SIZE * 8 === 64 );
|
||||
|
||||
$php_version = sprintf(
|
||||
@ -677,7 +677,7 @@ class WP_Debug_Data {
|
||||
);
|
||||
}
|
||||
|
||||
// SUHOSIN
|
||||
// SUHOSIN.
|
||||
$suhosin_loaded = ( extension_loaded( 'suhosin' ) || ( defined( 'SUHOSIN_PATCH' ) && constant( 'SUHOSIN_PATCH' ) ) );
|
||||
|
||||
$info['wp-server']['fields']['suhosin'] = array(
|
||||
@ -686,7 +686,7 @@ class WP_Debug_Data {
|
||||
'debug' => $suhosin_loaded,
|
||||
);
|
||||
|
||||
// Imagick
|
||||
// Imagick.
|
||||
$imagick_loaded = extension_loaded( 'imagick' );
|
||||
|
||||
$info['wp-server']['fields']['imagick_availability'] = array(
|
||||
@ -1012,7 +1012,7 @@ class WP_Debug_Data {
|
||||
$theme_version = $theme->version;
|
||||
$theme_author = $theme->author;
|
||||
|
||||
// Sanitize
|
||||
// Sanitize.
|
||||
$theme_author = wp_kses( $theme_author, array() );
|
||||
|
||||
$theme_version_string = __( 'No version or author information is available.' );
|
||||
@ -1054,7 +1054,7 @@ class WP_Debug_Data {
|
||||
);
|
||||
}
|
||||
|
||||
// Add more filesystem checks
|
||||
// Add more filesystem checks.
|
||||
if ( defined( 'WPMU_PLUGIN_DIR' ) && is_dir( WPMU_PLUGIN_DIR ) ) {
|
||||
$is_writable_wpmu_plugin_dir = wp_is_writable( WPMU_PLUGIN_DIR );
|
||||
|
||||
|
@ -55,7 +55,8 @@ class WP_Filesystem_Base {
|
||||
*/
|
||||
public function abspath() {
|
||||
$folder = $this->find_folder( ABSPATH );
|
||||
// Perhaps the FTP folder is rooted at the WordPress install, Check for wp-includes folder in root, Could have some false positives, but rare.
|
||||
// Perhaps the FTP folder is rooted at the WordPress install.
|
||||
// Check for wp-includes folder in root. Could have some false positives, but rare.
|
||||
if ( ! $folder && $this->is_dir( '/' . WPINC ) ) {
|
||||
$folder = '/';
|
||||
}
|
||||
@ -96,7 +97,7 @@ class WP_Filesystem_Base {
|
||||
public function wp_themes_dir( $theme = false ) {
|
||||
$theme_root = get_theme_root( $theme );
|
||||
|
||||
// Account for relative theme roots
|
||||
// Account for relative theme roots.
|
||||
if ( '/themes' == $theme_root || ! is_dir( $theme_root ) ) {
|
||||
$theme_root = WP_CONTENT_DIR . $theme_root;
|
||||
}
|
||||
@ -182,7 +183,7 @@ class WP_Filesystem_Base {
|
||||
'FTP_LANG_DIR' => WP_LANG_DIR,
|
||||
);
|
||||
|
||||
// Direct matches ( folder = CONSTANT/ )
|
||||
// Direct matches ( folder = CONSTANT/ ).
|
||||
foreach ( $constant_overrides as $constant => $dir ) {
|
||||
if ( ! defined( $constant ) ) {
|
||||
continue;
|
||||
@ -192,12 +193,12 @@ class WP_Filesystem_Base {
|
||||
}
|
||||
}
|
||||
|
||||
// Prefix Matches ( folder = CONSTANT/subdir )
|
||||
// Prefix matches ( folder = CONSTANT/subdir ),
|
||||
foreach ( $constant_overrides as $constant => $dir ) {
|
||||
if ( ! defined( $constant ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( 0 === stripos( $folder, $dir ) ) { // $folder starts with $dir
|
||||
if ( 0 === stripos( $folder, $dir ) ) { // $folder starts with $dir.
|
||||
$potential_folder = preg_replace( '#^' . preg_quote( $dir, '#' ) . '/#i', trailingslashit( constant( $constant ) ), $folder );
|
||||
$potential_folder = trailingslashit( $potential_folder );
|
||||
|
||||
@ -208,12 +209,12 @@ class WP_Filesystem_Base {
|
||||
}
|
||||
}
|
||||
} elseif ( 'direct' == $this->method ) {
|
||||
$folder = str_replace( '\\', '/', $folder ); // Windows path sanitisation
|
||||
$folder = str_replace( '\\', '/', $folder ); // Windows path sanitisation.
|
||||
return trailingslashit( $folder );
|
||||
}
|
||||
|
||||
$folder = preg_replace( '|^([a-z]{1}):|i', '', $folder ); // Strip out windows drive letter if it's there.
|
||||
$folder = str_replace( '\\', '/', $folder ); // Windows path sanitisation
|
||||
$folder = preg_replace( '|^([a-z]{1}):|i', '', $folder ); // Strip out Windows drive letter if it's there.
|
||||
$folder = str_replace( '\\', '/', $folder ); // Windows path sanitisation.
|
||||
|
||||
if ( isset( $this->cache[ $folder ] ) ) {
|
||||
return $this->cache[ $folder ];
|
||||
@ -240,7 +241,7 @@ class WP_Filesystem_Base {
|
||||
*
|
||||
* @param string $folder The folder to locate.
|
||||
* @param string $base The folder to start searching from.
|
||||
* @param bool $loop If the function has recursed, Internal use only.
|
||||
* @param bool $loop If the function has recursed. Internal use only.
|
||||
* @return string|false The location of the remote path, false to cease looping.
|
||||
*/
|
||||
public function search_for_folder( $folder, $base = '.', $loop = false ) {
|
||||
@ -303,7 +304,7 @@ class WP_Filesystem_Base {
|
||||
}
|
||||
|
||||
// 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 ) {
|
||||
return false;
|
||||
}
|
||||
@ -328,39 +329,39 @@ class WP_Filesystem_Base {
|
||||
*/
|
||||
public function gethchmod( $file ) {
|
||||
$perms = intval( $this->getchmod( $file ), 8 );
|
||||
if ( ( $perms & 0xC000 ) == 0xC000 ) { // Socket
|
||||
if ( ( $perms & 0xC000 ) == 0xC000 ) { // Socket.
|
||||
$info = 's';
|
||||
} elseif ( ( $perms & 0xA000 ) == 0xA000 ) { // Symbolic Link
|
||||
} elseif ( ( $perms & 0xA000 ) == 0xA000 ) { // Symbolic Link.
|
||||
$info = 'l';
|
||||
} elseif ( ( $perms & 0x8000 ) == 0x8000 ) { // Regular
|
||||
} elseif ( ( $perms & 0x8000 ) == 0x8000 ) { // Regular.
|
||||
$info = '-';
|
||||
} elseif ( ( $perms & 0x6000 ) == 0x6000 ) { // Block special
|
||||
} elseif ( ( $perms & 0x6000 ) == 0x6000 ) { // Block special.
|
||||
$info = 'b';
|
||||
} elseif ( ( $perms & 0x4000 ) == 0x4000 ) { // Directory
|
||||
} elseif ( ( $perms & 0x4000 ) == 0x4000 ) { // Directory.
|
||||
$info = 'd';
|
||||
} elseif ( ( $perms & 0x2000 ) == 0x2000 ) { // Character special
|
||||
} elseif ( ( $perms & 0x2000 ) == 0x2000 ) { // Character special.
|
||||
$info = 'c';
|
||||
} elseif ( ( $perms & 0x1000 ) == 0x1000 ) { // FIFO pipe
|
||||
} elseif ( ( $perms & 0x1000 ) == 0x1000 ) { // FIFO pipe.
|
||||
$info = 'p';
|
||||
} else { // Unknown
|
||||
} else { // Unknown.
|
||||
$info = 'u';
|
||||
}
|
||||
|
||||
// Owner
|
||||
// Owner.
|
||||
$info .= ( ( $perms & 0x0100 ) ? 'r' : '-' );
|
||||
$info .= ( ( $perms & 0x0080 ) ? 'w' : '-' );
|
||||
$info .= ( ( $perms & 0x0040 ) ?
|
||||
( ( $perms & 0x0800 ) ? 's' : 'x' ) :
|
||||
( ( $perms & 0x0800 ) ? 'S' : '-' ) );
|
||||
|
||||
// Group
|
||||
// Group.
|
||||
$info .= ( ( $perms & 0x0020 ) ? 'r' : '-' );
|
||||
$info .= ( ( $perms & 0x0010 ) ? 'w' : '-' );
|
||||
$info .= ( ( $perms & 0x0008 ) ?
|
||||
( ( $perms & 0x0400 ) ? 's' : 'x' ) :
|
||||
( ( $perms & 0x0400 ) ? 'S' : '-' ) );
|
||||
|
||||
// World
|
||||
// World.
|
||||
$info .= ( ( $perms & 0x0004 ) ? 'r' : '-' );
|
||||
$info .= ( ( $perms & 0x0002 ) ? 'w' : '-' );
|
||||
$info .= ( ( $perms & 0x0001 ) ?
|
||||
@ -827,4 +828,4 @@ class WP_Filesystem_Base {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // WP_Filesystem_Base
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||
if ( ! $this->is_dir( $file ) ) {
|
||||
return chgrp( $file, $group );
|
||||
}
|
||||
// Is a directory, and we want recursive
|
||||
// Is a directory, and we want recursive.
|
||||
$file = trailingslashit( $file );
|
||||
$filelist = $this->dirlist( $file );
|
||||
foreach ( $filelist as $filename ) {
|
||||
@ -167,7 +167,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||
if ( ! $recursive || ! $this->is_dir( $file ) ) {
|
||||
return chmod( $file, $mode );
|
||||
}
|
||||
// Is a directory, and we want recursive
|
||||
// Is a directory, and we want recursive.
|
||||
$file = trailingslashit( $file );
|
||||
$filelist = $this->dirlist( $file );
|
||||
foreach ( (array) $filelist as $filename => $filemeta ) {
|
||||
@ -198,7 +198,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||
if ( ! $this->is_dir( $file ) ) {
|
||||
return chown( $file, $owner );
|
||||
}
|
||||
// Is a directory, and we want recursive
|
||||
// Is a directory, and we want recursive.
|
||||
$filelist = $this->dirlist( $file );
|
||||
foreach ( $filelist as $filename ) {
|
||||
$this->chown( $file . '/' . $filename, $owner, $recursive );
|
||||
@ -327,10 +327,11 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
public function delete( $file, $recursive = false, $type = false ) {
|
||||
if ( empty( $file ) ) { // Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem.
|
||||
if ( empty( $file ) ) {
|
||||
// Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem.
|
||||
return false;
|
||||
}
|
||||
$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 ) ) {
|
||||
return @unlink( $file );
|
||||
@ -339,7 +340,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||
return @rmdir( $file );
|
||||
}
|
||||
|
||||
// At this point it's a folder, and we're in recursive mode
|
||||
// At this point it's a folder, and we're in recursive mode.
|
||||
$file = trailingslashit( $file );
|
||||
$filelist = $this->dirlist( $file, true );
|
||||
|
||||
|
@ -38,8 +38,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
||||
return;
|
||||
}
|
||||
|
||||
// This Class uses the timeout on a per-connection basis, Others use it on a per-action basis.
|
||||
|
||||
// This class uses the timeout on a per-connection basis, others use it on a per-action basis.
|
||||
if ( ! defined( 'FS_TIMEOUT' ) ) {
|
||||
define( 'FS_TIMEOUT', 240 );
|
||||
}
|
||||
@ -113,7 +112,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set the Connection to use Passive FTP
|
||||
// Set the connection to use Passive FTP.
|
||||
ftp_pasv( $this->link, true );
|
||||
if ( @ftp_get_option( $this->link, FTP_TIMEOUT_SEC ) < FS_TIMEOUT ) {
|
||||
@ftp_set_option( $this->link, FTP_TIMEOUT_SEC, FS_TIMEOUT );
|
||||
@ -146,7 +145,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
||||
return false;
|
||||
}
|
||||
|
||||
fseek( $temp, 0 ); // Skip back to the start of the file being written to
|
||||
fseek( $temp, 0 ); // Skip back to the start of the file being written to.
|
||||
$contents = '';
|
||||
|
||||
while ( ! feof( $temp ) ) {
|
||||
@ -203,7 +202,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
||||
return false;
|
||||
}
|
||||
|
||||
fseek( $temp, 0 ); // Skip back to the start of the file being written to
|
||||
fseek( $temp, 0 ); // Skip back to the start of the file being written to.
|
||||
|
||||
$ret = ftp_fput( $this->link, $file, $temp, FTP_BINARY );
|
||||
|
||||
@ -273,7 +272,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
||||
}
|
||||
}
|
||||
|
||||
// chmod the file or directory
|
||||
// chmod the file or directory.
|
||||
if ( ! function_exists( 'ftp_chmod' ) ) {
|
||||
return (bool) ftp_site( $this->link, sprintf( 'CHMOD %o %s', $mode, $file ) );
|
||||
}
|
||||
@ -405,7 +404,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
||||
return true; // File is an empty directory.
|
||||
}
|
||||
|
||||
return ! empty( $list ); //empty list = no file, so invert.
|
||||
return ! empty( $list ); // Empty list = no file, so invert.
|
||||
}
|
||||
|
||||
/**
|
||||
@ -573,7 +572,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
||||
if ( $lucifer[3] < 70 ) {
|
||||
$lucifer[3] += 2000;
|
||||
} else {
|
||||
$lucifer[3] += 1900; // 4digit year fix
|
||||
$lucifer[3] += 1900; // 4-digit year fix.
|
||||
}
|
||||
$b['isdir'] = ( $lucifer[7] == '<DIR>' );
|
||||
if ( $b['isdir'] ) {
|
||||
@ -637,7 +636,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
||||
}
|
||||
}
|
||||
|
||||
// Replace symlinks formatted as "source -> target" with just the source name
|
||||
// Replace symlinks formatted as "source -> target" with just the source name.
|
||||
if ( isset( $b['islink'] ) && $b['islink'] ) {
|
||||
$b['name'] = preg_replace( '/(\s*->\s*.*)$/', '', $b['name'] );
|
||||
}
|
||||
|
@ -150,12 +150,12 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
||||
|
||||
reset_mbstring_encoding();
|
||||
|
||||
return ''; // Blank document, File does exist, It's just blank.
|
||||
return ''; // Blank document. File does exist, it's just blank.
|
||||
}
|
||||
|
||||
reset_mbstring_encoding();
|
||||
|
||||
fseek( $temphandle, 0 ); // Skip back to the start of the file being written to
|
||||
fseek( $temphandle, 0 ); // Skip back to the start of the file being written to.
|
||||
$contents = '';
|
||||
|
||||
while ( ! feof( $temphandle ) ) {
|
||||
@ -198,7 +198,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
||||
return false;
|
||||
}
|
||||
|
||||
// The FTP class uses string functions internally during file download/upload
|
||||
// The FTP class uses string functions internally during file download/upload.
|
||||
mbstring_binary_safe_encoding();
|
||||
|
||||
$bytes_written = fwrite( $temphandle, $contents );
|
||||
@ -211,7 +211,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
||||
return false;
|
||||
}
|
||||
|
||||
fseek( $temphandle, 0 ); // Skip back to the start of the file being written to
|
||||
fseek( $temphandle, 0 ); // Skip back to the start of the file being written to.
|
||||
|
||||
$ret = $this->ftp->fput( $file, $temphandle );
|
||||
|
||||
@ -283,7 +283,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
||||
}
|
||||
}
|
||||
|
||||
// chmod the file or directory
|
||||
// chmod the file or directory.
|
||||
return $this->ftp->chmod( $file, $mode );
|
||||
}
|
||||
|
||||
@ -408,7 +408,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
||||
return true; // File is an empty directory.
|
||||
}
|
||||
|
||||
return ! empty( $list ); //empty list = no file, so invert.
|
||||
return ! empty( $list ); // Empty list = no file, so invert.
|
||||
// Return $this->ftp->is_exists($file); has issues with ABOR+426 responses on the ncFTPd server.
|
||||
}
|
||||
|
||||
@ -635,12 +635,12 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
||||
}
|
||||
}
|
||||
|
||||
// Replace symlinks formatted as "source -> target" with just the source name
|
||||
// Replace symlinks formatted as "source -> target" with just the source name.
|
||||
if ( $struc['islink'] ) {
|
||||
$struc['name'] = preg_replace( '/(\s*->\s*.*)$/', '', $struc['name'] );
|
||||
}
|
||||
|
||||
// Add the Octal representation of the file permissions
|
||||
// Add the octal representation of the file permissions.
|
||||
$struc['permsn'] = $this->getnumchmodfromh( $struc['perms'] );
|
||||
|
||||
$ret[ $struc['name'] ] = $struc;
|
||||
|
@ -582,7 +582,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
|
||||
* @return bool Whether $file is writable.
|
||||
*/
|
||||
public function is_writable( $file ) {
|
||||
// PHP will base it's writable checks on system_user === file_owner, not ssh_user === file_owner
|
||||
// PHP will base its writable checks on system_user === file_owner, not ssh_user === file_owner.
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -25,18 +25,18 @@ class WP_Importer {
|
||||
$limit = 100;
|
||||
$offset = 0;
|
||||
|
||||
// Grab all posts in chunks
|
||||
// Grab all posts in chunks.
|
||||
do {
|
||||
$meta_key = $importer_name . '_' . $bid . '_permalink';
|
||||
$sql = $wpdb->prepare( "SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = %s LIMIT %d,%d", $meta_key, $offset, $limit );
|
||||
$results = $wpdb->get_results( $sql );
|
||||
|
||||
// Increment offset
|
||||
// Increment offset.
|
||||
$offset = ( $limit + $offset );
|
||||
|
||||
if ( ! empty( $results ) ) {
|
||||
foreach ( $results as $r ) {
|
||||
// Set permalinks into array
|
||||
// Set permalinks into array.
|
||||
$hashtable[ $r->meta_value ] = intval( $r->post_id );
|
||||
}
|
||||
}
|
||||
@ -62,7 +62,7 @@ class WP_Importer {
|
||||
|
||||
$count = 0;
|
||||
|
||||
// Get count of permalinks
|
||||
// Get count of permalinks.
|
||||
$meta_key = $importer_name . '_' . $bid . '_permalink';
|
||||
$sql = $wpdb->prepare( "SELECT COUNT( post_id ) AS cnt FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key );
|
||||
|
||||
@ -94,21 +94,21 @@ class WP_Importer {
|
||||
$limit = 100;
|
||||
$offset = 0;
|
||||
|
||||
// Grab all comments in chunks
|
||||
// Grab all comments in chunks.
|
||||
do {
|
||||
$sql = $wpdb->prepare( "SELECT comment_ID, comment_agent FROM $wpdb->comments LIMIT %d,%d", $offset, $limit );
|
||||
$results = $wpdb->get_results( $sql );
|
||||
|
||||
// Increment offset
|
||||
// Increment offset.
|
||||
$offset = ( $limit + $offset );
|
||||
|
||||
if ( ! empty( $results ) ) {
|
||||
foreach ( $results as $r ) {
|
||||
// Explode comment_agent key
|
||||
// Explode comment_agent key.
|
||||
list ( $ca_bid, $source_comment_id ) = explode( '-', $r->comment_agent );
|
||||
$source_comment_id = intval( $source_comment_id );
|
||||
|
||||
// Check if this comment came from this blog
|
||||
// Check if this comment came from this blog.
|
||||
if ( $bid == $ca_bid ) {
|
||||
$hashtable[ $source_comment_id ] = intval( $r->comment_ID );
|
||||
}
|
||||
@ -203,7 +203,7 @@ class WP_Importer {
|
||||
* @return array
|
||||
*/
|
||||
public function get_page( $url, $username = '', $password = '', $head = false ) {
|
||||
// Increase the timeout
|
||||
// Increase the timeout.
|
||||
add_filter( 'http_request_timeout', array( $this, 'bump_request_timeout' ) );
|
||||
|
||||
$headers = array();
|
||||
@ -267,7 +267,7 @@ class WP_Importer {
|
||||
global $wpdb, $wp_actions;
|
||||
// Or define( 'WP_IMPORTING', true );
|
||||
$wpdb->queries = array();
|
||||
// Reset $wp_actions to keep it from growing out of control
|
||||
// Reset $wp_actions to keep it from growing out of control.
|
||||
$wp_actions = array();
|
||||
}
|
||||
}
|
||||
@ -317,15 +317,15 @@ function get_cli_args( $param, $required = false ) {
|
||||
}
|
||||
}
|
||||
|
||||
// Check array for specified param
|
||||
// Check array for specified param.
|
||||
if ( isset( $out[ $param ] ) ) {
|
||||
// Set return value
|
||||
// Set return value.
|
||||
$return = $out[ $param ];
|
||||
}
|
||||
|
||||
// Check for missing required param
|
||||
// Check for missing required param.
|
||||
if ( ! isset( $out[ $param ] ) && $required ) {
|
||||
// Display message and exit
|
||||
// Display message and exit.
|
||||
echo "\"$param\" parameter is required but was not specified\n";
|
||||
exit();
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ final class WP_Internal_Pointers {
|
||||
// None currently.
|
||||
);
|
||||
|
||||
// Check if screen related pointer is registered
|
||||
// Check if screen related pointer is registered.
|
||||
if ( empty( $registered_pointers[ $hook_suffix ] ) ) {
|
||||
return;
|
||||
}
|
||||
@ -75,7 +75,7 @@ final class WP_Internal_Pointers {
|
||||
// None currently.
|
||||
);
|
||||
|
||||
// Get dismissed pointers
|
||||
// Get dismissed pointers.
|
||||
$dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
|
||||
|
||||
$got_pointers = false;
|
||||
@ -88,7 +88,7 @@ final class WP_Internal_Pointers {
|
||||
}
|
||||
}
|
||||
|
||||
// Bind pointer print function
|
||||
// Bind pointer print function.
|
||||
add_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_' . $pointer ) );
|
||||
$got_pointers = true;
|
||||
}
|
||||
@ -97,7 +97,7 @@ final class WP_Internal_Pointers {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add pointers script and style to queue
|
||||
// Add pointers script and style to queue.
|
||||
wp_enqueue_style( 'wp-pointer' );
|
||||
wp_enqueue_script( 'wp-pointer' );
|
||||
}
|
||||
|
@ -1004,8 +1004,8 @@ class WP_List_Table {
|
||||
$columns = get_column_headers( $this->screen );
|
||||
$default = $this->get_default_primary_column_name();
|
||||
|
||||
// If the primary column doesn't exist fall back to the
|
||||
// first non-checkbox column.
|
||||
// If the primary column doesn't exist,
|
||||
// fall back to the first non-checkbox column.
|
||||
if ( ! isset( $columns[ $default ] ) ) {
|
||||
$default = WP_List_Table::get_default_primary_column_name();
|
||||
}
|
||||
@ -1035,7 +1035,7 @@ class WP_List_Table {
|
||||
* @return array
|
||||
*/
|
||||
protected function get_column_info() {
|
||||
// $_column_headers is already set / cached
|
||||
// $_column_headers is already set / cached.
|
||||
if ( isset( $this->_column_headers ) && is_array( $this->_column_headers ) ) {
|
||||
// Back-compat for list tables that have been manually setting $_column_headers for horse reasons.
|
||||
// In 4.3, we added a fourth argument for primary column.
|
||||
|
@ -114,7 +114,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
||||
preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s ) ||
|
||||
preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s ) ||
|
||||
preg_match( '/^[0-9]{1,3}\.$/', $s ) ) {
|
||||
// IPv4 address
|
||||
// IPv4 address.
|
||||
$sql = $wpdb->prepare( "SELECT blog_id FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.IP LIKE %s", $wpdb->esc_like( $s ) . ( ! empty( $wild ) ? '%' : '' ) );
|
||||
$reg_blog_ids = $wpdb->get_col( $sql );
|
||||
|
||||
@ -133,7 +133,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
||||
|
||||
$order_by = isset( $_REQUEST['orderby'] ) ? $_REQUEST['orderby'] : '';
|
||||
if ( 'registered' === $order_by ) {
|
||||
// registered is a valid field name.
|
||||
// 'registered' is a valid field name.
|
||||
} elseif ( 'lastupdated' === $order_by ) {
|
||||
$order_by = 'last_updated';
|
||||
} elseif ( 'blogname' === $order_by ) {
|
||||
|
@ -62,7 +62,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
|
||||
* @return array
|
||||
*/
|
||||
protected function get_table_classes() {
|
||||
// todo: remove and add CSS for .themes
|
||||
// @todo Remove and add CSS for .themes.
|
||||
return array( 'widefat', 'plugins' );
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ class WP_MS_Users_List_Table extends WP_List_Table {
|
||||
/** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */
|
||||
$args = apply_filters( 'users_list_table_query_args', $args );
|
||||
|
||||
// Query the user IDs for this page
|
||||
// Query the user IDs for this page.
|
||||
$wp_user_search = new WP_User_Query( $args );
|
||||
|
||||
$this->items = $wp_user_search->get_results();
|
||||
|
@ -95,7 +95,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
|
||||
|
||||
$per_page = 36;
|
||||
|
||||
// These are the tabs which are shown on the page
|
||||
// These are the tabs which are shown on the page.
|
||||
$tabs = array();
|
||||
|
||||
if ( 'search' === $tab ) {
|
||||
@ -471,7 +471,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
|
||||
$plugin = (array) $plugin;
|
||||
}
|
||||
|
||||
// Display the group heading if there is one
|
||||
// Display the group heading if there is one.
|
||||
if ( isset( $plugin['group'] ) && $plugin['group'] != $group ) {
|
||||
if ( isset( $this->groups[ $plugin['group'] ] ) ) {
|
||||
$group_name = $this->groups[ $plugin['group'] ];
|
||||
@ -482,13 +482,13 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
|
||||
$group_name = $plugin['group'];
|
||||
}
|
||||
|
||||
// Starting a new group, close off the divs of the last one
|
||||
// Starting a new group, close off the divs of the last one.
|
||||
if ( ! empty( $group ) ) {
|
||||
echo '</div></div>';
|
||||
}
|
||||
|
||||
echo '<div class="plugin-group"><h3>' . esc_html( $group_name ) . '</h3>';
|
||||
// needs an extra wrapping div for nth-child selectors to work
|
||||
// Needs an extra wrapping div for nth-child selectors to work.
|
||||
echo '<div class="plugin-items">';
|
||||
|
||||
$group = $plugin['group'];
|
||||
@ -768,7 +768,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
|
||||
<?php
|
||||
}
|
||||
|
||||
// Close off the group divs of the last one
|
||||
// Close off the group divs of the last one.
|
||||
if ( ! empty( $group ) ) {
|
||||
echo '</div></div>';
|
||||
}
|
||||
|
@ -186,40 +186,40 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
||||
if ( isset( $plugin_info->response[ $plugin_file ] ) ) {
|
||||
$plugin_data = array_merge( (array) $plugin_info->response[ $plugin_file ], $plugin_data );
|
||||
$plugins['all'][ $plugin_file ] = $plugin_data;
|
||||
// Make sure that $plugins['upgrade'] also receives the extra info since it is used on ?plugin_status=upgrade
|
||||
// Make sure that $plugins['upgrade'] also receives the extra info since it is used on ?plugin_status=upgrade.
|
||||
if ( isset( $plugins['upgrade'][ $plugin_file ] ) ) {
|
||||
$plugins['upgrade'][ $plugin_file ] = $plugin_data;
|
||||
}
|
||||
} elseif ( isset( $plugin_info->no_update[ $plugin_file ] ) ) {
|
||||
$plugin_data = array_merge( (array) $plugin_info->no_update[ $plugin_file ], $plugin_data );
|
||||
$plugins['all'][ $plugin_file ] = $plugin_data;
|
||||
// Make sure that $plugins['upgrade'] also receives the extra info since it is used on ?plugin_status=upgrade
|
||||
// Make sure that $plugins['upgrade'] also receives the extra info since it is used on ?plugin_status=upgrade.
|
||||
if ( isset( $plugins['upgrade'][ $plugin_file ] ) ) {
|
||||
$plugins['upgrade'][ $plugin_file ] = $plugin_data;
|
||||
}
|
||||
}
|
||||
|
||||
// Filter into individual sections
|
||||
// Filter into individual sections.
|
||||
if ( is_multisite() && ! $screen->in_admin( 'network' ) && is_network_only_plugin( $plugin_file ) && ! is_plugin_active( $plugin_file ) ) {
|
||||
if ( $show_network_active ) {
|
||||
// On the non-network screen, show inactive network-only plugins if allowed
|
||||
// On the non-network screen, show inactive network-only plugins if allowed.
|
||||
$plugins['inactive'][ $plugin_file ] = $plugin_data;
|
||||
} else {
|
||||
// On the non-network screen, filter out network-only plugins as long as they're not individually active
|
||||
// On the non-network screen, filter out network-only plugins as long as they're not individually active.
|
||||
unset( $plugins['all'][ $plugin_file ] );
|
||||
}
|
||||
} elseif ( ! $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) {
|
||||
if ( $show_network_active ) {
|
||||
// On the non-network screen, show network-active plugins if allowed
|
||||
// On the non-network screen, show network-active plugins if allowed.
|
||||
$plugins['active'][ $plugin_file ] = $plugin_data;
|
||||
} else {
|
||||
// On the non-network screen, filter out network-active plugins
|
||||
// On the non-network screen, filter out network-active plugins.
|
||||
unset( $plugins['all'][ $plugin_file ] );
|
||||
}
|
||||
} elseif ( ( ! $screen->in_admin( 'network' ) && is_plugin_active( $plugin_file ) )
|
||||
|| ( $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) ) {
|
||||
// On the non-network screen, populate the active list with plugins that are individually activated
|
||||
// On the network-admin screen, populate the active list with plugins that are network activated
|
||||
// On the non-network screen, populate the active list with plugins that are individually activated.
|
||||
// On the network admin screen, populate the active list with plugins that are network-activated.
|
||||
$plugins['active'][ $plugin_file ] = $plugin_data;
|
||||
|
||||
if ( ! $screen->in_admin( 'network' ) && is_plugin_paused( $plugin_file ) ) {
|
||||
@ -227,10 +227,10 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
||||
}
|
||||
} else {
|
||||
if ( isset( $recently_activated[ $plugin_file ] ) ) {
|
||||
// Populate the recently activated list with plugins that have been recently activated
|
||||
// Populate the recently activated list with plugins that have been recently activated.
|
||||
$plugins['recently_activated'][ $plugin_file ] = $plugin_data;
|
||||
}
|
||||
// Populate the inactive list with plugins that aren't activated
|
||||
// Populate the inactive list with plugins that aren't activated.
|
||||
$plugins['inactive'][ $plugin_file ] = $plugin_data;
|
||||
}
|
||||
}
|
||||
@ -251,7 +251,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
||||
|
||||
$this->items = array();
|
||||
foreach ( $plugins[ $status ] as $plugin_file => $plugin_data ) {
|
||||
// Translate, Don't Apply Markup, Sanitize HTML
|
||||
// Translate, don't apply markup, sanitize HTML.
|
||||
$this->items[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, false, true );
|
||||
}
|
||||
|
||||
@ -631,7 +631,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
||||
'delete' => '',
|
||||
);
|
||||
|
||||
// Do not restrict by default
|
||||
// Do not restrict by default.
|
||||
$restrict_network_active = false;
|
||||
$restrict_network_only = false;
|
||||
|
||||
@ -643,10 +643,10 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
||||
if ( $plugin_file != $plugin_data['Name'] ) {
|
||||
$plugin_name .= '<br/>' . $plugin_data['Name'];
|
||||
}
|
||||
if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant
|
||||
if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant.
|
||||
$is_active = true;
|
||||
$description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>';
|
||||
} elseif ( defined( $dropins[ $plugin_file ][1] ) && constant( $dropins[ $plugin_file ][1] ) ) { // Constant is true
|
||||
} elseif ( defined( $dropins[ $plugin_file ][1] ) && constant( $dropins[ $plugin_file ][1] ) ) { // Constant is true.
|
||||
$is_active = true;
|
||||
$description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>';
|
||||
} else {
|
||||
@ -750,9 +750,9 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
||||
__( 'Delete' )
|
||||
);
|
||||
}
|
||||
} // end if $is_active
|
||||
} // end if $screen->in_admin( 'network' )
|
||||
} // end if $context
|
||||
} // End if $is_active.
|
||||
} // End if $screen->in_admin( 'network' ).
|
||||
} // End if $context.
|
||||
|
||||
$actions = array_filter( $actions );
|
||||
|
||||
@ -906,7 +906,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
||||
$plugin_meta[] = sprintf( __( 'By %s' ), $author );
|
||||
}
|
||||
|
||||
// Details link using API info, if available
|
||||
// Details link using API info, if available.
|
||||
if ( isset( $plugin_data['slug'] ) && current_user_can( 'install_plugins' ) ) {
|
||||
$plugin_meta[] = sprintf(
|
||||
'<a href="%s" class="thickbox open-plugin-details-modal" aria-label="%s" data-title="%s">%s</a>',
|
||||
|
@ -143,7 +143,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
public function prepare_items() {
|
||||
global $avail_post_stati, $wp_query, $per_page, $mode;
|
||||
|
||||
// is going to call wp()
|
||||
// Is going to call wp().
|
||||
$avail_post_stati = wp_edit_posts_query();
|
||||
|
||||
$this->set_hierarchical_display( is_post_type_hierarchical( $this->screen->post_type ) && 'menu_order title' === $wp_query->query['orderby'] );
|
||||
@ -877,7 +877,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
$my_parents = array();
|
||||
$my_parent = $page->post_parent;
|
||||
while ( $my_parent ) {
|
||||
// Get the ID from the list or the attribute if my_parent is an object
|
||||
// Get the ID from the list or the attribute if my_parent is an object.
|
||||
$parent_id = $my_parent;
|
||||
if ( is_object( $my_parent ) ) {
|
||||
$parent_id = $my_parent->ID;
|
||||
@ -906,7 +906,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
$this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page, $to_display );
|
||||
}
|
||||
|
||||
unset( $children_pages[ $parent ] ); //required in order to keep track of orphans
|
||||
unset( $children_pages[ $parent ] ); // Required in order to keep track of orphans.
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1467,6 +1467,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
$taxonomy_names = get_object_taxonomies( $screen->post_type );
|
||||
$hierarchical_taxonomies = array();
|
||||
$flat_taxonomies = array();
|
||||
|
||||
foreach ( $taxonomy_names as $taxonomy_name ) {
|
||||
|
||||
$taxonomy = get_taxonomy( $taxonomy_name );
|
||||
@ -1507,7 +1508,8 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
|
||||
?>
|
||||
|
||||
<form method="get"><table style="display: none"><tbody id="inlineedit">
|
||||
<form method="get">
|
||||
<table style="display: none"><tbody id="inlineedit">
|
||||
<?php
|
||||
$hclass = count( $hierarchical_taxonomies ) ? 'post' : 'page';
|
||||
$inline_edit_classes = "inline-edit-row inline-edit-row-$hclass";
|
||||
@ -1515,24 +1517,21 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
$quick_edit_classes = "quick-edit-row quick-edit-row-$hclass inline-edit-{$screen->post_type}";
|
||||
|
||||
$bulk = 0;
|
||||
while ( $bulk < 2 ) {
|
||||
while ( $bulk < 2 ) :
|
||||
$classes = $inline_edit_classes . ' ';
|
||||
$classes .= $bulk ? $bulk_edit_classes : $quick_edit_classes;
|
||||
?>
|
||||
|
||||
<tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="
|
||||
<?php
|
||||
echo $inline_edit_classes . ' ';
|
||||
echo $bulk ? $bulk_edit_classes : $quick_edit_classes;
|
||||
?>
|
||||
" style="display: none"><td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange">
|
||||
<tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="<?php echo $classes; ?>" style="display: none">
|
||||
<td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange">
|
||||
|
||||
<fieldset class="inline-edit-col-left">
|
||||
<legend class="inline-edit-legend"><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></legend>
|
||||
<div class="inline-edit-col">
|
||||
<?php
|
||||
|
||||
if ( post_type_supports( $screen->post_type, 'title' ) ) :
|
||||
if ( $bulk ) :
|
||||
?>
|
||||
<?php if ( post_type_supports( $screen->post_type, 'title' ) ) : ?>
|
||||
|
||||
<?php if ( $bulk ) : ?>
|
||||
|
||||
<div id="bulk-title-div">
|
||||
<div id="bulk-titles"></div>
|
||||
</div>
|
||||
@ -1544,18 +1543,18 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
<span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span>
|
||||
</label>
|
||||
|
||||
<?php if ( is_post_type_viewable( $screen->post_type ) ) : // is_post_type_viewable check ?>
|
||||
<?php if ( is_post_type_viewable( $screen->post_type ) ) : ?>
|
||||
|
||||
<label>
|
||||
<span class="title"><?php _e( 'Slug' ); ?></span>
|
||||
<span class="input-text-wrap"><input type="text" name="post_name" value="" /></span>
|
||||
</label>
|
||||
|
||||
<?php
|
||||
endif; // is_post_type_viewable check
|
||||
endif; // $bulk
|
||||
endif; // post_type_supports title
|
||||
?>
|
||||
<?php endif; // is_post_type_viewable() ?>
|
||||
|
||||
<?php endif; // $bulk ?>
|
||||
|
||||
<?php endif; // post_type_supports( ... 'title' ) ?>
|
||||
|
||||
<?php if ( ! $bulk ) : ?>
|
||||
<fieldset class="inline-edit-date">
|
||||
@ -1563,9 +1562,9 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
<?php touch_time( 1, 1, 0, 1 ); ?>
|
||||
</fieldset>
|
||||
<br class="clear" />
|
||||
<?php
|
||||
endif; // $bulk
|
||||
<?php endif; // $bulk ?>
|
||||
|
||||
<?php
|
||||
if ( post_type_supports( $screen->post_type, 'author' ) ) :
|
||||
$authors_dropdown = '';
|
||||
|
||||
@ -1579,6 +1578,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
'echo' => 0,
|
||||
'show' => 'display_name_with_login',
|
||||
);
|
||||
|
||||
if ( $bulk ) {
|
||||
$users_opt['show_option_none'] = __( '— No Change —' );
|
||||
}
|
||||
@ -1590,17 +1590,18 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
$authors_dropdown .= $authors;
|
||||
$authors_dropdown .= '</label>';
|
||||
endif;
|
||||
endif; // authors
|
||||
endif; // current_user_can( 'edit_others_posts' )
|
||||
?>
|
||||
|
||||
<?php
|
||||
if ( ! $bulk ) {
|
||||
echo $authors_dropdown;}
|
||||
endif; // post_type_supports author
|
||||
|
||||
if ( ! $bulk && $can_publish ) :
|
||||
echo $authors_dropdown;
|
||||
}
|
||||
endif; // post_type_supports( ... 'author' )
|
||||
?>
|
||||
|
||||
<?php if ( ! $bulk && $can_publish ) : ?>
|
||||
|
||||
<div class="inline-edit-group wp-clearfix">
|
||||
<label class="alignleft">
|
||||
<span class="title"><?php _e( 'Password' ); ?></span>
|
||||
@ -1621,11 +1622,13 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div></fieldset>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<?php if ( count( $hierarchical_taxonomies ) && ! $bulk ) : ?>
|
||||
|
||||
<fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col">
|
||||
<fieldset class="inline-edit-col-center inline-edit-categories">
|
||||
<div class="inline-edit-col">
|
||||
|
||||
<?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?>
|
||||
|
||||
@ -1637,21 +1640,24 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
|
||||
<?php endforeach; // $hierarchical_taxonomies as $taxonomy ?>
|
||||
|
||||
</div></fieldset>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<?php endif; // count( $hierarchical_taxonomies ) && ! $bulk ?>
|
||||
|
||||
<fieldset class="inline-edit-col-right"><div class="inline-edit-col">
|
||||
<fieldset class="inline-edit-col-right">
|
||||
<div class="inline-edit-col">
|
||||
|
||||
<?php
|
||||
if ( post_type_supports( $screen->post_type, 'author' ) && $bulk ) {
|
||||
echo $authors_dropdown;
|
||||
}
|
||||
|
||||
if ( post_type_supports( $screen->post_type, 'page-attributes' ) ) :
|
||||
|
||||
if ( $post_type_object->hierarchical ) :
|
||||
?>
|
||||
|
||||
<?php if ( post_type_supports( $screen->post_type, 'page-attributes' ) ) : ?>
|
||||
|
||||
<?php if ( $post_type_object->hierarchical ) : ?>
|
||||
|
||||
<label>
|
||||
<span class="title"><?php _e( 'Parent' ); ?></span>
|
||||
<?php
|
||||
@ -1683,23 +1689,21 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
?>
|
||||
</label>
|
||||
|
||||
<?php
|
||||
endif; // hierarchical
|
||||
<?php endif; // hierarchical ?>
|
||||
|
||||
if ( ! $bulk ) :
|
||||
?>
|
||||
<?php if ( ! $bulk ) : ?>
|
||||
|
||||
<label>
|
||||
<span class="title"><?php _e( 'Order' ); ?></span>
|
||||
<span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order; ?>" /></span>
|
||||
</label>
|
||||
|
||||
<?php
|
||||
endif; // !$bulk
|
||||
endif; // page-attributes
|
||||
?>
|
||||
<?php endif; // ! $bulk ?>
|
||||
|
||||
<?php endif; // post_type_supports( ... 'page-attributes' ) ?>
|
||||
|
||||
<?php if ( 0 < count( get_page_templates( null, $screen->post_type ) ) ) : ?>
|
||||
|
||||
<label>
|
||||
<span class="title"><?php _e( 'Template' ); ?></span>
|
||||
<select name="page_template">
|
||||
@ -1714,33 +1718,35 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
<?php page_template_dropdown( '', $screen->post_type ); ?>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( count( $flat_taxonomies ) && ! $bulk ) : ?>
|
||||
|
||||
<?php foreach ( $flat_taxonomies as $taxonomy ) : ?>
|
||||
<?php
|
||||
if ( current_user_can( $taxonomy->cap->assign_terms ) ) :
|
||||
$taxonomy_name = esc_attr( $taxonomy->name );
|
||||
|
||||
?>
|
||||
<?php if ( current_user_can( $taxonomy->cap->assign_terms ) ) : ?>
|
||||
<?php $taxonomy_name = esc_attr( $taxonomy->name ); ?>
|
||||
|
||||
<label class="inline-edit-tags">
|
||||
<span class="title"><?php echo esc_html( $taxonomy->labels->name ); ?></span>
|
||||
<textarea data-wp-taxonomy="<?php echo $taxonomy_name; ?>" cols="22" rows="1" name="tax_input[<?php echo $taxonomy_name; ?>]" class="tax_input_<?php echo $taxonomy_name; ?>"></textarea>
|
||||
</label>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; // current_user_can( 'assign_terms' ) ?>
|
||||
|
||||
<?php endforeach; // $flat_taxonomies as $taxonomy ?>
|
||||
|
||||
<?php endif; // count( $flat_taxonomies ) && ! $bulk ?>
|
||||
|
||||
<?php
|
||||
if ( post_type_supports( $screen->post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) :
|
||||
if ( $bulk ) :
|
||||
?>
|
||||
<?php if ( post_type_supports( $screen->post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
|
||||
|
||||
<?php if ( $bulk ) : ?>
|
||||
|
||||
<div class="inline-edit-group wp-clearfix">
|
||||
|
||||
<?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
|
||||
|
||||
<label class="alignleft">
|
||||
<span class="title"><?php _e( 'Comments' ); ?></span>
|
||||
<select name="comment_status">
|
||||
@ -1749,7 +1755,11 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
<option value="closed"><?php _e( 'Do not allow' ); ?></option>
|
||||
</select>
|
||||
</label>
|
||||
<?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
|
||||
|
||||
<label class="alignright">
|
||||
<span class="title"><?php _e( 'Pings' ); ?></span>
|
||||
<select name="ping_status">
|
||||
@ -1758,44 +1768,56 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
<option value="closed"><?php _e( 'Do not allow' ); ?></option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php else : // $bulk ?>
|
||||
|
||||
<div class="inline-edit-group wp-clearfix">
|
||||
|
||||
<?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
|
||||
|
||||
<label class="alignleft">
|
||||
<input type="checkbox" name="comment_status" value="open" />
|
||||
<span class="checkbox-title"><?php _e( 'Allow Comments' ); ?></span>
|
||||
</label>
|
||||
<?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
|
||||
|
||||
<label class="alignleft">
|
||||
<input type="checkbox" name="ping_status" value="open" />
|
||||
<span class="checkbox-title"><?php _e( 'Allow Pings' ); ?></span>
|
||||
</label>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
endif; // $bulk
|
||||
endif; // post_type_supports comments or pings
|
||||
?>
|
||||
<?php endif; // $bulk ?>
|
||||
|
||||
<?php endif; // post_type_supports( ... comments or pings ) ?>
|
||||
|
||||
<div class="inline-edit-group wp-clearfix">
|
||||
|
||||
<label class="inline-edit-status alignleft">
|
||||
<span class="title"><?php _e( 'Status' ); ?></span>
|
||||
<select name="_status">
|
||||
<?php if ( $bulk ) : ?>
|
||||
<option value="-1"><?php _e( '— No Change —' ); ?></option>
|
||||
<?php endif; // $bulk ?>
|
||||
<?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review" ?>
|
||||
|
||||
<?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review". ?>
|
||||
<option value="publish"><?php _e( 'Published' ); ?></option>
|
||||
<option value="future"><?php _e( 'Scheduled' ); ?></option>
|
||||
<?php if ( $bulk ) : ?>
|
||||
<option value="private"><?php _e( 'Private' ); ?></option>
|
||||
<?php endif; // $bulk ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<option value="pending"><?php _e( 'Pending Review' ); ?></option>
|
||||
<option value="draft"><?php _e( 'Draft' ); ?></option>
|
||||
</select>
|
||||
@ -1823,38 +1845,30 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
|
||||
<?php endif; // $bulk ?>
|
||||
|
||||
<?php endif; // 'post' && $can_publish && current_user_can( 'edit_others_cap' ) ?>
|
||||
<?php endif; // 'post' && $can_publish && current_user_can( 'edit_others_posts' ) ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
<?php if ( $bulk && current_theme_supports( 'post-formats' ) && post_type_supports( $screen->post_type, 'post-formats' ) ) : ?>
|
||||
<?php $post_formats = get_theme_support( 'post-formats' ); ?>
|
||||
|
||||
if ( $bulk && current_theme_supports( 'post-formats' ) && post_type_supports( $screen->post_type, 'post-formats' ) ) {
|
||||
$post_formats = get_theme_support( 'post-formats' );
|
||||
|
||||
?>
|
||||
<label class="alignleft">
|
||||
<span class="title"><?php _ex( 'Format', 'post format' ); ?></span>
|
||||
<select name="post_format">
|
||||
<option value="-1"><?php _e( '— No Change —' ); ?></option>
|
||||
<option value="0"><?php echo get_post_format_string( 'standard' ); ?></option>
|
||||
<?php
|
||||
if ( is_array( $post_formats[0] ) ) {
|
||||
foreach ( $post_formats[0] as $format ) {
|
||||
?>
|
||||
<?php if ( is_array( $post_formats[0] ) ) : ?>
|
||||
<?php foreach ( $post_formats[0] as $format ) : ?>
|
||||
<option value="<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></option>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select></label>
|
||||
<?php
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
}
|
||||
<?php endif; ?>
|
||||
|
||||
?>
|
||||
|
||||
</div></fieldset>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<?php
|
||||
list( $columns ) = $this->get_column_info();
|
||||
@ -1890,35 +1904,38 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="submit inline-edit-save">
|
||||
<button type="button" class="button cancel alignleft"><?php _e( 'Cancel' ); ?></button>
|
||||
<?php
|
||||
if ( ! $bulk ) {
|
||||
wp_nonce_field( 'inlineeditnonce', '_inline_edit', false );
|
||||
?>
|
||||
|
||||
<?php if ( ! $bulk ) : ?>
|
||||
<?php wp_nonce_field( 'inlineeditnonce', '_inline_edit', false ); ?>
|
||||
<button type="button" class="button button-primary save alignright"><?php _e( 'Update' ); ?></button>
|
||||
<span class="spinner"></span>
|
||||
<?php
|
||||
} else {
|
||||
submit_button( __( 'Update' ), 'primary alignright', 'bulk_edit', false );
|
||||
}
|
||||
?>
|
||||
<?php else : ?>
|
||||
<?php submit_button( __( 'Update' ), 'primary alignright', 'bulk_edit', false ); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<input type="hidden" name="post_view" value="<?php echo esc_attr( $m ); ?>" />
|
||||
<input type="hidden" name="screen" value="<?php echo esc_attr( $screen->id ); ?>" />
|
||||
<?php if ( ! $bulk && ! post_type_supports( $screen->post_type, 'author' ) ) { ?>
|
||||
<?php if ( ! $bulk && ! post_type_supports( $screen->post_type, 'author' ) ) : ?>
|
||||
<input type="hidden" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
|
||||
<?php } ?>
|
||||
<?php endif; ?>
|
||||
<br class="clear" />
|
||||
|
||||
<div class="notice notice-error notice-alt inline hidden">
|
||||
<p class="error"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</td></tr>
|
||||
|
||||
<?php
|
||||
$bulk++;
|
||||
}
|
||||
endwhile;
|
||||
?>
|
||||
</tbody></table></form>
|
||||
</tbody></table>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
@ -73,9 +73,11 @@ abstract class WP_Privacy_Requests_Table extends WP_List_Table {
|
||||
* @return array Default sortable columns.
|
||||
*/
|
||||
protected function get_sortable_columns() {
|
||||
// The initial sorting is by 'Requested' (post_date) and descending.
|
||||
// With initial sorting, the first click on 'Requested' should be ascending.
|
||||
// With 'Requester' sorting active, the next click on 'Requested' should be descending.
|
||||
/*
|
||||
* The initial sorting is by 'Requested' (post_date) and descending.
|
||||
* With initial sorting, the first click on 'Requested' should be ascending.
|
||||
* With 'Requester' sorting active, the next click on 'Requested' should be descending.
|
||||
*/
|
||||
$desc_first = isset( $_GET['orderby'] );
|
||||
|
||||
return array(
|
||||
@ -146,7 +148,7 @@ abstract class WP_Privacy_Requests_Table extends WP_List_Table {
|
||||
$counts = $this->get_request_counts();
|
||||
$total_requests = absint( array_sum( (array) $counts ) );
|
||||
|
||||
// Normalized admin URL
|
||||
// Normalized admin URL.
|
||||
$admin_url = $this->get_admin_url();
|
||||
|
||||
$current_link_attributes = empty( $current_status ) ? ' class="current" aria-current="page"' : '';
|
||||
|
@ -226,7 +226,7 @@ final class WP_Screen {
|
||||
// For those pesky meta boxes.
|
||||
if ( $hook_name && post_type_exists( $hook_name ) ) {
|
||||
$post_type = $id;
|
||||
$id = 'post'; // changes later. ends up being $base.
|
||||
$id = 'post'; // Changes later. Ends up being $base.
|
||||
} else {
|
||||
if ( '.php' == substr( $id, -4 ) ) {
|
||||
$id = substr( $id, 0, -4 );
|
||||
@ -923,7 +923,7 @@ final class WP_Screen {
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
// Setup layout columns
|
||||
// Setup layout columns.
|
||||
|
||||
/**
|
||||
* Filters the array of screen layout columns.
|
||||
@ -952,7 +952,7 @@ final class WP_Screen {
|
||||
}
|
||||
$GLOBALS['screen_layout_columns'] = $this->columns; // Set the global for back-compat.
|
||||
|
||||
// Add screen options
|
||||
// Add screen options.
|
||||
if ( $this->show_screen_options() ) {
|
||||
$this->render_screen_options();
|
||||
}
|
||||
@ -1156,7 +1156,7 @@ final class WP_Screen {
|
||||
$special = array( '_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname' );
|
||||
|
||||
foreach ( $columns as $column => $title ) {
|
||||
// Can't hide these for they are special
|
||||
// Can't hide these for they are special.
|
||||
if ( in_array( $column, $special ) ) {
|
||||
continue;
|
||||
}
|
||||
@ -1255,13 +1255,13 @@ final class WP_Screen {
|
||||
$per_page = apply_filters( "{$option}", $per_page );
|
||||
}
|
||||
|
||||
// Back compat
|
||||
// Back compat.
|
||||
if ( isset( $this->post_type ) ) {
|
||||
/** This filter is documented in wp-admin/includes/post.php */
|
||||
$per_page = apply_filters( 'edit_posts_per_page', $per_page, $this->post_type );
|
||||
}
|
||||
|
||||
// This needs a submit button
|
||||
// This needs a submit button.
|
||||
add_filter( 'screen_options_show_submit', '__return_true' );
|
||||
|
||||
?>
|
||||
@ -1288,7 +1288,7 @@ final class WP_Screen {
|
||||
public function render_view_mode() {
|
||||
$screen = get_current_screen();
|
||||
|
||||
// Currently only enabled for posts lists
|
||||
// Currently only enabled for posts lists.
|
||||
if ( 'edit' !== $screen->base ) {
|
||||
return;
|
||||
}
|
||||
@ -1316,7 +1316,7 @@ final class WP_Screen {
|
||||
|
||||
global $mode;
|
||||
|
||||
// This needs a submit button
|
||||
// This needs a submit button.
|
||||
add_filter( 'screen_options_show_submit', '__return_true' );
|
||||
?>
|
||||
<fieldset class="metabox-prefs view-mode">
|
||||
|
@ -353,12 +353,12 @@ class WP_Site_Health_Auto_Updates {
|
||||
|
||||
$checksums = get_core_checksums( $wp_version, 'en_US' );
|
||||
$dev = ( false !== strpos( $wp_version, '-' ) );
|
||||
// Get the last stable version's files and test against that
|
||||
// Get the last stable version's files and test against that.
|
||||
if ( ! $checksums && $dev ) {
|
||||
$checksums = get_core_checksums( (float) $wp_version - 0.1, 'en_US' );
|
||||
}
|
||||
|
||||
// There aren't always checksums for development releases, so just skip the test if we still can't find any
|
||||
// There aren't always checksums for development releases, so just skip the test if we still can't find any.
|
||||
if ( ! $checksums && $dev ) {
|
||||
return false;
|
||||
}
|
||||
@ -415,7 +415,7 @@ class WP_Site_Health_Auto_Updates {
|
||||
*/
|
||||
function test_accepts_dev_updates() {
|
||||
include ABSPATH . WPINC . '/version.php'; // $wp_version; // x.y.z
|
||||
// Only for dev versions
|
||||
// Only for dev versions.
|
||||
if ( false === strpos( $wp_version, '-' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ class WP_Site_Health {
|
||||
if ( 'site-health' === $screen->id && ! isset( $_GET['tab'] ) ) {
|
||||
$tests = WP_Site_Health::get_tests();
|
||||
|
||||
// Don't run https test on localhost
|
||||
// Don't run https test on localhost.
|
||||
if ( 'localhost' === preg_replace( '|https?://|', '', get_site_url() ) ) {
|
||||
unset( $tests['direct']['https_status'] );
|
||||
}
|
||||
@ -1217,7 +1217,7 @@ class WP_Site_Health {
|
||||
__( 'Your MySQL version supports utf8mb4.' )
|
||||
);
|
||||
}
|
||||
} else { // MariaDB introduced utf8mb4 support in 5.5.0
|
||||
} else { // MariaDB introduced utf8mb4 support in 5.5.0.
|
||||
if ( version_compare( $this->mysql_server_version, '5.5.0', '<' ) ) {
|
||||
$result['status'] = 'recommended';
|
||||
|
||||
@ -2235,7 +2235,7 @@ class WP_Site_Health {
|
||||
'critical' => 0,
|
||||
);
|
||||
|
||||
// Don't run https test on localhost
|
||||
// Don't run https test on localhost.
|
||||
if ( 'localhost' === preg_replace( '|https?://|', '', get_site_url() ) ) {
|
||||
unset( $tests['direct']['https_status'] );
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ class WP_Site_Icon {
|
||||
natsort( $this->site_icon_sizes );
|
||||
$this->site_icon_sizes = array_reverse( $this->site_icon_sizes );
|
||||
|
||||
// ensure that we only resize the image into
|
||||
// Ensure that we only resize the image into sizes that allow cropping.
|
||||
foreach ( $sizes as $name => $size_array ) {
|
||||
if ( isset( $size_array['crop'] ) ) {
|
||||
$only_crop_sizes[ $name ] = $size_array;
|
||||
|
@ -139,7 +139,7 @@ class WP_Terms_List_Table extends WP_List_Table {
|
||||
* @return bool
|
||||
*/
|
||||
public function has_items() {
|
||||
// todo: populate $this->items in prepare_items()
|
||||
// @todo Populate $this->items in prepare_items().
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -254,7 +254,11 @@ class WP_Terms_List_Table extends WP_List_Table {
|
||||
} else {
|
||||
$children = _get_term_hierarchy( $taxonomy );
|
||||
}
|
||||
// Some funky recursion to get the job done( Paging & parents mainly ) is contained within, Skip it for non-hierarchical taxonomies for performance sake
|
||||
|
||||
/*
|
||||
* Some funky recursion to get the job done (paging & parents mainly) is contained within.
|
||||
* Skip it for non-hierarchical taxonomies for performance sake.
|
||||
*/
|
||||
$this->_rows( $taxonomy, $terms, $children, $offset, $number, $count );
|
||||
} else {
|
||||
foreach ( $terms as $term ) {
|
||||
@ -628,8 +632,11 @@ class WP_Terms_List_Table extends WP_List_Table {
|
||||
}
|
||||
?>
|
||||
|
||||
<form method="get"><table style="display: none"><tbody id="inlineedit">
|
||||
<tr id="inline-edit" class="inline-edit-row" style="display: none"><td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange">
|
||||
<form method="get">
|
||||
<table style="display: none"><tbody id="inlineedit">
|
||||
|
||||
<tr id="inline-edit" class="inline-edit-row" style="display: none">
|
||||
<td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange">
|
||||
|
||||
<fieldset>
|
||||
<legend class="inline-edit-legend"><?php _e( 'Quick Edit' ); ?></legend>
|
||||
@ -638,15 +645,17 @@ class WP_Terms_List_Table extends WP_List_Table {
|
||||
<span class="title"><?php _ex( 'Name', 'term name' ); ?></span>
|
||||
<span class="input-text-wrap"><input type="text" name="name" class="ptitle" value="" /></span>
|
||||
</label>
|
||||
<?php if ( ! global_terms_enabled() ) { ?>
|
||||
|
||||
<?php if ( ! global_terms_enabled() ) : ?>
|
||||
<label>
|
||||
<span class="title"><?php _e( 'Slug' ); ?></span>
|
||||
<span class="input-text-wrap"><input type="text" name="slug" class="ptitle" value="" /></span>
|
||||
</label>
|
||||
<?php } ?>
|
||||
</div></fieldset>
|
||||
<?php
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<?php
|
||||
$core_columns = array(
|
||||
'cb' => true,
|
||||
'description' => true,
|
||||
@ -665,23 +674,27 @@ class WP_Terms_List_Table extends WP_List_Table {
|
||||
/** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */
|
||||
do_action( 'quick_edit_custom_box', $column_name, 'edit-tags', $this->screen->taxonomy );
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="inline-edit-save submit">
|
||||
<button type="button" class="cancel button alignleft"><?php _e( 'Cancel' ); ?></button>
|
||||
<button type="button" class="save button button-primary alignright"><?php echo $tax->labels->update_item; ?></button>
|
||||
<span class="spinner"></span>
|
||||
|
||||
<?php wp_nonce_field( 'taxinlineeditnonce', '_inline_edit', false ); ?>
|
||||
<input type="hidden" name="taxonomy" value="<?php echo esc_attr( $this->screen->taxonomy ); ?>" />
|
||||
<input type="hidden" name="post_type" value="<?php echo esc_attr( $this->screen->post_type ); ?>" />
|
||||
<br class="clear" />
|
||||
|
||||
<div class="notice notice-error notice-alt inline hidden">
|
||||
<p class="error"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</td></tr>
|
||||
</tbody></table></form>
|
||||
|
||||
</tbody></table>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
} // end foreach $theme_names
|
||||
} // End foreach $theme_names.
|
||||
|
||||
$this->theme_installer();
|
||||
}
|
||||
|
@ -300,14 +300,14 @@ class WP_Themes_List_Table extends WP_List_Table {
|
||||
* @return bool
|
||||
*/
|
||||
public function search_theme( $theme ) {
|
||||
// Search the features
|
||||
// Search the features.
|
||||
foreach ( $this->features as $word ) {
|
||||
if ( ! in_array( $word, $theme->get( 'Tags' ) ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Match all phrases
|
||||
// Match all phrases.
|
||||
foreach ( $this->search_terms as $word ) {
|
||||
if ( in_array( $word, $theme->get( 'Tags' ) ) ) {
|
||||
continue;
|
||||
|
@ -195,7 +195,7 @@ class WP_Upgrader {
|
||||
if ( is_object( $wp_filesystem ) && $wp_filesystem->errors->has_errors() ) {
|
||||
$error = $wp_filesystem->errors;
|
||||
}
|
||||
// Failed to connect, Error and request again
|
||||
// Failed to connect. Error and request again.
|
||||
$this->skin->request_filesystem_credentials( $error, $directories[0], $allow_relaxed_file_ownership );
|
||||
return false;
|
||||
}
|
||||
@ -238,7 +238,7 @@ class WP_Upgrader {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} //end fs_connect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Download a package.
|
||||
@ -268,7 +268,7 @@ class WP_Upgrader {
|
||||
}
|
||||
|
||||
if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) { // Local file or remote?
|
||||
return $package; //must be a local file..
|
||||
return $package; // Must be a local file.
|
||||
}
|
||||
|
||||
if ( empty( $package ) ) {
|
||||
@ -313,15 +313,15 @@ class WP_Upgrader {
|
||||
}
|
||||
}
|
||||
|
||||
// We need a working directory - Strip off any .tmp or .zip suffixes
|
||||
// We need a working directory - strip off any .tmp or .zip suffixes.
|
||||
$working_dir = $upgrade_folder . basename( basename( $package, '.tmp' ), '.zip' );
|
||||
|
||||
// Clean up working directory
|
||||
// Clean up working directory.
|
||||
if ( $wp_filesystem->is_dir( $working_dir ) ) {
|
||||
$wp_filesystem->delete( $working_dir, true );
|
||||
}
|
||||
|
||||
// Unzip package to working directory
|
||||
// Unzip package to working directory.
|
||||
$result = unzip_file( $package, $working_dir );
|
||||
|
||||
// Once extracted, delete the package if required.
|
||||
@ -356,11 +356,11 @@ class WP_Upgrader {
|
||||
foreach ( $nested_files as $name => $details ) {
|
||||
$files[ $path . $name ] = $details;
|
||||
|
||||
// Append children recursively
|
||||
// Append children recursively.
|
||||
if ( ! empty( $details['files'] ) ) {
|
||||
$children = $this->flatten_dirlist( $details['files'], $path . $name . '/' );
|
||||
|
||||
// Merge keeping possible numeric keys, which array_merge() will reindex from 0..n
|
||||
// Merge keeping possible numeric keys, which array_merge() will reindex from 0..n.
|
||||
$files = $files + $children;
|
||||
}
|
||||
}
|
||||
@ -388,7 +388,7 @@ class WP_Upgrader {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Flatten the file list to iterate over
|
||||
// Flatten the file list to iterate over.
|
||||
$files = $this->flatten_dirlist( $files );
|
||||
|
||||
// Check all files are writable before attempting to clear the destination.
|
||||
@ -450,8 +450,8 @@ class WP_Upgrader {
|
||||
global $wp_filesystem, $wp_theme_directories;
|
||||
|
||||
$defaults = array(
|
||||
'source' => '', // Please always pass this
|
||||
'destination' => '', // and this
|
||||
'source' => '', // Please always pass this.
|
||||
'destination' => '', // ...and this.
|
||||
'clear_destination' => false,
|
||||
'clear_working' => false,
|
||||
'abort_if_destination_exists' => true,
|
||||
@ -490,19 +490,23 @@ class WP_Upgrader {
|
||||
return $res;
|
||||
}
|
||||
|
||||
//Retain the Original source and destinations
|
||||
// Retain the original source and destinations.
|
||||
$remote_source = $args['source'];
|
||||
$local_destination = $destination;
|
||||
|
||||
$source_files = array_keys( $wp_filesystem->dirlist( $remote_source ) );
|
||||
$remote_destination = $wp_filesystem->find_folder( $local_destination );
|
||||
|
||||
//Locate which directory to copy to the new folder, This is based on the actual folder holding the files.
|
||||
if ( 1 == count( $source_files ) && $wp_filesystem->is_dir( trailingslashit( $args['source'] ) . $source_files[0] . '/' ) ) { //Only one folder? Then we want its contents.
|
||||
// Locate which directory to copy to the new folder. This is based on the actual folder holding the files.
|
||||
if ( 1 == count( $source_files ) && $wp_filesystem->is_dir( trailingslashit( $args['source'] ) . $source_files[0] . '/' ) ) {
|
||||
// Only one folder? Then we want its contents.
|
||||
$source = trailingslashit( $args['source'] ) . trailingslashit( $source_files[0] );
|
||||
} elseif ( count( $source_files ) == 0 ) {
|
||||
return new WP_Error( 'incompatible_archive_empty', $this->strings['incompatible_archive'], $this->strings['no_files'] ); // There are no files?
|
||||
} else { // It's only a single file, the upgrader will use the folder name of this file as the destination folder. Folder name is based on zip filename.
|
||||
// There are no files?
|
||||
return new WP_Error( 'incompatible_archive_empty', $this->strings['incompatible_archive'], $this->strings['no_files'] );
|
||||
} else {
|
||||
// It's only a single file, the upgrader will use the folder name of this file as the destination folder.
|
||||
// Folder name is based on zip filename.
|
||||
$source = trailingslashit( $args['source'] );
|
||||
}
|
||||
|
||||
@ -568,7 +572,7 @@ class WP_Upgrader {
|
||||
return $removed;
|
||||
}
|
||||
} elseif ( $args['abort_if_destination_exists'] && $wp_filesystem->exists( $remote_destination ) ) {
|
||||
//If we're not clearing the destination folder and something exists there already, Bail.
|
||||
// If we're not clearing the destination folder and something exists there already, bail.
|
||||
// But first check to see if there are actually any files in the folder.
|
||||
$_files = $wp_filesystem->dirlist( $remote_destination );
|
||||
if ( ! empty( $_files ) ) {
|
||||
@ -577,12 +581,13 @@ class WP_Upgrader {
|
||||
}
|
||||
}
|
||||
|
||||
//Create destination if needed
|
||||
// Create destination if needed.
|
||||
if ( ! $wp_filesystem->exists( $remote_destination ) ) {
|
||||
if ( ! $wp_filesystem->mkdir( $remote_destination, FS_CHMOD_DIR ) ) {
|
||||
return new WP_Error( 'mkdir_failed_destination', $this->strings['mkdir_failed'], $remote_destination );
|
||||
}
|
||||
}
|
||||
|
||||
// Copy new version of item into place.
|
||||
$result = copy_dir( $source, $remote_destination );
|
||||
if ( is_wp_error( $result ) ) {
|
||||
@ -592,7 +597,7 @@ class WP_Upgrader {
|
||||
return $result;
|
||||
}
|
||||
|
||||
//Clear the Working folder?
|
||||
// Clear the working folder?
|
||||
if ( $args['clear_working'] ) {
|
||||
$wp_filesystem->delete( $remote_source, true );
|
||||
}
|
||||
@ -661,9 +666,9 @@ class WP_Upgrader {
|
||||
|
||||
$defaults = array(
|
||||
'package' => '', // Please always pass this.
|
||||
'destination' => '', // And this
|
||||
'destination' => '', // ...and this.
|
||||
'clear_destination' => false,
|
||||
'abort_if_destination_exists' => true, // Abort if the Destination directory exists, Pass clear_destination as false please
|
||||
'abort_if_destination_exists' => true, // Abort if the destination directory exists. Pass clear_destination as false please.
|
||||
'clear_working' => true,
|
||||
'is_multi' => false,
|
||||
'hook_extra' => array(), // Pass any extra $hook_extra args here, this will be passed to any hooked filters.
|
||||
@ -703,11 +708,11 @@ class WP_Upgrader {
|
||||
*/
|
||||
$options = apply_filters( 'upgrader_package_options', $options );
|
||||
|
||||
if ( ! $options['is_multi'] ) { // call $this->header separately if running multiple times
|
||||
if ( ! $options['is_multi'] ) { // Call $this->header separately if running multiple times.
|
||||
$this->skin->header();
|
||||
}
|
||||
|
||||
// Connect to the Filesystem first.
|
||||
// Connect to the filesystem first.
|
||||
$res = $this->fs_connect( array( WP_CONTENT_DIR, $options['destination'] ) );
|
||||
// Mainly for non-connected filesystem.
|
||||
if ( ! $res ) {
|
||||
@ -740,7 +745,7 @@ class WP_Upgrader {
|
||||
|
||||
// Don't output the 'no signature could be found' failure message for now.
|
||||
if ( 'signature_verification_no_signature' != $download->get_error_code() || WP_DEBUG ) {
|
||||
// Outout 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() );
|
||||
|
||||
// Report this failure back to WordPress.org for debugging purposes.
|
||||
@ -765,7 +770,7 @@ class WP_Upgrader {
|
||||
return $download;
|
||||
}
|
||||
|
||||
$delete_package = ( $download != $options['package'] ); // Do not delete a "local" file
|
||||
$delete_package = ( $download != $options['package'] ); // Do not delete a "local" file.
|
||||
|
||||
// Unzips the file into a temporary directory.
|
||||
$working_dir = $this->unpack_package( $download, $delete_package );
|
||||
@ -857,7 +862,7 @@ class WP_Upgrader {
|
||||
$file = $wp_filesystem->abspath() . '.maintenance';
|
||||
if ( $enable ) {
|
||||
$this->skin->feedback( 'maintenance_start' );
|
||||
// Create maintenance file to signal that we are upgrading
|
||||
// Create maintenance file to signal that we are upgrading.
|
||||
$maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
|
||||
$wp_filesystem->delete( $file );
|
||||
$wp_filesystem->put_contents( $file, $maintenance_string, FS_CHMOD_FILE );
|
||||
|
@ -137,7 +137,7 @@ class WP_Users_List_Table extends WP_List_Table {
|
||||
*/
|
||||
$args = apply_filters( 'users_list_table_query_args', $args );
|
||||
|
||||
// Query the user IDs for this page
|
||||
// Query the user IDs for this page.
|
||||
$wp_user_search = new WP_User_Query( $args );
|
||||
|
||||
$this->items = $wp_user_search->get_results();
|
||||
@ -389,7 +389,7 @@ class WP_Users_List_Table extends WP_List_Table {
|
||||
* @since 3.1.0
|
||||
*/
|
||||
public function display_rows() {
|
||||
// Query the post counts for this page
|
||||
// Query the post counts for this page.
|
||||
if ( ! $this->is_site_users ) {
|
||||
$post_counts = count_many_users_posts( array_keys( $this->items ) );
|
||||
}
|
||||
@ -428,7 +428,7 @@ class WP_Users_List_Table extends WP_List_Table {
|
||||
|
||||
$user_roles = $this->get_role_list( $user_object );
|
||||
|
||||
// Set up the hover actions for this user
|
||||
// Set up the hover actions for this user.
|
||||
$actions = array();
|
||||
$checkbox = '';
|
||||
$super_admin = '';
|
||||
@ -439,9 +439,9 @@ class WP_Users_List_Table extends WP_List_Table {
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the user for this row is editable
|
||||
// Check if the user for this row is editable.
|
||||
if ( current_user_can( 'list_users' ) ) {
|
||||
// Set up the user editing link
|
||||
// Set up the user editing link.
|
||||
$edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_object->ID ) ) );
|
||||
|
||||
if ( current_user_can( 'edit_user', $user_object->ID ) ) {
|
||||
@ -485,7 +485,7 @@ class WP_Users_List_Table extends WP_List_Table {
|
||||
// Role classes.
|
||||
$role_classes = esc_attr( implode( ' ', array_keys( $user_roles ) ) );
|
||||
|
||||
// Set up the checkbox ( because the user is editable, otherwise it's empty )
|
||||
// Set up the checkbox (because the user is editable, otherwise it's empty).
|
||||
$checkbox = sprintf(
|
||||
'<label class="screen-reader-text" for="user_%1$s">%2$s</label>' .
|
||||
'<input type="checkbox" name="users[]" id="user_%1$s" class="%3$s" value="%1$s" />',
|
||||
@ -514,7 +514,7 @@ class WP_Users_List_Table extends WP_List_Table {
|
||||
$classes .= ' has-row-actions column-primary';
|
||||
}
|
||||
if ( 'posts' === $column_name ) {
|
||||
$classes .= ' num'; // Special case for that column
|
||||
$classes .= ' num'; // Special case for that column.
|
||||
}
|
||||
|
||||
if ( in_array( $column_name, $hidden ) ) {
|
||||
|
@ -89,6 +89,7 @@ function edit_comment() {
|
||||
$hh = ( $hh > 23 ) ? $hh - 24 : $hh;
|
||||
$mn = ( $mn > 59 ) ? $mn - 60 : $mn;
|
||||
$ss = ( $ss > 59 ) ? $ss - 60 : $ss;
|
||||
|
||||
$_POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
* @return array|false A list of all of the contributors, or false on error.
|
||||
*/
|
||||
function wp_credits() {
|
||||
// include an unmodified $wp_version
|
||||
// Include an unmodified $wp_version.
|
||||
include( ABSPATH . WPINC . '/version.php' );
|
||||
|
||||
$locale = get_user_locale();
|
||||
|
@ -263,7 +263,7 @@ function wp_dashboard() {
|
||||
}
|
||||
|
||||
//
|
||||
// Dashboard Widgets
|
||||
// Dashboard Widgets.
|
||||
//
|
||||
|
||||
/**
|
||||
@ -1116,7 +1116,7 @@ function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = ar
|
||||
}
|
||||
|
||||
//
|
||||
// Dashboard Widgets Controls
|
||||
// Dashboard Widgets Controls.
|
||||
//
|
||||
|
||||
/**
|
||||
|
@ -1214,7 +1214,7 @@ function verify_file_signature( $filename, $signatures, $filename_for_errors = f
|
||||
// Check for a edge-case affecting PHP Maths abilities.
|
||||
if (
|
||||
! extension_loaded( 'sodium' ) &&
|
||||
in_array( PHP_VERSION_ID, [ 70200, 70201, 70202 ], true ) &&
|
||||
in_array( PHP_VERSION_ID, array( 70200, 70201, 70202 ), true ) &&
|
||||
extension_loaded( 'opcache' )
|
||||
) {
|
||||
// Sodium_Compat isn't compatible with PHP 7.2.0~7.2.2 due to a bug in the PHP Opcache extension, bail early as it'll fail.
|
||||
@ -1546,7 +1546,7 @@ function _unzip_file_ziparchive( $file, $to, $needed_dirs = array() ) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -272,8 +272,8 @@ function wp_create_image_subsizes( $file, $attachment_id ) {
|
||||
*/
|
||||
$threshold = (int) apply_filters( 'big_image_size_threshold', 2560, $imagesize, $file, $attachment_id );
|
||||
|
||||
// If the original image's dimensions are over the threshold, scale the image
|
||||
// and use it as the "full" size.
|
||||
// If the original image's dimensions are over the threshold,
|
||||
// scale the image and use it as the "full" size.
|
||||
if ( $threshold && ( $image_meta['width'] > $threshold || $image_meta['height'] > $threshold ) ) {
|
||||
$editor = wp_get_image_editor( $file );
|
||||
|
||||
@ -282,7 +282,7 @@ function wp_create_image_subsizes( $file, $attachment_id ) {
|
||||
return $image_meta;
|
||||
}
|
||||
|
||||
// Resize the image
|
||||
// Resize the image.
|
||||
$resized = $editor->resize( $threshold, $threshold );
|
||||
$rotated = null;
|
||||
|
||||
@ -305,10 +305,10 @@ function wp_create_image_subsizes( $file, $attachment_id ) {
|
||||
$image_meta['image_meta']['orientation'] = 1;
|
||||
}
|
||||
} else {
|
||||
// TODO: log errors.
|
||||
// TODO: Log errors.
|
||||
}
|
||||
} else {
|
||||
// TODO: log errors.
|
||||
// TODO: Log errors.
|
||||
}
|
||||
} elseif ( ! empty( $exif_meta['orientation'] ) && (int) $exif_meta['orientation'] !== 1 ) {
|
||||
// Rotate the whole original image if there is EXIF data and "orientation" is not 1.
|
||||
@ -335,7 +335,7 @@ function wp_create_image_subsizes( $file, $attachment_id ) {
|
||||
$image_meta['image_meta']['orientation'] = 1;
|
||||
}
|
||||
} else {
|
||||
// TODO: log errors.
|
||||
// TODO: Log errors.
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -434,7 +434,7 @@ function _wp_make_subsizes( $new_sizes, $file, $image_meta, $attachment_id ) {
|
||||
$rotated = $editor->maybe_exif_rotate();
|
||||
|
||||
if ( is_wp_error( $rotated ) ) {
|
||||
// TODO: log errors.
|
||||
// TODO: Log errors.
|
||||
}
|
||||
}
|
||||
|
||||
@ -443,7 +443,7 @@ function _wp_make_subsizes( $new_sizes, $file, $image_meta, $attachment_id ) {
|
||||
$new_size_meta = $editor->make_subsize( $new_size_data );
|
||||
|
||||
if ( is_wp_error( $new_size_meta ) ) {
|
||||
// TODO: log errors.
|
||||
// TODO: Log errors.
|
||||
} else {
|
||||
// Save the size meta value.
|
||||
$image_meta['sizes'][ $new_size_name ] = $new_size_meta;
|
||||
@ -575,7 +575,7 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) {
|
||||
if ( ! empty( $merged_sizes ) ) {
|
||||
$editor = wp_get_image_editor( $file );
|
||||
|
||||
if ( ! is_wp_error( $editor ) ) { // No support for this type of file
|
||||
if ( ! is_wp_error( $editor ) ) { // No support for this type of file.
|
||||
/*
|
||||
* PDFs may have the same file filename as JPEGs.
|
||||
* Ensure the PDF preview image does not overwrite any JPEG images that already exist.
|
||||
@ -715,18 +715,18 @@ function wp_read_image_metadata( $file ) {
|
||||
if ( ! empty( $info['APP13'] ) ) {
|
||||
$iptc = @iptcparse( $info['APP13'] );
|
||||
|
||||
// Headline, "A brief synopsis of the caption."
|
||||
// Headline, "A brief synopsis of the caption".
|
||||
if ( ! empty( $iptc['2#105'][0] ) ) {
|
||||
$meta['title'] = trim( $iptc['2#105'][0] );
|
||||
/*
|
||||
* Title, "Many use the Title field to store the filename of the image,
|
||||
* though the field may be used in many ways."
|
||||
* though the field may be used in many ways".
|
||||
*/
|
||||
} elseif ( ! empty( $iptc['2#005'][0] ) ) {
|
||||
$meta['title'] = trim( $iptc['2#005'][0] );
|
||||
}
|
||||
|
||||
if ( ! empty( $iptc['2#120'][0] ) ) { // description / legacy caption
|
||||
if ( ! empty( $iptc['2#120'][0] ) ) { // Description / legacy caption.
|
||||
$caption = trim( $iptc['2#120'][0] );
|
||||
|
||||
mbstring_binary_safe_encoding();
|
||||
|
@ -136,7 +136,8 @@ function wp_import_handle_upload() {
|
||||
* @return array Importers with metadata for each.
|
||||
*/
|
||||
function wp_get_popular_importers() {
|
||||
include( ABSPATH . WPINC . '/version.php' ); // Include an unmodified $wp_version.
|
||||
// Include an unmodified $wp_version.
|
||||
include( ABSPATH . WPINC . '/version.php' );
|
||||
|
||||
$locale = get_user_locale();
|
||||
$cache_key = 'popular_importers_' . md5( $locale . $wp_version );
|
||||
|
@ -770,7 +770,7 @@ function media_upload_form_handler() {
|
||||
if ( $image_alt != get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) ) {
|
||||
$image_alt = wp_strip_all_tags( $image_alt, true );
|
||||
|
||||
// Update_meta expects slashed.
|
||||
// update_post_meta() expects slashed.
|
||||
update_post_meta( $attachment_id, '_wp_attachment_image_alt', wp_slash( $image_alt ) );
|
||||
}
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ function wp_privacy_generate_personal_data_export_file( $request_id ) {
|
||||
}
|
||||
|
||||
$stripped_email = str_replace( '@', '-at-', $email_address );
|
||||
$stripped_email = sanitize_title( $stripped_email ); // slugify the email address
|
||||
$stripped_email = sanitize_title( $stripped_email ); // Slugify the email address.
|
||||
$obscura = wp_generate_password( 32, false, false );
|
||||
$file_basename = 'wp-personal-data-file-' . $stripped_email . '-' . $obscura;
|
||||
$html_report_filename = $file_basename . '.html';
|
||||
|
@ -55,7 +55,7 @@ function wp_get_revision_ui_diff( $post, $compare_from, $compare_to ) {
|
||||
$compare_to = $temp;
|
||||
}
|
||||
|
||||
// Add default title if title field is empty
|
||||
// Add default title if title field is empty.
|
||||
if ( $compare_from && empty( $compare_from->post_title ) ) {
|
||||
$compare_from->post_title = __( '(no title)' );
|
||||
}
|
||||
@ -340,7 +340,7 @@ function wp_prepare_revisions_for_js( $post, $selected_revision_id, $from = null
|
||||
'from' => $from,
|
||||
'diffData' => $diffs,
|
||||
'baseUrl' => parse_url( admin_url( 'revision.php' ), PHP_URL_PATH ),
|
||||
'compareTwoMode' => absint( $compare_two_mode ), // Apparently booleans are not allowed
|
||||
'compareTwoMode' => absint( $compare_two_mode ), // Apparently booleans are not allowed.
|
||||
'revisionIds' => array_keys( $revisions ),
|
||||
);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ function wp_get_db_schema( $scope = 'all', $blog_id = null ) {
|
||||
*/
|
||||
$max_index_length = 191;
|
||||
|
||||
// Blog specific tables.
|
||||
// Blog-specific tables.
|
||||
$blog_tables = "CREATE TABLE $wpdb->termmeta (
|
||||
meta_id bigint(20) unsigned NOT NULL auto_increment,
|
||||
term_id bigint(20) unsigned NOT NULL default '0',
|
||||
@ -205,7 +205,7 @@ CREATE TABLE $wpdb->posts (
|
||||
KEY user_email (user_email)
|
||||
) $charset_collate;\n";
|
||||
|
||||
// Multisite users table
|
||||
// Multisite users table.
|
||||
$users_multi_table = "CREATE TABLE $wpdb->users (
|
||||
ID bigint(20) unsigned NOT NULL auto_increment,
|
||||
user_login varchar(60) NOT NULL default '',
|
||||
@ -236,7 +236,7 @@ CREATE TABLE $wpdb->posts (
|
||||
KEY meta_key (meta_key($max_index_length))
|
||||
) $charset_collate;\n";
|
||||
|
||||
// Global tables
|
||||
// Global tables.
|
||||
if ( $is_multisite ) {
|
||||
$global_tables = $users_multi_table . $usermeta_table;
|
||||
} else {
|
||||
@ -547,7 +547,7 @@ function populate_options( array $options = array() ) {
|
||||
? $wp_current_db_version : $wp_db_version;
|
||||
}
|
||||
|
||||
// 3.0 multisite
|
||||
// 3.0 multisite.
|
||||
if ( is_multisite() ) {
|
||||
/* translators: %s: Network title. */
|
||||
$defaults['blogdescription'] = sprintf( __( 'Just another %s site' ), get_network()->site_name );
|
||||
@ -556,7 +556,7 @@ function populate_options( array $options = array() ) {
|
||||
|
||||
$options = wp_parse_args( $options, $defaults );
|
||||
|
||||
// Set autoload to no for these options
|
||||
// Set autoload to no for these options.
|
||||
$fat_options = array( 'moderation_keys', 'recently_edited', 'blacklist_keys', 'uninstall_plugins' );
|
||||
|
||||
$keys = "'" . implode( "', '", array_keys( $options ) ) . "'";
|
||||
@ -677,7 +677,7 @@ function populate_options( array $options = array() ) {
|
||||
// Delete obsolete magpie stuff.
|
||||
$wpdb->query( "DELETE FROM $wpdb->options WHERE option_name REGEXP '^rss_[0-9a-f]{32}(_ts)?$'" );
|
||||
|
||||
// Clear expired transients
|
||||
// Clear expired transients.
|
||||
delete_expired_transients( true );
|
||||
}
|
||||
|
||||
@ -703,15 +703,14 @@ function populate_roles() {
|
||||
* @since 2.0.0
|
||||
*/
|
||||
function populate_roles_160() {
|
||||
// Add roles
|
||||
|
||||
// Add roles.
|
||||
add_role( 'administrator', 'Administrator' );
|
||||
add_role( 'editor', 'Editor' );
|
||||
add_role( 'author', 'Author' );
|
||||
add_role( 'contributor', 'Contributor' );
|
||||
add_role( 'subscriber', 'Subscriber' );
|
||||
|
||||
// Add caps for Administrator role
|
||||
// Add caps for Administrator role.
|
||||
$role = get_role( 'administrator' );
|
||||
$role->add_cap( 'switch_themes' );
|
||||
$role->add_cap( 'edit_themes' );
|
||||
@ -744,7 +743,7 @@ function populate_roles_160() {
|
||||
$role->add_cap( 'level_1' );
|
||||
$role->add_cap( 'level_0' );
|
||||
|
||||
// Add caps for Editor role
|
||||
// Add caps for Editor role.
|
||||
$role = get_role( 'editor' );
|
||||
$role->add_cap( 'moderate_comments' );
|
||||
$role->add_cap( 'manage_categories' );
|
||||
@ -766,7 +765,7 @@ function populate_roles_160() {
|
||||
$role->add_cap( 'level_1' );
|
||||
$role->add_cap( 'level_0' );
|
||||
|
||||
// Add caps for Author role
|
||||
// Add caps for Author role.
|
||||
$role = get_role( 'author' );
|
||||
$role->add_cap( 'upload_files' );
|
||||
$role->add_cap( 'edit_posts' );
|
||||
@ -777,14 +776,14 @@ function populate_roles_160() {
|
||||
$role->add_cap( 'level_1' );
|
||||
$role->add_cap( 'level_0' );
|
||||
|
||||
// Add caps for Contributor role
|
||||
// Add caps for Contributor role.
|
||||
$role = get_role( 'contributor' );
|
||||
$role->add_cap( 'edit_posts' );
|
||||
$role->add_cap( 'read' );
|
||||
$role->add_cap( 'level_1' );
|
||||
$role->add_cap( 'level_0' );
|
||||
|
||||
// Add caps for Subscriber role
|
||||
// Add caps for Subscriber role.
|
||||
$role = get_role( 'subscriber' );
|
||||
$role->add_cap( 'read' );
|
||||
$role->add_cap( 'level_0' );
|
||||
@ -1244,7 +1243,7 @@ We hope you enjoy your new site. Thanks!
|
||||
'welcome_email' => $welcome_email,
|
||||
/* translators: %s: Site link. */
|
||||
'first_post' => __( 'Welcome to %s. This is your first post. Edit or delete it, then start writing!' ),
|
||||
// @todo - network admins should have a method of editing the network siteurl (used for cookie hash)
|
||||
// @todo - Network admins should have a method of editing the network siteurl (used for cookie hash).
|
||||
'siteurl' => get_option( 'siteurl' ) . '/',
|
||||
'add_new_users' => '0',
|
||||
'upload_space_check_disabled' => is_multisite() ? get_site_option( 'upload_space_check_disabled' ) : '1',
|
||||
|
@ -117,7 +117,7 @@ function meta_box_prefs( $screen ) {
|
||||
if ( false == $box || ! $box['title'] ) {
|
||||
continue;
|
||||
}
|
||||
// Submit box cannot be hidden
|
||||
// Submit box cannot be hidden.
|
||||
if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] ) {
|
||||
continue;
|
||||
}
|
||||
@ -156,7 +156,7 @@ function get_hidden_meta_boxes( $screen ) {
|
||||
|
||||
$use_defaults = ! is_array( $hidden );
|
||||
|
||||
// Hide slug boxes by default
|
||||
// Hide slug boxes by default.
|
||||
if ( $use_defaults ) {
|
||||
$hidden = array();
|
||||
if ( 'post' == $screen->base ) {
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
//
|
||||
// Category
|
||||
// Category.
|
||||
//
|
||||
|
||||
/**
|
||||
@ -192,7 +192,7 @@ function wp_update_category( $catarr ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// First, get all of the original fields
|
||||
// First, get all of the original fields.
|
||||
$category = get_term( $cat_ID, 'category', ARRAY_A );
|
||||
_make_cat_compat( $category );
|
||||
|
||||
@ -206,7 +206,7 @@ function wp_update_category( $catarr ) {
|
||||
}
|
||||
|
||||
//
|
||||
// Tags
|
||||
// Tags.
|
||||
//
|
||||
|
||||
/**
|
||||
|
@ -15,7 +15,7 @@ require_once( ABSPATH . 'wp-admin/includes/class-walker-category-checklist.php'
|
||||
require_once( ABSPATH . 'wp-admin/includes/class-wp-internal-pointers.php' );
|
||||
|
||||
//
|
||||
// Category Checklists
|
||||
// Category Checklists.
|
||||
//
|
||||
|
||||
/**
|
||||
@ -165,7 +165,8 @@ function wp_terms_checklist( $post_id = 0, $args = array() ) {
|
||||
$output = '';
|
||||
|
||||
if ( $parsed_args['checked_ontop'] ) {
|
||||
// Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
|
||||
// Post-process $categories rather than adding an exclude to the get_terms() query
|
||||
// to keep the query the same across all posts (for any query cache).
|
||||
$checked_categories = array();
|
||||
$keys = array_keys( $categories );
|
||||
|
||||
@ -176,10 +177,10 @@ function wp_terms_checklist( $post_id = 0, $args = array() ) {
|
||||
}
|
||||
}
|
||||
|
||||
// Put checked cats on top
|
||||
// Put checked categories on top.
|
||||
$output .= $walker->walk( $checked_categories, 0, $args );
|
||||
}
|
||||
// Then the rest of them
|
||||
// Then the rest of them.
|
||||
$output .= $walker->walk( $categories, 0, $args );
|
||||
|
||||
if ( $parsed_args['echo'] ) {
|
||||
@ -265,7 +266,7 @@ function wp_link_category_checklist( $link_id = 0 ) {
|
||||
|
||||
if ( $link_id ) {
|
||||
$checked_categories = wp_get_link_cats( $link_id );
|
||||
// No selected categories, strange
|
||||
// No selected categories, strange.
|
||||
if ( ! count( $checked_categories ) ) {
|
||||
$checked_categories[] = $default;
|
||||
}
|
||||
@ -559,7 +560,7 @@ function wp_comment_trashnotice() {
|
||||
* @param array $meta
|
||||
*/
|
||||
function list_meta( $meta ) {
|
||||
// Exit if no meta
|
||||
// Exit if no meta.
|
||||
if ( ! $meta ) {
|
||||
echo '
|
||||
<table id="list-table" style="display: none;">
|
||||
@ -572,7 +573,7 @@ function list_meta( $meta ) {
|
||||
<tbody id="the-list" data-wp-lists="list:meta">
|
||||
<tr><td></td></tr>
|
||||
</tbody>
|
||||
</table>'; //TBODY needed for list-manipulation JS
|
||||
</table>'; // TBODY needed for list-manipulation JS.
|
||||
return;
|
||||
}
|
||||
$count = 0;
|
||||
@ -632,7 +633,7 @@ function _list_meta_row( $entry, &$count ) {
|
||||
}
|
||||
|
||||
$entry['meta_key'] = esc_attr( $entry['meta_key'] );
|
||||
$entry['meta_value'] = esc_textarea( $entry['meta_value'] ); // using a <textarea />
|
||||
$entry['meta_value'] = esc_textarea( $entry['meta_value'] ); // Using a <textarea />.
|
||||
$entry['meta_id'] = (int) $entry['meta_id'];
|
||||
|
||||
$delete_nonce = wp_create_nonce( 'delete-meta_' . $entry['meta_id'] );
|
||||
@ -790,7 +791,7 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
|
||||
$tab_index_attribute = " tabindex=\"$tab_index\"";
|
||||
}
|
||||
|
||||
// todo: Remove this?
|
||||
// @todo Remove this?
|
||||
// echo '<label for="timestamp" style="display: block;"><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> '.__( 'Edit timestamp' ).'</label><br />';
|
||||
|
||||
$post_date = ( $for_post ) ? $post->post_date : get_comment()->comment_date;
|
||||
@ -925,7 +926,7 @@ function wp_dropdown_roles( $selected = '' ) {
|
||||
|
||||
foreach ( $editable_roles as $role => $details ) {
|
||||
$name = translate_user_role( $details['name'] );
|
||||
// preselect specified role
|
||||
// Preselect specified role.
|
||||
if ( $selected == $role ) {
|
||||
$r .= "\n\t<option selected='selected' value='" . esc_attr( $role ) . "'>$name</option>";
|
||||
} else {
|
||||
@ -1052,7 +1053,7 @@ function add_meta_box( $id, $title, $callback, $screen = null, $context = 'advan
|
||||
|
||||
// If a core box was previously added or removed by a plugin, don't add.
|
||||
if ( 'core' == $priority ) {
|
||||
// If core box previously deleted, don't add
|
||||
// If core box previously deleted, don't add.
|
||||
if ( false === $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] ) {
|
||||
return;
|
||||
}
|
||||
@ -1067,7 +1068,7 @@ function add_meta_box( $id, $title, $callback, $screen = null, $context = 'advan
|
||||
}
|
||||
return;
|
||||
}
|
||||
// If no priority given and id already present, use existing priority.
|
||||
// If no priority given and ID already present, use existing priority.
|
||||
if ( empty( $priority ) ) {
|
||||
$priority = $a_priority;
|
||||
/*
|
||||
@ -1079,7 +1080,7 @@ function add_meta_box( $id, $title, $callback, $screen = null, $context = 'advan
|
||||
$callback = $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]['callback'];
|
||||
$callback_args = $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]['args'];
|
||||
}
|
||||
// An id can be in only one priority and one context.
|
||||
// An ID can be in only one priority and one context.
|
||||
if ( $priority != $a_priority || $context != $a_context ) {
|
||||
unset( $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] );
|
||||
}
|
||||
@ -1245,7 +1246,8 @@ function do_meta_boxes( $screen, $context, $object ) {
|
||||
|
||||
printf( '<div id="%s-sortables" class="meta-box-sortables">', esc_attr( $context ) );
|
||||
|
||||
// Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
|
||||
// Grab the ones the user has manually sorted.
|
||||
// Pull them out of their previous context/priority and into the one the user chose.
|
||||
$sorted = get_user_option( "meta-box-order_$page" );
|
||||
if ( ! $already_sorted && $sorted ) {
|
||||
foreach ( $sorted as $box_context => $ids ) {
|
||||
@ -2192,12 +2194,12 @@ function _media_states( $post ) {
|
||||
} else {
|
||||
$header_image = get_header_image();
|
||||
|
||||
// Display "Header Image" if the image was ever used as a header image
|
||||
// Display "Header Image" if the image was ever used as a header image.
|
||||
if ( ! empty( $meta_header ) && $meta_header == $stylesheet && $header_image !== wp_get_attachment_url( $post->ID ) ) {
|
||||
$media_states[] = __( 'Header Image' );
|
||||
}
|
||||
|
||||
// Display "Current Header Image" if the image is currently the header image
|
||||
// Display "Current Header Image" if the image is currently the header image.
|
||||
if ( $header_image && $header_image == wp_get_attachment_url( $post->ID ) ) {
|
||||
$media_states[] = __( 'Current Header Image' );
|
||||
}
|
||||
@ -2378,7 +2380,7 @@ function get_submit_button( $text = '', $type = 'primary large', $name = 'submit
|
||||
|
||||
$text = $text ? $text : __( 'Save Changes' );
|
||||
|
||||
// Default the id attribute to $name unless an id was specifically provided in $other_attributes
|
||||
// Default the id attribute to $name unless an id was specifically provided in $other_attributes.
|
||||
$id = $name;
|
||||
if ( is_array( $other_attributes ) && isset( $other_attributes['id'] ) ) {
|
||||
$id = $other_attributes['id'];
|
||||
@ -2388,9 +2390,9 @@ function get_submit_button( $text = '', $type = 'primary large', $name = 'submit
|
||||
$attributes = '';
|
||||
if ( is_array( $other_attributes ) ) {
|
||||
foreach ( $other_attributes as $attribute => $value ) {
|
||||
$attributes .= $attribute . '="' . esc_attr( $value ) . '" '; // Trailing space is important
|
||||
$attributes .= $attribute . '="' . esc_attr( $value ) . '" '; // Trailing space is important.
|
||||
}
|
||||
} elseif ( ! empty( $other_attributes ) ) { // Attributes provided as a string
|
||||
} elseif ( ! empty( $other_attributes ) ) { // Attributes provided as a string.
|
||||
$attributes = $other_attributes;
|
||||
}
|
||||
|
||||
@ -2533,15 +2535,15 @@ function wp_star_rating( $args = array() ) {
|
||||
);
|
||||
$parsed_args = wp_parse_args( $args, $defaults );
|
||||
|
||||
// Non-English decimal places when the $rating is coming from a string
|
||||
// Non-English decimal places when the $rating is coming from a string.
|
||||
$rating = (float) str_replace( ',', '.', $parsed_args['rating'] );
|
||||
|
||||
// Convert Percentage to star rating, 0..5 in .5 increments
|
||||
// Convert percentage to star rating, 0..5 in .5 increments.
|
||||
if ( 'percent' === $parsed_args['type'] ) {
|
||||
$rating = round( $rating / 10, 0 ) / 2;
|
||||
}
|
||||
|
||||
// Calculate the number of each type of star needed
|
||||
// Calculate the number of each type of star needed.
|
||||
$full_stars = floor( $rating );
|
||||
$half_stars = ceil( $rating - $full_stars );
|
||||
$empty_stars = 5 - $full_stars - $half_stars;
|
||||
|
@ -45,7 +45,8 @@ function delete_theme( $stylesheet, $redirect = '' ) {
|
||||
|
||||
if ( ! WP_Filesystem( $credentials ) ) {
|
||||
ob_start();
|
||||
request_filesystem_credentials( $redirect, '', true ); // Failed to connect, Error and request again.
|
||||
// Failed to connect. Error and request again.
|
||||
request_filesystem_credentials( $redirect, '', true );
|
||||
$data = ob_get_clean();
|
||||
|
||||
if ( ! empty( $data ) ) {
|
||||
@ -194,7 +195,7 @@ function get_theme_update_available( $theme ) {
|
||||
'height' => 800,
|
||||
),
|
||||
$update['url']
|
||||
); //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list.
|
||||
); // Theme browser inside WP? Replace this. Also, theme preview JS will override this on the available list.
|
||||
$update_url = wp_nonce_url( admin_url( 'update.php?action=upgrade-theme&theme=' . urlencode( $stylesheet ) ), 'upgrade-theme_' . $stylesheet );
|
||||
|
||||
if ( ! is_multisite() ) {
|
||||
@ -260,7 +261,7 @@ function get_theme_update_available( $theme ) {
|
||||
* @return array Array of features keyed by category with translations keyed by slug.
|
||||
*/
|
||||
function get_theme_feature_list( $api = true ) {
|
||||
// Hard-coded list is used if api not accessible.
|
||||
// Hard-coded list is used if API is not accessible.
|
||||
$features = array(
|
||||
|
||||
__( 'Subject' ) => array(
|
||||
@ -331,7 +332,7 @@ function get_theme_feature_list( $api = true ) {
|
||||
'Subject' => __( 'Subject' ),
|
||||
);
|
||||
|
||||
// Loop over the wporg canonical list and apply translations
|
||||
// Loop over the wp.org canonical list and apply translations.
|
||||
$wporg_features = array();
|
||||
foreach ( (array) $feature_list as $feature_category => $feature_items ) {
|
||||
if ( isset( $category_translations[ $feature_category ] ) ) {
|
||||
@ -433,7 +434,7 @@ function get_theme_feature_list( $api = true ) {
|
||||
* for more information on the make-up of possible return objects depending on the value of `$action`.
|
||||
*/
|
||||
function themes_api( $action, $args = array() ) {
|
||||
// include an unmodified $wp_version
|
||||
// Include an unmodified $wp_version.
|
||||
include( ABSPATH . WPINC . '/version.php' );
|
||||
|
||||
if ( is_array( $args ) ) {
|
||||
@ -451,7 +452,7 @@ function themes_api( $action, $args = array() ) {
|
||||
}
|
||||
|
||||
if ( ! isset( $args->wp_version ) ) {
|
||||
$args->wp_version = substr( $wp_version, 0, 3 ); // X.y
|
||||
$args->wp_version = substr( $wp_version, 0, 3 ); // x.y
|
||||
}
|
||||
|
||||
/**
|
||||
@ -655,7 +656,7 @@ function wp_prepare_themes_for_js( $themes = null ) {
|
||||
$prepared_themes[ $slug ] = array(
|
||||
'id' => $slug,
|
||||
'name' => $theme->display( 'Name' ),
|
||||
'screenshot' => array( $theme->get_screenshot() ), // @todo multiple
|
||||
'screenshot' => array( $theme->get_screenshot() ), // @todo Multiple screenshots.
|
||||
'description' => $theme->display( 'Description' ),
|
||||
'author' => $theme->display( 'Author', false, true ),
|
||||
'authorAndUri' => $theme->display( 'Author' ),
|
||||
@ -674,7 +675,7 @@ function wp_prepare_themes_for_js( $themes = null ) {
|
||||
);
|
||||
}
|
||||
|
||||
// Remove 'delete' action if theme has an active child
|
||||
// Remove 'delete' action if theme has an active child.
|
||||
if ( ! empty( $parents ) && array_key_exists( $current_theme, $parents ) ) {
|
||||
unset( $prepared_themes[ $parents[ $current_theme ] ]['actions']['delete'] );
|
||||
}
|
||||
|
@ -17,7 +17,8 @@
|
||||
* @return object|WP_Error On success an object of translations, WP_Error on failure.
|
||||
*/
|
||||
function translations_api( $type, $args = null ) {
|
||||
include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
|
||||
// Include an unmodified $wp_version.
|
||||
include( ABSPATH . WPINC . '/version.php' );
|
||||
|
||||
if ( ! in_array( $type, array( 'plugins', 'themes', 'core' ) ) ) {
|
||||
return new WP_Error( 'invalid_type', __( 'Invalid translation type.' ) );
|
||||
@ -47,12 +48,12 @@ function translations_api( $type, $args = null ) {
|
||||
'body' => array(
|
||||
'wp_version' => $wp_version,
|
||||
'locale' => get_locale(),
|
||||
'version' => $args['version'], // Version of plugin, theme or core
|
||||
'version' => $args['version'], // Version of plugin, theme or core.
|
||||
),
|
||||
);
|
||||
|
||||
if ( 'core' !== $type ) {
|
||||
$options['body']['slug'] = $args['slug']; // Plugin or theme slug
|
||||
$options['body']['slug'] = $args['slug']; // Plugin or theme slug.
|
||||
}
|
||||
|
||||
$request = wp_remote_post( $url, $options );
|
||||
@ -126,7 +127,8 @@ function wp_get_available_translations() {
|
||||
}
|
||||
}
|
||||
|
||||
include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
|
||||
// Include an unmodified $wp_version.
|
||||
include( ABSPATH . WPINC . '/version.php' );
|
||||
|
||||
$api = translations_api( 'core', array( 'version' => $wp_version ) );
|
||||
|
||||
|
@ -253,7 +253,7 @@ $_old_files = array(
|
||||
'wp-includes/js/jquery/autocomplete.js',
|
||||
'wp-includes/js/jquery/interface.js',
|
||||
'wp-includes/js/scriptaculous/prototype.js',
|
||||
// Following file added back in 5.1 see #45645
|
||||
// Following file added back in 5.1, see #45645.
|
||||
//'wp-includes/js/tinymce/wp-tinymce.js',
|
||||
// 3.1
|
||||
'wp-admin/edit-attachment-rows.php',
|
||||
@ -536,7 +536,7 @@ $_old_files = array(
|
||||
'wp-admin/images/screenshots/twitter-embed-1.png',
|
||||
'wp-admin/images/screenshots/twitter-embed-2.png',
|
||||
'wp-admin/js/utils.js',
|
||||
// Added back in 5.3 [45448], see #43895
|
||||
// Added back in 5.3 [45448], see #43895.
|
||||
// 'wp-admin/options-privacy.php',
|
||||
'wp-app.php',
|
||||
'wp-includes/class-wp-atom-server.php',
|
||||
@ -600,7 +600,7 @@ $_old_files = array(
|
||||
'wp-admin/css/colors.min.css',
|
||||
'wp-admin/css/colors-rtl.css',
|
||||
'wp-admin/css/colors-rtl.min.css',
|
||||
// Following files added back in 4.5 see #36083
|
||||
// Following files added back in 4.5, see #36083.
|
||||
// 'wp-admin/css/media-rtl.min.css',
|
||||
// 'wp-admin/css/media.min.css',
|
||||
// 'wp-admin/css/farbtastic-rtl.min.css',
|
||||
@ -615,7 +615,7 @@ $_old_files = array(
|
||||
'wp-includes/js/plupload/changelog.txt',
|
||||
'wp-includes/js/plupload/plupload.silverlight.js',
|
||||
'wp-includes/js/plupload/plupload.flash.js',
|
||||
// Added back in 4.9 [41328], see #41755
|
||||
// Added back in 4.9 [41328], see #41755.
|
||||
// 'wp-includes/js/plupload/plupload.js',
|
||||
'wp-includes/js/tinymce/plugins/spellchecker',
|
||||
'wp-includes/js/tinymce/plugins/inlinepopups',
|
||||
@ -938,8 +938,8 @@ function update_core( $from, $to ) {
|
||||
|
||||
$php_version = phpversion();
|
||||
$mysql_version = $wpdb->db_version();
|
||||
$old_wp_version = $GLOBALS['wp_version']; // The version of WordPress we're updating from
|
||||
$development_build = ( false !== strpos( $old_wp_version . $wp_version, '-' ) ); // a dash in the version indicates a Development release
|
||||
$old_wp_version = $GLOBALS['wp_version']; // The version of WordPress we're updating from.
|
||||
$development_build = ( false !== strpos( $old_wp_version . $wp_version, '-' ) ); // A dash in the version indicates a development release.
|
||||
$php_compat = version_compare( $php_version, $required_php_version, '>=' );
|
||||
if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) {
|
||||
$mysql_compat = true;
|
||||
@ -1017,19 +1017,19 @@ function update_core( $from, $to ) {
|
||||
/** This filter is documented in wp-admin/includes/update-core.php */
|
||||
apply_filters( 'update_feedback', __( 'Preparing to install the latest version…' ) );
|
||||
|
||||
// Don't copy wp-content, we'll deal with that below
|
||||
// We also copy version.php last so failed updates report their old version
|
||||
// Don't copy wp-content, we'll deal with that below.
|
||||
// We also copy version.php last so failed updates report their old version.
|
||||
$skip = array( 'wp-content', 'wp-includes/version.php' );
|
||||
$check_is_writable = array();
|
||||
|
||||
// Check to see which files don't really need updating - only available for 3.7 and higher
|
||||
// Check to see which files don't really need updating - only available for 3.7 and higher.
|
||||
if ( function_exists( 'get_core_checksums' ) ) {
|
||||
// Find the local version of the working directory
|
||||
// Find the local version of the working directory.
|
||||
$working_dir_local = WP_CONTENT_DIR . '/upgrade/' . basename( $from ) . $distro;
|
||||
|
||||
$checksums = get_core_checksums( $wp_version, isset( $wp_local_package ) ? $wp_local_package : 'en_US' );
|
||||
if ( is_array( $checksums ) && isset( $checksums[ $wp_version ] ) ) {
|
||||
$checksums = $checksums[ $wp_version ]; // Compat code for 3.7-beta2
|
||||
$checksums = $checksums[ $wp_version ]; // Compat code for 3.7-beta2.
|
||||
}
|
||||
if ( is_array( $checksums ) ) {
|
||||
foreach ( $checksums as $file => $checksum ) {
|
||||
@ -1078,7 +1078,7 @@ function update_core( $from, $to ) {
|
||||
|
||||
/** This filter is documented in wp-admin/includes/update-core.php */
|
||||
apply_filters( 'update_feedback', __( 'Enabling Maintenance mode…' ) );
|
||||
// Create maintenance file to signal that we are upgrading
|
||||
// Create maintenance file to signal that we are upgrading.
|
||||
$maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
|
||||
$maintenance_file = $to . '.maintenance';
|
||||
$wp_filesystem->delete( $maintenance_file );
|
||||
@ -1092,7 +1092,7 @@ function update_core( $from, $to ) {
|
||||
$result = new WP_Error( $result->get_error_code(), $result->get_error_message(), substr( $result->get_error_data(), strlen( $to ) ) );
|
||||
}
|
||||
|
||||
// Since we know the core files have copied over, we can now copy the version file
|
||||
// Since we know the core files have copied over, we can now copy the version file.
|
||||
if ( ! is_wp_error( $result ) ) {
|
||||
if ( ! $wp_filesystem->copy( $from . $distro . 'wp-includes/version.php', $to . 'wp-includes/version.php', true /* overwrite */ ) ) {
|
||||
$wp_filesystem->delete( $from, true );
|
||||
@ -1101,7 +1101,7 @@ function update_core( $from, $to ) {
|
||||
$wp_filesystem->chmod( $to . 'wp-includes/version.php', FS_CHMOD_FILE );
|
||||
}
|
||||
|
||||
// Check to make sure everything copied correctly, ignoring the contents of wp-content
|
||||
// Check to make sure everything copied correctly, ignoring the contents of wp-content.
|
||||
$skip = array( 'wp-content' );
|
||||
$failed = array();
|
||||
if ( isset( $checksums ) && is_array( $checksums ) ) {
|
||||
@ -1124,7 +1124,7 @@ function update_core( $from, $to ) {
|
||||
}
|
||||
}
|
||||
|
||||
// Some files didn't copy properly
|
||||
// Some files didn't copy properly.
|
||||
if ( ! empty( $failed ) ) {
|
||||
$total_size = 0;
|
||||
foreach ( $failed as $file ) {
|
||||
@ -1146,8 +1146,8 @@ function update_core( $from, $to ) {
|
||||
}
|
||||
}
|
||||
|
||||
// Custom Content Directory needs updating now.
|
||||
// Copy Languages
|
||||
// Custom content directory needs updating now.
|
||||
// Copy languages.
|
||||
if ( ! is_wp_error( $result ) && $wp_filesystem->is_dir( $from . $distro . 'wp-content/languages' ) ) {
|
||||
if ( WP_LANG_DIR != ABSPATH . WPINC . '/languages' || @is_dir( WP_LANG_DIR ) ) {
|
||||
$lang_dir = WP_LANG_DIR;
|
||||
@ -1155,9 +1155,11 @@ function update_core( $from, $to ) {
|
||||
$lang_dir = WP_CONTENT_DIR . '/languages';
|
||||
}
|
||||
|
||||
if ( ! @is_dir( $lang_dir ) && 0 === strpos( $lang_dir, ABSPATH ) ) { // Check the language directory exists first
|
||||
$wp_filesystem->mkdir( $to . str_replace( ABSPATH, '', $lang_dir ), FS_CHMOD_DIR ); // If it's within the ABSPATH we can handle it here, otherwise they're out of luck.
|
||||
clearstatcache(); // for FTP, Need to clear the stat cache
|
||||
// Check if the language directory exists first.
|
||||
if ( ! @is_dir( $lang_dir ) && 0 === strpos( $lang_dir, ABSPATH ) ) {
|
||||
// If it's within the ABSPATH we can handle it here, otherwise they're out of luck.
|
||||
$wp_filesystem->mkdir( $to . str_replace( ABSPATH, '', $lang_dir ), FS_CHMOD_DIR );
|
||||
clearstatcache(); // For FTP, need to clear the stat cache.
|
||||
}
|
||||
|
||||
if ( @is_dir( $lang_dir ) ) {
|
||||
@ -1173,7 +1175,7 @@ function update_core( $from, $to ) {
|
||||
|
||||
/** This filter is documented in wp-admin/includes/update-core.php */
|
||||
apply_filters( 'update_feedback', __( 'Disabling Maintenance mode…' ) );
|
||||
// Remove maintenance file, we're done with potential site-breaking changes
|
||||
// Remove maintenance file, we're done with potential site-breaking changes.
|
||||
$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.
|
||||
@ -1183,17 +1185,20 @@ function update_core( $from, $to ) {
|
||||
}
|
||||
}
|
||||
|
||||
// Copy New bundled plugins & themes
|
||||
// This gives us the ability to install new plugins & themes bundled with future versions of WordPress whilst avoiding the re-install upon upgrade issue.
|
||||
// $development_build controls us overwriting bundled themes and plugins when a non-stable release is being updated
|
||||
/*
|
||||
* Copy new bundled plugins & themes.
|
||||
* This gives us the ability to install new plugins & themes bundled with
|
||||
* future versions of WordPress whilst avoiding the re-install upon upgrade issue.
|
||||
* $development_build controls us overwriting bundled themes and plugins when a non-stable release is being updated.
|
||||
*/
|
||||
if ( ! is_wp_error( $result ) && ( ! defined( 'CORE_UPGRADE_SKIP_NEW_BUNDLED' ) || ! CORE_UPGRADE_SKIP_NEW_BUNDLED ) ) {
|
||||
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, '>' ) ) {
|
||||
$directory = ( '/' == $file[ strlen( $file ) - 1 ] );
|
||||
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 ) ) {
|
||||
continue;
|
||||
}
|
||||
@ -1201,7 +1206,8 @@ function update_core( $from, $to ) {
|
||||
if ( 'plugins' == $type ) {
|
||||
$dest = $wp_filesystem->wp_plugins_dir();
|
||||
} elseif ( 'themes' == $type ) {
|
||||
$dest = trailingslashit( $wp_filesystem->wp_themes_dir() ); // 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() );
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
@ -1231,16 +1237,16 @@ function update_core( $from, $to ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} //end foreach
|
||||
} // End foreach.
|
||||
}
|
||||
|
||||
// Handle $result error from the above blocks
|
||||
// Handle $result error from the above blocks.
|
||||
if ( is_wp_error( $result ) ) {
|
||||
$wp_filesystem->delete( $from, true );
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Remove old files
|
||||
// Remove old files.
|
||||
foreach ( $_old_files as $old_file ) {
|
||||
$old_file = $to . $old_file;
|
||||
if ( ! $wp_filesystem->exists( $old_file ) ) {
|
||||
@ -1253,27 +1259,27 @@ function update_core( $from, $to ) {
|
||||
}
|
||||
}
|
||||
|
||||
// Remove any Genericons example.html's from the filesystem
|
||||
// Remove any Genericons example.html's from the filesystem.
|
||||
_upgrade_422_remove_genericons();
|
||||
|
||||
// Remove the REST API plugin if its version is Beta 4 or lower
|
||||
// Remove the REST API plugin if its version is Beta 4 or lower.
|
||||
_upgrade_440_force_deactivate_incompatible_plugins();
|
||||
|
||||
// Upgrade DB with separate request
|
||||
// Upgrade DB with separate request.
|
||||
/** This filter is documented in wp-admin/includes/update-core.php */
|
||||
apply_filters( 'update_feedback', __( 'Upgrading database…' ) );
|
||||
$db_upgrade_url = admin_url( 'upgrade.php?step=upgrade_db' );
|
||||
wp_remote_post( $db_upgrade_url, array( 'timeout' => 60 ) );
|
||||
|
||||
// Clear the cache to prevent an update_option() from saving a stale db_version to the cache
|
||||
// Clear the cache to prevent an update_option() from saving a stale db_version to the cache.
|
||||
wp_cache_flush();
|
||||
// (Not all cache back ends listen to 'flush')
|
||||
// Not all cache back ends listen to 'flush'.
|
||||
wp_cache_delete( 'alloptions', 'options' );
|
||||
|
||||
// Remove working directory
|
||||
// Remove working directory.
|
||||
$wp_filesystem->delete( $from, true );
|
||||
|
||||
// Force refresh of update information
|
||||
// Force refresh of update information.
|
||||
if ( function_exists( 'delete_site_transient' ) ) {
|
||||
delete_site_transient( 'update_core' );
|
||||
} else {
|
||||
@ -1396,7 +1402,7 @@ function _redirect_to_about_wordpress( $new_version ) {
|
||||
// Load the updated default text localization domain for new strings.
|
||||
load_default_textdomain();
|
||||
|
||||
// See do_core_upgrade()
|
||||
// See do_core_upgrade().
|
||||
show_message( __( 'WordPress updated successfully' ) );
|
||||
|
||||
// self_admin_url() won't exist when upgrading from <= 3.0, so relative URLs are intentional.
|
||||
@ -1442,13 +1448,13 @@ function _upgrade_422_remove_genericons() {
|
||||
// A list of the affected files using the filesystem absolute paths.
|
||||
$affected_files = array();
|
||||
|
||||
// Themes
|
||||
// Themes.
|
||||
foreach ( $wp_theme_directories as $directory ) {
|
||||
$affected_theme_files = _upgrade_422_find_genericons_files_in_folder( $directory );
|
||||
$affected_files = array_merge( $affected_files, $affected_theme_files );
|
||||
}
|
||||
|
||||
// Plugins
|
||||
// Plugins.
|
||||
$affected_plugin_files = _upgrade_422_find_genericons_files_in_folder( WP_PLUGIN_DIR );
|
||||
$affected_files = array_merge( $affected_files, $affected_plugin_files );
|
||||
|
||||
@ -1458,7 +1464,7 @@ function _upgrade_422_remove_genericons() {
|
||||
continue;
|
||||
}
|
||||
|
||||
// The path when the file is accessed via WP_Filesystem may differ in the case of FTP
|
||||
// The path when the file is accessed via WP_Filesystem may differ in the case of FTP.
|
||||
$remote_file = $gen_dir . basename( $file );
|
||||
|
||||
if ( ! $wp_filesystem->exists( $remote_file ) ) {
|
||||
|
@ -723,7 +723,8 @@ function wp_theme_update_row( $theme_key, $theme ) {
|
||||
* @return void|false
|
||||
*/
|
||||
function maintenance_nag() {
|
||||
include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
|
||||
// Include an unmodified $wp_version.
|
||||
include( ABSPATH . WPINC . '/version.php' );
|
||||
global $upgrading;
|
||||
$nag = isset( $upgrading );
|
||||
if ( ! $nag ) {
|
||||
|
@ -154,7 +154,7 @@ if ( ! function_exists( 'wp_install_defaults' ) ) :
|
||||
function wp_install_defaults( $user_id ) {
|
||||
global $wpdb, $wp_rewrite, $table_prefix;
|
||||
|
||||
// Default category
|
||||
// Default category.
|
||||
$cat_name = __( 'Uncategorized' );
|
||||
/* translators: Default category slug. */
|
||||
$cat_slug = sanitize_title( _x( 'Uncategorized', 'Default category slug' ) );
|
||||
@ -199,7 +199,7 @@ if ( ! function_exists( 'wp_install_defaults' ) ) :
|
||||
);
|
||||
$cat_tt_id = $wpdb->insert_id;
|
||||
|
||||
// First post
|
||||
// First post.
|
||||
$now = current_time( 'mysql' );
|
||||
$now_gmt = current_time( 'mysql', 1 );
|
||||
$first_post_guid = get_option( 'home' ) . '/?p=1';
|
||||
@ -219,7 +219,7 @@ if ( ! function_exists( 'wp_install_defaults' ) ) :
|
||||
sprintf( '<a href="%s">%s</a>', esc_url( network_home_url() ), get_network()->site_name )
|
||||
);
|
||||
|
||||
// Back-compat for pre-4.4
|
||||
// Back-compat for pre-4.4.
|
||||
$first_post = str_replace( 'SITE_URL', esc_url( network_home_url() ), $first_post );
|
||||
$first_post = str_replace( 'SITE_NAME', get_network()->site_name, $first_post );
|
||||
} else {
|
||||
@ -257,7 +257,7 @@ if ( ! function_exists( 'wp_install_defaults' ) ) :
|
||||
)
|
||||
);
|
||||
|
||||
// Default comment
|
||||
// Default comment.
|
||||
if ( is_multisite() ) {
|
||||
$first_comment_author = get_site_option( 'first_comment_author' );
|
||||
$first_comment_email = get_site_option( 'first_comment_email' );
|
||||
@ -286,7 +286,7 @@ Commenter avatars come from <a href="https://gravatar.com">Gravatar</a>.'
|
||||
)
|
||||
);
|
||||
|
||||
// First Page
|
||||
// First page.
|
||||
if ( is_multisite() ) {
|
||||
$first_page = get_site_option( 'first_page' );
|
||||
}
|
||||
@ -352,7 +352,7 @@ Commenter avatars come from <a href="https://gravatar.com">Gravatar</a>.'
|
||||
)
|
||||
);
|
||||
|
||||
// Privacy Policy page
|
||||
// Privacy Policy page.
|
||||
if ( is_multisite() ) {
|
||||
// Disable by default unless the suggested content is provided.
|
||||
$privacy_policy_content = get_site_option( 'default_privacy_policy_content' );
|
||||
@ -493,7 +493,8 @@ Commenter avatars come from <a href="https://gravatar.com">Gravatar</a>.'
|
||||
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix . 'user_level' ) );
|
||||
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix . 'capabilities' ) );
|
||||
|
||||
// Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.) TODO: Get previous_blog_id.
|
||||
// Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.)
|
||||
// TODO: Get previous_blog_id.
|
||||
if ( ! is_super_admin( $user_id ) && $user_id != 1 ) {
|
||||
$wpdb->delete(
|
||||
$wpdb->usermeta,
|
||||
@ -550,7 +551,7 @@ function wp_install_maybe_enable_pretty_permalinks() {
|
||||
|
||||
$test_url = '';
|
||||
|
||||
// Test against a real WordPress Post
|
||||
// Test against a real WordPress post.
|
||||
$first_post = get_page_by_path( sanitize_title( _x( 'hello-world', 'Default post slug' ) ), OBJECT, 'post' );
|
||||
if ( $first_post ) {
|
||||
$test_url = get_permalink( $first_post->ID );
|
||||
@ -852,7 +853,7 @@ function upgrade_all() {
|
||||
function upgrade_100() {
|
||||
global $wpdb;
|
||||
|
||||
// Get the title and ID of every post, post_name to check if it already has a value
|
||||
// Get the title and ID of every post, post_name to check if it already has a value.
|
||||
$posts = $wpdb->get_results( "SELECT ID, post_title, post_name FROM $wpdb->posts WHERE post_name = ''" );
|
||||
if ( $posts ) {
|
||||
foreach ( $posts as $post ) {
|
||||
@ -891,9 +892,9 @@ function upgrade_100() {
|
||||
$allposts = $wpdb->get_results( "SELECT ID, post_category FROM $wpdb->posts WHERE post_category != '0' $catwhere" );
|
||||
if ( $allposts ) :
|
||||
foreach ( $allposts as $post ) {
|
||||
// Check to see if it's already been imported
|
||||
// Check to see if it's already been imported.
|
||||
$cat = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->post2cat WHERE post_id = %d AND category_id = %d", $post->ID, $post->post_category ) );
|
||||
if ( ! $cat && 0 != $post->post_category ) { // If there's no result
|
||||
if ( ! $cat && 0 != $post->post_category ) { // If there's no result.
|
||||
$wpdb->insert(
|
||||
$wpdb->post2cat,
|
||||
array(
|
||||
@ -917,7 +918,7 @@ function upgrade_100() {
|
||||
function upgrade_101() {
|
||||
global $wpdb;
|
||||
|
||||
// Clean up indices, add a few
|
||||
// Clean up indices, add a few.
|
||||
add_clean_index( $wpdb->posts, 'post_name' );
|
||||
add_clean_index( $wpdb->posts, 'post_status' );
|
||||
add_clean_index( $wpdb->categories, 'category_nicename' );
|
||||
@ -954,7 +955,7 @@ function upgrade_110() {
|
||||
}
|
||||
}
|
||||
|
||||
// Get the GMT offset, we'll use that later on
|
||||
// Get the GMT offset, we'll use that later on.
|
||||
$all_options = get_alloptions_110();
|
||||
|
||||
$time_difference = $all_options->time_difference;
|
||||
@ -968,17 +969,19 @@ function upgrade_110() {
|
||||
$diff_gmt_weblogger = $diff_gmt_server - $diff_weblogger_server;
|
||||
$gmt_offset = -$diff_gmt_weblogger;
|
||||
|
||||
// Add a gmt_offset option, with value $gmt_offset
|
||||
// Add a gmt_offset option, with value $gmt_offset.
|
||||
add_option( 'gmt_offset', $gmt_offset );
|
||||
|
||||
// Check if we already set the GMT fields (if we did, then
|
||||
// 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
|
||||
/*
|
||||
* Check if we already set the GMT fields. If we did, then
|
||||
* 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.
|
||||
*/
|
||||
$got_gmt_fields = ! ( $wpdb->get_var( "SELECT MAX(post_date_gmt) FROM $wpdb->posts" ) == '0000-00-00 00:00:00' );
|
||||
|
||||
if ( ! $got_gmt_fields ) {
|
||||
|
||||
// Add or subtract time to all dates, to get GMT dates
|
||||
// Add or subtract time to all dates, to get GMT dates.
|
||||
$add_hours = intval( $diff_gmt_weblogger );
|
||||
$add_minutes = intval( 60 * ( $diff_gmt_weblogger - $add_hours ) );
|
||||
$wpdb->query( "UPDATE $wpdb->posts SET post_date_gmt = DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)" );
|
||||
@ -1052,17 +1055,17 @@ function upgrade_130() {
|
||||
update_option( 'active_plugins', $active_plugins );
|
||||
}
|
||||
|
||||
// Obsolete tables
|
||||
// Obsolete tables.
|
||||
$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optionvalues' );
|
||||
$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiontypes' );
|
||||
$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiongroups' );
|
||||
$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiongroup_options' );
|
||||
|
||||
// Update comments table to use comment_type
|
||||
// Update comments table to use comment_type.
|
||||
$wpdb->query( "UPDATE $wpdb->comments SET comment_type='trackback', comment_content = REPLACE(comment_content, '<trackback />', '') WHERE comment_content LIKE '<trackback />%'" );
|
||||
$wpdb->query( "UPDATE $wpdb->comments SET comment_type='pingback', comment_content = REPLACE(comment_content, '<pingback />', '') WHERE comment_content LIKE '<pingback />%'" );
|
||||
|
||||
// Some versions have multiple duplicate option_name rows with the same values
|
||||
// Some versions have multiple duplicate option_name rows with the same values.
|
||||
$options = $wpdb->get_results( "SELECT option_name, COUNT(option_name) AS dupes FROM `$wpdb->options` GROUP BY option_name" );
|
||||
foreach ( $options as $option ) {
|
||||
if ( 1 != $option->dupes ) { // Could this be done in the query?
|
||||
@ -1370,7 +1373,7 @@ function upgrade_230() {
|
||||
if ( $wp_current_db_version < 3570 ) {
|
||||
/*
|
||||
* Create link_category terms for link categories. Create a map of link
|
||||
* cat IDs to link_category terms.
|
||||
* category IDs to link_category terms.
|
||||
*/
|
||||
$link_cat_id_map = array();
|
||||
$default_link_cat = 0;
|
||||
@ -1411,7 +1414,7 @@ function upgrade_230() {
|
||||
$tt_ids[ $term_id ] = (int) $wpdb->insert_id;
|
||||
}
|
||||
|
||||
// Associate links to cats.
|
||||
// Associate links to categories.
|
||||
$links = $wpdb->get_results( "SELECT link_id, link_category FROM $wpdb->links" );
|
||||
if ( ! empty( $links ) ) {
|
||||
foreach ( $links as $link ) {
|
||||
@ -1460,11 +1463,11 @@ function upgrade_230() {
|
||||
}
|
||||
|
||||
if ( $wp_current_db_version < 4772 ) {
|
||||
// Obsolete linkcategories table
|
||||
// Obsolete linkcategories table.
|
||||
$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'linkcategories' );
|
||||
}
|
||||
|
||||
// Recalculate all counts
|
||||
// Recalculate all counts.
|
||||
$terms = $wpdb->get_results( "SELECT term_taxonomy_id, taxonomy FROM $wpdb->term_taxonomy" );
|
||||
foreach ( (array) $terms as $term ) {
|
||||
if ( ( 'post_tag' == $term->taxonomy ) || ( 'category' == $term->taxonomy ) ) {
|
||||
@ -1586,7 +1589,7 @@ function upgrade_270() {
|
||||
populate_roles_270();
|
||||
}
|
||||
|
||||
// Update post_date for unpublished posts with empty timestamp
|
||||
// Update post_date for unpublished posts with empty timestamp.
|
||||
if ( $wp_current_db_version < 8921 ) {
|
||||
$wpdb->query( "UPDATE $wpdb->posts SET post_date = post_modified WHERE post_date = '0000-00-00 00:00:00'" );
|
||||
}
|
||||
@ -1637,7 +1640,8 @@ function upgrade_290() {
|
||||
global $wp_current_db_version;
|
||||
|
||||
if ( $wp_current_db_version < 11958 ) {
|
||||
// Previously, setting depth to 1 would redundantly disable threading, but now 2 is the minimum depth to avoid confusion
|
||||
// Previously, setting depth to 1 would redundantly disable threading,
|
||||
// but now 2 is the minimum depth to avoid confusion.
|
||||
if ( get_option( 'thread_comments_depth' ) == '1' ) {
|
||||
update_option( 'thread_comments_depth', 2 );
|
||||
update_option( 'thread_comments', 0 );
|
||||
@ -1769,7 +1773,7 @@ function upgrade_330() {
|
||||
$sidebars_widgets = $_sidebars_widgets;
|
||||
unset( $_sidebars_widgets );
|
||||
|
||||
// intentional fall-through to upgrade to the next version.
|
||||
// Intentional fall-through to upgrade to the next version.
|
||||
case 2:
|
||||
$sidebars_widgets = retrieve_widgets();
|
||||
$sidebars_widgets['array_version'] = 3;
|
||||
@ -1827,7 +1831,7 @@ function upgrade_350() {
|
||||
global $wp_current_db_version, $wpdb;
|
||||
|
||||
if ( $wp_current_db_version < 22006 && $wpdb->get_var( "SELECT link_id FROM $wpdb->links LIMIT 1" ) ) {
|
||||
update_option( 'link_manager_enabled', 1 ); // Previously set to 0 by populate_options()
|
||||
update_option( 'link_manager_enabled', 1 ); // Previously set to 0 by populate_options().
|
||||
}
|
||||
|
||||
if ( $wp_current_db_version < 21811 && wp_should_upgrade_global_tables() ) {
|
||||
@ -2021,7 +2025,7 @@ function upgrade_430_fix_comments() {
|
||||
* @since 4.3.1
|
||||
*/
|
||||
function upgrade_431() {
|
||||
// Fix incorrect cron entries for term splitting
|
||||
// Fix incorrect cron entries for term splitting.
|
||||
$cron_array = _get_cron_array();
|
||||
if ( isset( $cron_array['wp_batch_split_terms'] ) ) {
|
||||
unset( $cron_array['wp_batch_split_terms'] );
|
||||
@ -2138,11 +2142,13 @@ function upgrade_510() {
|
||||
* @since 5.3.0
|
||||
*/
|
||||
function upgrade_530() {
|
||||
// The `admin_email_lifespan` option may have been set by an admin that just logged in,
|
||||
// saw the verification screen, clicked on a button there, and is now upgrading the db,
|
||||
// or by populate_options() that is called earlier in upgrade_all().
|
||||
// In the second case `admin_email_lifespan` should be reset so the verification screen
|
||||
// is shown next time an admin logs in.
|
||||
/*
|
||||
* The `admin_email_lifespan` option may have been set by an admin that just logged in,
|
||||
* saw the verification screen, clicked on a button there, and is now upgrading the db,
|
||||
* or by populate_options() that is called earlier in upgrade_all().
|
||||
* In the second case `admin_email_lifespan` should be reset so the verification screen
|
||||
* is shown next time an admin logs in.
|
||||
*/
|
||||
if ( function_exists( 'current_user_can' ) && ! current_user_can( 'manage_options' ) ) {
|
||||
update_option( 'admin_email_lifespan', 0 );
|
||||
}
|
||||
@ -2159,10 +2165,10 @@ function upgrade_530() {
|
||||
function upgrade_network() {
|
||||
global $wp_current_db_version, $wpdb;
|
||||
|
||||
// Always clear expired transients
|
||||
// Always clear expired transients.
|
||||
delete_expired_transients( true );
|
||||
|
||||
// 2.8.
|
||||
// 2.8
|
||||
if ( $wp_current_db_version < 11549 ) {
|
||||
$wpmu_sitewide_plugins = get_site_option( 'wpmu_sitewide_plugins' );
|
||||
$active_sitewide_plugins = get_site_option( 'active_sitewide_plugins' );
|
||||
@ -2301,7 +2307,7 @@ function upgrade_network() {
|
||||
}
|
||||
|
||||
//
|
||||
// General functions we use to actually do stuff
|
||||
// General functions we use to actually do stuff.
|
||||
//
|
||||
|
||||
/**
|
||||
@ -2328,7 +2334,7 @@ function maybe_create_table( $table_name, $create_ddl ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Didn't find it try to create it..
|
||||
// Didn't find it, so try to create it.
|
||||
$wpdb->query( $create_ddl );
|
||||
|
||||
// We cannot directly tell that whether this succeeded!
|
||||
@ -2353,7 +2359,7 @@ function drop_index( $table, $index ) {
|
||||
global $wpdb;
|
||||
$wpdb->hide_errors();
|
||||
$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++ ) {
|
||||
$wpdb->query( "ALTER TABLE `$table` DROP INDEX `{$index}_$i`" );
|
||||
}
|
||||
@ -2399,7 +2405,7 @@ function maybe_add_column( $table_name, $column_name, $create_ddl ) {
|
||||
}
|
||||
}
|
||||
|
||||
// Didn't find it try to create it.
|
||||
// Didn't find it, so try to create it.
|
||||
$wpdb->query( $create_ddl );
|
||||
|
||||
// We cannot directly tell that whether this succeeded!
|
||||
@ -2566,7 +2572,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
|
||||
$queries = wp_get_db_schema( $queries );
|
||||
}
|
||||
|
||||
// Separate individual queries into an array
|
||||
// Separate individual queries into an array.
|
||||
if ( ! is_array( $queries ) ) {
|
||||
$queries = explode( ';', $queries );
|
||||
$queries = array_filter( $queries );
|
||||
@ -2581,11 +2587,11 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
|
||||
*/
|
||||
$queries = apply_filters( 'dbdelta_queries', $queries );
|
||||
|
||||
$cqueries = array(); // Creation Queries
|
||||
$iqueries = array(); // Insertion Queries
|
||||
$cqueries = array(); // Creation queries.
|
||||
$iqueries = array(); // Insertion queries.
|
||||
$for_update = array();
|
||||
|
||||
// Create a tablename index for an array ($cqueries) of queries
|
||||
// Create a tablename index for an array ($cqueries) of queries.
|
||||
foreach ( $queries as $qry ) {
|
||||
if ( preg_match( '|CREATE TABLE ([^ ]*)|', $qry, $matches ) ) {
|
||||
$cqueries[ trim( $matches[1], '`' ) ] = $qry;
|
||||
@ -2597,7 +2603,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
|
||||
} elseif ( preg_match( '|UPDATE ([^ ]*)|', $qry, $matches ) ) {
|
||||
$iqueries[] = $qry;
|
||||
} else {
|
||||
// Unrecognized query type
|
||||
// Unrecognized query type.
|
||||
}
|
||||
}
|
||||
|
||||
@ -2634,7 +2640,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
|
||||
continue;
|
||||
}
|
||||
|
||||
// Fetch the table column structure from the database
|
||||
// Fetch the table column structure from the database.
|
||||
$suppress = $wpdb->suppress_errors();
|
||||
$tablefields = $wpdb->get_results( "DESCRIBE {$table};" );
|
||||
$wpdb->suppress_errors( $suppress );
|
||||
@ -2808,6 +2814,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
|
||||
if ( $do_change ) {
|
||||
// Add a query to change the column type.
|
||||
$cqueries[] = "ALTER TABLE {$table} CHANGE COLUMN `{$tablefield->Field}` " . $cfields[ $tablefield_field_lowercased ];
|
||||
|
||||
$for_update[ $table . '.' . $tablefield->Field ] = "Changed type of {$table}.{$tablefield->Field} from {$tablefield->Type} to {$fieldtype}";
|
||||
}
|
||||
}
|
||||
@ -2818,6 +2825,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
|
||||
if ( $tablefield->Default != $default_value ) {
|
||||
// Add a query to change the column's default value
|
||||
$cqueries[] = "ALTER TABLE {$table} ALTER COLUMN `{$tablefield->Field}` SET DEFAULT '{$default_value}'";
|
||||
|
||||
$for_update[ $table . '.' . $tablefield->Field ] = "Changed default value of {$table}.{$tablefield->Field} from {$tablefield->Default} to {$default_value}";
|
||||
}
|
||||
}
|
||||
@ -2833,6 +2841,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
|
||||
foreach ( $cfields as $fieldname => $fielddef ) {
|
||||
// Push a query line into $cqueries that adds the field to that table.
|
||||
$cqueries[] = "ALTER TABLE {$table} ADD COLUMN $fielddef";
|
||||
|
||||
$for_update[ $table . '.' . $fieldname ] = 'Added column ' . $table . '.' . $fieldname;
|
||||
}
|
||||
|
||||
@ -2845,9 +2854,9 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
|
||||
|
||||
// For every index in the table.
|
||||
foreach ( $tableindices as $tableindex ) {
|
||||
$keyname = strtolower( $tableindex->Key_name );
|
||||
|
||||
// Add the index to the index data array.
|
||||
$keyname = strtolower( $tableindex->Key_name );
|
||||
$index_ary[ $keyname ]['columns'][] = array(
|
||||
'fieldname' => $tableindex->Column_name,
|
||||
'subpart' => $tableindex->Sub_part,
|
||||
@ -2905,6 +2914,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
|
||||
foreach ( (array) $indices as $index ) {
|
||||
// Push a query line into $cqueries that adds the index to that table.
|
||||
$cqueries[] = "ALTER TABLE {$table} ADD $index";
|
||||
|
||||
$for_update[] = 'Added index ' . $table . ' ' . $index;
|
||||
}
|
||||
|
||||
@ -3269,7 +3279,7 @@ function maybe_disable_link_manager() {
|
||||
function pre_schema_upgrade() {
|
||||
global $wp_current_db_version, $wpdb;
|
||||
|
||||
// Upgrade versions prior to 2.9
|
||||
// Upgrade versions prior to 2.9.
|
||||
if ( $wp_current_db_version < 11557 ) {
|
||||
// Delete duplicate options. Keep the option with the highest option_id.
|
||||
$wpdb->query( "DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2 USING (`option_name`) WHERE o2.option_id > o1.option_id" );
|
||||
@ -3284,7 +3294,7 @@ function pre_schema_upgrade() {
|
||||
// Multisite schema upgrades.
|
||||
if ( $wp_current_db_version < 25448 && is_multisite() && wp_should_upgrade_global_tables() ) {
|
||||
|
||||
// Upgrade versions prior to 3.7
|
||||
// Upgrade versions prior to 3.7.
|
||||
if ( $wp_current_db_version < 25179 ) {
|
||||
// New primary key for signups.
|
||||
$wpdb->query( "ALTER TABLE $wpdb->signups ADD signup_id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST" );
|
||||
@ -3342,7 +3352,7 @@ CREATE TABLE $wpdb->sitecategories (
|
||||
KEY last_updated (last_updated)
|
||||
) $charset_collate;
|
||||
";
|
||||
// now create tables
|
||||
// Now create tables.
|
||||
dbDelta( $ms_queries );
|
||||
}
|
||||
endif;
|
||||
@ -3367,20 +3377,20 @@ endif;
|
||||
*/
|
||||
function wp_should_upgrade_global_tables() {
|
||||
|
||||
// Return false early if explicitly not upgrading
|
||||
// Return false early if explicitly not upgrading.
|
||||
if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Assume global tables should be upgraded
|
||||
// Assume global tables should be upgraded.
|
||||
$should_upgrade = true;
|
||||
|
||||
// Set to false if not on main network (does not matter if not multi-network)
|
||||
// Set to false if not on main network (does not matter if not multi-network).
|
||||
if ( ! is_main_network() ) {
|
||||
$should_upgrade = false;
|
||||
}
|
||||
|
||||
// Set to false if not on main site of current network (does not matter if not multi-site)
|
||||
// Set to false if not on main site of current network (does not matter if not multi-site).
|
||||
if ( ! is_main_site() ) {
|
||||
$should_upgrade = false;
|
||||
}
|
||||
|
@ -393,7 +393,7 @@ function wp_delete_user( $id, $reassign = null ) {
|
||||
}
|
||||
}
|
||||
|
||||
// Clean links
|
||||
// Clean links.
|
||||
$link_ids = $wpdb->get_col( $wpdb->prepare( "SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id ) );
|
||||
|
||||
if ( $link_ids ) {
|
||||
@ -418,7 +418,7 @@ function wp_delete_user( $id, $reassign = null ) {
|
||||
}
|
||||
}
|
||||
|
||||
// FINALLY, delete user
|
||||
// FINALLY, delete user.
|
||||
if ( is_multisite() ) {
|
||||
remove_user_from_blog( $id, get_current_blog_id() );
|
||||
} else {
|
||||
@ -474,7 +474,7 @@ function default_password_nag_handler( $errors = false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 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'] ) {
|
||||
delete_user_setting( 'default_password_nag' );
|
||||
update_user_option( $user_ID, 'default_password_nag', false, true );
|
||||
|
@ -22,7 +22,7 @@ function wp_list_widgets() {
|
||||
$done = array();
|
||||
|
||||
foreach ( $sort as $widget ) {
|
||||
if ( in_array( $widget['callback'], $done, true ) ) { // We already showed this multi-widget
|
||||
if ( in_array( $widget['callback'], $done, true ) ) { // We already showed this multi-widget.
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -142,8 +142,8 @@ function wp_list_widget_controls_dynamic_sidebar( $params ) {
|
||||
|
||||
$params[0]['before_widget'] = "<div id='widget-{$i}_{$id}' class='widget'$hidden>";
|
||||
$params[0]['after_widget'] = '</div>';
|
||||
$params[0]['before_title'] = '%BEG_OF_TITLE%'; // deprecated
|
||||
$params[0]['after_title'] = '%END_OF_TITLE%'; // deprecated
|
||||
$params[0]['before_title'] = '%BEG_OF_TITLE%'; // Deprecated.
|
||||
$params[0]['after_title'] = '%END_OF_TITLE%'; // Deprecated.
|
||||
|
||||
if ( is_callable( $wp_registered_widgets[ $widget_id ]['callback'] ) ) {
|
||||
$wp_registered_widgets[ $widget_id ]['_callback'] = $wp_registered_widgets[ $widget_id ]['callback'];
|
||||
@ -192,7 +192,7 @@ function wp_widget_control( $sidebar_args ) {
|
||||
|
||||
$widget_id = $sidebar_args['widget_id'];
|
||||
$sidebar_id = isset( $sidebar_args['id'] ) ? $sidebar_args['id'] : false;
|
||||
$key = $sidebar_id ? array_search( $widget_id, $sidebars_widgets[ $sidebar_id ] ) : '-1'; // position of widget in sidebar
|
||||
$key = $sidebar_id ? array_search( $widget_id, $sidebars_widgets[ $sidebar_id ] ) : '-1'; // Position of widget in sidebar.
|
||||
$control = isset( $wp_registered_widget_controls[ $widget_id ] ) ? $wp_registered_widget_controls[ $widget_id ] : array();
|
||||
$widget = $wp_registered_widgets[ $widget_id ];
|
||||
|
||||
@ -226,7 +226,7 @@ function wp_widget_control( $sidebar_args ) {
|
||||
* for a multi-widget control.
|
||||
*/
|
||||
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;
|
||||
// With id_base widget id's are constructed like {$id_base}-{$id_number}.
|
||||
if ( isset( $control['id_base'] ) ) {
|
||||
|
@ -44,7 +44,7 @@ $screen->add_help_tab(
|
||||
)
|
||||
);
|
||||
|
||||
// Help tabs
|
||||
// Help tabs.
|
||||
|
||||
$help = '<p>' . __( 'The left-hand navigation menu provides links to all of the WordPress administration screens, with submenu items displayed on hover. You can minimize this menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom.' ) . '</p>';
|
||||
$help .= '<p>' . __( 'Links in the Toolbar at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful WordPress information.' ) . '</p>';
|
||||
@ -119,7 +119,7 @@ if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) )
|
||||
$classes = 'welcome-panel';
|
||||
|
||||
$option = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
|
||||
// 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
|
||||
// 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner.
|
||||
$hide = 0 == $option || ( 2 == $option && wp_get_current_user()->user_email != get_option( 'admin_email' ) );
|
||||
if ( $hide ) {
|
||||
$classes .= ' hidden';
|
||||
|
@ -194,7 +194,7 @@ function check_column( $table_name, $col_name, $col_type, $is_null = null, $key
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} // end if found our column
|
||||
} // End if found our column.
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ function display_header( $body_classes = '' ) {
|
||||
<p id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>"><?php _e( 'WordPress' ); ?></a></p>
|
||||
|
||||
<?php
|
||||
} // end display_header()
|
||||
} // End display_header().
|
||||
|
||||
/**
|
||||
* Display installer setup form.
|
||||
@ -94,7 +94,7 @@ function display_setup_form( $error = null ) {
|
||||
$sql = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->users ) );
|
||||
$user_table = ( $wpdb->get_var( $sql ) != null );
|
||||
|
||||
// Ensure that Blogs appear in search engines by default.
|
||||
// Ensure that sites appear in search engines by default.
|
||||
$blog_public = 1;
|
||||
if ( isset( $_POST['weblog_title'] ) ) {
|
||||
$blog_public = isset( $_POST['blog_public'] );
|
||||
@ -209,7 +209,7 @@ function display_setup_form( $error = null ) {
|
||||
<input type="hidden" name="language" value="<?php echo isset( $_REQUEST['language'] ) ? esc_attr( $_REQUEST['language'] ) : ''; ?>" />
|
||||
</form>
|
||||
<?php
|
||||
} // end display_setup_form()
|
||||
} // End display_setup_form().
|
||||
|
||||
// Let's check to make sure WP isn't already installed.
|
||||
if ( is_blog_installed() ) {
|
||||
@ -303,7 +303,7 @@ if ( ! empty( $_REQUEST['language'] ) ) {
|
||||
$scripts_to_print = array( 'jquery' );
|
||||
|
||||
switch ( $step ) {
|
||||
case 0: // Step 0
|
||||
case 0: // Step 0.
|
||||
if ( wp_can_install_language_pack() && empty( $language ) ) {
|
||||
$languages = wp_get_available_translations();
|
||||
if ( $languages ) {
|
||||
@ -355,7 +355,7 @@ switch ( $step ) {
|
||||
$scripts_to_print[] = 'user-profile';
|
||||
|
||||
display_header();
|
||||
// Fill in the data we gathered
|
||||
// Fill in the data we gathered.
|
||||
$weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : '';
|
||||
$user_name = isset( $_POST['user_name'] ) ? trim( wp_unslash( $_POST['user_name'] ) ) : '';
|
||||
$admin_password = isset( $_POST['admin_password'] ) ? wp_unslash( $_POST['admin_password'] ) : '';
|
||||
@ -366,22 +366,22 @@ switch ( $step ) {
|
||||
// Check email address.
|
||||
$error = false;
|
||||
if ( empty( $user_name ) ) {
|
||||
// TODO: poka-yoke
|
||||
// TODO: Poka-yoke.
|
||||
display_setup_form( __( 'Please provide a valid username.' ) );
|
||||
$error = true;
|
||||
} elseif ( $user_name != sanitize_user( $user_name, true ) ) {
|
||||
display_setup_form( __( 'The username you provided has invalid characters.' ) );
|
||||
$error = true;
|
||||
} elseif ( $admin_password != $admin_password_check ) {
|
||||
// TODO: poka-yoke
|
||||
// TODO: Poka-yoke.
|
||||
display_setup_form( __( 'Your passwords do not match. Please try again.' ) );
|
||||
$error = true;
|
||||
} elseif ( empty( $admin_email ) ) {
|
||||
// TODO: poka-yoke
|
||||
// TODO: Poka-yoke.
|
||||
display_setup_form( __( 'You must provide an email address.' ) );
|
||||
$error = true;
|
||||
} elseif ( ! is_email( $admin_email ) ) {
|
||||
// TODO: poka-yoke
|
||||
// TODO: Poka-yoke.
|
||||
display_setup_form( __( 'Sorry, that isn’t a valid email address. Email addresses look like <code>username@example.com</code>.' ) );
|
||||
$error = true;
|
||||
}
|
||||
|
@ -35,11 +35,11 @@
|
||||
|
||||
// Expand/Collapse accordion sections on click.
|
||||
$( '.accordion-container' ).on( 'click keydown', '.accordion-section-title', function( e ) {
|
||||
if ( e.type === 'keydown' && 13 !== e.which ) { // "return" key
|
||||
if ( e.type === 'keydown' && 13 !== e.which ) { // "Return" key.
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault(); // Keep this AFTER the key filter above
|
||||
e.preventDefault(); // Keep this AFTER the key filter above.
|
||||
|
||||
accordionSwitch( $( this ) );
|
||||
});
|
||||
@ -80,7 +80,7 @@
|
||||
section.toggleClass( 'open' );
|
||||
}
|
||||
|
||||
// We have to wait for the animations to finish
|
||||
// We have to wait for the animations to finish.
|
||||
setTimeout(function(){
|
||||
container.removeClass( 'opening' );
|
||||
}, 150);
|
||||
|
@ -79,7 +79,11 @@ if ( 'undefined' === typeof window.wp.codeEditor ) {
|
||||
options = $.extend( {}, options );
|
||||
}
|
||||
|
||||
// Note that rules must be sent in the "deprecated" lint.options property to prevent linter from complaining about unrecognized options. See <https://github.com/codemirror/CodeMirror/pull/4944>.
|
||||
/*
|
||||
* Note that rules must be sent in the "deprecated" lint.options property
|
||||
* to prevent linter from complaining about unrecognized options.
|
||||
* See <https://github.com/codemirror/CodeMirror/pull/4944>.
|
||||
*/
|
||||
if ( ! options.options ) {
|
||||
options.options = {};
|
||||
}
|
||||
|
@ -36,7 +36,6 @@
|
||||
* Creates a color picker that only allows you to adjust the hue.
|
||||
*
|
||||
* @since 3.5.0
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @return {void}
|
||||
@ -80,7 +79,6 @@
|
||||
* Creates the color picker, sets default values, css classes and wraps it all in HTML.
|
||||
*
|
||||
* @since 3.5.0
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @return {void}
|
||||
@ -209,7 +207,6 @@
|
||||
* Binds event listeners to the color picker.
|
||||
*
|
||||
* @since 3.5.0
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @return {void}
|
||||
|
@ -70,7 +70,7 @@ jQuery(document).ready( function($) {
|
||||
* @param {Event} event The event object.
|
||||
* @return {void}
|
||||
*/
|
||||
$timestampdiv.find('.save-timestamp').click( function( event ) { // crazyhorse - multiple ok cancels
|
||||
$timestampdiv.find('.save-timestamp').click( function( event ) { // Crazyhorse - multiple OK cancels.
|
||||
var aa = $('#aa').val(), mm = $('#mm').val(), jj = $('#jj').val(), hh = $('#hh').val(), mn = $('#mn').val(),
|
||||
newD = new Date( aa, mm - 1, jj, hh, mn );
|
||||
|
||||
|
@ -168,7 +168,7 @@ window.validateForm = function( form ) {
|
||||
.length;
|
||||
};
|
||||
|
||||
// stub for doing better warnings
|
||||
// Stub for doing better warnings.
|
||||
/**
|
||||
* Shows message pop-up notice or confirmation message.
|
||||
*
|
||||
@ -334,13 +334,13 @@ $('.contextual-help-tabs').delegate('a', 'click', function(e) {
|
||||
if ( link.is('.active a') )
|
||||
return false;
|
||||
|
||||
// Links
|
||||
// Links.
|
||||
$('.contextual-help-tabs .active').removeClass('active');
|
||||
link.parent('li').addClass('active');
|
||||
|
||||
panel = $( link.attr('href') );
|
||||
|
||||
// Panels
|
||||
// Panels.
|
||||
$('.help-tab-content').not( panel ).removeClass('active').hide();
|
||||
panel.addClass('active').show();
|
||||
});
|
||||
@ -517,7 +517,7 @@ $document.ready( function() {
|
||||
$( '#collapse-button' ).on( 'click.collapse-menu', function() {
|
||||
var viewportWidth = getViewportWidth() || 961;
|
||||
|
||||
// reset any compensation for submenus near the bottom of the screen
|
||||
// Reset any compensation for submenus near the bottom of the screen.
|
||||
$('#adminmenu div.wp-submenu').css('margin-top', '');
|
||||
|
||||
if ( viewportWidth < 960 ) {
|
||||
@ -582,12 +582,12 @@ $document.ready( function() {
|
||||
|
||||
menutop = $menuItem.offset().top;
|
||||
wintop = $window.scrollTop();
|
||||
maxtop = menutop - wintop - 30; // max = make the top of the sub almost touch admin bar
|
||||
maxtop = menutop - wintop - 30; // max = make the top of the sub almost touch admin bar.
|
||||
|
||||
bottomOffset = menutop + $submenu.height() + 1; // Bottom offset of the menu
|
||||
pageHeight = $wpwrap.height(); // Height of the entire page
|
||||
bottomOffset = menutop + $submenu.height() + 1; // Bottom offset of the menu.
|
||||
pageHeight = $wpwrap.height(); // Height of the entire page.
|
||||
adjustment = 60 + bottomOffset - pageHeight;
|
||||
theFold = $window.height() + wintop - 50; // The fold
|
||||
theFold = $window.height() + wintop - 50; // The fold.
|
||||
|
||||
if ( theFold < ( bottomOffset - adjustment ) ) {
|
||||
adjustment = bottomOffset - theFold;
|
||||
@ -604,8 +604,8 @@ $document.ready( function() {
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'ontouchstart' in window || /IEMobile\/[1-9]/.test(navigator.userAgent) ) { // touch screen device
|
||||
// iOS Safari works with touchstart, the rest work with click
|
||||
if ( 'ontouchstart' in window || /IEMobile\/[1-9]/.test(navigator.userAgent) ) { // Touch screen device.
|
||||
// iOS Safari works with touchstart, the rest work with click.
|
||||
mobileEvent = isIOS ? 'touchstart' : 'click';
|
||||
|
||||
/**
|
||||
@ -639,9 +639,11 @@ $document.ready( function() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Show the sub instead of following the link if:
|
||||
// - the submenu is not open
|
||||
// - the submenu is not shown inline or the menu is not folded
|
||||
/*
|
||||
* Show the sub instead of following the link if:
|
||||
* - the submenu is not open.
|
||||
* - the submenu is not shown inline or the menu is not folded.
|
||||
*/
|
||||
if ( ! $menuItem.hasClass( 'opensub' ) && ( ! $menuItem.hasClass( 'wp-menu-open' ) || $menuItem.width() < 40 ) ) {
|
||||
event.preventDefault();
|
||||
adjustSubmenu( $menuItem );
|
||||
@ -664,12 +666,12 @@ $document.ready( function() {
|
||||
$submenu = $menuItem.find( '.wp-submenu' ),
|
||||
top = parseInt( $submenu.css( 'top' ), 10 );
|
||||
|
||||
if ( isNaN( top ) || top > -5 ) { // the submenu is visible
|
||||
if ( isNaN( top ) || top > -5 ) { // The submenu is visible.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $adminmenu.data( 'wp-responsive' ) ) {
|
||||
// The menu is in responsive mode, bail
|
||||
// The menu is in responsive mode, bail.
|
||||
return;
|
||||
}
|
||||
|
||||
@ -685,7 +687,7 @@ $document.ready( function() {
|
||||
*/
|
||||
out: function(){
|
||||
if ( $adminmenu.data( 'wp-responsive' ) ) {
|
||||
// The menu is in responsive mode, bail
|
||||
// The menu is in responsive mode, bail.
|
||||
return;
|
||||
}
|
||||
|
||||
@ -705,7 +707,7 @@ $document.ready( function() {
|
||||
*/
|
||||
$adminmenu.on( 'focus.adminmenu', '.wp-submenu a', function( event ) {
|
||||
if ( $adminmenu.data( 'wp-responsive' ) ) {
|
||||
// The menu is in responsive mode, bail
|
||||
// The menu is in responsive mode, bail.
|
||||
return;
|
||||
}
|
||||
|
||||
@ -759,7 +761,7 @@ $document.ready( function() {
|
||||
$button = $( '<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>' ),
|
||||
btnText = commonL10n.dismiss || '';
|
||||
|
||||
// Ensure plain text
|
||||
// Ensure plain text.
|
||||
$button.find( '.screen-reader-text' ).text( btnText );
|
||||
$button.on( 'click.wp-dismiss-notice', function( event ) {
|
||||
event.preventDefault();
|
||||
@ -776,7 +778,7 @@ $document.ready( function() {
|
||||
|
||||
$document.on( 'wp-updates-notice-added wp-plugin-install-error wp-plugin-update-error wp-plugin-delete-error wp-theme-install-error wp-theme-delete-error', makeNoticesDismissible );
|
||||
|
||||
// Init screen meta
|
||||
// Init screen meta.
|
||||
screenMeta.init();
|
||||
|
||||
/**
|
||||
@ -902,7 +904,7 @@ $document.ready( function() {
|
||||
}
|
||||
}, '.has-row-actions' );
|
||||
|
||||
// Toggle list table rows on small screens
|
||||
// Toggle list table rows on small screens.
|
||||
$( 'tbody' ).on( 'click', '.toggle-row', function() {
|
||||
$( this ).closest( 'tr' ).toggleClass( 'is-expanded' );
|
||||
});
|
||||
@ -925,7 +927,7 @@ $document.ready( function() {
|
||||
|
||||
// After pressing escape key (keyCode: 27), the tab key should tab out of the textarea.
|
||||
if ( e.keyCode == 27 ) {
|
||||
// when pressing Escape: Opera 12 and 27 blur form fields, IE 8 clears them
|
||||
// When pressing Escape: Opera 12 and 27 blur form fields, IE 8 clears them.
|
||||
e.preventDefault();
|
||||
$(el).data('tab-out', true);
|
||||
return;
|
||||
@ -1276,7 +1278,7 @@ $document.ready( function() {
|
||||
|
||||
this.maybeDisableSortables = this.maybeDisableSortables.bind( this );
|
||||
|
||||
// Modify functionality based on custom activate/deactivate event
|
||||
// Modify functionality based on custom activate/deactivate event.
|
||||
$document.on( 'wp-responsive-activate.wp-responsive', function() {
|
||||
self.activate();
|
||||
}).on( 'wp-responsive-deactivate.wp-responsive', function() {
|
||||
@ -1289,7 +1291,7 @@ $document.ready( function() {
|
||||
$( '#wp-admin-bar-menu-toggle' ).on( 'click.wp-responsive', function( event ) {
|
||||
event.preventDefault();
|
||||
|
||||
// close any open toolbar submenus.
|
||||
// Close any open toolbar submenus.
|
||||
$adminbar.find( '.hover' ).removeClass( 'hover' );
|
||||
|
||||
$wpwrap.toggleClass( 'wp-responsive-open' );
|
||||
|
@ -578,7 +578,8 @@
|
||||
return deferred.promise();
|
||||
}
|
||||
|
||||
// A status would cause a revision to be made, and for this wp.customize.previewer.save() should be used. Status is also disallowed for revisions regardless.
|
||||
// A status would cause a revision to be made, and for this wp.customize.previewer.save() should be used.
|
||||
// Status is also disallowed for revisions regardless.
|
||||
if ( submittedArgs.status ) {
|
||||
return deferred.reject( { code: 'illegal_status_in_changeset_update' } ).promise();
|
||||
}
|
||||
@ -772,13 +773,13 @@
|
||||
*/
|
||||
api.utils.areElementListsEqual = function ( listA, listB ) {
|
||||
var equal = (
|
||||
listA.length === listB.length && // if lists are different lengths, then naturally they are not equal
|
||||
-1 === _.indexOf( _.map( // are there any false values in the list returned by map?
|
||||
_.zip( listA, listB ), // pair up each element between the two lists
|
||||
listA.length === listB.length && // If lists are different lengths, then naturally they are not equal.
|
||||
-1 === _.indexOf( _.map( // Are there any false values in the list returned by map?
|
||||
_.zip( listA, listB ), // Pair up each element between the two lists.
|
||||
function ( pair ) {
|
||||
return $( pair[0] ).is( pair[1] ); // compare to see if each pair are equal
|
||||
return $( pair[0] ).is( pair[1] ); // Compare to see if each pair is equal.
|
||||
}
|
||||
), false ) // check for presence of false in map's return value
|
||||
), false ) // Check for presence of false in map's return value.
|
||||
);
|
||||
return equal;
|
||||
};
|
||||
@ -1128,7 +1129,8 @@
|
||||
}
|
||||
|
||||
if ( ! $.contains( document, headContainer.get( 0 ) ) ) {
|
||||
// If the element is not in the DOM, then jQuery.fn.slideUp() does nothing. In this case, a hard toggle is required instead.
|
||||
// If the element is not in the DOM, then jQuery.fn.slideUp() does nothing.
|
||||
// In this case, a hard toggle is required instead.
|
||||
headContainer.toggle( active );
|
||||
if ( args.completeCallback ) {
|
||||
args.completeCallback();
|
||||
@ -1479,7 +1481,7 @@
|
||||
});
|
||||
} );
|
||||
} else {
|
||||
// There is no panel, so embed the section in the root of the customizer
|
||||
// There is no panel, so embed the section in the root of the customizer.
|
||||
parentContainer = api.ensure( section.containerPaneParent );
|
||||
if ( ! section.headContainer.parent().is( parentContainer ) ) {
|
||||
parentContainer.append( section.headContainer );
|
||||
@ -1511,7 +1513,7 @@
|
||||
if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
|
||||
return;
|
||||
}
|
||||
event.preventDefault(); // Keep this AFTER the key filter above
|
||||
event.preventDefault(); // Keep this AFTER the key filter above.
|
||||
|
||||
if ( section.expanded() ) {
|
||||
section.collapse();
|
||||
@ -1718,12 +1720,12 @@
|
||||
var inject,
|
||||
section = this;
|
||||
|
||||
// Watch for changes to the panel state
|
||||
// Watch for changes to the panel state.
|
||||
inject = function( panelId ) {
|
||||
var parentContainer;
|
||||
api.panel( panelId, function( panel ) {
|
||||
|
||||
// The panel has been registered, wait for it to become ready/initialized
|
||||
// The panel has been registered, wait for it to become ready/initialized.
|
||||
panel.deferred.embedded.done( function() {
|
||||
parentContainer = panel.contentContainer;
|
||||
if ( ! section.headContainer.parent().is( parentContainer ) ) {
|
||||
@ -1737,7 +1739,7 @@
|
||||
} );
|
||||
};
|
||||
section.panel.bind( inject );
|
||||
inject( section.panel.get() ); // Since a section may never get a panel, assume that it won't ever get one
|
||||
inject( section.panel.get() ); // Since a section may never get a panel, assume that it won't ever get one.
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1758,17 +1760,17 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// Pressing the right arrow key fires a theme:next event
|
||||
// Pressing the right arrow key fires a theme:next event.
|
||||
if ( 39 === event.keyCode ) {
|
||||
section.nextTheme();
|
||||
}
|
||||
|
||||
// Pressing the left arrow key fires a theme:previous event
|
||||
// Pressing the left arrow key fires a theme:previous event.
|
||||
if ( 37 === event.keyCode ) {
|
||||
section.previousTheme();
|
||||
}
|
||||
|
||||
// Pressing the escape key fires a theme:collapse event
|
||||
// Pressing the escape key fires a theme:collapse event.
|
||||
if ( 27 === event.keyCode ) {
|
||||
if ( section.$body.hasClass( 'modal-open' ) ) {
|
||||
|
||||
@ -1818,7 +1820,7 @@
|
||||
if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
|
||||
return;
|
||||
}
|
||||
event.preventDefault(); // Keep this AFTER the key filter above
|
||||
event.preventDefault(); // Keep this AFTER the key filter above.
|
||||
section.collapse();
|
||||
});
|
||||
|
||||
@ -1957,11 +1959,11 @@
|
||||
*/
|
||||
onChangeExpanded: function ( expanded, args ) {
|
||||
|
||||
// Note: there is a second argument 'args' passed
|
||||
// Note: there is a second argument 'args' passed.
|
||||
var section = this,
|
||||
container = section.contentContainer.closest( '.customize-themes-full-container' );
|
||||
|
||||
// Immediately call the complete callback if there were no changes
|
||||
// Immediately call the complete callback if there were no changes.
|
||||
if ( args.unchanged ) {
|
||||
if ( args.completeCallback ) {
|
||||
args.completeCallback();
|
||||
@ -1976,7 +1978,7 @@
|
||||
section.loadThemes();
|
||||
}
|
||||
|
||||
// Collapse any sibling sections/panels
|
||||
// Collapse any sibling sections/panels.
|
||||
api.section.each( function ( otherSection ) {
|
||||
var searchTerm;
|
||||
|
||||
@ -2123,7 +2125,8 @@
|
||||
|
||||
_.delay( section.renderScreenshots, 100 ); // Wait for the controls to become visible.
|
||||
|
||||
if ( 'local' === section.params.filter_type || 100 > themes.length ) { // If we have less than the requested 100 themes, it's the end of the list.
|
||||
if ( 'local' === section.params.filter_type || 100 > themes.length ) {
|
||||
// If we have less than the requested 100 themes, it's the end of the list.
|
||||
section.fullyLoaded = true;
|
||||
}
|
||||
} else {
|
||||
@ -2202,7 +2205,9 @@
|
||||
container = section.container.closest( '.customize-themes-full-container' );
|
||||
|
||||
bottom = container.scrollTop() + container.height();
|
||||
threshold = container.prop( 'scrollHeight' ) - 3000; // Use a fixed distance to the bottom of loaded results to avoid unnecessarily loading results sooner when using a percentage of scroll distance.
|
||||
// Use a fixed distance to the bottom of loaded results to avoid unnecessarily
|
||||
// loading results sooner when using a percentage of scroll distance.
|
||||
threshold = container.prop( 'scrollHeight' ) - 3000;
|
||||
|
||||
if ( bottom > threshold ) {
|
||||
section.loadThemes();
|
||||
@ -2614,15 +2619,15 @@
|
||||
el.on( 'keydown', function( event ) {
|
||||
|
||||
// Return if it's not the tab key
|
||||
// When navigating with prev/next focus is already handled
|
||||
// When navigating with prev/next focus is already handled.
|
||||
if ( 9 !== event.keyCode ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// uses jQuery UI to get the tabbable elements
|
||||
// Uses jQuery UI to get the tabbable elements.
|
||||
tabbables = $( ':tabbable', el );
|
||||
|
||||
// Keep focus within the overlay
|
||||
// Keep focus within the overlay.
|
||||
if ( tabbables.last()[0] === event.target && ! event.shiftKey ) {
|
||||
tabbables.first().focus();
|
||||
return false;
|
||||
@ -2797,7 +2802,7 @@
|
||||
embed: function () {
|
||||
var panel = this,
|
||||
container = $( '#customize-theme-controls' ),
|
||||
parentContainer = $( '.customize-pane-parent' ); // @todo This should be defined elsewhere, and to be configurable
|
||||
parentContainer = $( '.customize-pane-parent' ); // @todo This should be defined elsewhere, and to be configurable.
|
||||
|
||||
if ( ! panel.headContainer.parent().is( parentContainer ) ) {
|
||||
parentContainer.append( panel.headContainer );
|
||||
@ -2821,7 +2826,7 @@
|
||||
if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
|
||||
return;
|
||||
}
|
||||
event.preventDefault(); // Keep this AFTER the key filter above
|
||||
event.preventDefault(); // Keep this AFTER the key filter above.
|
||||
|
||||
if ( ! panel.expanded() ) {
|
||||
panel.expand();
|
||||
@ -2833,7 +2838,7 @@
|
||||
if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
|
||||
return;
|
||||
}
|
||||
event.preventDefault(); // Keep this AFTER the key filter above
|
||||
event.preventDefault(); // Keep this AFTER the key filter above.
|
||||
|
||||
if ( panel.expanded() ) {
|
||||
panel.collapse();
|
||||
@ -2908,7 +2913,7 @@
|
||||
*/
|
||||
onChangeExpanded: function ( expanded, args ) {
|
||||
|
||||
// Immediately call the complete callback if there were no changes
|
||||
// Immediately call the complete callback if there were no changes.
|
||||
if ( args.unchanged ) {
|
||||
if ( args.completeCallback ) {
|
||||
args.completeCallback();
|
||||
@ -2916,7 +2921,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// Note: there is a second argument 'args' passed
|
||||
// Note: there is a second argument 'args' passed.
|
||||
var panel = this,
|
||||
accordionSection = panel.contentContainer,
|
||||
overlay = accordionSection.closest( '.wp-full-overlay' ),
|
||||
@ -2927,7 +2932,7 @@
|
||||
skipTransition;
|
||||
|
||||
if ( expanded && ! accordionSection.hasClass( 'current-panel' ) ) {
|
||||
// Collapse any sibling sections/panels
|
||||
// Collapse any sibling sections/panels.
|
||||
api.section.each( function ( section ) {
|
||||
if ( panel.id !== section.panel() ) {
|
||||
section.collapse( { duration: 0 } );
|
||||
@ -3067,7 +3072,7 @@
|
||||
// Attach regular panel events.
|
||||
api.Panel.prototype.attachEvents.apply( panel );
|
||||
|
||||
// Temporary since supplying SFTP credentials does not work yet. See #42184
|
||||
// Temporary since supplying SFTP credentials does not work yet. See #42184.
|
||||
if ( api.settings.theme._canInstall && api.settings.theme._filesystemCredentialsNeeded ) {
|
||||
panel.notifications.add( new api.Notification( 'theme_install_unavailable', {
|
||||
message: api.l10n.themeInstallUnavailable,
|
||||
@ -3140,7 +3145,7 @@
|
||||
// Expand/collapse the panel normally.
|
||||
api.Panel.prototype.onChangeExpanded.apply( this, [ expanded, args ] );
|
||||
|
||||
// Immediately call the complete callback if there were no changes
|
||||
// Immediately call the complete callback if there were no changes.
|
||||
if ( args.unchanged ) {
|
||||
if ( args.completeCallback ) {
|
||||
args.completeCallback();
|
||||
@ -3682,15 +3687,15 @@
|
||||
var control = this,
|
||||
inject;
|
||||
|
||||
// Watch for changes to the section state
|
||||
// Watch for changes to the section state.
|
||||
inject = function ( sectionId ) {
|
||||
var parentContainer;
|
||||
if ( ! sectionId ) { // @todo allow a control to be embedded without a section, for instance a control embedded in the front end.
|
||||
if ( ! sectionId ) { // @todo Allow a control to be embedded without a section, for instance a control embedded in the front end.
|
||||
return;
|
||||
}
|
||||
// Wait for the section to be registered
|
||||
// Wait for the section to be registered.
|
||||
api.section( sectionId, function ( section ) {
|
||||
// Wait for the section to be ready/initialized
|
||||
// Wait for the section to be ready/initialized.
|
||||
section.deferred.embedded.done( function () {
|
||||
parentContainer = ( section.contentContainer.is( 'ul' ) ) ? section.contentContainer : section.contentContainer.find( 'ul:first' );
|
||||
if ( ! control.container.parent().is( parentContainer ) ) {
|
||||
@ -3724,7 +3729,7 @@
|
||||
control.addNewPage();
|
||||
});
|
||||
control.container.on( 'keydown', '.create-item-input', function( e ) {
|
||||
if ( 13 === e.which ) { // Enter
|
||||
if ( 13 === e.which ) { // Enter.
|
||||
control.addNewPage();
|
||||
}
|
||||
});
|
||||
@ -3909,7 +3914,7 @@
|
||||
}
|
||||
|
||||
if ( ! $.contains( document, this.container[0] ) ) {
|
||||
// jQuery.fn.slideUp is not hiding an element if it is not in the DOM
|
||||
// jQuery.fn.slideUp is not hiding an element if it is not in the DOM.
|
||||
this.container.toggle( active );
|
||||
if ( args.completeCallback ) {
|
||||
args.completeCallback();
|
||||
@ -3957,7 +3962,7 @@
|
||||
}
|
||||
};
|
||||
|
||||
// Support the .dropdown class to open/close complex elements
|
||||
// Support the .dropdown class to open/close complex elements.
|
||||
this.container.on( 'click keydown', '.dropdown', function( event ) {
|
||||
if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
|
||||
return;
|
||||
@ -3973,7 +3978,7 @@
|
||||
control.container.parent().parent().find( 'li.library-selected' ).focus();
|
||||
}
|
||||
|
||||
// Don't want to fire focus and click at same time
|
||||
// Don't want to fire focus and click at same time.
|
||||
toggleFreeze = true;
|
||||
setTimeout(function () {
|
||||
toggleFreeze = false;
|
||||
@ -4017,7 +4022,8 @@
|
||||
|
||||
templateId = control.templateSelector;
|
||||
|
||||
// Use default content template when a standard HTML type is used, there isn't a more specific template existing, and the control container is empty.
|
||||
// Use default content template when a standard HTML type is used,
|
||||
// there isn't a more specific template existing, and the control container is empty.
|
||||
if ( templateId === 'customize-control-' + control.params.type + '-content' &&
|
||||
_.contains( standardTypes, control.params.type ) &&
|
||||
! document.getElementById( 'tmpl-' + templateId ) &&
|
||||
@ -4047,6 +4053,7 @@
|
||||
*
|
||||
* @since 4.7.0
|
||||
* @access private
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
addNewPage: function () {
|
||||
@ -4070,7 +4077,8 @@
|
||||
input.removeClass( 'invalid' );
|
||||
input.attr( 'disabled', 'disabled' );
|
||||
|
||||
// The menus functions add the page, publish when appropriate, and also add the new page to the dropdown-pages controls.
|
||||
// The menus functions add the page, publish when appropriate,
|
||||
// and also add the new page to the dropdown-pages controls.
|
||||
promise = api.Menus.insertAutoDraftPost( {
|
||||
post_title: title,
|
||||
post_type: 'page'
|
||||
@ -4199,7 +4207,7 @@
|
||||
control.container.on( 'click keydown', '.remove-button', control.removeFile );
|
||||
control.container.on( 'click keydown', '.remove-button', control.cleanupPlayer );
|
||||
|
||||
// Resize the player controls when it becomes visible (ie when section is expanded)
|
||||
// Resize the player controls when it becomes visible (ie when section is expanded).
|
||||
api.section( control.section() ).container
|
||||
.on( 'expanded', function() {
|
||||
if ( control.player ) {
|
||||
@ -5128,7 +5136,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault(); // Keep this AFTER the key filter above
|
||||
event.preventDefault(); // Keep this AFTER the key filter above.
|
||||
section = api.section( control.section() );
|
||||
section.showDetails( control.params.theme, function() {
|
||||
|
||||
@ -5196,7 +5204,7 @@
|
||||
control.params.priority = 101 - matchCount; // Sort results by match count.
|
||||
return true;
|
||||
} else {
|
||||
control.deactivate(); // Hide control
|
||||
control.deactivate(); // Hide control.
|
||||
control.params.priority = 101;
|
||||
return false;
|
||||
}
|
||||
@ -6498,13 +6506,15 @@
|
||||
urlParser.href = previewer.origin();
|
||||
previewer.add( 'scheme', urlParser.protocol.replace( /:$/, '' ) );
|
||||
|
||||
// Limit the URL to internal, front-end links.
|
||||
//
|
||||
// If the front end and the admin are served from the same domain, load the
|
||||
// preview over ssl if the Customizer is being loaded over ssl. This avoids
|
||||
// insecure content warnings. This is not attempted if the admin and front end
|
||||
// are on different domains to avoid the case where the front end doesn't have
|
||||
// ssl certs.
|
||||
/*
|
||||
* Limit the URL to internal, front-end links.
|
||||
*
|
||||
* If the front end and the admin are served from the same domain, load the
|
||||
* preview over ssl if the Customizer is being loaded over ssl. This avoids
|
||||
* insecure content warnings. This is not attempted if the admin and front end
|
||||
* are on different domains to avoid the case where the front end doesn't have
|
||||
* ssl certs.
|
||||
*/
|
||||
|
||||
previewer.add( 'previewUrl', params.previewUrl ).setter( function( to ) {
|
||||
var result = null, urlParser, queryParams, parsedAllowedUrl, parsedCandidateUrls = [];
|
||||
@ -6735,12 +6745,13 @@
|
||||
*
|
||||
* @since 3.4.0
|
||||
* @access public
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
refresh: function() {
|
||||
var previewer = this, onSettingChange;
|
||||
|
||||
// Display loading indicator
|
||||
// Display loading indicator.
|
||||
previewer.send( 'loading-initiated' );
|
||||
|
||||
previewer.abort();
|
||||
@ -7013,7 +7024,7 @@
|
||||
activeElement = $( document.activeElement );
|
||||
}
|
||||
|
||||
// Sort the sections within each panel
|
||||
// Sort the sections within each panel.
|
||||
api.panel.each( function ( panel ) {
|
||||
if ( 'themes' === panel.id ) {
|
||||
return; // Don't reflow theme sections, as doing so moves them after the themes container.
|
||||
@ -7031,7 +7042,7 @@
|
||||
}
|
||||
} );
|
||||
|
||||
// Sort the controls within each section
|
||||
// Sort the controls within each section.
|
||||
api.section.each( function ( section ) {
|
||||
var controls = section.controls(),
|
||||
controlContainers = _.pluck( controls, 'container' );
|
||||
@ -7047,10 +7058,10 @@
|
||||
}
|
||||
} );
|
||||
|
||||
// Sort the root panels and sections
|
||||
// Sort the root panels and sections.
|
||||
rootNodes.sort( api.utils.prioritySort );
|
||||
rootHeadContainers = _.pluck( rootNodes, 'headContainer' );
|
||||
appendContainer = $( '#customize-theme-controls .customize-pane-parent' ); // @todo This should be defined elsewhere, and to be configurable
|
||||
appendContainer = $( '#customize-theme-controls .customize-pane-parent' ); // @todo This should be defined elsewhere, and to be configurable.
|
||||
if ( ! api.utils.areElementListsEqual( rootHeadContainers, appendContainer.children() ) ) {
|
||||
_( rootNodes ).each( function ( rootNode ) {
|
||||
appendContainer.append( rootNode.headContainer );
|
||||
@ -7058,7 +7069,7 @@
|
||||
wasReflowed = true;
|
||||
}
|
||||
|
||||
// Now re-trigger the active Value callbacks to that the panels and sections can decide whether they can be rendered
|
||||
// Now re-trigger the active Value callbacks so that the panels and sections can decide whether they can be rendered.
|
||||
api.panel.each( function ( panel ) {
|
||||
var value = panel.active();
|
||||
panel.active.callbacks.fireWith( panel.active, [ value, value ] );
|
||||
@ -7068,7 +7079,7 @@
|
||||
section.active.callbacks.fireWith( section.active, [ value, value ] );
|
||||
} );
|
||||
|
||||
// Restore focus if there was a reflow and there was an active (focused) element
|
||||
// Restore focus if there was a reflow and there was an active (focused) element.
|
||||
if ( wasReflowed && activeElement ) {
|
||||
activeElement.focus();
|
||||
}
|
||||
@ -7208,9 +7219,11 @@
|
||||
cancelScheduleButtonReminder = api.utils.highlightButton( btnWrapper, {
|
||||
delay: 1000,
|
||||
|
||||
// Only abort the reminder when the save button is focused.
|
||||
// If the user clicks the settings button to toggle the
|
||||
// settings closed, we'll still remind them.
|
||||
/*
|
||||
* Only abort the reminder when the save button is focused.
|
||||
* If the user clicks the settings button to toggle the
|
||||
* settings closed, we'll still remind them.
|
||||
*/
|
||||
focusTarget: saveBtn
|
||||
} );
|
||||
}
|
||||
@ -7579,7 +7592,7 @@
|
||||
if ( '0' === response ) {
|
||||
response = 'not_logged_in';
|
||||
} else if ( '-1' === response ) {
|
||||
// Back-compat in case any other check_ajax_referer() call is dying
|
||||
// Back-compat in case any other check_ajax_referer() call is dying.
|
||||
response = 'invalid_nonce';
|
||||
}
|
||||
|
||||
@ -7812,7 +7825,7 @@
|
||||
api.previewer.send( 'nonce-refresh', nonce );
|
||||
});
|
||||
|
||||
// Create Settings
|
||||
// Create Settings.
|
||||
$.each( api.settings.settings, function( id, data ) {
|
||||
var Constructor = api.settingConstructor[ data.type ] || api.Setting;
|
||||
api.add( new Constructor( id, data.value, {
|
||||
@ -7822,28 +7835,31 @@
|
||||
} ) );
|
||||
});
|
||||
|
||||
// Create Panels
|
||||
// Create Panels.
|
||||
$.each( api.settings.panels, function ( id, data ) {
|
||||
var Constructor = api.panelConstructor[ data.type ] || api.Panel, options;
|
||||
options = _.extend( { params: data }, data ); // Inclusion of params alias is for back-compat for custom panels that expect to augment this property.
|
||||
// Inclusion of params alias is for back-compat for custom panels that expect to augment this property.
|
||||
options = _.extend( { params: data }, data );
|
||||
api.panel.add( new Constructor( id, options ) );
|
||||
});
|
||||
|
||||
// Create Sections
|
||||
// Create Sections.
|
||||
$.each( api.settings.sections, function ( id, data ) {
|
||||
var Constructor = api.sectionConstructor[ data.type ] || api.Section, options;
|
||||
options = _.extend( { params: data }, data ); // Inclusion of params alias is for back-compat for custom sections that expect to augment this property.
|
||||
// Inclusion of params alias is for back-compat for custom sections that expect to augment this property.
|
||||
options = _.extend( { params: data }, data );
|
||||
api.section.add( new Constructor( id, options ) );
|
||||
});
|
||||
|
||||
// Create Controls
|
||||
// Create Controls.
|
||||
$.each( api.settings.controls, function( id, data ) {
|
||||
var Constructor = api.controlConstructor[ data.type ] || api.Control, options;
|
||||
options = _.extend( { params: data }, data ); // Inclusion of params alias is for back-compat for custom controls that expect to augment this property.
|
||||
// Inclusion of params alias is for back-compat for custom controls that expect to augment this property.
|
||||
options = _.extend( { params: data }, data );
|
||||
api.control.add( new Constructor( id, options ) );
|
||||
});
|
||||
|
||||
// Focus the autofocused element
|
||||
// Focus the autofocused element.
|
||||
_.each( [ 'panel', 'section', 'control' ], function( type ) {
|
||||
var id = api.settings.autofocus[ type ];
|
||||
if ( ! id ) {
|
||||
@ -7896,7 +7912,7 @@
|
||||
api.notifications.render();
|
||||
});
|
||||
|
||||
// Save and activated states
|
||||
// Save and activated states.
|
||||
(function( state ) {
|
||||
var saved = state.instance( 'saved' ),
|
||||
saving = state.instance( 'saving' ),
|
||||
@ -8690,7 +8706,8 @@
|
||||
};
|
||||
}());
|
||||
|
||||
// Previewed device bindings. (The api.previewedDevice property is how this Value was first introduced, but since it has moved to api.state.)
|
||||
// Previewed device bindings. (The api.previewedDevice property
|
||||
// is how this Value was first introduced, but since it has moved to api.state.)
|
||||
api.previewedDevice = api.state( 'previewedDevice' );
|
||||
|
||||
// Set the default device.
|
||||
@ -8797,7 +8814,7 @@
|
||||
api.state( 'selectedChangesetStatus' ).unbind( startPromptingBeforeUnload );
|
||||
api.state( 'selectedChangesetDate' ).unbind( startPromptingBeforeUnload );
|
||||
|
||||
// Prompt user with AYS dialog if leaving the Customizer with unsaved changes
|
||||
// Prompt user with AYS dialog if leaving the Customizer with unsaved changes.
|
||||
$( window ).on( 'beforeunload.customize-confirm', function() {
|
||||
if ( ! isCleanState() && ! api.state( 'changesetLocked' ).get() ) {
|
||||
setTimeout( function() {
|
||||
@ -8882,7 +8899,7 @@
|
||||
});
|
||||
} );
|
||||
|
||||
// Pass titles to the parent
|
||||
// Pass titles to the parent.
|
||||
api.bind( 'title', function( newTitle ) {
|
||||
parent.send( 'title', newTitle );
|
||||
});
|
||||
@ -8894,7 +8911,7 @@
|
||||
// Initialize the connection with the parent frame.
|
||||
parent.send( 'ready' );
|
||||
|
||||
// Control visibility for default controls
|
||||
// Control visibility for default controls.
|
||||
$.each({
|
||||
'background_image': {
|
||||
controls: [ 'background_preset', 'background_position', 'background_size', 'background_repeat', 'background_attachment' ],
|
||||
@ -8926,7 +8943,7 @@
|
||||
api.control( 'background_preset', function( control ) {
|
||||
var visibility, defaultValues, values, toggleVisibility, updateSettings, preset;
|
||||
|
||||
visibility = { // position, size, repeat, attachment
|
||||
visibility = { // position, size, repeat, attachment.
|
||||
'default': [ false, false, false, false ],
|
||||
'fill': [ true, false, false, false ],
|
||||
'fit': [ true, false, true, false ],
|
||||
@ -8942,14 +8959,15 @@
|
||||
_wpCustomizeBackground.defaults['default-attachment']
|
||||
];
|
||||
|
||||
values = { // position_x, position_y, size, repeat, attachment
|
||||
values = { // position_x, position_y, size, repeat, attachment.
|
||||
'default': defaultValues,
|
||||
'fill': [ 'left', 'top', 'cover', 'no-repeat', 'fixed' ],
|
||||
'fit': [ 'left', 'top', 'contain', 'no-repeat', 'fixed' ],
|
||||
'repeat': [ 'left', 'top', 'auto', 'repeat', 'scroll' ]
|
||||
};
|
||||
|
||||
// @todo These should actually toggle the active state, but without the preview overriding the state in data.activeControls.
|
||||
// @todo These should actually toggle the active state,
|
||||
// but without the preview overriding the state in data.activeControls.
|
||||
toggleVisibility = function( preset ) {
|
||||
_.each( [ 'background_position', 'background_size', 'background_repeat', 'background_attachment' ], function( controlId, i ) {
|
||||
var control = api.control( controlId );
|
||||
@ -9009,7 +9027,7 @@
|
||||
} );
|
||||
} );
|
||||
|
||||
// Juggle the two controls that use header_textcolor
|
||||
// Juggle the two controls that use header_textcolor.
|
||||
api.control( 'display_header_text', function( control ) {
|
||||
var last = '';
|
||||
|
||||
|
@ -203,9 +203,11 @@
|
||||
|
||||
_.bindAll( this, 'close' );
|
||||
|
||||
// If the available menu items panel is open and the customize controls are
|
||||
// interacted with (other than an item being deleted), then close the
|
||||
// available menu items panel. Also close on back button click.
|
||||
/*
|
||||
* If the available menu items panel is open and the customize controls
|
||||
* are interacted with (other than an item being deleted), then close
|
||||
* the available menu items panel. Also close on back button click.
|
||||
*/
|
||||
$( '#customize-controls, .customize-section-back' ).on( 'click keydown', function( e ) {
|
||||
var isDeleteBtn = $( e.target ).is( '.item-delete, .item-delete *' ),
|
||||
isAddNewBtn = $( e.target ).is( '.add-new-menu-item, .add-new-menu-item *' );
|
||||
@ -252,7 +254,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
// Close the panel if the URL in the preview changes
|
||||
// Close the panel if the URL in the preview changes.
|
||||
api.previewer.bind( 'url', this.close );
|
||||
|
||||
self.delegateEvents();
|
||||
@ -496,7 +498,7 @@
|
||||
|
||||
// Submit handler for keypress and click on menu item.
|
||||
_submit: function( event ) {
|
||||
// Only proceed with keypress if it is Enter or Spacebar
|
||||
// Only proceed with keypress if it is Enter or Spacebar.
|
||||
if ( 'keypress' === event.type && ( 13 !== event.which && 32 !== event.which ) ) {
|
||||
return;
|
||||
}
|
||||
@ -717,7 +719,7 @@
|
||||
this.$search.focus();
|
||||
},
|
||||
|
||||
// Closes the panel
|
||||
// Closes the panel.
|
||||
close: function( options ) {
|
||||
options = options || {};
|
||||
|
||||
@ -741,7 +743,7 @@
|
||||
isBackTab = ( 9 === event.which && event.shiftKey ),
|
||||
isSearchFocused = $( event.target ).is( this.$search );
|
||||
|
||||
// If enter pressed but nothing entered, don't do anything
|
||||
// If enter pressed but nothing entered, don't do anything.
|
||||
if ( isEnter && ! this.$search.val() ) {
|
||||
return;
|
||||
}
|
||||
@ -781,7 +783,7 @@
|
||||
}
|
||||
event.preventDefault();
|
||||
|
||||
// Hide description
|
||||
// Hide description.
|
||||
if ( content.not( ':hidden' ) ) {
|
||||
content.slideUp( 'fast' );
|
||||
help.attr( 'aria-expanded', 'false' );
|
||||
@ -802,7 +804,7 @@
|
||||
return false;
|
||||
} );
|
||||
|
||||
// Help toggle
|
||||
// Help toggle.
|
||||
help.on( 'click keydown', function( event ) {
|
||||
if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
|
||||
return;
|
||||
@ -1062,7 +1064,7 @@
|
||||
menuAutoAddControl.active.set( true );
|
||||
}
|
||||
|
||||
// Add the control for deleting the menu
|
||||
// Add the control for deleting the menu.
|
||||
menuDeleteControlId = section.id + '[delete]';
|
||||
menuDeleteControl = api.control( menuDeleteControlId );
|
||||
if ( ! menuDeleteControl ) {
|
||||
@ -1126,7 +1128,7 @@
|
||||
wpNavMenu.menuList = section.contentContainer;
|
||||
wpNavMenu.targetList = wpNavMenu.menuList;
|
||||
|
||||
// Add attributes needed by wpNavMenu
|
||||
// Add attributes needed by wpNavMenu.
|
||||
$( '#menu-to-edit' ).removeAttr( 'id' );
|
||||
wpNavMenu.menuList.attr( 'id', 'menu-to-edit' ).addClass( 'menu' );
|
||||
|
||||
@ -1145,7 +1147,8 @@
|
||||
wpNavMenu.initSortables(); // Depends on menu-to-edit ID being set above.
|
||||
section.deferred.initSortables.resolve( wpNavMenu.menuList ); // Now MenuControl can extend the sortable.
|
||||
|
||||
// @todo Note that wp.customize.reflowPaneContents() is debounced, so this immediate change will show a slight flicker while priorities get updated.
|
||||
// @todo Note that wp.customize.reflowPaneContents() is debounced,
|
||||
// so this immediate change will show a slight flicker while priorities get updated.
|
||||
api.control( 'nav_menu[' + String( section.params.menu_id ) + ']' ).reflowMenuItems();
|
||||
}
|
||||
if ( _.isFunction( completeCallback ) ) {
|
||||
@ -1415,7 +1418,7 @@
|
||||
navMenuLocationSetting = api( 'nav_menu_locations[' + checkbox.data( 'location-id' ) + ']' );
|
||||
navMenuLocationSetting.set( menuSection.params.menu_id );
|
||||
|
||||
// Reset state for next new menu
|
||||
// Reset state for next new menu.
|
||||
checkbox.prop( 'checked', false );
|
||||
}
|
||||
} );
|
||||
@ -1698,7 +1701,8 @@
|
||||
control.elements.classes = new api.Element( control.container.find( '.edit-menu-item-classes' ) );
|
||||
control.elements.xfn = new api.Element( control.container.find( '.edit-menu-item-xfn' ) );
|
||||
control.elements.description = new api.Element( control.container.find( '.edit-menu-item-description' ) );
|
||||
// @todo allow other elements, added by plugins, to be automatically picked up here; allow additional values to be added to setting array.
|
||||
// @todo Allow other elements, added by plugins, to be automatically picked up here;
|
||||
// allow additional values to be added to setting array.
|
||||
|
||||
_.each( control.elements, function( element, property ) {
|
||||
element.bind(function( value ) {
|
||||
@ -1790,7 +1794,7 @@
|
||||
$removeBtn = control.container.find( '.item-delete' );
|
||||
|
||||
$removeBtn.on( 'click', function() {
|
||||
// Find an adjacent element to add focus to when this menu item goes away
|
||||
// Find an adjacent element to add focus to when this menu item goes away.
|
||||
var addingItems = true, $adjacentFocusTarget, $next, $prev;
|
||||
|
||||
if ( ! $( 'body' ).hasClass( 'adding-menu-items' ) ) {
|
||||
@ -1811,7 +1815,7 @@
|
||||
control.container.slideUp( function() {
|
||||
control.setting.set( false );
|
||||
wp.a11y.speak( api.Menus.data.l10n.itemDeleted );
|
||||
$adjacentFocusTarget.focus(); // keyboard accessibility
|
||||
$adjacentFocusTarget.focus(); // Keyboard accessibility.
|
||||
} );
|
||||
|
||||
control.setting.set( false );
|
||||
@ -2778,13 +2782,13 @@
|
||||
action = sectionTitle.find( '.customize-action' ),
|
||||
name = displayNavMenuName( menu.name );
|
||||
|
||||
// Update the control title
|
||||
// Update the control title.
|
||||
controlTitle.text( name );
|
||||
if ( location.length ) {
|
||||
location.appendTo( controlTitle );
|
||||
}
|
||||
|
||||
// Update the section title
|
||||
// Update the section title.
|
||||
sectionTitle.text( name );
|
||||
if ( action.length ) {
|
||||
action.prependTo( sectionTitle );
|
||||
@ -2981,7 +2985,7 @@
|
||||
position: position
|
||||
}
|
||||
);
|
||||
delete item.id; // only used by Backbone
|
||||
delete item.id; // Only used by Backbone.
|
||||
|
||||
placeholderId = api.Menus.generatePlaceholderAutoIncrementId();
|
||||
customizeId = 'nav_menu_item[' + String( placeholderId ) + ']';
|
||||
|
@ -17,7 +17,7 @@
|
||||
api.Widgets = api.Widgets || {};
|
||||
api.Widgets.savedWidgetIds = {};
|
||||
|
||||
// Link settings
|
||||
// Link settings.
|
||||
api.Widgets.data = _wpCustomizeWidgetsSettings || {};
|
||||
l10n = api.Widgets.data.l10n;
|
||||
|
||||
@ -59,16 +59,16 @@
|
||||
model: api.Widgets.WidgetModel,
|
||||
|
||||
// Controls searching on the current widget collection
|
||||
// and triggers an update event
|
||||
// and triggers an update event.
|
||||
doSearch: function( value ) {
|
||||
|
||||
// Don't do anything if we've already done this search
|
||||
// Useful because the search handler fires multiple times per keystroke
|
||||
// Don't do anything if we've already done this search.
|
||||
// Useful because the search handler fires multiple times per keystroke.
|
||||
if ( this.terms === value ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Updates terms with the value passed
|
||||
// Updates terms with the value passed.
|
||||
this.terms = value;
|
||||
|
||||
// If we have terms, run a search...
|
||||
@ -84,16 +84,16 @@
|
||||
}
|
||||
},
|
||||
|
||||
// Performs a search within the collection
|
||||
// Performs a search within the collection.
|
||||
// @uses RegExp
|
||||
search: function( term ) {
|
||||
var match, haystack;
|
||||
|
||||
// Escape the term string for RegExp meta characters
|
||||
// Escape the term string for RegExp meta characters.
|
||||
term = term.replace( /[-\/\\^$*+?.()|[\]{}]/g, '\\$&' );
|
||||
|
||||
// Consider spaces as word delimiters and match the whole string
|
||||
// so matching terms can be combined
|
||||
// so matching terms can be combined.
|
||||
term = term.replace( / /g, ')(?=.*' );
|
||||
match = new RegExp( '^(?=.*' + term + ').+', 'i' );
|
||||
|
||||
@ -150,10 +150,10 @@
|
||||
'keydown' : 'keyboardAccessible'
|
||||
},
|
||||
|
||||
// Cache current selected widget
|
||||
// Cache current selected widget.
|
||||
selected: null,
|
||||
|
||||
// Cache sidebar control which has opened panel
|
||||
// Cache sidebar control which has opened panel.
|
||||
currentSidebarControl: null,
|
||||
$search: null,
|
||||
$clearResults: null,
|
||||
@ -181,9 +181,11 @@
|
||||
// Set the initial search count to the number of available widgets.
|
||||
this.searchMatchesCount = this.collection.length;
|
||||
|
||||
// If the available widgets panel is open and the customize controls are
|
||||
// interacted with (i.e. available widgets panel is blurred) then close the
|
||||
// available widgets panel. Also close on back button click.
|
||||
/*
|
||||
* If the available widgets panel is open and the customize controls
|
||||
* are interacted with (i.e. available widgets panel is blurred) then
|
||||
* close the available widgets panel. Also close on back button click.
|
||||
*/
|
||||
$( '#customize-controls, #available-widgets .customize-section-title' ).on( 'click keydown', function( e ) {
|
||||
var isAddNewBtn = $( e.target ).is( '.add-new-widget, .add-new-widget *' );
|
||||
if ( $( 'body' ).hasClass( 'adding-widget' ) && ! isAddNewBtn ) {
|
||||
@ -197,7 +199,7 @@
|
||||
self.collection.doSearch( '' );
|
||||
} );
|
||||
|
||||
// Close the panel if the URL in the preview changes
|
||||
// Close the panel if the URL in the preview changes.
|
||||
api.previewer.bind( 'url', this.close );
|
||||
},
|
||||
|
||||
@ -213,19 +215,19 @@
|
||||
// Announce how many search results.
|
||||
this.announceSearchMatches();
|
||||
|
||||
// Remove a widget from being selected if it is no longer visible
|
||||
// Remove a widget from being selected if it is no longer visible.
|
||||
if ( this.selected && ! this.selected.is( ':visible' ) ) {
|
||||
this.selected.removeClass( 'selected' );
|
||||
this.selected = null;
|
||||
}
|
||||
|
||||
// If a widget was selected but the filter value has been cleared out, clear selection
|
||||
// If a widget was selected but the filter value has been cleared out, clear selection.
|
||||
if ( this.selected && ! event.target.value ) {
|
||||
this.selected.removeClass( 'selected' );
|
||||
this.selected = null;
|
||||
}
|
||||
|
||||
// If a filter has been entered and a widget hasn't been selected, select the first one shown
|
||||
// If a filter has been entered and a widget hasn't been selected, select the first one shown.
|
||||
if ( ! this.selected && event.target.value ) {
|
||||
firstVisible = this.$el.find( '> .widget-tpl:visible:first' );
|
||||
if ( firstVisible.length ) {
|
||||
@ -301,7 +303,7 @@
|
||||
* Handles submit for keypress and click on widget.
|
||||
*/
|
||||
_submit: function( event ) {
|
||||
// Only proceed with keypress if it is Enter or Spacebar
|
||||
// Only proceed with keypress if it is Enter or Spacebar.
|
||||
if ( event.type === 'keypress' && ( event.which !== 13 && event.which !== 32 ) ) {
|
||||
return;
|
||||
}
|
||||
@ -345,7 +347,7 @@
|
||||
open: function( sidebarControl ) {
|
||||
this.currentSidebarControl = sidebarControl;
|
||||
|
||||
// Wide widget controls appear over the preview, and so they need to be collapsed when the panel opens
|
||||
// Wide widget controls appear over the preview, and so they need to be collapsed when the panel opens.
|
||||
_( this.currentSidebarControl.getWidgetFormControls() ).each( function( control ) {
|
||||
if ( control.params.is_wide ) {
|
||||
control.collapseForm();
|
||||
@ -360,7 +362,7 @@
|
||||
|
||||
this.$el.find( '.selected' ).removeClass( 'selected' );
|
||||
|
||||
// Reset search
|
||||
// Reset search.
|
||||
this.collection.doSearch( '' );
|
||||
|
||||
if ( ! api.settings.browser.mobile ) {
|
||||
@ -428,7 +430,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// If enter pressed but nothing entered, don't do anything
|
||||
// If enter pressed but nothing entered, don't do anything.
|
||||
if ( isEnter && ! this.$search.val() ) {
|
||||
return;
|
||||
}
|
||||
@ -602,7 +604,7 @@
|
||||
_setupModel: function() {
|
||||
var self = this, rememberSavedWidgetId;
|
||||
|
||||
// Remember saved widgets so we know which to trash (move to inactive widgets sidebar)
|
||||
// Remember saved widgets so we know which to trash (move to inactive widgets sidebar).
|
||||
rememberSavedWidgetId = function() {
|
||||
api.Widgets.savedWidgetIds[self.params.widget_id] = true;
|
||||
};
|
||||
@ -613,7 +615,7 @@
|
||||
this.isWidgetUpdating = false;
|
||||
this.liveUpdateMode = true;
|
||||
|
||||
// Update widget whenever model changes
|
||||
// Update widget whenever model changes.
|
||||
this.setting.bind( function( to, from ) {
|
||||
if ( ! _( from ).isEqual( to ) && ! self.isWidgetUpdating ) {
|
||||
self.updateWidget( { instance: to } );
|
||||
@ -658,10 +660,10 @@
|
||||
top;
|
||||
$widgetInside.css( 'max-height', windowHeight );
|
||||
top = Math.max(
|
||||
0, // prevent top from going off screen
|
||||
0, // Prevent top from going off screen.
|
||||
Math.min(
|
||||
Math.max( offsetTop, 0 ), // distance widget in panel is from top of screen
|
||||
windowHeight - formHeight // flush up against bottom of screen
|
||||
Math.max( offsetTop, 0 ), // Distance widget in panel is from top of screen.
|
||||
windowHeight - formHeight // Flush up against bottom of screen.
|
||||
)
|
||||
);
|
||||
$widgetInside.css( 'top', top );
|
||||
@ -680,7 +682,7 @@
|
||||
$themeControlsContainer.off( 'expanded collapsed', positionWidget );
|
||||
} );
|
||||
|
||||
// Reposition whenever a sidebar's widgets are changed
|
||||
// Reposition whenever a sidebar's widgets are changed.
|
||||
api.each( function( setting ) {
|
||||
if ( 0 === setting.id.indexOf( 'sidebars_widgets[' ) ) {
|
||||
setting.bind( function() {
|
||||
@ -711,7 +713,7 @@
|
||||
$closeBtn = this.container.find( '.widget-control-close' );
|
||||
$closeBtn.on( 'click', function() {
|
||||
self.collapse();
|
||||
self.container.find( '.widget-top .widget-action:first' ).focus(); // keyboard accessibility
|
||||
self.container.find( '.widget-top .widget-action:first' ).focus(); // Keyboard accessibility.
|
||||
} );
|
||||
},
|
||||
|
||||
@ -838,7 +840,7 @@
|
||||
wp.a11y.speak( l10n.widgetMovedDown );
|
||||
}
|
||||
|
||||
$( this ).focus(); // re-focus after the container was moved
|
||||
$( this ).focus(); // Re-focus after the container was moved.
|
||||
}
|
||||
} );
|
||||
|
||||
@ -886,12 +888,12 @@
|
||||
_setupHighlightEffects: function() {
|
||||
var self = this;
|
||||
|
||||
// Highlight whenever hovering or clicking over the form
|
||||
// Highlight whenever hovering or clicking over the form.
|
||||
this.container.on( 'mouseenter click', function() {
|
||||
self.setting.previewer.send( 'highlight-widget', self.params.widget_id );
|
||||
} );
|
||||
|
||||
// Highlight when the setting is updated
|
||||
// Highlight when the setting is updated.
|
||||
this.setting.bind( function() {
|
||||
self.setting.previewer.send( 'highlight-widget', self.params.widget_id );
|
||||
} );
|
||||
@ -907,7 +909,7 @@
|
||||
$widgetRoot = this.container.find( '.widget:first' );
|
||||
$widgetContent = $widgetRoot.find( '.widget-content:first' );
|
||||
|
||||
// Configure update button
|
||||
// Configure update button.
|
||||
$saveBtn = this.container.find( '.widget-control-save' );
|
||||
$saveBtn.val( l10n.saveBtnLabel );
|
||||
$saveBtn.attr( 'title', l10n.saveBtnTooltip );
|
||||
@ -921,15 +923,15 @@
|
||||
self.updateWidget();
|
||||
}, 250 );
|
||||
|
||||
// Trigger widget form update when hitting Enter within an input
|
||||
// Trigger widget form update when hitting Enter within an input.
|
||||
$widgetContent.on( 'keydown', 'input', function( e ) {
|
||||
if ( 13 === e.which ) { // Enter
|
||||
if ( 13 === e.which ) { // Enter.
|
||||
e.preventDefault();
|
||||
self.updateWidget( { ignoreActiveElement: true } );
|
||||
}
|
||||
} );
|
||||
|
||||
// Handle widgets that support live previews
|
||||
// Handle widgets that support live previews.
|
||||
$widgetContent.on( 'change input propertychange', ':input', function( e ) {
|
||||
if ( ! self.liveUpdateMode ) {
|
||||
return;
|
||||
@ -939,7 +941,7 @@
|
||||
}
|
||||
} );
|
||||
|
||||
// Remove loading indicators when the setting is saved and the preview updates
|
||||
// Remove loading indicators when the setting is saved and the preview updates.
|
||||
this.setting.previewer.channel.bind( 'synced', function() {
|
||||
self.container.removeClass( 'previewer-loading' );
|
||||
} );
|
||||
@ -972,7 +974,7 @@
|
||||
* @param {function} args.completeCallback
|
||||
*/
|
||||
onChangeActive: function ( active, args ) {
|
||||
// Note: there is a second 'args' parameter being passed, merged on top of this.defaultActiveArguments
|
||||
// Note: there is a second 'args' parameter being passed, merged on top of this.defaultActiveArguments.
|
||||
this.container.toggleClass( 'widget-rendered', active );
|
||||
if ( args.completeCallback ) {
|
||||
args.completeCallback();
|
||||
@ -985,10 +987,10 @@
|
||||
_setupRemoveUI: function() {
|
||||
var self = this, $removeBtn, replaceDeleteWithRemove;
|
||||
|
||||
// Configure remove button
|
||||
// Configure remove button.
|
||||
$removeBtn = this.container.find( '.widget-control-remove' );
|
||||
$removeBtn.on( 'click', function() {
|
||||
// Find an adjacent element to add focus to when this widget goes away
|
||||
// Find an adjacent element to add focus to when this widget goes away.
|
||||
var $adjacentFocusTarget;
|
||||
if ( self.container.next().is( '.customize-control-widget_form' ) ) {
|
||||
$adjacentFocusTarget = self.container.next().find( '.widget-action:first' );
|
||||
@ -1015,12 +1017,12 @@
|
||||
sidebarWidgetIds.splice( i, 1 );
|
||||
sidebarsWidgetsControl.setting( sidebarWidgetIds );
|
||||
|
||||
$adjacentFocusTarget.focus(); // keyboard accessibility
|
||||
$adjacentFocusTarget.focus(); // Keyboard accessibility.
|
||||
} );
|
||||
} );
|
||||
|
||||
replaceDeleteWithRemove = function() {
|
||||
$removeBtn.text( l10n.removeBtnLabel ); // wp_widget_control() outputs the button as "Delete"
|
||||
$removeBtn.text( l10n.removeBtnLabel ); // wp_widget_control() outputs the button as "Delete".
|
||||
$removeBtn.attr( 'title', l10n.removeBtnTooltip );
|
||||
};
|
||||
|
||||
@ -1105,7 +1107,7 @@
|
||||
if ( ! $.isArray( state ) ) {
|
||||
state = [];
|
||||
} else {
|
||||
// Make sure all state items are strings since the DOM value is a string
|
||||
// Make sure all state items are strings since the DOM value is a string.
|
||||
state = _.map( state, function ( value ) {
|
||||
return String( value );
|
||||
} );
|
||||
@ -1169,7 +1171,7 @@
|
||||
$widgetRoot = this.container.find( '.widget:first' );
|
||||
$widgetContent = $widgetRoot.find( '.widget-content:first' );
|
||||
|
||||
// Remove a previous error message
|
||||
// Remove a previous error message.
|
||||
$widgetContent.find( '.widget-error' ).remove();
|
||||
|
||||
this.container.addClass( 'widget-form-loading' );
|
||||
@ -1191,9 +1193,11 @@
|
||||
data = $.param( params );
|
||||
$inputs = this._getInputs( $widgetContent );
|
||||
|
||||
// Store the value we're submitting in data so that when the response comes back,
|
||||
// we know if it got sanitized; if there is no difference in the sanitized value,
|
||||
// then we do not need to touch the UI and mess up the user's ongoing editing.
|
||||
/*
|
||||
* Store the value we're submitting in data so that when the response comes back,
|
||||
* we know if it got sanitized; if there is no difference in the sanitized value,
|
||||
* then we do not need to touch the UI and mess up the user's ongoing editing.
|
||||
*/
|
||||
$inputs.each( function() {
|
||||
$( this ).data( 'state' + updateNumber, self._getInputState( this ) );
|
||||
} );
|
||||
@ -1236,14 +1240,14 @@
|
||||
$sanitizedInputs = self._getInputs( sanitizedForm );
|
||||
hasSameInputsInResponse = self._getInputsSignature( $inputs ) === self._getInputsSignature( $sanitizedInputs );
|
||||
|
||||
// Restore live update mode if sanitized fields are now aligned with the existing fields
|
||||
// Restore live update mode if sanitized fields are now aligned with the existing fields.
|
||||
if ( hasSameInputsInResponse && ! self.liveUpdateMode ) {
|
||||
self.liveUpdateMode = true;
|
||||
self.container.removeClass( 'widget-form-disabled' );
|
||||
self.container.find( 'input[name="savewidget"]' ).hide();
|
||||
}
|
||||
|
||||
// Sync sanitized field states to existing fields if they are aligned
|
||||
// Sync sanitized field states to existing fields if they are aligned.
|
||||
if ( hasSameInputsInResponse && self.liveUpdateMode ) {
|
||||
$inputs.each( function( i ) {
|
||||
var $input = $( this ),
|
||||
@ -1262,13 +1266,13 @@
|
||||
|
||||
$( document ).trigger( 'widget-synced', [ $widgetRoot, r.data.form ] );
|
||||
|
||||
// Otherwise, if sanitized fields are not aligned with existing fields, disable live update mode if enabled
|
||||
// Otherwise, if sanitized fields are not aligned with existing fields, disable live update mode if enabled.
|
||||
} else if ( self.liveUpdateMode ) {
|
||||
self.liveUpdateMode = false;
|
||||
self.container.find( 'input[name="savewidget"]' ).show();
|
||||
isLiveUpdateAborted = true;
|
||||
|
||||
// Otherwise, replace existing form with the sanitized form
|
||||
// Otherwise, replace existing form with the sanitized form.
|
||||
} else {
|
||||
$widgetContent.html( r.data.form );
|
||||
|
||||
@ -1284,11 +1288,11 @@
|
||||
*/
|
||||
isChanged = ! isLiveUpdateAborted && ! _( self.setting() ).isEqual( r.data.instance );
|
||||
if ( isChanged ) {
|
||||
self.isWidgetUpdating = true; // suppress triggering another updateWidget
|
||||
self.isWidgetUpdating = true; // Suppress triggering another updateWidget.
|
||||
self.setting( r.data.instance );
|
||||
self.isWidgetUpdating = false;
|
||||
} else {
|
||||
// no change was made, so stop the spinner now instead of when the preview would updates
|
||||
// No change was made, so stop the spinner now instead of when the preview would updates.
|
||||
self.container.removeClass( 'previewer-loading' );
|
||||
}
|
||||
|
||||
@ -1296,7 +1300,7 @@
|
||||
completeCallback.call( self, null, { noChange: ! isChanged, ajaxFinished: true } );
|
||||
}
|
||||
} else {
|
||||
// General error message
|
||||
// General error message.
|
||||
message = l10n.error;
|
||||
|
||||
if ( r.data && r.data.message ) {
|
||||
@ -1406,7 +1410,7 @@
|
||||
self.embedWidgetContent();
|
||||
}
|
||||
|
||||
// If the expanded state is unchanged only manipulate container expanded states
|
||||
// If the expanded state is unchanged only manipulate container expanded states.
|
||||
if ( args.unchanged ) {
|
||||
if ( expanded ) {
|
||||
api.Control.prototype.expand.call( self, {
|
||||
@ -1422,7 +1426,7 @@
|
||||
|
||||
expandControl = function() {
|
||||
|
||||
// Close all other widget controls before expanding this one
|
||||
// Close all other widget controls before expanding this one.
|
||||
api.control.each( function( otherControl ) {
|
||||
if ( self.params.type === otherControl.params.type && self !== otherControl ) {
|
||||
otherControl.collapse();
|
||||
@ -1535,7 +1539,7 @@
|
||||
i = this.getWidgetSidebarPosition();
|
||||
|
||||
sidebarWidgetsSetting = this.getSidebarWidgetsControl().setting;
|
||||
sidebarWidgetIds = Array.prototype.slice.call( sidebarWidgetsSetting() ); // clone
|
||||
sidebarWidgetIds = Array.prototype.slice.call( sidebarWidgetsSetting() ); // Clone.
|
||||
adjacentWidgetId = sidebarWidgetIds[i + offset];
|
||||
sidebarWidgetIds[i + offset] = this.params.widget_id;
|
||||
sidebarWidgetIds[i] = adjacentWidgetId;
|
||||
@ -1558,7 +1562,7 @@
|
||||
}
|
||||
|
||||
if ( showOrHide ) {
|
||||
// reset the selected sidebar
|
||||
// Reset the selected sidebar.
|
||||
$moveWidgetArea.find( '.selected' ).removeClass( 'selected' );
|
||||
|
||||
$moveWidgetArea.find( 'li' ).filter( function() {
|
||||
@ -1781,7 +1785,7 @@
|
||||
|
||||
removedWidgetIds = _( oldWidgetIds ).difference( newWidgetIds );
|
||||
|
||||
// Filter out any persistent widget IDs for widgets which have been deactivated
|
||||
// Filter out any persistent widget IDs for widgets which have been deactivated.
|
||||
newWidgetIds = _( newWidgetIds ).filter( function( newWidgetId ) {
|
||||
var parsedWidgetId = parseWidgetId( newWidgetId );
|
||||
|
||||
@ -1798,7 +1802,7 @@
|
||||
return widgetFormControl;
|
||||
} );
|
||||
|
||||
// Sort widget controls to their new positions
|
||||
// Sort widget controls to their new positions.
|
||||
widgetFormControls.sort( function( a, b ) {
|
||||
var aIndex = _.indexOf( newWidgetIds, a.params.widget_id ),
|
||||
bIndex = _.indexOf( newWidgetIds, b.params.widget_id );
|
||||
@ -1811,25 +1815,26 @@
|
||||
control.section( self.section() );
|
||||
priority += 1;
|
||||
});
|
||||
self.priority( priority ); // Make sure sidebar control remains at end
|
||||
self.priority( priority ); // Make sure sidebar control remains at end.
|
||||
|
||||
// Re-sort widget form controls (including widgets form other sidebars newly moved here)
|
||||
// Re-sort widget form controls (including widgets form other sidebars newly moved here).
|
||||
self._applyCardinalOrderClassNames();
|
||||
|
||||
// If the widget was dragged into the sidebar, make sure the sidebar_id param is updated
|
||||
// If the widget was dragged into the sidebar, make sure the sidebar_id param is updated.
|
||||
_( widgetFormControls ).each( function( widgetFormControl ) {
|
||||
widgetFormControl.params.sidebar_id = self.params.sidebar_id;
|
||||
} );
|
||||
|
||||
// Cleanup after widget removal
|
||||
// Cleanup after widget removal.
|
||||
_( removedWidgetIds ).each( function( removedWidgetId ) {
|
||||
|
||||
// Using setTimeout so that when moving a widget to another sidebar, the other sidebars_widgets settings get a chance to update
|
||||
// Using setTimeout so that when moving a widget to another sidebar,
|
||||
// the other sidebars_widgets settings get a chance to update.
|
||||
setTimeout( function() {
|
||||
var removedControl, wasDraggedToAnotherSidebar, inactiveWidgets, removedIdBase,
|
||||
widget, isPresentInAnotherSidebar = false;
|
||||
|
||||
// Check if the widget is in another sidebar
|
||||
// Check if the widget is in another sidebar.
|
||||
api.each( function( otherSetting ) {
|
||||
if ( otherSetting.id === self.setting.id || 0 !== otherSetting.id.indexOf( 'sidebars_widgets[' ) || otherSetting.id === 'sidebars_widgets[wp_inactive_widgets]' ) {
|
||||
return;
|
||||
@ -1850,24 +1855,24 @@
|
||||
|
||||
removedControl = api.Widgets.getWidgetFormControlForWidget( removedWidgetId );
|
||||
|
||||
// Detect if widget control was dragged to another sidebar
|
||||
// Detect if widget control was dragged to another sidebar.
|
||||
wasDraggedToAnotherSidebar = removedControl && $.contains( document, removedControl.container[0] ) && ! $.contains( self.$sectionContent[0], removedControl.container[0] );
|
||||
|
||||
// Delete any widget form controls for removed widgets
|
||||
// Delete any widget form controls for removed widgets.
|
||||
if ( removedControl && ! wasDraggedToAnotherSidebar ) {
|
||||
api.control.remove( removedControl.id );
|
||||
removedControl.container.remove();
|
||||
}
|
||||
|
||||
// Move widget to inactive widgets sidebar (move it to trash) if has been previously saved
|
||||
// This prevents the inactive widgets sidebar from overflowing with throwaway widgets
|
||||
// Move widget to inactive widgets sidebar (move it to trash) if has been previously saved.
|
||||
// This prevents the inactive widgets sidebar from overflowing with throwaway widgets.
|
||||
if ( api.Widgets.savedWidgetIds[removedWidgetId] ) {
|
||||
inactiveWidgets = api.value( 'sidebars_widgets[wp_inactive_widgets]' )().slice();
|
||||
inactiveWidgets.push( removedWidgetId );
|
||||
api.value( 'sidebars_widgets[wp_inactive_widgets]' )( _( inactiveWidgets ).unique() );
|
||||
}
|
||||
|
||||
// Make old single widget available for adding again
|
||||
// Make old single widget available for adding again.
|
||||
removedIdBase = parseWidgetId( removedWidgetId ).id_base;
|
||||
widget = api.Widgets.availableWidgets.findWhere( { id_base: removedIdBase } );
|
||||
if ( widget && ! widget.get( 'is_multi' ) ) {
|
||||
@ -1916,9 +1921,9 @@
|
||||
over: function() {
|
||||
var section = api.section( self.section.get() );
|
||||
section.expand({
|
||||
allowMultiple: true, // Prevent the section being dragged from to be collapsed
|
||||
allowMultiple: true, // Prevent the section being dragged from to be collapsed.
|
||||
completeCallback: function () {
|
||||
// @todo It is not clear when refreshPositions should be called on which sections, or if it is even needed
|
||||
// @todo It is not clear when refreshPositions should be called on which sections, or if it is even needed.
|
||||
api.section.each( function ( otherSection ) {
|
||||
if ( otherSection.container.find( '.customize-control-sidebar_widgets' ).length ) {
|
||||
otherSection.container.find( '.accordion-section-content:first' ).sortable( 'refreshPositions' );
|
||||
@ -2079,7 +2084,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set up new multi widget
|
||||
// Set up new multi widget.
|
||||
if ( widget.get( 'is_multi' ) && ! widgetNumber ) {
|
||||
widget.set( 'multi_number', widget.get( 'multi_number' ) + 1 );
|
||||
widgetNumber = widget.get( 'multi_number' );
|
||||
@ -2091,7 +2096,7 @@
|
||||
return m.replace( /__i__|%i%/g, widgetNumber );
|
||||
} );
|
||||
} else {
|
||||
widget.set( 'is_disabled', true ); // Prevent single widget from being added again now
|
||||
widget.set( 'is_disabled', true ); // Prevent single widget from being added again now.
|
||||
}
|
||||
|
||||
$widget = $( controlHtml );
|
||||
@ -2101,7 +2106,7 @@
|
||||
.addClass( 'customize-control-' + controlType )
|
||||
.append( $widget );
|
||||
|
||||
// Remove icon which is visible inside the panel
|
||||
// Remove icon which is visible inside the panel.
|
||||
controlContainer.find( '> .widget-icon' ).remove();
|
||||
|
||||
if ( widget.get( 'is_multi' ) ) {
|
||||
@ -2111,7 +2116,7 @@
|
||||
|
||||
widgetId = controlContainer.find( '[name="widget-id"]' ).val();
|
||||
|
||||
controlContainer.hide(); // to be slid-down below
|
||||
controlContainer.hide(); // To be slid-down below.
|
||||
|
||||
settingId = 'widget_' + widget.get( 'id_base' );
|
||||
if ( widget.get( 'is_multi' ) ) {
|
||||
@ -2119,7 +2124,7 @@
|
||||
}
|
||||
controlContainer.attr( 'id', 'customize-control-' + settingId.replace( /\]/g, '' ).replace( /\[/g, '-' ) );
|
||||
|
||||
// Only create setting if it doesn't already exist (if we're adding a pre-existing inactive widget)
|
||||
// Only create setting if it doesn't already exist (if we're adding a pre-existing inactive widget).
|
||||
isExistingWidget = api.has( settingId );
|
||||
if ( ! isExistingWidget ) {
|
||||
settingArgs = {
|
||||
@ -2127,7 +2132,7 @@
|
||||
previewer: this.setting.previewer
|
||||
};
|
||||
setting = api.create( settingId, settingId, '', settingArgs );
|
||||
setting.set( {} ); // mark dirty, changing from '' to {}
|
||||
setting.set( {} ); // Mark dirty, changing from '' to {}.
|
||||
}
|
||||
|
||||
controlConstructor = api.controlConstructor[controlType];
|
||||
@ -2147,7 +2152,7 @@
|
||||
} );
|
||||
api.control.add( widgetFormControl );
|
||||
|
||||
// Make sure widget is removed from the other sidebars
|
||||
// Make sure widget is removed from the other sidebars.
|
||||
api.each( function( otherSetting ) {
|
||||
if ( otherSetting.id === self.setting.id ) {
|
||||
return;
|
||||
@ -2166,7 +2171,7 @@
|
||||
}
|
||||
} );
|
||||
|
||||
// Add widget to this sidebar
|
||||
// Add widget to this sidebar.
|
||||
sidebarWidgets = this.setting().slice();
|
||||
if ( -1 === _.indexOf( sidebarWidgets, widgetId ) ) {
|
||||
sidebarWidgets.push( widgetId );
|
||||
@ -2185,7 +2190,7 @@
|
||||
}
|
||||
} );
|
||||
|
||||
// Register models for custom panel, section, and control types
|
||||
// Register models for custom panel, section, and control types.
|
||||
$.extend( api.panelConstructor, {
|
||||
widgets: api.Widgets.WidgetsPanel
|
||||
});
|
||||
@ -2201,15 +2206,15 @@
|
||||
* Init Customizer for widgets.
|
||||
*/
|
||||
api.bind( 'ready', function() {
|
||||
// Set up the widgets panel
|
||||
// Set up the widgets panel.
|
||||
api.Widgets.availableWidgetsPanel = new api.Widgets.AvailableWidgetsPanelView({
|
||||
collection: api.Widgets.availableWidgets
|
||||
});
|
||||
|
||||
// Highlight widget control
|
||||
// Highlight widget control.
|
||||
api.previewer.bind( 'highlight-widget-control', api.Widgets.highlightWidgetFormControl );
|
||||
|
||||
// Open and focus widget control
|
||||
// Open and focus widget control.
|
||||
api.previewer.bind( 'focus-widget-control', api.Widgets.focusWidgetFormControl );
|
||||
} );
|
||||
|
||||
@ -2247,7 +2252,7 @@
|
||||
api.Widgets.getSidebarWidgetControlContainingWidget = function( widgetId ) {
|
||||
var foundControl = null;
|
||||
|
||||
// @todo this can use widgetIdToSettingId(), then pass into wp.customize.control( x ).getSidebarWidgetsControl()
|
||||
// @todo This can use widgetIdToSettingId(), then pass into wp.customize.control( x ).getSidebarWidgetsControl().
|
||||
api.control.each( function( control ) {
|
||||
if ( control.params.type === 'sidebar_widgets' && -1 !== _.indexOf( control.setting(), widgetId ) ) {
|
||||
foundControl = control;
|
||||
@ -2266,7 +2271,7 @@
|
||||
api.Widgets.getWidgetFormControlForWidget = function( widgetId ) {
|
||||
var foundControl = null;
|
||||
|
||||
// @todo We can just use widgetIdToSettingId() here
|
||||
// @todo We can just use widgetIdToSettingId() here.
|
||||
api.control.each( function( control ) {
|
||||
if ( control.params.type === 'widget_form' && control.params.widget_id === widgetId ) {
|
||||
foundControl = control;
|
||||
@ -2343,7 +2348,7 @@
|
||||
parsed.id_base = matches[1];
|
||||
parsed.number = parseInt( matches[2], 10 );
|
||||
} else {
|
||||
// likely an old single widget
|
||||
// Likely an old single widget.
|
||||
parsed.id_base = widgetId;
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ var getCount, updateCount, updateCountText, updatePending, updateApproved,
|
||||
var newTitle, regExMatch, titleCount, commentFrag;
|
||||
|
||||
titleRegEx = titleRegEx || new RegExp( adminCommentsL10n.docTitleCommentsCount.replace( '%s', '\\([0-9' + thousandsSeparator + ']+\\)' ) + '?' );
|
||||
// count funcs operate on a $'d element
|
||||
// Count funcs operate on a $'d element.
|
||||
titleDiv = titleDiv || $( '<div />' );
|
||||
newTitle = adminTitle;
|
||||
|
||||
@ -256,7 +256,7 @@ var getCount, updateCount, updateCountText, updatePending, updateApproved,
|
||||
return;
|
||||
}
|
||||
|
||||
// cache selectors to not get dupes
|
||||
// Cache selectors to not get dupes.
|
||||
pending = $( 'span.' + pendingClass, postSelector );
|
||||
noPending = $( 'span.' + noClass, postSelector );
|
||||
|
||||
@ -444,7 +444,7 @@ window.setCommentsList = function() {
|
||||
|
||||
a.click(function( e ){
|
||||
e.preventDefault();
|
||||
e.stopPropagation(); // ticket #35904
|
||||
e.stopPropagation(); // Ticket #35904.
|
||||
list.wpList.del(this);
|
||||
$('#undo-' + id).css( {backgroundColor:'#ceb'} ).fadeOut(350, function(){
|
||||
$(this).remove();
|
||||
@ -491,17 +491,19 @@ window.setCommentsList = function() {
|
||||
unapproved = commentRow.hasClass( 'unapproved' ),
|
||||
spammed = commentRow.hasClass( 'spam' ),
|
||||
trashed = commentRow.hasClass( 'trash' ),
|
||||
undoing = false; // ticket #35904
|
||||
undoing = false; // Ticket #35904.
|
||||
|
||||
updateDashboardText( newTotal );
|
||||
updateInModerationText( newTotal );
|
||||
|
||||
// the order of these checks is important
|
||||
// .unspam can also have .approve or .unapprove
|
||||
// .untrash can also have .approve or .unapprove
|
||||
/*
|
||||
* The order of these checks is important.
|
||||
* .unspam can also have .approve or .unapprove.
|
||||
* .untrash can also have .approve or .unapprove.
|
||||
*/
|
||||
|
||||
if ( targetParent.is( 'span.undo' ) ) {
|
||||
// the comment was spammed
|
||||
// The comment was spammed.
|
||||
if ( targetParent.hasClass( 'unspam' ) ) {
|
||||
spamDiff = -1;
|
||||
|
||||
@ -513,7 +515,7 @@ window.setCommentsList = function() {
|
||||
pendingDiff = 1;
|
||||
}
|
||||
|
||||
// the comment was trashed
|
||||
// The comment was trashed.
|
||||
} else if ( targetParent.hasClass( 'untrash' ) ) {
|
||||
trashDiff = -1;
|
||||
|
||||
@ -528,32 +530,32 @@ window.setCommentsList = function() {
|
||||
|
||||
undoing = true;
|
||||
|
||||
// user clicked "Spam"
|
||||
// User clicked "Spam".
|
||||
} else if ( targetParent.is( 'span.spam' ) ) {
|
||||
// the comment is currently approved
|
||||
// The comment is currently approved.
|
||||
if ( approved ) {
|
||||
approvedDiff = -1;
|
||||
// the comment is currently pending
|
||||
// The comment is currently pending.
|
||||
} else if ( unapproved ) {
|
||||
pendingDiff = -1;
|
||||
// the comment was in the trash
|
||||
// The comment was in the trash.
|
||||
} else if ( trashed ) {
|
||||
trashDiff = -1;
|
||||
}
|
||||
// you can't spam an item on the spam screen
|
||||
// You can't spam an item on the Spam screen.
|
||||
spamDiff = 1;
|
||||
|
||||
// user clicked "Unspam"
|
||||
// User clicked "Unspam".
|
||||
} else if ( targetParent.is( 'span.unspam' ) ) {
|
||||
if ( approved ) {
|
||||
pendingDiff = 1;
|
||||
} else if ( unapproved ) {
|
||||
approvedDiff = 1;
|
||||
} else if ( trashed ) {
|
||||
// the comment was previously approved
|
||||
// The comment was previously approved.
|
||||
if ( targetParent.hasClass( 'approve' ) ) {
|
||||
approvedDiff = 1;
|
||||
// the comment was previously pending
|
||||
// The comment was previously pending.
|
||||
} else if ( targetParent.hasClass( 'unapprove' ) ) {
|
||||
pendingDiff = 1;
|
||||
}
|
||||
@ -565,23 +567,23 @@ window.setCommentsList = function() {
|
||||
pendingDiff = 1;
|
||||
}
|
||||
}
|
||||
// you can Unspam an item on the spam screen
|
||||
// You can unspam an item on the Spam screen.
|
||||
spamDiff = -1;
|
||||
|
||||
// user clicked "Trash"
|
||||
// User clicked "Trash".
|
||||
} else if ( targetParent.is( 'span.trash' ) ) {
|
||||
if ( approved ) {
|
||||
approvedDiff = -1;
|
||||
} else if ( unapproved ) {
|
||||
pendingDiff = -1;
|
||||
// the comment was in the spam queue
|
||||
// The comment was in the spam queue.
|
||||
} else if ( spammed ) {
|
||||
spamDiff = -1;
|
||||
}
|
||||
// you can't trash an item on the trash screen
|
||||
// You can't trash an item on the Trash screen.
|
||||
trashDiff = 1;
|
||||
|
||||
// user clicked "Restore"
|
||||
// User clicked "Restore".
|
||||
} else if ( targetParent.is( 'span.untrash' ) ) {
|
||||
if ( approved ) {
|
||||
pendingDiff = 1;
|
||||
@ -594,21 +596,21 @@ window.setCommentsList = function() {
|
||||
pendingDiff = 1;
|
||||
}
|
||||
}
|
||||
// you can't go from trash to spam
|
||||
// you can untrash on the trash screen
|
||||
// You can't go from Trash to Spam.
|
||||
// You can untrash on the Trash screen.
|
||||
trashDiff = -1;
|
||||
|
||||
// User clicked "Approve"
|
||||
// User clicked "Approve".
|
||||
} else if ( targetParent.is( 'span.approve:not(.unspam):not(.untrash)' ) ) {
|
||||
approvedDiff = 1;
|
||||
pendingDiff = -1;
|
||||
|
||||
// User clicked "Unapprove"
|
||||
// User clicked "Unapprove".
|
||||
} else if ( targetParent.is( 'span.unapprove:not(.unspam):not(.untrash)' ) ) {
|
||||
approvedDiff = -1;
|
||||
pendingDiff = 1;
|
||||
|
||||
// User clicked "Delete Permanently"
|
||||
// User clicked "Delete Permanently".
|
||||
} else if ( targetParent.is( 'span.delete' ) ) {
|
||||
if ( spammed ) {
|
||||
spamDiff = -1;
|
||||
@ -713,17 +715,17 @@ window.setCommentsList = function() {
|
||||
|
||||
if (ev) {
|
||||
theExtraList.empty();
|
||||
args.number = Math.min(8, per_page); // see WP_Comments_List_Table::prepare_items() @ class-wp-comments-list-table.php
|
||||
args.number = Math.min(8, per_page); // See WP_Comments_List_Table::prepare_items() in class-wp-comments-list-table.php.
|
||||
} else {
|
||||
args.number = 1;
|
||||
args.offset = Math.min(8, per_page) - 1; // fetch only the next item on the extra list
|
||||
args.offset = Math.min(8, per_page) - 1; // Fetch only the next item on the extra list.
|
||||
}
|
||||
|
||||
args.no_placeholder = true;
|
||||
|
||||
args.paged ++;
|
||||
|
||||
// $.query.get() needs some correction to be sent into an ajax request
|
||||
// $.query.get() needs some correction to be sent into an Ajax request.
|
||||
if ( true === args.comment_type )
|
||||
args.comment_type = '';
|
||||
|
||||
@ -781,9 +783,9 @@ window.commentReply = {
|
||||
/**
|
||||
* Initializes the comment reply functionality.
|
||||
*
|
||||
* @memberof commentReply
|
||||
*
|
||||
* @since 2.7.0
|
||||
*
|
||||
* @memberof commentReply
|
||||
*/
|
||||
init : function() {
|
||||
var row = $('#replyrow');
|
||||
@ -798,7 +800,7 @@ window.commentReply = {
|
||||
}
|
||||
});
|
||||
|
||||
// add events
|
||||
// Add events.
|
||||
$('#the-comment-list .column-comment > p').dblclick(function(){
|
||||
commentReply.toggle($(this).parent());
|
||||
});
|
||||
@ -911,7 +913,7 @@ window.commentReply = {
|
||||
.focus();
|
||||
}
|
||||
|
||||
// reset the Quicktags buttons
|
||||
// Reset the Quicktags buttons.
|
||||
if ( typeof QTags != 'undefined' )
|
||||
QTags.closeAllTags('replycontent');
|
||||
|
||||
@ -1029,7 +1031,7 @@ window.commentReply = {
|
||||
|
||||
$('#replycontent').focus().keyup(function(e){
|
||||
if ( e.which == 27 )
|
||||
commentReply.revert(); // close on Escape
|
||||
commentReply.revert(); // Close on Escape.
|
||||
});
|
||||
}, 600);
|
||||
|
||||
@ -1130,7 +1132,7 @@ window.commentReply = {
|
||||
updateCountText( 'span.all-count', 1 );
|
||||
}
|
||||
|
||||
c = $.trim(r.data); // Trim leading whitespaces
|
||||
c = $.trim(r.data); // Trim leading whitespaces.
|
||||
$(c).hide();
|
||||
$('#replyrow').after(c);
|
||||
|
||||
|
@ -246,10 +246,11 @@
|
||||
function mceKeyup( event ) {
|
||||
var key = event.keyCode;
|
||||
|
||||
// Bail on special keys. Key code 47 is a /
|
||||
// Bail on special keys. Key code 47 is a '/'.
|
||||
if ( key <= 47 && ! ( key === VK.SPACEBAR || key === VK.ENTER || key === VK.DELETE || key === VK.BACKSPACE || key === VK.UP || key === VK.LEFT || key === VK.DOWN || key === VK.UP ) ) {
|
||||
return;
|
||||
// OS keys, function keys, num lock, scroll lock. Key code 91-93 are OS keys. Key code 112-123 are F1 to F12. Key code 144 is num lock. Key code 145 is scroll lock.
|
||||
// OS keys, function keys, num lock, scroll lock. Key code 91-93 are OS keys.
|
||||
// Key code 112-123 are F1 to F12. Key code 144 is num lock. Key code 145 is scroll lock.
|
||||
} else if ( ( key >= 91 && key <= 93 ) || ( key >= 112 && key <= 123 ) || key === 144 || key === 145 ) {
|
||||
return;
|
||||
}
|
||||
@ -516,7 +517,7 @@
|
||||
* If in visual mode, checks if the editorHeight is greater than the autoresizeMinHeight + topHeight.
|
||||
* If not in visual mode, checks if the editorHeight is greater than the autoresizeMinHeight + 20.
|
||||
*/
|
||||
canPin = visual ? autoresizeMinHeight + topHeight : autoresizeMinHeight + 20; // 20px from textarea padding
|
||||
canPin = visual ? autoresizeMinHeight + topHeight : autoresizeMinHeight + 20; // 20px from textarea padding.
|
||||
canPin = editorHeight > ( canPin + 5 );
|
||||
|
||||
if ( ! canPin ) {
|
||||
@ -910,7 +911,7 @@
|
||||
// Adjust when entering or exiting fullscreen mode.
|
||||
fullscreen && fullscreen.pubsub.unsubscribe( 'hidden', fullscreenHide );
|
||||
|
||||
// Reset all css
|
||||
// Reset all CSS.
|
||||
$.each( [ $visualTop, $textTop, $tools, $menuBar, $bottom, $statusBar, $contentWrap, $visualEditor, $textEditor, $sideSortables ], function( i, element ) {
|
||||
element && element.attr( 'style', '' );
|
||||
});
|
||||
@ -1179,15 +1180,15 @@
|
||||
|
||||
// Return if any of the following keys or combinations of keys is pressed.
|
||||
if ( event && ( event.metaKey || ( event.ctrlKey && ! event.altKey ) || ( event.altKey && event.shiftKey ) || ( key && (
|
||||
// Special keys ( tab, ctrl, alt, esc, arrow keys... )
|
||||
// Special keys ( tab, ctrl, alt, esc, arrow keys... ).
|
||||
( key <= 47 && key !== 8 && key !== 13 && key !== 32 && key !== 46 ) ||
|
||||
// Windows keys
|
||||
// Windows keys.
|
||||
( key >= 91 && key <= 93 ) ||
|
||||
// F keys
|
||||
// F keys.
|
||||
( key >= 112 && key <= 135 ) ||
|
||||
// Num Lock, Scroll Lock, OEM
|
||||
// Num Lock, Scroll Lock, OEM.
|
||||
( key >= 144 && key <= 150 ) ||
|
||||
// OEM or non-printable
|
||||
// OEM or non-printable.
|
||||
key >= 224
|
||||
) ) ) ) {
|
||||
return;
|
||||
|
@ -112,7 +112,7 @@ window.wp = window.wp || {};
|
||||
}
|
||||
|
||||
if ( keepSelection ) {
|
||||
// Save the selection
|
||||
// Save the selection.
|
||||
addHTMLBookmarkInTextAreaContent( $textarea );
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ window.wp = window.wp || {};
|
||||
}
|
||||
|
||||
if ( editor.getParam( 'wp_keep_scroll_position' ) ) {
|
||||
// Restore the selection
|
||||
// Restore the selection.
|
||||
focusHTMLBookmarkInVisualEditor( editor );
|
||||
}
|
||||
} else {
|
||||
@ -149,7 +149,8 @@ window.wp = window.wp || {};
|
||||
}
|
||||
|
||||
if ( editor ) {
|
||||
// Don't resize the textarea in iOS. The iframe is forced to 100% height there, we shouldn't match it.
|
||||
// Don't resize the textarea in iOS.
|
||||
// The iframe is forced to 100% height there, we shouldn't match it.
|
||||
if ( ! tinymce.Env.iOS ) {
|
||||
iframe = editor.iframeElement;
|
||||
editorHeight = iframe ? parseInt( iframe.style.height, 10 ) : 0;
|
||||
@ -177,7 +178,8 @@ window.wp = window.wp || {};
|
||||
selectTextInTextArea( editor, selectionRange );
|
||||
}
|
||||
} else {
|
||||
// There is probably a JS error on the page. The TinyMCE editor instance doesn't exist. Show the textarea.
|
||||
// There is probably a JS error on the page.
|
||||
// The TinyMCE editor instance doesn't exist. Show the textarea.
|
||||
$textarea.css({ 'display': '', 'visibility': '' });
|
||||
}
|
||||
|
||||
@ -209,7 +211,7 @@ window.wp = window.wp || {};
|
||||
lastGtPos = content.lastIndexOf( '>', cursorPosition );
|
||||
|
||||
if ( lastLtPos > lastGtPos || content.substr( cursorPosition, 1 ) === '>' ) {
|
||||
// find what the tag is
|
||||
// Find what the tag is.
|
||||
var tagContent = content.substr( lastLtPos ),
|
||||
tagMatch = tagContent.match( /<\s*(\/)?(\w+|\!-{2}.*-{2})/ );
|
||||
|
||||
@ -222,7 +224,7 @@ window.wp = window.wp || {};
|
||||
|
||||
return {
|
||||
ltPos: lastLtPos,
|
||||
gtPos: lastLtPos + closingGt + 1, // offset by one to get the position _after_ the character,
|
||||
gtPos: lastLtPos + closingGt + 1, // Offset by one to get the position _after_ the character.
|
||||
tagType: tagType,
|
||||
isClosingTag: !! tagMatch[1]
|
||||
};
|
||||
@ -403,7 +405,7 @@ window.wp = window.wp || {};
|
||||
|
||||
var cursorStart = cursorPositions.cursorStart,
|
||||
cursorEnd = cursorPositions.cursorEnd,
|
||||
// check if the cursor is in a tag and if so, adjust it
|
||||
// Check if the cursor is in a tag and if so, adjust it.
|
||||
isCursorStartInTag = getContainingTagInfo( content, cursorStart );
|
||||
|
||||
if ( isCursorStartInTag ) {
|
||||
@ -506,11 +508,11 @@ window.wp = window.wp || {};
|
||||
}
|
||||
|
||||
textArea.value = [
|
||||
textArea.value.slice( 0, htmlModeCursorStartPosition ), // text until the cursor/selection position
|
||||
cursorMarkerSkeleton.clone() // cursor/selection start marker
|
||||
textArea.value.slice( 0, htmlModeCursorStartPosition ), // Text until the cursor/selection position.
|
||||
cursorMarkerSkeleton.clone() // Cursor/selection start marker.
|
||||
.addClass( 'mce_SELRES_start' )[0].outerHTML,
|
||||
selectedText, // selected text with end cursor/position marker
|
||||
textArea.value.slice( htmlModeCursorEndPosition ) // text from last cursor/selection position to end
|
||||
selectedText, // Selected text with end cursor/position marker.
|
||||
textArea.value.slice( htmlModeCursorEndPosition ) // Text from last cursor/selection position to end.
|
||||
].join( '' );
|
||||
}
|
||||
|
||||
@ -804,7 +806,7 @@ window.wp = window.wp || {};
|
||||
endMatchIndex -= endMatch[1].length;
|
||||
}
|
||||
|
||||
// We need to adjust the end position to discard the length of the range start marker
|
||||
// We need to adjust the end position to discard the length of the range start marker.
|
||||
endIndex = endMatchIndex - startMatchLength;
|
||||
}
|
||||
|
||||
@ -826,7 +828,7 @@ window.wp = window.wp || {};
|
||||
* @param {Object} selection Selection data.
|
||||
*/
|
||||
function selectTextInTextArea( editor, selection ) {
|
||||
// only valid in the text area mode and if we have selection
|
||||
// Only valid in the text area mode and if we have selection.
|
||||
if ( ! selection ) {
|
||||
return;
|
||||
}
|
||||
@ -836,11 +838,11 @@ window.wp = window.wp || {};
|
||||
end = selection.end || selection.start;
|
||||
|
||||
if ( textArea.focus ) {
|
||||
// Wait for the Visual editor to be hidden, then focus and scroll to the position
|
||||
// Wait for the Visual editor to be hidden, then focus and scroll to the position.
|
||||
setTimeout( function() {
|
||||
textArea.setSelectionRange( start, end );
|
||||
if ( textArea.blur ) {
|
||||
// defocus before focusing
|
||||
// Defocus before focusing.
|
||||
textArea.blur();
|
||||
}
|
||||
textArea.focus();
|
||||
@ -1249,7 +1251,7 @@ window.wp = window.wp || {};
|
||||
|
||||
defaults = wp.editor.getDefaultSettings();
|
||||
|
||||
// Initialize TinyMCE by default
|
||||
// Initialize TinyMCE by default.
|
||||
if ( ! settings ) {
|
||||
settings = {
|
||||
tinymce: true
|
||||
|
@ -15,7 +15,7 @@ jQuery(document).ready(function($) {
|
||||
distance: 2,
|
||||
handle: 'div.filename',
|
||||
stop: function() {
|
||||
// When an update has occurred, adjust the order for each item
|
||||
// When an update has occurred, adjust the order for each item.
|
||||
var all = $('#media-items').sortable('toArray'), len = all.length;
|
||||
$.each(all, function(i, id) {
|
||||
var order = desc ? (len - i) : (1 + i);
|
||||
@ -71,7 +71,7 @@ jQuery(document).ready(function($) {
|
||||
$('img.pinkynail').toggle(true);
|
||||
});
|
||||
|
||||
// initialize sortable
|
||||
// Initialize sortable.
|
||||
gallerySortableInit();
|
||||
clearAll();
|
||||
|
||||
@ -88,7 +88,7 @@ jQuery(document).ready(function($) {
|
||||
}
|
||||
});
|
||||
|
||||
jQuery(window).unload( function () { window.tinymce = window.tinyMCE = window.wpgallery = null; } ); // Cleanup
|
||||
jQuery(window).unload( function () { window.tinymce = window.tinyMCE = window.wpgallery = null; } ); // Cleanup.
|
||||
|
||||
/* gallery settings */
|
||||
window.tinymce = null;
|
||||
@ -122,7 +122,7 @@ window.wpgallery = {
|
||||
document.domain = q.mce_rdomain;
|
||||
}
|
||||
|
||||
// Find window & API
|
||||
// Find window & API.
|
||||
window.tinymce = w.tinymce;
|
||||
window.tinyMCE = w.tinyMCE;
|
||||
t.editor = tinymce.EditorManager.activeEditor;
|
||||
|
@ -48,9 +48,10 @@
|
||||
/**
|
||||
* Converts a value to an integer.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {number} f The float value that should be converted.
|
||||
*
|
||||
* @return {number} The integer representation from the float value.
|
||||
@ -66,9 +67,10 @@
|
||||
/**
|
||||
* Adds the disabled attribute and class to a single form element or a field set.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {jQuery} el The element that should be modified.
|
||||
* @param {bool|number} s The state for the element. If set to true
|
||||
* the element is disabled,
|
||||
@ -95,9 +97,10 @@
|
||||
/**
|
||||
* Initializes the image editor.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {number} postid The post id.
|
||||
*
|
||||
* @return {void}
|
||||
@ -121,12 +124,12 @@
|
||||
$('input[type="text"]', '#imgedit-panel-' + postid).keypress(function(e) {
|
||||
var k = e.keyCode;
|
||||
|
||||
// Key codes 37 thru 40 are the arrow keys.
|
||||
// Key codes 37 through 40 are the arrow keys.
|
||||
if ( 36 < k && k < 41 ) {
|
||||
$(this).blur();
|
||||
}
|
||||
|
||||
// The key code 13 is the enter key.
|
||||
// The key code 13 is the Enter key.
|
||||
if ( 13 === k ) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
@ -138,9 +141,10 @@
|
||||
/**
|
||||
* Toggles the wait/load icon in the editor.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {number} postid The post id.
|
||||
* @param {number} toggle Is 0 or 1, fades the icon in then 1 and out when 0.
|
||||
*
|
||||
@ -159,9 +163,10 @@
|
||||
/**
|
||||
* Shows or hides the image edit help box.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {HTMLElement} el The element to create the help window in.
|
||||
*
|
||||
* @return {boolean} Always returns false.
|
||||
@ -181,9 +186,10 @@
|
||||
* The image edit target contains the image sizes where the (possible) changes
|
||||
* have to be applied to.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {number} postid The post id.
|
||||
*
|
||||
* @return {string} The value from the imagedit-save-target input field when available,
|
||||
@ -198,9 +204,10 @@
|
||||
*
|
||||
* If the original image size is exceeded a red exclamation mark is shown.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {number} postid The current post id.
|
||||
* @param {number} x Is 0 when it applies the y-axis
|
||||
* and 1 when applicable for the x-axis.
|
||||
@ -234,9 +241,10 @@
|
||||
/**
|
||||
* Gets the selected aspect ratio.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {number} postid The post id.
|
||||
*
|
||||
* @return {string} The aspect ratio.
|
||||
@ -261,9 +269,10 @@
|
||||
* Removes the last action from the image edit history.
|
||||
* The history consist of (edit) actions performed on the image.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {number} postid The post id.
|
||||
* @param {number} setSize 0 or 1, when 1 the image resets to its original size.
|
||||
*
|
||||
@ -295,13 +304,13 @@
|
||||
// Restore original 'o'.
|
||||
o = history[history.length - 1];
|
||||
|
||||
// c = 'crop', r = 'rotate', f = 'flip'
|
||||
// c = 'crop', r = 'rotate', f = 'flip'.
|
||||
o = o.c || o.r || o.f || false;
|
||||
|
||||
if ( o ) {
|
||||
// fw = Full image width
|
||||
// fw = Full image width.
|
||||
this.hold.w = o.fw;
|
||||
// fh = Full image height
|
||||
// fh = Full image height.
|
||||
this.hold.h = o.fh;
|
||||
}
|
||||
}
|
||||
@ -326,9 +335,10 @@
|
||||
*
|
||||
* When the image source is reloaded the image will be reloaded.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {number} postid The post id.
|
||||
* @param {string} nonce The nonce to verify the request.
|
||||
* @param {function} callback Function to execute when the image is loaded.
|
||||
@ -371,7 +381,7 @@
|
||||
|
||||
parent.empty().append(img);
|
||||
|
||||
// w, h are the new full size dims
|
||||
// w, h are the new full size dimensions.
|
||||
max1 = Math.max( t.hold.w, t.hold.h );
|
||||
max2 = Math.max( $(img).width(), $(img).height() );
|
||||
t.hold.sizer = max1 > max2 ? max2 / max1 : 1;
|
||||
@ -399,9 +409,10 @@
|
||||
/**
|
||||
* Performs an image edit action.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {number} postid The post id.
|
||||
* @param {string} nonce The nonce to verify the request.
|
||||
* @param {string} action The action to perform on the image.
|
||||
@ -456,7 +467,7 @@
|
||||
$.post(ajaxurl, data, function(r) {
|
||||
$('#image-editor-' + postid).empty().append(r);
|
||||
t.toggleEditor(postid, 0);
|
||||
// refresh the attachment model so that changes propagate
|
||||
// Refresh the attachment model so that changes propagate.
|
||||
if ( t._view ) {
|
||||
t._view.refresh();
|
||||
}
|
||||
@ -466,9 +477,10 @@
|
||||
/**
|
||||
* Stores the changes that are made to the image.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {number} postid The post id to get the image from the database.
|
||||
* @param {string} nonce The nonce to verify the request.
|
||||
*
|
||||
@ -531,9 +543,10 @@
|
||||
/**
|
||||
* Creates the image edit window.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {number} postid The post id for the image.
|
||||
* @param {string} nonce The nonce to verify the request.
|
||||
* @param {object} view The image editor view to be used for the editing.
|
||||
@ -588,9 +601,10 @@
|
||||
/**
|
||||
* Initializes the cropping tool and sets a default cropping selection.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {number} postid The post id.
|
||||
*
|
||||
* @return {void}
|
||||
@ -614,9 +628,10 @@
|
||||
/**
|
||||
* Initializes the cropping tool.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {number} postid The post id.
|
||||
* @param {HTMLElement} image The preview image.
|
||||
* @param {HTMLElement} parent The preview image container.
|
||||
@ -645,8 +660,8 @@
|
||||
* @param {jQuery} img The preview image.
|
||||
*/
|
||||
onInit: function( img ) {
|
||||
// Ensure that the imgAreaSelect wrapper elements are position:absolute.
|
||||
// (even if we're in a position:fixed modal)
|
||||
// Ensure that the imgAreaSelect wrapper elements are position:absolute
|
||||
// (even if we're in a position:fixed modal).
|
||||
$img = $( img );
|
||||
$img.next().css( 'position', 'absolute' )
|
||||
.nextAll( '.imgareaselect-outer' ).css( 'position', 'absolute' );
|
||||
@ -715,9 +730,10 @@
|
||||
/**
|
||||
* Stores the current crop selection.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {number} postid The post id.
|
||||
* @param {object} c The selection.
|
||||
*
|
||||
@ -746,9 +762,10 @@
|
||||
/**
|
||||
* Closes the image editor.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {number} postid The post id.
|
||||
* @param {bool} warn Warning message.
|
||||
*
|
||||
@ -764,13 +781,14 @@
|
||||
this.iasapi = {};
|
||||
this.hold = {};
|
||||
|
||||
// If we've loaded the editor in the context of a Media Modal, then switch to the previous view,
|
||||
// whatever that might have been.
|
||||
// If we've loaded the editor in the context of a Media Modal,
|
||||
// then switch to the previous view, whatever that might have been.
|
||||
if ( this._view ){
|
||||
this._view.back();
|
||||
}
|
||||
|
||||
// In case we are not accessing the image editor in the context of a View, close the editor the old-skool way
|
||||
// In case we are not accessing the image editor in the context of a View,
|
||||
// close the editor the old-school way.
|
||||
else {
|
||||
$('#image-editor-' + postid).fadeOut('fast', function() {
|
||||
$( '#media-head-' + postid ).fadeIn( 'fast', function() {
|
||||
@ -787,9 +805,10 @@
|
||||
/**
|
||||
* Checks if the image edit history is saved.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {number} postid The post id.
|
||||
*
|
||||
* @return {boolean} Returns true if the history is not saved.
|
||||
@ -811,9 +830,10 @@
|
||||
/**
|
||||
* Adds an image edit action to the history.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {object} op The original position.
|
||||
* @param {number} postid The post id.
|
||||
* @param {string} nonce The nonce.
|
||||
@ -830,7 +850,7 @@
|
||||
history.pop();
|
||||
pop--;
|
||||
}
|
||||
undone.val(0); // reset
|
||||
undone.val(0); // Reset.
|
||||
|
||||
history.push(op);
|
||||
elem.val( JSON.stringify(history) );
|
||||
@ -844,9 +864,10 @@
|
||||
/**
|
||||
* Rotates the image.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {string} angle The angle the image is rotated with.
|
||||
* @param {number} postid The post id.
|
||||
* @param {string} nonce The nonce.
|
||||
@ -865,9 +886,10 @@
|
||||
/**
|
||||
* Flips the image.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {number} axis The axle the image is flipped on.
|
||||
* @param {number} postid The post id.
|
||||
* @param {string} nonce The nonce.
|
||||
@ -886,9 +908,10 @@
|
||||
/**
|
||||
* Crops the image.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {number} postid The post id.
|
||||
* @param {string} nonce The nonce.
|
||||
* @param {object} t The target object.
|
||||
@ -915,9 +938,10 @@
|
||||
/**
|
||||
* Undoes an image edit action.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {number} postid The post id.
|
||||
* @param {string} nonce The nonce.
|
||||
*
|
||||
@ -948,9 +972,10 @@
|
||||
/**
|
||||
* Reverts a undo action.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {number} postid The post id.
|
||||
* @param {string} nonce The nonce.
|
||||
*
|
||||
@ -978,9 +1003,10 @@
|
||||
/**
|
||||
* Sets the selection for the height and width in pixels.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {number} postid The post id.
|
||||
* @param {jQuery} el The element containing the values.
|
||||
*
|
||||
@ -1035,9 +1061,10 @@
|
||||
/**
|
||||
* Rounds a number to a whole.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {number} num The number.
|
||||
*
|
||||
* @return {number} The number rounded to a whole number.
|
||||
@ -1064,9 +1091,10 @@
|
||||
/**
|
||||
* Sets a locked aspect ratio for the selection.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {number} postid The post id.
|
||||
* @param {number} n The ratio to set.
|
||||
* @param {jQuery} el The element containing the values.
|
||||
@ -1108,8 +1136,9 @@
|
||||
/**
|
||||
* Validates if a value in a jQuery.HTMLElement is numeric.
|
||||
*
|
||||
* @since 4.6.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
* @since 4.6
|
||||
*
|
||||
* @param {jQuery} el The html element.
|
||||
*
|
||||
|
@ -29,41 +29,42 @@ window.wp = window.wp || {};
|
||||
/**
|
||||
* Initializes the inline and bulk post editor.
|
||||
*
|
||||
* Binds event handlers to the escape key to close the inline editor
|
||||
* Binds event handlers to the Escape key to close the inline editor
|
||||
* and to the save and close buttons. Changes DOM to be ready for inline
|
||||
* editing. Adds event handler to bulk edit.
|
||||
*
|
||||
* @memberof inlineEditPost
|
||||
* @since 2.7.0
|
||||
*
|
||||
* @memberof inlineEditPost
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
init : function(){
|
||||
var t = this, qeRow = $('#inline-edit'), bulkRow = $('#bulk-edit');
|
||||
|
||||
t.type = $('table.widefat').hasClass('pages') ? 'page' : 'post';
|
||||
// Post id prefix.
|
||||
// Post ID prefix.
|
||||
t.what = '#post-';
|
||||
|
||||
/**
|
||||
* Binds the escape key to revert the changes and close the quick editor.
|
||||
* Binds the Escape key to revert the changes and close the quick editor.
|
||||
*
|
||||
* @return {boolean} The result of revert.
|
||||
*/
|
||||
qeRow.keyup(function(e){
|
||||
// Revert changes if escape key is pressed.
|
||||
// Revert changes if Escape key is pressed.
|
||||
if ( e.which === 27 ) {
|
||||
return inlineEditPost.revert();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Binds the escape key to revert the changes and close the bulk editor.
|
||||
* Binds the Escape key to revert the changes and close the bulk editor.
|
||||
*
|
||||
* @return {boolean} The result of revert.
|
||||
*/
|
||||
bulkRow.keyup(function(e){
|
||||
// Revert changes if escape key is pressed.
|
||||
// Revert changes if Escape key is pressed.
|
||||
if ( e.which === 27 ) {
|
||||
return inlineEditPost.revert();
|
||||
}
|
||||
@ -88,7 +89,7 @@ window.wp = window.wp || {};
|
||||
});
|
||||
|
||||
/**
|
||||
* If enter is pressed, and the target is not the cancel button, save the post.
|
||||
* If Enter is pressed, and the target is not the cancel button, save the post.
|
||||
*
|
||||
* @return {boolean} The result of save.
|
||||
*/
|
||||
@ -157,9 +158,10 @@ window.wp = window.wp || {};
|
||||
* Toggles the quick edit window, hiding it when it's active and showing it when
|
||||
* inactive.
|
||||
*
|
||||
* @memberof inlineEditPost
|
||||
* @since 2.7.0
|
||||
*
|
||||
* @memberof inlineEditPost
|
||||
*
|
||||
* @param {Object} el Element within a post table row.
|
||||
*/
|
||||
toggle : function(el){
|
||||
@ -170,8 +172,9 @@ window.wp = window.wp || {};
|
||||
/**
|
||||
* Creates the bulk editor row to edit multiple posts at once.
|
||||
*
|
||||
* @memberof inlineEditPost
|
||||
* @since 2.7.0
|
||||
*
|
||||
* @memberof inlineEditPost
|
||||
*/
|
||||
setBulk : function(){
|
||||
var te = '', type = this.type, c = true;
|
||||
@ -242,9 +245,10 @@ window.wp = window.wp || {};
|
||||
/**
|
||||
* Creates a quick edit window for the post that has been clicked.
|
||||
*
|
||||
* @memberof inlineEditPost
|
||||
* @since 2.7.0
|
||||
*
|
||||
* @memberof inlineEditPost
|
||||
*
|
||||
* @param {number|Object} id The id of the clicked post or an element within a post
|
||||
* table row.
|
||||
* @return {boolean} Always returns false at the end of execution.
|
||||
@ -409,7 +413,7 @@ window.wp = window.wp || {};
|
||||
fields = $('#edit-'+id).find(':input').serialize();
|
||||
params = fields + '&' + $.param(params);
|
||||
|
||||
// Make ajax request.
|
||||
// Make Ajax request.
|
||||
$.post( ajaxurl, params,
|
||||
function(r) {
|
||||
var $errorNotice = $( '#edit-' + id + ' .inline-edit-save .notice-error' ),
|
||||
@ -450,9 +454,10 @@ window.wp = window.wp || {};
|
||||
/**
|
||||
* Hides and empties the Quick Edit and/or Bulk Edit windows.
|
||||
*
|
||||
* @memberof inlineEditPost
|
||||
* @since 2.7.0
|
||||
*
|
||||
* @memberof inlineEditPost
|
||||
*
|
||||
* @return {boolean} Always returns false.
|
||||
*/
|
||||
revert : function(){
|
||||
@ -494,9 +499,10 @@ window.wp = window.wp || {};
|
||||
* Gets the id for a the post that you want to quick edit from the row in the quick
|
||||
* edit table.
|
||||
*
|
||||
* @memberof inlineEditPost
|
||||
* @since 2.7.0
|
||||
*
|
||||
* @memberof inlineEditPost
|
||||
*
|
||||
* @param {Object} o DOM row object to get the id for.
|
||||
* @return {string} The post id extracted from the table row in the object.
|
||||
*/
|
||||
@ -546,7 +552,7 @@ $( document ).on( 'heartbeat-tick.wp-check-locked-posts', function( e, data ) {
|
||||
}
|
||||
}).ready( function() {
|
||||
|
||||
// Set the heartbeat interval to 15 sec.
|
||||
// Set the heartbeat interval to 15 seconds.
|
||||
if ( typeof wp !== 'undefined' && wp.heartbeat ) {
|
||||
wp.heartbeat.interval( 15 );
|
||||
}
|
||||
|
@ -43,12 +43,12 @@ window.inlineEditTax = {
|
||||
});
|
||||
|
||||
/**
|
||||
* Cancels inline editing when pressing escape inside the inline editor.
|
||||
* Cancels inline editing when pressing Escape inside the inline editor.
|
||||
*
|
||||
* @param {Object} e The keyup event that has been triggered.
|
||||
*/
|
||||
row.keyup( function( e ) {
|
||||
// 27 = [escape]
|
||||
// 27 = [Escape].
|
||||
if ( e.which === 27 ) {
|
||||
return inlineEditTax.revert();
|
||||
}
|
||||
@ -69,10 +69,10 @@ window.inlineEditTax = {
|
||||
});
|
||||
|
||||
/**
|
||||
* Saves the inline edits when pressing enter inside the inline editor.
|
||||
* Saves the inline edits when pressing Enter inside the inline editor.
|
||||
*/
|
||||
$( 'input, select', row ).keydown( function( e ) {
|
||||
// 13 = [enter]
|
||||
// 13 = [Enter].
|
||||
if ( e.which === 13 ) {
|
||||
return inlineEditTax.save( this );
|
||||
}
|
||||
@ -184,7 +184,7 @@ window.inlineEditTax = {
|
||||
fields = $('#edit-'+id).find(':input').serialize();
|
||||
params = fields + '&' + $.param(params);
|
||||
|
||||
// Do the ajax request to save the data to the server.
|
||||
// Do the Ajax request to save the data to the server.
|
||||
$.post( ajaxurl, params,
|
||||
/**
|
||||
* Handles the response from the server
|
||||
|
@ -9,7 +9,7 @@ jQuery(document).ready( function($) {
|
||||
var newCat, noSyncChecks = false, syncChecks, catAddAfter;
|
||||
|
||||
$('#link_name').focus();
|
||||
// postboxes
|
||||
// Postboxes.
|
||||
postboxes.add_postbox_toggles('link');
|
||||
|
||||
/**
|
||||
@ -33,7 +33,7 @@ jQuery(document).ready( function($) {
|
||||
if ( getUserSetting('cats') )
|
||||
$('#category-tabs a[href="#categories-pop"]').click();
|
||||
|
||||
// Ajax Cat
|
||||
// Ajax Cat.
|
||||
newCat = $('#newcat').one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ); } );
|
||||
|
||||
/**
|
||||
|
@ -43,16 +43,16 @@ window.send_to_editor = function( html ) {
|
||||
editor = tinymce.get( wpActiveEditor );
|
||||
}
|
||||
|
||||
// If the editor is set and not hidden, insert the HTML into the content of the
|
||||
// editor.
|
||||
// If the editor is set and not hidden,
|
||||
// insert the HTML into the content of the editor.
|
||||
if ( editor && ! editor.isHidden() ) {
|
||||
editor.execCommand( 'mceInsertContent', false, html );
|
||||
} else if ( hasQuicktags ) {
|
||||
// If quick tags are available, insert the HTML into its content.
|
||||
QTags.insertContent( html );
|
||||
} else {
|
||||
// If neither the TinyMCE editor and the quick tags are available, add the HTML
|
||||
// to the current active editor.
|
||||
// If neither the TinyMCE editor and the quick tags are available,
|
||||
// add the HTML to the current active editor.
|
||||
document.getElementById( wpActiveEditor ).value += html;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@
|
||||
},
|
||||
|
||||
jQueryExtensions : function() {
|
||||
// jQuery extensions
|
||||
// jQuery extensions.
|
||||
$.fn.extend({
|
||||
menuItemDepth : function() {
|
||||
var margin = api.isRTL ? this.eq(0).css('margin-right') : this.eq(0).css('margin-left');
|
||||
@ -114,7 +114,7 @@
|
||||
depth = t.menuItemDepth(),
|
||||
newDepth = depth + dir;
|
||||
|
||||
// Change .menu-item-depth-n class
|
||||
// Change .menu-item-depth-n class.
|
||||
t.moveHorizontally( newDepth, depth );
|
||||
});
|
||||
},
|
||||
@ -125,10 +125,10 @@
|
||||
diff = newDepth - depth,
|
||||
subItemText = t.find('.is-submenu');
|
||||
|
||||
// Change .menu-item-depth-n class
|
||||
// Change .menu-item-depth-n class.
|
||||
t.updateDepthClass( newDepth, depth ).updateParentMenuItemDBId();
|
||||
|
||||
// If it has children, move those too
|
||||
// If it has children, move those too.
|
||||
if ( children ) {
|
||||
children.each(function() {
|
||||
var t = $(this),
|
||||
@ -138,7 +138,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
// Show "Sub item" helper text
|
||||
// Show "Sub item" helper text.
|
||||
if (0 === newDepth)
|
||||
subItemText.hide();
|
||||
else
|
||||
@ -153,7 +153,7 @@
|
||||
parentDepth = depth - 1,
|
||||
parent = item.prevAll( '.menu-item-depth-' + parentDepth ).first();
|
||||
|
||||
if ( 0 === depth ) { // Item is on the top level, has no parent
|
||||
if ( 0 === depth ) { // Item is on the top level, has no parent.
|
||||
input.val(0);
|
||||
} else { // Find the parent item, and retrieve its object id.
|
||||
input.val( parent.find( '.menu-item-data-db-id' ).val() );
|
||||
@ -191,10 +191,10 @@
|
||||
if ( !checkboxes.length )
|
||||
return false;
|
||||
|
||||
// Show the ajax spinner
|
||||
// Show the Ajax spinner.
|
||||
t.find( '.button-controls .spinner' ).addClass( 'is-active' );
|
||||
|
||||
// Retrieve menu item data
|
||||
// Retrieve menu item data.
|
||||
$(checkboxes).each(function(){
|
||||
var t = $(this),
|
||||
listItemDBIDMatch = re.exec( t.attr('name') ),
|
||||
@ -205,9 +205,9 @@
|
||||
menuItems[listItemDBID] = t.closest('li').getItemData( 'add-menu-item', listItemDBID );
|
||||
});
|
||||
|
||||
// Add the items
|
||||
// Add the items.
|
||||
api.addItemToMenu(menuItems, processMethod, function(){
|
||||
// Deselect the items and hide the ajax spinner
|
||||
// Deselect the items and hide the Ajax spinner.
|
||||
checkboxes.prop( 'checked', false );
|
||||
t.find( '.button-controls .select-all' ).prop( 'checked', false );
|
||||
t.find( '.button-controls .spinner' ).removeClass( 'is-active' );
|
||||
@ -312,22 +312,22 @@
|
||||
case 'up':
|
||||
newItemPosition = thisItemPosition - 1;
|
||||
|
||||
// Already at top
|
||||
// Already at top.
|
||||
if ( 0 === thisItemPosition )
|
||||
break;
|
||||
|
||||
// If a sub item is moved to top, shift it to 0 depth
|
||||
// If a sub item is moved to top, shift it to 0 depth.
|
||||
if ( 0 === newItemPosition && 0 !== thisItemDepth )
|
||||
thisItem.moveHorizontally( 0, thisItemDepth );
|
||||
|
||||
// If prev item is sub item, shift to match depth
|
||||
// If prev item is sub item, shift to match depth.
|
||||
if ( 0 !== prevItemDepth )
|
||||
thisItem.moveHorizontally( prevItemDepth, thisItemDepth );
|
||||
|
||||
// Does this item have sub items?
|
||||
if ( thisItemChildren ) {
|
||||
items = thisItem.add( thisItemChildren );
|
||||
// Move the entire block
|
||||
// Move the entire block.
|
||||
items.detach().insertBefore( menuItems.eq( newItemPosition ) ).updateParentMenuItemDBId();
|
||||
} else {
|
||||
thisItem.detach().insertBefore( menuItems.eq( newItemPosition ) ).updateParentMenuItemDBId();
|
||||
@ -351,40 +351,40 @@
|
||||
|
||||
items.detach().insertAfter( menuItems.eq( thisItemPosition + items.length ) ).updateParentMenuItemDBId();
|
||||
} else {
|
||||
// If next item has sub items, shift depth
|
||||
// If next item has sub items, shift depth.
|
||||
if ( 0 !== nextItemChildren.length )
|
||||
thisItem.moveHorizontally( nextItemDepth, thisItemDepth );
|
||||
|
||||
// Have we reached the bottom
|
||||
// Have we reached the bottom?
|
||||
if ( menuItemsCount === thisItemPosition + 1 )
|
||||
break;
|
||||
thisItem.detach().insertAfter( menuItems.eq( thisItemPosition + 1 ) ).updateParentMenuItemDBId();
|
||||
}
|
||||
break;
|
||||
case 'top':
|
||||
// Already at top
|
||||
// Already at top.
|
||||
if ( 0 === thisItemPosition )
|
||||
break;
|
||||
// Does this item have sub items?
|
||||
if ( thisItemChildren ) {
|
||||
items = thisItem.add( thisItemChildren );
|
||||
// Move the entire block
|
||||
// Move the entire block.
|
||||
items.detach().insertBefore( menuItems.eq( 0 ) ).updateParentMenuItemDBId();
|
||||
} else {
|
||||
thisItem.detach().insertBefore( menuItems.eq( 0 ) ).updateParentMenuItemDBId();
|
||||
}
|
||||
break;
|
||||
case 'left':
|
||||
// As far left as possible
|
||||
// As far left as possible.
|
||||
if ( 0 === thisItemDepth )
|
||||
break;
|
||||
thisItem.shiftHorizontally( -1 );
|
||||
break;
|
||||
case 'right':
|
||||
// Can't be sub item at top
|
||||
// Can't be sub item at top.
|
||||
if ( 0 === thisItemPosition )
|
||||
break;
|
||||
// Already sub item of prevItem
|
||||
// Already sub item of prevItem.
|
||||
if ( thisItemData['menu-item-parent-id'] === prevItemId )
|
||||
break;
|
||||
thisItem.shiftHorizontally( 1 );
|
||||
@ -402,7 +402,7 @@
|
||||
api.refreshKeyboardAccessibility();
|
||||
api.refreshAdvancedAccessibility();
|
||||
|
||||
// Refresh the accessibility when the user comes close to the item in any way
|
||||
// Refresh the accessibility when the user comes close to the item in any way.
|
||||
menu.on( 'mouseenter.refreshAccessibility focus.refreshAccessibility touchstart.refreshAccessibility' , '.menu-item' , function(){
|
||||
api.refreshAdvancedAccessibilityOfItem( $( this ).find( 'a.item-edit' ) );
|
||||
} );
|
||||
@ -412,7 +412,7 @@
|
||||
api.refreshAdvancedAccessibilityOfItem( $( this ) );
|
||||
} );
|
||||
|
||||
// Links for moving items
|
||||
// Links for moving items.
|
||||
menu.on( 'click', '.menus-move', function () {
|
||||
var $this = $( this ),
|
||||
dir = $this.data( 'dir' );
|
||||
@ -433,7 +433,7 @@
|
||||
*/
|
||||
refreshAdvancedAccessibilityOfItem : function( itemToRefresh ) {
|
||||
|
||||
// Only refresh accessibility when necessary
|
||||
// Only refresh accessibility when necessary.
|
||||
if ( true !== $( itemToRefresh ).data( 'needs_accessibility_refresh' ) ) {
|
||||
return;
|
||||
}
|
||||
@ -494,7 +494,7 @@
|
||||
itemPosition = primaryItems.index( menuItem ) + 1,
|
||||
totalMenuItems = primaryItems.length,
|
||||
|
||||
// String together help text for primary menu items
|
||||
// String together help text for primary menu items.
|
||||
title = menus.menuFocus.replace( '%1$s', itemName ).replace( '%2$d', itemPosition ).replace( '%3$d', totalMenuItems );
|
||||
} else {
|
||||
parentItem = menuItem.prevAll( '.menu-item-depth-' + parseInt( depth - 1, 10 ) ).first(),
|
||||
@ -503,13 +503,13 @@
|
||||
subItems = $( '.menu-item .menu-item-data-parent-id[value="' + parentItemId + '"]' ),
|
||||
itemPosition = $( subItems.parents('.menu-item').get().reverse() ).index( menuItem ) + 1;
|
||||
|
||||
// String together help text for sub menu items
|
||||
// String together help text for sub menu items.
|
||||
title = menus.subMenuFocus.replace( '%1$s', itemName ).replace( '%2$d', itemPosition ).replace( '%3$s', parentItemName );
|
||||
}
|
||||
|
||||
$this.attr( 'aria-label', title );
|
||||
|
||||
// Mark this item's accessibility as refreshed
|
||||
// Mark this item's accessibility as refreshed.
|
||||
$this.data( 'needs_accessibility_refresh', false );
|
||||
},
|
||||
|
||||
@ -523,10 +523,10 @@
|
||||
// Hide all the move buttons by default.
|
||||
$( '.menu-item-settings .field-move .menus-move' ).hide();
|
||||
|
||||
// Mark all menu items as unprocessed
|
||||
// Mark all menu items as unprocessed.
|
||||
$( 'a.item-edit' ).data( 'needs_accessibility_refresh', true );
|
||||
|
||||
// All open items have to be refreshed or they will show no links
|
||||
// All open items have to be refreshed or they will show no links.
|
||||
$( '.menu-item-edit-active a.item-edit' ).each( function() {
|
||||
api.refreshAdvancedAccessibilityOfItem( this );
|
||||
} );
|
||||
@ -541,18 +541,18 @@
|
||||
thisItem = $this.parents( 'li.menu-item' ),
|
||||
thisItemData = thisItem.getItemData();
|
||||
|
||||
// Bail if it's not an arrow key
|
||||
// Bail if it's not an arrow key.
|
||||
if ( 37 != e.which && 38 != e.which && 39 != e.which && 40 != e.which )
|
||||
return;
|
||||
|
||||
// Avoid multiple keydown events
|
||||
// Avoid multiple keydown events.
|
||||
$this.off('keydown');
|
||||
|
||||
// Bail if there is only one menu item
|
||||
// Bail if there is only one menu item.
|
||||
if ( 1 === $('#menu-to-edit li').length )
|
||||
return;
|
||||
|
||||
// If RTL, swap left/right arrows
|
||||
// If RTL, swap left/right arrows.
|
||||
arrows = { '38': 'up', '40': 'down', '37': 'left', '39': 'right' };
|
||||
if ( $('body').hasClass('rtl') )
|
||||
arrows = { '38' : 'up', '40' : 'down', '39' : 'left', '37' : 'right' };
|
||||
@ -571,7 +571,7 @@
|
||||
api.moveMenuItem( $this, 'right' );
|
||||
break;
|
||||
}
|
||||
// Put focus back on same menu item
|
||||
// Put focus back on same menu item.
|
||||
$( '#edit-' + thisItemData['menu-item-db-id'] ).focus();
|
||||
return false;
|
||||
});
|
||||
@ -594,10 +594,10 @@
|
||||
},
|
||||
|
||||
initToggles : function() {
|
||||
// init postboxes
|
||||
// Init postboxes.
|
||||
postboxes.add_postbox_toggles('nav-menus');
|
||||
|
||||
// adjust columns functions for menus UI
|
||||
// Adjust columns functions for menus UI.
|
||||
columns.useCheckboxesForHidden();
|
||||
columns.checked = function(field) {
|
||||
$('.field-' + field).removeClass('hidden-field');
|
||||
@ -605,7 +605,7 @@
|
||||
columns.unchecked = function(field) {
|
||||
$('.field-' + field).addClass('hidden-field');
|
||||
};
|
||||
// hide fields
|
||||
// Hide fields.
|
||||
api.menuList.hideAdvancedMenuItemFields();
|
||||
|
||||
$('.hide-postbox-tog').click(function () {
|
||||
@ -639,7 +639,7 @@
|
||||
start: function(e, ui) {
|
||||
var height, width, parent, children, tempHolder;
|
||||
|
||||
// handle placement for rtl orientation
|
||||
// Handle placement for RTL orientation.
|
||||
if ( api.isRTL )
|
||||
ui.item[0].style.right = 'auto';
|
||||
|
||||
@ -649,19 +649,19 @@
|
||||
originalDepth = ui.item.menuItemDepth();
|
||||
updateCurrentDepth(ui, originalDepth);
|
||||
|
||||
// Attach child elements to parent
|
||||
// Skip the placeholder
|
||||
// Attach child elements to parent.
|
||||
// Skip the placeholder.
|
||||
parent = ( ui.item.next()[0] == ui.placeholder[0] ) ? ui.item.next() : ui.item;
|
||||
children = parent.childMenuItems();
|
||||
transport.append( children );
|
||||
|
||||
// Update the height of the placeholder to match the moving item.
|
||||
height = transport.outerHeight();
|
||||
// If there are children, account for distance between top of children and parent
|
||||
// If there are children, account for distance between top of children and parent.
|
||||
height += ( height > 0 ) ? (ui.placeholder.css('margin-top').slice(0, -2) * 1) : 0;
|
||||
height += ui.helper.outerHeight();
|
||||
helperHeight = height;
|
||||
height -= 2; // Subtract 2 for borders
|
||||
height -= 2; // Subtract 2 for borders.
|
||||
ui.placeholder.height(height);
|
||||
|
||||
// Update the width of the placeholder to match the moving item.
|
||||
@ -670,18 +670,18 @@
|
||||
var depth = $(this).menuItemDepth();
|
||||
maxChildDepth = (depth > maxChildDepth) ? depth : maxChildDepth;
|
||||
});
|
||||
width = ui.helper.find('.menu-item-handle').outerWidth(); // Get original width
|
||||
width += api.depthToPx(maxChildDepth - originalDepth); // Account for children
|
||||
width -= 2; // Subtract 2 for borders
|
||||
width = ui.helper.find('.menu-item-handle').outerWidth(); // Get original width.
|
||||
width += api.depthToPx(maxChildDepth - originalDepth); // Account for children.
|
||||
width -= 2; // Subtract 2 for borders.
|
||||
ui.placeholder.width(width);
|
||||
|
||||
// Update the list of menu items.
|
||||
tempHolder = ui.placeholder.next( '.menu-item' );
|
||||
tempHolder.css( 'margin-top', helperHeight + 'px' ); // Set the margin to absorb the placeholder
|
||||
ui.placeholder.detach(); // detach or jQuery UI will think the placeholder is a menu item
|
||||
$(this).sortable( 'refresh' ); // The children aren't sortable. We should let jQ UI know.
|
||||
ui.item.after( ui.placeholder ); // reattach the placeholder.
|
||||
tempHolder.css('margin-top', 0); // reset the margin
|
||||
tempHolder.css( 'margin-top', helperHeight + 'px' ); // Set the margin to absorb the placeholder.
|
||||
ui.placeholder.detach(); // Detach or jQuery UI will think the placeholder is a menu item.
|
||||
$(this).sortable( 'refresh' ); // The children aren't sortable. We should let jQuery UI know.
|
||||
ui.item.after( ui.placeholder ); // Reattach the placeholder.
|
||||
tempHolder.css('margin-top', 0); // Reset the margin.
|
||||
|
||||
// Now that the element is complete, we can update...
|
||||
updateSharedVars(ui);
|
||||
@ -690,31 +690,31 @@
|
||||
var children, subMenuTitle,
|
||||
depthChange = currentDepth - originalDepth;
|
||||
|
||||
// Return child elements to the list
|
||||
// Return child elements to the list.
|
||||
children = transport.children().insertAfter(ui.item);
|
||||
|
||||
// Add "sub menu" description
|
||||
// Add "sub menu" description.
|
||||
subMenuTitle = ui.item.find( '.item-title .is-submenu' );
|
||||
if ( 0 < currentDepth )
|
||||
subMenuTitle.show();
|
||||
else
|
||||
subMenuTitle.hide();
|
||||
|
||||
// Update depth classes
|
||||
// Update depth classes.
|
||||
if ( 0 !== depthChange ) {
|
||||
ui.item.updateDepthClass( currentDepth );
|
||||
children.shiftDepthClass( depthChange );
|
||||
updateMenuMaxDepth( depthChange );
|
||||
}
|
||||
// Register a change
|
||||
// Register a change.
|
||||
api.registerChange();
|
||||
// Update the item data.
|
||||
ui.item.updateParentMenuItemDBId();
|
||||
|
||||
// address sortable's incorrectly-calculated top in opera
|
||||
// Address sortable's incorrectly-calculated top in Opera.
|
||||
ui.item[0].style.top = 0;
|
||||
|
||||
// handle drop placement for rtl orientation
|
||||
// Handle drop placement for rtl orientation.
|
||||
if ( api.isRTL ) {
|
||||
ui.item[0].style.left = 'auto';
|
||||
ui.item[0].style.right = 0;
|
||||
@ -736,9 +736,11 @@
|
||||
edge = api.isRTL ? offset.left + ui.helper.width() : offset.left,
|
||||
depth = api.negateIfRTL * api.pxToDepth( edge - menuEdge );
|
||||
|
||||
// Check and correct if depth is not within range.
|
||||
// Also, if the dragged element is dragged upwards over
|
||||
// an item, shift the placeholder to a child position.
|
||||
/*
|
||||
* Check and correct if depth is not within range.
|
||||
* Also, if the dragged element is dragged upwards over an item,
|
||||
* shift the placeholder to a child position.
|
||||
*/
|
||||
if ( depth > maxDepth || offset.top < ( prevBottom - api.options.targetTolerance ) ) {
|
||||
depth = maxDepth;
|
||||
} else if ( depth < minDepth ) {
|
||||
@ -748,7 +750,7 @@
|
||||
if( depth != currentDepth )
|
||||
updateCurrentDepth(ui, depth);
|
||||
|
||||
// If we overlap the next element, manually shift downwards
|
||||
// If we overlap the next element, manually shift downwards.
|
||||
if( nextThreshold && offset.top + helperHeight > nextThreshold ) {
|
||||
next.after( ui.placeholder );
|
||||
updateSharedVars( ui );
|
||||
@ -955,12 +957,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
// Show the ajax spinner
|
||||
// Show the Ajax spinner.
|
||||
$( '.customlinkdiv .spinner' ).addClass( 'is-active' );
|
||||
this.addLinkToMenu( url, label, processMethod, function() {
|
||||
// Remove the ajax spinner
|
||||
// Remove the Ajax spinner.
|
||||
$( '.customlinkdiv .spinner' ).removeClass( 'is-active' );
|
||||
// Set custom link form back to defaults
|
||||
// Set custom link form back to defaults.
|
||||
$('#custom-menu-item-name').val('').blur();
|
||||
$( '#custom-menu-item-url' ).val( '' ).attr( 'placeholder', 'https://' );
|
||||
});
|
||||
@ -997,10 +999,10 @@
|
||||
$.post( ajaxurl, params, function(menuMarkup) {
|
||||
var ins = $('#menu-instructions');
|
||||
|
||||
menuMarkup = $.trim( menuMarkup ); // Trim leading whitespaces
|
||||
menuMarkup = $.trim( menuMarkup ); // Trim leading whitespaces.
|
||||
processMethod(menuMarkup, params);
|
||||
|
||||
// Make it stand out a bit more visually, by adding a fadeIn
|
||||
// Make it stand out a bit more visually, by adding a fadeIn.
|
||||
$( 'li.pending' ).hide().fadeIn('slow');
|
||||
$( '.drag-instructions' ).show();
|
||||
if( ! ins.hasClass( 'menu-instructions-inactive' ) && ins.siblings().length )
|
||||
@ -1051,7 +1053,7 @@
|
||||
return navMenuL10n.saveAlert;
|
||||
};
|
||||
} else {
|
||||
// Make the post boxes read-only, as they can't be used yet
|
||||
// Make the post boxes read-only, as they can't be used yet.
|
||||
$( '#menu-settings-column' ).find( 'input,select' ).end().find( 'a' ).attr( 'href', '#' ).unbind( 'click' );
|
||||
}
|
||||
},
|
||||
@ -1071,7 +1073,7 @@
|
||||
|
||||
wrapper = target.parents('.accordion-section-content').first();
|
||||
|
||||
// upon changing tabs, we want to uncheck all checkboxes
|
||||
// Upon changing tabs, we want to uncheck all checkboxes.
|
||||
$( 'input', wrapper ).prop( 'checked', false );
|
||||
|
||||
$('.tabs-panel-active', wrapper).removeClass('tabs-panel-active').addClass('tabs-panel-inactive');
|
||||
@ -1080,7 +1082,7 @@
|
||||
$('.tabs', wrapper).removeClass('tabs');
|
||||
target.parent().addClass('tabs');
|
||||
|
||||
// select the search bar
|
||||
// Select the search bar.
|
||||
$('.quick-search', wrapper).focus();
|
||||
|
||||
// Hide controls in the search tab if no items found.
|
||||
@ -1193,17 +1195,17 @@
|
||||
var locs = '',
|
||||
menuName = $('#menu-name'),
|
||||
menuNameVal = menuName.val();
|
||||
// Cancel and warn if invalid menu name
|
||||
// Cancel and warn if invalid menu name.
|
||||
if ( ! menuNameVal || ! menuNameVal.replace( /\s+/, '' ) ) {
|
||||
menuName.parent().addClass( 'form-invalid' );
|
||||
return false;
|
||||
}
|
||||
// Copy menu theme locations
|
||||
// Copy menu theme locations.
|
||||
$('#nav-menu-theme-locations select').each(function() {
|
||||
locs += '<input type="hidden" name="' + this.name + '" value="' + $(this).val() + '" />';
|
||||
});
|
||||
$('#update-nav-menu').append( locs );
|
||||
// Update menu item position data
|
||||
// Update menu item position data.
|
||||
api.menuList.find('.menu-item-data-position').val( function(index) { return index + 1; } );
|
||||
window.onbeforeunload = null;
|
||||
|
||||
@ -1211,7 +1213,7 @@
|
||||
},
|
||||
|
||||
eventOnClickMenuDelete : function() {
|
||||
// Delete warning AYS
|
||||
// Delete warning AYS.
|
||||
if ( window.confirm( navMenuL10n.warnDeleteMenu ) ) {
|
||||
window.onbeforeunload = null;
|
||||
return true;
|
||||
@ -1253,7 +1255,7 @@
|
||||
$items.each(function(){
|
||||
$item = $(this);
|
||||
|
||||
// make a unique DB ID number
|
||||
// Make a unique DB ID number.
|
||||
matched = pattern.exec($item.html());
|
||||
|
||||
if ( matched && matched[1] ) {
|
||||
|
@ -183,11 +183,12 @@ jQuery( document ).ready( function( $ ) {
|
||||
var tab = $( this ).attr( 'name' );
|
||||
event.preventDefault();
|
||||
|
||||
// Flip the tab
|
||||
// Flip the tab.
|
||||
$( '#plugin-information-tabs a.current' ).removeClass( 'current' );
|
||||
$( this ).addClass( 'current' );
|
||||
|
||||
// Only show the fyi box in the description section, on smaller screen, where it's otherwise always displayed at the top.
|
||||
// Only show the fyi box in the description section, on smaller screen,
|
||||
// where it's otherwise always displayed at the top.
|
||||
if ( 'description' !== tab && $( window ).width() < 772 ) {
|
||||
$( '#plugin-information-content' ).find( '.fyi' ).hide();
|
||||
} else {
|
||||
|
@ -91,9 +91,9 @@ window.wp = window.wp || {};
|
||||
/**
|
||||
* Load the next batch of comments.
|
||||
*
|
||||
* @param {int} total Total number of comments to load.
|
||||
*
|
||||
* @memberof commentsBox
|
||||
*
|
||||
* @param {int} total Total number of comments to load.
|
||||
*/
|
||||
load: function(total){
|
||||
this.st = jQuery('#the-comment-list tr.comment:visible').length;
|
||||
@ -309,24 +309,24 @@ jQuery(document).ready( function($) {
|
||||
|
||||
// Post locks: contain focus inside the dialog. If the dialog is shown, focus the first item.
|
||||
$('#post-lock-dialog .notification-dialog').on( 'keydown', function(e) {
|
||||
// Don't do anything when [tab] is pressed.
|
||||
// Don't do anything when [Tab] is pressed.
|
||||
if ( e.which != 9 )
|
||||
return;
|
||||
|
||||
var target = $(e.target);
|
||||
|
||||
// [shift] + [tab] on first tab cycles back to last tab.
|
||||
// [Shift] + [Tab] on first tab cycles back to last tab.
|
||||
if ( target.hasClass('wp-tab-first') && e.shiftKey ) {
|
||||
$(this).find('.wp-tab-last').focus();
|
||||
e.preventDefault();
|
||||
// [tab] on last tab cycles back to first tab.
|
||||
// [Tab] on last tab cycles back to first tab.
|
||||
} else if ( target.hasClass('wp-tab-last') && ! e.shiftKey ) {
|
||||
$(this).find('.wp-tab-first').focus();
|
||||
e.preventDefault();
|
||||
}
|
||||
}).filter(':visible').find('.wp-tab-first').focus();
|
||||
|
||||
// Set the heartbeat interval to 15 sec. if post lock dialogs are enabled.
|
||||
// Set the heartbeat interval to 15 seconds if post lock dialogs are enabled.
|
||||
if ( wp.heartbeat && $('#post-lock-dialog').length ) {
|
||||
wp.heartbeat.interval( 15 );
|
||||
}
|
||||
@ -385,7 +385,7 @@ jQuery(document).ready( function($) {
|
||||
});
|
||||
});
|
||||
|
||||
// Submit the form saving a draft or an autosave, and show a preview in a new tab
|
||||
// Submit the form saving a draft or an autosave, and show a preview in a new tab.
|
||||
$('#post-preview').on( 'click.post-preview', function( event ) {
|
||||
var $this = $(this),
|
||||
$form = $('form#post'),
|
||||
@ -534,7 +534,7 @@ jQuery(document).ready( function($) {
|
||||
});
|
||||
});
|
||||
|
||||
// Multiple Taxonomies.
|
||||
// Multiple taxonomies.
|
||||
if ( $('#tagsdiv-post_tag').length ) {
|
||||
window.tagBox && window.tagBox.init();
|
||||
} else {
|
||||
@ -559,7 +559,7 @@ jQuery(document).ready( function($) {
|
||||
settingName = 'cats';
|
||||
}
|
||||
|
||||
// TODO: move to jQuery 1.3+, support for multiple hierarchical taxonomies, see wp-lists.js
|
||||
// @todo Move to jQuery 1.3+, support for multiple hierarchical taxonomies, see wp-lists.js.
|
||||
$('a', '#' + taxonomy + '-tabs').click( function( e ) {
|
||||
e.preventDefault();
|
||||
var t = $(this).attr('href');
|
||||
@ -581,7 +581,7 @@ jQuery(document).ready( function($) {
|
||||
$( this ).val( '' ).removeClass( 'form-input-tip' );
|
||||
});
|
||||
|
||||
// On [enter] submit the taxonomy.
|
||||
// On [Enter] submit the taxonomy.
|
||||
$('#new' + taxonomy).keypress( function(event){
|
||||
if( 13 === event.keyCode ) {
|
||||
event.preventDefault();
|
||||
@ -654,7 +654,7 @@ jQuery(document).ready( function($) {
|
||||
$('#in-' + taxonomy + '-' + id + ', #in-popular-' + taxonomy + '-' + id).prop( 'checked', c );
|
||||
});
|
||||
|
||||
}); // end cats
|
||||
}); // End cats.
|
||||
|
||||
// Custom Fields postbox.
|
||||
if ( $('#postcustom').length ) {
|
||||
@ -796,7 +796,8 @@ jQuery(document).ready( function($) {
|
||||
|
||||
// Update "Status:" to currently selected status.
|
||||
$('#post-status-display').text(
|
||||
wp.sanitize.stripTagsAndEncodeText( $('option:selected', postStatus).text() ) // Remove any potential tags from post status text.
|
||||
// Remove any potential tags from post status text.
|
||||
wp.sanitize.stripTagsAndEncodeText( $('option:selected', postStatus).text() )
|
||||
);
|
||||
|
||||
// Show or hide the "Save Draft" button.
|
||||
@ -838,7 +839,7 @@ jQuery(document).ready( function($) {
|
||||
});
|
||||
|
||||
// Set the selected visibility as current.
|
||||
$postVisibilitySelect.find('.save-post-visibility').click( function( event ) { // crazyhorse - multiple ok cancels
|
||||
$postVisibilitySelect.find('.save-post-visibility').click( function( event ) { // Crazyhorse - multiple OK cancels.
|
||||
$postVisibilitySelect.slideUp('fast');
|
||||
$('#visibility .edit-visibility').show().focus();
|
||||
updateText();
|
||||
@ -886,7 +887,7 @@ jQuery(document).ready( function($) {
|
||||
});
|
||||
|
||||
// Save the changed timestamp.
|
||||
$timestampdiv.find('.save-timestamp').click( function( event ) { // crazyhorse - multiple ok cancels
|
||||
$timestampdiv.find('.save-timestamp').click( function( event ) { // Crazyhorse - multiple OK cancels.
|
||||
if ( updateText() ) {
|
||||
$timestampdiv.slideUp('fast');
|
||||
$timestampdiv.siblings('a.edit-timestamp').show().focus();
|
||||
@ -1023,12 +1024,12 @@ jQuery(document).ready( function($) {
|
||||
|
||||
$el.html( '<input type="text" id="new-post-slug" value="' + slug_value + '" autocomplete="off" />' ).children( 'input' ).keydown( function( e ) {
|
||||
var key = e.which;
|
||||
// On [enter], just save the new slug, don't save the post.
|
||||
// On [Enter], just save the new slug, don't save the post.
|
||||
if ( 13 === key ) {
|
||||
e.preventDefault();
|
||||
buttons.children( '.save' ).click();
|
||||
}
|
||||
// On [esc] cancel the editing.
|
||||
// On [Esc] cancel the editing.
|
||||
if ( 27 === key ) {
|
||||
buttons.children( '.cancel' ).click();
|
||||
}
|
||||
@ -1173,7 +1174,7 @@ jQuery(document).ready( function($) {
|
||||
}
|
||||
});
|
||||
|
||||
// When changing page template, change the editor body class
|
||||
// When changing page template, change the editor body class.
|
||||
$( '#page_template' ).on( 'change.set-editor-class', function() {
|
||||
var editor, body, pageTemplate = $( this ).val() || '';
|
||||
|
||||
@ -1191,9 +1192,9 @@ jQuery(document).ready( function($) {
|
||||
|
||||
}
|
||||
|
||||
// Save on pressing [ctrl]/[command] + [s] in the Text editor.
|
||||
// Save on pressing [Ctrl]/[Command] + [S] in the Text editor.
|
||||
$textarea.on( 'keydown.wp-autosave', function( event ) {
|
||||
// Key [s] has code 83.
|
||||
// Key [S] has code 83.
|
||||
if ( event.which === 83 ) {
|
||||
if ( event.shiftKey || event.altKey || ( isMac && ( ! event.metaKey || event.ctrlKey ) ) || ( ! isMac && ! event.ctrlKey ) ) {
|
||||
return;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user