[ Index ]

PHP Cross Reference of WordPress

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', '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                  <span><?php _ex( 'Active:', 'theme' ); ?></span> <?php echo $theme['name']; ?>
 346              </h2>
 347          <?php } else { ?>
 348              <h2 class="theme-name" id="<?php echo $aria_name; ?>"><?php echo $theme['name']; ?></h2>
 349          <?php } ?>
 350  
 351          <div class="theme-actions">
 352          <?php if ( $theme['active'] ) { ?>
 353              <?php if ( $theme['actions']['customize'] && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?>
 354                  <a class="button button-primary customize load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Customize' ); ?></a>
 355              <?php } ?>
 356          <?php } else { ?>
 357              <?php
 358              /* translators: %s: Theme name. */
 359              $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
 360              ?>
 361              <a class="button activate" href="<?php echo $theme['actions']['activate']; ?>" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
 362              <?php if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?>
 363                  <a class="button button-primary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Live Preview' ); ?></a>
 364              <?php } ?>
 365          <?php } ?>
 366  
 367          </div>
 368      </div>
 369  </div>
 370  <?php endforeach; ?>
 371      </div>
 372  </div>
 373  <div class="theme-overlay" tabindex="0" role="dialog" aria-label="<?php esc_attr_e( 'Theme Details' ); ?>"></div>
 374  
 375  <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
 376  
 377  <?php
 378  // List broken themes, if any.
 379  $broken_themes = wp_get_themes( array( 'errors' => true ) );
 380  if ( ! is_multisite() && current_user_can( 'edit_themes' ) && $broken_themes ) {
 381      ?>
 382  
 383  <div class="broken-themes">
 384  <h3><?php _e( 'Broken Themes' ); ?></h3>
 385  <p><?php _e( 'The following themes are installed but incomplete.' ); ?></p>
 386  
 387      <?php
 388      $can_resume  = current_user_can( 'resume_themes' );
 389      $can_delete  = current_user_can( 'delete_themes' );
 390      $can_install = current_user_can( 'install_themes' );
 391      ?>
 392  <table>
 393      <tr>
 394          <th><?php _ex( 'Name', 'theme name' ); ?></th>
 395          <th><?php _e( 'Description' ); ?></th>
 396          <?php if ( $can_resume ) { ?>
 397              <td></td>
 398          <?php } ?>
 399          <?php if ( $can_delete ) { ?>
 400              <td></td>
 401          <?php } ?>
 402          <?php if ( $can_install ) { ?>
 403              <td></td>
 404          <?php } ?>
 405      </tr>
 406      <?php foreach ( $broken_themes as $broken_theme ) : ?>
 407          <tr>
 408              <td><?php echo $broken_theme->get( 'Name' ) ? $broken_theme->display( 'Name' ) : $broken_theme->get_stylesheet(); ?></td>
 409              <td><?php echo $broken_theme->errors()->get_error_message(); ?></td>
 410              <?php
 411              if ( $can_resume ) {
 412                  if ( 'theme_paused' === $broken_theme->errors()->get_error_code() ) {
 413                      $stylesheet = $broken_theme->get_stylesheet();
 414                      $resume_url = add_query_arg(
 415                          array(
 416                              'action'     => 'resume',
 417                              'stylesheet' => urlencode( $stylesheet ),
 418                          ),
 419                          admin_url( 'themes.php' )
 420                      );
 421                      $resume_url = wp_nonce_url( $resume_url, 'resume-theme_' . $stylesheet );
 422                      ?>
 423                      <td><a href="<?php echo esc_url( $resume_url ); ?>" class="button resume-theme"><?php _e( 'Resume' ); ?></a></td>
 424                      <?php
 425                  } else {
 426                      ?>
 427                      <td></td>
 428                      <?php
 429                  }
 430              }
 431  
 432              if ( $can_delete ) {
 433                  $stylesheet = $broken_theme->get_stylesheet();
 434                  $delete_url = add_query_arg(
 435                      array(
 436                          'action'     => 'delete',
 437                          'stylesheet' => urlencode( $stylesheet ),
 438                      ),
 439                      admin_url( 'themes.php' )
 440                  );
 441                  $delete_url = wp_nonce_url( $delete_url, 'delete-theme_' . $stylesheet );
 442                  ?>
 443                  <td><a href="<?php echo esc_url( $delete_url ); ?>" class="button delete-theme"><?php _e( 'Delete' ); ?></a></td>
 444                  <?php
 445              }
 446  
 447              if ( $can_install && 'theme_no_parent' === $broken_theme->errors()->get_error_code() ) {
 448                  $parent_theme_name = $broken_theme->get( 'Template' );
 449                  $parent_theme      = themes_api( 'theme_information', array( 'slug' => urlencode( $parent_theme_name ) ) );
 450  
 451                  if ( ! is_wp_error( $parent_theme ) ) {
 452                      $install_url = add_query_arg(
 453                          array(
 454                              'action' => 'install-theme',
 455                              'theme'  => urlencode( $parent_theme_name ),
 456                          ),
 457                          admin_url( 'update.php' )
 458                      );
 459                      $install_url = wp_nonce_url( $install_url, 'install-theme_' . $parent_theme_name );
 460                      ?>
 461                      <td><a href="<?php echo esc_url( $install_url ); ?>" class="button install-theme"><?php _e( 'Install Parent Theme' ); ?></a></td>
 462                      <?php
 463                  }
 464              }
 465              ?>
 466          </tr>
 467      <?php endforeach; ?>
 468  </table>
 469  </div>
 470  
 471      <?php
 472  }
 473  ?>
 474  </div><!-- .wrap -->
 475  
 476  <?php
 477  /*
 478   * The tmpl-theme template is synchronized with PHP above!
 479   */
 480  ?>
 481  <script id="tmpl-theme" type="text/template">
 482      <# if ( data.screenshot[0] ) { #>
 483          <div class="theme-screenshot">
 484              <img src="{{ data.screenshot[0] }}" alt="" />
 485          </div>
 486      <# } else { #>
 487          <div class="theme-screenshot blank"></div>
 488      <# } #>
 489  
 490      <# if ( data.hasUpdate ) { #>
 491          <# if ( data.hasPackage ) { #>
 492              <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>
 493          <# } else { #>
 494              <div class="update-message notice inline notice-warning notice-alt"><p><?php _e( 'New version available.' ); ?></p></div>
 495          <# } #>
 496      <# } #>
 497  
 498      <span class="more-details" id="{{ data.id }}-action"><?php _e( 'Theme Details' ); ?></span>
 499      <div class="theme-author">
 500          <?php
 501          /* translators: %s: Theme author name. */
 502          printf( __( 'By %s' ), '{{{ data.author }}}' );
 503          ?>
 504      </div>
 505  
 506      <div class="theme-id-container">
 507          <# if ( data.active ) { #>
 508              <h2 class="theme-name" id="{{ data.id }}-name">
 509                  <span><?php _ex( 'Active:', 'theme' ); ?></span> {{{ data.name }}}
 510              </h2>
 511          <# } else { #>
 512              <h2 class="theme-name" id="{{ data.id }}-name">{{{ data.name }}}</h2>
 513          <# } #>
 514  
 515          <div class="theme-actions">
 516              <# if ( data.active ) { #>
 517                  <# if ( data.actions.customize ) { #>
 518                      <a class="button button-primary customize load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Customize' ); ?></a>
 519                  <# } #>
 520              <# } else { #>
 521                  <?php
 522                  /* translators: %s: Theme name. */
 523                  $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
 524                  ?>
 525                  <a class="button activate" href="{{{ data.actions.activate }}}" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a>
 526                  <a class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a>
 527              <# } #>
 528          </div>
 529      </div>
 530  </script>
 531  
 532  <script id="tmpl-theme-single" type="text/template">
 533      <div class="theme-backdrop"></div>
 534      <div class="theme-wrap wp-clearfix" role="document">
 535          <div class="theme-header">
 536              <button class="left dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show previous theme' ); ?></span></button>
 537              <button class="right dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show next theme' ); ?></span></button>
 538              <button class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Close details dialog' ); ?></span></button>
 539          </div>
 540          <div class="theme-about wp-clearfix">
 541              <div class="theme-screenshots">
 542              <# if ( data.screenshot[0] ) { #>
 543                  <div class="screenshot"><img src="{{ data.screenshot[0] }}" alt="" /></div>
 544              <# } else { #>
 545                  <div class="screenshot blank"></div>
 546              <# } #>
 547              </div>
 548  
 549              <div class="theme-info">
 550                  <# if ( data.active ) { #>
 551                      <span class="current-label"><?php _e( 'Current Theme' ); ?></span>
 552                  <# } #>
 553                  <h2 class="theme-name">{{{ data.name }}}<span class="theme-version">
 554                      <?php
 555                      /* translators: %s: Theme version. */
 556                      printf( __( 'Version: %s' ), '{{ data.version }}' );
 557                      ?>
 558                  </span></h2>
 559                  <p class="theme-author">
 560                      <?php
 561                      /* translators: %s: Theme author link. */
 562                      printf( __( 'By %s' ), '{{{ data.authorAndUri }}}' );
 563                      ?>
 564                  </p>
 565  
 566                  <# if ( data.hasUpdate ) { #>
 567                  <div class="notice notice-warning notice-alt notice-large">
 568                      <h3 class="notice-title"><?php _e( 'Update Available' ); ?></h3>
 569                      {{{ data.update }}}
 570                  </div>
 571                  <# } #>
 572                  <p class="theme-description">{{{ data.description }}}</p>
 573  
 574                  <# if ( data.parent ) { #>
 575                      <p class="parent-theme">
 576                          <?php
 577                          /* translators: %s: Theme name. */
 578                          printf( __( 'This is a child theme of %s.' ), '<strong>{{{ data.parent }}}</strong>' );
 579                          ?>
 580                      </p>
 581                  <# } #>
 582  
 583                  <# if ( data.tags ) { #>
 584                      <p class="theme-tags"><span><?php _e( 'Tags:' ); ?></span> {{{ data.tags }}}</p>
 585                  <# } #>
 586              </div>
 587          </div>
 588  
 589          <div class="theme-actions">
 590              <div class="active-theme">
 591                  <a href="{{{ data.actions.customize }}}" class="button button-primary customize load-customize hide-if-no-customize"><?php _e( 'Customize' ); ?></a>
 592                  <?php echo implode( ' ', $current_theme_actions ); ?>
 593              </div>
 594              <div class="inactive-theme">
 595                  <?php
 596                  /* translators: %s: Theme name. */
 597                  $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
 598                  ?>
 599                  <# if ( data.actions.activate ) { #>
 600                      <a href="{{{ data.actions.activate }}}" class="button activate" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a>
 601                  <# } #>
 602                  <a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php _e( 'Live Preview' ); ?></a>
 603              </div>
 604  
 605              <# if ( ! data.active && data.actions['delete'] ) { #>
 606                  <a href="{{{ data.actions['delete'] }}}" class="button delete-theme"><?php _e( 'Delete' ); ?></a>
 607              <# } #>
 608          </div>
 609      </div>
 610  </script>
 611  
 612  <?php
 613  wp_print_request_filesystem_credentials_modal();
 614  wp_print_admin_notice_templates();
 615  wp_print_update_row_templates();
 616  
 617  wp_localize_script(
 618      'updates',
 619      '_wpUpdatesItemCounts',
 620      array(
 621          'totals' => wp_get_update_data(),
 622      )
 623  );
 624  
 625  require( ABSPATH . 'wp-admin/admin-footer.php' );


Generated: Sun Jan 26 01:00:03 2020 Cross-referenced by PHPXref 0.7.1