diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-admin/network/themes.php --- a/wp/wp-admin/network/themes.php Tue Oct 22 16:11:46 2019 +0200 +++ b/wp/wp-admin/network/themes.php Tue Dec 15 13:49:49 2020 +0100 @@ -8,7 +8,7 @@ */ /** Load WordPress Administration Bootstrap */ -require_once( dirname( __FILE__ ) . '/admin.php' ); +require_once __DIR__ . '/admin.php'; if ( ! current_user_can( 'manage_network_themes' ) ) { wp_die( __( 'Sorry, you are not allowed to manage network themes.' ) ); @@ -22,7 +22,15 @@ $s = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : ''; // Clean up request URI from temporary args for screen options/paging uri's to work as expected. -$temp_args = array( 'enabled', 'disabled', 'deleted', 'error' ); +$temp_args = array( + 'enabled', + 'disabled', + 'deleted', + 'error', + 'enabled-auto-update', + 'disabled-auto-update', +); + $_SERVER['REQUEST_URI'] = remove_query_arg( $temp_args, $_SERVER['REQUEST_URI'] ); $referer = remove_query_arg( $temp_args, wp_get_referer() ); @@ -76,7 +84,7 @@ $title = __( 'Update Themes' ); $parent_file = 'themes.php'; - require_once( ABSPATH . 'wp-admin/admin-header.php' ); + require_once ABSPATH . 'wp-admin/admin-header.php'; echo '
'; echo '

' . esc_html( $title ) . '

'; @@ -86,7 +94,7 @@ echo ""; echo '
'; - require_once( ABSPATH . 'wp-admin/admin-footer.php' ); + require_once ABSPATH . 'wp-admin/admin-footer.php'; exit; case 'delete-selected': if ( ! current_user_can( 'delete_themes' ) ) { @@ -114,17 +122,17 @@ $theme_info[ $theme ] = wp_get_theme( $theme ); } - include( ABSPATH . 'wp-admin/update.php' ); + require ABSPATH . 'wp-admin/update.php'; $parent_file = 'themes.php'; if ( ! isset( $_REQUEST['verify-delete'] ) ) { wp_enqueue_script( 'jquery' ); - require_once( ABSPATH . 'wp-admin/admin-header.php' ); + require_once ABSPATH . 'wp-admin/admin-header.php'; $themes_to_delete = count( $themes ); ?> -
- +
+

@@ -137,7 +145,7 @@ ' . sprintf( - /* translators: 1: theme name, 2: theme author */ + /* translators: 1: Theme name, 2: Theme author. */ _x( '%1$s by %2$s', 'theme' ), '' . $theme->display( 'Name' ) . '', '' . $theme->display( 'Author' ) . '' @@ -145,39 +153,40 @@ } ?> - -

+ +

-

+

'; } - wp_nonce_field( 'bulk-themes' ); + wp_nonce_field( 'bulk-themes' ); - if ( 1 == $themes_to_delete ) { + if ( 1 === $themes_to_delete ) { submit_button( __( 'Yes, delete this theme' ), '', 'submit', false ); } else { submit_button( __( 'Yes, delete these themes' ), '', 'submit', false ); } + ?>
- +
-
+
id, $referer, $action, $themes ); + $referer = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $referer, $action, $themes ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores wp_safe_redirect( $referer ); exit; @@ -241,9 +302,26 @@ ) ); +$help_sidebar_autoupdates = ''; + +if ( current_user_can( 'update_themes' ) && wp_is_auto_update_enabled_for_type( 'theme' ) ) { + get_current_screen()->add_help_tab( + array( + 'id' => 'plugins-themes-auto-updates', + 'title' => __( 'Auto-updates' ), + 'content' => + '

' . __( 'Auto-updates can be enabled or disabled for each individual theme. Themes with auto-updates enabled will display the estimated date of the next auto-update. Auto-updates depends on the WP-Cron task scheduling system.' ) . '

' . + '

' . __( 'Please note: Third-party themes and plugins, or custom code, may override WordPress scheduling.' ) . '

', + ) + ); + + $help_sidebar_autoupdates = '

' . __( 'Learn more: Auto-updates documentation' ) . '

'; +} + get_current_screen()->set_help_sidebar( '

' . __( 'For more information:' ) . '

' . '

' . __( 'Documentation on Network Themes' ) . '

' . + $help_sidebar_autoupdates . '

' . __( 'Support' ) . '

' ); @@ -261,7 +339,7 @@ wp_enqueue_script( 'updates' ); wp_enqueue_script( 'theme-preview' ); -require_once( ABSPATH . 'wp-admin/admin-header.php' ); +require_once ABSPATH . 'wp-admin/admin-header.php'; ?> @@ -274,7 +352,7 @@ ' . __( 'Search results for “%s”' ) . '', esc_html( $s ) ); } ?> @@ -284,31 +362,52 @@

' . sprintf( $message, number_format_i18n( $enabled ) ) . '

'; } elseif ( isset( $_GET['disabled'] ) ) { $disabled = absint( $_GET['disabled'] ); - if ( 1 == $disabled ) { + if ( 1 === $disabled ) { $message = __( 'Theme disabled.' ); } else { + /* translators: %s: Number of themes. */ $message = _n( '%s theme disabled.', '%s themes disabled.', $disabled ); } echo '

' . sprintf( $message, number_format_i18n( $disabled ) ) . '

'; } elseif ( isset( $_GET['deleted'] ) ) { $deleted = absint( $_GET['deleted'] ); - if ( 1 == $deleted ) { + if ( 1 === $deleted ) { $message = __( 'Theme deleted.' ); } else { + /* translators: %s: Number of themes. */ $message = _n( '%s theme deleted.', '%s themes deleted.', $deleted ); } echo '

' . sprintf( $message, number_format_i18n( $deleted ) ) . '

'; -} elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) { +} elseif ( isset( $_GET['enabled-auto-update'] ) ) { + $enabled = absint( $_GET['enabled-auto-update'] ); + if ( 1 === $enabled ) { + $message = __( 'Theme will be auto-updated.' ); + } else { + /* translators: %s: Number of themes. */ + $message = _n( '%s theme will be auto-updated.', '%s themes will be auto-updated.', $enabled ); + } + echo '

' . sprintf( $message, number_format_i18n( $enabled ) ) . '

'; +} elseif ( isset( $_GET['disabled-auto-update'] ) ) { + $disabled = absint( $_GET['disabled-auto-update'] ); + if ( 1 === $disabled ) { + $message = __( 'Theme will no longer be auto-updated.' ); + } else { + /* translators: %s: Number of themes. */ + $message = _n( '%s theme will no longer be auto-updated.', '%s themes will no longer be auto-updated.', $disabled ); + } + echo '

' . sprintf( $message, number_format_i18n( $disabled ) ) . '

'; +} elseif ( isset( $_GET['error'] ) && 'none' === $_GET['error'] ) { echo '

' . __( 'No theme selected.' ) . '

'; -} elseif ( isset( $_GET['error'] ) && 'main' == $_GET['error'] ) { +} elseif ( isset( $_GET['error'] ) && 'main' === $_GET['error'] ) { echo '

' . __( 'You cannot delete a theme while it is active on the main site.' ) . '

'; } @@ -321,7 +420,7 @@ views(); -if ( 'broken' == $status ) { +if ( 'broken' === $status ) { echo '

' . __( 'The following themes are installed but incomplete.' ) . '

'; } ?> @@ -340,4 +439,4 @@ wp_print_admin_notice_templates(); wp_print_update_row_templates(); -include( ABSPATH . 'wp-admin/admin-footer.php' ); +require_once ABSPATH . 'wp-admin/admin-footer.php';