[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

title

Body

[close]

/wp-admin/ -> themes.php (source)

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


Generated: Sat Nov 23 20:47:33 2019 Cross-referenced by PHPXref 0.7