Edit File by line
/home/barbar84/public_h.../wp-admin
File: themes.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Themes 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
[10] Fix | Delete
if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) ) {
[11] Fix | Delete
wp_die(
[12] Fix | Delete
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
[13] Fix | Delete
'<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>',
[14] Fix | Delete
403
[15] Fix | Delete
);
[16] Fix | Delete
}
[17] Fix | Delete
[18] Fix | Delete
if ( current_user_can( 'switch_themes' ) && isset( $_GET['action'] ) ) {
[19] Fix | Delete
if ( 'activate' === $_GET['action'] ) {
[20] Fix | Delete
check_admin_referer( 'switch-theme_' . $_GET['stylesheet'] );
[21] Fix | Delete
$theme = wp_get_theme( $_GET['stylesheet'] );
[22] Fix | Delete
[23] Fix | Delete
if ( ! $theme->exists() || ! $theme->is_allowed() ) {
[24] Fix | Delete
wp_die(
[25] Fix | Delete
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
[26] Fix | Delete
'<p>' . __( 'The requested theme does not exist.' ) . '</p>',
[27] Fix | Delete
403
[28] Fix | Delete
);
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
switch_theme( $theme->get_stylesheet() );
[32] Fix | Delete
wp_redirect( admin_url( 'themes.php?activated=true' ) );
[33] Fix | Delete
exit;
[34] Fix | Delete
} elseif ( 'resume' === $_GET['action'] ) {
[35] Fix | Delete
check_admin_referer( 'resume-theme_' . $_GET['stylesheet'] );
[36] Fix | Delete
$theme = wp_get_theme( $_GET['stylesheet'] );
[37] Fix | Delete
[38] Fix | Delete
if ( ! current_user_can( 'resume_theme', $_GET['stylesheet'] ) ) {
[39] Fix | Delete
wp_die(
[40] Fix | Delete
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
[41] Fix | Delete
'<p>' . __( 'Sorry, you are not allowed to resume this theme.' ) . '</p>',
[42] Fix | Delete
403
[43] Fix | Delete
);
[44] Fix | Delete
}
[45] Fix | Delete
[46] Fix | Delete
$result = resume_theme( $theme->get_stylesheet(), self_admin_url( 'themes.php?error=resuming' ) );
[47] Fix | Delete
[48] Fix | Delete
if ( is_wp_error( $result ) ) {
[49] Fix | Delete
wp_die( $result );
[50] Fix | Delete
}
[51] Fix | Delete
[52] Fix | Delete
wp_redirect( admin_url( 'themes.php?resumed=true' ) );
[53] Fix | Delete
exit;
[54] Fix | Delete
} elseif ( 'delete' === $_GET['action'] ) {
[55] Fix | Delete
check_admin_referer( 'delete-theme_' . $_GET['stylesheet'] );
[56] Fix | Delete
$theme = wp_get_theme( $_GET['stylesheet'] );
[57] Fix | Delete
[58] Fix | Delete
if ( ! current_user_can( 'delete_themes' ) ) {
[59] Fix | Delete
wp_die(
[60] Fix | Delete
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
[61] Fix | Delete
'<p>' . __( 'Sorry, you are not allowed to delete this item.' ) . '</p>',
[62] Fix | Delete
403
[63] Fix | Delete
);
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
if ( ! $theme->exists() ) {
[67] Fix | Delete
wp_die(
[68] Fix | Delete
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
[69] Fix | Delete
'<p>' . __( 'The requested theme does not exist.' ) . '</p>',
[70] Fix | Delete
403
[71] Fix | Delete
);
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
$active = wp_get_theme();
[75] Fix | Delete
if ( $active->get( 'Template' ) == $_GET['stylesheet'] ) {
[76] Fix | Delete
wp_redirect( admin_url( 'themes.php?delete-active-child=true' ) );
[77] Fix | Delete
} else {
[78] Fix | Delete
delete_theme( $_GET['stylesheet'] );
[79] Fix | Delete
wp_redirect( admin_url( 'themes.php?deleted=true' ) );
[80] Fix | Delete
}
[81] Fix | Delete
exit;
[82] Fix | Delete
} elseif ( 'enable-auto-update' === $_GET['action'] ) {
[83] Fix | Delete
if ( ! ( current_user_can( 'update_themes' ) && wp_is_auto_update_enabled_for_type( 'theme' ) ) ) {
[84] Fix | Delete
wp_die( __( 'Sorry, you are not allowed to enable themes automatic updates.' ) );
[85] Fix | Delete
}
[86] Fix | Delete
[87] Fix | Delete
check_admin_referer( 'updates' );
[88] Fix | Delete
[89] Fix | Delete
$all_items = wp_get_themes();
[90] Fix | Delete
$auto_updates = (array) get_site_option( 'auto_update_themes', array() );
[91] Fix | Delete
[92] Fix | Delete
$auto_updates[] = $_GET['stylesheet'];
[93] Fix | Delete
$auto_updates = array_unique( $auto_updates );
[94] Fix | Delete
// Remove themes that have been deleted since the site option was last updated.
[95] Fix | Delete
$auto_updates = array_intersect( $auto_updates, array_keys( $all_items ) );
[96] Fix | Delete
[97] Fix | Delete
update_site_option( 'auto_update_themes', $auto_updates );
[98] Fix | Delete
[99] Fix | Delete
wp_redirect( admin_url( 'themes.php?enabled-auto-update=true' ) );
[100] Fix | Delete
[101] Fix | Delete
exit;
[102] Fix | Delete
} elseif ( 'disable-auto-update' === $_GET['action'] ) {
[103] Fix | Delete
if ( ! ( current_user_can( 'update_themes' ) && wp_is_auto_update_enabled_for_type( 'theme' ) ) ) {
[104] Fix | Delete
wp_die( __( 'Sorry, you are not allowed to disable themes automatic updates.' ) );
[105] Fix | Delete
}
[106] Fix | Delete
[107] Fix | Delete
check_admin_referer( 'updates' );
[108] Fix | Delete
[109] Fix | Delete
$all_items = wp_get_themes();
[110] Fix | Delete
$auto_updates = (array) get_site_option( 'auto_update_themes', array() );
[111] Fix | Delete
[112] Fix | Delete
$auto_updates = array_diff( $auto_updates, array( $_GET['stylesheet'] ) );
[113] Fix | Delete
// Remove themes that have been deleted since the site option was last updated.
[114] Fix | Delete
$auto_updates = array_intersect( $auto_updates, array_keys( $all_items ) );
[115] Fix | Delete
[116] Fix | Delete
update_site_option( 'auto_update_themes', $auto_updates );
[117] Fix | Delete
[118] Fix | Delete
wp_redirect( admin_url( 'themes.php?disabled-auto-update=true' ) );
[119] Fix | Delete
[120] Fix | Delete
exit;
[121] Fix | Delete
}
[122] Fix | Delete
}
[123] Fix | Delete
[124] Fix | Delete
$title = __( 'Manage Themes' );
[125] Fix | Delete
$parent_file = 'themes.php';
[126] Fix | Delete
[127] Fix | Delete
// Help tab: Overview.
[128] Fix | Delete
if ( current_user_can( 'switch_themes' ) ) {
[129] Fix | Delete
$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>' .
[130] Fix | Delete
'<p>' . __( 'From this screen you can:' ) . '</p>' .
[131] Fix | Delete
'<ul><li>' . __( 'Hover or tap to see Activate and Live Preview buttons' ) . '</li>' .
[132] Fix | Delete
'<li>' . __( 'Click on the theme to see the theme name, version, author, description, tags, and the Delete link' ) . '</li>' .
[133] Fix | Delete
'<li>' . __( 'Click Customize for the current theme or Live Preview for any other theme to see a live preview' ) . '</li></ul>' .
[134] Fix | Delete
'<p>' . __( 'The current theme is displayed highlighted as the first theme.' ) . '</p>' .
[135] Fix | Delete
'<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>';
[136] Fix | Delete
[137] Fix | Delete
get_current_screen()->add_help_tab(
[138] Fix | Delete
array(
[139] Fix | Delete
'id' => 'overview',
[140] Fix | Delete
'title' => __( 'Overview' ),
[141] Fix | Delete
'content' => $help_overview,
[142] Fix | Delete
)
[143] Fix | Delete
);
[144] Fix | Delete
} // End if 'switch_themes'.
[145] Fix | Delete
[146] Fix | Delete
// Help tab: Adding Themes.
[147] Fix | Delete
if ( current_user_can( 'install_themes' ) ) {
[148] Fix | Delete
if ( is_multisite() ) {
[149] Fix | Delete
$help_install = '<p>' . __( 'Installing themes on Multisite can only be done from the Network Admin section.' ) . '</p>';
[150] Fix | Delete
} else {
[151] Fix | Delete
$help_install = '<p>' . sprintf(
[152] Fix | Delete
/* translators: %s: https://wordpress.org/themes/ */
[153] Fix | Delete
__( 'If you would like to see more themes to choose from, click on the &#8220;Add New&#8221; button and you will be able to browse or search for additional themes from the <a href="%s">WordPress Theme Directory</a>. Themes in the WordPress Theme Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they&#8217;re free!' ),
[154] Fix | Delete
__( 'https://wordpress.org/themes/' )
[155] Fix | Delete
) . '</p>';
[156] Fix | Delete
}
[157] Fix | Delete
[158] Fix | Delete
get_current_screen()->add_help_tab(
[159] Fix | Delete
array(
[160] Fix | Delete
'id' => 'adding-themes',
[161] Fix | Delete
'title' => __( 'Adding Themes' ),
[162] Fix | Delete
'content' => $help_install,
[163] Fix | Delete
)
[164] Fix | Delete
);
[165] Fix | Delete
} // End if 'install_themes'.
[166] Fix | Delete
[167] Fix | Delete
// Help tab: Previewing and Customizing.
[168] Fix | Delete
if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
[169] Fix | Delete
$help_customize =
[170] Fix | Delete
'<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>' .
[171] Fix | Delete
'<p>' . __( 'The theme being previewed is fully interactive &mdash; navigate to different pages to see how the theme handles posts, archives, and other page templates. The settings may differ depending on what theme features the theme being previewed supports. To accept the new settings and activate the theme all in one step, click the Activate &amp; Publish button above the menu.' ) . '</p>' .
[172] Fix | Delete
'<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>';
[173] Fix | Delete
[174] Fix | Delete
get_current_screen()->add_help_tab(
[175] Fix | Delete
array(
[176] Fix | Delete
'id' => 'customize-preview-themes',
[177] Fix | Delete
'title' => __( 'Previewing and Customizing' ),
[178] Fix | Delete
'content' => $help_customize,
[179] Fix | Delete
)
[180] Fix | Delete
);
[181] Fix | Delete
} // End if 'edit_theme_options' && 'customize'.
[182] Fix | Delete
[183] Fix | Delete
$help_sidebar_autoupdates = '';
[184] Fix | Delete
[185] Fix | Delete
// Help tab: Auto-updates.
[186] Fix | Delete
if ( current_user_can( 'update_themes' ) && wp_is_auto_update_enabled_for_type( 'theme' ) ) {
[187] Fix | Delete
$help_tab_autoupdates =
[188] Fix | Delete
'<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>' .
[189] Fix | Delete
'<p>' . __( 'Please note: Third-party themes and plugins, or custom code, may override WordPress scheduling.' ) . '</p>';
[190] Fix | Delete
[191] Fix | Delete
get_current_screen()->add_help_tab(
[192] Fix | Delete
array(
[193] Fix | Delete
'id' => 'plugins-themes-auto-updates',
[194] Fix | Delete
'title' => __( 'Auto-updates' ),
[195] Fix | Delete
'content' => $help_tab_autoupdates,
[196] Fix | Delete
)
[197] Fix | Delete
);
[198] Fix | Delete
[199] Fix | Delete
$help_sidebar_autoupdates = '<p>' . __( '<a href="https://wordpress.org/support/article/plugins-themes-auto-updates/">Learn more: Auto-updates documentation</a>' ) . '</p>';
[200] Fix | Delete
} // End if 'update_themes' && 'wp_is_auto_update_enabled_for_type'.
[201] Fix | Delete
[202] Fix | Delete
get_current_screen()->set_help_sidebar(
[203] Fix | Delete
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
[204] Fix | Delete
'<p>' . __( '<a href="https://wordpress.org/support/article/using-themes/">Documentation on Using Themes</a>' ) . '</p>' .
[205] Fix | Delete
$help_sidebar_autoupdates .
[206] Fix | Delete
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
[207] Fix | Delete
);
[208] Fix | Delete
[209] Fix | Delete
if ( current_user_can( 'switch_themes' ) ) {
[210] Fix | Delete
$themes = wp_prepare_themes_for_js();
[211] Fix | Delete
} else {
[212] Fix | Delete
$themes = wp_prepare_themes_for_js( array( wp_get_theme() ) );
[213] Fix | Delete
}
[214] Fix | Delete
wp_reset_vars( array( 'theme', 'search' ) );
[215] Fix | Delete
[216] Fix | Delete
wp_localize_script(
[217] Fix | Delete
'theme',
[218] Fix | Delete
'_wpThemeSettings',
[219] Fix | Delete
array(
[220] Fix | Delete
'themes' => $themes,
[221] Fix | Delete
'settings' => array(
[222] Fix | Delete
'canInstall' => ( ! is_multisite() && current_user_can( 'install_themes' ) ),
[223] Fix | Delete
'installURI' => ( ! is_multisite() && current_user_can( 'install_themes' ) ) ? admin_url( 'theme-install.php' ) : null,
[224] Fix | Delete
'confirmDelete' => __( "Are you sure you want to delete this theme?\n\nClick 'Cancel' to go back, 'OK' to confirm the delete." ),
[225] Fix | Delete
'adminUrl' => parse_url( admin_url(), PHP_URL_PATH ),
[226] Fix | Delete
),
[227] Fix | Delete
'l10n' => array(
[228] Fix | Delete
'addNew' => __( 'Add New Theme' ),
[229] Fix | Delete
'search' => __( 'Search Installed Themes' ),
[230] Fix | Delete
'searchPlaceholder' => __( 'Search installed themes...' ), // Placeholder (no ellipsis).
[231] Fix | Delete
/* translators: %d: Number of themes. */
[232] Fix | Delete
'themesFound' => __( 'Number of Themes found: %d' ),
[233] Fix | Delete
'noThemesFound' => __( 'No themes found. Try a different search.' ),
[234] Fix | Delete
),
[235] Fix | Delete
)
[236] Fix | Delete
);
[237] Fix | Delete
[238] Fix | Delete
add_thickbox();
[239] Fix | Delete
wp_enqueue_script( 'theme' );
[240] Fix | Delete
wp_enqueue_script( 'updates' );
[241] Fix | Delete
[242] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-header.php';
[243] Fix | Delete
?>
[244] Fix | Delete
[245] Fix | Delete
<div class="wrap">
[246] Fix | Delete
<h1 class="wp-heading-inline"><?php esc_html_e( 'Themes' ); ?>
[247] Fix | Delete
<span class="title-count theme-count"><?php echo ! empty( $_GET['search'] ) ? __( '&hellip;' ) : count( $themes ); ?></span>
[248] Fix | Delete
</h1>
[249] Fix | Delete
[250] Fix | Delete
<?php if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?>
[251] Fix | Delete
<a href="<?php echo admin_url( 'theme-install.php' ); ?>" class="hide-if-no-js page-title-action"><?php echo esc_html_x( 'Add New', 'theme' ); ?></a>
[252] Fix | Delete
<?php endif; ?>
[253] Fix | Delete
[254] Fix | Delete
<form class="search-form"></form>
[255] Fix | Delete
[256] Fix | Delete
<hr class="wp-header-end">
[257] Fix | Delete
<?php
[258] Fix | Delete
if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) {
[259] Fix | Delete
?>
[260] Fix | Delete
<div id="message1" class="updated notice is-dismissible"><p><?php _e( 'The active theme is broken. Reverting to the default theme.' ); ?></p></div>
[261] Fix | Delete
<?php
[262] Fix | Delete
} elseif ( isset( $_GET['activated'] ) ) {
[263] Fix | Delete
if ( isset( $_GET['previewed'] ) ) {
[264] Fix | Delete
?>
[265] Fix | Delete
<div id="message2" class="updated notice is-dismissible"><p><?php _e( 'Settings saved and theme activated.' ); ?> <a href="<?php echo home_url( '/' ); ?>"><?php _e( 'Visit site' ); ?></a></p></div>
[266] Fix | Delete
<?php
[267] Fix | Delete
} else {
[268] Fix | Delete
?>
[269] Fix | Delete
<div id="message2" class="updated notice is-dismissible"><p><?php _e( 'New theme activated.' ); ?> <a href="<?php echo home_url( '/' ); ?>"><?php _e( 'Visit site' ); ?></a></p></div>
[270] Fix | Delete
<?php
[271] Fix | Delete
}
[272] Fix | Delete
} elseif ( isset( $_GET['deleted'] ) ) {
[273] Fix | Delete
?>
[274] Fix | Delete
<div id="message3" class="updated notice is-dismissible"><p><?php _e( 'Theme deleted.' ); ?></p></div>
[275] Fix | Delete
<?php
[276] Fix | Delete
} elseif ( isset( $_GET['delete-active-child'] ) ) {
[277] Fix | Delete
?>
[278] Fix | Delete
<div id="message4" class="error"><p><?php _e( 'You cannot delete a theme while it has an active child theme.' ); ?></p></div>
[279] Fix | Delete
<?php
[280] Fix | Delete
} elseif ( isset( $_GET['resumed'] ) ) {
[281] Fix | Delete
?>
[282] Fix | Delete
<div id="message5" class="updated notice is-dismissible"><p><?php _e( 'Theme resumed.' ); ?></p></div>
[283] Fix | Delete
<?php
[284] Fix | Delete
} elseif ( isset( $_GET['error'] ) && 'resuming' === $_GET['error'] ) {
[285] Fix | Delete
?>
[286] Fix | Delete
<div id="message6" class="error"><p><?php _e( 'Theme could not be resumed because it triggered a <strong>fatal error</strong>.' ); ?></p></div>
[287] Fix | Delete
<?php
[288] Fix | Delete
} elseif ( isset( $_GET['enabled-auto-update'] ) ) {
[289] Fix | Delete
?>
[290] Fix | Delete
<div id="message7" class="updated notice is-dismissible"><p><?php _e( 'Theme will be auto-updated.' ); ?></p></div>
[291] Fix | Delete
<?php
[292] Fix | Delete
} elseif ( isset( $_GET['disabled-auto-update'] ) ) {
[293] Fix | Delete
?>
[294] Fix | Delete
<div id="message8" class="updated notice is-dismissible"><p><?php _e( 'Theme will no longer be auto-updated.' ); ?></p></div>
[295] Fix | Delete
<?php
[296] Fix | Delete
}
[297] Fix | Delete
[298] Fix | Delete
$ct = wp_get_theme();
[299] Fix | Delete
[300] Fix | Delete
if ( $ct->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) {
[301] Fix | Delete
echo '<div class="error"><p>' . __( 'Error:' ) . ' ' . $ct->errors()->get_error_message() . '</p></div>';
[302] Fix | Delete
}
[303] Fix | Delete
[304] Fix | Delete
/*
[305] Fix | Delete
// Certain error codes are less fatal than others. We can still display theme information in most cases.
[306] Fix | Delete
if ( ! $ct->errors() || ( 1 === count( $ct->errors()->get_error_codes() )
[307] Fix | Delete
&& in_array( $ct->errors()->get_error_code(), array( 'theme_no_parent', 'theme_parent_invalid', 'theme_no_index' ) ) ) ) : ?>
[308] Fix | Delete
*/
[309] Fix | Delete
[310] Fix | Delete
// Pretend you didn't see this.
[311] Fix | Delete
$current_theme_actions = array();
[312] Fix | Delete
if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) {
[313] Fix | Delete
foreach ( (array) $submenu['themes.php'] as $item ) {
[314] Fix | Delete
$class = '';
[315] Fix | Delete
if ( 'themes.php' === $item[2] || 'theme-editor.php' === $item[2] || 0 === strpos( $item[2], 'customize.php' ) ) {
[316] Fix | Delete
continue;
[317] Fix | Delete
}
[318] Fix | Delete
// 0 = name, 1 = capability, 2 = file.
[319] Fix | Delete
if ( ( strcmp( $self, $item[2] ) == 0 && empty( $parent_file ) ) || ( $parent_file && ( $item[2] == $parent_file ) ) ) {
[320] Fix | Delete
$class = ' current';
[321] Fix | Delete
}
[322] Fix | Delete
if ( ! empty( $submenu[ $item[2] ] ) ) {
[323] Fix | Delete
$submenu[ $item[2] ] = array_values( $submenu[ $item[2] ] ); // Re-index.
[324] Fix | Delete
$menu_hook = get_plugin_page_hook( $submenu[ $item[2] ][0][2], $item[2] );
[325] Fix | Delete
if ( file_exists( WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}" ) || ! empty( $menu_hook ) ) {
[326] Fix | Delete
$current_theme_actions[] = "<a class='button$class' href='admin.php?page={$submenu[$item[2]][0][2]}'>{$item[0]}</a>";
[327] Fix | Delete
} else {
[328] Fix | Delete
$current_theme_actions[] = "<a class='button$class' href='{$submenu[$item[2]][0][2]}'>{$item[0]}</a>";
[329] Fix | Delete
}
[330] Fix | Delete
} elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) {
[331] Fix | Delete
$menu_file = $item[2];
[332] Fix | Delete
[333] Fix | Delete
if ( current_user_can( 'customize' ) ) {
[334] Fix | Delete
if ( 'custom-header' === $menu_file ) {
[335] Fix | Delete
$current_theme_actions[] = "<a class='button hide-if-no-customize$class' href='customize.php?autofocus[control]=header_image'>{$item[0]}</a>";
[336] Fix | Delete
} elseif ( 'custom-background' === $menu_file ) {
[337] Fix | Delete
$current_theme_actions[] = "<a class='button hide-if-no-customize$class' href='customize.php?autofocus[control]=background_image'>{$item[0]}</a>";
[338] Fix | Delete
}
[339] Fix | Delete
}
[340] Fix | Delete
[341] Fix | Delete
$pos = strpos( $menu_file, '?' );
[342] Fix | Delete
if ( false !== $pos ) {
[343] Fix | Delete
$menu_file = substr( $menu_file, 0, $pos );
[344] Fix | Delete
}
[345] Fix | Delete
[346] Fix | Delete
if ( file_exists( ABSPATH . "wp-admin/$menu_file" ) ) {
[347] Fix | Delete
$current_theme_actions[] = "<a class='button$class' href='{$item[2]}'>{$item[0]}</a>";
[348] Fix | Delete
} else {
[349] Fix | Delete
$current_theme_actions[] = "<a class='button$class' href='themes.php?page={$item[2]}'>{$item[0]}</a>";
[350] Fix | Delete
}
[351] Fix | Delete
}
[352] Fix | Delete
}
[353] Fix | Delete
}
[354] Fix | Delete
[355] Fix | Delete
?>
[356] Fix | Delete
[357] Fix | Delete
<?php
[358] Fix | Delete
$class_name = 'theme-browser';
[359] Fix | Delete
if ( ! empty( $_GET['search'] ) ) {
[360] Fix | Delete
$class_name .= ' search-loading';
[361] Fix | Delete
}
[362] Fix | Delete
?>
[363] Fix | Delete
<div class="<?php echo esc_attr( $class_name ); ?>">
[364] Fix | Delete
<div class="themes wp-clearfix">
[365] Fix | Delete
[366] Fix | Delete
<?php
[367] Fix | Delete
/*
[368] Fix | Delete
* This PHP is synchronized with the tmpl-theme template below!
[369] Fix | Delete
*/
[370] Fix | Delete
[371] Fix | Delete
foreach ( $themes as $theme ) :
[372] Fix | Delete
$aria_action = esc_attr( $theme['id'] . '-action' );
[373] Fix | Delete
$aria_name = esc_attr( $theme['id'] . '-name' );
[374] Fix | Delete
[375] Fix | Delete
$active_class = '';
[376] Fix | Delete
if ( $theme['active'] ) {
[377] Fix | Delete
$active_class = ' active';
[378] Fix | Delete
}
[379] Fix | Delete
?>
[380] Fix | Delete
<div class="theme<?php echo $active_class; ?>" tabindex="0" aria-describedby="<?php echo $aria_action . ' ' . $aria_name; ?>">
[381] Fix | Delete
<?php if ( ! empty( $theme['screenshot'][0] ) ) { ?>
[382] Fix | Delete
<div class="theme-screenshot">
[383] Fix | Delete
<img src="<?php echo $theme['screenshot'][0]; ?>" alt="" />
[384] Fix | Delete
</div>
[385] Fix | Delete
<?php } else { ?>
[386] Fix | Delete
<div class="theme-screenshot blank"></div>
[387] Fix | Delete
<?php } ?>
[388] Fix | Delete
[389] Fix | Delete
<?php if ( $theme['hasUpdate'] ) : ?>
[390] Fix | Delete
<?php if ( $theme['updateResponse']['compatibleWP'] && $theme['updateResponse']['compatiblePHP'] ) : ?>
[391] Fix | Delete
<div class="update-message notice inline notice-warning notice-alt"><p>
[392] Fix | Delete
<?php if ( $theme['hasPackage'] ) : ?>
[393] Fix | Delete
<?php _e( 'New version available. <button class="button-link" type="button">Update now</button>' ); ?>
[394] Fix | Delete
<?php else : ?>
[395] Fix | Delete
<?php _e( 'New version available.' ); ?>
[396] Fix | Delete
<?php endif; ?>
[397] Fix | Delete
</p></div>
[398] Fix | Delete
<?php else : ?>
[399] Fix | Delete
<div class="update-message notice inline notice-error notice-alt"><p>
[400] Fix | Delete
<?php
[401] Fix | Delete
if ( ! $theme['updateResponse']['compatibleWP'] && ! $theme['updateResponse']['compatiblePHP'] ) {
[402] Fix | Delete
printf(
[403] Fix | Delete
/* translators: %s: Theme name. */
[404] Fix | Delete
__( 'There is a new version of %s available, but it doesn&#8217;t work with your versions of WordPress and PHP.' ),
[405] Fix | Delete
$theme['name']
[406] Fix | Delete
);
[407] Fix | Delete
if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
[408] Fix | Delete
printf(
[409] Fix | Delete
/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
[410] Fix | Delete
' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
[411] Fix | Delete
self_admin_url( 'update-core.php' ),
[412] Fix | Delete
esc_url( wp_get_update_php_url() )
[413] Fix | Delete
);
[414] Fix | Delete
wp_update_php_annotation( '</p><p><em>', '</em>' );
[415] Fix | Delete
} elseif ( current_user_can( 'update_core' ) ) {
[416] Fix | Delete
printf(
[417] Fix | Delete
/* translators: %s: URL to WordPress Updates screen. */
[418] Fix | Delete
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
[419] Fix | Delete
self_admin_url( 'update-core.php' )
[420] Fix | Delete
);
[421] Fix | Delete
} elseif ( current_user_can( 'update_php' ) ) {
[422] Fix | Delete
printf(
[423] Fix | Delete
/* translators: %s: URL to Update PHP page. */
[424] Fix | Delete
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
[425] Fix | Delete
esc_url( wp_get_update_php_url() )
[426] Fix | Delete
);
[427] Fix | Delete
wp_update_php_annotation( '</p><p><em>', '</em>' );
[428] Fix | Delete
}
[429] Fix | Delete
} elseif ( ! $theme['updateResponse']['compatibleWP'] ) {
[430] Fix | Delete
printf(
[431] Fix | Delete
/* translators: %s: Theme name. */
[432] Fix | Delete
__( 'There is a new version of %s available, but it doesn&#8217;t work with your version of WordPress.' ),
[433] Fix | Delete
$theme['name']
[434] Fix | Delete
);
[435] Fix | Delete
if ( current_user_can( 'update_core' ) ) {
[436] Fix | Delete
printf(
[437] Fix | Delete
/* translators: %s: URL to WordPress Updates screen. */
[438] Fix | Delete
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
[439] Fix | Delete
self_admin_url( 'update-core.php' )
[440] Fix | Delete
);
[441] Fix | Delete
}
[442] Fix | Delete
} elseif ( ! $theme['updateResponse']['compatiblePHP'] ) {
[443] Fix | Delete
printf(
[444] Fix | Delete
/* translators: %s: Theme name. */
[445] Fix | Delete
__( 'There is a new version of %s available, but it doesn&#8217;t work with your version of PHP.' ),
[446] Fix | Delete
$theme['name']
[447] Fix | Delete
);
[448] Fix | Delete
if ( current_user_can( 'update_php' ) ) {
[449] Fix | Delete
printf(
[450] Fix | Delete
/* translators: %s: URL to Update PHP page. */
[451] Fix | Delete
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
[452] Fix | Delete
esc_url( wp_get_update_php_url() )
[453] Fix | Delete
);
[454] Fix | Delete
wp_update_php_annotation( '</p><p><em>', '</em>' );
[455] Fix | Delete
}
[456] Fix | Delete
}
[457] Fix | Delete
?>
[458] Fix | Delete
</p></div>
[459] Fix | Delete
<?php endif; ?>
[460] Fix | Delete
<?php endif; ?>
[461] Fix | Delete
[462] Fix | Delete
<?php
[463] Fix | Delete
if ( ! $theme['compatibleWP'] || ! $theme['compatiblePHP'] ) {
[464] Fix | Delete
echo '<div class="notice inline notice-error notice-alt"><p>';
[465] Fix | Delete
if ( ! $theme['compatibleWP'] && ! $theme['compatiblePHP'] ) {
[466] Fix | Delete
_e( 'This theme doesn&#8217;t work with your versions of WordPress and PHP.' );
[467] Fix | Delete
if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
[468] Fix | Delete
printf(
[469] Fix | Delete
/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
[470] Fix | Delete
' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
[471] Fix | Delete
self_admin_url( 'update-core.php' ),
[472] Fix | Delete
esc_url( wp_get_update_php_url() )
[473] Fix | Delete
);
[474] Fix | Delete
wp_update_php_annotation( '</p><p><em>', '</em>' );
[475] Fix | Delete
} elseif ( current_user_can( 'update_core' ) ) {
[476] Fix | Delete
printf(
[477] Fix | Delete
/* translators: %s: URL to WordPress Updates screen. */
[478] Fix | Delete
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
[479] Fix | Delete
self_admin_url( 'update-core.php' )
[480] Fix | Delete
);
[481] Fix | Delete
} elseif ( current_user_can( 'update_php' ) ) {
[482] Fix | Delete
printf(
[483] Fix | Delete
/* translators: %s: URL to Update PHP page. */
[484] Fix | Delete
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
[485] Fix | Delete
esc_url( wp_get_update_php_url() )
[486] Fix | Delete
);
[487] Fix | Delete
wp_update_php_annotation( '</p><p><em>', '</em>' );
[488] Fix | Delete
}
[489] Fix | Delete
} elseif ( ! $theme['compatibleWP'] ) {
[490] Fix | Delete
_e( 'This theme doesn&#8217;t work with your version of WordPress.' );
[491] Fix | Delete
if ( current_user_can( 'update_core' ) ) {
[492] Fix | Delete
printf(
[493] Fix | Delete
/* translators: %s: URL to WordPress Updates screen. */
[494] Fix | Delete
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
[495] Fix | Delete
self_admin_url( 'update-core.php' )
[496] Fix | Delete
);
[497] Fix | Delete
}
[498] Fix | Delete
} elseif ( ! $theme['compatiblePHP'] ) {
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function