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