2010-07-30 16:34:54 -04:00
< ? php
/**
* Multisite themes administration panel .
*
* @ package WordPress
* @ subpackage Multisite
2010-10-31 05:37:15 -04:00
* @ since 3.1 . 0
2010-07-30 16:34:54 -04:00
*/
2010-11-10 09:27:15 -05:00
/** Load WordPress Administration Bootstrap */
2020-02-06 01:33:11 -05:00
require_once __DIR__ . '/admin.php' ;
2010-07-30 16:34:54 -04:00
2017-11-30 18:11:00 -05:00
if ( ! current_user_can ( 'manage_network_themes' ) ) {
2016-06-29 11:16:29 -04:00
wp_die ( __ ( 'Sorry, you are not allowed to manage network themes.' ) );
2017-11-30 18:11:00 -05:00
}
2010-12-15 14:24:42 -05:00
2017-11-30 18:11:00 -05:00
$wp_list_table = _get_list_table ( 'WP_MS_Themes_List_Table' );
$pagenum = $wp_list_table -> get_pagenum ();
2010-07-30 16:34:54 -04:00
2010-10-31 05:37:15 -04:00
$action = $wp_list_table -> current_action ();
2017-11-30 18:11:00 -05:00
$s = isset ( $_REQUEST [ 's' ] ) ? $_REQUEST [ 's' ] : '' ;
2010-10-31 05:37:15 -04:00
// Clean up request URI from temporary args for screen options/paging uri's to work as expected.
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
$temp_args = array (
'enabled' ,
'disabled' ,
'deleted' ,
'error' ,
'enabled-auto-update' ,
'disabled-auto-update' ,
);
2010-12-24 12:41:36 -05:00
$_SERVER [ 'REQUEST_URI' ] = remove_query_arg ( $temp_args , $_SERVER [ 'REQUEST_URI' ] );
2017-11-30 18:11:00 -05:00
$referer = remove_query_arg ( $temp_args , wp_get_referer () );
2010-10-31 05:37:15 -04:00
if ( $action ) {
switch ( $action ) {
2010-11-08 16:52:54 -05:00
case 'enable' :
2017-11-30 18:11:00 -05:00
check_admin_referer ( 'enable-theme_' . $_GET [ 'theme' ] );
2016-04-13 23:40:27 -04:00
WP_Theme :: network_enable_theme ( $_GET [ 'theme' ] );
2017-11-30 18:11:00 -05:00
if ( false === strpos ( $referer , '/network/themes.php' ) ) {
2012-06-12 11:31:25 -04:00
wp_redirect ( network_admin_url ( 'themes.php?enabled=1' ) );
2017-11-30 18:11:00 -05:00
} else {
2012-06-12 11:31:25 -04:00
wp_safe_redirect ( add_query_arg ( 'enabled' , 1 , $referer ) );
2017-11-30 18:11:00 -05:00
}
2010-12-24 12:41:36 -05:00
exit ;
2010-11-08 16:52:54 -05:00
case 'disable' :
2017-11-30 18:11:00 -05:00
check_admin_referer ( 'disable-theme_' . $_GET [ 'theme' ] );
2016-04-13 23:40:27 -04:00
WP_Theme :: network_disable_theme ( $_GET [ 'theme' ] );
2011-12-10 13:26:48 -05:00
wp_safe_redirect ( add_query_arg ( 'disabled' , '1' , $referer ) );
2010-10-31 05:37:15 -04:00
exit ;
2010-11-08 16:52:54 -05:00
case 'enable-selected' :
2017-11-30 18:11:00 -05:00
check_admin_referer ( 'bulk-themes' );
2010-10-31 05:37:15 -04:00
$themes = isset ( $_POST [ 'checked' ] ) ? ( array ) $_POST [ 'checked' ] : array ();
2017-11-30 18:11:00 -05:00
if ( empty ( $themes ) ) {
2011-12-10 13:26:48 -05:00
wp_safe_redirect ( add_query_arg ( 'error' , 'none' , $referer ) );
2010-10-31 05:37:15 -04:00
exit ;
2010-12-24 12:41:36 -05:00
}
2016-04-13 23:40:27 -04:00
WP_Theme :: network_enable_theme ( ( array ) $themes );
2011-12-10 13:26:48 -05:00
wp_safe_redirect ( add_query_arg ( 'enabled' , count ( $themes ), $referer ) );
2010-12-24 12:41:36 -05:00
exit ;
2010-11-08 16:52:54 -05:00
case 'disable-selected' :
2017-11-30 18:11:00 -05:00
check_admin_referer ( 'bulk-themes' );
2010-11-04 16:11:08 -04:00
$themes = isset ( $_POST [ 'checked' ] ) ? ( array ) $_POST [ 'checked' ] : array ();
2017-11-30 18:11:00 -05:00
if ( empty ( $themes ) ) {
2011-12-10 13:26:48 -05:00
wp_safe_redirect ( add_query_arg ( 'error' , 'none' , $referer ) );
2010-11-04 16:11:08 -04:00
exit ;
2010-12-24 12:41:36 -05:00
}
2016-04-13 23:40:27 -04:00
WP_Theme :: network_disable_theme ( ( array ) $themes );
2011-12-10 13:26:48 -05:00
wp_safe_redirect ( add_query_arg ( 'disabled' , count ( $themes ), $referer ) );
2010-12-24 12:41:36 -05:00
exit ;
2017-11-30 18:11:00 -05:00
case 'update-selected' :
2011-10-03 10:35:43 -04:00
check_admin_referer ( 'bulk-themes' );
2017-11-30 18:11:00 -05:00
if ( isset ( $_GET [ 'themes' ] ) ) {
2011-10-03 10:35:43 -04:00
$themes = explode ( ',' , $_GET [ 'themes' ] );
2017-11-30 18:11:00 -05:00
} elseif ( isset ( $_POST [ 'checked' ] ) ) {
2011-10-03 10:35:43 -04:00
$themes = ( array ) $_POST [ 'checked' ];
2017-11-30 18:11:00 -05:00
} else {
2011-10-03 10:35:43 -04:00
$themes = array ();
2017-11-30 18:11:00 -05:00
}
2011-10-03 10:35:43 -04:00
2017-11-30 18:11:00 -05:00
$title = __ ( 'Update Themes' );
2011-10-03 10:35:43 -04:00
$parent_file = 'themes.php' ;
2020-02-06 01:33:11 -05:00
require_once ABSPATH . 'wp-admin/admin-header.php' ;
2011-10-03 10:35:43 -04:00
echo '<div class="wrap">' ;
2015-06-27 11:41:25 -04:00
echo '<h1>' . esc_html ( $title ) . '</h1>' ;
2011-10-03 10:35:43 -04:00
2020-10-18 13:27:06 -04:00
$url = self_admin_url ( 'update.php?action=update-selected-themes&themes=' . urlencode ( implode ( ',' , $themes ) ) );
2017-11-30 18:11:00 -05:00
$url = wp_nonce_url ( $url , 'bulk-update-themes' );
2011-10-03 10:35:43 -04:00
echo " <iframe src=' $url ' style='width: 100%; height:100%; min-height:850px;'></iframe> " ;
echo '</div>' ;
2020-02-06 01:33:11 -05:00
require_once ABSPATH . 'wp-admin/admin-footer.php' ;
2011-10-03 10:35:43 -04:00
exit ;
2010-12-21 11:50:16 -05:00
case 'delete-selected' :
2014-10-08 15:05:20 -04:00
if ( ! current_user_can ( 'delete_themes' ) ) {
2017-11-30 18:11:00 -05:00
wp_die ( __ ( 'Sorry, you are not allowed to delete themes for this site.' ) );
2014-10-08 15:05:20 -04:00
}
2010-12-23 13:53:44 -05:00
check_admin_referer ( 'bulk-themes' );
2010-12-21 11:50:16 -05:00
$themes = isset ( $_REQUEST [ 'checked' ] ) ? ( array ) $_REQUEST [ 'checked' ] : array ();
2010-12-24 12:41:36 -05:00
2010-12-21 11:50:16 -05:00
if ( empty ( $themes ) ) {
2011-12-10 13:26:48 -05:00
wp_safe_redirect ( add_query_arg ( 'error' , 'none' , $referer ) );
2010-12-21 11:50:16 -05:00
exit ;
}
2014-10-05 16:37:17 -04:00
$themes = array_diff ( $themes , array ( get_option ( 'stylesheet' ), get_option ( 'template' ) ) );
2011-12-08 18:02:33 -05:00
2010-12-21 11:50:16 -05:00
if ( empty ( $themes ) ) {
2011-12-10 13:26:48 -05:00
wp_safe_redirect ( add_query_arg ( 'error' , 'main' , $referer ) );
2010-12-21 11:50:16 -05:00
exit ;
}
2010-12-23 10:56:32 -05:00
2015-12-17 13:35:26 -05:00
$theme_info = array ();
2014-10-05 16:37:17 -04:00
foreach ( $themes as $key => $theme ) {
$theme_info [ $theme ] = wp_get_theme ( $theme );
}
2020-02-06 01:33:11 -05:00
require ABSPATH . 'wp-admin/update.php' ;
2010-12-21 11:50:16 -05:00
$parent_file = 'themes.php' ;
if ( ! isset ( $_REQUEST [ 'verify-delete' ] ) ) {
wp_enqueue_script ( 'jquery' );
2020-02-06 01:33:11 -05:00
require_once ABSPATH . 'wp-admin/admin-header.php' ;
2015-03-31 14:45:28 -04:00
$themes_to_delete = count ( $themes );
2010-12-21 11:50:16 -05:00
?>
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
< div class = " wrap " >
< ? php if ( 1 === $themes_to_delete ) : ?>
2015-06-27 11:41:25 -04:00
< h1 >< ? php _e ( 'Delete Theme' ); ?> </h1>
2015-03-31 14:45:28 -04:00
< div class = " error " >< p >< strong >< ? php _e ( 'Caution:' ); ?> </strong> <?php _e( 'This theme may be active on other sites in the network.' ); ?></p></div>
< p >< ? php _e ( 'You are about to remove the following theme:' ); ?> </p>
< ? php else : ?>
2015-06-27 11:41:25 -04:00
< h1 >< ? php _e ( 'Delete Themes' ); ?> </h1>
2015-03-31 14:45:28 -04:00
< div class = " error " >< p >< strong >< ? php _e ( 'Caution:' ); ?> </strong> <?php _e( 'These themes may be active on other sites in the network.' ); ?></p></div>
< p >< ? php _e ( 'You are about to remove the following themes:' ); ?> </p>
< ? php endif ; ?>
2010-12-21 11:50:16 -05:00
< ul class = " ul-disc " >
2014-10-08 15:05:20 -04:00
< ? php
2017-11-30 18:11:00 -05:00
foreach ( $theme_info as $theme ) {
echo '<li>' . sprintf (
2019-09-02 20:41:05 -04:00
/* translators: 1: Theme name, 2: Theme author. */
2017-11-30 18:11:00 -05:00
_x ( '%1$s by %2$s' , 'theme' ),
'<strong>' . $theme -> display ( 'Name' ) . '</strong>' ,
'<em>' . $theme -> display ( 'Author' ) . '</em>'
) . '</li>' ;
}
2014-10-08 15:05:20 -04:00
?>
2010-12-21 11:50:16 -05:00
</ ul >
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
< ? php if ( 1 === $themes_to_delete ) : ?>
2019-07-04 05:56:57 -04:00
< p >< ? php _e ( 'Are you sure you want to delete this theme?' ); ?> </p>
2015-03-31 14:45:28 -04:00
< ? php else : ?>
2019-07-04 05:56:57 -04:00
< p >< ? php _e ( 'Are you sure you want to delete these themes?' ); ?> </p>
2015-03-31 14:45:28 -04:00
< ? php endif ; ?>
2017-11-30 18:11:00 -05:00
< form method = " post " action = " <?php echo esc_url( $_SERVER['REQUEST_URI'] ); ?> " style = " display:inline; " >
2010-12-21 11:50:16 -05:00
< input type = " hidden " name = " verify-delete " value = " 1 " />
< input type = " hidden " name = " action " value = " delete-selected " />
< ? php
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
2017-11-30 18:11:00 -05:00
foreach ( ( array ) $themes as $theme ) {
echo '<input type="hidden" name="checked[]" value="' . esc_attr ( $theme ) . '" />' ;
}
2015-03-31 14:45:28 -04:00
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
wp_nonce_field ( 'bulk-themes' );
2015-03-31 14:45:28 -04:00
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
if ( 1 === $themes_to_delete ) {
2017-11-30 18:11:00 -05:00
submit_button ( __ ( 'Yes, delete this theme' ), '' , 'submit' , false );
} else {
submit_button ( __ ( 'Yes, delete these themes' ), '' , 'submit' , false );
}
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
2010-12-21 11:50:16 -05:00
?>
</ form >
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
< ? php $referer = wp_get_referer (); ?>
2015-03-08 22:11:28 -04:00
< form method = " post " action = " <?php echo $referer ? esc_url( $referer ) : ''; ?> " style = " display:inline; " >
2016-09-28 15:54:28 -04:00
< ? php submit_button ( __ ( 'No, return me to the theme list' ), '' , 'submit' , false ); ?>
2010-12-21 11:50:16 -05:00
</ form >
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
</ div >
2010-12-21 11:50:16 -05:00
< ? php
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
2020-02-06 01:33:11 -05:00
require_once ABSPATH . 'wp-admin/admin-footer.php' ;
2010-12-21 11:50:16 -05:00
exit ;
2020-01-28 19:45:18 -05:00
} // End if verify-delete.
2010-12-23 14:40:32 -05:00
2012-09-28 21:36:14 -04:00
foreach ( $themes as $theme ) {
2017-11-30 18:11:00 -05:00
$delete_result = delete_theme (
2018-08-16 21:51:36 -04:00
$theme ,
esc_url (
2017-11-30 18:11:00 -05:00
add_query_arg (
array (
'verify-delete' => 1 ,
'action' => 'delete-selected' ,
'checked' => $_REQUEST [ 'checked' ],
'_wpnonce' => $_REQUEST [ '_wpnonce' ],
2018-08-16 21:51:36 -04:00
),
network_admin_url ( 'themes.php' )
2017-11-30 18:11:00 -05:00
)
)
);
2012-09-28 21:36:14 -04:00
}
2014-05-06 14:08:14 -04:00
2011-12-08 18:02:33 -05:00
$paged = ( $_REQUEST [ 'paged' ] ) ? $_REQUEST [ 'paged' ] : 1 ;
2017-11-30 18:11:00 -05:00
wp_redirect (
add_query_arg (
array (
'deleted' => count ( $themes ),
'paged' => $paged ,
's' => $s ,
2018-08-16 21:51:36 -04:00
),
network_admin_url ( 'themes.php' )
2017-11-30 18:11:00 -05:00
)
);
2010-12-21 11:50:16 -05:00
exit ;
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
case 'enable-auto-update' :
case 'disable-auto-update' :
case 'enable-auto-update-selected' :
case 'disable-auto-update-selected' :
if ( ! ( current_user_can ( 'update_themes' ) && wp_is_auto_update_enabled_for_type ( 'theme' ) ) ) {
wp_die ( __ ( 'Sorry, you are not allowed to change themes automatic update settings.' ) );
}
if ( 'enable-auto-update' === $action || 'disable-auto-update' === $action ) {
check_admin_referer ( 'updates' );
} else {
if ( empty ( $_POST [ 'checked' ] ) ) {
// Nothing to do.
wp_safe_redirect ( add_query_arg ( 'error' , 'none' , $referer ) );
exit ;
}
check_admin_referer ( 'bulk-themes' );
}
$auto_updates = ( array ) get_site_option ( 'auto_update_themes' , array () );
if ( 'enable-auto-update' === $action ) {
$auto_updates [] = $_GET [ 'theme' ];
$auto_updates = array_unique ( $auto_updates );
$referer = add_query_arg ( 'enabled-auto-update' , 1 , $referer );
} elseif ( 'disable-auto-update' === $action ) {
$auto_updates = array_diff ( $auto_updates , array ( $_GET [ 'theme' ] ) );
$referer = add_query_arg ( 'disabled-auto-update' , 1 , $referer );
} else {
// Bulk enable/disable.
$themes = ( array ) wp_unslash ( $_POST [ 'checked' ] );
if ( 'enable-auto-update-selected' === $action ) {
$auto_updates = array_merge ( $auto_updates , $themes );
$auto_updates = array_unique ( $auto_updates );
$referer = add_query_arg ( 'enabled-auto-update' , count ( $themes ), $referer );
} else {
$auto_updates = array_diff ( $auto_updates , $themes );
$referer = add_query_arg ( 'disabled-auto-update' , count ( $themes ), $referer );
}
}
$all_items = wp_get_themes ();
// Remove themes that don't exist or have been deleted since the option was last updated.
$auto_updates = array_intersect ( $auto_updates , array_keys ( $all_items ) );
update_site_option ( 'auto_update_themes' , $auto_updates );
wp_safe_redirect ( $referer );
exit ;
2016-09-23 16:33:30 -04:00
default :
$themes = isset ( $_POST [ 'checked' ] ) ? ( array ) $_POST [ 'checked' ] : array ();
if ( empty ( $themes ) ) {
wp_safe_redirect ( add_query_arg ( 'error' , 'none' , $referer ) );
exit ;
}
check_admin_referer ( 'bulk-themes' );
2016-10-26 10:37:29 -04:00
/** This action is documented in wp-admin/network/site-themes.php */
2019-07-04 21:45:56 -04:00
$referer = apply_filters ( 'handle_network_bulk_actions-' . get_current_screen () -> id , $referer , $action , $themes ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
2016-09-23 16:33:30 -04:00
wp_safe_redirect ( $referer );
exit ;
2010-10-31 05:37:15 -04:00
}
2010-07-30 16:34:54 -04:00
}
2010-10-31 05:37:15 -04:00
$wp_list_table -> prepare_items ();
2011-01-12 19:03:38 -05:00
2010-11-01 16:08:25 -04:00
add_thickbox ();
2010-10-31 05:37:15 -04:00
2015-03-10 11:32:27 -04:00
add_screen_option ( 'per_page' );
2011-10-02 02:59:36 -04:00
2017-11-30 18:11:00 -05:00
get_current_screen () -> add_help_tab (
array (
'id' => 'overview' ,
'title' => __ ( 'Overview' ),
'content' =>
'<p>' . __ ( 'This screen enables and disables the inclusion of themes available to choose in the Appearance menu for each site. It does not activate or deactivate which theme a site is currently using.' ) . '</p>' .
'<p>' . __ ( 'If the network admin disables a theme that is in use, it can still remain selected on that site. If another theme is chosen, the disabled theme will not appear in the site’s Appearance > Themes screen.' ) . '</p>' .
'<p>' . __ ( 'Themes can be enabled on a site by site basis by the network admin on the Edit Site screen (which has a Themes tab); get there via the Edit action link on the All Sites screen. Only network admins are able to install or edit themes.' ) . '</p>' ,
)
);
2011-11-02 01:33:53 -04:00
2020-06-16 13:29:07 -04:00
$help_sidebar_autoupdates = '' ;
2020-06-19 17:14:08 -04:00
2020-06-16 13:29:07 -04:00
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' =>
'<p>' . __ ( '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.' ) . '</p>' .
'<p>' . __ ( 'Please note: Third-party themes and plugins, or custom code, may override WordPress scheduling.' ) . '</p>' ,
)
);
$help_sidebar_autoupdates = '<p>' . __ ( '<a href="https://wordpress.org/support/article/plugins-themes-auto-updates/">Learn more: Auto-updates documentation</a>' ) . '</p>' ;
}
2011-11-02 17:32:16 -04:00
get_current_screen () -> set_help_sidebar (
2017-11-30 18:11:00 -05:00
'<p><strong>' . __ ( 'For more information:' ) . '</strong></p>' .
'<p>' . __ ( '<a href="https://codex.wordpress.org/Network_Admin_Themes_Screen">Documentation on Network Themes</a>' ) . '</p>' .
2020-06-19 17:14:08 -04:00
$help_sidebar_autoupdates .
'<p>' . __ ( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
2010-10-31 19:23:32 -04:00
);
2017-11-30 18:11:00 -05:00
get_current_screen () -> set_screen_reader_content (
array (
'heading_views' => __ ( 'Filter themes list' ),
'heading_pagination' => __ ( 'Themes list navigation' ),
'heading_list' => __ ( 'Themes list' ),
)
);
2015-10-06 21:28:25 -04:00
2017-11-30 18:11:00 -05:00
$title = __ ( 'Themes' );
2010-10-31 05:37:15 -04:00
$parent_file = 'themes.php' ;
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
wp_enqueue_script ( 'updates' );
No-JavaScript and no-Customizer support for the new Themes screen.
JavaScript is rarely disabled, but graceful degradation is still important. For example, syntax errors can occur, usually with major WP updates that overhaul entire experiences and update external libraries combined with themes or plugins doing weird or old things. If this error is due to their current theme, a user needs to be able to access the themes screen to switch away from the theme. A more subtle issue could make things painful to diagnose.
This commit renders the grid in PHP (the template is duplicated, but it lightweight, fairly mundane, and easy to sync). On Backbone render, the grid is then re-rendered from JavaScript so searches can occur. Customize and Live Preview is disabled if JS fails to kick in. If JS is disabled, old-school "Preview" links are displayed.
No-Customizer support: The customizer is only supported when the browser supports postMessage (IE8+), and if the frontend is a different domain, CORS (IE10+). We use the .hide-if-no-customize class for this. Pre-customize "Preview" links should use .hide-if-customize.
The .load-customize class should be used to declare a link that opens the customizer. This enables customize-loader.js to intercept this link and load the customizer on top of the current window, making for a smoother experience.
fixes #25964.
Built from https://develop.svn.wordpress.org/trunk@26726
git-svn-id: http://core.svn.wordpress.org/trunk@26615 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-06 11:11:10 -05:00
wp_enqueue_script ( 'theme-preview' );
2013-07-05 11:15:58 -04:00
2020-02-06 01:33:11 -05:00
require_once ABSPATH . 'wp-admin/admin-header.php' ;
2010-10-31 05:37:15 -04:00
2010-07-30 16:34:54 -04:00
?>
2010-10-31 05:37:15 -04:00
2010-07-30 16:34:54 -04:00
< div class = " wrap " >
2016-12-09 13:57:42 -05:00
< h1 class = " wp-heading-inline " >< ? php echo esc_html ( $title ); ?> </h1>
< ? php if ( current_user_can ( 'install_themes' ) ) : ?>
< a href = " theme-install.php " class = " page-title-action " >< ? php echo esc_html_x ( 'Add New' , 'theme' ); ?> </a>
< ? php endif ; ?>
< ? php
2016-01-14 15:06:25 -05:00
if ( isset ( $_REQUEST [ 's' ] ) && strlen ( $_REQUEST [ 's' ] ) ) {
2020-10-23 13:19:14 -04:00
echo '<span class="subtitle">' ;
printf (
/* translators: %s: Search query. */
__ ( 'Search results for: %s' ),
'<strong>' . esc_html ( $s ) . '</strong>'
);
echo '</span>' ;
2016-01-14 15:06:25 -05:00
}
?>
2016-12-09 13:57:42 -05:00
< hr class = " wp-header-end " >
2010-10-31 05:37:15 -04:00
2010-12-24 12:41:36 -05:00
< ? php
if ( isset ( $_GET [ 'enabled' ] ) ) {
2015-03-31 14:45:28 -04:00
$enabled = absint ( $_GET [ 'enabled' ] );
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
if ( 1 === $enabled ) {
2015-03-31 14:45:28 -04:00
$message = __ ( 'Theme enabled.' );
} else {
2019-09-02 20:41:05 -04:00
/* translators: %s: Number of themes. */
2015-03-31 14:45:28 -04:00
$message = _n ( '%s theme enabled.' , '%s themes enabled.' , $enabled );
}
2015-04-01 18:06:28 -04:00
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf ( $message , number_format_i18n ( $enabled ) ) . '</p></div>' ;
2010-12-24 12:41:36 -05:00
} elseif ( isset ( $_GET [ 'disabled' ] ) ) {
2015-03-31 14:45:28 -04:00
$disabled = absint ( $_GET [ 'disabled' ] );
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
if ( 1 === $disabled ) {
2015-03-31 14:45:28 -04:00
$message = __ ( 'Theme disabled.' );
} else {
2019-09-02 20:41:05 -04:00
/* translators: %s: Number of themes. */
2015-03-31 14:45:28 -04:00
$message = _n ( '%s theme disabled.' , '%s themes disabled.' , $disabled );
}
2015-04-01 18:06:28 -04:00
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf ( $message , number_format_i18n ( $disabled ) ) . '</p></div>' ;
2010-12-24 12:41:36 -05:00
} elseif ( isset ( $_GET [ 'deleted' ] ) ) {
2015-03-31 14:45:28 -04:00
$deleted = absint ( $_GET [ 'deleted' ] );
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
if ( 1 === $deleted ) {
2015-03-31 14:45:28 -04:00
$message = __ ( 'Theme deleted.' );
} else {
2019-09-02 20:41:05 -04:00
/* translators: %s: Number of themes. */
2015-03-31 14:45:28 -04:00
$message = _n ( '%s theme deleted.' , '%s themes deleted.' , $deleted );
}
2015-04-01 18:06:28 -04:00
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf ( $message , number_format_i18n ( $deleted ) ) . '</p></div>' ;
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
} 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 '<div id="message" class="updated notice is-dismissible"><p>' . sprintf ( $message , number_format_i18n ( $enabled ) ) . '</p></div>' ;
} 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 '<div id="message" class="updated notice is-dismissible"><p>' . sprintf ( $message , number_format_i18n ( $disabled ) ) . '</p></div>' ;
} elseif ( isset ( $_GET [ 'error' ] ) && 'none' === $_GET [ 'error' ] ) {
2015-04-01 18:06:28 -04:00
echo '<div id="message" class="error notice is-dismissible"><p>' . __ ( 'No theme selected.' ) . '</p></div>' ;
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
} elseif ( isset ( $_GET [ 'error' ] ) && 'main' === $_GET [ 'error' ] ) {
2015-04-01 18:06:28 -04:00
echo '<div class="error notice is-dismissible"><p>' . __ ( 'You cannot delete a theme while it is active on the main site.' ) . '</p></div>' ;
2010-12-24 12:41:36 -05:00
}
?>
2015-01-15 23:16:24 -05:00
< form method = " get " >
2010-12-16 15:45:10 -05:00
< ? php $wp_list_table -> search_box ( __ ( 'Search Installed Themes' ), 'theme' ); ?>
2010-10-31 05:37:15 -04:00
</ form >
2012-03-08 02:32:42 -05:00
< ? php
$wp_list_table -> views ();
Security: Add user interface to auto-update themes and plugins.
Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.
Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.
Built from https://develop.svn.wordpress.org/trunk@47835
git-svn-id: http://core.svn.wordpress.org/trunk@47611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 14:49:09 -04:00
if ( 'broken' === $status ) {
2016-02-23 12:20:27 -05:00
echo '<p class="clear">' . __ ( 'The following themes are installed but incomplete.' ) . '</p>' ;
2017-11-30 18:11:00 -05:00
}
2012-03-08 02:32:42 -05:00
?>
2010-10-31 05:37:15 -04:00
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
< form id = " bulk-action-form " method = " post " >
2017-11-30 18:11:00 -05:00
< input type = " hidden " name = " theme_status " value = " <?php echo esc_attr( $status ); ?> " />
< input type = " hidden " name = " paged " value = " <?php echo esc_attr( $page ); ?> " />
2010-10-31 05:37:15 -04:00
< ? php $wp_list_table -> display (); ?>
</ form >
2010-07-30 16:34:54 -04:00
</ div >
2010-10-31 05:37:15 -04:00
< ? php
Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.
Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.
Built from https://develop.svn.wordpress.org/trunk@37714
git-svn-id: http://core.svn.wordpress.org/trunk@37680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:37:29 -04:00
wp_print_request_filesystem_credentials_modal ();
wp_print_admin_notice_templates ();
wp_print_update_row_templates ();
2020-02-06 01:33:11 -05:00
require_once ABSPATH . 'wp-admin/admin-footer.php' ;