#39; ),
  • self_admin_url( 'update-core.php' )
  • );
  • } elseif ( current_user_can( 'update_php' ) ) {
  • printf(
  • /* translators: %s: URL to Update PHP page. */
  • ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
  • esc_url( wp_get_update_php_url() )
  • );
  • wp_update_php_annotation( '</p><p><em>', '</em>' );
  • }
  • ?>
  • <# } else if ( ! data.compatibleWP ) { #>
  • <?php
  • _e( 'This theme doesn&#8217;t work with your version of WordPress.' );
  • if ( current_user_can( 'update_core' ) ) {
  • printf(
  • /* translators: %s: URL to WordPress Updates screen. */
  • ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
  • self_admin_url( 'update-core.php' )
  • );
  • }
  • ?>
  • <# } else if ( ! data.compatiblePHP ) { #>
  • <?php
  • _e( 'This theme doesn&#8217;t work with your version of PHP.' );
  • if ( current_user_can( 'update_php' ) ) {
  • printf(
  • /* translators: %s: URL to Update PHP page. */
  • ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
  • esc_url( wp_get_update_php_url() )
  • );
  • wp_update_php_annotation( '</p><p><em>', '</em>' );
  • }
  • ?>
  • <# } #>
  • </p></div>
  • <# } #>
  • <p class="theme-description">{{{ data.description }}}</p>
  • <# if ( data.tags ) { #>
  • <p class="theme-tags"><span><?php _e( 'Tags:' ); ?></span> {{{ data.tags }}}</p>
  • <# } #>
  • </div>
  • </div>
  • <div class="theme-actions">
  • <# if ( data.active ) { #>
  • <button type="button" class="button button-primary customize-theme"><?php _e( 'Customize' ); ?></button>
  • <# } else if ( 'installed' === data.type ) { #>
  • <?php if ( current_user_can( 'delete_themes' ) ) { ?>
  • <# if ( data.actions && data.actions['delete'] ) { #>
  • <a href="{{{ data.actions['delete'] }}}" data-slug="{{ data.id }}" class="button button-secondary delete-theme"><?php _e( 'Delete' ); ?></a>
  • <# } #>
  • <?php } ?>
  • <# if ( data.compatibleWP && data.compatiblePHP ) { #>
  • <button type="button" class="button button-primary preview-theme" data-slug="{{ data.id }}"><?php _e( 'Live Preview' ); ?></button>
  • <# } else { #>
  • <button class="button button-primary disabled"><?php _e( 'Live Preview' ); ?></button>
  • <# } #>
  • <# } else { #>
  • <# if ( data.compatibleWP && data.compatiblePHP ) { #>
  • <button type="button" class="button theme-install" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></button>
  • <button type="button" class="button button-primary theme-install preview" data-slug="{{ data.id }}"><?php _e( 'Install &amp; Preview' ); ?></button>
  • <# } else { #>
  • <button type="button" class="button disabled"><?php _ex( 'Cannot Install', 'theme' ); ?></button>
  • <button type="button" class="button button-primary disabled"><?php _e( 'Install &amp; Preview' ); ?></button>
  • <# } #>
  • <# } #>
  • </div>
  • </div>
  • </script>
  • <?php
  • }
  • /**
  • * Determines whether a theme is technically active but was paused while
  • * loading.
  • *
  • * For more information on this and similar theme functions, check out
  • * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
  • * Conditional Tags} article in the Theme Developer Handbook.
  • *
  • * @since 5.2.0
  • *
  • * @param string $theme Path to the theme directory relative to the themes directory.
  • * @return bool True, if in the list of paused themes. False, not in the list.
  • */
  • function is_theme_paused( $theme ) {
  • if ( ! isset( $GLOBALS['_paused_themes'] ) ) {
  • return false;
  • }
  • if ( get_stylesheet() !== $theme && get_template() !== $theme ) {
  • return false;
  • }
  • return array_key_exists( $theme, $GLOBALS['_paused_themes'] );
  • }
  • /**
  • * Gets the error that was recorded for a paused theme.
  • *
  • * @since 5.2.0
  • *
  • * @param string $theme Path to the theme directory relative to the themes
  • * directory.
  • * @return array|false Array of error information as it was returned by
  • * `error_get_last()`, or false if none was recorded.
  • */
  • function wp_get_theme_error( $theme ) {
  • if ( ! isset( $GLOBALS['_paused_themes'] ) ) {
  • return false;
  • }
  • if ( ! array_key_exists( $theme, $GLOBALS['_paused_themes'] ) ) {
  • return false;
  • }
  • return $GLOBALS['_paused_themes'][ $theme ];
  • }
  • /**
  • * Tries to resume a single theme.
  • *
  • * If a redirect was provided and a functions.php file was found, we first ensure that
  • * functions.php file does not throw fatal errors anymore.
  • *
  • * The way it works is by setting the redirection to the error before trying to
  • * include the file. If the theme fails, then the redirection will not be overwritten
  • * with the success message and the theme will not be resumed.
  • *
  • * @since 5.2.0
  • *
  • * @param string $theme Single theme to resume.
  • * @param string $redirect Optional. URL to redirect to. Default empty string.
  • * @return bool|WP_Error True on success, false if `$theme` was not paused,
  • * `WP_Error` on failure.
  • */
  • function resume_theme( $theme, $redirect = '' ) {
  • list( $extension ) = explode( '/', $theme );
  • /*
  • * We'll override this later if the theme could be resumed without
  • * creating a fatal error.
  • */
  • if ( ! empty( $redirect ) ) {
  • $functions_path = '';
  • if ( strpos( STYLESHEETPATH, $extension ) ) {
  • $functions_path = STYLESHEETPATH . '/functions.php';
  • } elseif ( strpos( TEMPLATEPATH, $extension ) ) {
  • $functions_path = TEMPLATEPATH . '/functions.php';
  • }
  • if ( ! empty( $functions_path ) ) {
  • wp_redirect(
  • add_query_arg(
  • '_error_nonce',
  • wp_create_nonce( 'theme-resume-error_' . $theme ),
  • $redirect
  • )
  • );
  • // Load the theme's functions.php to test whether it throws a fatal error.
  • ob_start();
  • if ( ! defined( 'WP_SANDBOX_SCRAPING' ) ) {
  • define( 'WP_SANDBOX_SCRAPING', true );
  • }
  • include $functions_path;
  • ob_clean();
  • }
  • }
  • $result = wp_paused_themes()->delete( $extension );
  • if ( ! $result ) {
  • return new WP_Error(
  • 'could_not_resume_theme',
  • __( 'Could not resume the theme.' )
  • );
  • }
  • return true;
  • }
  • /**
  • * Renders an admin notice in case some themes have been paused due to errors.
  • *
  • * @since 5.2.0
  • *
  • * @global string $pagenow
  • */
  • function paused_themes_notice() {
  • if ( 'themes.php' === $GLOBALS['pagenow'] ) {
  • return;
  • }
  • if ( ! current_user_can( 'resume_themes' ) ) {
  • return;
  • }
  • if ( ! isset( $GLOBALS['_paused_themes'] ) || empty( $GLOBALS['_paused_themes'] ) ) {
  • return;
  • }
  • printf(
  • '<div class="notice notice-error"><p><strong>%s</strong><br>%s</p><p><a href="%s">%s</a></p></div>',
  • __( 'One or more themes failed to load properly.' ),
  • __( 'You can find more details and make changes on the Themes screen.' ),
  • esc_url( admin_url( 'themes.php' ) ),
  • __( 'Go to the Themes screen' )
  • );
  • }
  • tum/shaqfindbeds - Gogs: Simplico Git Service

    暫無描述

    Tum 81a3998249 fix static 5 年之前
    ..
    main.js 81a3998249 fix static 5 年之前