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