themes.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. <?php
  2. /**
  3. * Themes administration panel.
  4. *
  5. * @package WordPress
  6. * @subpackage Administration
  7. */
  8. /** WordPress Administration Bootstrap */
  9. require_once( dirname( __FILE__ ) . '/admin.php' );
  10. if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) ) {
  11. wp_die(
  12. '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
  13. '<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>',
  14. 403
  15. );
  16. }
  17. if ( current_user_can( 'switch_themes' ) && isset($_GET['action'] ) ) {
  18. if ( 'activate' == $_GET['action'] ) {
  19. check_admin_referer('switch-theme_' . $_GET['stylesheet']);
  20. $theme = wp_get_theme( $_GET['stylesheet'] );
  21. if ( ! $theme->exists() || ! $theme->is_allowed() ) {
  22. wp_die(
  23. '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
  24. '<p>' . __( 'The requested theme does not exist.' ) . '</p>',
  25. 403
  26. );
  27. }
  28. switch_theme( $theme->get_stylesheet() );
  29. wp_redirect( admin_url('themes.php?activated=true') );
  30. exit;
  31. } elseif ( 'delete' == $_GET['action'] ) {
  32. check_admin_referer('delete-theme_' . $_GET['stylesheet']);
  33. $theme = wp_get_theme( $_GET['stylesheet'] );
  34. if ( ! current_user_can( 'delete_themes' ) ) {
  35. wp_die(
  36. '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
  37. '<p>' . __( 'Sorry, you are not allowed to delete this item.' ) . '</p>',
  38. 403
  39. );
  40. }
  41. if ( ! $theme->exists() ) {
  42. wp_die(
  43. '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
  44. '<p>' . __( 'The requested theme does not exist.' ) . '</p>',
  45. 403
  46. );
  47. }
  48. $active = wp_get_theme();
  49. if ( $active->get( 'Template' ) == $_GET['stylesheet'] ) {
  50. wp_redirect( admin_url( 'themes.php?delete-active-child=true' ) );
  51. } else {
  52. delete_theme( $_GET['stylesheet'] );
  53. wp_redirect( admin_url( 'themes.php?deleted=true' ) );
  54. }
  55. exit;
  56. }
  57. }
  58. $title = __('Manage Themes');
  59. $parent_file = 'themes.php';
  60. // Help tab: Overview
  61. if ( current_user_can( 'switch_themes' ) ) {
  62. $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>' .
  63. '<p>' . __( 'From this screen you can:' ) . '</p>' .
  64. '<ul><li>' . __( 'Hover or tap to see Activate and Live Preview buttons' ) . '</li>' .
  65. '<li>' . __( 'Click on the theme to see the theme name, version, author, description, tags, and the Delete link' ) . '</li>' .
  66. '<li>' . __( 'Click Customize for the current theme or Live Preview for any other theme to see a live preview' ) . '</li></ul>' .
  67. '<p>' . __( 'The current theme is displayed highlighted as the first theme.' ) . '</p>' .
  68. '<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>';
  69. get_current_screen()->add_help_tab( array(
  70. 'id' => 'overview',
  71. 'title' => __( 'Overview' ),
  72. 'content' => $help_overview
  73. ) );
  74. } // switch_themes
  75. // Help tab: Adding Themes
  76. if ( current_user_can( 'install_themes' ) ) {
  77. if ( is_multisite() ) {
  78. $help_install = '<p>' . __('Installing themes on Multisite can only be done from the Network Admin section.') . '</p>';
  79. } else {
  80. $help_install = '<p>' . sprintf( __('If you would like to see more themes to choose from, click on the &#8220;Add New&#8221; 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&#8217;re free!'), __( 'https://wordpress.org/themes/' ) ) . '</p>';
  81. }
  82. get_current_screen()->add_help_tab( array(
  83. 'id' => 'adding-themes',
  84. 'title' => __('Adding Themes'),
  85. 'content' => $help_install
  86. ) );
  87. } // install_themes
  88. // Help tab: Previewing and Customizing
  89. if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
  90. $help_customize =
  91. '<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>'.
  92. '<p>' . __( 'The theme being previewed is fully interactive &mdash; 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 Save &amp; Activate button above the menu.' ) . '</p>' .
  93. '<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>';
  94. get_current_screen()->add_help_tab( array(
  95. 'id' => 'customize-preview-themes',
  96. 'title' => __( 'Previewing and Customizing' ),
  97. 'content' => $help_customize
  98. ) );
  99. } // edit_theme_options && customize
  100. get_current_screen()->set_help_sidebar(
  101. '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
  102. '<p>' . __( '<a href="https://codex.wordpress.org/Using_Themes">Documentation on Using Themes</a>' ) . '</p>' .
  103. '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>'
  104. );
  105. if ( current_user_can( 'switch_themes' ) ) {
  106. $themes = wp_prepare_themes_for_js();
  107. } else {
  108. $themes = wp_prepare_themes_for_js( array( wp_get_theme() ) );
  109. }
  110. wp_reset_vars( array( 'theme', 'search' ) );
  111. wp_localize_script( 'theme', '_wpThemeSettings', array(
  112. 'themes' => $themes,
  113. 'settings' => array(
  114. 'canInstall' => ( ! is_multisite() && current_user_can( 'install_themes' ) ),
  115. 'installURI' => ( ! is_multisite() && current_user_can( 'install_themes' ) ) ? admin_url( 'theme-install.php' ) : null,
  116. 'confirmDelete' => __( "Are you sure you want to delete this theme?\n\nClick 'Cancel' to go back, 'OK' to confirm the delete." ),
  117. 'adminUrl' => parse_url( admin_url(), PHP_URL_PATH ),
  118. ),
  119. 'l10n' => array(
  120. 'addNew' => __( 'Add New Theme' ),
  121. 'search' => __( 'Search Installed Themes' ),
  122. 'searchPlaceholder' => __( 'Search installed themes...' ), // placeholder (no ellipsis)
  123. 'themesFound' => __( 'Number of Themes found: %d' ),
  124. 'noThemesFound' => __( 'No themes found. Try a different search.' ),
  125. ),
  126. ) );
  127. add_thickbox();
  128. wp_enqueue_script( 'theme' );
  129. wp_enqueue_script( 'updates' );
  130. wp_enqueue_script( 'customize-loader' );
  131. require_once( ABSPATH . 'wp-admin/admin-header.php' );
  132. ?>
  133. <div class="wrap">
  134. <h1 class="wp-heading-inline"><?php esc_html_e( 'Themes' ); ?>
  135. <span class="title-count theme-count"><?php echo count( $themes ); ?></span>
  136. </h1>
  137. <?php if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?>
  138. <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>
  139. <?php endif; ?>
  140. <form class="search-form"></form>
  141. <hr class="wp-header-end">
  142. <?php
  143. if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) : ?>
  144. <div id="message1" class="updated notice is-dismissible"><p><?php _e('The active theme is broken. Reverting to the default theme.'); ?></p></div>
  145. <?php elseif ( isset($_GET['activated']) ) :
  146. if ( isset( $_GET['previewed'] ) ) { ?>
  147. <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>
  148. <?php } else { ?>
  149. <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><?php
  150. }
  151. elseif ( isset($_GET['deleted']) ) : ?>
  152. <div id="message3" class="updated notice is-dismissible"><p><?php _e('Theme deleted.') ?></p></div>
  153. <?php elseif ( isset( $_GET['delete-active-child'] ) ) : ?>
  154. <div id="message4" class="error"><p><?php _e( 'You cannot delete a theme while it has an active child theme.' ); ?></p></div>
  155. <?php
  156. endif;
  157. $ct = wp_get_theme();
  158. if ( $ct->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) {
  159. echo '<div class="error"><p>' . __( 'ERROR:' ) . ' ' . $ct->errors()->get_error_message() . '</p></div>';
  160. }
  161. /*
  162. // Certain error codes are less fatal than others. We can still display theme information in most cases.
  163. if ( ! $ct->errors() || ( 1 == count( $ct->errors()->get_error_codes() )
  164. && in_array( $ct->errors()->get_error_code(), array( 'theme_no_parent', 'theme_parent_invalid', 'theme_no_index' ) ) ) ) : ?>
  165. */
  166. // Pretend you didn't see this.
  167. $current_theme_actions = array();
  168. if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) {
  169. foreach ( (array) $submenu['themes.php'] as $item) {
  170. $class = '';
  171. if ( 'themes.php' == $item[2] || 'theme-editor.php' == $item[2] || 0 === strpos( $item[2], 'customize.php' ) )
  172. continue;
  173. // 0 = name, 1 = capability, 2 = file
  174. if ( ( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file)) )
  175. $class = ' current';
  176. if ( !empty($submenu[$item[2]]) ) {
  177. $submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index.
  178. $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
  179. if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
  180. $current_theme_actions[] = "<a class='button$class' href='admin.php?page={$submenu[$item[2]][0][2]}'>{$item[0]}</a>";
  181. else
  182. $current_theme_actions[] = "<a class='button$class' href='{$submenu[$item[2]][0][2]}'>{$item[0]}</a>";
  183. } elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) {
  184. $menu_file = $item[2];
  185. if ( current_user_can( 'customize' ) ) {
  186. if ( 'custom-header' === $menu_file ) {
  187. $current_theme_actions[] = "<a class='button hide-if-no-customize$class' href='customize.php?autofocus[control]=header_image'>{$item[0]}</a>";
  188. } elseif ( 'custom-background' === $menu_file ) {
  189. $current_theme_actions[] = "<a class='button hide-if-no-customize$class' href='customize.php?autofocus[control]=background_image'>{$item[0]}</a>";
  190. }
  191. }
  192. if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) {
  193. $menu_file = substr( $menu_file, 0, $pos );
  194. }
  195. if ( file_exists( ABSPATH . "wp-admin/$menu_file" ) ) {
  196. $current_theme_actions[] = "<a class='button$class' href='{$item[2]}'>{$item[0]}</a>";
  197. } else {
  198. $current_theme_actions[] = "<a class='button$class' href='themes.php?page={$item[2]}'>{$item[0]}</a>";
  199. }
  200. }
  201. }
  202. }
  203. ?>
  204. <div class="theme-browser">
  205. <div class="themes wp-clearfix">
  206. <?php
  207. /*
  208. * This PHP is synchronized with the tmpl-theme template below!
  209. */
  210. foreach ( $themes as $theme ) :
  211. $aria_action = esc_attr( $theme['id'] . '-action' );
  212. $aria_name = esc_attr( $theme['id'] . '-name' );
  213. ?>
  214. <div class="theme<?php if ( $theme['active'] ) echo ' active'; ?>" tabindex="0" aria-describedby="<?php echo $aria_action . ' ' . $aria_name; ?>">
  215. <?php if ( ! empty( $theme['screenshot'][0] ) ) { ?>
  216. <div class="theme-screenshot">
  217. <img src="<?php echo $theme['screenshot'][0]; ?>" alt="" />
  218. </div>
  219. <?php } else { ?>
  220. <div class="theme-screenshot blank"></div>
  221. <?php } ?>
  222. <?php if ( $theme['hasUpdate'] ) : ?>
  223. <div class="update-message notice inline notice-warning notice-alt">
  224. <?php if ( $theme['hasPackage'] ) : ?>
  225. <p><?php _e( 'New version available. <button class="button-link" type="button">Update now</button>' ); ?></p>
  226. <?php else : ?>
  227. <p><?php _e( 'New version available.' ); ?></p>
  228. <?php endif; ?>
  229. </div>
  230. <?php endif; ?>
  231. <span class="more-details" id="<?php echo $aria_action; ?>"><?php _e( 'Theme Details' ); ?></span>
  232. <div class="theme-author"><?php printf( __( 'By %s' ), $theme['author'] ); ?></div>
  233. <?php if ( $theme['active'] ) { ?>
  234. <h2 class="theme-name" id="<?php echo $aria_name; ?>">
  235. <?php
  236. /* translators: %s: theme name */
  237. printf( __( '<span>Active:</span> %s' ), $theme['name'] );
  238. ?>
  239. </h2>
  240. <?php } else { ?>
  241. <h2 class="theme-name" id="<?php echo $aria_name; ?>"><?php echo $theme['name']; ?></h2>
  242. <?php } ?>
  243. <div class="theme-actions">
  244. <?php if ( $theme['active'] ) { ?>
  245. <?php if ( $theme['actions']['customize'] && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?>
  246. <a class="button button-primary customize load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Customize' ); ?></a>
  247. <?php } ?>
  248. <?php } else { ?>
  249. <?php
  250. /* translators: %s: Theme name */
  251. $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
  252. ?>
  253. <a class="button activate" href="<?php echo $theme['actions']['activate']; ?>" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
  254. <?php if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?>
  255. <a class="button button-primary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Live Preview' ); ?></a>
  256. <?php } ?>
  257. <?php } ?>
  258. </div>
  259. </div>
  260. <?php endforeach; ?>
  261. </div>
  262. </div>
  263. <div class="theme-overlay"></div>
  264. <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
  265. <?php
  266. // List broken themes, if any.
  267. if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_get_themes( array( 'errors' => true ) ) ) {
  268. ?>
  269. <div class="broken-themes">
  270. <h3><?php _e('Broken Themes'); ?></h3>
  271. <p><?php _e( 'The following themes are installed but incomplete.' ); ?></p>
  272. <?php
  273. $can_delete = current_user_can( 'delete_themes' );
  274. $can_install = current_user_can( 'install_themes' );
  275. ?>
  276. <table>
  277. <tr>
  278. <th><?php _ex('Name', 'theme name'); ?></th>
  279. <th><?php _e('Description'); ?></th>
  280. <?php if ( $can_delete ) { ?>
  281. <td></td>
  282. <?php } ?>
  283. <?php if ( $can_install ) { ?>
  284. <td></td>
  285. <?php } ?>
  286. </tr>
  287. <?php foreach ( $broken_themes as $broken_theme ) : ?>
  288. <tr>
  289. <td><?php echo $broken_theme->get( 'Name' ) ? $broken_theme->display( 'Name' ) : $broken_theme->get_stylesheet(); ?></td>
  290. <td><?php echo $broken_theme->errors()->get_error_message(); ?></td>
  291. <?php
  292. if ( $can_delete ) {
  293. $stylesheet = $broken_theme->get_stylesheet();
  294. $delete_url = add_query_arg( array(
  295. 'action' => 'delete',
  296. 'stylesheet' => urlencode( $stylesheet ),
  297. ), admin_url( 'themes.php' ) );
  298. $delete_url = wp_nonce_url( $delete_url, 'delete-theme_' . $stylesheet );
  299. ?>
  300. <td><a href="<?php echo esc_url( $delete_url ); ?>" class="button delete-theme"><?php _e( 'Delete' ); ?></a></td>
  301. <?php
  302. }
  303. if ( $can_install && 'theme_no_parent' === $broken_theme->errors()->get_error_code() ) {
  304. $parent_theme_name = $broken_theme->get( 'Template' );
  305. $parent_theme = themes_api( 'theme_information', array( 'slug' => urlencode( $parent_theme_name ) ) );
  306. if ( ! is_wp_error( $parent_theme ) ) {
  307. $install_url = add_query_arg( array(
  308. 'action' => 'install-theme',
  309. 'theme' => urlencode( $parent_theme_name ),
  310. ), admin_url( 'update.php' ) );
  311. $install_url = wp_nonce_url( $install_url, 'install-theme_' . $parent_theme_name );
  312. ?>
  313. <td><a href="<?php echo esc_url( $install_url ); ?>" class="button install-theme"><?php _e( 'Install Parent Theme' ); ?></a></td>
  314. <?php
  315. }
  316. }
  317. ?>
  318. </tr>
  319. <?php endforeach; ?>
  320. </table>
  321. </div>
  322. <?php
  323. }
  324. ?>
  325. </div><!-- .wrap -->
  326. <?php
  327. /*
  328. * The tmpl-theme template is synchronized with PHP above!
  329. */
  330. ?>
  331. <script id="tmpl-theme" type="text/template">
  332. <# if ( data.screenshot[0] ) { #>
  333. <div class="theme-screenshot">
  334. <img src="{{ data.screenshot[0] }}" alt="" />
  335. </div>
  336. <# } else { #>
  337. <div class="theme-screenshot blank"></div>
  338. <# } #>
  339. <# if ( data.hasUpdate ) { #>
  340. <# if ( data.hasPackage ) { #>
  341. <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>
  342. <# } else { #>
  343. <div class="update-message notice inline notice-warning notice-alt"><p><?php _e( 'New version available.' ); ?></p></div>
  344. <# } #>
  345. <# } #>
  346. <span class="more-details" id="{{ data.id }}-action"><?php _e( 'Theme Details' ); ?></span>
  347. <div class="theme-author">
  348. <?php
  349. /* translators: %s: Theme author name */
  350. printf( __( 'By %s' ), '{{{ data.author }}}' );
  351. ?>
  352. </div>
  353. <# if ( data.active ) { #>
  354. <h2 class="theme-name" id="{{ data.id }}-name">
  355. <?php
  356. /* translators: %s: Theme name */
  357. printf( __( '<span>Active:</span> %s' ), '{{{ data.name }}}' );
  358. ?>
  359. </h2>
  360. <# } else { #>
  361. <h2 class="theme-name" id="{{ data.id }}-name">{{{ data.name }}}</h2>
  362. <# } #>
  363. <div class="theme-actions">
  364. <# if ( data.active ) { #>
  365. <# if ( data.actions.customize ) { #>
  366. <a class="button button-primary customize load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Customize' ); ?></a>
  367. <# } #>
  368. <# } else { #>
  369. <?php
  370. /* translators: %s: Theme name */
  371. $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
  372. ?>
  373. <a class="button activate" href="{{{ data.actions.activate }}}" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a>
  374. <a class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a>
  375. <# } #>
  376. </div>
  377. </script>
  378. <script id="tmpl-theme-single" type="text/template">
  379. <div class="theme-backdrop"></div>
  380. <div class="theme-wrap wp-clearfix">
  381. <div class="theme-header">
  382. <button class="left dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show previous theme' ); ?></span></button>
  383. <button class="right dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show next theme' ); ?></span></button>
  384. <button class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Close details dialog' ); ?></span></button>
  385. </div>
  386. <div class="theme-about wp-clearfix">
  387. <div class="theme-screenshots">
  388. <# if ( data.screenshot[0] ) { #>
  389. <div class="screenshot"><img src="{{ data.screenshot[0] }}" alt="" /></div>
  390. <# } else { #>
  391. <div class="screenshot blank"></div>
  392. <# } #>
  393. </div>
  394. <div class="theme-info">
  395. <# if ( data.active ) { #>
  396. <span class="current-label"><?php _e( 'Current Theme' ); ?></span>
  397. <# } #>
  398. <h2 class="theme-name">{{{ data.name }}}<span class="theme-version"><?php printf( __( 'Version: %s' ), '{{ data.version }}' ); ?></span></h2>
  399. <p class="theme-author"><?php printf( __( 'By %s' ), '{{{ data.authorAndUri }}}' ); ?></p>
  400. <# if ( data.hasUpdate ) { #>
  401. <div class="notice notice-warning notice-alt notice-large">
  402. <h3 class="notice-title"><?php _e( 'Update Available' ); ?></h3>
  403. {{{ data.update }}}
  404. </div>
  405. <# } #>
  406. <p class="theme-description">{{{ data.description }}}</p>
  407. <# if ( data.parent ) { #>
  408. <p class="parent-theme"><?php printf( __( 'This is a child theme of %s.' ), '<strong>{{{ data.parent }}}</strong>' ); ?></p>
  409. <# } #>
  410. <# if ( data.tags ) { #>
  411. <p class="theme-tags"><span><?php _e( 'Tags:' ); ?></span> {{{ data.tags }}}</p>
  412. <# } #>
  413. </div>
  414. </div>
  415. <div class="theme-actions">
  416. <div class="active-theme">
  417. <a href="{{{ data.actions.customize }}}" class="button button-primary customize load-customize hide-if-no-customize"><?php _e( 'Customize' ); ?></a>
  418. <?php echo implode( ' ', $current_theme_actions ); ?>
  419. </div>
  420. <div class="inactive-theme">
  421. <?php
  422. /* translators: %s: Theme name */
  423. $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
  424. ?>
  425. <# if ( data.actions.activate ) { #>
  426. <a href="{{{ data.actions.activate }}}" class="button activate" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a>
  427. <# } #>
  428. <a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php _e( 'Live Preview' ); ?></a>
  429. </div>
  430. <# if ( ! data.active && data.actions['delete'] ) { #>
  431. <a href="{{{ data.actions['delete'] }}}" class="button delete-theme"><?php _e( 'Delete' ); ?></a>
  432. <# } #>
  433. </div>
  434. </div>
  435. </script>
  436. <?php
  437. wp_print_request_filesystem_credentials_modal();
  438. wp_print_admin_notice_templates();
  439. wp_print_update_row_templates();
  440. wp_localize_script( 'updates', '_wpUpdatesItemCounts', array(
  441. 'totals' => wp_get_update_data(),
  442. ) );
  443. require( ABSPATH . 'wp-admin/admin-footer.php' );