plugin updates

This commit is contained in:
Tony Volpe
2024-11-15 13:53:04 -05:00
parent 1293d604ca
commit 0238f0c4ca
2009 changed files with 163492 additions and 89543 deletions
+1
View File
@@ -172,3 +172,4 @@ add_filter( 'list_pages', '_wp_privacy_settings_filter_draft_page_titles', 10, 2
// Font management.
add_action( 'admin_print_styles', 'wp_print_font_faces', 50 );
add_action( 'admin_print_styles', 'wp_print_font_faces_from_style_variations', 50 );
+1
View File
@@ -3556,6 +3556,7 @@ function wp_ajax_get_revision_diffs() {
$return = array();
// Removes the script timeout limit by setting it to 0 allowing ample time for diff UI setup.
if ( function_exists( 'set_time_limit' ) ) {
set_time_limit( 0 );
}
@@ -13,6 +13,10 @@
* It allows for WordPress to upgrade itself in combination with
* the wp-admin/includes/update-core.php file.
*
* Note: Newly introduced functions and methods cannot be used here.
* All functions must be present in the previous version being upgraded from
* as this file is used there too.
*
* @since 2.8.0
* @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader.php.
*
@@ -17,16 +17,16 @@ class Custom_Background {
/**
* Callback for administration header.
*
* @var callable
* @since 3.0.0
* @var callable
*/
public $admin_header_callback;
/**
* Callback for header div.
*
* @var callable
* @since 3.0.0
* @var callable
*/
public $admin_image_div_callback;
@@ -17,24 +17,24 @@ class Custom_Image_Header {
/**
* Callback for administration header.
*
* @var callable
* @since 2.1.0
* @var callable
*/
public $admin_header_callback;
/**
* Callback for header div.
*
* @var callable
* @since 3.0.0
* @var callable
*/
public $admin_image_div_callback;
/**
* Holds default headers.
*
* @var array
* @since 3.0.0
* @var array
*/
public $default_headers = array();
@@ -284,7 +284,7 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
$error = sprintf(
/* translators: 1: Current WordPress version, 2: Version required by the uploaded plugin. */
__( 'Your WordPress version is %1$s, however the uploaded plugin requires %2$s.' ),
get_bloginfo( 'version' ),
esc_html( wp_get_wp_version() ),
$requires_wp
);
@@ -274,8 +274,6 @@ class Plugin_Upgrader extends WP_Upgrader {
* @since 2.8.0
* @since 3.7.0 The `$args` parameter was added, making clearing the plugin update cache optional.
*
* @global string $wp_version The WordPress version string.
*
* @param string[] $plugins Array of paths to plugin files relative to the plugins directory.
* @param array $args {
* Optional. Other arguments for upgrading several plugins at once.
@@ -285,7 +283,7 @@ class Plugin_Upgrader extends WP_Upgrader {
* @return array|false An array of results indexed by plugin file, or false if unable to connect to the filesystem.
*/
public function bulk_upgrade( $plugins, $args = array() ) {
global $wp_version;
$wp_version = wp_get_wp_version();
$defaults = array(
'clear_update_cache' => true,
@@ -457,14 +455,14 @@ class Plugin_Upgrader extends WP_Upgrader {
* @since 3.3.0
*
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
* @global string $wp_version The WordPress version string.
*
* @param string $source The path to the downloaded package source.
* @return string|WP_Error The source as passed, or a WP_Error object on failure.
*/
public function check_package( $source ) {
global $wp_filesystem, $wp_version;
global $wp_filesystem;
$wp_version = wp_get_wp_version();
$this->new_plugin_data = array();
if ( is_wp_error( $source ) ) {
@@ -319,7 +319,7 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
$error = sprintf(
/* translators: 1: Current WordPress version, 2: Version required by the uploaded theme. */
__( 'Your WordPress version is %1$s, however the uploaded theme requires %2$s.' ),
get_bloginfo( 'version' ),
esc_html( wp_get_wp_version() ),
$requires_wp
);
@@ -371,8 +371,6 @@ class Theme_Upgrader extends WP_Upgrader {
* @since 3.0.0
* @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional.
*
* @global string $wp_version The WordPress version string.
*
* @param string[] $themes Array of the theme slugs.
* @param array $args {
* Optional. Other arguments for upgrading several themes at once. Default empty array.
@@ -383,8 +381,7 @@ class Theme_Upgrader extends WP_Upgrader {
* @return array[]|false An array of results, or false if unable to connect to the filesystem.
*/
public function bulk_upgrade( $themes, $args = array() ) {
global $wp_version;
$wp_version = wp_get_wp_version();
$defaults = array(
'clear_update_cache' => true,
);
@@ -558,14 +555,14 @@ class Theme_Upgrader extends WP_Upgrader {
* @since 3.3.0
*
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
* @global string $wp_version The WordPress version string.
*
* @param string $source The path to the downloaded package source.
* @return string|WP_Error The source as passed, or a WP_Error object on failure.
*/
public function check_package( $source ) {
global $wp_filesystem, $wp_version;
global $wp_filesystem;
$wp_version = wp_get_wp_version();
$this->new_theme_data = array();
if ( is_wp_error( $source ) ) {
@@ -107,11 +107,13 @@ class Walker_Category_Checklist extends Walker {
/** This filter is documented in wp-includes/category-template.php */
esc_html( apply_filters( 'the_category', $category->name, '', '' ) ) . '</div>';
} else {
$is_selected = in_array( $category->term_id, $args['selected_cats'], true );
$is_disabled = ! empty( $args['disabled'] );
$is_selected = in_array( $category->term_id, $args['selected_cats'], true );
$is_disabled = ! empty( $args['disabled'] );
$li_element_id = wp_unique_prefixed_id( "in-{$taxonomy}-{$category->term_id}-" );
$checkbox_element_id = wp_unique_prefixed_id( "in-{$taxonomy}-{$category->term_id}-" );
$output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" .
'<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]" id="in-' . $taxonomy . '-' . $category->term_id . '"' .
$output .= "\n<li id='" . esc_attr( $li_element_id ) . "'$class>" .
'<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]" id="' . esc_attr( $checkbox_element_id ) . '"' .
checked( $is_selected, true, false ) .
disabled( $is_disabled, true, false ) . ' /> ' .
/** This filter is documented in wp-includes/category-template.php */
@@ -218,18 +218,20 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
<?php _e( 'Open link in a new tab' ); ?>
</label>
</p>
<p class="field-css-classes description description-thin">
<label for="edit-menu-item-classes-<?php echo $item_id; ?>">
<?php _e( 'CSS Classes (optional)' ); ?><br />
<input type="text" id="edit-menu-item-classes-<?php echo $item_id; ?>" class="widefat code edit-menu-item-classes" name="menu-item-classes[<?php echo $item_id; ?>]" value="<?php echo esc_attr( implode( ' ', $menu_item->classes ) ); ?>" />
</label>
</p>
<p class="field-xfn description description-thin">
<label for="edit-menu-item-xfn-<?php echo $item_id; ?>">
<?php _e( 'Link Relationship (XFN)' ); ?><br />
<input type="text" id="edit-menu-item-xfn-<?php echo $item_id; ?>" class="widefat code edit-menu-item-xfn" name="menu-item-xfn[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $menu_item->xfn ); ?>" />
</label>
</p>
<div class="description-group">
<p class="field-css-classes description description-thin">
<label for="edit-menu-item-classes-<?php echo $item_id; ?>">
<?php _e( 'CSS Classes (optional)' ); ?><br />
<input type="text" id="edit-menu-item-classes-<?php echo $item_id; ?>" class="widefat code edit-menu-item-classes" name="menu-item-classes[<?php echo $item_id; ?>]" value="<?php echo esc_attr( implode( ' ', $menu_item->classes ) ); ?>" />
</label>
</p>
<p class="field-xfn description description-thin">
<label for="edit-menu-item-xfn-<?php echo $item_id; ?>">
<?php _e( 'Link Relationship (XFN)' ); ?><br />
<input type="text" id="edit-menu-item-xfn-<?php echo $item_id; ?>" class="widefat code edit-menu-item-xfn" name="menu-item-xfn[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $menu_item->xfn ); ?>" />
</label>
</p>
</div>
<p class="field-description description description-wide">
<label for="edit-menu-item-description-<?php echo $item_id; ?>">
<?php _e( 'Description' ); ?><br />
@@ -238,6 +240,31 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
</label>
</p>
<?php
/**
* Update parent and order of menu item using select inputs.
*
* @since 6.7.0
*/
?>
<div class="field-move-combo description-group">
<p class="description description-wide">
<label for="edit-menu-item-parent-<?php echo $item_id; ?>">
<?php _e( 'Menu Parent' ); ?>
</label>
<select class="edit-menu-item-parent widefat" id="edit-menu-item-parent-<?php echo $item_id; ?>" name="menu-item-parent[<?php echo $item_id; ?>]">
</select>
</p>
<p class="description description-wide">
<label for="edit-menu-item-order-<?php echo $item_id; ?>">
<?php _e( 'Menu Order' ); ?>
</label>
<select class="edit-menu-item-order widefat" id="edit-menu-item-order-<?php echo $item_id; ?>" name="menu-item-order[<?php echo $item_id; ?>]">
</select>
</p>
</div>
<?php
/**
* Fires just before the move buttons of a nav menu item in the menu editor.
@@ -320,4 +347,4 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
<?php
$output .= ob_get_clean();
}
}
}
@@ -752,7 +752,7 @@ class WP_Automatic_Updater {
// Send debugging email to admin for all development installations.
if ( ! empty( $this->update_results ) ) {
$development_version = str_contains( get_bloginfo( 'version' ), '-' );
$development_version = str_contains( wp_get_wp_version(), '-' );
/**
* Filters whether to send a debugging email for each automatic background update.
@@ -795,7 +795,7 @@ class WP_Automatic_Updater {
* @param object $update_result The result of the core update. Includes the update offer and result.
*/
protected function after_core_update( $update_result ) {
$wp_version = get_bloginfo( 'version' );
$wp_version = wp_get_wp_version();
$core_update = $update_result->item;
$result = $update_result->result;
@@ -705,18 +705,18 @@ class WP_Comments_List_Table extends WP_List_Table {
$output = '';
$del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) );
$approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) );
$approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( 'approve-comment_' . $comment->comment_ID ) );
$del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( 'delete-comment_' . $comment->comment_ID ) );
$url = "comment.php?c=$comment->comment_ID";
$action_string = 'comment.php?action=%s&c=' . $comment->comment_ID . '&%s';
$approve_url = esc_url( $url . "&action=approvecomment&$approve_nonce" );
$unapprove_url = esc_url( $url . "&action=unapprovecomment&$approve_nonce" );
$spam_url = esc_url( $url . "&action=spamcomment&$del_nonce" );
$unspam_url = esc_url( $url . "&action=unspamcomment&$del_nonce" );
$trash_url = esc_url( $url . "&action=trashcomment&$del_nonce" );
$untrash_url = esc_url( $url . "&action=untrashcomment&$del_nonce" );
$delete_url = esc_url( $url . "&action=deletecomment&$del_nonce" );
$approve_url = sprintf( $action_string, 'approvecomment', $approve_nonce );
$unapprove_url = sprintf( $action_string, 'unapprovecomment', $approve_nonce );
$spam_url = sprintf( $action_string, 'spamcomment', $del_nonce );
$unspam_url = sprintf( $action_string, 'unspamcomment', $del_nonce );
$trash_url = sprintf( $action_string, 'trashcomment', $del_nonce );
$untrash_url = sprintf( $action_string, 'untrashcomment', $del_nonce );
$delete_url = sprintf( $action_string, 'deletecomment', $del_nonce );
// Preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash.
$actions = array(
@@ -737,7 +737,7 @@ class WP_Comments_List_Table extends WP_List_Table {
if ( 'approved' === $the_comment_status ) {
$actions['unapprove'] = sprintf(
'<a href="%s" data-wp-lists="%s" class="vim-u vim-destructive aria-button-if-js" aria-label="%s">%s</a>',
$unapprove_url,
esc_url( $unapprove_url ),
"delete:the-comment-list:comment-{$comment->comment_ID}:e7e7d3:action=dim-comment&amp;new=unapproved",
esc_attr__( 'Unapprove this comment' ),
__( 'Unapprove' )
@@ -745,7 +745,7 @@ class WP_Comments_List_Table extends WP_List_Table {
} elseif ( 'unapproved' === $the_comment_status ) {
$actions['approve'] = sprintf(
'<a href="%s" data-wp-lists="%s" class="vim-a vim-destructive aria-button-if-js" aria-label="%s">%s</a>',
$approve_url,
esc_url( $approve_url ),
"delete:the-comment-list:comment-{$comment->comment_ID}:e7e7d3:action=dim-comment&amp;new=approved",
esc_attr__( 'Approve this comment' ),
__( 'Approve' )
@@ -754,7 +754,7 @@ class WP_Comments_List_Table extends WP_List_Table {
} else {
$actions['approve'] = sprintf(
'<a href="%s" data-wp-lists="%s" class="vim-a aria-button-if-js" aria-label="%s">%s</a>',
$approve_url,
esc_url( $approve_url ),
"dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=approved",
esc_attr__( 'Approve this comment' ),
__( 'Approve' )
@@ -762,7 +762,7 @@ class WP_Comments_List_Table extends WP_List_Table {
$actions['unapprove'] = sprintf(
'<a href="%s" data-wp-lists="%s" class="vim-u aria-button-if-js" aria-label="%s">%s</a>',
$unapprove_url,
esc_url( $unapprove_url ),
"dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=unapproved",
esc_attr__( 'Unapprove this comment' ),
__( 'Unapprove' )
@@ -772,7 +772,7 @@ class WP_Comments_List_Table extends WP_List_Table {
if ( 'spam' !== $the_comment_status ) {
$actions['spam'] = sprintf(
'<a href="%s" data-wp-lists="%s" class="vim-s vim-destructive aria-button-if-js" aria-label="%s">%s</a>',
$spam_url,
esc_url( $spam_url ),
"delete:the-comment-list:comment-{$comment->comment_ID}::spam=1",
esc_attr__( 'Mark this comment as spam' ),
/* translators: "Mark as spam" link. */
@@ -781,7 +781,7 @@ class WP_Comments_List_Table extends WP_List_Table {
} elseif ( 'spam' === $the_comment_status ) {
$actions['unspam'] = sprintf(
'<a href="%s" data-wp-lists="%s" class="vim-z vim-destructive aria-button-if-js" aria-label="%s">%s</a>',
$unspam_url,
esc_url( $unspam_url ),
"delete:the-comment-list:comment-{$comment->comment_ID}:66cc66:unspam=1",
esc_attr__( 'Restore this comment from the spam' ),
_x( 'Not Spam', 'comment' )
@@ -791,7 +791,7 @@ class WP_Comments_List_Table extends WP_List_Table {
if ( 'trash' === $the_comment_status ) {
$actions['untrash'] = sprintf(
'<a href="%s" data-wp-lists="%s" class="vim-z vim-destructive aria-button-if-js" aria-label="%s">%s</a>',
$untrash_url,
esc_url( $untrash_url ),
"delete:the-comment-list:comment-{$comment->comment_ID}:66cc66:untrash=1",
esc_attr__( 'Restore this comment from the Trash' ),
__( 'Restore' )
@@ -801,7 +801,7 @@ class WP_Comments_List_Table extends WP_List_Table {
if ( 'spam' === $the_comment_status || 'trash' === $the_comment_status || ! EMPTY_TRASH_DAYS ) {
$actions['delete'] = sprintf(
'<a href="%s" data-wp-lists="%s" class="delete vim-d vim-destructive aria-button-if-js" aria-label="%s">%s</a>',
$delete_url,
esc_url( $delete_url ),
"delete:the-comment-list:comment-{$comment->comment_ID}::delete=1",
esc_attr__( 'Delete this comment permanently' ),
__( 'Delete Permanently' )
@@ -809,7 +809,7 @@ class WP_Comments_List_Table extends WP_List_Table {
} else {
$actions['trash'] = sprintf(
'<a href="%s" data-wp-lists="%s" class="delete vim-d vim-destructive aria-button-if-js" aria-label="%s">%s</a>',
$trash_url,
esc_url( $trash_url ),
"delete:the-comment-list:comment-{$comment->comment_ID}::trash=1",
esc_attr__( 'Move this comment to the Trash' ),
_x( 'Trash', 'verb' )
@@ -847,7 +847,16 @@ class WP_Comments_List_Table extends WP_List_Table {
);
}
/** This filter is documented in wp-admin/includes/dashboard.php */
/**
* Filters the action links displayed for each comment in the Comments list table.
*
* @since 2.6.0
*
* @param string[] $actions An array of comment actions. Default actions include:
* 'Approve', 'Unapprove', 'Edit', 'Reply', 'Spam',
* 'Delete', and 'Trash'.
* @param WP_Comment $comment The comment object.
*/
$actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment );
$always_visible = false;
File diff suppressed because it is too large Load Diff
@@ -307,6 +307,11 @@ class WP_Links_List_Table extends WP_List_Table {
do_action( 'manage_link_custom_column', $column_name, $link->link_id );
}
/**
* Generates the list table rows.
*
* @since 3.1.0
*/
public function display_rows() {
foreach ( $this->items as $link ) {
$link = sanitize_bookmark( $link );
+2 -2
View File
@@ -625,7 +625,7 @@ class WP_List_Table {
echo "</select>\n";
submit_button( __( 'Apply' ), 'action', '', false, array( 'id' => "doaction$two" ) );
submit_button( __( 'Apply' ), 'action', 'bulk_action', false, array( 'id' => "doaction$two" ) );
echo "\n";
}
@@ -1718,7 +1718,7 @@ class WP_List_Table {
}
/**
* Generates the table rows.
* Generates the list table rows.
*
* @since 3.1.0
*/
@@ -708,6 +708,10 @@ class WP_Media_List_Table extends WP_List_Table {
}
/**
* Generates the list table rows.
*
* @since 3.1.0
*
* @global WP_Post $post Global post object.
* @global WP_Query $wp_query WordPress Query object.
*/
@@ -611,7 +611,9 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
}
/**
* @global string $mode List table view mode.
* Generates the list table rows.
*
* @since 3.1.0
*/
public function display_rows() {
foreach ( $this->items as $blog ) {
@@ -494,6 +494,9 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
}
/**
* Generates the list table rows.
*
* @since 3.1.0
*/
public function display_rows() {
foreach ( $this->items as $theme ) {
@@ -470,6 +470,11 @@ class WP_MS_Users_List_Table extends WP_List_Table {
echo apply_filters( 'manage_users_custom_column', '', $column_name, $user->ID );
}
/**
* Generates the list table rows.
*
* @since 3.1.0
*/
public function display_rows() {
foreach ( $this->items as $user ) {
$class = '';
@@ -464,6 +464,11 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
}
}
/**
* Generates the list table rows.
*
* @since 3.1.0
*/
public function display_rows() {
$plugins_allowedtags = array(
'a' => array(
@@ -194,7 +194,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
if ( $screen->in_admin( 'network' ) ) {
update_site_option( 'recently_activated', $recently_activated );
} else {
update_option( 'recently_activated', $recently_activated );
update_option( 'recently_activated', $recently_activated, false );
}
$plugin_info = get_site_transient( 'update_plugins' );
@@ -694,6 +694,10 @@ class WP_Plugins_List_Table extends WP_List_Table {
}
/**
* Generates the list table rows.
*
* @since 3.1.0
*
* @global string $status
*/
public function display_rows() {
@@ -1594,7 +1598,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
}
printf(
'<div class="requires"><p>%1$s</p><p>%2$s</p></div>',
'<div class="requires"><p>%1$s</p>%2$s</div>',
$requires,
$notice
);
@@ -723,7 +723,7 @@ class WP_Posts_List_Table extends WP_List_Table {
*
* @since 2.5.0
*
* @param string[] $post_columns An associative array of column headings.
* @param string[] $posts_columns An associative array of column headings.
*/
$posts_columns = apply_filters( 'manage_pages_columns', $posts_columns );
} else {
@@ -733,8 +733,8 @@ class WP_Posts_List_Table extends WP_List_Table {
*
* @since 1.5.0
*
* @param string[] $post_columns An associative array of column headings.
* @param string $post_type The post type slug.
* @param string[] $posts_columns An associative array of column headings.
* @param string $post_type The post type slug.
*/
$posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type );
}
@@ -751,7 +751,7 @@ class WP_Posts_List_Table extends WP_List_Table {
*
* @since 3.0.0
*
* @param string[] $post_columns An associative array of column headings.
* @param string[] $posts_columns An associative array of column headings.
*/
return apply_filters( "manage_{$post_type}_posts_columns", $posts_columns );
}
@@ -790,8 +790,13 @@ class WP_Posts_List_Table extends WP_List_Table {
}
/**
* Generates the list table rows.
*
* @since 3.1.0
*
* @global WP_Query $wp_query WordPress Query object.
* @global int $per_page
* @global int $per_page
*
* @param array $posts
* @param int $level
*/
@@ -1837,6 +1842,7 @@ class WP_Posts_List_Table extends WP_List_Table {
if ( $bulk ) {
$dropdown_args['show_option_no_change'] = __( '&mdash; No Change &mdash;' );
$dropdown_args['id'] = 'bulk_edit_post_parent';
}
/**
@@ -120,7 +120,7 @@ final class WP_Privacy_Policy_Content {
// Cache the result for use before `admin_init` (see above).
if ( $cached !== $state ) {
update_option( '_wp_suggested_policy_text_has_changed', $state );
update_option( '_wp_suggested_policy_text_has_changed', $state, false );
}
return 'changed' === $state;
@@ -224,12 +224,18 @@ class WP_Site_Health_Auto_Updates {
}
$check_dirs = array_unique( $check_dirs );
$updater = new WP_Automatic_Updater();
$checkout = false;
// Search all directories we've found for evidence of version control.
foreach ( $vcs_dirs as $vcs_dir ) {
foreach ( $check_dirs as $check_dir ) {
// phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition,Squiz.PHP.DisallowMultipleAssignments
if ( $checkout = @is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" ) ) {
if ( ! $updater->is_allowed_dir( $check_dir ) ) {
continue;
}
$checkout = is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" );
if ( $checkout ) {
break 2;
}
}
+16 -16
View File
@@ -264,7 +264,7 @@ class WP_Site_Health {
'test' => 'wordpress_version',
);
$core_current_version = get_bloginfo( 'version' );
$core_current_version = wp_get_wp_version();
$core_updates = get_core_updates();
if ( ! is_array( $core_updates ) ) {
@@ -728,8 +728,8 @@ class WP_Site_Health {
$result = array(
'label' => sprintf(
/* translators: %s: The current PHP version. */
__( 'Your site is running the current version of PHP (%s)' ),
/* translators: %s: The recommended PHP version. */
__( 'Your site is running a recommended version of PHP (%s)' ),
PHP_VERSION
),
'status' => 'good',
@@ -746,7 +746,7 @@ class WP_Site_Health {
)
),
'actions' => sprintf(
'<p><a href="%s" target="_blank" rel="noopener">%s<span class="screen-reader-text"> %s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
'<p><a href="%s" target="_blank">%s<span class="screen-reader-text"> %s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
esc_url( wp_get_update_php_url() ),
__( 'Learn more about updating PHP' ),
/* translators: Hidden accessibility text. */
@@ -892,7 +892,7 @@ class WP_Site_Health {
__( 'The WordPress Hosting Team maintains a list of those modules, both recommended and required, in <a href="%1$s" %2$s>the team handbook%3$s</a>.' ),
/* translators: Localized team handbook, if one exists. */
esc_url( __( 'https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions' ) ),
'target="_blank" rel="noopener"',
'target="_blank"',
sprintf(
'<span class="screen-reader-text"> %s</span><span aria-hidden="true" class="dashicons dashicons-external"></span>',
/* translators: Hidden accessibility text. */
@@ -1218,7 +1218,7 @@ class WP_Site_Health {
__( 'The SQL server is a required piece of software for the database WordPress uses to store all your site&#8217;s content and settings.' )
),
'actions' => sprintf(
'<p><a href="%s" target="_blank" rel="noopener">%s<span class="screen-reader-text"> %s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
'<p><a href="%s" target="_blank">%s<span class="screen-reader-text"> %s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
/* translators: Localized version of WordPress requirements if one exists. */
esc_url( __( 'https://wordpress.org/about/requirements/' ) ),
__( 'Learn more about what WordPress requires to run.' ),
@@ -1335,7 +1335,7 @@ class WP_Site_Health {
);
$result['actions'] = sprintf(
'<p><a href="%s" target="_blank" rel="noopener">%s<span class="screen-reader-text"> %s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
'<p><a href="%s" target="_blank">%s<span class="screen-reader-text"> %s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
/* translators: Localized Support reference. */
esc_url( __( 'https://wordpress.org/support/forums/' ) ),
__( 'Get help resolving this issue.' ),
@@ -1373,7 +1373,7 @@ class WP_Site_Health {
__( 'Debug mode is often enabled to gather more details about an error or site failure, but may contain sensitive information which should not be available on a publicly available website.' )
),
'actions' => sprintf(
'<p><a href="%s" target="_blank" rel="noopener">%s<span class="screen-reader-text"> %s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
'<p><a href="%s" target="_blank">%s<span class="screen-reader-text"> %s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
/* translators: Documentation explaining debugging in WordPress. */
esc_url( __( 'https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/' ) ),
__( 'Learn more about debugging in WordPress.' ),
@@ -1455,7 +1455,7 @@ class WP_Site_Health {
__( 'An HTTPS connection is a more secure way of browsing the web. Many services now have HTTPS as a requirement. HTTPS allows you to take advantage of new features that can increase site speed, improve search rankings, and gain the trust of your visitors by helping to protect their online privacy.' )
),
'actions' => sprintf(
'<p><a href="%s" target="_blank" rel="noopener">%s<span class="screen-reader-text"> %s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
'<p><a href="%s" target="_blank">%s<span class="screen-reader-text"> %s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
esc_url( $default_update_url ),
__( 'Learn more about why you should use HTTPS' ),
/* translators: Hidden accessibility text. */
@@ -1539,7 +1539,7 @@ class WP_Site_Health {
if ( ! empty( $direct_update_url ) ) {
$result['actions'] = sprintf(
'<p class="button-container"><a class="button button-primary" href="%1$s" target="_blank" rel="noopener">%2$s<span class="screen-reader-text"> %3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
'<p class="button-container"><a class="button button-primary" href="%1$s" target="_blank">%2$s<span class="screen-reader-text"> %3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
esc_url( $direct_update_url ),
__( 'Update your site to use HTTPS' ),
/* translators: Hidden accessibility text. */
@@ -1558,7 +1558,7 @@ class WP_Site_Health {
$update_url = wp_get_update_https_url();
if ( $update_url !== $default_update_url ) {
$result['description'] .= sprintf(
'<p><a href="%s" target="_blank" rel="noopener">%s<span class="screen-reader-text"> %s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
'<p><a href="%s" target="_blank">%s<span class="screen-reader-text"> %s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
esc_url( $update_url ),
__( 'Talk to your web host about supporting HTTPS for your website.' ),
/* translators: Hidden accessibility text. */
@@ -1817,7 +1817,7 @@ class WP_Site_Health {
* @return array The test results.
*/
public function get_test_available_updates_disk_space() {
$available_space = function_exists( 'disk_free_space' ) ? @disk_free_space( WP_CONTENT_DIR . '/upgrade/' ) : false;
$available_space = function_exists( 'disk_free_space' ) ? @disk_free_space( WP_CONTENT_DIR ) : false;
$result = array(
'label' => __( 'Disk space available to safely perform updates' ),
@@ -2364,7 +2364,7 @@ class WP_Site_Health {
);
} else {
$result['actions'] .= sprintf(
'<p><a href="%s" target="_blank" rel="noopener">%s<span class="screen-reader-text"> %s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
'<p><a href="%s" target="_blank">%s<span class="screen-reader-text"> %s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
__( 'https://developer.wordpress.org/rest-api/frequently-asked-questions/#why-is-authentication-not-working' ),
__( 'Learn how to configure the Authorization header.' ),
/* translators: Hidden accessibility text. */
@@ -2397,7 +2397,7 @@ class WP_Site_Health {
'status' => 'good',
'label' => '',
'actions' => sprintf(
'<p><a href="%1$s" target="_blank" rel="noopener noreferrer">%2$s<span class="screen-reader-text"> %3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
'<p><a href="%1$s" target="_blank" rel="noreferrer">%2$s<span class="screen-reader-text"> %3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
__( 'https://developer.wordpress.org/advanced-administration/performance/optimization/#caching' ),
__( 'Learn more about page cache' ),
/* translators: Hidden accessibility text. */
@@ -2523,7 +2523,7 @@ class WP_Site_Health {
__( 'A persistent object cache makes your site&#8217;s database more efficient, resulting in faster load times because WordPress can retrieve your site&#8217;s content and settings much more quickly.' )
),
'actions' => sprintf(
'<p><a href="%s" target="_blank" rel="noopener">%s<span class="screen-reader-text"> %s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
'<p><a href="%s" target="_blank">%s<span class="screen-reader-text"> %s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
esc_url( $action_url ),
__( 'Learn more about persistent object caching.' ),
/* translators: Hidden accessibility text. */
@@ -2671,7 +2671,7 @@ class WP_Site_Health {
$result['actions'] = sprintf(
/* translators: 1: HelpHub URL, 2: Link description. */
'<p><a target="_blank" rel="noopener" href="%1$s">%2$s</a></p>',
'<p><a target="_blank" href="%1$s">%2$s</a></p>',
esc_url( __( 'https://developer.wordpress.org/advanced-administration/performance/optimization/#autoloaded-options' ) ),
__( 'More info about optimizing autoloaded options' )
);
@@ -230,6 +230,9 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
}
/**
* Generates the list table rows.
*
* @since 3.1.0
*/
public function display_rows() {
$themes = $this->items;
@@ -189,6 +189,9 @@ class WP_Themes_List_Table extends WP_List_Table {
}
/**
* Generates the list table rows.
*
* @since 3.1.0
*/
public function display_rows() {
$themes = $this->items;
+17 -3
View File
@@ -204,6 +204,7 @@ class WP_Upgrader {
$this->strings['mkdir_failed'] = __( 'Could not create directory.' );
$this->strings['incompatible_archive'] = __( 'The package could not be installed.' );
$this->strings['files_not_writable'] = __( 'The update cannot be installed because some files could not be copied. This is usually due to inconsistent file permissions.' );
$this->strings['dir_not_readable'] = __( 'A directory could not be read.' );
$this->strings['maintenance_start'] = __( 'Enabling Maintenance mode&#8230;' );
$this->strings['maintenance_end'] = __( 'Disabling Maintenance mode&#8230;' );
@@ -524,6 +525,7 @@ class WP_Upgrader {
$destination = $args['destination'];
$clear_destination = $args['clear_destination'];
// Give the upgrade an additional 300 seconds(5 minutes) to ensure the install doesn't prematurely timeout having used up the maximum script execution time upacking and downloading in WP_Upgrader->run.
if ( function_exists( 'set_time_limit' ) ) {
set_time_limit( 300 );
}
@@ -557,7 +559,13 @@ class WP_Upgrader {
$remote_source = $args['source'];
$local_destination = $destination;
$source_files = array_keys( $wp_filesystem->dirlist( $remote_source ) );
$dirlist = $wp_filesystem->dirlist( $remote_source );
if ( false === $dirlist ) {
return new WP_Error( 'source_read_failed', $this->strings['fs_error'], $this->strings['dir_not_readable'] );
}
$source_files = array_keys( $dirlist );
$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.
@@ -604,7 +612,13 @@ class WP_Upgrader {
// Has the source location changed? If so, we need a new source_files list.
if ( $source !== $remote_source ) {
$source_files = array_keys( $wp_filesystem->dirlist( $source ) );
$dirlist = $wp_filesystem->dirlist( $source );
if ( false === $dirlist ) {
return new WP_Error( 'new_source_read_failed', $this->strings['fs_error'], $this->strings['dir_not_readable'] );
}
$source_files = array_keys( $dirlist );
}
/*
@@ -1053,7 +1067,7 @@ class WP_Upgrader {
}
// Update the lock, as by this point we've definitely got a lock, just need to fire the actions.
update_option( $lock_option, time() );
update_option( $lock_option, time(), false );
return true;
}
+1 -4
View File
@@ -19,10 +19,7 @@
*/
function wp_credits( $version = '', $locale = '' ) {
if ( ! $version ) {
// Include an unmodified $wp_version.
require ABSPATH . WPINC . '/version.php';
$version = $wp_version;
$version = wp_get_wp_version();
}
if ( ! $locale ) {
+20 -31
View File
@@ -726,18 +726,20 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
'view' => '',
);
$del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) );
$approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) );
$approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( 'approve-comment_' . $comment->comment_ID ) );
$del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( 'delete-comment_' . $comment->comment_ID ) );
$approve_url = esc_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" );
$unapprove_url = esc_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" );
$spam_url = esc_url( "comment.php?action=spamcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
$trash_url = esc_url( "comment.php?action=trashcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
$delete_url = esc_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
$action_string = 'comment.php?action=%s&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID . '&%s';
$approve_url = sprintf( $action_string, 'approvecomment', $approve_nonce );
$unapprove_url = sprintf( $action_string, 'unapprovecomment', $approve_nonce );
$spam_url = sprintf( $action_string, 'spamcomment', $del_nonce );
$trash_url = sprintf( $action_string, 'trashcomment', $del_nonce );
$delete_url = sprintf( $action_string, 'deletecomment', $del_nonce );
$actions['approve'] = sprintf(
'<a href="%s" data-wp-lists="%s" class="vim-a aria-button-if-js" aria-label="%s">%s</a>',
$approve_url,
esc_url( $approve_url ),
"dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=approved",
esc_attr__( 'Approve this comment' ),
__( 'Approve' )
@@ -745,7 +747,7 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
$actions['unapprove'] = sprintf(
'<a href="%s" data-wp-lists="%s" class="vim-u aria-button-if-js" aria-label="%s">%s</a>',
$unapprove_url,
esc_url( $unapprove_url ),
"dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=unapproved",
esc_attr__( 'Unapprove this comment' ),
__( 'Unapprove' )
@@ -768,7 +770,7 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
$actions['spam'] = sprintf(
'<a href="%s" data-wp-lists="%s" class="vim-s vim-destructive aria-button-if-js" aria-label="%s">%s</a>',
$spam_url,
esc_url( $spam_url ),
"delete:the-comment-list:comment-{$comment->comment_ID}::spam=1",
esc_attr__( 'Mark this comment as spam' ),
/* translators: "Mark as spam" link. */
@@ -778,7 +780,7 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
if ( ! EMPTY_TRASH_DAYS ) {
$actions['delete'] = sprintf(
'<a href="%s" data-wp-lists="%s" class="delete vim-d vim-destructive aria-button-if-js" aria-label="%s">%s</a>',
$delete_url,
esc_url( $delete_url ),
"delete:the-comment-list:comment-{$comment->comment_ID}::trash=1",
esc_attr__( 'Delete this comment permanently' ),
__( 'Delete Permanently' )
@@ -786,7 +788,7 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
} else {
$actions['trash'] = sprintf(
'<a href="%s" data-wp-lists="%s" class="delete vim-d vim-destructive aria-button-if-js" aria-label="%s">%s</a>',
$trash_url,
esc_url( $trash_url ),
"delete:the-comment-list:comment-{$comment->comment_ID}::trash=1",
esc_attr__( 'Move this comment to the Trash' ),
_x( 'Trash', 'verb' )
@@ -800,17 +802,7 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
__( 'View' )
);
/**
* Filters the action links displayed for each comment in the 'Recent Comments'
* dashboard widget.
*
* @since 2.6.0
*
* @param string[] $actions An array of comment actions. Default actions include:
* 'Approve', 'Unapprove', 'Edit', 'Reply', 'Spam',
* 'Delete', and 'Trash'.
* @param WP_Comment $comment The comment object.
*/
/** This filter is documented in wp-admin/includes/class-wp-comments-list-table.php */
$actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment );
$i = 0;
@@ -1287,7 +1279,7 @@ function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) {
}
}
update_option( 'dashboard_widget_options', $widget_options );
update_option( 'dashboard_widget_options', $widget_options, false );
$locale = get_user_locale();
$cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale );
@@ -1819,13 +1811,10 @@ function wp_check_browser_version() {
$response = get_site_transient( 'browser_' . $key );
if ( false === $response ) {
// Include an unmodified $wp_version.
require ABSPATH . WPINC . '/version.php';
$url = 'http://api.wordpress.org/core/browse-happy/1.1/';
$options = array(
'body' => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ),
'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ),
'user-agent' => 'WordPress/' . wp_get_wp_version() . '; ' . home_url( '/' ),
);
if ( wp_http_supports( array( 'ssl' ) ) ) {
@@ -1923,7 +1912,7 @@ function wp_dashboard_php_nag() {
<p class="button-container">
<?php
printf(
'<a class="button button-primary" href="%1$s" target="_blank" rel="noopener">%2$s<span class="screen-reader-text"> %3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
'<a class="button button-primary" href="%1$s" target="_blank">%2$s<span class="screen-reader-text"> %3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
esc_url( wp_get_update_php_url() ),
__( 'Learn more about updating PHP' ),
/* translators: Hidden accessibility text. */
@@ -2067,7 +2056,7 @@ function wp_dashboard_empty() {}
* @since 5.9.0 Send users to the Site Editor if the active theme is block-based.
*/
function wp_welcome_panel() {
list( $display_version ) = explode( '-', get_bloginfo( 'version' ) );
list( $display_version ) = explode( '-', wp_get_wp_version() );
$can_customize = current_user_can( 'customize' );
$is_block_theme = wp_is_block_theme();
?>
@@ -2081,7 +2070,7 @@ function wp_welcome_panel() {
<a href="<?php echo esc_url( admin_url( 'about.php' ) ); ?>">
<?php
/* translators: %s: Current WordPress version. */
printf( __( 'Learn more about the %s version.' ), $display_version );
printf( __( 'Learn more about the %s version.' ), esc_html( $display_version ) );
?>
</a>
</p>
+1 -25
View File
@@ -1402,30 +1402,6 @@ function verify_file_signature( $filename, $signatures, $filename_for_errors = f
);
}
// Check for an edge-case affecting PHP Maths abilities.
if (
! extension_loaded( 'sodium' ) &&
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.
* https://bugs.php.net/bug.php?id=75938
*/
return new WP_Error(
'signature_verification_unsupported',
sprintf(
/* translators: %s: The filename of the package. */
__( 'The authenticity of %s could not be verified as signature verification is unavailable on this system.' ),
'<span class="code">' . esc_html( $filename_for_errors ) . '</span>'
),
array(
'php' => PHP_VERSION,
'sodium' => defined( 'SODIUM_LIBRARY_VERSION' ) ? SODIUM_LIBRARY_VERSION : ( defined( 'ParagonIE_Sodium_Compat::VERSION_STRING' ) ? ParagonIE_Sodium_Compat::VERSION_STRING : false ),
)
);
}
// Verify runtime speed of Sodium_Compat is acceptable.
if ( ! extension_loaded( 'sodium' ) && ! ParagonIE_Sodium_Compat::polyfill_is_fast() ) {
$sodium_compat_is_fast = false;
@@ -2496,7 +2472,7 @@ function request_filesystem_credentials( $form_post, $type = '', $error = false,
);
if ( ! wp_installing() ) {
update_option( 'ftp_credentials', $stored_credentials );
update_option( 'ftp_credentials', $stored_credentials, false );
}
return $credentials;
+29 -17
View File
@@ -75,9 +75,9 @@ function wp_image_editor( $post_id, $msg = false ) {
) ) {
$note_no_rotate = '';
?>
<button type="button" class="imgedit-rleft button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.rotate( 90, <?php echo "$post_id, '$nonce'"; ?>, this)" onblur="imageEdit.monitorPopup()"><?php esc_html_e( 'Rotate 90&deg; left' ); ?></button>
<button type="button" class="imgedit-rright button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.rotate(-90, <?php echo "$post_id, '$nonce'"; ?>, this)" onblur="imageEdit.monitorPopup()"><?php esc_html_e( 'Rotate 90&deg; right' ); ?></button>
<button type="button" class="imgedit-rfull button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.rotate(180, <?php echo "$post_id, '$nonce'"; ?>, this)" onblur="imageEdit.monitorPopup()"><?php esc_html_e( 'Rotate 180&deg;' ); ?></button>
<button type="button" class="imgedit-rleft button" onkeydown="imageEdit.browsePopup(event, this)" onclick="imageEdit.rotate( 90, <?php echo "$post_id, '$nonce'"; ?>, this)" onblur="imageEdit.monitorPopup()"><?php esc_html_e( 'Rotate 90&deg; left' ); ?></button>
<button type="button" class="imgedit-rright button" onkeydown="imageEdit.browsePopup(event, this)" onclick="imageEdit.rotate(-90, <?php echo "$post_id, '$nonce'"; ?>, this)" onblur="imageEdit.monitorPopup()"><?php esc_html_e( 'Rotate 90&deg; right' ); ?></button>
<button type="button" class="imgedit-rfull button" onkeydown="imageEdit.browsePopup(event, this)" onclick="imageEdit.rotate(180, <?php echo "$post_id, '$nonce'"; ?>, this)" onblur="imageEdit.monitorPopup()"><?php esc_html_e( 'Rotate 180&deg;' ); ?></button>
<?php
} else {
$note_no_rotate = '<p class="note-no-rotate"><em>' . __( 'Image rotation is not supported by your web host.' ) . '</em></p>';
@@ -88,8 +88,8 @@ function wp_image_editor( $post_id, $msg = false ) {
}
?>
<hr />
<button type="button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>, this)" onblur="imageEdit.monitorPopup()" class="imgedit-flipv button"><?php esc_html_e( 'Flip vertical' ); ?></button>
<button type="button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.flip(2, <?php echo "$post_id, '$nonce'"; ?>, this)" onblur="imageEdit.monitorPopup()" class="imgedit-fliph button"><?php esc_html_e( 'Flip horizontal' ); ?></button>
<button type="button" onkeydown="imageEdit.browsePopup(event, this)" onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>, this)" onblur="imageEdit.monitorPopup()" class="imgedit-flipv button"><?php esc_html_e( 'Flip vertical' ); ?></button>
<button type="button" onkeydown="imageEdit.browsePopup(event, this)" onclick="imageEdit.flip(2, <?php echo "$post_id, '$nonce'"; ?>, this)" onblur="imageEdit.monitorPopup()" class="imgedit-fliph button"><?php esc_html_e( 'Flip horizontal' ); ?></button>
<?php echo $note_no_rotate; ?>
</div>
</div>
@@ -735,10 +735,10 @@ function image_edit_apply_changes( $image, $changes ) {
$w = $size['width'];
$h = $size['height'];
$scale = 1 / _image_get_preview_ratio( $w, $h ); // Discard preview scaling.
$scale = isset( $sel->r ) ? $sel->r : 1 / _image_get_preview_ratio( $w, $h ); // Discard preview scaling.
$image->crop( (int) ( $sel->x * $scale ), (int) ( $sel->y * $scale ), (int) ( $sel->w * $scale ), (int) ( $sel->h * $scale ) );
} else {
$scale = 1 / _image_get_preview_ratio( imagesx( $image ), imagesy( $image ) ); // Discard preview scaling.
$scale = isset( $sel->r ) ? $sel->r : 1 / _image_get_preview_ratio( imagesx( $image ), imagesy( $image ) ); // Discard preview scaling.
$image = _crop_image_resource( $image, $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale );
}
break;
@@ -826,9 +826,10 @@ function wp_restore_image( $post_id ) {
}
} elseif ( isset( $meta['width'], $meta['height'] ) ) {
$backup_sizes[ "full-$suffix" ] = array(
'width' => $meta['width'],
'height' => $meta['height'],
'file' => $parts['basename'],
'width' => $meta['width'],
'height' => $meta['height'],
'filesize' => $meta['filesize'],
'file' => $parts['basename'],
);
}
}
@@ -839,6 +840,14 @@ function wp_restore_image( $post_id ) {
$meta['file'] = _wp_relative_upload_path( $restored_file );
$meta['width'] = $data['width'];
$meta['height'] = $data['height'];
if ( isset( $data['filesize'] ) ) {
/*
* Restore the original filesize if it was backed up.
*
* See https://core.trac.wordpress.org/ticket/59684.
*/
$meta['filesize'] = $data['filesize'];
}
}
foreach ( $default_sizes as $default_size ) {
@@ -997,8 +1006,9 @@ function wp_save_image( $post_id ) {
}
}
$saved_image = wp_save_image_file( $new_path, $img, $post->post_mime_type, $post_id );
// Save the full-size file, also needed to create sub-sizes.
if ( ! wp_save_image_file( $new_path, $img, $post->post_mime_type, $post_id ) ) {
if ( ! $saved_image ) {
$return->error = esc_js( __( 'Unable to save the image.' ) );
return $return;
}
@@ -1018,9 +1028,10 @@ function wp_save_image( $post_id ) {
if ( $tag ) {
$backup_sizes[ $tag ] = array(
'width' => $meta['width'],
'height' => $meta['height'],
'file' => $basename,
'width' => $meta['width'],
'height' => $meta['height'],
'filesize' => $meta['filesize'],
'file' => $basename,
);
}
@@ -1028,9 +1039,10 @@ function wp_save_image( $post_id ) {
$meta['file'] = _wp_relative_upload_path( $new_path );
$size = $img->get_size();
$meta['width'] = $size['width'];
$meta['height'] = $size['height'];
$size = $img->get_size();
$meta['width'] = $size['width'];
$meta['height'] = $size['height'];
$meta['filesize'] = $saved_image['filesize'];
if ( $success && ( 'nothumb' === $target || 'all' === $target ) ) {
$sizes = get_intermediate_image_sizes();
+47 -5
View File
@@ -291,7 +291,26 @@ function wp_create_image_subsizes( $file, $attachment_id ) {
* If the original image's dimensions are over the threshold,
* scale the image and use it as the "full" size.
*/
$scale_down = false;
$convert = false;
if ( $threshold && ( $image_meta['width'] > $threshold || $image_meta['height'] > $threshold ) ) {
// The image will be converted if needed on saving.
$scale_down = true;
} else {
// The image may need to be converted regardless of its dimensions.
$output_format = wp_get_image_editor_output_format( $file, $imagesize['mime'] );
if (
is_array( $output_format ) &&
array_key_exists( $imagesize['mime'], $output_format ) &&
$output_format[ $imagesize['mime'] ] !== $imagesize['mime']
) {
$convert = true;
}
}
if ( $scale_down || $convert ) {
$editor = wp_get_image_editor( $file );
if ( is_wp_error( $editor ) ) {
@@ -299,14 +318,20 @@ function wp_create_image_subsizes( $file, $attachment_id ) {
return $image_meta;
}
// Resize the image.
$resized = $editor->resize( $threshold, $threshold );
if ( $scale_down ) {
// Resize the image. This will also convet it if needed.
$resized = $editor->resize( $threshold, $threshold );
} elseif ( $convert ) {
// The image will be converted (if possible) when saved.
$resized = true;
}
$rotated = null;
// If there is EXIF data, rotate according to EXIF Orientation.
if ( ! is_wp_error( $resized ) && is_array( $exif_meta ) ) {
$resized = $editor->maybe_exif_rotate();
$rotated = $resized;
$rotated = $resized; // bool true or WP_Error
}
if ( ! is_wp_error( $resized ) ) {
@@ -314,7 +339,23 @@ function wp_create_image_subsizes( $file, $attachment_id ) {
* Append "-scaled" to the image file name. It will look like "my_image-scaled.jpg".
* This doesn't affect the sub-sizes names as they are generated from the original image (for best quality).
*/
$saved = $editor->save( $editor->generate_filename( 'scaled' ) );
if ( $scale_down ) {
$saved = $editor->save( $editor->generate_filename( 'scaled' ) );
} elseif ( $convert ) {
/*
* Generate a new file name for the converted image.
*
* As the image file name will be unique due to the changed file extension,
* it does not need a suffix to be unique. However, the generate_filename method
* does not allow for an empty suffix, so the "-converted" suffix is required to
* be added and subsequently removed.
*/
$converted_file_name = $editor->generate_filename( 'converted' );
$converted_file_name = preg_replace( '/(-converted\.)([a-z0-9]+)$/i', '.$2', $converted_file_name );
$saved = $editor->save( $converted_file_name );
} else {
$saved = $editor->save();
}
if ( ! is_wp_error( $saved ) ) {
$image_meta = _wp_image_meta_replace_original( $saved, $file, $image_meta, $attachment_id );
@@ -543,6 +584,7 @@ function wp_copy_parent_attachment_properties( $cropped, $parent_attachment_id,
*
* @since 2.1.0
* @since 6.0.0 The `$filesize` value was added to the returned array.
* @since 6.7.0 The 'image/heic' mime type is supported.
*
* @param int $attachment_id Attachment ID to process.
* @param string $file Filepath of the attached image.
@@ -555,7 +597,7 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) {
$support = false;
$mime_type = get_post_mime_type( $attachment );
if ( preg_match( '!^image/!', $mime_type ) && file_is_displayable_image( $file ) ) {
if ( 'image/heic' === $mime_type || ( preg_match( '!^image/!', $mime_type ) && file_is_displayable_image( $file ) ) ) {
// Make thumbnails and other intermediate sizes.
$metadata = wp_create_image_subsizes( $file, $attachment_id );
} elseif ( wp_attachment_is( 'video', $attachment ) ) {
+3 -6
View File
@@ -136,22 +136,19 @@ function wp_import_handle_upload() {
* @return array Importers with metadata for each.
*/
function wp_get_popular_importers() {
// Include an unmodified $wp_version.
require ABSPATH . WPINC . '/version.php';
$locale = get_user_locale();
$cache_key = 'popular_importers_' . md5( $locale . $wp_version );
$cache_key = 'popular_importers_' . md5( $locale . wp_get_wp_version() );
$popular_importers = get_site_transient( $cache_key );
if ( ! $popular_importers ) {
$url = add_query_arg(
array(
'locale' => $locale,
'version' => $wp_version,
'version' => wp_get_wp_version(),
),
'http://api.wordpress.org/core/importers/1.1/'
);
$options = array( 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ) );
$options = array( 'user-agent' => 'WordPress/' . wp_get_wp_version() . '; ' . home_url( '/' ) );
if ( wp_http_supports( array( 'ssl' ) ) ) {
$url = set_url_scheme( $url, 'https' );
+1 -1
View File
@@ -3243,7 +3243,7 @@ function edit_form_image_editor( $post ) {
__( '<a href="%1$s" %2$s>Learn how to describe the purpose of the image%3$s</a>. Leave empty if the image is purely decorative.' ),
/* translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations. */
esc_url( __( 'https://www.w3.org/WAI/tutorials/images/decision-tree/' ) ),
'target="_blank" rel="noopener"',
'target="_blank"',
sprintf(
'<span class="screen-reader-text"> %s</span>',
/* translators: Hidden accessibility text. */
+1 -1
View File
@@ -1270,7 +1270,7 @@ function xfn_check( $xfn_relationship, $xfn_value = '', $deprecated = '' ) {
_deprecated_argument( __FUNCTION__, '2.5.0' ); // Never implemented.
}
$link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';
$link_rel = isset( $link->link_rel ) ? $link->link_rel : '';
$link_rels = preg_split( '/\s+/', $link_rel );
// Mark the specified value as checked if it matches the current link's relationship.
+1 -1
View File
@@ -1477,7 +1477,7 @@ function update_option_new_admin_email( $old_value, $value ) {
'hash' => $hash,
'newemail' => $value,
);
update_option( 'adminhash', $new_admin_email );
update_option( 'adminhash', $new_admin_email, false );
$switched_locale = switch_to_user_locale( get_current_user_id() );
+1 -1
View File
@@ -1484,7 +1484,7 @@ function wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selecte
wp_get_nav_menus( array( 'fields' => 'ids' ) )
);
update_option( 'nav_menu_options', $nav_menu_option );
update_option( 'nav_menu_options', $nav_menu_option, false );
wp_defer_term_counting( false );
+20 -25
View File
@@ -20,34 +20,33 @@
*
* The second filter, {@see 'plugins_api'}, allows a plugin to override the WordPress.org
* Plugin Installation API entirely. If `$action` is 'query_plugins' or 'plugin_information',
* an object MUST be passed. If `$action` is 'hot_tags' or 'hot_categories', an array MUST
* be passed.
* an object MUST be passed. If `$action` is 'hot_tags', an array MUST be passed.
*
* Finally, the third filter, {@see 'plugins_api_result'}, makes it possible to filter the
* response object or array, depending on the `$action` type.
*
* Supported arguments per action:
*
* | Argument Name | query_plugins | plugin_information | hot_tags | hot_categories |
* | -------------------- | :-----------: | :----------------: | :------: | :------------: |
* | `$slug` | No | Yes | No | No |
* | `$per_page` | Yes | No | No | No |
* | `$page` | Yes | No | No | No |
* | `$number` | No | No | Yes | Yes |
* | `$search` | Yes | No | No | No |
* | `$tag` | Yes | No | No | No |
* | `$author` | Yes | No | No | No |
* | `$user` | Yes | No | No | No |
* | `$browse` | Yes | No | No | No |
* | `$locale` | Yes | Yes | No | No |
* | `$installed_plugins` | Yes | No | No | No |
* | `$is_ssl` | Yes | Yes | No | No |
* | `$fields` | Yes | Yes | No | No |
* | Argument Name | query_plugins | plugin_information | hot_tags |
* | -------------------- | :-----------: | :----------------: | :------: |
* | `$slug` | No | Yes | No |
* | `$per_page` | Yes | No | No |
* | `$page` | Yes | No | No |
* | `$number` | No | No | Yes |
* | `$search` | Yes | No | No |
* | `$tag` | Yes | No | No |
* | `$author` | Yes | No | No |
* | `$user` | Yes | No | No |
* | `$browse` | Yes | No | No |
* | `$locale` | Yes | Yes | No |
* | `$installed_plugins` | Yes | No | No |
* | `$is_ssl` | Yes | Yes | No |
* | `$fields` | Yes | Yes | No |
*
* @since 2.7.0
*
* @param string $action API action to perform: 'query_plugins', 'plugin_information',
* 'hot_tags' or 'hot_categories'.
* or 'hot_tags'.
* @param array|object $args {
* Optional. Array or object of arguments to serialize for the Plugin Info API.
*
@@ -91,7 +90,6 @@
* @type bool $banners Whether to return the banner images links. Default false.
* @type bool $icons Whether to return the icon links. Default false.
* @type bool $active_installs Whether to return the number of active installations. Default false.
* @type bool $group Whether to return the assigned group. Default false.
* @type bool $contributors Whether to return the list of contributors. Default false.
* }
* }
@@ -100,9 +98,6 @@
* for more information on the make-up of possible return values depending on the value of `$action`.
*/
function plugins_api( $action, $args = array() ) {
// Include an unmodified $wp_version.
require ABSPATH . WPINC . '/version.php';
if ( is_array( $args ) ) {
$args = (object) $args;
}
@@ -118,7 +113,7 @@ function plugins_api( $action, $args = array() ) {
}
if ( ! isset( $args->wp_version ) ) {
$args->wp_version = substr( $wp_version, 0, 3 ); // x.y
$args->wp_version = substr( wp_get_wp_version(), 0, 3 ); // x.y
}
/**
@@ -139,7 +134,7 @@ function plugins_api( $action, $args = array() ) {
* Returning a non-false value will effectively short-circuit the WordPress.org API request.
*
* If `$action` is 'query_plugins' or 'plugin_information', an object MUST be passed.
* If `$action` is 'hot_tags' or 'hot_categories', an array should be passed.
* If `$action` is 'hot_tags', an array should be passed.
*
* @since 2.7.0
*
@@ -168,7 +163,7 @@ function plugins_api( $action, $args = array() ) {
$http_args = array(
'timeout' => 15,
'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ),
'user-agent' => 'WordPress/' . wp_get_wp_version() . '; ' . home_url( '/' ),
);
$request = wp_remote_get( $url, $http_args );
+2 -2
View File
@@ -2610,7 +2610,7 @@ function deactivated_plugins_notice() {
if ( false === $blog_deactivated_plugins ) {
// Option not in database, add an empty array to avoid extra DB queries on subsequent loads.
update_option( 'wp_force_deactivated_plugins', array() );
update_option( 'wp_force_deactivated_plugins', array(), false );
}
if ( is_multisite() ) {
@@ -2664,7 +2664,7 @@ function deactivated_plugins_notice() {
}
// Empty the options.
update_option( 'wp_force_deactivated_plugins', array() );
update_option( 'wp_force_deactivated_plugins', array(), false );
if ( is_multisite() ) {
update_site_option( 'wp_force_deactivated_plugins', array() );
}
+16 -18
View File
@@ -1804,18 +1804,21 @@ function _admin_notice_post_locked() {
$locked = false;
}
$sendback = wp_get_referer();
if ( $locked && $sendback && ! str_contains( $sendback, 'post.php' ) && ! str_contains( $sendback, 'post-new.php' ) ) {
$sendback = wp_get_referer();
$sendback_text = __( 'Go back' );
$sendback_text = __( 'Go back' );
} else {
if ( ! $locked || ! $sendback || str_contains( $sendback, 'post.php' ) || str_contains( $sendback, 'post-new.php' ) ) {
$sendback = admin_url( 'edit.php' );
if ( 'post' !== $post->post_type ) {
$sendback = add_query_arg( 'post_type', $post->post_type, $sendback );
}
$sendback_text = get_post_type_object( $post->post_type )->labels->all_items;
$post_type_object = get_post_type_object( $post->post_type );
if ( $post_type_object ) {
$sendback_text = $post_type_object->labels->all_items;
}
}
$hidden = $locked ? '' : ' hidden';
@@ -2005,7 +2008,7 @@ function wp_create_post_autosave( $post_data ) {
}
/**
* Autosave the revisioned meta fields.
* Autosaves the revisioned meta fields.
*
* Iterates through the revisioned meta fields and checks each to see if they are set,
* and have a changed value. If so, the meta value is saved and attached to the autosave.
@@ -2027,15 +2030,14 @@ function wp_autosave_post_revisioned_meta_fields( $new_autosave ) {
$post_type = get_post_type( $new_autosave['post_parent'] );
/*
* Go thru the revisioned meta keys and save them as part of the autosave, if
* the meta key is part of the posted data, the meta value is not blank and
* the the meta value has changes from the last autosaved value.
* Go through the revisioned meta keys and save them as part of the autosave,
* if the meta key is part of the posted data, the meta value is not blank,
* and the meta value has changes from the last autosaved value.
*/
foreach ( wp_post_revision_meta_keys( $post_type ) as $meta_key ) {
if (
isset( $posted_data[ $meta_key ] ) &&
get_post_meta( $new_autosave['ID'], $meta_key, true ) !== wp_unslash( $posted_data[ $meta_key ] )
if ( isset( $posted_data[ $meta_key ] )
&& get_post_meta( $new_autosave['ID'], $meta_key, true ) !== wp_unslash( $posted_data[ $meta_key ] )
) {
/*
* Use the underlying delete_metadata() and add_metadata() functions
@@ -2044,13 +2046,9 @@ function wp_autosave_post_revisioned_meta_fields( $new_autosave ) {
*/
delete_metadata( 'post', $new_autosave['ID'], $meta_key );
/*
* One last check to ensure meta value not empty().
*/
// One last check to ensure meta value is not empty.
if ( ! empty( $posted_data[ $meta_key ] ) ) {
/*
* Add the revisions meta data to the autosave.
*/
// Add the revisions meta data to the autosave.
add_metadata( 'post', $new_autosave['ID'], $meta_key, $posted_data[ $meta_key ] );
}
}
+9 -4
View File
@@ -378,6 +378,11 @@ function wp_print_revision_templates() {
</div>
</script>
<script id="tmpl-revisions-slider-hidden-help" type="text/html">
<h2 class="screen-reader-text"><?php esc_html_e( 'Select a revision' ); ?></h2>
<p id="revisions-slider-hidden-help" hidden><?php esc_html_e( 'Change revision by using the left and right arrow keys' ); ?></p>
</script>
<script id="tmpl-revisions-checkbox" type="text/html">
<div class="revision-toggle-compare-mode">
<label>
@@ -397,13 +402,13 @@ function wp_print_revision_templates() {
<# if ( ! _.isUndefined( data.attributes ) ) { #>
<div class="diff-title">
<# if ( 'from' === data.type ) { #>
<strong><?php _ex( 'From:', 'Followed by post revision info' ); ?></strong>
<strong id="diff-title-from"><?php _ex( 'From:', 'Followed by post revision info' ); ?></strong>
<# } else if ( 'to' === data.type ) { #>
<strong><?php _ex( 'To:', 'Followed by post revision info' ); ?></strong>
<strong id="diff-title-to"><?php _ex( 'To:', 'Followed by post revision info' ); ?></strong>
<# } #>
<div class="author-card<# if ( data.attributes.autosave ) { #> autosave<# } #>">
{{{ data.attributes.author.avatar }}}
<div class="author-info">
<div class="author-info" id="diff-title-author">
<# if ( data.attributes.autosave ) { #>
<span class="byline">
<?php
@@ -464,7 +469,7 @@ function wp_print_revision_templates() {
<div class="diff-error"><?php _e( 'Sorry, something went wrong. The requested comparison could not be loaded.' ); ?></div>
<div class="diff">
<# _.each( data.fields, function( field ) { #>
<h3>{{ field.name }}</h3>
<h2>{{ field.name }}</h2>
{{{ field.diff }}}
<# }); #>
</div>
+1 -1
View File
@@ -424,7 +424,7 @@ function populate_options( array $options = array() ) {
'rss_use_excerpt' => 0,
'mailserver_url' => 'mail.example.com',
'mailserver_login' => 'login@example.com',
'mailserver_pass' => 'password',
'mailserver_pass' => '',
'mailserver_port' => 110,
'default_category' => 1,
'default_comment_status' => 'open',
+17 -16
View File
@@ -850,19 +850,19 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
$day = '<label><span class="screen-reader-text">' .
/* translators: Hidden accessibility text. */
__( 'Day' ) .
'</span><input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>';
'</span><input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" class="form-required" inputmode="numeric" /></label>';
$year = '<label><span class="screen-reader-text">' .
/* translators: Hidden accessibility text. */
__( 'Year' ) .
'</span><input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>';
'</span><input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" class="form-required" inputmode="numeric" /></label>';
$hour = '<label><span class="screen-reader-text">' .
/* translators: Hidden accessibility text. */
__( 'Hour' ) .
'</span><input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>';
'</span><input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" class="form-required" inputmode="numeric" /></label>';
$minute = '<label><span class="screen-reader-text">' .
/* translators: Hidden accessibility text. */
__( 'Minute' ) .
'</span><input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>';
'</span><input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" class="form-required" inputmode="numeric" /></label>';
echo '<div class="timestamp-wrap">';
/* translators: 1: Month, 2: Day, 3: Year, 4: Hour, 5: Minute. */
@@ -1566,23 +1566,24 @@ function do_accordion_sections( $screen, $context, $data_object ) {
++$i;
$hidden_class = in_array( $box['id'], $hidden, true ) ? 'hide-if-js' : '';
$open_class = '';
$open_class = '';
$aria_expanded = 'false';
if ( ! $first_open && empty( $hidden_class ) ) {
$first_open = true;
$open_class = 'open';
$first_open = true;
$open_class = 'open';
$aria_expanded = 'true';
}
?>
<li class="control-section accordion-section <?php echo $hidden_class; ?> <?php echo $open_class; ?> <?php echo esc_attr( $box['id'] ); ?>" id="<?php echo esc_attr( $box['id'] ); ?>">
<h3 class="accordion-section-title hndle" tabindex="0">
<?php echo esc_html( $box['title'] ); ?>
<span class="screen-reader-text">
<?php
/* translators: Hidden accessibility text. */
_e( 'Press return or enter to open this section' );
?>
</span>
<h3 class="accordion-section-title hndle">
<button type="button" class="accordion-trigger" aria-expanded="<?php echo $aria_expanded; ?>" aria-controls="<?php echo esc_attr( $box['id'] ); ?>-content">
<span class="accordion-title">
<?php echo esc_html( $box['title'] ); ?>
<span class="dashicons dashicons-arrow-down" aria-hidden="true"></span>
</span>
</button>
</h3>
<div class="accordion-section-content <?php postbox_classes( $box['id'], $page ); ?>">
<div class="accordion-section-content <?php postbox_classes( $box['id'], $page ); ?>" id="<?php echo esc_attr( $box['id'] ); ?>-content">
<div class="inside">
<?php call_user_func( $box['callback'], $data_object, $box ); ?>
</div><!-- .inside -->
+2 -5
View File
@@ -493,9 +493,6 @@ 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.
require ABSPATH . WPINC . '/version.php';
if ( is_array( $args ) ) {
$args = (object) $args;
}
@@ -511,7 +508,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_get_wp_version(), 0, 3 ); // x.y
}
/**
@@ -562,7 +559,7 @@ function themes_api( $action, $args = array() ) {
$http_args = array(
'timeout' => 15,
'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ),
'user-agent' => 'WordPress/' . wp_get_wp_version() . '; ' . home_url( '/' ),
);
$request = wp_remote_get( $url, $http_args );
+54 -13
View File
@@ -14,12 +14,26 @@
*
* @param string $type Type of translations. Accepts 'plugins', 'themes', 'core'.
* @param array|object $args Translation API arguments. Optional.
* @return array|WP_Error On success an associative array of translations, WP_Error on failure.
* @return array|WP_Error {
* On success an associative array of translations, WP_Error on failure.
*
* @type array $translations {
* List of translations, each an array of data.
*
* @type array ...$0 {
* @type string $language Language code.
* @type string $version WordPress version.
* @type string $updated Date the translation was last updated, in MySQL datetime format.
* @type string $english_name English name of the language.
* @type string $native_name Native name of the language.
* @type string $package URL to download the translation package.
* @type string[] $iso Array of ISO language codes.
* @type array $strings Array of translated strings used in the installation process.
* }
* }
* }
*/
function translations_api( $type, $args = null ) {
// Include an unmodified $wp_version.
require ABSPATH . WPINC . '/version.php';
if ( ! in_array( $type, array( 'plugins', 'themes', 'core' ), true ) ) {
return new WP_Error( 'invalid_type', __( 'Invalid translation type.' ) );
}
@@ -46,7 +60,7 @@ function translations_api( $type, $args = null ) {
$options = array(
'timeout' => 3,
'body' => array(
'wp_version' => $wp_version,
'wp_version' => wp_get_wp_version(),
'locale' => get_locale(),
'version' => $args['version'], // Version of plugin, theme or core.
),
@@ -103,7 +117,24 @@ function translations_api( $type, $args = null ) {
*
* @since 4.0.0
*
* @param array|WP_Error $res Response as an associative array or WP_Error.
* @param array|WP_Error $res {
* On success an associative array of translations, WP_Error on failure.
*
* @type array $translations {
* List of translations, each an array of data.
*
* @type array ...$0 {
* @type string $language Language code.
* @type string $version WordPress version.
* @type string $updated Date the translation was last updated, in MySQL datetime format.
* @type string $english_name English name of the language.
* @type string $native_name Native name of the language.
* @type string $package URL to download the translation package.
* @type string[] $iso Array of ISO language codes.
* @type array $strings Array of translated strings used in the installation process.
* }
* }
* }
* @param string $type The type of translations being requested.
* @param object $args Translation API arguments.
*/
@@ -117,8 +148,21 @@ function translations_api( $type, $args = null ) {
*
* @see translations_api()
*
* @return array[] Array of translations, each an array of data, keyed by the language. If the API response results
* in an error, an empty array will be returned.
* @return array {
* Array of translations keyed by the language code, each an associative array of data.
* If the API response results in an error, an empty array will be returned.
*
* @type array ...$0 {
* @type string $language Language code.
* @type string $version WordPress version.
* @type string $updated Date the translation was last updated, in MySQL datetime format.
* @type string $english_name English name of the language.
* @type string $native_name Native name of the language.
* @type string $package URL to download the translation package.
* @type string[] $iso Array of ISO language codes.
* @type array $strings Array of translated strings used in the installation process.
* }
* }
*/
function wp_get_available_translations() {
if ( ! wp_installing() ) {
@@ -128,17 +172,14 @@ function wp_get_available_translations() {
}
}
// Include an unmodified $wp_version.
require ABSPATH . WPINC . '/version.php';
$api = translations_api( 'core', array( 'version' => $wp_version ) );
$api = translations_api( 'core', array( 'version' => wp_get_wp_version() ) );
if ( is_wp_error( $api ) || empty( $api['translations'] ) ) {
return array();
}
$translations = array();
// Key the array with the language code for now.
// Key the array with the language code.
foreach ( $api['translations'] as $translation ) {
$translations[ $translation['language'] ] = $translation;
}
+65 -5
View File
@@ -2,6 +2,10 @@
/**
* WordPress core upgrade functionality.
*
* Note: Newly introduced functions and methods cannot be used here.
* All functions must be present in the previous version being upgraded from
* as this file is used there too.
*
* @package WordPress
* @subpackage Administration
* @since 2.7.0
@@ -737,10 +741,14 @@ $_old_files = array(
'wp-includes/blocks/query-title/editor.min.css',
'wp-includes/blocks/query-title/editor-rtl.css',
'wp-includes/blocks/query-title/editor-rtl.min.css',
'wp-includes/blocks/tag-cloud/editor.css',
'wp-includes/blocks/tag-cloud/editor.min.css',
'wp-includes/blocks/tag-cloud/editor-rtl.css',
'wp-includes/blocks/tag-cloud/editor-rtl.min.css',
/*
* Restored in WordPress 6.7
*
* 'wp-includes/blocks/tag-cloud/editor.css',
* 'wp-includes/blocks/tag-cloud/editor.min.css',
* 'wp-includes/blocks/tag-cloud/editor-rtl.css',
* 'wp-includes/blocks/tag-cloud/editor-rtl.min.css',
*/
// 6.1
'wp-includes/blocks/post-comments.php',
'wp-includes/blocks/post-comments',
@@ -770,6 +778,56 @@ $_old_files = array(
'wp-includes/blocks/block/editor.min.css',
'wp-includes/blocks/block/editor-rtl.css',
'wp-includes/blocks/block/editor-rtl.min.css',
/*
* 6.7
*
* WordPress 6.7 included a SimplePie upgrade that included a major
* refactoring of the file structure and library. The old files are
* split in to two sections to account for this: files and directories.
*
* See https://core.trac.wordpress.org/changeset/59141
*/
// 6.7 - files
'wp-includes/js/dist/interactivity-router.asset.php',
'wp-includes/js/dist/interactivity-router.js',
'wp-includes/js/dist/interactivity-router.min.js',
'wp-includes/js/dist/interactivity-router.min.asset.php',
'wp-includes/js/dist/interactivity.js',
'wp-includes/js/dist/interactivity.min.js',
'wp-includes/js/dist/vendor/react-dom.min.js.LICENSE.txt',
'wp-includes/js/dist/vendor/react.min.js.LICENSE.txt',
'wp-includes/js/dist/vendor/wp-polyfill-importmap.js',
'wp-includes/js/dist/vendor/wp-polyfill-importmap.min.js',
'wp-includes/sodium_compat/src/Core/Base64/Common.php',
'wp-includes/SimplePie/Author.php',
'wp-includes/SimplePie/Cache.php',
'wp-includes/SimplePie/Caption.php',
'wp-includes/SimplePie/Category.php',
'wp-includes/SimplePie/Copyright.php',
'wp-includes/SimplePie/Core.php',
'wp-includes/SimplePie/Credit.php',
'wp-includes/SimplePie/Enclosure.php',
'wp-includes/SimplePie/Exception.php',
'wp-includes/SimplePie/File.php',
'wp-includes/SimplePie/gzdecode.php',
'wp-includes/SimplePie/IRI.php',
'wp-includes/SimplePie/Item.php',
'wp-includes/SimplePie/Locator.php',
'wp-includes/SimplePie/Misc.php',
'wp-includes/SimplePie/Parser.php',
'wp-includes/SimplePie/Rating.php',
'wp-includes/SimplePie/Registry.php',
'wp-includes/SimplePie/Restriction.php',
'wp-includes/SimplePie/Sanitize.php',
'wp-includes/SimplePie/Source.php',
// 6.7 - directories
'wp-includes/SimplePie/Cache/',
'wp-includes/SimplePie/Content/',
'wp-includes/SimplePie/Decode/',
'wp-includes/SimplePie/HTTP/',
'wp-includes/SimplePie/Net/',
'wp-includes/SimplePie/Parse/',
'wp-includes/SimplePie/XML/',
);
/**
@@ -901,6 +959,7 @@ $_new_bundled_files = array(
'themes/twentytwentytwo/' => '5.9',
'themes/twentytwentythree/' => '6.1',
'themes/twentytwentyfour/' => '6.4',
'themes/twentytwentyfive/' => '6.7',
);
/**
@@ -962,6 +1021,7 @@ function update_core( $from, $to ) {
global $wp_filesystem, $_old_files, $_old_requests_files, $_new_bundled_files, $wpdb;
if ( function_exists( 'set_time_limit' ) ) {
// Gives core update script time an additional 300 seconds(5 minutes) to finish updating large files or run on slower servers.
set_time_limit( 300 );
}
@@ -1763,7 +1823,7 @@ function _upgrade_core_deactivate_incompatible_plugins() {
} else {
$deactivated_plugins = get_option( 'wp_force_deactivated_plugins', array() );
$deactivated_plugins = array_merge( $deactivated_plugins, $deactivated_gutenberg );
update_option( 'wp_force_deactivated_plugins', $deactivated_plugins );
update_option( 'wp_force_deactivated_plugins', $deactivated_plugins, false );
}
deactivate_plugins( array( 'gutenberg/gutenberg.php' ), true );
}
+2 -7
View File
@@ -264,10 +264,7 @@ function core_update_footer( $msg = '' ) {
$cur->response = '';
}
// Include an unmodified $wp_version.
require ABSPATH . WPINC . '/version.php';
$is_development_version = preg_match( '/alpha|beta|RC/', $wp_version );
$is_development_version = preg_match( '/alpha|beta|RC/', wp_get_wp_version() );
if ( $is_development_version ) {
return sprintf(
@@ -854,8 +851,6 @@ function wp_theme_update_row( $theme_key, $theme ) {
* @return void|false
*/
function maintenance_nag() {
// Include an unmodified $wp_version.
require ABSPATH . WPINC . '/version.php';
global $upgrading;
$nag = isset( $upgrading );
@@ -873,7 +868,7 @@ function maintenance_nag() {
* This flag is cleared whenever a successful update occurs using Core_Upgrader.
*/
$comparison = ! empty( $failed['critical'] ) ? '>=' : '>';
if ( isset( $failed['attempted'] ) && version_compare( $failed['attempted'], $wp_version, $comparison ) ) {
if ( isset( $failed['attempted'] ) && version_compare( $failed['attempted'], wp_get_wp_version(), $comparison ) ) {
$nag = true;
}
}
+57 -24
View File
@@ -75,7 +75,7 @@ if ( ! function_exists( 'wp_install' ) ) :
update_option( 'blog_public', $is_public );
// Freshness of site - in the future, this could get more specific about actions taken, perhaps.
update_option( 'fresh_site', 1 );
update_option( 'fresh_site', 1, false );
if ( $language ) {
update_option( 'WPLANG', $language );
@@ -278,7 +278,8 @@ if ( ! function_exists( 'wp_install_defaults' ) ) :
To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.
Commenter avatars come from <a href="%s">Gravatar</a>.'
),
esc_url( __( 'https://en.gravatar.com/' ) )
/* translators: The localized Gravatar URL. */
esc_url( __( 'https://gravatar.com/' ) )
);
$wpdb->insert(
$wpdb->comments,
@@ -459,7 +460,7 @@ Commenter avatars come from <a href="%s">Gravatar</a>.'
* 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 ) && 1 != $user_id ) {
if ( ! is_super_admin( $user_id ) && 1 !== $user_id ) {
$wpdb->delete(
$wpdb->usermeta,
array(
@@ -638,16 +639,16 @@ if ( ! function_exists( 'wp_upgrade' ) ) :
*
* @since 2.1.0
*
* @global int $wp_current_db_version The old (current) database version.
* @global int $wp_db_version The new database version.
* @global int $wp_current_db_version The old (current) database version.
* @global int $wp_db_version The new database version.
*/
function wp_upgrade() {
global $wp_current_db_version, $wp_db_version;
$wp_current_db_version = __get_option( 'db_version' );
$wp_current_db_version = (int) __get_option( 'db_version' );
// We are up to date. Nothing to do.
if ( $wp_db_version == $wp_current_db_version ) {
if ( $wp_db_version === $wp_current_db_version ) {
return;
}
@@ -699,10 +700,10 @@ endif;
function upgrade_all() {
global $wp_current_db_version, $wp_db_version;
$wp_current_db_version = __get_option( 'db_version' );
$wp_current_db_version = (int) __get_option( 'db_version' );
// We are up to date. Nothing to do.
if ( $wp_db_version == $wp_current_db_version ) {
if ( $wp_db_version === $wp_current_db_version ) {
return;
}
@@ -862,6 +863,9 @@ function upgrade_all() {
upgrade_650();
}
if ( $wp_current_db_version < 58975 ) {
upgrade_670();
}
maybe_disable_link_manager();
maybe_disable_automattic_widgets();
@@ -922,7 +926,7 @@ function upgrade_100() {
foreach ( $allposts as $post ) {
// 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 !== (int) $post->post_category ) { // If there's no result.
$wpdb->insert(
$wpdb->post2cat,
array(
@@ -988,9 +992,9 @@ function upgrade_110() {
$time_difference = $all_options->time_difference;
$server_time = time() + gmdate( 'Z' );
$weblogger_time = $server_time + $time_difference * HOUR_IN_SECONDS;
$gmt_time = time();
$server_time = time() + gmdate( 'Z' );
$weblogger_time = $server_time + $time_difference * HOUR_IN_SECONDS;
$gmt_time = time();
$diff_gmt_server = ( $gmt_time - $server_time ) / HOUR_IN_SECONDS;
$diff_weblogger_server = ( $weblogger_time - $server_time ) / HOUR_IN_SECONDS;
@@ -1095,7 +1099,7 @@ function upgrade_130() {
// 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?
if ( $option->dupes > 1 ) { // Could this be done in the query?
$limit = $option->dupes - 1;
$dupe_ids = $wpdb->get_col( $wpdb->prepare( "SELECT option_id FROM $wpdb->options WHERE option_name = %s LIMIT %d", $option->option_name, $limit ) );
if ( $dupe_ids ) {
@@ -1445,7 +1449,7 @@ function upgrade_230() {
$links = $wpdb->get_results( "SELECT link_id, link_category FROM $wpdb->links" );
if ( ! empty( $links ) ) {
foreach ( $links as $link ) {
if ( 0 == $link->link_category ) {
if ( 0 === (int) $link->link_category ) {
continue;
}
if ( ! isset( $link_cat_id_map[ $link->link_category ] ) ) {
@@ -1670,7 +1674,7 @@ function upgrade_290() {
* 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' ) {
if ( 1 === (int) get_option( 'thread_comments_depth' ) ) {
update_option( 'thread_comments_depth', 2 );
update_option( 'thread_comments', 0 );
}
@@ -1843,7 +1847,7 @@ function upgrade_340() {
if ( 'yes' === $wpdb->get_var( "SELECT autoload FROM $wpdb->options WHERE option_name = 'uninstall_plugins'" ) ) {
$uninstall_plugins = get_option( 'uninstall_plugins' );
delete_option( 'uninstall_plugins' );
add_option( 'uninstall_plugins', $uninstall_plugins, null, 'no' );
add_option( 'uninstall_plugins', $uninstall_plugins, null, false );
}
}
}
@@ -2339,7 +2343,7 @@ function upgrade_630() {
$can_compress_scripts = get_option( 'can_compress_scripts', false );
if ( false !== $can_compress_scripts ) {
delete_option( 'can_compress_scripts' );
add_option( 'can_compress_scripts', $can_compress_scripts, '', 'yes' );
add_option( 'can_compress_scripts', $can_compress_scripts, '', true );
}
}
}
@@ -2392,11 +2396,40 @@ function upgrade_650() {
)
);
$autoload = array_fill_keys( $theme_mods_options, 'no' );
$autoload = array_fill_keys( $theme_mods_options, false );
wp_set_option_autoload_values( $autoload );
}
}
/**
* Executes changes made in WordPress 6.7.0.
*
* @ignore
* @since 6.7.0
*
* @global int $wp_current_db_version The old (current) database version.
*/
function upgrade_670() {
global $wp_current_db_version;
if ( $wp_current_db_version < 58975 ) {
$options = array(
'recently_activated',
'_wp_suggested_policy_text_has_changed',
'dashboard_widget_options',
'ftp_credentials',
'adminhash',
'nav_menu_options',
'wp_force_deactivated_plugins',
'delete_blog_hash',
'allowedthemes',
'recovery_keys',
'https_detection_errors',
'fresh_site',
);
wp_set_options_autoload( $options, false );
}
}
/**
* Executes network-level upgrade routines.
*
@@ -2518,7 +2551,7 @@ function upgrade_network() {
$upgrade = false;
$indexes = $wpdb->get_results( "SHOW INDEXES FROM $wpdb->signups" );
foreach ( $indexes as $index ) {
if ( 'domain_path' === $index->Key_name && 'domain' === $index->Column_name && 140 != $index->Sub_part ) {
if ( 'domain_path' === $index->Key_name && 'domain' === $index->Column_name && '140' !== $index->Sub_part ) {
$upgrade = true;
break;
}
@@ -3088,7 +3121,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
$fieldtype_base = strtok( $fieldtype_without_parentheses, ' ' );
// Is actual field type different from the field type in query?
if ( $tablefield->Type != $fieldtype ) {
if ( $tablefield->Type !== $fieldtype ) {
$do_change = true;
if ( in_array( $fieldtype_lowercased, $text_fields, true ) && in_array( $tablefield_type_lowercased, $text_fields, true ) ) {
if ( array_search( $fieldtype_lowercased, $text_fields, true ) < array_search( $tablefield_type_lowercased, $text_fields, true ) ) {
@@ -3128,7 +3161,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
// Get the default value from the array.
if ( preg_match( "| DEFAULT '(.*?)'|i", $cfields[ $tablefield_field_lowercased ], $matches ) ) {
$default_value = $matches[1];
if ( $tablefield->Default != $default_value ) {
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}'";
@@ -3167,7 +3200,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N
'fieldname' => $tableindex->Column_name,
'subpart' => $tableindex->Sub_part,
);
$index_ary[ $keyname ]['unique'] = ( 0 == $tableindex->Non_unique ) ? true : false;
$index_ary[ $keyname ]['unique'] = ( '0' === $tableindex->Non_unique ) ? true : false;
$index_ary[ $keyname ]['index_type'] = $tableindex->Index_type;
}
@@ -3519,7 +3552,7 @@ function make_site_theme() {
// Make the new site theme active.
$current_template = __get_option( 'template' );
if ( WP_DEFAULT_THEME == $current_template ) {
if ( WP_DEFAULT_THEME === $current_template ) {
update_option( 'template', $template );
update_option( 'stylesheet', $template );
}