author | ymh <ymh.work@gmail.com> |
Tue, 27 Sep 2022 16:37:53 +0200 | |
changeset 19 | 3d72ae0968f4 |
parent 18 | be944660c56a |
child 21 | 48c4eec2b7e6 |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/** |
|
3 |
* Multisite themes administration panel. |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Multisite |
|
7 |
* @since 3.1.0 |
|
8 |
*/ |
|
9 |
||
10 |
/** Load WordPress Administration Bootstrap */ |
|
16 | 11 |
require_once __DIR__ . '/admin.php'; |
0 | 12 |
|
9 | 13 |
if ( ! current_user_can( 'manage_network_themes' ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
14 |
wp_die( __( 'Sorry, you are not allowed to manage network themes.' ) ); |
9 | 15 |
} |
0 | 16 |
|
9 | 17 |
$wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' ); |
18 |
$pagenum = $wp_list_table->get_pagenum(); |
|
0 | 19 |
|
20 |
$action = $wp_list_table->current_action(); |
|
21 |
||
9 | 22 |
$s = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : ''; |
0 | 23 |
|
24 |
// Clean up request URI from temporary args for screen options/paging uri's to work as expected. |
|
16 | 25 |
$temp_args = array( |
26 |
'enabled', |
|
27 |
'disabled', |
|
28 |
'deleted', |
|
29 |
'error', |
|
30 |
'enabled-auto-update', |
|
31 |
'disabled-auto-update', |
|
32 |
); |
|
33 |
||
0 | 34 |
$_SERVER['REQUEST_URI'] = remove_query_arg( $temp_args, $_SERVER['REQUEST_URI'] ); |
9 | 35 |
$referer = remove_query_arg( $temp_args, wp_get_referer() ); |
0 | 36 |
|
37 |
if ( $action ) { |
|
38 |
switch ( $action ) { |
|
39 |
case 'enable': |
|
9 | 40 |
check_admin_referer( 'enable-theme_' . $_GET['theme'] ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
41 |
WP_Theme::network_enable_theme( $_GET['theme'] ); |
9 | 42 |
if ( false === strpos( $referer, '/network/themes.php' ) ) { |
0 | 43 |
wp_redirect( network_admin_url( 'themes.php?enabled=1' ) ); |
9 | 44 |
} else { |
0 | 45 |
wp_safe_redirect( add_query_arg( 'enabled', 1, $referer ) ); |
9 | 46 |
} |
0 | 47 |
exit; |
48 |
case 'disable': |
|
9 | 49 |
check_admin_referer( 'disable-theme_' . $_GET['theme'] ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
50 |
WP_Theme::network_disable_theme( $_GET['theme'] ); |
0 | 51 |
wp_safe_redirect( add_query_arg( 'disabled', '1', $referer ) ); |
52 |
exit; |
|
53 |
case 'enable-selected': |
|
9 | 54 |
check_admin_referer( 'bulk-themes' ); |
0 | 55 |
$themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); |
9 | 56 |
if ( empty( $themes ) ) { |
0 | 57 |
wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) ); |
58 |
exit; |
|
59 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
60 |
WP_Theme::network_enable_theme( (array) $themes ); |
0 | 61 |
wp_safe_redirect( add_query_arg( 'enabled', count( $themes ), $referer ) ); |
62 |
exit; |
|
63 |
case 'disable-selected': |
|
9 | 64 |
check_admin_referer( 'bulk-themes' ); |
0 | 65 |
$themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); |
9 | 66 |
if ( empty( $themes ) ) { |
0 | 67 |
wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) ); |
68 |
exit; |
|
69 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
70 |
WP_Theme::network_disable_theme( (array) $themes ); |
0 | 71 |
wp_safe_redirect( add_query_arg( 'disabled', count( $themes ), $referer ) ); |
72 |
exit; |
|
9 | 73 |
case 'update-selected': |
0 | 74 |
check_admin_referer( 'bulk-themes' ); |
75 |
||
9 | 76 |
if ( isset( $_GET['themes'] ) ) { |
0 | 77 |
$themes = explode( ',', $_GET['themes'] ); |
9 | 78 |
} elseif ( isset( $_POST['checked'] ) ) { |
0 | 79 |
$themes = (array) $_POST['checked']; |
9 | 80 |
} else { |
0 | 81 |
$themes = array(); |
9 | 82 |
} |
0 | 83 |
|
19 | 84 |
// Used in the HTML title tag. |
9 | 85 |
$title = __( 'Update Themes' ); |
0 | 86 |
$parent_file = 'themes.php'; |
87 |
||
16 | 88 |
require_once ABSPATH . 'wp-admin/admin-header.php'; |
0 | 89 |
|
90 |
echo '<div class="wrap">'; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
91 |
echo '<h1>' . esc_html( $title ) . '</h1>'; |
0 | 92 |
|
18 | 93 |
$url = self_admin_url( 'update.php?action=update-selected-themes&themes=' . urlencode( implode( ',', $themes ) ) ); |
9 | 94 |
$url = wp_nonce_url( $url, 'bulk-update-themes' ); |
0 | 95 |
|
96 |
echo "<iframe src='$url' style='width: 100%; height:100%; min-height:850px;'></iframe>"; |
|
97 |
echo '</div>'; |
|
16 | 98 |
require_once ABSPATH . 'wp-admin/admin-footer.php'; |
0 | 99 |
exit; |
100 |
case 'delete-selected': |
|
5 | 101 |
if ( ! current_user_can( 'delete_themes' ) ) { |
9 | 102 |
wp_die( __( 'Sorry, you are not allowed to delete themes for this site.' ) ); |
5 | 103 |
} |
104 |
||
0 | 105 |
check_admin_referer( 'bulk-themes' ); |
106 |
||
107 |
$themes = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array(); |
|
108 |
||
109 |
if ( empty( $themes ) ) { |
|
110 |
wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) ); |
|
111 |
exit; |
|
112 |
} |
|
113 |
||
5 | 114 |
$themes = array_diff( $themes, array( get_option( 'stylesheet' ), get_option( 'template' ) ) ); |
0 | 115 |
|
116 |
if ( empty( $themes ) ) { |
|
117 |
wp_safe_redirect( add_query_arg( 'error', 'main', $referer ) ); |
|
118 |
exit; |
|
119 |
} |
|
120 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
121 |
$theme_info = array(); |
5 | 122 |
foreach ( $themes as $key => $theme ) { |
123 |
$theme_info[ $theme ] = wp_get_theme( $theme ); |
|
124 |
} |
|
125 |
||
16 | 126 |
require ABSPATH . 'wp-admin/update.php'; |
0 | 127 |
|
128 |
$parent_file = 'themes.php'; |
|
129 |
||
130 |
if ( ! isset( $_REQUEST['verify-delete'] ) ) { |
|
131 |
wp_enqueue_script( 'jquery' ); |
|
16 | 132 |
require_once ABSPATH . 'wp-admin/admin-header.php'; |
5 | 133 |
$themes_to_delete = count( $themes ); |
0 | 134 |
?> |
16 | 135 |
<div class="wrap"> |
136 |
<?php if ( 1 === $themes_to_delete ) : ?> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
137 |
<h1><?php _e( 'Delete Theme' ); ?></h1> |
5 | 138 |
<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This theme may be active on other sites in the network.' ); ?></p></div> |
139 |
<p><?php _e( 'You are about to remove the following theme:' ); ?></p> |
|
140 |
<?php else : ?> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
141 |
<h1><?php _e( 'Delete Themes' ); ?></h1> |
5 | 142 |
<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These themes may be active on other sites in the network.' ); ?></p></div> |
143 |
<p><?php _e( 'You are about to remove the following themes:' ); ?></p> |
|
144 |
<?php endif; ?> |
|
0 | 145 |
<ul class="ul-disc"> |
5 | 146 |
<?php |
9 | 147 |
foreach ( $theme_info as $theme ) { |
148 |
echo '<li>' . sprintf( |
|
16 | 149 |
/* translators: 1: Theme name, 2: Theme author. */ |
9 | 150 |
_x( '%1$s by %2$s', 'theme' ), |
151 |
'<strong>' . $theme->display( 'Name' ) . '</strong>', |
|
152 |
'<em>' . $theme->display( 'Author' ) . '</em>' |
|
153 |
) . '</li>'; |
|
154 |
} |
|
5 | 155 |
?> |
0 | 156 |
</ul> |
16 | 157 |
<?php if ( 1 === $themes_to_delete ) : ?> |
158 |
<p><?php _e( 'Are you sure you want to delete this theme?' ); ?></p> |
|
5 | 159 |
<?php else : ?> |
16 | 160 |
<p><?php _e( 'Are you sure you want to delete these themes?' ); ?></p> |
5 | 161 |
<?php endif; ?> |
9 | 162 |
<form method="post" action="<?php echo esc_url( $_SERVER['REQUEST_URI'] ); ?>" style="display:inline;"> |
0 | 163 |
<input type="hidden" name="verify-delete" value="1" /> |
164 |
<input type="hidden" name="action" value="delete-selected" /> |
|
165 |
<?php |
|
16 | 166 |
|
9 | 167 |
foreach ( (array) $themes as $theme ) { |
168 |
echo '<input type="hidden" name="checked[]" value="' . esc_attr( $theme ) . '" />'; |
|
169 |
} |
|
5 | 170 |
|
16 | 171 |
wp_nonce_field( 'bulk-themes' ); |
5 | 172 |
|
16 | 173 |
if ( 1 === $themes_to_delete ) { |
9 | 174 |
submit_button( __( 'Yes, delete this theme' ), '', 'submit', false ); |
175 |
} else { |
|
176 |
submit_button( __( 'Yes, delete these themes' ), '', 'submit', false ); |
|
177 |
} |
|
16 | 178 |
|
0 | 179 |
?> |
180 |
</form> |
|
16 | 181 |
<?php $referer = wp_get_referer(); ?> |
5 | 182 |
<form method="post" action="<?php echo $referer ? esc_url( $referer ) : ''; ?>" style="display:inline;"> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
183 |
<?php submit_button( __( 'No, return me to the theme list' ), '', 'submit', false ); ?> |
0 | 184 |
</form> |
16 | 185 |
</div> |
0 | 186 |
<?php |
16 | 187 |
|
188 |
require_once ABSPATH . 'wp-admin/admin-footer.php'; |
|
0 | 189 |
exit; |
16 | 190 |
} // End if verify-delete. |
0 | 191 |
|
192 |
foreach ( $themes as $theme ) { |
|
9 | 193 |
$delete_result = delete_theme( |
194 |
$theme, |
|
195 |
esc_url( |
|
196 |
add_query_arg( |
|
197 |
array( |
|
198 |
'verify-delete' => 1, |
|
199 |
'action' => 'delete-selected', |
|
200 |
'checked' => $_REQUEST['checked'], |
|
201 |
'_wpnonce' => $_REQUEST['_wpnonce'], |
|
202 |
), |
|
203 |
network_admin_url( 'themes.php' ) |
|
204 |
) |
|
205 |
) |
|
206 |
); |
|
0 | 207 |
} |
5 | 208 |
|
0 | 209 |
$paged = ( $_REQUEST['paged'] ) ? $_REQUEST['paged'] : 1; |
9 | 210 |
wp_redirect( |
211 |
add_query_arg( |
|
212 |
array( |
|
213 |
'deleted' => count( $themes ), |
|
214 |
'paged' => $paged, |
|
215 |
's' => $s, |
|
216 |
), |
|
217 |
network_admin_url( 'themes.php' ) |
|
218 |
) |
|
219 |
); |
|
0 | 220 |
exit; |
16 | 221 |
case 'enable-auto-update': |
222 |
case 'disable-auto-update': |
|
223 |
case 'enable-auto-update-selected': |
|
224 |
case 'disable-auto-update-selected': |
|
225 |
if ( ! ( current_user_can( 'update_themes' ) && wp_is_auto_update_enabled_for_type( 'theme' ) ) ) { |
|
226 |
wp_die( __( 'Sorry, you are not allowed to change themes automatic update settings.' ) ); |
|
227 |
} |
|
228 |
||
229 |
if ( 'enable-auto-update' === $action || 'disable-auto-update' === $action ) { |
|
230 |
check_admin_referer( 'updates' ); |
|
231 |
} else { |
|
232 |
if ( empty( $_POST['checked'] ) ) { |
|
233 |
// Nothing to do. |
|
234 |
wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) ); |
|
235 |
exit; |
|
236 |
} |
|
237 |
||
238 |
check_admin_referer( 'bulk-themes' ); |
|
239 |
} |
|
240 |
||
241 |
$auto_updates = (array) get_site_option( 'auto_update_themes', array() ); |
|
242 |
||
243 |
if ( 'enable-auto-update' === $action ) { |
|
244 |
$auto_updates[] = $_GET['theme']; |
|
245 |
$auto_updates = array_unique( $auto_updates ); |
|
246 |
$referer = add_query_arg( 'enabled-auto-update', 1, $referer ); |
|
247 |
} elseif ( 'disable-auto-update' === $action ) { |
|
248 |
$auto_updates = array_diff( $auto_updates, array( $_GET['theme'] ) ); |
|
249 |
$referer = add_query_arg( 'disabled-auto-update', 1, $referer ); |
|
250 |
} else { |
|
251 |
// Bulk enable/disable. |
|
252 |
$themes = (array) wp_unslash( $_POST['checked'] ); |
|
253 |
||
254 |
if ( 'enable-auto-update-selected' === $action ) { |
|
255 |
$auto_updates = array_merge( $auto_updates, $themes ); |
|
256 |
$auto_updates = array_unique( $auto_updates ); |
|
257 |
$referer = add_query_arg( 'enabled-auto-update', count( $themes ), $referer ); |
|
258 |
} else { |
|
259 |
$auto_updates = array_diff( $auto_updates, $themes ); |
|
260 |
$referer = add_query_arg( 'disabled-auto-update', count( $themes ), $referer ); |
|
261 |
} |
|
262 |
} |
|
263 |
||
264 |
$all_items = wp_get_themes(); |
|
265 |
||
266 |
// Remove themes that don't exist or have been deleted since the option was last updated. |
|
267 |
$auto_updates = array_intersect( $auto_updates, array_keys( $all_items ) ); |
|
268 |
||
269 |
update_site_option( 'auto_update_themes', $auto_updates ); |
|
270 |
||
271 |
wp_safe_redirect( $referer ); |
|
272 |
exit; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
273 |
default: |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
274 |
$themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
275 |
if ( empty( $themes ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
276 |
wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
277 |
exit; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
278 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
279 |
check_admin_referer( 'bulk-themes' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
280 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
281 |
/** This action is documented in wp-admin/network/site-themes.php */ |
16 | 282 |
$referer = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $referer, $action, $themes ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
283 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
284 |
wp_safe_redirect( $referer ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
285 |
exit; |
0 | 286 |
} |
287 |
} |
|
288 |
||
289 |
$wp_list_table->prepare_items(); |
|
290 |
||
291 |
add_thickbox(); |
|
292 |
||
5 | 293 |
add_screen_option( 'per_page' ); |
0 | 294 |
|
9 | 295 |
get_current_screen()->add_help_tab( |
296 |
array( |
|
297 |
'id' => 'overview', |
|
298 |
'title' => __( 'Overview' ), |
|
299 |
'content' => |
|
300 |
'<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>' . |
|
301 |
'<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>' . |
|
302 |
'<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>', |
|
303 |
) |
|
304 |
); |
|
0 | 305 |
|
16 | 306 |
$help_sidebar_autoupdates = ''; |
307 |
||
308 |
if ( current_user_can( 'update_themes' ) && wp_is_auto_update_enabled_for_type( 'theme' ) ) { |
|
309 |
get_current_screen()->add_help_tab( |
|
310 |
array( |
|
311 |
'id' => 'plugins-themes-auto-updates', |
|
312 |
'title' => __( 'Auto-updates' ), |
|
313 |
'content' => |
|
314 |
'<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>' . |
|
315 |
'<p>' . __( 'Please note: Third-party themes and plugins, or custom code, may override WordPress scheduling.' ) . '</p>', |
|
316 |
) |
|
317 |
); |
|
318 |
||
319 |
$help_sidebar_autoupdates = '<p>' . __( '<a href="https://wordpress.org/support/article/plugins-themes-auto-updates/">Learn more: Auto-updates documentation</a>' ) . '</p>'; |
|
320 |
} |
|
321 |
||
0 | 322 |
get_current_screen()->set_help_sidebar( |
9 | 323 |
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
324 |
'<p>' . __( '<a href="https://codex.wordpress.org/Network_Admin_Themes_Screen">Documentation on Network Themes</a>' ) . '</p>' . |
|
16 | 325 |
$help_sidebar_autoupdates . |
9 | 326 |
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
0 | 327 |
); |
328 |
||
9 | 329 |
get_current_screen()->set_screen_reader_content( |
330 |
array( |
|
331 |
'heading_views' => __( 'Filter themes list' ), |
|
332 |
'heading_pagination' => __( 'Themes list navigation' ), |
|
333 |
'heading_list' => __( 'Themes list' ), |
|
334 |
) |
|
335 |
); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
336 |
|
19 | 337 |
// Used in the HTML title tag. |
9 | 338 |
$title = __( 'Themes' ); |
0 | 339 |
$parent_file = 'themes.php'; |
340 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
341 |
wp_enqueue_script( 'updates' ); |
5 | 342 |
wp_enqueue_script( 'theme-preview' ); |
0 | 343 |
|
16 | 344 |
require_once ABSPATH . 'wp-admin/admin-header.php'; |
0 | 345 |
|
346 |
?> |
|
347 |
||
348 |
<div class="wrap"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
349 |
<h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
350 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
351 |
<?php if ( current_user_can( 'install_themes' ) ) : ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
352 |
<a href="theme-install.php" class="page-title-action"><?php echo esc_html_x( 'Add New', 'theme' ); ?></a> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
353 |
<?php endif; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
354 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
355 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
356 |
if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) { |
18 | 357 |
echo '<span class="subtitle">'; |
358 |
printf( |
|
359 |
/* translators: %s: Search query. */ |
|
360 |
__( 'Search results for: %s' ), |
|
361 |
'<strong>' . esc_html( $s ) . '</strong>' |
|
362 |
); |
|
363 |
echo '</span>'; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
364 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
365 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
366 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
367 |
<hr class="wp-header-end"> |
0 | 368 |
|
369 |
<?php |
|
370 |
if ( isset( $_GET['enabled'] ) ) { |
|
5 | 371 |
$enabled = absint( $_GET['enabled'] ); |
16 | 372 |
if ( 1 === $enabled ) { |
5 | 373 |
$message = __( 'Theme enabled.' ); |
374 |
} else { |
|
16 | 375 |
/* translators: %s: Number of themes. */ |
5 | 376 |
$message = _n( '%s theme enabled.', '%s themes enabled.', $enabled ); |
377 |
} |
|
378 |
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $enabled ) ) . '</p></div>'; |
|
0 | 379 |
} elseif ( isset( $_GET['disabled'] ) ) { |
5 | 380 |
$disabled = absint( $_GET['disabled'] ); |
16 | 381 |
if ( 1 === $disabled ) { |
5 | 382 |
$message = __( 'Theme disabled.' ); |
383 |
} else { |
|
16 | 384 |
/* translators: %s: Number of themes. */ |
5 | 385 |
$message = _n( '%s theme disabled.', '%s themes disabled.', $disabled ); |
386 |
} |
|
387 |
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $disabled ) ) . '</p></div>'; |
|
0 | 388 |
} elseif ( isset( $_GET['deleted'] ) ) { |
5 | 389 |
$deleted = absint( $_GET['deleted'] ); |
16 | 390 |
if ( 1 === $deleted ) { |
5 | 391 |
$message = __( 'Theme deleted.' ); |
392 |
} else { |
|
16 | 393 |
/* translators: %s: Number of themes. */ |
5 | 394 |
$message = _n( '%s theme deleted.', '%s themes deleted.', $deleted ); |
395 |
} |
|
396 |
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $deleted ) ) . '</p></div>'; |
|
16 | 397 |
} elseif ( isset( $_GET['enabled-auto-update'] ) ) { |
398 |
$enabled = absint( $_GET['enabled-auto-update'] ); |
|
399 |
if ( 1 === $enabled ) { |
|
400 |
$message = __( 'Theme will be auto-updated.' ); |
|
401 |
} else { |
|
402 |
/* translators: %s: Number of themes. */ |
|
403 |
$message = _n( '%s theme will be auto-updated.', '%s themes will be auto-updated.', $enabled ); |
|
404 |
} |
|
405 |
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $enabled ) ) . '</p></div>'; |
|
406 |
} elseif ( isset( $_GET['disabled-auto-update'] ) ) { |
|
407 |
$disabled = absint( $_GET['disabled-auto-update'] ); |
|
408 |
if ( 1 === $disabled ) { |
|
409 |
$message = __( 'Theme will no longer be auto-updated.' ); |
|
410 |
} else { |
|
411 |
/* translators: %s: Number of themes. */ |
|
412 |
$message = _n( '%s theme will no longer be auto-updated.', '%s themes will no longer be auto-updated.', $disabled ); |
|
413 |
} |
|
414 |
echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $disabled ) ) . '</p></div>'; |
|
415 |
} elseif ( isset( $_GET['error'] ) && 'none' === $_GET['error'] ) { |
|
5 | 416 |
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'No theme selected.' ) . '</p></div>'; |
16 | 417 |
} elseif ( isset( $_GET['error'] ) && 'main' === $_GET['error'] ) { |
5 | 418 |
echo '<div class="error notice is-dismissible"><p>' . __( 'You cannot delete a theme while it is active on the main site.' ) . '</p></div>'; |
0 | 419 |
} |
420 |
||
421 |
?> |
|
422 |
||
5 | 423 |
<form method="get"> |
0 | 424 |
<?php $wp_list_table->search_box( __( 'Search Installed Themes' ), 'theme' ); ?> |
425 |
</form> |
|
426 |
||
427 |
<?php |
|
428 |
$wp_list_table->views(); |
|
429 |
||
16 | 430 |
if ( 'broken' === $status ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
431 |
echo '<p class="clear">' . __( 'The following themes are installed but incomplete.' ) . '</p>'; |
9 | 432 |
} |
0 | 433 |
?> |
434 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
435 |
<form id="bulk-action-form" method="post"> |
9 | 436 |
<input type="hidden" name="theme_status" value="<?php echo esc_attr( $status ); ?>" /> |
437 |
<input type="hidden" name="paged" value="<?php echo esc_attr( $page ); ?>" /> |
|
0 | 438 |
|
439 |
<?php $wp_list_table->display(); ?> |
|
440 |
</form> |
|
441 |
||
442 |
</div> |
|
443 |
||
444 |
<?php |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
445 |
wp_print_request_filesystem_credentials_modal(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
446 |
wp_print_admin_notice_templates(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
447 |
wp_print_update_row_templates(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
448 |
|
16 | 449 |
require_once ABSPATH . 'wp-admin/admin-footer.php'; |