8 |
8 |
9 /** WordPress Administration Bootstrap */ |
9 /** WordPress Administration Bootstrap */ |
10 require_once __DIR__ . '/admin.php'; |
10 require_once __DIR__ . '/admin.php'; |
11 require ABSPATH . 'wp-admin/includes/theme-install.php'; |
11 require ABSPATH . 'wp-admin/includes/theme-install.php'; |
12 |
12 |
13 wp_reset_vars( array( 'tab' ) ); |
13 $tab = ! empty( $_REQUEST['tab'] ) ? sanitize_text_field( $_REQUEST['tab'] ) : ''; |
14 |
14 |
15 if ( ! current_user_can( 'install_themes' ) ) { |
15 if ( ! current_user_can( 'install_themes' ) ) { |
16 wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) ); |
16 wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) ); |
17 } |
17 } |
18 |
18 |
54 'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ), |
54 'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ), |
55 ), |
55 ), |
56 'l10n' => array( |
56 'l10n' => array( |
57 'addNew' => __( 'Add New Theme' ), |
57 'addNew' => __( 'Add New Theme' ), |
58 'search' => __( 'Search Themes' ), |
58 'search' => __( 'Search Themes' ), |
59 'searchPlaceholder' => __( 'Search themes...' ), // Placeholder (no ellipsis). |
|
60 'upload' => __( 'Upload Theme' ), |
59 'upload' => __( 'Upload Theme' ), |
61 'back' => __( 'Back' ), |
60 'back' => __( 'Back' ), |
62 'error' => sprintf( |
61 'error' => sprintf( |
63 /* translators: %s: Support forums URL. */ |
62 /* translators: %s: Support forums URL. */ |
64 __( '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>.' ), |
63 __( '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>.' ), |
68 /* translators: %d: Number of themes. */ |
67 /* translators: %d: Number of themes. */ |
69 'themesFound' => __( 'Number of Themes found: %d' ), |
68 'themesFound' => __( 'Number of Themes found: %d' ), |
70 'noThemesFound' => __( 'No themes found. Try a different search.' ), |
69 'noThemesFound' => __( 'No themes found. Try a different search.' ), |
71 'collapseSidebar' => __( 'Collapse Sidebar' ), |
70 'collapseSidebar' => __( 'Collapse Sidebar' ), |
72 'expandSidebar' => __( 'Expand Sidebar' ), |
71 'expandSidebar' => __( 'Expand Sidebar' ), |
73 /* translators: Accessibility text. */ |
72 /* translators: Hidden accessibility text. */ |
74 'selectFeatureFilter' => __( 'Select one or more Theme features to filter by' ), |
73 'selectFeatureFilter' => __( 'Select one or more Theme features to filter by' ), |
75 ), |
74 ), |
76 'installedThemes' => array_keys( $installed_themes ), |
75 'installedThemes' => array_keys( $installed_themes ), |
77 'activeTheme' => get_stylesheet(), |
76 'activeTheme' => get_stylesheet(), |
78 ) |
77 ) |
88 * The dynamic portion of the hook name, `$tab`, refers to the current |
87 * The dynamic portion of the hook name, `$tab`, refers to the current |
89 * theme installation tab. |
88 * theme installation tab. |
90 * |
89 * |
91 * Possible hook names include: |
90 * Possible hook names include: |
92 * |
91 * |
|
92 * - `install_themes_pre_block-themes` |
93 * - `install_themes_pre_dashboard` |
93 * - `install_themes_pre_dashboard` |
94 * - `install_themes_pre_featured` |
94 * - `install_themes_pre_featured` |
95 * - `install_themes_pre_new` |
95 * - `install_themes_pre_new` |
96 * - `install_themes_pre_search` |
96 * - `install_themes_pre_search` |
97 * - `install_themes_pre_updated` |
97 * - `install_themes_pre_updated` |
98 * - `install_themes_pre_upload` |
98 * - `install_themes_pre_upload` |
99 * |
99 * |
100 * @since 2.8.0 |
100 * @since 2.8.0 |
|
101 * @since 6.1.0 Added the `install_themes_pre_block-themes` hook name. |
101 */ |
102 */ |
102 do_action( "install_themes_pre_{$tab}" ); |
103 do_action( "install_themes_pre_{$tab}" ); |
103 } |
104 } |
104 |
105 |
105 $help_overview = |
106 $help_overview = |
134 'title' => __( 'Previewing and Installing' ), |
135 'title' => __( 'Previewing and Installing' ), |
135 'content' => $help_installing, |
136 'content' => $help_installing, |
136 ) |
137 ) |
137 ); |
138 ); |
138 |
139 |
|
140 // Help tab: Block themes. |
|
141 $help_block_themes = |
|
142 '<p>' . __( 'A block theme is a theme that uses blocks for all parts of a site including navigation menus, header, content, and site footer. These themes are built for the features that allow you to edit and customize all parts of your site.' ) . '</p>' . |
|
143 '<p>' . __( 'With a block theme, you can place and edit blocks without affecting your content by customizing or creating new templates.' ) . '</p>'; |
|
144 |
|
145 get_current_screen()->add_help_tab( |
|
146 array( |
|
147 'id' => 'block_themes', |
|
148 'title' => __( 'Block themes' ), |
|
149 'content' => $help_block_themes, |
|
150 ) |
|
151 ); |
|
152 |
139 get_current_screen()->set_help_sidebar( |
153 get_current_screen()->set_help_sidebar( |
140 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
154 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
141 '<p>' . __( '<a href="https://wordpress.org/support/article/appearance-themes-screen/#install-themes">Documentation on Adding New Themes</a>' ) . '</p>' . |
155 '<p>' . __( '<a href="https://wordpress.org/documentation/article/appearance-themes-screen/#install-themes">Documentation on Adding New Themes</a>' ) . '</p>' . |
142 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
156 '<p>' . __( '<a href="https://wordpress.org/documentation/article/block-themes/">Documentation on Block Themes</a>' ) . '</p>' . |
|
157 '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>' |
143 ); |
158 ); |
144 |
159 |
145 require_once ABSPATH . 'wp-admin/admin-header.php'; |
160 require_once ABSPATH . 'wp-admin/admin-header.php'; |
146 |
161 |
147 ?> |
162 ?> |
165 } |
180 } |
166 ?> |
181 ?> |
167 |
182 |
168 <hr class="wp-header-end"> |
183 <hr class="wp-header-end"> |
169 |
184 |
170 <div class="error hide-if-js"> |
185 <?php |
171 <p><?php _e( 'The Theme Installer screen requires JavaScript.' ); ?></p> |
186 wp_admin_notice( |
172 </div> |
187 __( 'The Theme Installer screen requires JavaScript.' ), |
|
188 array( |
|
189 'additional_classes' => array( 'error', 'hide-if-js' ), |
|
190 ) |
|
191 ); |
|
192 ?> |
173 |
193 |
174 <div class="upload-theme"> |
194 <div class="upload-theme"> |
175 <?php install_themes_upload(); ?> |
195 <?php install_themes_upload(); ?> |
176 </div> |
196 </div> |
177 |
197 |
178 <h2 class="screen-reader-text hide-if-no-js"><?php _e( 'Filter themes list' ); ?></h2> |
198 <h2 class="screen-reader-text hide-if-no-js"> |
|
199 <?php |
|
200 /* translators: Hidden accessibility text. */ |
|
201 _e( 'Filter themes list' ); |
|
202 ?> |
|
203 </h2> |
179 |
204 |
180 <div class="wp-filter hide-if-no-js"> |
205 <div class="wp-filter hide-if-no-js"> |
181 <div class="filter-count"> |
206 <div class="filter-count"> |
182 <span class="count theme-count"></span> |
207 <span class="count theme-count"></span> |
183 </div> |
208 </div> |
184 |
209 |
185 <ul class="filter-links"> |
210 <ul class="filter-links"> |
186 <li><a href="#" data-sort="popular"><?php _ex( 'Popular', 'themes' ); ?></a></li> |
211 <li><a href="#" data-sort="popular"><?php _ex( 'Popular', 'themes' ); ?></a></li> |
187 <li><a href="#" data-sort="new"><?php _ex( 'Latest', 'themes' ); ?></a></li> |
212 <li><a href="#" data-sort="new"><?php _ex( 'Latest', 'themes' ); ?></a></li> |
|
213 <li><a href="#" data-sort="block-themes"><?php _ex( 'Block Themes', 'themes' ); ?></a></li> |
188 <li><a href="#" data-sort="favorites"><?php _ex( 'Favorites', 'themes' ); ?></a></li> |
214 <li><a href="#" data-sort="favorites"><?php _ex( 'Favorites', 'themes' ); ?></a></li> |
189 </ul> |
215 </ul> |
190 |
216 |
191 <button type="button" class="button drawer-toggle" aria-expanded="false"><?php _e( 'Feature Filter' ); ?></button> |
217 <button type="button" class="button drawer-toggle" aria-expanded="false"><?php _e( 'Feature Filter' ); ?></button> |
192 |
218 |
193 <form class="search-form"></form> |
219 <form class="search-form"><p class="search-box"></p></form> |
194 |
220 |
195 <div class="favorites-form"> |
221 <div class="favorites-form"> |
196 <?php |
222 <?php |
197 $action = 'save_wporg_username_' . get_current_user_id(); |
223 $action = 'save_wporg_username_' . get_current_user_id(); |
198 if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_GET['_wpnonce'] ), $action ) ) { |
224 if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_GET['_wpnonce'] ), $action ) ) { |
244 <div class="tags"></div> |
270 <div class="tags"></div> |
245 <button type="button" class="button-link edit-filters"><?php _e( 'Edit Filters' ); ?></button> |
271 <button type="button" class="button-link edit-filters"><?php _e( 'Edit Filters' ); ?></button> |
246 </div> |
272 </div> |
247 </div> |
273 </div> |
248 </div> |
274 </div> |
249 <h2 class="screen-reader-text hide-if-no-js"><?php _e( 'Themes list' ); ?></h2> |
275 <h2 class="screen-reader-text hide-if-no-js"> |
|
276 <?php |
|
277 /* translators: Hidden accessibility text. */ |
|
278 _e( 'Themes list' ); |
|
279 ?> |
|
280 </h2> |
250 <div class="theme-browser content-filterable"></div> |
281 <div class="theme-browser content-filterable"></div> |
251 <div class="theme-install-overlay wp-full-overlay expanded"></div> |
282 <div class="theme-install-overlay wp-full-overlay expanded"></div> |
252 |
283 |
253 <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p> |
284 <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p> |
254 <span class="spinner"></span> |
285 <span class="spinner"></span> |
261 * The dynamic portion of the hook name, `$tab`, refers to the current |
292 * The dynamic portion of the hook name, `$tab`, refers to the current |
262 * theme installation tab. |
293 * theme installation tab. |
263 * |
294 * |
264 * Possible hook names include: |
295 * Possible hook names include: |
265 * |
296 * |
|
297 * - `install_themes_block-themes` |
266 * - `install_themes_dashboard` |
298 * - `install_themes_dashboard` |
267 * - `install_themes_featured` |
299 * - `install_themes_featured` |
268 * - `install_themes_new` |
300 * - `install_themes_new` |
269 * - `install_themes_search` |
301 * - `install_themes_search` |
270 * - `install_themes_updated` |
302 * - `install_themes_updated` |
271 * - `install_themes_upload` |
303 * - `install_themes_upload` |
272 * |
304 * |
273 * @since 2.8.0 |
305 * @since 2.8.0 |
|
306 * @since 6.1.0 Added the `install_themes_block-themes` hook name. |
274 * |
307 * |
275 * @param int $paged Number of the current page of results being viewed. |
308 * @param int $paged Number of the current page of results being viewed. |
276 */ |
309 */ |
277 do_action( "install_themes_{$tab}", $paged ); |
310 do_action( "install_themes_{$tab}", $paged ); |
278 } |
311 } |
287 <# } else { #> |
320 <# } else { #> |
288 <div class="theme-screenshot blank"></div> |
321 <div class="theme-screenshot blank"></div> |
289 <# } #> |
322 <# } #> |
290 |
323 |
291 <# if ( data.installed ) { #> |
324 <# if ( data.installed ) { #> |
292 <div class="notice notice-success notice-alt"><p><?php _ex( 'Installed', 'theme' ); ?></p></div> |
325 <?php |
|
326 wp_admin_notice( |
|
327 _x( 'Installed', 'theme' ), |
|
328 array( |
|
329 'type' => 'success', |
|
330 'additional_classes' => array( 'notice-alt' ), |
|
331 ) |
|
332 ); |
|
333 ?> |
293 <# } #> |
334 <# } #> |
294 |
335 |
295 <# if ( ! data.compatible_wp || ! data.compatible_php ) { #> |
336 <# if ( ! data.compatible_wp || ! data.compatible_php ) { #> |
296 <div class="notice notice-error notice-alt"><p> |
337 <div class="notice notice-error notice-alt"><p> |
297 <# if ( ! data.compatible_wp && ! data.compatible_php ) { #> |
338 <# if ( ! data.compatible_wp && ! data.compatible_php ) { #> |
419 </script> |
460 </script> |
420 |
461 |
421 <script id="tmpl-theme-preview" type="text/template"> |
462 <script id="tmpl-theme-preview" type="text/template"> |
422 <div class="wp-full-overlay-sidebar"> |
463 <div class="wp-full-overlay-sidebar"> |
423 <div class="wp-full-overlay-header"> |
464 <div class="wp-full-overlay-header"> |
424 <button class="close-full-overlay"><span class="screen-reader-text"><?php _e( 'Close' ); ?></span></button> |
465 <button class="close-full-overlay"><span class="screen-reader-text"> |
425 <button class="previous-theme"><span class="screen-reader-text"><?php _e( 'Previous theme' ); ?></span></button> |
466 <?php |
426 <button class="next-theme"><span class="screen-reader-text"><?php _e( 'Next theme' ); ?></span></button> |
467 /* translators: Hidden accessibility text. */ |
|
468 _e( 'Close' ); |
|
469 ?> |
|
470 </span></button> |
|
471 <button class="previous-theme"><span class="screen-reader-text"> |
|
472 <?php |
|
473 /* translators: Hidden accessibility text. */ |
|
474 _e( 'Previous theme' ); |
|
475 ?> |
|
476 </span></button> |
|
477 <button class="next-theme"><span class="screen-reader-text"> |
|
478 <?php |
|
479 /* translators: Hidden accessibility text. */ |
|
480 _e( 'Next theme' ); |
|
481 ?> |
|
482 </span></button> |
427 <# if ( data.installed ) { #> |
483 <# if ( data.installed ) { #> |
428 <# if ( data.compatible_wp && data.compatible_php ) { #> |
484 <# if ( data.compatible_wp && data.compatible_php ) { #> |
429 <?php |
485 <?php |
430 /* translators: %s: Theme name. */ |
486 /* translators: %s: Theme name. */ |
431 $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); |
487 $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); |