author | ymh <ymh.work@gmail.com> |
Mon, 14 Oct 2019 18:28:13 +0200 | |
changeset 9 | 177826044cd9 |
parent 7 | cf61fcea0001 |
child 16 | a86126ab1dd4 |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/** |
|
3 |
* Themes administration panel. |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Administration |
|
7 |
*/ |
|
8 |
||
9 |
/** WordPress Administration Bootstrap */ |
|
10 |
require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
12 |
if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
13 |
wp_die( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
14 |
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' . |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
15 |
'<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
16 |
403 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
17 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
18 |
} |
0 | 19 |
|
9 | 20 |
if ( current_user_can( 'switch_themes' ) && isset( $_GET['action'] ) ) { |
0 | 21 |
if ( 'activate' == $_GET['action'] ) { |
9 | 22 |
check_admin_referer( 'switch-theme_' . $_GET['stylesheet'] ); |
0 | 23 |
$theme = wp_get_theme( $_GET['stylesheet'] ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
24 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
25 |
if ( ! $theme->exists() || ! $theme->is_allowed() ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
26 |
wp_die( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
27 |
'<h1>' . __( 'Something went wrong.' ) . '</h1>' . |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
28 |
'<p>' . __( 'The requested theme does not exist.' ) . '</p>', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
29 |
403 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
30 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
31 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
32 |
|
0 | 33 |
switch_theme( $theme->get_stylesheet() ); |
9 | 34 |
wp_redirect( admin_url( 'themes.php?activated=true' ) ); |
35 |
exit; |
|
36 |
} elseif ( 'resume' === $_GET['action'] ) { |
|
37 |
check_admin_referer( 'resume-theme_' . $_GET['stylesheet'] ); |
|
38 |
$theme = wp_get_theme( $_GET['stylesheet'] ); |
|
39 |
||
40 |
if ( ! current_user_can( 'resume_theme', $_GET['stylesheet'] ) ) { |
|
41 |
wp_die( |
|
42 |
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' . |
|
43 |
'<p>' . __( 'Sorry, you are not allowed to resume this theme.' ) . '</p>', |
|
44 |
403 |
|
45 |
); |
|
46 |
} |
|
47 |
||
48 |
$result = resume_theme( $theme->get_stylesheet(), self_admin_url( 'themes.php?error=resuming' ) ); |
|
49 |
||
50 |
if ( is_wp_error( $result ) ) { |
|
51 |
wp_die( $result ); |
|
52 |
} |
|
53 |
||
54 |
wp_redirect( admin_url( 'themes.php?resumed=true' ) ); |
|
0 | 55 |
exit; |
56 |
} elseif ( 'delete' == $_GET['action'] ) { |
|
9 | 57 |
check_admin_referer( 'delete-theme_' . $_GET['stylesheet'] ); |
0 | 58 |
$theme = wp_get_theme( $_GET['stylesheet'] ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
59 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
60 |
if ( ! current_user_can( 'delete_themes' ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
61 |
wp_die( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
62 |
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' . |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
63 |
'<p>' . __( 'Sorry, you are not allowed to delete this item.' ) . '</p>', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
64 |
403 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
65 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
66 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
67 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
68 |
if ( ! $theme->exists() ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
69 |
wp_die( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
70 |
'<h1>' . __( 'Something went wrong.' ) . '</h1>' . |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
71 |
'<p>' . __( 'The requested theme does not exist.' ) . '</p>', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
72 |
403 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
73 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
74 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
75 |
|
5 | 76 |
$active = wp_get_theme(); |
77 |
if ( $active->get( 'Template' ) == $_GET['stylesheet'] ) { |
|
78 |
wp_redirect( admin_url( 'themes.php?delete-active-child=true' ) ); |
|
79 |
} else { |
|
80 |
delete_theme( $_GET['stylesheet'] ); |
|
81 |
wp_redirect( admin_url( 'themes.php?deleted=true' ) ); |
|
82 |
} |
|
0 | 83 |
exit; |
84 |
} |
|
85 |
} |
|
86 |
||
9 | 87 |
$title = __( 'Manage Themes' ); |
0 | 88 |
$parent_file = 'themes.php'; |
89 |
||
5 | 90 |
// Help tab: Overview |
91 |
if ( current_user_can( 'switch_themes' ) ) { |
|
9 | 92 |
$help_overview = '<p>' . __( 'This screen is used for managing your installed themes. Aside from the default theme(s) included with your WordPress installation, themes are designed and developed by third parties.' ) . '</p>' . |
5 | 93 |
'<p>' . __( 'From this screen you can:' ) . '</p>' . |
94 |
'<ul><li>' . __( 'Hover or tap to see Activate and Live Preview buttons' ) . '</li>' . |
|
95 |
'<li>' . __( 'Click on the theme to see the theme name, version, author, description, tags, and the Delete link' ) . '</li>' . |
|
96 |
'<li>' . __( 'Click Customize for the current theme or Live Preview for any other theme to see a live preview' ) . '</li></ul>' . |
|
97 |
'<p>' . __( 'The current theme is displayed highlighted as the first theme.' ) . '</p>' . |
|
98 |
'<p>' . __( 'The search for installed themes will search for terms in their name, description, author, or tag.' ) . ' <span id="live-search-desc">' . __( 'The search results will be updated as you type.' ) . '</span></p>'; |
|
0 | 99 |
|
9 | 100 |
get_current_screen()->add_help_tab( |
101 |
array( |
|
102 |
'id' => 'overview', |
|
103 |
'title' => __( 'Overview' ), |
|
104 |
'content' => $help_overview, |
|
105 |
) |
|
106 |
); |
|
5 | 107 |
} // switch_themes |
0 | 108 |
|
5 | 109 |
// Help tab: Adding Themes |
0 | 110 |
if ( current_user_can( 'install_themes' ) ) { |
111 |
if ( is_multisite() ) { |
|
9 | 112 |
$help_install = '<p>' . __( 'Installing themes on Multisite can only be done from the Network Admin section.' ) . '</p>'; |
0 | 113 |
} else { |
9 | 114 |
$help_install = '<p>' . sprintf( __( 'If you would like to see more themes to choose from, click on the “Add New” button and you will be able to browse or search for additional themes from the <a href="%s">WordPress Theme Directory</a>. Themes in the WordPress Theme Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!' ), __( 'https://wordpress.org/themes/' ) ) . '</p>'; |
0 | 115 |
} |
116 |
||
9 | 117 |
get_current_screen()->add_help_tab( |
118 |
array( |
|
119 |
'id' => 'adding-themes', |
|
120 |
'title' => __( 'Adding Themes' ), |
|
121 |
'content' => $help_install, |
|
122 |
) |
|
123 |
); |
|
5 | 124 |
} // install_themes |
0 | 125 |
|
5 | 126 |
// Help tab: Previewing and Customizing |
127 |
if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { |
|
0 | 128 |
$help_customize = |
9 | 129 |
'<p>' . __( 'Tap or hover on any theme then click the Live Preview button to see a live preview of that theme and change theme options in a separate, full-screen view. You can also find a Live Preview button at the bottom of the theme details screen. Any installed theme can be previewed and customized in this way.' ) . '</p>' . |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
130 |
'<p>' . __( 'The theme being previewed is fully interactive — navigate to different pages to see how the theme handles posts, archives, and other page templates. The settings may differ depending on what theme features the theme being previewed supports. To accept the new settings and activate the theme all in one step, click the Publish & Activate button above the menu.' ) . '</p>' . |
5 | 131 |
'<p>' . __( 'When previewing on smaller monitors, you can use the collapse icon at the bottom of the left-hand pane. This will hide the pane, giving you more room to preview your site in the new theme. To bring the pane back, click on the collapse icon again.' ) . '</p>'; |
0 | 132 |
|
9 | 133 |
get_current_screen()->add_help_tab( |
134 |
array( |
|
135 |
'id' => 'customize-preview-themes', |
|
136 |
'title' => __( 'Previewing and Customizing' ), |
|
137 |
'content' => $help_customize, |
|
138 |
) |
|
139 |
); |
|
5 | 140 |
} // edit_theme_options && customize |
0 | 141 |
|
142 |
get_current_screen()->set_help_sidebar( |
|
5 | 143 |
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
144 |
'<p>' . __( '<a href="https://codex.wordpress.org/Using_Themes">Documentation on Using Themes</a>' ) . '</p>' . |
9 | 145 |
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
0 | 146 |
); |
147 |
||
5 | 148 |
if ( current_user_can( 'switch_themes' ) ) { |
149 |
$themes = wp_prepare_themes_for_js(); |
|
150 |
} else { |
|
151 |
$themes = wp_prepare_themes_for_js( array( wp_get_theme() ) ); |
|
152 |
} |
|
153 |
wp_reset_vars( array( 'theme', 'search' ) ); |
|
154 |
||
9 | 155 |
wp_localize_script( |
156 |
'theme', |
|
157 |
'_wpThemeSettings', |
|
158 |
array( |
|
159 |
'themes' => $themes, |
|
160 |
'settings' => array( |
|
161 |
'canInstall' => ( ! is_multisite() && current_user_can( 'install_themes' ) ), |
|
162 |
'installURI' => ( ! is_multisite() && current_user_can( 'install_themes' ) ) ? admin_url( 'theme-install.php' ) : null, |
|
163 |
'confirmDelete' => __( "Are you sure you want to delete this theme?\n\nClick 'Cancel' to go back, 'OK' to confirm the delete." ), |
|
164 |
'adminUrl' => parse_url( admin_url(), PHP_URL_PATH ), |
|
165 |
), |
|
166 |
'l10n' => array( |
|
167 |
'addNew' => __( 'Add New Theme' ), |
|
168 |
'search' => __( 'Search Installed Themes' ), |
|
169 |
'searchPlaceholder' => __( 'Search installed themes...' ), // placeholder (no ellipsis) |
|
170 |
'themesFound' => __( 'Number of Themes found: %d' ), |
|
171 |
'noThemesFound' => __( 'No themes found. Try a different search.' ), |
|
172 |
), |
|
173 |
) |
|
174 |
); |
|
5 | 175 |
|
176 |
add_thickbox(); |
|
0 | 177 |
wp_enqueue_script( 'theme' ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
178 |
wp_enqueue_script( 'updates' ); |
0 | 179 |
|
180 |
require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
181 |
?> |
|
182 |
||
5 | 183 |
<div class="wrap"> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
184 |
<h1 class="wp-heading-inline"><?php esc_html_e( 'Themes' ); ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
185 |
<span class="title-count theme-count"><?php echo ! empty( $_GET['search'] ) ? __( '…' ) : count( $themes ); ?></span> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
186 |
</h1> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
187 |
|
5 | 188 |
<?php if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
189 |
<a href="<?php echo admin_url( 'theme-install.php' ); ?>" class="hide-if-no-js page-title-action"><?php echo esc_html_x( 'Add New', 'Add new theme' ); ?></a> |
5 | 190 |
<?php endif; ?> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
191 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
192 |
<form class="search-form"></form> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
193 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
194 |
<hr class="wp-header-end"> |
0 | 195 |
<?php |
9 | 196 |
if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) { |
197 |
?> |
|
198 |
<div id="message1" class="updated notice is-dismissible"><p><?php _e( 'The active theme is broken. Reverting to the default theme.' ); ?></p></div> |
|
199 |
<?php |
|
200 |
} elseif ( isset( $_GET['activated'] ) ) { |
|
201 |
if ( isset( $_GET['previewed'] ) ) { |
|
202 |
?> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
203 |
<div id="message2" class="updated notice is-dismissible"><p><?php _e( 'Settings saved and theme activated.' ); ?> <a href="<?php echo home_url( '/' ); ?>"><?php _e( 'Visit site' ); ?></a></p></div> |
9 | 204 |
<?php |
205 |
} else { |
|
206 |
?> |
|
207 |
<div id="message2" class="updated notice is-dismissible"><p><?php _e( 'New theme activated.' ); ?> <a href="<?php echo home_url( '/' ); ?>"><?php _e( 'Visit site' ); ?></a></p></div> |
|
208 |
<?php |
|
209 |
} |
|
210 |
} elseif ( isset( $_GET['deleted'] ) ) { |
|
211 |
?> |
|
212 |
<div id="message3" class="updated notice is-dismissible"><p><?php _e( 'Theme deleted.' ); ?></p></div> |
|
213 |
<?php |
|
214 |
} elseif ( isset( $_GET['delete-active-child'] ) ) { |
|
215 |
?> |
|
5 | 216 |
<div id="message4" class="error"><p><?php _e( 'You cannot delete a theme while it has an active child theme.' ); ?></p></div> |
9 | 217 |
<?php |
218 |
} elseif ( isset( $_GET['resumed'] ) ) { |
|
219 |
?> |
|
220 |
<div id="message5" class="updated notice is-dismissible"><p><?php _e( 'Theme resumed.' ); ?></p></div> |
|
221 |
<?php |
|
222 |
} elseif ( isset( $_GET['error'] ) && 'resuming' === $_GET['error'] ) { |
|
223 |
?> |
|
224 |
<div id="message6" class="error"><p><?php _e( 'Theme could not be resumed because it triggered a <strong>fatal error</strong>.' ); ?></p></div> |
|
225 |
<?php |
|
226 |
} |
|
0 | 227 |
|
228 |
$ct = wp_get_theme(); |
|
229 |
||
230 |
if ( $ct->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
231 |
echo '<div class="error"><p>' . __( 'ERROR:' ) . ' ' . $ct->errors()->get_error_message() . '</p></div>'; |
0 | 232 |
} |
233 |
||
5 | 234 |
/* |
0 | 235 |
// Certain error codes are less fatal than others. We can still display theme information in most cases. |
236 |
if ( ! $ct->errors() || ( 1 == count( $ct->errors()->get_error_codes() ) |
|
237 |
&& in_array( $ct->errors()->get_error_code(), array( 'theme_no_parent', 'theme_parent_invalid', 'theme_no_index' ) ) ) ) : ?> |
|
5 | 238 |
*/ |
0 | 239 |
|
240 |
// Pretend you didn't see this. |
|
5 | 241 |
$current_theme_actions = array(); |
9 | 242 |
if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) { |
243 |
foreach ( (array) $submenu['themes.php'] as $item ) { |
|
244 |
$class = ''; |
|
245 |
if ( 'themes.php' == $item[2] || 'theme-editor.php' == $item[2] || 0 === strpos( $item[2], 'customize.php' ) ) { |
|
246 |
continue; |
|
247 |
} |
|
248 |
// 0 = name, 1 = capability, 2 = file |
|
249 |
if ( ( strcmp( $self, $item[2] ) == 0 && empty( $parent_file ) ) || ( $parent_file && ( $item[2] == $parent_file ) ) ) { |
|
250 |
$class = ' current'; |
|
251 |
} |
|
252 |
if ( ! empty( $submenu[ $item[2] ] ) ) { |
|
253 |
$submenu[ $item[2] ] = array_values( $submenu[ $item[2] ] ); // Re-index. |
|
254 |
$menu_hook = get_plugin_page_hook( $submenu[ $item[2] ][0][2], $item[2] ); |
|
255 |
if ( file_exists( WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}" ) || ! empty( $menu_hook ) ) { |
|
256 |
$current_theme_actions[] = "<a class='button$class' href='admin.php?page={$submenu[$item[2]][0][2]}'>{$item[0]}</a>"; |
|
257 |
} else { |
|
258 |
$current_theme_actions[] = "<a class='button$class' href='{$submenu[$item[2]][0][2]}'>{$item[0]}</a>"; |
|
259 |
} |
|
260 |
} elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) { |
|
261 |
$menu_file = $item[2]; |
|
5 | 262 |
|
9 | 263 |
if ( current_user_can( 'customize' ) ) { |
264 |
if ( 'custom-header' === $menu_file ) { |
|
265 |
$current_theme_actions[] = "<a class='button hide-if-no-customize$class' href='customize.php?autofocus[control]=header_image'>{$item[0]}</a>"; |
|
266 |
} elseif ( 'custom-background' === $menu_file ) { |
|
267 |
$current_theme_actions[] = "<a class='button hide-if-no-customize$class' href='customize.php?autofocus[control]=background_image'>{$item[0]}</a>"; |
|
5 | 268 |
} |
9 | 269 |
} |
5 | 270 |
|
9 | 271 |
if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) { |
272 |
$menu_file = substr( $menu_file, 0, $pos ); |
|
273 |
} |
|
5 | 274 |
|
9 | 275 |
if ( file_exists( ABSPATH . "wp-admin/$menu_file" ) ) { |
276 |
$current_theme_actions[] = "<a class='button$class' href='{$item[2]}'>{$item[0]}</a>"; |
|
277 |
} else { |
|
278 |
$current_theme_actions[] = "<a class='button$class' href='themes.php?page={$item[2]}'>{$item[0]}</a>"; |
|
0 | 279 |
} |
280 |
} |
|
281 |
} |
|
9 | 282 |
} |
0 | 283 |
|
284 |
?> |
|
285 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
286 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
287 |
$class_name = 'theme-browser'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
288 |
if ( ! empty( $_GET['search'] ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
289 |
$class_name .= ' search-loading'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
290 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
291 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
292 |
<div class="<?php echo esc_attr( $class_name ); ?>"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
293 |
<div class="themes wp-clearfix"> |
0 | 294 |
|
5 | 295 |
<?php |
296 |
/* |
|
297 |
* This PHP is synchronized with the tmpl-theme template below! |
|
298 |
*/ |
|
0 | 299 |
|
5 | 300 |
foreach ( $themes as $theme ) : |
301 |
$aria_action = esc_attr( $theme['id'] . '-action' ); |
|
302 |
$aria_name = esc_attr( $theme['id'] . '-name' ); |
|
9 | 303 |
|
304 |
$active_class = ''; |
|
305 |
if ( $theme['active'] ) { |
|
306 |
$active_class = ' active'; |
|
307 |
} |
|
5 | 308 |
?> |
9 | 309 |
<div class="theme<?php echo $active_class; ?>" tabindex="0" aria-describedby="<?php echo $aria_action . ' ' . $aria_name; ?>"> |
5 | 310 |
<?php if ( ! empty( $theme['screenshot'][0] ) ) { ?> |
311 |
<div class="theme-screenshot"> |
|
312 |
<img src="<?php echo $theme['screenshot'][0]; ?>" alt="" /> |
|
313 |
</div> |
|
314 |
<?php } else { ?> |
|
315 |
<div class="theme-screenshot blank"></div> |
|
316 |
<?php } ?> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
317 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
318 |
<?php if ( $theme['hasUpdate'] ) : ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
319 |
<div class="update-message notice inline notice-warning notice-alt"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
320 |
<?php if ( $theme['hasPackage'] ) : ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
321 |
<p><?php _e( 'New version available. <button class="button-link" type="button">Update now</button>' ); ?></p> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
322 |
<?php else : ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
323 |
<p><?php _e( 'New version available.' ); ?></p> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
324 |
<?php endif; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
325 |
</div> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
326 |
<?php endif; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
327 |
|
5 | 328 |
<span class="more-details" id="<?php echo $aria_action; ?>"><?php _e( 'Theme Details' ); ?></span> |
329 |
<div class="theme-author"><?php printf( __( 'By %s' ), $theme['author'] ); ?></div> |
|
0 | 330 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
331 |
<div class="theme-id-container"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
332 |
<?php if ( $theme['active'] ) { ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
333 |
<h2 class="theme-name" id="<?php echo $aria_name; ?>"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
334 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
335 |
/* translators: %s: theme name */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
336 |
printf( __( '<span>Active:</span> %s' ), $theme['name'] ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
337 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
338 |
</h2> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
339 |
<?php } else { ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
340 |
<h2 class="theme-name" id="<?php echo $aria_name; ?>"><?php echo $theme['name']; ?></h2> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
341 |
<?php } ?> |
0 | 342 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
343 |
<div class="theme-actions"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
344 |
<?php if ( $theme['active'] ) { ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
345 |
<?php if ( $theme['actions']['customize'] && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
346 |
<a class="button button-primary customize load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Customize' ); ?></a> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
347 |
<?php } ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
348 |
<?php } else { ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
349 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
350 |
/* translators: %s: Theme name */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
351 |
$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); |
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 |
<a class="button activate" href="<?php echo $theme['actions']['activate']; ?>" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
354 |
<?php if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
355 |
<a class="button button-primary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Live Preview' ); ?></a> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
356 |
<?php } ?> |
5 | 357 |
<?php } ?> |
358 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
359 |
</div> |
0 | 360 |
</div> |
361 |
</div> |
|
5 | 362 |
<?php endforeach; ?> |
363 |
</div> |
|
364 |
</div> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
365 |
<div class="theme-overlay" tabindex="0" role="dialog" aria-label="<?php esc_attr_e( 'Theme Details' ); ?>"></div> |
0 | 366 |
|
5 | 367 |
<p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p> |
0 | 368 |
|
369 |
<?php |
|
370 |
// List broken themes, if any. |
|
9 | 371 |
if ( ! is_multisite() && current_user_can( 'edit_themes' ) && $broken_themes = wp_get_themes( array( 'errors' => true ) ) ) { |
372 |
?> |
|
0 | 373 |
|
5 | 374 |
<div class="broken-themes"> |
9 | 375 |
<h3><?php _e( 'Broken Themes' ); ?></h3> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
376 |
<p><?php _e( 'The following themes are installed but incomplete.' ); ?></p> |
0 | 377 |
|
9 | 378 |
<?php |
379 |
$can_resume = current_user_can( 'resume_themes' ); |
|
380 |
$can_delete = current_user_can( 'delete_themes' ); |
|
381 |
$can_install = current_user_can( 'install_themes' ); |
|
382 |
?> |
|
5 | 383 |
<table> |
0 | 384 |
<tr> |
9 | 385 |
<th><?php _ex( 'Name', 'theme name' ); ?></th> |
386 |
<th><?php _e( 'Description' ); ?></th> |
|
387 |
<?php if ( $can_resume ) { ?> |
|
388 |
<td></td> |
|
389 |
<?php } ?> |
|
5 | 390 |
<?php if ( $can_delete ) { ?> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
391 |
<td></td> |
5 | 392 |
<?php } ?> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
393 |
<?php if ( $can_install ) { ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
394 |
<td></td> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
395 |
<?php } ?> |
0 | 396 |
</tr> |
5 | 397 |
<?php foreach ( $broken_themes as $broken_theme ) : ?> |
0 | 398 |
<tr> |
5 | 399 |
<td><?php echo $broken_theme->get( 'Name' ) ? $broken_theme->display( 'Name' ) : $broken_theme->get_stylesheet(); ?></td> |
400 |
<td><?php echo $broken_theme->errors()->get_error_message(); ?></td> |
|
401 |
<?php |
|
9 | 402 |
if ( $can_resume ) { |
403 |
if ( 'theme_paused' === $broken_theme->errors()->get_error_code() ) { |
|
404 |
$stylesheet = $broken_theme->get_stylesheet(); |
|
405 |
$resume_url = add_query_arg( |
|
406 |
array( |
|
407 |
'action' => 'resume', |
|
408 |
'stylesheet' => urlencode( $stylesheet ), |
|
409 |
), |
|
410 |
admin_url( 'themes.php' ) |
|
411 |
); |
|
412 |
$resume_url = wp_nonce_url( $resume_url, 'resume-theme_' . $stylesheet ); |
|
413 |
?> |
|
414 |
<td><a href="<?php echo esc_url( $resume_url ); ?>" class="button resume-theme"><?php _e( 'Resume' ); ?></a></td> |
|
415 |
<?php |
|
416 |
} else { |
|
417 |
?> |
|
418 |
<td></td> |
|
419 |
<?php |
|
420 |
} |
|
421 |
} |
|
422 |
||
5 | 423 |
if ( $can_delete ) { |
424 |
$stylesheet = $broken_theme->get_stylesheet(); |
|
9 | 425 |
$delete_url = add_query_arg( |
426 |
array( |
|
427 |
'action' => 'delete', |
|
428 |
'stylesheet' => urlencode( $stylesheet ), |
|
429 |
), |
|
430 |
admin_url( 'themes.php' ) |
|
431 |
); |
|
5 | 432 |
$delete_url = wp_nonce_url( $delete_url, 'delete-theme_' . $stylesheet ); |
433 |
?> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
434 |
<td><a href="<?php echo esc_url( $delete_url ); ?>" class="button delete-theme"><?php _e( 'Delete' ); ?></a></td> |
5 | 435 |
<?php |
436 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
437 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
438 |
if ( $can_install && 'theme_no_parent' === $broken_theme->errors()->get_error_code() ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
439 |
$parent_theme_name = $broken_theme->get( 'Template' ); |
9 | 440 |
$parent_theme = themes_api( 'theme_information', array( 'slug' => urlencode( $parent_theme_name ) ) ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
441 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
442 |
if ( ! is_wp_error( $parent_theme ) ) { |
9 | 443 |
$install_url = add_query_arg( |
444 |
array( |
|
445 |
'action' => 'install-theme', |
|
446 |
'theme' => urlencode( $parent_theme_name ), |
|
447 |
), |
|
448 |
admin_url( 'update.php' ) |
|
449 |
); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
450 |
$install_url = wp_nonce_url( $install_url, 'install-theme_' . $parent_theme_name ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
451 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
452 |
<td><a href="<?php echo esc_url( $install_url ); ?>" class="button install-theme"><?php _e( 'Install Parent Theme' ); ?></a></td> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
453 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
454 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
455 |
} |
5 | 456 |
?> |
457 |
</tr> |
|
458 |
<?php endforeach; ?> |
|
0 | 459 |
</table> |
5 | 460 |
</div> |
461 |
||
9 | 462 |
<?php |
0 | 463 |
} |
464 |
?> |
|
5 | 465 |
</div><!-- .wrap --> |
466 |
||
467 |
<?php |
|
468 |
/* |
|
469 |
* The tmpl-theme template is synchronized with PHP above! |
|
470 |
*/ |
|
471 |
?> |
|
472 |
<script id="tmpl-theme" type="text/template"> |
|
473 |
<# if ( data.screenshot[0] ) { #> |
|
474 |
<div class="theme-screenshot"> |
|
475 |
<img src="{{ data.screenshot[0] }}" alt="" /> |
|
476 |
</div> |
|
477 |
<# } else { #> |
|
478 |
<div class="theme-screenshot blank"></div> |
|
479 |
<# } #> |
|
480 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
481 |
<# if ( data.hasUpdate ) { #> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
482 |
<# if ( data.hasPackage ) { #> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
483 |
<div class="update-message notice inline notice-warning notice-alt"><p><?php _e( 'New version available. <button class="button-link" type="button">Update now</button>' ); ?></p></div> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
484 |
<# } else { #> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
485 |
<div class="update-message notice inline notice-warning notice-alt"><p><?php _e( 'New version available.' ); ?></p></div> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
486 |
<# } #> |
5 | 487 |
<# } #> |
488 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
489 |
<span class="more-details" id="{{ data.id }}-action"><?php _e( 'Theme Details' ); ?></span> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
490 |
<div class="theme-author"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
491 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
492 |
/* translators: %s: Theme author name */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
493 |
printf( __( 'By %s' ), '{{{ data.author }}}' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
494 |
?> |
5 | 495 |
</div> |
496 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
497 |
<div class="theme-id-container"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
498 |
<# if ( data.active ) { #> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
499 |
<h2 class="theme-name" id="{{ data.id }}-name"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
500 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
501 |
/* translators: %s: Theme name */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
502 |
printf( __( '<span>Active:</span> %s' ), '{{{ data.name }}}' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
503 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
504 |
</h2> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
505 |
<# } else { #> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
506 |
<h2 class="theme-name" id="{{ data.id }}-name">{{{ data.name }}}</h2> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
507 |
<# } #> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
508 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
509 |
<div class="theme-actions"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
510 |
<# if ( data.active ) { #> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
511 |
<# if ( data.actions.customize ) { #> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
512 |
<a class="button button-primary customize load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Customize' ); ?></a> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
513 |
<# } #> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
514 |
<# } else { #> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
515 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
516 |
/* translators: %s: Theme name */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
517 |
$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
518 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
519 |
<a class="button activate" href="{{{ data.actions.activate }}}" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
520 |
<a class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
521 |
<# } #> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
522 |
</div> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
523 |
</div> |
5 | 524 |
</script> |
0 | 525 |
|
5 | 526 |
<script id="tmpl-theme-single" type="text/template"> |
527 |
<div class="theme-backdrop"></div> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
528 |
<div class="theme-wrap wp-clearfix" role="document"> |
5 | 529 |
<div class="theme-header"> |
530 |
<button class="left dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show previous theme' ); ?></span></button> |
|
531 |
<button class="right dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show next theme' ); ?></span></button> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
532 |
<button class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Close details dialog' ); ?></span></button> |
5 | 533 |
</div> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
534 |
<div class="theme-about wp-clearfix"> |
5 | 535 |
<div class="theme-screenshots"> |
536 |
<# if ( data.screenshot[0] ) { #> |
|
537 |
<div class="screenshot"><img src="{{ data.screenshot[0] }}" alt="" /></div> |
|
538 |
<# } else { #> |
|
539 |
<div class="screenshot blank"></div> |
|
540 |
<# } #> |
|
541 |
</div> |
|
542 |
||
543 |
<div class="theme-info"> |
|
544 |
<# if ( data.active ) { #> |
|
545 |
<span class="current-label"><?php _e( 'Current Theme' ); ?></span> |
|
546 |
<# } #> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
547 |
<h2 class="theme-name">{{{ data.name }}}<span class="theme-version"><?php printf( __( 'Version: %s' ), '{{ data.version }}' ); ?></span></h2> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
548 |
<p class="theme-author"><?php printf( __( 'By %s' ), '{{{ data.authorAndUri }}}' ); ?></p> |
5 | 549 |
|
550 |
<# if ( data.hasUpdate ) { #> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
551 |
<div class="notice notice-warning notice-alt notice-large"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
552 |
<h3 class="notice-title"><?php _e( 'Update Available' ); ?></h3> |
5 | 553 |
{{{ data.update }}} |
554 |
</div> |
|
555 |
<# } #> |
|
556 |
<p class="theme-description">{{{ data.description }}}</p> |
|
557 |
||
558 |
<# if ( data.parent ) { #> |
|
559 |
<p class="parent-theme"><?php printf( __( 'This is a child theme of %s.' ), '<strong>{{{ data.parent }}}</strong>' ); ?></p> |
|
560 |
<# } #> |
|
561 |
||
562 |
<# if ( data.tags ) { #> |
|
563 |
<p class="theme-tags"><span><?php _e( 'Tags:' ); ?></span> {{{ data.tags }}}</p> |
|
564 |
<# } #> |
|
565 |
</div> |
|
566 |
</div> |
|
567 |
||
568 |
<div class="theme-actions"> |
|
569 |
<div class="active-theme"> |
|
570 |
<a href="{{{ data.actions.customize }}}" class="button button-primary customize load-customize hide-if-no-customize"><?php _e( 'Customize' ); ?></a> |
|
571 |
<?php echo implode( ' ', $current_theme_actions ); ?> |
|
572 |
</div> |
|
573 |
<div class="inactive-theme"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
574 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
575 |
/* translators: %s: Theme name */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
576 |
$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
577 |
?> |
5 | 578 |
<# if ( data.actions.activate ) { #> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
579 |
<a href="{{{ data.actions.activate }}}" class="button activate" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a> |
5 | 580 |
<# } #> |
581 |
<a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php _e( 'Live Preview' ); ?></a> |
|
582 |
</div> |
|
583 |
||
584 |
<# if ( ! data.active && data.actions['delete'] ) { #> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
585 |
<a href="{{{ data.actions['delete'] }}}" class="button delete-theme"><?php _e( 'Delete' ); ?></a> |
5 | 586 |
<# } #> |
587 |
</div> |
|
588 |
</div> |
|
589 |
</script> |
|
590 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
591 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
592 |
wp_print_request_filesystem_credentials_modal(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
593 |
wp_print_admin_notice_templates(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
594 |
wp_print_update_row_templates(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
595 |
|
9 | 596 |
wp_localize_script( |
597 |
'updates', |
|
598 |
'_wpUpdatesItemCounts', |
|
599 |
array( |
|
600 |
'totals' => wp_get_update_data(), |
|
601 |
) |
|
602 |
); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
603 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
604 |
require( ABSPATH . 'wp-admin/admin-footer.php' ); |