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 |
* Install theme administration panel. |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Administration |
|
7 |
*/ |
|
8 |
||
9 |
/** WordPress Administration Bootstrap */ |
|
16 | 10 |
require_once __DIR__ . '/admin.php'; |
11 |
require ABSPATH . 'wp-admin/includes/theme-install.php'; |
|
5 | 12 |
|
13 |
wp_reset_vars( array( 'tab' ) ); |
|
0 | 14 |
|
9 | 15 |
if ( ! current_user_can( 'install_themes' ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
16 |
wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) ); |
9 | 17 |
} |
0 | 18 |
|
19 |
if ( is_multisite() && ! is_network_admin() ) { |
|
20 |
wp_redirect( network_admin_url( 'theme-install.php' ) ); |
|
16 | 21 |
exit; |
0 | 22 |
} |
23 |
||
9 | 24 |
$title = __( 'Add Themes' ); |
5 | 25 |
$parent_file = 'themes.php'; |
26 |
||
27 |
if ( ! is_network_admin() ) { |
|
28 |
$submenu_file = 'themes.php'; |
|
29 |
} |
|
30 |
||
31 |
$installed_themes = search_theme_directories(); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
32 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
33 |
if ( false === $installed_themes ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
34 |
$installed_themes = array(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
35 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
36 |
|
5 | 37 |
foreach ( $installed_themes as $k => $v ) { |
38 |
if ( false !== strpos( $k, '/' ) ) { |
|
39 |
unset( $installed_themes[ $k ] ); |
|
40 |
} |
|
41 |
} |
|
0 | 42 |
|
9 | 43 |
wp_localize_script( |
44 |
'theme', |
|
45 |
'_wpThemeSettings', |
|
46 |
array( |
|
47 |
'themes' => false, |
|
48 |
'settings' => array( |
|
49 |
'isInstall' => true, |
|
50 |
'canInstall' => current_user_can( 'install_themes' ), |
|
51 |
'installURI' => current_user_can( 'install_themes' ) ? self_admin_url( 'theme-install.php' ) : null, |
|
52 |
'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ), |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
53 |
), |
9 | 54 |
'l10n' => array( |
55 |
'addNew' => __( 'Add New Theme' ), |
|
56 |
'search' => __( 'Search Themes' ), |
|
16 | 57 |
'searchPlaceholder' => __( 'Search themes...' ), // Placeholder (no ellipsis). |
9 | 58 |
'upload' => __( 'Upload Theme' ), |
59 |
'back' => __( 'Back' ), |
|
60 |
'error' => sprintf( |
|
16 | 61 |
/* translators: %s: Support forums URL. */ |
9 | 62 |
__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ), |
16 | 63 |
__( 'https://wordpress.org/support/forums/' ) |
9 | 64 |
), |
65 |
'tryAgain' => __( 'Try Again' ), |
|
16 | 66 |
/* translators: %d: Number of themes. */ |
9 | 67 |
'themesFound' => __( 'Number of Themes found: %d' ), |
68 |
'noThemesFound' => __( 'No themes found. Try a different search.' ), |
|
69 |
'collapseSidebar' => __( 'Collapse Sidebar' ), |
|
70 |
'expandSidebar' => __( 'Expand Sidebar' ), |
|
16 | 71 |
/* translators: Accessibility text. */ |
9 | 72 |
'selectFeatureFilter' => __( 'Select one or more Theme features to filter by' ), |
73 |
), |
|
74 |
'installedThemes' => array_keys( $installed_themes ), |
|
16 | 75 |
'activeTheme' => get_stylesheet(), |
9 | 76 |
) |
77 |
); |
|
0 | 78 |
|
79 |
wp_enqueue_script( 'theme' ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
80 |
wp_enqueue_script( 'updates' ); |
0 | 81 |
|
5 | 82 |
if ( $tab ) { |
83 |
/** |
|
84 |
* Fires before each of the tabs are rendered on the Install Themes page. |
|
85 |
* |
|
86 |
* The dynamic portion of the hook name, `$tab`, refers to the current |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
87 |
* theme installation tab. Possible values are 'dashboard', 'search', 'upload', |
5 | 88 |
* 'featured', 'new', or 'updated'. |
89 |
* |
|
90 |
* @since 2.8.0 |
|
91 |
*/ |
|
92 |
do_action( "install_themes_pre_{$tab}" ); |
|
93 |
} |
|
0 | 94 |
|
95 |
$help_overview = |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
96 |
'<p>' . sprintf( |
16 | 97 |
/* translators: %s: Theme Directory URL. */ |
98 |
__( 'You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the <a href="%s">WordPress Theme Directory</a>. These themes are designed and developed by third parties, are available free of charge, and are compatible with the license WordPress uses.' ), |
|
9 | 99 |
__( 'https://wordpress.org/themes/' ) |
100 |
) . '</p>' . |
|
5 | 101 |
'<p>' . __( 'You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter.' ) . ' <span id="live-search-desc">' . __( 'The search results will be updated as you type.' ) . '</span></p>' . |
102 |
'<p>' . __( 'Alternately, you can browse the themes that are Featured, Popular, or Latest. When you find a theme you like, you can preview it or install it.' ) . '</p>' . |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
103 |
'<p>' . sprintf( |
9 | 104 |
/* translators: %s: /wp-content/themes */ |
16 | 105 |
__( 'You can Upload a theme manually if you have already downloaded its ZIP archive onto your computer (make sure it is from a trusted and original source). You can also do it the old-fashioned way and copy a downloaded theme’s folder via FTP into your %s directory.' ), |
9 | 106 |
'<code>/wp-content/themes</code>' |
107 |
) . '</p>'; |
|
0 | 108 |
|
9 | 109 |
get_current_screen()->add_help_tab( |
110 |
array( |
|
111 |
'id' => 'overview', |
|
112 |
'title' => __( 'Overview' ), |
|
113 |
'content' => $help_overview, |
|
114 |
) |
|
115 |
); |
|
0 | 116 |
|
117 |
$help_installing = |
|
9 | 118 |
'<p>' . __( 'Once you have generated a list of themes, you can preview and install any of them. Click on the thumbnail of the theme you’re interested in previewing. It will open up in a full-screen Preview page to give you a better idea of how that theme will look.' ) . '</p>' . |
119 |
'<p>' . __( 'To install the theme so you can preview it with your site’s content and customize its theme options, click the "Install" button at the top of the left-hand pane. The theme files will be downloaded to your website automatically. When this is complete, the theme is now available for activation, which you can do by clicking the "Activate" link, or by navigating to your Manage Themes screen and clicking the "Live Preview" link under any installed theme’s thumbnail image.' ) . '</p>'; |
|
0 | 120 |
|
9 | 121 |
get_current_screen()->add_help_tab( |
122 |
array( |
|
123 |
'id' => 'installing', |
|
124 |
'title' => __( 'Previewing and Installing' ), |
|
125 |
'content' => $help_installing, |
|
126 |
) |
|
127 |
); |
|
0 | 128 |
|
129 |
get_current_screen()->set_help_sidebar( |
|
9 | 130 |
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
16 | 131 |
'<p>' . __( '<a href="https://wordpress.org/support/article/using-themes/#adding-new-themes">Documentation on Adding New Themes</a>' ) . '</p>' . |
9 | 132 |
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
0 | 133 |
); |
134 |
||
16 | 135 |
require_once ABSPATH . 'wp-admin/admin-header.php'; |
5 | 136 |
|
0 | 137 |
?> |
138 |
<div class="wrap"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
139 |
<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
|
140 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
141 |
<?php |
5 | 142 |
|
143 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
144 |
* Filters the tabs shown on the Add Themes screen. |
5 | 145 |
* |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
146 |
* This filter is for backward compatibility only, for the suppression of the upload tab. |
5 | 147 |
* |
148 |
* @since 2.8.0 |
|
149 |
* |
|
9 | 150 |
* @param string[] $tabs Associative array of the tabs shown on the Add Themes screen. Default is 'upload'. |
5 | 151 |
*/ |
152 |
$tabs = apply_filters( 'install_themes_tabs', array( 'upload' => __( 'Upload Theme' ) ) ); |
|
153 |
if ( ! empty( $tabs['upload'] ) && current_user_can( 'upload_themes' ) ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
154 |
echo ' <button type="button" class="upload-view-toggle page-title-action hide-if-no-js" aria-expanded="false">' . __( 'Upload Theme' ) . '</button>'; |
5 | 155 |
} |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
156 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
157 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
158 |
<hr class="wp-header-end"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
159 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
160 |
<div class="error hide-if-js"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
161 |
<p><?php _e( 'The Theme Installer screen requires JavaScript.' ); ?></p> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
162 |
</div> |
5 | 163 |
|
164 |
<div class="upload-theme"> |
|
165 |
<?php install_themes_upload(); ?> |
|
166 |
</div> |
|
167 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
168 |
<h2 class="screen-reader-text hide-if-no-js"><?php _e( 'Filter themes list' ); ?></h2> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
169 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
170 |
<div class="wp-filter hide-if-no-js"> |
5 | 171 |
<div class="filter-count"> |
172 |
<span class="count theme-count"></span> |
|
173 |
</div> |
|
174 |
||
175 |
<ul class="filter-links"> |
|
176 |
<li><a href="#" data-sort="featured"><?php _ex( 'Featured', 'themes' ); ?></a></li> |
|
177 |
<li><a href="#" data-sort="popular"><?php _ex( 'Popular', 'themes' ); ?></a></li> |
|
178 |
<li><a href="#" data-sort="new"><?php _ex( 'Latest', 'themes' ); ?></a></li> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
179 |
<li><a href="#" data-sort="favorites"><?php _ex( 'Favorites', 'themes' ); ?></a></li> |
5 | 180 |
</ul> |
181 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
182 |
<button type="button" class="button drawer-toggle" aria-expanded="false"><?php _e( 'Feature Filter' ); ?></button> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
183 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
184 |
<form class="search-form"></form> |
5 | 185 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
186 |
<div class="favorites-form"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
187 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
188 |
$action = 'save_wporg_username_' . get_current_user_id(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
189 |
if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_GET['_wpnonce'] ), $action ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
190 |
$user = isset( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
191 |
update_user_meta( get_current_user_id(), 'wporg_favorites', $user ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
192 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
193 |
$user = get_user_option( 'wporg_favorites' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
194 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
195 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
196 |
<p class="install-help"><?php _e( 'If you have marked themes as favorites on WordPress.org, you can browse them here.' ); ?></p> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
197 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
198 |
<p> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
199 |
<label for="wporg-username-input"><?php _e( 'Your WordPress.org username:' ); ?></label> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
200 |
<input type="hidden" id="wporg-username-nonce" name="_wpnonce" value="<?php echo esc_attr( wp_create_nonce( $action ) ); ?>" /> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
201 |
<input type="search" id="wporg-username-input" value="<?php echo esc_attr( $user ); ?>" /> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
202 |
<input type="button" class="button favorites-form-submit" value="<?php esc_attr_e( 'Get Favorites' ); ?>" /> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
203 |
</p> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
204 |
</div> |
5 | 205 |
|
206 |
<div class="filter-drawer"> |
|
207 |
<div class="buttons"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
208 |
<button type="button" class="apply-filters button"><?php _e( 'Apply Filters' ); ?><span></span></button> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
209 |
<button type="button" class="clear-filters button" aria-label="<?php esc_attr_e( 'Clear current filters' ); ?>"><?php _e( 'Clear' ); ?></button> |
5 | 210 |
</div> |
211 |
<?php |
|
16 | 212 |
// Use the core list, rather than the .org API, due to inconsistencies |
213 |
// and to ensure tags are translated. |
|
214 |
$feature_list = get_theme_feature_list( false ); |
|
215 |
||
5 | 216 |
foreach ( $feature_list as $feature_name => $features ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
217 |
echo '<fieldset class="filter-group">'; |
5 | 218 |
$feature_name = esc_html( $feature_name ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
219 |
echo '<legend>' . $feature_name . '</legend>'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
220 |
echo '<div class="filter-group-feature">'; |
5 | 221 |
foreach ( $features as $feature => $feature_name ) { |
222 |
$feature = esc_attr( $feature ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
223 |
echo '<input type="checkbox" id="filter-id-' . $feature . '" value="' . $feature . '" /> '; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
224 |
echo '<label for="filter-id-' . $feature . '">' . $feature_name . '</label>'; |
5 | 225 |
} |
226 |
echo '</div>'; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
227 |
echo '</fieldset>'; |
5 | 228 |
} |
229 |
?> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
230 |
<div class="buttons"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
231 |
<button type="button" class="apply-filters button"><?php _e( 'Apply Filters' ); ?><span></span></button> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
232 |
<button type="button" class="clear-filters button" aria-label="<?php esc_attr_e( 'Clear current filters' ); ?>"><?php _e( 'Clear' ); ?></button> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
233 |
</div> |
5 | 234 |
<div class="filtered-by"> |
235 |
<span><?php _e( 'Filtering by:' ); ?></span> |
|
236 |
<div class="tags"></div> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
237 |
<button type="button" class="button-link edit-filters"><?php _e( 'Edit Filters' ); ?></button> |
5 | 238 |
</div> |
239 |
</div> |
|
240 |
</div> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
241 |
<h2 class="screen-reader-text hide-if-no-js"><?php _e( 'Themes list' ); ?></h2> |
5 | 242 |
<div class="theme-browser content-filterable"></div> |
243 |
<div class="theme-install-overlay wp-full-overlay expanded"></div> |
|
244 |
||
245 |
<p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p> |
|
246 |
<span class="spinner"></span> |
|
0 | 247 |
|
5 | 248 |
<?php |
249 |
if ( $tab ) { |
|
250 |
/** |
|
251 |
* Fires at the top of each of the tabs on the Install Themes page. |
|
252 |
* |
|
253 |
* The dynamic portion of the hook name, `$tab`, refers to the current |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
254 |
* theme installation tab. Possible values are 'dashboard', 'search', 'upload', |
5 | 255 |
* 'featured', 'new', or 'updated'. |
256 |
* |
|
257 |
* @since 2.8.0 |
|
258 |
* |
|
259 |
* @param int $paged Number of the current page of results being viewed. |
|
260 |
*/ |
|
261 |
do_action( "install_themes_{$tab}", $paged ); |
|
262 |
} |
|
263 |
?> |
|
264 |
</div> |
|
265 |
||
266 |
<script id="tmpl-theme" type="text/template"> |
|
267 |
<# if ( data.screenshot_url ) { #> |
|
268 |
<div class="theme-screenshot"> |
|
269 |
<img src="{{ data.screenshot_url }}" alt="" /> |
|
270 |
</div> |
|
271 |
<# } else { #> |
|
272 |
<div class="theme-screenshot blank"></div> |
|
273 |
<# } #> |
|
16 | 274 |
|
275 |
<# if ( data.installed ) { #> |
|
276 |
<div class="notice notice-success notice-alt"><p><?php _ex( 'Installed', 'theme' ); ?></p></div> |
|
277 |
<# } #> |
|
278 |
||
279 |
<# if ( ! data.compatible_wp || ! data.compatible_php ) { #> |
|
280 |
<div class="notice notice-error notice-alt"><p> |
|
281 |
<# if ( ! data.compatible_wp && ! data.compatible_php ) { #> |
|
282 |
<?php |
|
283 |
_e( 'This theme doesn’t work with your versions of WordPress and PHP.' ); |
|
284 |
if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { |
|
285 |
printf( |
|
286 |
/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ |
|
287 |
' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), |
|
288 |
self_admin_url( 'update-core.php' ), |
|
289 |
esc_url( wp_get_update_php_url() ) |
|
290 |
); |
|
291 |
wp_update_php_annotation( '</p><p><em>', '</em>' ); |
|
292 |
} elseif ( current_user_can( 'update_core' ) ) { |
|
293 |
printf( |
|
294 |
/* translators: %s: URL to WordPress Updates screen. */ |
|
295 |
' ' . __( '<a href="%s">Please update WordPress</a>.' ), |
|
296 |
self_admin_url( 'update-core.php' ) |
|
297 |
); |
|
298 |
} elseif ( current_user_can( 'update_php' ) ) { |
|
299 |
printf( |
|
300 |
/* translators: %s: URL to Update PHP page. */ |
|
301 |
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), |
|
302 |
esc_url( wp_get_update_php_url() ) |
|
303 |
); |
|
304 |
wp_update_php_annotation( '</p><p><em>', '</em>' ); |
|
305 |
} |
|
306 |
?> |
|
307 |
<# } else if ( ! data.compatible_wp ) { #> |
|
308 |
<?php |
|
309 |
_e( 'This theme doesn’t work with your version of WordPress.' ); |
|
310 |
if ( current_user_can( 'update_core' ) ) { |
|
311 |
printf( |
|
312 |
/* translators: %s: URL to WordPress Updates screen. */ |
|
313 |
' ' . __( '<a href="%s">Please update WordPress</a>.' ), |
|
314 |
self_admin_url( 'update-core.php' ) |
|
315 |
); |
|
316 |
} |
|
317 |
?> |
|
318 |
<# } else if ( ! data.compatible_php ) { #> |
|
319 |
<?php |
|
320 |
_e( 'This theme doesn’t work with your version of PHP.' ); |
|
321 |
if ( current_user_can( 'update_php' ) ) { |
|
322 |
printf( |
|
323 |
/* translators: %s: URL to Update PHP page. */ |
|
324 |
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), |
|
325 |
esc_url( wp_get_update_php_url() ) |
|
326 |
); |
|
327 |
wp_update_php_annotation( '</p><p><em>', '</em>' ); |
|
328 |
} |
|
329 |
?> |
|
330 |
<# } #> |
|
331 |
</p></div> |
|
332 |
<# } #> |
|
333 |
||
5 | 334 |
<span class="more-details"><?php _ex( 'Details & Preview', 'theme' ); ?></span> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
335 |
<div class="theme-author"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
336 |
<?php |
16 | 337 |
/* translators: %s: Theme author name. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
338 |
printf( __( 'By %s' ), '{{ data.author }}' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
339 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
340 |
</div> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
341 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
342 |
<div class="theme-id-container"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
343 |
<h3 class="theme-name">{{ data.name }}</h3> |
5 | 344 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
345 |
<div class="theme-actions"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
346 |
<# if ( data.installed ) { #> |
16 | 347 |
<# if ( data.compatible_wp && data.compatible_php ) { #> |
348 |
<?php |
|
349 |
/* translators: %s: Theme name. */ |
|
350 |
$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); |
|
351 |
?> |
|
352 |
<# if ( data.activate_url ) { #> |
|
353 |
<# if ( ! data.active ) { #> |
|
354 |
<a class="button button-primary activate" href="{{ data.activate_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a> |
|
355 |
<# } else { #> |
|
356 |
<button class="button button-primary disabled"><?php _ex( 'Activated', 'theme' ); ?></button> |
|
357 |
<# } #> |
|
358 |
<# } #> |
|
359 |
<# if ( data.customize_url ) { #> |
|
360 |
<# if ( ! data.active ) { #> |
|
361 |
<a class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Live Preview' ); ?></a> |
|
362 |
<# } else { #> |
|
363 |
<a class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Customize' ); ?></a> |
|
364 |
<# } #> |
|
365 |
<# } else { #> |
|
366 |
<button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button> |
|
367 |
<# } #> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
368 |
<# } else { #> |
16 | 369 |
<?php |
370 |
/* translators: %s: Theme name. */ |
|
371 |
$aria_label = sprintf( _x( 'Cannot Activate %s', 'theme' ), '{{ data.name }}' ); |
|
372 |
?> |
|
373 |
<# if ( data.activate_url ) { #> |
|
374 |
<a class="button button-primary disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _ex( 'Cannot Activate', 'theme' ); ?></a> |
|
375 |
<# } #> |
|
376 |
<# if ( data.customize_url ) { #> |
|
377 |
<a class="button disabled"><?php _e( 'Live Preview' ); ?></a> |
|
378 |
<# } else { #> |
|
379 |
<button class="button disabled"><?php _e( 'Preview' ); ?></button> |
|
380 |
<# } #> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
381 |
<# } #> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
382 |
<# } else { #> |
16 | 383 |
<# if ( data.compatible_wp && data.compatible_php ) { #> |
384 |
<?php |
|
385 |
/* translators: %s: Theme name. */ |
|
386 |
$aria_label = sprintf( _x( 'Install %s', 'theme' ), '{{ data.name }}' ); |
|
387 |
?> |
|
388 |
<a class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}" href="{{ data.install_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Install' ); ?></a> |
|
389 |
<button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button> |
|
390 |
<# } else { #> |
|
391 |
<?php |
|
392 |
/* translators: %s: Theme name. */ |
|
393 |
$aria_label = sprintf( _x( 'Cannot Install %s', 'theme' ), '{{ data.name }}' ); |
|
394 |
?> |
|
395 |
<a class="button button-primary disabled" data-name="{{ data.name }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _ex( 'Cannot Install', 'theme' ); ?></a> |
|
396 |
<button class="button disabled"><?php _e( 'Preview' ); ?></button> |
|
397 |
<# } #> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
398 |
<# } #> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
399 |
</div> |
5 | 400 |
</div> |
401 |
</script> |
|
402 |
||
403 |
<script id="tmpl-theme-preview" type="text/template"> |
|
404 |
<div class="wp-full-overlay-sidebar"> |
|
405 |
<div class="wp-full-overlay-header"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
406 |
<button class="close-full-overlay"><span class="screen-reader-text"><?php _e( 'Close' ); ?></span></button> |
9 | 407 |
<button class="previous-theme"><span class="screen-reader-text"><?php _e( 'Previous theme' ); ?></span></button> |
408 |
<button class="next-theme"><span class="screen-reader-text"><?php _e( 'Next theme' ); ?></span></button> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
409 |
<# if ( data.installed ) { #> |
16 | 410 |
<# if ( data.compatible_wp && data.compatible_php ) { #> |
411 |
<?php |
|
412 |
/* translators: %s: Theme name. */ |
|
413 |
$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); |
|
414 |
?> |
|
415 |
<# if ( ! data.active ) { #> |
|
416 |
<a class="button button-primary activate" href="{{ data.activate_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a> |
|
417 |
<# } else { #> |
|
418 |
<button class="button button-primary disabled"><?php _ex( 'Activated', 'theme' ); ?></button> |
|
419 |
<# } #> |
|
420 |
<# } else { #> |
|
421 |
<a class="button button-primary disabled" ><?php _ex( 'Cannot Activate', 'theme' ); ?></a> |
|
422 |
<# } #> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
423 |
<# } else { #> |
16 | 424 |
<# if ( data.compatible_wp && data.compatible_php ) { #> |
425 |
<a href="{{ data.install_url }}" class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></a> |
|
426 |
<# } else { #> |
|
427 |
<a class="button button-primary disabled" ><?php _ex( 'Cannot Install', 'theme' ); ?></a> |
|
428 |
<# } #> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
429 |
<# } #> |
5 | 430 |
</div> |
431 |
<div class="wp-full-overlay-sidebar-content"> |
|
432 |
<div class="install-theme-info"> |
|
433 |
<h3 class="theme-name">{{ data.name }}</h3> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
434 |
<span class="theme-by"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
435 |
<?php |
16 | 436 |
/* translators: %s: Theme author name. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
437 |
printf( __( 'By %s' ), '{{ data.author }}' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
438 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
439 |
</span> |
5 | 440 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
441 |
<img class="theme-screenshot" src="{{ data.screenshot_url }}" alt="" /> |
5 | 442 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
443 |
<div class="theme-details"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
444 |
<# if ( data.rating ) { #> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
445 |
<div class="theme-rating"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
446 |
{{{ data.stars }}} |
9 | 447 |
<a class="num-ratings" href="{{ data.reviews_url }}"> |
448 |
<?php |
|
16 | 449 |
/* translators: %s: Number of ratings. */ |
450 |
printf( __( '(%s ratings)' ), '{{ data.num_ratings }}' ); |
|
9 | 451 |
?> |
452 |
</a> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
453 |
</div> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
454 |
<# } else { #> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
455 |
<span class="no-rating"><?php _e( 'This theme has not been rated yet.' ); ?></span> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
456 |
<# } #> |
16 | 457 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
458 |
<div class="theme-version"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
459 |
<?php |
16 | 460 |
/* translators: %s: Theme version. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
461 |
printf( __( 'Version: %s' ), '{{ data.version }}' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
462 |
?> |
5 | 463 |
</div> |
16 | 464 |
|
465 |
<# if ( ! data.compatible_wp || ! data.compatible_php ) { #> |
|
466 |
<div class="notice notice-error notice-alt notice-large"><p> |
|
467 |
<# if ( ! data.compatible_wp && ! data.compatible_php ) { #> |
|
468 |
<?php |
|
469 |
_e( 'This theme doesn’t work with your versions of WordPress and PHP.' ); |
|
470 |
if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { |
|
471 |
printf( |
|
472 |
/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ |
|
473 |
' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), |
|
474 |
self_admin_url( 'update-core.php' ), |
|
475 |
esc_url( wp_get_update_php_url() ) |
|
476 |
); |
|
477 |
wp_update_php_annotation( '</p><p><em>', '</em>' ); |
|
478 |
} elseif ( current_user_can( 'update_core' ) ) { |
|
479 |
printf( |
|
480 |
/* translators: %s: URL to WordPress Updates screen. */ |
|
481 |
' ' . __( '<a href="%s">Please update WordPress</a>.' ), |
|
482 |
self_admin_url( 'update-core.php' ) |
|
483 |
); |
|
484 |
} elseif ( current_user_can( 'update_php' ) ) { |
|
485 |
printf( |
|
486 |
/* translators: %s: URL to Update PHP page. */ |
|
487 |
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), |
|
488 |
esc_url( wp_get_update_php_url() ) |
|
489 |
); |
|
490 |
wp_update_php_annotation( '</p><p><em>', '</em>' ); |
|
491 |
} |
|
492 |
?> |
|
493 |
<# } else if ( ! data.compatible_wp ) { #> |
|
494 |
<?php |
|
495 |
_e( 'This theme doesn’t work with your version of WordPress.' ); |
|
496 |
if ( current_user_can( 'update_core' ) ) { |
|
497 |
printf( |
|
498 |
/* translators: %s: URL to WordPress Updates screen. */ |
|
499 |
' ' . __( '<a href="%s">Please update WordPress</a>.' ), |
|
500 |
self_admin_url( 'update-core.php' ) |
|
501 |
); |
|
502 |
} |
|
503 |
?> |
|
504 |
<# } else if ( ! data.compatible_php ) { #> |
|
505 |
<?php |
|
506 |
_e( 'This theme doesn’t work with your version of PHP.' ); |
|
507 |
if ( current_user_can( 'update_php' ) ) { |
|
508 |
printf( |
|
509 |
/* translators: %s: URL to Update PHP page. */ |
|
510 |
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), |
|
511 |
esc_url( wp_get_update_php_url() ) |
|
512 |
); |
|
513 |
wp_update_php_annotation( '</p><p><em>', '</em>' ); |
|
514 |
} |
|
515 |
?> |
|
516 |
<# } #> |
|
517 |
</p></div> |
|
518 |
<# } #> |
|
519 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
520 |
<div class="theme-description">{{{ data.description }}}</div> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
521 |
</div> |
5 | 522 |
</div> |
523 |
</div> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
524 |
<div class="wp-full-overlay-footer"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
525 |
<button type="button" class="collapse-sidebar button" aria-expanded="true" aria-label="<?php esc_attr_e( 'Collapse Sidebar' ); ?>"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
526 |
<span class="collapse-sidebar-arrow"></span> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
527 |
<span class="collapse-sidebar-label"><?php _e( 'Collapse' ); ?></span> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
528 |
</button> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
529 |
</div> |
5 | 530 |
</div> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
531 |
<div class="wp-full-overlay-main"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
532 |
<iframe src="{{ data.preview_url }}" title="<?php esc_attr_e( 'Preview' ); ?>"></iframe> |
5 | 533 |
</div> |
534 |
</script> |
|
0 | 535 |
|
536 |
<?php |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
537 |
wp_print_request_filesystem_credentials_modal(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
538 |
wp_print_admin_notice_templates(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
539 |
|
16 | 540 |
require_once ABSPATH . 'wp-admin/admin-footer.php'; |