Edit File by line
/home/barbar84/www/wp-admin
File: theme-install.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Install theme administration panel.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
* @subpackage Administration
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
/** WordPress Administration Bootstrap */
[8] Fix | Delete
require_once __DIR__ . '/admin.php';
[9] Fix | Delete
require ABSPATH . 'wp-admin/includes/theme-install.php';
[10] Fix | Delete
[11] Fix | Delete
wp_reset_vars( array( 'tab' ) );
[12] Fix | Delete
[13] Fix | Delete
if ( ! current_user_can( 'install_themes' ) ) {
[14] Fix | Delete
wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) );
[15] Fix | Delete
}
[16] Fix | Delete
[17] Fix | Delete
if ( is_multisite() && ! is_network_admin() ) {
[18] Fix | Delete
wp_redirect( network_admin_url( 'theme-install.php' ) );
[19] Fix | Delete
exit;
[20] Fix | Delete
}
[21] Fix | Delete
[22] Fix | Delete
$title = __( 'Add Themes' );
[23] Fix | Delete
$parent_file = 'themes.php';
[24] Fix | Delete
[25] Fix | Delete
if ( ! is_network_admin() ) {
[26] Fix | Delete
$submenu_file = 'themes.php';
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
$installed_themes = search_theme_directories();
[30] Fix | Delete
[31] Fix | Delete
if ( false === $installed_themes ) {
[32] Fix | Delete
$installed_themes = array();
[33] Fix | Delete
}
[34] Fix | Delete
[35] Fix | Delete
foreach ( $installed_themes as $k => $v ) {
[36] Fix | Delete
if ( false !== strpos( $k, '/' ) ) {
[37] Fix | Delete
unset( $installed_themes[ $k ] );
[38] Fix | Delete
}
[39] Fix | Delete
}
[40] Fix | Delete
[41] Fix | Delete
wp_localize_script(
[42] Fix | Delete
'theme',
[43] Fix | Delete
'_wpThemeSettings',
[44] Fix | Delete
array(
[45] Fix | Delete
'themes' => false,
[46] Fix | Delete
'settings' => array(
[47] Fix | Delete
'isInstall' => true,
[48] Fix | Delete
'canInstall' => current_user_can( 'install_themes' ),
[49] Fix | Delete
'installURI' => current_user_can( 'install_themes' ) ? self_admin_url( 'theme-install.php' ) : null,
[50] Fix | Delete
'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ),
[51] Fix | Delete
),
[52] Fix | Delete
'l10n' => array(
[53] Fix | Delete
'addNew' => __( 'Add New Theme' ),
[54] Fix | Delete
'search' => __( 'Search Themes' ),
[55] Fix | Delete
'searchPlaceholder' => __( 'Search themes...' ), // Placeholder (no ellipsis).
[56] Fix | Delete
'upload' => __( 'Upload Theme' ),
[57] Fix | Delete
'back' => __( 'Back' ),
[58] Fix | Delete
'error' => sprintf(
[59] Fix | Delete
/* translators: %s: Support forums URL. */
[60] Fix | Delete
__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
[61] Fix | Delete
__( 'https://wordpress.org/support/forums/' )
[62] Fix | Delete
),
[63] Fix | Delete
'tryAgain' => __( 'Try Again' ),
[64] Fix | Delete
/* translators: %d: Number of themes. */
[65] Fix | Delete
'themesFound' => __( 'Number of Themes found: %d' ),
[66] Fix | Delete
'noThemesFound' => __( 'No themes found. Try a different search.' ),
[67] Fix | Delete
'collapseSidebar' => __( 'Collapse Sidebar' ),
[68] Fix | Delete
'expandSidebar' => __( 'Expand Sidebar' ),
[69] Fix | Delete
/* translators: Accessibility text. */
[70] Fix | Delete
'selectFeatureFilter' => __( 'Select one or more Theme features to filter by' ),
[71] Fix | Delete
),
[72] Fix | Delete
'installedThemes' => array_keys( $installed_themes ),
[73] Fix | Delete
'activeTheme' => get_stylesheet(),
[74] Fix | Delete
)
[75] Fix | Delete
);
[76] Fix | Delete
[77] Fix | Delete
wp_enqueue_script( 'theme' );
[78] Fix | Delete
wp_enqueue_script( 'updates' );
[79] Fix | Delete
[80] Fix | Delete
if ( $tab ) {
[81] Fix | Delete
/**
[82] Fix | Delete
* Fires before each of the tabs are rendered on the Install Themes page.
[83] Fix | Delete
*
[84] Fix | Delete
* The dynamic portion of the hook name, `$tab`, refers to the current
[85] Fix | Delete
* theme installation tab. Possible values are 'dashboard', 'search', 'upload',
[86] Fix | Delete
* 'featured', 'new', or 'updated'.
[87] Fix | Delete
*
[88] Fix | Delete
* @since 2.8.0
[89] Fix | Delete
*/
[90] Fix | Delete
do_action( "install_themes_pre_{$tab}" );
[91] Fix | Delete
}
[92] Fix | Delete
[93] Fix | Delete
$help_overview =
[94] Fix | Delete
'<p>' . sprintf(
[95] Fix | Delete
/* translators: %s: Theme Directory URL. */
[96] Fix | Delete
__( 'You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the <a href="%s">WordPress Theme Directory</a>. These themes are designed and developed by third parties, are available free of charge, and are compatible with the license WordPress uses.' ),
[97] Fix | Delete
__( 'https://wordpress.org/themes/' )
[98] Fix | Delete
) . '</p>' .
[99] Fix | Delete
'<p>' . __( 'You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter.' ) . ' <span id="live-search-desc">' . __( 'The search results will be updated as you type.' ) . '</span></p>' .
[100] Fix | Delete
'<p>' . __( 'Alternately, you can browse the themes that are Featured, Popular, or Latest. When you find a theme you like, you can preview it or install it.' ) . '</p>' .
[101] Fix | Delete
'<p>' . sprintf(
[102] Fix | Delete
/* translators: %s: /wp-content/themes */
[103] Fix | Delete
__( 'You can Upload a theme manually if you have already downloaded its ZIP archive onto your computer (make sure it is from a trusted and original source). You can also do it the old-fashioned way and copy a downloaded theme&#8217;s folder via FTP into your %s directory.' ),
[104] Fix | Delete
'<code>/wp-content/themes</code>'
[105] Fix | Delete
) . '</p>';
[106] Fix | Delete
[107] Fix | Delete
get_current_screen()->add_help_tab(
[108] Fix | Delete
array(
[109] Fix | Delete
'id' => 'overview',
[110] Fix | Delete
'title' => __( 'Overview' ),
[111] Fix | Delete
'content' => $help_overview,
[112] Fix | Delete
)
[113] Fix | Delete
);
[114] Fix | Delete
[115] Fix | Delete
$help_installing =
[116] Fix | Delete
'<p>' . __( 'Once you have generated a list of themes, you can preview and install any of them. Click on the thumbnail of the theme you&#8217;re interested in previewing. It will open up in a full-screen Preview page to give you a better idea of how that theme will look.' ) . '</p>' .
[117] Fix | Delete
'<p>' . __( 'To install the theme so you can preview it with your site&#8217;s content and customize its theme options, click the "Install" button at the top of the left-hand pane. The theme files will be downloaded to your website automatically. When this is complete, the theme is now available for activation, which you can do by clicking the "Activate" link, or by navigating to your Manage Themes screen and clicking the "Live Preview" link under any installed theme&#8217;s thumbnail image.' ) . '</p>';
[118] Fix | Delete
[119] Fix | Delete
get_current_screen()->add_help_tab(
[120] Fix | Delete
array(
[121] Fix | Delete
'id' => 'installing',
[122] Fix | Delete
'title' => __( 'Previewing and Installing' ),
[123] Fix | Delete
'content' => $help_installing,
[124] Fix | Delete
)
[125] Fix | Delete
);
[126] Fix | Delete
[127] Fix | Delete
get_current_screen()->set_help_sidebar(
[128] Fix | Delete
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
[129] Fix | Delete
'<p>' . __( '<a href="https://wordpress.org/support/article/using-themes/#adding-new-themes">Documentation on Adding New Themes</a>' ) . '</p>' .
[130] Fix | Delete
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
[131] Fix | Delete
);
[132] Fix | Delete
[133] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-header.php';
[134] Fix | Delete
[135] Fix | Delete
?>
[136] Fix | Delete
<div class="wrap">
[137] Fix | Delete
<h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1>
[138] Fix | Delete
[139] Fix | Delete
<?php
[140] Fix | Delete
[141] Fix | Delete
/**
[142] Fix | Delete
* Filters the tabs shown on the Add Themes screen.
[143] Fix | Delete
*
[144] Fix | Delete
* This filter is for backward compatibility only, for the suppression of the upload tab.
[145] Fix | Delete
*
[146] Fix | Delete
* @since 2.8.0
[147] Fix | Delete
*
[148] Fix | Delete
* @param string[] $tabs Associative array of the tabs shown on the Add Themes screen. Default is 'upload'.
[149] Fix | Delete
*/
[150] Fix | Delete
$tabs = apply_filters( 'install_themes_tabs', array( 'upload' => __( 'Upload Theme' ) ) );
[151] Fix | Delete
if ( ! empty( $tabs['upload'] ) && current_user_can( 'upload_themes' ) ) {
[152] Fix | Delete
echo ' <button type="button" class="upload-view-toggle page-title-action hide-if-no-js" aria-expanded="false">' . __( 'Upload Theme' ) . '</button>';
[153] Fix | Delete
}
[154] Fix | Delete
?>
[155] Fix | Delete
[156] Fix | Delete
<hr class="wp-header-end">
[157] Fix | Delete
[158] Fix | Delete
<div class="error hide-if-js">
[159] Fix | Delete
<p><?php _e( 'The Theme Installer screen requires JavaScript.' ); ?></p>
[160] Fix | Delete
</div>
[161] Fix | Delete
[162] Fix | Delete
<div class="upload-theme">
[163] Fix | Delete
<?php install_themes_upload(); ?>
[164] Fix | Delete
</div>
[165] Fix | Delete
[166] Fix | Delete
<h2 class="screen-reader-text hide-if-no-js"><?php _e( 'Filter themes list' ); ?></h2>
[167] Fix | Delete
[168] Fix | Delete
<div class="wp-filter hide-if-no-js">
[169] Fix | Delete
<div class="filter-count">
[170] Fix | Delete
<span class="count theme-count"></span>
[171] Fix | Delete
</div>
[172] Fix | Delete
[173] Fix | Delete
<ul class="filter-links">
[174] Fix | Delete
<li><a href="#" data-sort="featured"><?php _ex( 'Featured', 'themes' ); ?></a></li>
[175] Fix | Delete
<li><a href="#" data-sort="popular"><?php _ex( 'Popular', 'themes' ); ?></a></li>
[176] Fix | Delete
<li><a href="#" data-sort="new"><?php _ex( 'Latest', 'themes' ); ?></a></li>
[177] Fix | Delete
<li><a href="#" data-sort="favorites"><?php _ex( 'Favorites', 'themes' ); ?></a></li>
[178] Fix | Delete
</ul>
[179] Fix | Delete
[180] Fix | Delete
<button type="button" class="button drawer-toggle" aria-expanded="false"><?php _e( 'Feature Filter' ); ?></button>
[181] Fix | Delete
[182] Fix | Delete
<form class="search-form"></form>
[183] Fix | Delete
[184] Fix | Delete
<div class="favorites-form">
[185] Fix | Delete
<?php
[186] Fix | Delete
$action = 'save_wporg_username_' . get_current_user_id();
[187] Fix | Delete
if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_GET['_wpnonce'] ), $action ) ) {
[188] Fix | Delete
$user = isset( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' );
[189] Fix | Delete
update_user_meta( get_current_user_id(), 'wporg_favorites', $user );
[190] Fix | Delete
} else {
[191] Fix | Delete
$user = get_user_option( 'wporg_favorites' );
[192] Fix | Delete
}
[193] Fix | Delete
?>
[194] Fix | Delete
<p class="install-help"><?php _e( 'If you have marked themes as favorites on WordPress.org, you can browse them here.' ); ?></p>
[195] Fix | Delete
[196] Fix | Delete
<p>
[197] Fix | Delete
<label for="wporg-username-input"><?php _e( 'Your WordPress.org username:' ); ?></label>
[198] Fix | Delete
<input type="hidden" id="wporg-username-nonce" name="_wpnonce" value="<?php echo esc_attr( wp_create_nonce( $action ) ); ?>" />
[199] Fix | Delete
<input type="search" id="wporg-username-input" value="<?php echo esc_attr( $user ); ?>" />
[200] Fix | Delete
<input type="button" class="button favorites-form-submit" value="<?php esc_attr_e( 'Get Favorites' ); ?>" />
[201] Fix | Delete
</p>
[202] Fix | Delete
</div>
[203] Fix | Delete
[204] Fix | Delete
<div class="filter-drawer">
[205] Fix | Delete
<div class="buttons">
[206] Fix | Delete
<button type="button" class="apply-filters button"><?php _e( 'Apply Filters' ); ?><span></span></button>
[207] Fix | Delete
<button type="button" class="clear-filters button" aria-label="<?php esc_attr_e( 'Clear current filters' ); ?>"><?php _e( 'Clear' ); ?></button>
[208] Fix | Delete
</div>
[209] Fix | Delete
<?php
[210] Fix | Delete
// Use the core list, rather than the .org API, due to inconsistencies
[211] Fix | Delete
// and to ensure tags are translated.
[212] Fix | Delete
$feature_list = get_theme_feature_list( false );
[213] Fix | Delete
[214] Fix | Delete
foreach ( $feature_list as $feature_name => $features ) {
[215] Fix | Delete
echo '<fieldset class="filter-group">';
[216] Fix | Delete
$feature_name = esc_html( $feature_name );
[217] Fix | Delete
echo '<legend>' . $feature_name . '</legend>';
[218] Fix | Delete
echo '<div class="filter-group-feature">';
[219] Fix | Delete
foreach ( $features as $feature => $feature_name ) {
[220] Fix | Delete
$feature = esc_attr( $feature );
[221] Fix | Delete
echo '<input type="checkbox" id="filter-id-' . $feature . '" value="' . $feature . '" /> ';
[222] Fix | Delete
echo '<label for="filter-id-' . $feature . '">' . $feature_name . '</label>';
[223] Fix | Delete
}
[224] Fix | Delete
echo '</div>';
[225] Fix | Delete
echo '</fieldset>';
[226] Fix | Delete
}
[227] Fix | Delete
?>
[228] Fix | Delete
<div class="buttons">
[229] Fix | Delete
<button type="button" class="apply-filters button"><?php _e( 'Apply Filters' ); ?><span></span></button>
[230] Fix | Delete
<button type="button" class="clear-filters button" aria-label="<?php esc_attr_e( 'Clear current filters' ); ?>"><?php _e( 'Clear' ); ?></button>
[231] Fix | Delete
</div>
[232] Fix | Delete
<div class="filtered-by">
[233] Fix | Delete
<span><?php _e( 'Filtering by:' ); ?></span>
[234] Fix | Delete
<div class="tags"></div>
[235] Fix | Delete
<button type="button" class="button-link edit-filters"><?php _e( 'Edit Filters' ); ?></button>
[236] Fix | Delete
</div>
[237] Fix | Delete
</div>
[238] Fix | Delete
</div>
[239] Fix | Delete
<h2 class="screen-reader-text hide-if-no-js"><?php _e( 'Themes list' ); ?></h2>
[240] Fix | Delete
<div class="theme-browser content-filterable"></div>
[241] Fix | Delete
<div class="theme-install-overlay wp-full-overlay expanded"></div>
[242] Fix | Delete
[243] Fix | Delete
<p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
[244] Fix | Delete
<span class="spinner"></span>
[245] Fix | Delete
[246] Fix | Delete
<?php
[247] Fix | Delete
if ( $tab ) {
[248] Fix | Delete
/**
[249] Fix | Delete
* Fires at the top of each of the tabs on the Install Themes page.
[250] Fix | Delete
*
[251] Fix | Delete
* The dynamic portion of the hook name, `$tab`, refers to the current
[252] Fix | Delete
* theme installation tab. Possible values are 'dashboard', 'search', 'upload',
[253] Fix | Delete
* 'featured', 'new', or 'updated'.
[254] Fix | Delete
*
[255] Fix | Delete
* @since 2.8.0
[256] Fix | Delete
*
[257] Fix | Delete
* @param int $paged Number of the current page of results being viewed.
[258] Fix | Delete
*/
[259] Fix | Delete
do_action( "install_themes_{$tab}", $paged );
[260] Fix | Delete
}
[261] Fix | Delete
?>
[262] Fix | Delete
</div>
[263] Fix | Delete
[264] Fix | Delete
<script id="tmpl-theme" type="text/template">
[265] Fix | Delete
<# if ( data.screenshot_url ) { #>
[266] Fix | Delete
<div class="theme-screenshot">
[267] Fix | Delete
<img src="{{ data.screenshot_url }}" alt="" />
[268] Fix | Delete
</div>
[269] Fix | Delete
<# } else { #>
[270] Fix | Delete
<div class="theme-screenshot blank"></div>
[271] Fix | Delete
<# } #>
[272] Fix | Delete
[273] Fix | Delete
<# if ( data.installed ) { #>
[274] Fix | Delete
<div class="notice notice-success notice-alt"><p><?php _ex( 'Installed', 'theme' ); ?></p></div>
[275] Fix | Delete
<# } #>
[276] Fix | Delete
[277] Fix | Delete
<# if ( ! data.compatible_wp || ! data.compatible_php ) { #>
[278] Fix | Delete
<div class="notice notice-error notice-alt"><p>
[279] Fix | Delete
<# if ( ! data.compatible_wp && ! data.compatible_php ) { #>
[280] Fix | Delete
<?php
[281] Fix | Delete
_e( 'This theme doesn&#8217;t work with your versions of WordPress and PHP.' );
[282] Fix | Delete
if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
[283] Fix | Delete
printf(
[284] Fix | Delete
/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
[285] Fix | Delete
' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
[286] Fix | Delete
self_admin_url( 'update-core.php' ),
[287] Fix | Delete
esc_url( wp_get_update_php_url() )
[288] Fix | Delete
);
[289] Fix | Delete
wp_update_php_annotation( '</p><p><em>', '</em>' );
[290] Fix | Delete
} elseif ( current_user_can( 'update_core' ) ) {
[291] Fix | Delete
printf(
[292] Fix | Delete
/* translators: %s: URL to WordPress Updates screen. */
[293] Fix | Delete
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
[294] Fix | Delete
self_admin_url( 'update-core.php' )
[295] Fix | Delete
);
[296] Fix | Delete
} elseif ( current_user_can( 'update_php' ) ) {
[297] Fix | Delete
printf(
[298] Fix | Delete
/* translators: %s: URL to Update PHP page. */
[299] Fix | Delete
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
[300] Fix | Delete
esc_url( wp_get_update_php_url() )
[301] Fix | Delete
);
[302] Fix | Delete
wp_update_php_annotation( '</p><p><em>', '</em>' );
[303] Fix | Delete
}
[304] Fix | Delete
?>
[305] Fix | Delete
<# } else if ( ! data.compatible_wp ) { #>
[306] Fix | Delete
<?php
[307] Fix | Delete
_e( 'This theme doesn&#8217;t work with your version of WordPress.' );
[308] Fix | Delete
if ( current_user_can( 'update_core' ) ) {
[309] Fix | Delete
printf(
[310] Fix | Delete
/* translators: %s: URL to WordPress Updates screen. */
[311] Fix | Delete
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
[312] Fix | Delete
self_admin_url( 'update-core.php' )
[313] Fix | Delete
);
[314] Fix | Delete
}
[315] Fix | Delete
?>
[316] Fix | Delete
<# } else if ( ! data.compatible_php ) { #>
[317] Fix | Delete
<?php
[318] Fix | Delete
_e( 'This theme doesn&#8217;t work with your version of PHP.' );
[319] Fix | Delete
if ( current_user_can( 'update_php' ) ) {
[320] Fix | Delete
printf(
[321] Fix | Delete
/* translators: %s: URL to Update PHP page. */
[322] Fix | Delete
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
[323] Fix | Delete
esc_url( wp_get_update_php_url() )
[324] Fix | Delete
);
[325] Fix | Delete
wp_update_php_annotation( '</p><p><em>', '</em>' );
[326] Fix | Delete
}
[327] Fix | Delete
?>
[328] Fix | Delete
<# } #>
[329] Fix | Delete
</p></div>
[330] Fix | Delete
<# } #>
[331] Fix | Delete
[332] Fix | Delete
<span class="more-details"><?php _ex( 'Details &amp; Preview', 'theme' ); ?></span>
[333] Fix | Delete
<div class="theme-author">
[334] Fix | Delete
<?php
[335] Fix | Delete
/* translators: %s: Theme author name. */
[336] Fix | Delete
printf( __( 'By %s' ), '{{ data.author }}' );
[337] Fix | Delete
?>
[338] Fix | Delete
</div>
[339] Fix | Delete
[340] Fix | Delete
<div class="theme-id-container">
[341] Fix | Delete
<h3 class="theme-name">{{ data.name }}</h3>
[342] Fix | Delete
[343] Fix | Delete
<div class="theme-actions">
[344] Fix | Delete
<# if ( data.installed ) { #>
[345] Fix | Delete
<# if ( data.compatible_wp && data.compatible_php ) { #>
[346] Fix | Delete
<?php
[347] Fix | Delete
/* translators: %s: Theme name. */
[348] Fix | Delete
$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
[349] Fix | Delete
?>
[350] Fix | Delete
<# if ( data.activate_url ) { #>
[351] Fix | Delete
<# if ( ! data.active ) { #>
[352] Fix | Delete
<a class="button button-primary activate" href="{{ data.activate_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
[353] Fix | Delete
<# } else { #>
[354] Fix | Delete
<button class="button button-primary disabled"><?php _ex( 'Activated', 'theme' ); ?></button>
[355] Fix | Delete
<# } #>
[356] Fix | Delete
<# } #>
[357] Fix | Delete
<# if ( data.customize_url ) { #>
[358] Fix | Delete
<# if ( ! data.active ) { #>
[359] Fix | Delete
<a class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Live Preview' ); ?></a>
[360] Fix | Delete
<# } else { #>
[361] Fix | Delete
<a class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Customize' ); ?></a>
[362] Fix | Delete
<# } #>
[363] Fix | Delete
<# } else { #>
[364] Fix | Delete
<button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button>
[365] Fix | Delete
<# } #>
[366] Fix | Delete
<# } else { #>
[367] Fix | Delete
<?php
[368] Fix | Delete
/* translators: %s: Theme name. */
[369] Fix | Delete
$aria_label = sprintf( _x( 'Cannot Activate %s', 'theme' ), '{{ data.name }}' );
[370] Fix | Delete
?>
[371] Fix | Delete
<# if ( data.activate_url ) { #>
[372] Fix | Delete
<a class="button button-primary disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
[373] Fix | Delete
<# } #>
[374] Fix | Delete
<# if ( data.customize_url ) { #>
[375] Fix | Delete
<a class="button disabled"><?php _e( 'Live Preview' ); ?></a>
[376] Fix | Delete
<# } else { #>
[377] Fix | Delete
<button class="button disabled"><?php _e( 'Preview' ); ?></button>
[378] Fix | Delete
<# } #>
[379] Fix | Delete
<# } #>
[380] Fix | Delete
<# } else { #>
[381] Fix | Delete
<# if ( data.compatible_wp && data.compatible_php ) { #>
[382] Fix | Delete
<?php
[383] Fix | Delete
/* translators: %s: Theme name. */
[384] Fix | Delete
$aria_label = sprintf( _x( 'Install %s', 'theme' ), '{{ data.name }}' );
[385] Fix | Delete
?>
[386] Fix | Delete
<a class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}" href="{{ data.install_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Install' ); ?></a>
[387] Fix | Delete
<button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button>
[388] Fix | Delete
<# } else { #>
[389] Fix | Delete
<?php
[390] Fix | Delete
/* translators: %s: Theme name. */
[391] Fix | Delete
$aria_label = sprintf( _x( 'Cannot Install %s', 'theme' ), '{{ data.name }}' );
[392] Fix | Delete
?>
[393] Fix | Delete
<a class="button button-primary disabled" data-name="{{ data.name }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _ex( 'Cannot Install', 'theme' ); ?></a>
[394] Fix | Delete
<button class="button disabled"><?php _e( 'Preview' ); ?></button>
[395] Fix | Delete
<# } #>
[396] Fix | Delete
<# } #>
[397] Fix | Delete
</div>
[398] Fix | Delete
</div>
[399] Fix | Delete
</script>
[400] Fix | Delete
[401] Fix | Delete
<script id="tmpl-theme-preview" type="text/template">
[402] Fix | Delete
<div class="wp-full-overlay-sidebar">
[403] Fix | Delete
<div class="wp-full-overlay-header">
[404] Fix | Delete
<button class="close-full-overlay"><span class="screen-reader-text"><?php _e( 'Close' ); ?></span></button>
[405] Fix | Delete
<button class="previous-theme"><span class="screen-reader-text"><?php _e( 'Previous theme' ); ?></span></button>
[406] Fix | Delete
<button class="next-theme"><span class="screen-reader-text"><?php _e( 'Next theme' ); ?></span></button>
[407] Fix | Delete
<# if ( data.installed ) { #>
[408] Fix | Delete
<# if ( data.compatible_wp && data.compatible_php ) { #>
[409] Fix | Delete
<?php
[410] Fix | Delete
/* translators: %s: Theme name. */
[411] Fix | Delete
$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
[412] Fix | Delete
?>
[413] Fix | Delete
<# if ( ! data.active ) { #>
[414] Fix | Delete
<a class="button button-primary activate" href="{{ data.activate_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
[415] Fix | Delete
<# } else { #>
[416] Fix | Delete
<button class="button button-primary disabled"><?php _ex( 'Activated', 'theme' ); ?></button>
[417] Fix | Delete
<# } #>
[418] Fix | Delete
<# } else { #>
[419] Fix | Delete
<a class="button button-primary disabled" ><?php _ex( 'Cannot Activate', 'theme' ); ?></a>
[420] Fix | Delete
<# } #>
[421] Fix | Delete
<# } else { #>
[422] Fix | Delete
<# if ( data.compatible_wp && data.compatible_php ) { #>
[423] Fix | Delete
<a href="{{ data.install_url }}" class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></a>
[424] Fix | Delete
<# } else { #>
[425] Fix | Delete
<a class="button button-primary disabled" ><?php _ex( 'Cannot Install', 'theme' ); ?></a>
[426] Fix | Delete
<# } #>
[427] Fix | Delete
<# } #>
[428] Fix | Delete
</div>
[429] Fix | Delete
<div class="wp-full-overlay-sidebar-content">
[430] Fix | Delete
<div class="install-theme-info">
[431] Fix | Delete
<h3 class="theme-name">{{ data.name }}</h3>
[432] Fix | Delete
<span class="theme-by">
[433] Fix | Delete
<?php
[434] Fix | Delete
/* translators: %s: Theme author name. */
[435] Fix | Delete
printf( __( 'By %s' ), '{{ data.author }}' );
[436] Fix | Delete
?>
[437] Fix | Delete
</span>
[438] Fix | Delete
[439] Fix | Delete
<img class="theme-screenshot" src="{{ data.screenshot_url }}" alt="" />
[440] Fix | Delete
[441] Fix | Delete
<div class="theme-details">
[442] Fix | Delete
<# if ( data.rating ) { #>
[443] Fix | Delete
<div class="theme-rating">
[444] Fix | Delete
{{{ data.stars }}}
[445] Fix | Delete
<a class="num-ratings" href="{{ data.reviews_url }}">
[446] Fix | Delete
<?php
[447] Fix | Delete
/* translators: %s: Number of ratings. */
[448] Fix | Delete
printf( __( '(%s ratings)' ), '{{ data.num_ratings }}' );
[449] Fix | Delete
?>
[450] Fix | Delete
</a>
[451] Fix | Delete
</div>
[452] Fix | Delete
<# } else { #>
[453] Fix | Delete
<span class="no-rating"><?php _e( 'This theme has not been rated yet.' ); ?></span>
[454] Fix | Delete
<# } #>
[455] Fix | Delete
[456] Fix | Delete
<div class="theme-version">
[457] Fix | Delete
<?php
[458] Fix | Delete
/* translators: %s: Theme version. */
[459] Fix | Delete
printf( __( 'Version: %s' ), '{{ data.version }}' );
[460] Fix | Delete
?>
[461] Fix | Delete
</div>
[462] Fix | Delete
[463] Fix | Delete
<# if ( ! data.compatible_wp || ! data.compatible_php ) { #>
[464] Fix | Delete
<div class="notice notice-error notice-alt notice-large"><p>
[465] Fix | Delete
<# if ( ! data.compatible_wp && ! data.compatible_php ) { #>
[466] Fix | Delete
<?php
[467] Fix | Delete
_e( 'This theme doesn&#8217;t work with your versions of WordPress and PHP.' );
[468] Fix | Delete
if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
[469] Fix | Delete
printf(
[470] Fix | Delete
/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
[471] Fix | Delete
' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
[472] Fix | Delete
self_admin_url( 'update-core.php' ),
[473] Fix | Delete
esc_url( wp_get_update_php_url() )
[474] Fix | Delete
);
[475] Fix | Delete
wp_update_php_annotation( '</p><p><em>', '</em>' );
[476] Fix | Delete
} elseif ( current_user_can( 'update_core' ) ) {
[477] Fix | Delete
printf(
[478] Fix | Delete
/* translators: %s: URL to WordPress Updates screen. */
[479] Fix | Delete
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
[480] Fix | Delete
self_admin_url( 'update-core.php' )
[481] Fix | Delete
);
[482] Fix | Delete
} elseif ( current_user_can( 'update_php' ) ) {
[483] Fix | Delete
printf(
[484] Fix | Delete
/* translators: %s: URL to Update PHP page. */
[485] Fix | Delete
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
[486] Fix | Delete
esc_url( wp_get_update_php_url() )
[487] Fix | Delete
);
[488] Fix | Delete
wp_update_php_annotation( '</p><p><em>', '</em>' );
[489] Fix | Delete
}
[490] Fix | Delete
?>
[491] Fix | Delete
<# } else if ( ! data.compatible_wp ) { #>
[492] Fix | Delete
<?php
[493] Fix | Delete
_e( 'This theme doesn&#8217;t work with your version of WordPress.' );
[494] Fix | Delete
if ( current_user_can( 'update_core' ) ) {
[495] Fix | Delete
printf(
[496] Fix | Delete
/* translators: %s: URL to WordPress Updates screen. */
[497] Fix | Delete
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
[498] Fix | Delete
self_admin_url( 'update-core.php' )
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function