| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Themes administration panel. 4 * 5 * @package WordPress 6 * @subpackage Administration 7 */ 8 9 /** WordPress Administration Bootstrap */ 10 require_once __DIR__ . '/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>' . __( 'An error occurred.' ) . '</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>' . __( 'An error occurred while deleting the theme.' ) . '</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 } elseif ( 'enable-auto-update' === $_GET['action'] ) { 85 if ( ! ( current_user_can( 'update_themes' ) && wp_is_auto_update_enabled_for_type( 'theme' ) ) ) { 86 wp_die( __( 'Sorry, you are not allowed to enable themes automatic updates.' ) ); 87 } 88 89 check_admin_referer( 'updates' ); 90 91 $all_items = wp_get_themes(); 92 $auto_updates = (array) get_site_option( 'auto_update_themes', array() ); 93 94 $auto_updates[] = $_GET['stylesheet']; 95 $auto_updates = array_unique( $auto_updates ); 96 // Remove themes that have been deleted since the site option was last updated. 97 $auto_updates = array_intersect( $auto_updates, array_keys( $all_items ) ); 98 99 update_site_option( 'auto_update_themes', $auto_updates ); 100 101 wp_redirect( admin_url( 'themes.php?enabled-auto-update=true' ) ); 102 103 exit; 104 } elseif ( 'disable-auto-update' === $_GET['action'] ) { 105 if ( ! ( current_user_can( 'update_themes' ) && wp_is_auto_update_enabled_for_type( 'theme' ) ) ) { 106 wp_die( __( 'Sorry, you are not allowed to disable themes automatic updates.' ) ); 107 } 108 109 check_admin_referer( 'updates' ); 110 111 $all_items = wp_get_themes(); 112 $auto_updates = (array) get_site_option( 'auto_update_themes', array() ); 113 114 $auto_updates = array_diff( $auto_updates, array( $_GET['stylesheet'] ) ); 115 // Remove themes that have been deleted since the site option was last updated. 116 $auto_updates = array_intersect( $auto_updates, array_keys( $all_items ) ); 117 118 update_site_option( 'auto_update_themes', $auto_updates ); 119 120 wp_redirect( admin_url( 'themes.php?disabled-auto-update=true' ) ); 121 122 exit; 123 } 124 } 125 126 // Used in the HTML title tag. 127 $title = __( 'Themes' ); 128 $parent_file = 'themes.php'; 129 130 // Help tab: Overview. 131 if ( current_user_can( 'switch_themes' ) ) { 132 $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>' . 133 '<p>' . __( 'From this screen you can:' ) . '</p>' . 134 '<ul><li>' . __( 'Hover or tap to see Activate and Live Preview buttons.' ) . '</li>' . 135 '<li>' . __( 'Click Customize for the active theme or Live Preview for any other theme to see a live preview.' ) . '</li>' . 136 '<li>' . __( 'Click on a theme to open the Theme Details dialog and see the theme name, version, author, description, tags, and the Delete link.' ) . '</li>' . 137 '<li>' . __( 'Use the buttons at the top of the dialog, or <code>alt</code>/<code>option</code> plus the left or right arrow keys on your keyboard, to navigate between themes quickly.' ) . '</li></ul>' . 138 '<p>' . __( 'The active theme is displayed highlighted as the first theme.' ) . '</p>' . 139 '<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>'; 140 141 get_current_screen()->add_help_tab( 142 array( 143 'id' => 'overview', 144 'title' => __( 'Overview' ), 145 'content' => $help_overview, 146 ) 147 ); 148 } // End if 'switch_themes'. 149 150 // Help tab: Adding Themes. 151 if ( current_user_can( 'install_themes' ) ) { 152 if ( is_multisite() ) { 153 $help_install = '<p>' . __( 'Installing themes on Multisite can only be done from the Network Admin section.' ) . '</p>'; 154 } else { 155 $help_install = '<p>' . sprintf( 156 /* translators: %s: https://wordpress.org/themes/ */ 157 __( 'If you would like to see more themes to choose from, click on the “Add Theme” 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 are free!' ), 158 __( 'https://wordpress.org/themes/' ) 159 ) . '</p>'; 160 } 161 162 get_current_screen()->add_help_tab( 163 array( 164 'id' => 'adding-themes', 165 'title' => __( 'Adding Themes' ), 166 'content' => $help_install, 167 ) 168 ); 169 } // End if 'install_themes'. 170 171 // Help tab: Previewing and Customizing. 172 if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { 173 $help_customize = 174 '<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>' . 175 '<p>' . __( 'The theme being previewed is fully interactive — 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 Activate & Publish button above the menu.' ) . '</p>' . 176 '<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>'; 177 178 get_current_screen()->add_help_tab( 179 array( 180 'id' => 'customize-preview-themes', 181 'title' => __( 'Previewing and Customizing' ), 182 'content' => $help_customize, 183 ) 184 ); 185 } // End if 'edit_theme_options' && 'customize'. 186 187 $help_sidebar_autoupdates = ''; 188 189 // Help tab: Auto-updates. 190 if ( current_user_can( 'update_themes' ) && wp_is_auto_update_enabled_for_type( 'theme' ) ) { 191 $help_tab_autoupdates = 192 '<p>' . __( 'Auto-updates can be enabled or disabled for each individual theme. Themes with auto-updates enabled will display the estimated date of the next auto-update. Auto-updates depends on the WP-Cron task scheduling system.' ) . '</p>' . 193 '<p>' . __( 'Please note: Third-party themes and plugins, or custom code, may override WordPress scheduling.' ) . '</p>'; 194 195 get_current_screen()->add_help_tab( 196 array( 197 'id' => 'plugins-themes-auto-updates', 198 'title' => __( 'Auto-updates' ), 199 'content' => $help_tab_autoupdates, 200 ) 201 ); 202 203 $help_sidebar_autoupdates = '<p>' . __( '<a href="https://wordpress.org/documentation/article/plugins-themes-auto-updates/">Documentation on Auto-updates</a>' ) . '</p>'; 204 } // End if 'update_themes' && 'wp_is_auto_update_enabled_for_type'. 205 206 get_current_screen()->set_help_sidebar( 207 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . 208 '<p>' . __( '<a href="https://wordpress.org/documentation/article/work-with-themes/">Documentation on Using Themes</a>' ) . '</p>' . 209 '<p>' . __( '<a href="https://wordpress.org/documentation/article/appearance-themes-screen/">Documentation on Managing Themes</a>' ) . '</p>' . 210 $help_sidebar_autoupdates . 211 '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>' 212 ); 213 214 if ( current_user_can( 'switch_themes' ) ) { 215 $themes = wp_prepare_themes_for_js(); 216 } else { 217 $themes = wp_prepare_themes_for_js( array( wp_get_theme() ) ); 218 } 219 220 $theme = ! empty( $_REQUEST['theme'] ) ? sanitize_text_field( $_REQUEST['theme'] ) : ''; 221 $search = ! empty( $_REQUEST['search'] ) ? sanitize_text_field( $_REQUEST['search'] ) : ''; 222 223 wp_localize_script( 224 'theme', 225 '_wpThemeSettings', 226 array( 227 'themes' => $themes, 228 'settings' => array( 229 'canInstall' => ( ! is_multisite() && current_user_can( 'install_themes' ) ), 230 'installURI' => ( ! is_multisite() && current_user_can( 'install_themes' ) ) ? admin_url( 'theme-install.php' ) : null, 231 'confirmDelete' => __( "Are you sure you want to delete this theme?\n\nClick 'Cancel' to go back, 'OK' to confirm the delete." ), 232 'adminUrl' => parse_url( admin_url(), PHP_URL_PATH ), 233 ), 234 'l10n' => array( 235 'addNew' => __( 'Add Theme' ), 236 'search' => __( 'Search installed themes' ), 237 /* translators: %d: Number of themes. */ 238 'themesFound' => __( 'Number of Themes found: %d' ), 239 'noThemesFound' => __( 'No themes found. Try a different search.' ), 240 /* translators: %s: Theme name. */ 241 'themeViewed' => __( 'Theme details: %s' ), 242 ), 243 ) 244 ); 245 246 add_thickbox(); 247 wp_enqueue_script( 'theme' ); 248 wp_enqueue_script( 'updates' ); 249 250 require_once ABSPATH . 'wp-admin/admin-header.php'; 251 ?> 252 253 <div class="wrap"> 254 <h1 class="wp-heading-inline"><?php esc_html_e( 'Themes' ); ?> 255 <span class="title-count theme-count"><?php echo ! empty( $_GET['search'] ) ? __( '…' ) : count( $themes ); ?></span> 256 </h1> 257 <?php if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?> 258 <a href="<?php echo esc_url( admin_url( 'theme-install.php' ) ); ?>" class="hide-if-no-js page-title-action"><?php echo esc_html__( 'Add Theme' ); ?></a> 259 <?php endif; ?> 260 <hr class="wp-header-end"> 261 <form class="search-form search-themes"><p class="search-box"></p></form> 262 263 <?php 264 if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) { 265 wp_admin_notice( 266 __( 'The active theme is broken. Reverting to the default theme.' ), 267 array( 268 'id' => 'message1', 269 'additional_classes' => array( 'updated' ), 270 'dismissible' => true, 271 ) 272 ); 273 } elseif ( isset( $_GET['activated'] ) ) { 274 if ( isset( $_GET['previewed'] ) ) { 275 wp_admin_notice( 276 __( 'Settings saved and theme activated.' ) . ' <a href="' . esc_url( home_url( '/' ) ) . '">' . __( 'Visit site' ) . '</a>', 277 array( 278 'id' => 'message2', 279 'additional_classes' => array( 'updated' ), 280 'dismissible' => true, 281 ) 282 ); 283 } else { 284 wp_admin_notice( 285 __( 'New theme activated.' ) . ' <a href="' . esc_url( home_url( '/' ) ) . '">' . __( 'Visit site' ) . '</a>', 286 array( 287 'id' => 'message2', 288 'additional_classes' => array( 'updated' ), 289 'dismissible' => true, 290 ) 291 ); 292 } 293 } elseif ( isset( $_GET['deleted'] ) ) { 294 wp_admin_notice( 295 __( 'Theme deleted.' ), 296 array( 297 'id' => 'message3', 298 'additional_classes' => array( 'updated' ), 299 'dismissible' => true, 300 ) 301 ); 302 } elseif ( isset( $_GET['delete-active-child'] ) ) { 303 wp_admin_notice( 304 __( 'You cannot delete a theme while it has an active child theme.' ), 305 array( 306 'id' => 'message4', 307 'additional_classes' => array( 'error' ), 308 ) 309 ); 310 } elseif ( isset( $_GET['resumed'] ) ) { 311 wp_admin_notice( 312 __( 'Theme resumed.' ), 313 array( 314 'id' => 'message5', 315 'additional_classes' => array( 'updated' ), 316 'dismissible' => true, 317 ) 318 ); 319 } elseif ( isset( $_GET['error'] ) && 'resuming' === $_GET['error'] ) { 320 wp_admin_notice( 321 __( 'Theme could not be resumed because it triggered a <strong>fatal error</strong>.' ), 322 array( 323 'id' => 'message6', 324 'additional_classes' => array( 'error' ), 325 ) 326 ); 327 } elseif ( isset( $_GET['enabled-auto-update'] ) ) { 328 wp_admin_notice( 329 __( 'Theme will be auto-updated.' ), 330 array( 331 'id' => 'message7', 332 'additional_classes' => array( 'updated' ), 333 'dismissible' => true, 334 ) 335 ); 336 } elseif ( isset( $_GET['disabled-auto-update'] ) ) { 337 wp_admin_notice( 338 __( 'Theme will no longer be auto-updated.' ), 339 array( 340 'id' => 'message8', 341 'additional_classes' => array( 'updated' ), 342 'dismissible' => true, 343 ) 344 ); 345 } 346 347 $current_theme = wp_get_theme(); 348 349 if ( $current_theme->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) { 350 wp_admin_notice( 351 '<strong>' . __( 'Error:' ) . '</strong> ' . $current_theme->errors()->get_error_message(), 352 array( 353 'additional_classes' => array( 'error' ), 354 ) 355 ); 356 } 357 358 $current_theme_actions = array(); 359 360 if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) { 361 $forbidden_paths = array( 362 'themes.php', 363 'theme-editor.php', 364 'site-editor.php', 365 'edit.php?post_type=wp_navigation', 366 ); 367 368 foreach ( (array) $submenu['themes.php'] as $item ) { 369 $class = ''; 370 371 if ( in_array( $item[2], $forbidden_paths, true ) || str_starts_with( $item[2], 'customize.php' ) ) { 372 continue; 373 } 374 375 // 0 = name, 1 = capability, 2 = file. 376 if ( 0 === strcmp( $self, $item[2] ) && empty( $parent_file ) 377 || $parent_file && $item[2] === $parent_file 378 ) { 379 $class = ' current'; 380 } 381 382 if ( ! empty( $submenu[ $item[2] ] ) ) { 383 $submenu[ $item[2] ] = array_values( $submenu[ $item[2] ] ); // Re-index. 384 $menu_hook = get_plugin_page_hook( $submenu[ $item[2] ][0][2], $item[2] ); 385 386 if ( file_exists( WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}" ) || ! empty( $menu_hook ) ) { 387 $current_theme_actions[] = "<a class='button button-compact$class' href='admin.php?page={$submenu[$item[2]][0][2]}'>{$item[0]}</a>"; 388 } else { 389 $current_theme_actions[] = "<a class='button button-compact$class' href='{$submenu[$item[2]][0][2]}'>{$item[0]}</a>"; 390 } 391 } elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) { 392 $menu_file = $item[2]; 393 394 if ( current_user_can( 'customize' ) ) { 395 if ( 'custom-header' === $menu_file ) { 396 $current_theme_actions[] = "<a class='button button-compact hide-if-no-customize$class' href='customize.php?autofocus[control]=header_image'>{$item[0]}</a>"; 397 } elseif ( 'custom-background' === $menu_file ) { 398 $current_theme_actions[] = "<a class='button button-compact hide-if-no-customize$class' href='customize.php?autofocus[control]=background_image'>{$item[0]}</a>"; 399 } 400 } 401 402 $pos = strpos( $menu_file, '?' ); 403 if ( false !== $pos ) { 404 $menu_file = substr( $menu_file, 0, $pos ); 405 } 406 407 if ( file_exists( ABSPATH . "wp-admin/$menu_file" ) ) { 408 $current_theme_actions[] = "<a class='button button-compact$class' href='{$item[2]}'>{$item[0]}</a>"; 409 } else { 410 $current_theme_actions[] = "<a class='button button-compact$class' href='themes.php?page={$item[2]}'>{$item[0]}</a>"; 411 } 412 } 413 } 414 } 415 416 $class_name = 'theme-browser'; 417 if ( ! empty( $_GET['search'] ) ) { 418 $class_name .= ' search-loading'; 419 } 420 ?> 421 <div class="<?php echo esc_attr( $class_name ); ?>"> 422 <div class="themes wp-clearfix"> 423 424 <?php 425 /* 426 * This PHP is synchronized with the tmpl-theme template below! 427 */ 428 429 foreach ( $themes as $theme ) : 430 $aria_action = $theme['id'] . '-action'; 431 $aria_name = $theme['id'] . '-name'; 432 433 $active_class = ''; 434 if ( $theme['active'] ) { 435 $active_class = ' active'; 436 } 437 ?> 438 <div class="theme<?php echo $active_class; ?>"> 439 <?php if ( ! empty( $theme['screenshot'][0] ) ) { ?> 440 <div class="theme-screenshot"> 441 <img src="<?php echo esc_url( $theme['screenshot'][0] . '?ver=' . $theme['version'] ); ?>" alt="" /> 442 </div> 443 <?php } else { ?> 444 <div class="theme-screenshot blank"></div> 445 <?php } ?> 446 447 <?php if ( $theme['hasUpdate'] ) : ?> 448 <?php 449 if ( $theme['updateResponse']['compatibleWP'] && $theme['updateResponse']['compatiblePHP'] ) : 450 if ( $theme['hasPackage'] ) { 451 $new_version_available = __( 'New version available. <button class="button-link" type="button">Update now</button>' ); 452 } else { 453 $new_version_available = __( 'New version available.' ); 454 } 455 wp_admin_notice( 456 $new_version_available, 457 array( 458 'type' => 'warning', 459 'additional_classes' => array( 'notice-alt', 'inline', 'update-message' ), 460 ) 461 ); 462 else : 463 $theme_update_error = ''; 464 if ( ! $theme['updateResponse']['compatibleWP'] && ! $theme['updateResponse']['compatiblePHP'] ) { 465 $theme_update_error .= sprintf( 466 /* translators: %s: Theme name. */ 467 __( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ), 468 $theme['name'] 469 ); 470 if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { 471 $theme_update_error .= sprintf( 472 /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ 473 ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), 474 self_admin_url( 'update-core.php' ), 475 esc_url( wp_get_update_php_url() ) 476 ); 477 wp_update_php_annotation( '</p><p><em>', '</em>', false ); 478 } elseif ( current_user_can( 'update_core' ) ) { 479 $theme_update_error .= sprintf( 480 /* translators: %s: URL to WordPress Updates screen. */ 481 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), 482 self_admin_url( 'update-core.php' ) 483 ); 484 } elseif ( current_user_can( 'update_php' ) ) { 485 $theme_update_error .= sprintf( 486 /* translators: %s: URL to Update PHP page. */ 487 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), 488 esc_url( wp_get_update_php_url() ) 489 ); 490 wp_update_php_annotation( '</p><p><em>', '</em>', false ); 491 } 492 } elseif ( ! $theme['updateResponse']['compatibleWP'] ) { 493 $theme_update_error .= sprintf( 494 /* translators: %s: Theme name. */ 495 __( 'There is a new version of %s available, but it does not work with your version of WordPress.' ), 496 $theme['name'] 497 ); 498 if ( current_user_can( 'update_core' ) ) { 499 $theme_update_error .= sprintf( 500 /* translators: %s: URL to WordPress Updates screen. */ 501 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), 502 self_admin_url( 'update-core.php' ) 503 ); 504 } 505 } elseif ( ! $theme['updateResponse']['compatiblePHP'] ) { 506 $theme_update_error .= sprintf( 507 /* translators: %s: Theme name. */ 508 __( 'There is a new version of %s available, but it does not work with your version of PHP.' ), 509 $theme['name'] 510 ); 511 if ( current_user_can( 'update_php' ) ) { 512 $theme_update_error .= sprintf( 513 /* translators: %s: URL to Update PHP page. */ 514 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), 515 esc_url( wp_get_update_php_url() ) 516 ); 517 wp_update_php_annotation( '</p><p><em>', '</em>', false ); 518 } 519 } 520 wp_admin_notice( 521 $theme_update_error, 522 array( 523 'type' => 'error', 524 'additional_classes' => array( 'notice-alt', 'inline', 'update-message' ), 525 ) 526 ); 527 endif; 528 endif; 529 530 if ( ! $theme['compatibleWP'] || ! $theme['compatiblePHP'] ) { 531 $message = ''; 532 if ( ! $theme['compatibleWP'] && ! $theme['compatiblePHP'] ) { 533 $message = __( 'This theme does not work with your versions of WordPress and PHP.' ); 534 if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { 535 $message .= sprintf( 536 /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ 537 ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), 538 self_admin_url( 'update-core.php' ), 539 esc_url( wp_get_update_php_url() ) 540 ); 541 $message .= wp_update_php_annotation( '</p><p><em>', '</em>', false ); 542 } elseif ( current_user_can( 'update_core' ) ) { 543 $message .= sprintf( 544 /* translators: %s: URL to WordPress Updates screen. */ 545 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), 546 self_admin_url( 'update-core.php' ) 547 ); 548 } elseif ( current_user_can( 'update_php' ) ) { 549 $message .= sprintf( 550 /* translators: %s: URL to Update PHP page. */ 551 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), 552 esc_url( wp_get_update_php_url() ) 553 ); 554 $message .= wp_update_php_annotation( '</p><p><em>', '</em>', false ); 555 } 556 } elseif ( ! $theme['compatibleWP'] ) { 557 $message .= __( 'This theme does not work with your version of WordPress.' ); 558 if ( current_user_can( 'update_core' ) ) { 559 $message .= sprintf( 560 /* translators: %s: URL to WordPress Updates screen. */ 561 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), 562 self_admin_url( 'update-core.php' ) 563 ); 564 } 565 } elseif ( ! $theme['compatiblePHP'] ) { 566 $message .= __( 'This theme does not work with your version of PHP.' ); 567 if ( current_user_can( 'update_php' ) ) { 568 $message .= sprintf( 569 /* translators: %s: URL to Update PHP page. */ 570 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), 571 esc_url( wp_get_update_php_url() ) 572 ); 573 $message .= wp_update_php_annotation( '</p><p><em>', '</em>', false ); 574 } 575 } 576 577 wp_admin_notice( 578 $message, 579 array( 580 'type' => 'error', 581 'additional_classes' => array( 'inline', 'notice-alt' ), 582 ) 583 ); 584 } 585 586 /* translators: %s: Theme name. */ 587 $details_aria_label = sprintf( _x( 'View Theme Details for %s', 'theme' ), $theme['name'] ); 588 ?> 589 <button type="button" class="more-details" id="<?php echo esc_attr( $aria_action ); ?>" 590 aria-label="<?php echo esc_attr( $details_aria_label ); ?>" 591 ><?php _e( 'Theme Details' ); ?></button> 592 <div class="theme-author"> 593 <?php 594 /* translators: %s: Theme author name. */ 595 printf( __( 'By %s' ), $theme['author'] ); 596 ?> 597 </div> 598 599 <div class="theme-id-container"> 600 <?php if ( $theme['active'] ) { ?> 601 <h2 class="theme-name" id="<?php echo esc_attr( $aria_name ); ?>"> 602 <span><?php _ex( 'Active:', 'theme' ); ?></span> <?php echo $theme['name']; ?> 603 </h2> 604 <?php } else { ?> 605 <h2 class="theme-name" id="<?php echo esc_attr( $aria_name ); ?>"><?php echo $theme['name']; ?></h2> 606 <?php } ?> 607 608 <div class="theme-actions"> 609 <?php if ( $theme['active'] ) { ?> 610 <?php 611 if ( $theme['actions']['customize'] && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { 612 /* translators: %s: Theme name. */ 613 $customize_aria_label = sprintf( _x( 'Customize %s', 'theme' ), $theme['name'] ); 614 ?> 615 <a class="button button-compact button-primary customize load-customize hide-if-no-customize" 616 href="<?php echo esc_url( $theme['actions']['customize'] ); ?>" 617 aria-label="<?php echo esc_attr( $customize_aria_label ); ?>" 618 ><?php _e( 'Customize' ); ?></a> 619 <?php } ?> 620 <?php } elseif ( $theme['compatibleWP'] && $theme['compatiblePHP'] ) { ?> 621 <?php 622 /* translators: %s: Theme name. */ 623 $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); 624 ?> 625 <a class="button button-compact activate" 626 href="<?php echo esc_url( $theme['actions']['activate'] ); ?>" 627 aria-label="<?php echo esc_attr( $aria_label ); ?>" 628 ><?php _e( 'Activate' ); ?></a> 629 630 <?php 631 // Only classic themes require the "customize" capability. 632 if ( current_user_can( 'edit_theme_options' ) && ( $theme['blockTheme'] || current_user_can( 'customize' ) ) ) { 633 /* translators: %s: Theme name. */ 634 $live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' ); 635 ?> 636 <a class="button button-compact button-primary load-customize hide-if-no-customize" 637 href="<?php echo esc_url( $theme['actions']['customize'] ); ?>" 638 aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>" 639 ><?php _e( 'Live Preview' ); ?></a> 640 <?php } ?> 641 <?php } else { ?> 642 <?php 643 /* translators: %s: Theme name. */ 644 $aria_label = sprintf( _x( 'Cannot Activate %s', 'theme' ), '{{ data.name }}' ); 645 ?> 646 <a class="button button-compact disabled" 647 aria-label="<?php echo esc_attr( $aria_label ); ?>" 648 ><?php _ex( 'Cannot Activate', 'theme' ); ?></a> 649 650 <?php 651 if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { 652 /* translators: %s: Theme name. */ 653 $live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' ); 654 ?> 655 <a class="button button-compact button-primary hide-if-no-customize disabled" 656 aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>" 657 ><?php _e( 'Live Preview' ); ?></a> 658 <?php } ?> 659 <?php } ?> 660 661 </div> 662 </div> 663 </div> 664 <?php endforeach; ?> 665 </div> 666 </div> 667 <div class="theme-overlay" tabindex="0" role="dialog" aria-label="<?php esc_attr_e( 'Theme Details' ); ?>"></div> 668 669 <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p> 670 671 <?php 672 // List broken themes, if any. 673 $broken_themes = wp_get_themes( array( 'errors' => true ) ); 674 if ( ! is_multisite() && $broken_themes ) { 675 ?> 676 677 <div class="broken-themes"> 678 <h3><?php _e( 'Broken Themes' ); ?></h3> 679 <p><?php _e( 'The following themes are installed but incomplete.' ); ?></p> 680 681 <?php 682 $can_resume = current_user_can( 'resume_themes' ); 683 $can_delete = current_user_can( 'delete_themes' ); 684 $can_install = current_user_can( 'install_themes' ); 685 ?> 686 <table> 687 <tr> 688 <th><?php _ex( 'Name', 'theme name' ); ?></th> 689 <th><?php _e( 'Description' ); ?></th> 690 <?php if ( $can_resume ) { ?> 691 <td></td> 692 <?php } ?> 693 <?php if ( $can_delete ) { ?> 694 <td></td> 695 <?php } ?> 696 <?php if ( $can_install ) { ?> 697 <td></td> 698 <?php } ?> 699 </tr> 700 <?php 701 foreach ( $broken_themes as $broken_theme ) : 702 ?> 703 <tr> 704 <td><?php echo $broken_theme->get( 'Name' ) ? $broken_theme->display( 'Name' ) : esc_html( $broken_theme->get_stylesheet() ); ?></td> 705 <td><?php echo $broken_theme->errors()->get_error_message(); ?></td> 706 <?php 707 if ( $can_resume ) { 708 if ( 'theme_paused' === $broken_theme->errors()->get_error_code() ) { 709 $stylesheet = $broken_theme->get_stylesheet(); 710 $resume_url = add_query_arg( 711 array( 712 'action' => 'resume', 713 'stylesheet' => urlencode( $stylesheet ), 714 ), 715 admin_url( 'themes.php' ) 716 ); 717 $resume_url = wp_nonce_url( $resume_url, 'resume-theme_' . $stylesheet ); 718 ?> 719 <td><a href="<?php echo esc_url( $resume_url ); ?>" class="button resume-theme"><?php _e( 'Resume' ); ?></a></td> 720 <?php 721 } else { 722 ?> 723 <td></td> 724 <?php 725 } 726 } 727 728 if ( $can_delete ) { 729 $stylesheet = $broken_theme->get_stylesheet(); 730 $delete_url = add_query_arg( 731 array( 732 'action' => 'delete', 733 'stylesheet' => urlencode( $stylesheet ), 734 ), 735 admin_url( 'themes.php' ) 736 ); 737 $delete_url = wp_nonce_url( $delete_url, 'delete-theme_' . $stylesheet ); 738 ?> 739 <td><a href="<?php echo esc_url( $delete_url ); ?>" class="button delete-theme"><?php _e( 'Delete' ); ?></a></td> 740 <?php 741 } 742 743 if ( $can_install && 'theme_no_parent' === $broken_theme->errors()->get_error_code() ) { 744 $parent_theme_name = $broken_theme->get( 'Template' ); 745 $parent_theme = themes_api( 'theme_information', array( 'slug' => urlencode( $parent_theme_name ) ) ); 746 747 if ( ! is_wp_error( $parent_theme ) ) { 748 $install_url = add_query_arg( 749 array( 750 'action' => 'install-theme', 751 'theme' => urlencode( $parent_theme_name ), 752 ), 753 admin_url( 'update.php' ) 754 ); 755 $install_url = wp_nonce_url( $install_url, 'install-theme_' . $parent_theme_name ); 756 ?> 757 <td><a href="<?php echo esc_url( $install_url ); ?>" class="button install-theme"><?php _e( 'Install Parent Theme' ); ?></a></td> 758 <?php 759 } 760 } 761 ?> 762 </tr> 763 <?php 764 endforeach; 765 ?> 766 </table> 767 </div> 768 769 <?php 770 } 771 ?> 772 </div><!-- .wrap --> 773 774 <?php 775 776 /** 777 * Returns the JavaScript template used to display the auto-update setting for a theme. 778 * 779 * @since 5.5.0 780 * 781 * @return string The template for displaying the auto-update setting link. 782 */ 783 function wp_theme_auto_update_setting_template() { 784 $notice = wp_get_admin_notice( 785 '', 786 array( 787 'type' => 'error', 788 'additional_classes' => array( 'notice-alt', 'inline', 'hidden' ), 789 ) 790 ); 791 $template = ' 792 <div class="theme-autoupdate"> 793 <# if ( data.autoupdate.supported ) { #> 794 <# if ( data.autoupdate.forced === false ) { #> 795 ' . __( 'Auto-updates disabled' ) . ' 796 <# } else if ( data.autoupdate.forced ) { #> 797 ' . __( 'Auto-updates enabled' ) . ' 798 <# } else if ( data.autoupdate.enabled ) { #> 799 <button type="button" class="toggle-auto-update button-link" data-slug="{{ data.id }}" data-wp-action="disable"> 800 <span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span><span class="label">' . __( 'Disable auto-updates' ) . '</span> 801 </button> 802 <# } else { #> 803 <button type="button" class="toggle-auto-update button-link" data-slug="{{ data.id }}" data-wp-action="enable"> 804 <span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span><span class="label">' . __( 'Enable auto-updates' ) . '</span> 805 </button> 806 <# } #> 807 <# } #> 808 <# if ( data.hasUpdate ) { #> 809 <# if ( data.autoupdate.supported && data.autoupdate.enabled ) { #> 810 <span class="auto-update-time"> 811 <# } else { #> 812 <span class="auto-update-time hidden"> 813 <# } #> 814 <br />' . wp_get_auto_update_message() . '</span> 815 <# } #> 816 ' . $notice . ' 817 </div> 818 '; 819 820 /** 821 * Filters the JavaScript template used to display the auto-update setting for a theme (in the overlay). 822 * 823 * See {@see wp_prepare_themes_for_js()} for the properties of the `data` object. 824 * 825 * @since 5.5.0 826 * 827 * @param string $template The template for displaying the auto-update setting link. 828 */ 829 return apply_filters( 'theme_auto_update_setting_template', $template ); 830 } 831 832 /* 833 * The tmpl-theme template is synchronized with PHP above! 834 */ 835 ?> 836 <script id="tmpl-theme" type="text/template"> 837 <# if ( data.screenshot[0] ) { #> 838 <div class="theme-screenshot"> 839 <img src="{{ data.screenshot[0] }}?ver={{ data.version }}" alt="" /> 840 </div> 841 <# } else { #> 842 <div class="theme-screenshot blank"></div> 843 <# } #> 844 845 <# if ( data.hasUpdate ) { #> 846 <# if ( data.updateResponse.compatibleWP && data.updateResponse.compatiblePHP ) { #> 847 <div class="update-message notice inline notice-warning notice-alt"><p> 848 <# if ( data.hasPackage ) { #> 849 <?php _e( 'New version available. <button class="button-link" type="button">Update now</button>' ); ?> 850 <# } else { #> 851 <?php _e( 'New version available.' ); ?> 852 <# } #> 853 </p></div> 854 <# } else { #> 855 <div class="update-message notice inline notice-error notice-alt"><p> 856 <# if ( ! data.updateResponse.compatibleWP && ! data.updateResponse.compatiblePHP ) { #> 857 <?php 858 printf( 859 /* translators: %s: Theme name. */ 860 __( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ), 861 '{{{ data.name }}}' 862 ); 863 if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { 864 printf( 865 /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ 866 ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), 867 self_admin_url( 'update-core.php' ), 868 esc_url( wp_get_update_php_url() ) 869 ); 870 wp_update_php_annotation( '</p><p><em>', '</em>' ); 871 } elseif ( current_user_can( 'update_core' ) ) { 872 printf( 873 /* translators: %s: URL to WordPress Updates screen. */ 874 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), 875 self_admin_url( 'update-core.php' ) 876 ); 877 } elseif ( current_user_can( 'update_php' ) ) { 878 printf( 879 /* translators: %s: URL to Update PHP page. */ 880 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), 881 esc_url( wp_get_update_php_url() ) 882 ); 883 wp_update_php_annotation( '</p><p><em>', '</em>' ); 884 } 885 ?> 886 <# } else if ( ! data.updateResponse.compatibleWP ) { #> 887 <?php 888 printf( 889 /* translators: %s: Theme name. */ 890 __( 'There is a new version of %s available, but it does not work with your version of WordPress.' ), 891 '{{{ data.name }}}' 892 ); 893 if ( current_user_can( 'update_core' ) ) { 894 printf( 895 /* translators: %s: URL to WordPress Updates screen. */ 896 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), 897 self_admin_url( 'update-core.php' ) 898 ); 899 } 900 ?> 901 <# } else if ( ! data.updateResponse.compatiblePHP ) { #> 902 <?php 903 printf( 904 /* translators: %s: Theme name. */ 905 __( 'There is a new version of %s available, but it does not work with your version of PHP.' ), 906 '{{{ data.name }}}' 907 ); 908 if ( current_user_can( 'update_php' ) ) { 909 printf( 910 /* translators: %s: URL to Update PHP page. */ 911 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), 912 esc_url( wp_get_update_php_url() ) 913 ); 914 wp_update_php_annotation( '</p><p><em>', '</em>' ); 915 } 916 ?> 917 <# } #> 918 </p></div> 919 <# } #> 920 <# } #> 921 922 <# if ( ! data.compatibleWP || ! data.compatiblePHP ) { #> 923 <div class="notice notice-error notice-alt"><p> 924 <# if ( ! data.compatibleWP && ! data.compatiblePHP ) { #> 925 <?php 926 _e( 'This theme does not work with your versions of WordPress and PHP.' ); 927 if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { 928 printf( 929 /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ 930 ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), 931 self_admin_url( 'update-core.php' ), 932 esc_url( wp_get_update_php_url() ) 933 ); 934 wp_update_php_annotation( '</p><p><em>', '</em>' ); 935 } elseif ( current_user_can( 'update_core' ) ) { 936 printf( 937 /* translators: %s: URL to WordPress Updates screen. */ 938 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), 939 self_admin_url( 'update-core.php' ) 940 ); 941 } elseif ( current_user_can( 'update_php' ) ) { 942 printf( 943 /* translators: %s: URL to Update PHP page. */ 944 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), 945 esc_url( wp_get_update_php_url() ) 946 ); 947 wp_update_php_annotation( '</p><p><em>', '</em>' ); 948 } 949 ?> 950 <# } else if ( ! data.compatibleWP ) { #> 951 <?php 952 _e( 'This theme does not work with your version of WordPress.' ); 953 if ( current_user_can( 'update_core' ) ) { 954 printf( 955 /* translators: %s: URL to WordPress Updates screen. */ 956 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), 957 self_admin_url( 'update-core.php' ) 958 ); 959 } 960 ?> 961 <# } else if ( ! data.compatiblePHP ) { #> 962 <?php 963 _e( 'This theme does not work with your version of PHP.' ); 964 if ( current_user_can( 'update_php' ) ) { 965 printf( 966 /* translators: %s: URL to Update PHP page. */ 967 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), 968 esc_url( wp_get_update_php_url() ) 969 ); 970 wp_update_php_annotation( '</p><p><em>', '</em>' ); 971 } 972 ?> 973 <# } #> 974 </p></div> 975 <# } #> 976 977 <?php 978 /* translators: %s: Theme name. */ 979 $details_aria_label = sprintf( _x( 'View Theme Details for %s', 'theme' ), '{{ data.name }}' ); 980 ?> 981 <button type="button" class="more-details" id="{{ data.id }}-action" 982 aria-label="<?php echo esc_attr( $details_aria_label ); ?>" 983 ><?php _e( 'Theme Details' ); ?></button> 984 <div class="theme-author"> 985 <?php 986 /* translators: %s: Theme author name. */ 987 printf( __( 'By %s' ), '{{{ data.author }}}' ); 988 ?> 989 </div> 990 991 <div class="theme-id-container"> 992 <# if ( data.active ) { #> 993 <h2 class="theme-name" id="{{ data.id }}-name"> 994 <span><?php _ex( 'Active:', 'theme' ); ?></span> {{{ data.name }}} 995 </h2> 996 <# } else { #> 997 <h2 class="theme-name" id="{{ data.id }}-name">{{{ data.name }}}</h2> 998 <# } #> 999 1000 <div class="theme-actions"> 1001 <# if ( data.active ) { #> 1002 <# if ( data.actions.customize ) { #> 1003 <?php 1004 /* translators: %s: Theme name. */ 1005 $customize_aria_label = sprintf( _x( 'Customize %s', 'theme' ), '{{ data.name }}' ); 1006 ?> 1007 <a class="button button-compact button-primary customize load-customize hide-if-no-customize" 1008 href="{{{ data.actions.customize }}}" 1009 aria-label="<?php echo esc_attr( $customize_aria_label ); ?>" 1010 ><?php _e( 'Customize' ); ?></a> 1011 <# } #> 1012 <# } else { #> 1013 <# if ( data.compatibleWP && data.compatiblePHP ) { #> 1014 <?php 1015 /* translators: %s: Theme name. */ 1016 $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); 1017 ?> 1018 <a class="button button-compact activate" 1019 href="{{{ data.actions.activate }}}" 1020 aria-label="<?php echo esc_attr( $aria_label ); ?>" 1021 ><?php _e( 'Activate' ); ?></a> 1022 1023 <?php 1024 /* translators: %s: Theme name. */ 1025 $live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' ); 1026 ?> 1027 <a class="button button-compact button-primary load-customize hide-if-no-customize" 1028 href="{{{ data.actions.customize }}}" 1029 aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>" 1030 ><?php _e( 'Live Preview' ); ?></a> 1031 <# } else { #> 1032 <?php 1033 /* translators: %s: Theme name. */ 1034 $aria_label = sprintf( _x( 'Cannot Activate %s', 'theme' ), '{{ data.name }}' ); 1035 ?> 1036 <a class="button button-compact disabled" 1037 aria-label="<?php echo esc_attr( $aria_label ); ?>" 1038 ><?php _ex( 'Cannot Activate', 'theme' ); ?></a> 1039 1040 <?php 1041 /* translators: %s: Theme name. */ 1042 $live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' ); 1043 ?> 1044 <a class="button button-compact button-primary hide-if-no-customize disabled" 1045 aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>" 1046 ><?php _e( 'Live Preview' ); ?></a> 1047 <# } #> 1048 <# } #> 1049 </div> 1050 </div> 1051 </script> 1052 1053 <script id="tmpl-theme-single" type="text/template"> 1054 <div class="theme-backdrop"></div> 1055 <div class="theme-wrap wp-clearfix" role="document"> 1056 <div class="theme-header"> 1057 <button class="left dashicons dashicons-no"><span class="screen-reader-text"> 1058 <?php 1059 /* translators: Hidden accessibility text. */ 1060 _e( 'Show previous theme' ); 1061 ?> 1062 </span></button> 1063 <button class="right dashicons dashicons-no"><span class="screen-reader-text"> 1064 <?php 1065 /* translators: Hidden accessibility text. */ 1066 _e( 'Show next theme' ); 1067 ?> 1068 </span></button> 1069 <button class="close dashicons dashicons-no"><span class="screen-reader-text"> 1070 <?php 1071 /* translators: Hidden accessibility text. */ 1072 _e( 'Close details dialog' ); 1073 ?> 1074 </span></button> 1075 </div> 1076 <div class="theme-about wp-clearfix"> 1077 <div class="theme-screenshots"> 1078 <# if ( data.screenshot[0] ) { #> 1079 <div class="screenshot"><img src="{{ data.screenshot[0] }}?ver={{ data.version }}" alt="" /></div> 1080 <# } else { #> 1081 <div class="screenshot blank"></div> 1082 <# } #> 1083 </div> 1084 1085 <div class="theme-info"> 1086 <# if ( data.active ) { #> 1087 <span class="current-label"><?php _e( 'Active Theme' ); ?></span> 1088 <# } #> 1089 <h2 class="theme-name">{{{ data.name }}}<span class="theme-version"> 1090 <?php 1091 /* translators: %s: Theme version. */ 1092 printf( __( 'Version: %s' ), '{{ data.version }}' ); 1093 ?> 1094 </span></h2> 1095 <p class="theme-author"> 1096 <?php 1097 /* translators: %s: Theme author link. */ 1098 printf( __( 'By %s' ), '{{{ data.authorAndUri }}}' ); 1099 ?> 1100 </p> 1101 1102 <# if ( ! data.compatibleWP || ! data.compatiblePHP ) { #> 1103 <div class="notice notice-error notice-alt notice-large"><p> 1104 <# if ( ! data.compatibleWP && ! data.compatiblePHP ) { #> 1105 <?php 1106 _e( 'This theme does not work with your versions of WordPress and PHP.' ); 1107 if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { 1108 printf( 1109 /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ 1110 ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), 1111 self_admin_url( 'update-core.php' ), 1112 esc_url( wp_get_update_php_url() ) 1113 ); 1114 wp_update_php_annotation( '</p><p><em>', '</em>' ); 1115 } elseif ( current_user_can( 'update_core' ) ) { 1116 printf( 1117 /* translators: %s: URL to WordPress Updates screen. */ 1118 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), 1119 self_admin_url( 'update-core.php' ) 1120 ); 1121 } elseif ( current_user_can( 'update_php' ) ) { 1122 printf( 1123 /* translators: %s: URL to Update PHP page. */ 1124 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), 1125 esc_url( wp_get_update_php_url() ) 1126 ); 1127 wp_update_php_annotation( '</p><p><em>', '</em>' ); 1128 } 1129 ?> 1130 <# } else if ( ! data.compatibleWP ) { #> 1131 <?php 1132 _e( 'This theme does not work with your version of WordPress.' ); 1133 if ( current_user_can( 'update_core' ) ) { 1134 printf( 1135 /* translators: %s: URL to WordPress Updates screen. */ 1136 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), 1137 self_admin_url( 'update-core.php' ) 1138 ); 1139 } 1140 ?> 1141 <# } else if ( ! data.compatiblePHP ) { #> 1142 <?php 1143 _e( 'This theme does not work with your version of PHP.' ); 1144 if ( current_user_can( 'update_php' ) ) { 1145 printf( 1146 /* translators: %s: URL to Update PHP page. */ 1147 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), 1148 esc_url( wp_get_update_php_url() ) 1149 ); 1150 wp_update_php_annotation( '</p><p><em>', '</em>' ); 1151 } 1152 ?> 1153 <# } #> 1154 </p></div> 1155 <# } #> 1156 1157 <# if ( data.hasUpdate ) { #> 1158 <# if ( data.updateResponse.compatibleWP && data.updateResponse.compatiblePHP ) { #> 1159 <div class="notice notice-warning notice-alt notice-large"> 1160 <h3 class="notice-title"><?php _e( 'Update Available' ); ?></h3> 1161 {{{ data.update }}} 1162 </div> 1163 <# } else { #> 1164 <div class="notice notice-error notice-alt notice-large"> 1165 <h3 class="notice-title"><?php _e( 'Update Incompatible' ); ?></h3> 1166 <p> 1167 <# if ( ! data.updateResponse.compatibleWP && ! data.updateResponse.compatiblePHP ) { #> 1168 <?php 1169 printf( 1170 /* translators: %s: Theme name. */ 1171 __( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ), 1172 '{{{ data.name }}}' 1173 ); 1174 if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { 1175 printf( 1176 /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ 1177 ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), 1178 self_admin_url( 'update-core.php' ), 1179 esc_url( wp_get_update_php_url() ) 1180 ); 1181 wp_update_php_annotation( '</p><p><em>', '</em>' ); 1182 } elseif ( current_user_can( 'update_core' ) ) { 1183 printf( 1184 /* translators: %s: URL to WordPress Updates screen. */ 1185 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), 1186 self_admin_url( 'update-core.php' ) 1187 ); 1188 } elseif ( current_user_can( 'update_php' ) ) { 1189 printf( 1190 /* translators: %s: URL to Update PHP page. */ 1191 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), 1192 esc_url( wp_get_update_php_url() ) 1193 ); 1194 wp_update_php_annotation( '</p><p><em>', '</em>' ); 1195 } 1196 ?> 1197 <# } else if ( ! data.updateResponse.compatibleWP ) { #> 1198 <?php 1199 printf( 1200 /* translators: %s: Theme name. */ 1201 __( 'There is a new version of %s available, but it does not work with your version of WordPress.' ), 1202 '{{{ data.name }}}' 1203 ); 1204 if ( current_user_can( 'update_core' ) ) { 1205 printf( 1206 /* translators: %s: URL to WordPress Updates screen. */ 1207 ' ' . __( '<a href="%s">Please update WordPress</a>.' ), 1208 self_admin_url( 'update-core.php' ) 1209 ); 1210 } 1211 ?> 1212 <# } else if ( ! data.updateResponse.compatiblePHP ) { #> 1213 <?php 1214 printf( 1215 /* translators: %s: Theme name. */ 1216 __( 'There is a new version of %s available, but it does not work with your version of PHP.' ), 1217 '{{{ data.name }}}' 1218 ); 1219 if ( current_user_can( 'update_php' ) ) { 1220 printf( 1221 /* translators: %s: URL to Update PHP page. */ 1222 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), 1223 esc_url( wp_get_update_php_url() ) 1224 ); 1225 wp_update_php_annotation( '</p><p><em>', '</em>' ); 1226 } 1227 ?> 1228 <# } #> 1229 </p> 1230 </div> 1231 <# } #> 1232 <# } #> 1233 1234 <# if ( data.actions.autoupdate ) { #> 1235 <?php echo wp_theme_auto_update_setting_template(); ?> 1236 <# } #> 1237 1238 <p class="theme-description">{{{ data.description }}}</p> 1239 1240 <# if ( data.parent ) { #> 1241 <p class="parent-theme"> 1242 <?php 1243 /* translators: %s: Theme name. */ 1244 printf( __( 'This is a child theme of %s.' ), '<strong>{{{ data.parent }}}</strong>' ); 1245 ?> 1246 </p> 1247 <# } #> 1248 1249 <# if ( data.tags ) { #> 1250 <p class="theme-tags"><span><?php _e( 'Tags:' ); ?></span> {{{ data.tags }}}</p> 1251 <# } #> 1252 </div> 1253 </div> 1254 1255 <div class="theme-actions"> 1256 <div class="active-theme"> 1257 <a class="button button-compact button-primary customize load-customize hide-if-no-customize" 1258 href="{{{ data.actions.customize }}}" 1259 ><?php _e( 'Customize' ); ?></a> 1260 <?php echo implode( ' ', $current_theme_actions ); ?> 1261 </div> 1262 1263 <div class="inactive-theme"> 1264 <# if ( data.compatibleWP && data.compatiblePHP ) { #> 1265 <?php 1266 /* translators: %s: Theme name. */ 1267 $live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' ); 1268 ?> 1269 <a class="button button-compact button-primary load-customize hide-if-no-customize" 1270 href="{{{ data.actions.customize }}}" 1271 aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>" 1272 ><?php _e( 'Live Preview' ); ?></a> 1273 1274 <# if ( data.actions.activate ) { #> 1275 <?php 1276 /* translators: %s: Theme name. */ 1277 $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); 1278 ?> 1279 <a class="button button-compact activate" 1280 href="{{{ data.actions.activate }}}" 1281 aria-label="<?php echo esc_attr( $aria_label ); ?>" 1282 ><?php _e( 'Activate' ); ?></a> 1283 <# } #> 1284 <# } else { #> 1285 <?php 1286 /* translators: %s: Theme name. */ 1287 $live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' ); 1288 ?> 1289 <a class="button button-compact button-primary hide-if-no-customize disabled" 1290 aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>" 1291 ><?php _e( 'Live Preview' ); ?></a> 1292 1293 <# if ( data.actions.activate ) { #> 1294 <?php 1295 /* translators: %s: Theme name. */ 1296 $aria_label = sprintf( _x( 'Cannot Activate %s', 'theme' ), '{{ data.name }}' ); 1297 ?> 1298 <a class="button button-compact disabled" 1299 aria-label="<?php echo esc_attr( $aria_label ); ?>" 1300 ><?php _ex( 'Cannot Activate', 'theme' ); ?></a> 1301 <# } #> 1302 <# } #> 1303 </div> 1304 1305 <# if ( ! data.active && data.actions['delete'] ) { #> 1306 <?php 1307 /* translators: %s: Theme name. */ 1308 $aria_label = sprintf( _x( 'Delete %s', 'theme' ), '{{ data.name }}' ); 1309 ?> 1310 <a class="button button-compact delete-theme" 1311 href="{{{ data.actions['delete'] }}}" 1312 aria-label="<?php echo esc_attr( $aria_label ); ?>" 1313 ><?php _e( 'Delete' ); ?></a> 1314 <# } #> 1315 </div> 1316 </div> 1317 </script> 1318 1319 <?php 1320 wp_print_request_filesystem_credentials_modal(); 1321 wp_print_admin_notice_templates(); 1322 wp_print_update_row_templates(); 1323 1324 wp_localize_script( 1325 'updates', 1326 '_wpUpdatesItemCounts', 1327 array( 1328 'totals' => wp_get_update_data(), 1329 ) 1330 ); 1331 1332 require_once ABSPATH . 'wp-admin/admin-footer.php';
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Wed Aug 12 08:20:21 2026 | Cross-referenced by PHPXref |