Edit File by line
/home/zeestwma/ceyloniy.../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>' . __( 'An error occurred.' ) . '</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>' . __( 'An error occurred while deleting the theme.' ) . '</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
// Used in the HTML title tag.
[125] Fix | Delete
$title = __( 'Themes' );
[126] Fix | Delete
$parent_file = 'themes.php';
[127] Fix | Delete
[128] Fix | Delete
// Help tab: Overview.
[129] Fix | Delete
if ( current_user_can( 'switch_themes' ) ) {
[130] 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>' .
[131] Fix | Delete
'<p>' . __( 'From this screen you can:' ) . '</p>' .
[132] Fix | Delete
'<ul><li>' . __( 'Hover or tap to see Activate and Live Preview buttons' ) . '</li>' .
[133] Fix | Delete
'<li>' . __( 'Click on the theme to see the theme name, version, author, description, tags, and the Delete link' ) . '</li>' .
[134] Fix | Delete
'<li>' . __( 'Click Customize for the active theme or Live Preview for any other theme to see a live preview' ) . '</li></ul>' .
[135] Fix | Delete
'<p>' . __( 'The active theme is displayed highlighted as the first theme.' ) . '</p>' .
[136] 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>';
[137] Fix | Delete
[138] Fix | Delete
get_current_screen()->add_help_tab(
[139] Fix | Delete
array(
[140] Fix | Delete
'id' => 'overview',
[141] Fix | Delete
'title' => __( 'Overview' ),
[142] Fix | Delete
'content' => $help_overview,
[143] Fix | Delete
)
[144] Fix | Delete
);
[145] Fix | Delete
} // End if 'switch_themes'.
[146] Fix | Delete
[147] Fix | Delete
// Help tab: Adding Themes.
[148] Fix | Delete
if ( current_user_can( 'install_themes' ) ) {
[149] Fix | Delete
if ( is_multisite() ) {
[150] Fix | Delete
$help_install = '<p>' . __( 'Installing themes on Multisite can only be done from the Network Admin section.' ) . '</p>';
[151] Fix | Delete
} else {
[152] Fix | Delete
$help_install = '<p>' . sprintf(
[153] Fix | Delete
/* translators: %s: https://wordpress.org/themes/ */
[154] Fix | Delete
__( 'If you would like to see more themes to choose from, click on the &#8220;Add Theme&#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 are free!' ),
[155] Fix | Delete
__( 'https://wordpress.org/themes/' )
[156] Fix | Delete
) . '</p>';
[157] Fix | Delete
}
[158] Fix | Delete
[159] Fix | Delete
get_current_screen()->add_help_tab(
[160] Fix | Delete
array(
[161] Fix | Delete
'id' => 'adding-themes',
[162] Fix | Delete
'title' => __( 'Adding Themes' ),
[163] Fix | Delete
'content' => $help_install,
[164] Fix | Delete
)
[165] Fix | Delete
);
[166] Fix | Delete
} // End if 'install_themes'.
[167] Fix | Delete
[168] Fix | Delete
// Help tab: Previewing and Customizing.
[169] Fix | Delete
if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
[170] Fix | Delete
$help_customize =
[171] 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>' .
[172] 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>' .
[173] 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>';
[174] Fix | Delete
[175] Fix | Delete
get_current_screen()->add_help_tab(
[176] Fix | Delete
array(
[177] Fix | Delete
'id' => 'customize-preview-themes',
[178] Fix | Delete
'title' => __( 'Previewing and Customizing' ),
[179] Fix | Delete
'content' => $help_customize,
[180] Fix | Delete
)
[181] Fix | Delete
);
[182] Fix | Delete
} // End if 'edit_theme_options' && 'customize'.
[183] Fix | Delete
[184] Fix | Delete
$help_sidebar_autoupdates = '';
[185] Fix | Delete
[186] Fix | Delete
// Help tab: Auto-updates.
[187] Fix | Delete
if ( current_user_can( 'update_themes' ) && wp_is_auto_update_enabled_for_type( 'theme' ) ) {
[188] Fix | Delete
$help_tab_autoupdates =
[189] 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>' .
[190] Fix | Delete
'<p>' . __( 'Please note: Third-party themes and plugins, or custom code, may override WordPress scheduling.' ) . '</p>';
[191] Fix | Delete
[192] Fix | Delete
get_current_screen()->add_help_tab(
[193] Fix | Delete
array(
[194] Fix | Delete
'id' => 'plugins-themes-auto-updates',
[195] Fix | Delete
'title' => __( 'Auto-updates' ),
[196] Fix | Delete
'content' => $help_tab_autoupdates,
[197] Fix | Delete
)
[198] Fix | Delete
);
[199] Fix | Delete
[200] Fix | Delete
$help_sidebar_autoupdates = '<p>' . __( '<a href="https://wordpress.org/documentation/article/plugins-themes-auto-updates/">Documentation on Auto-updates</a>' ) . '</p>';
[201] Fix | Delete
} // End if 'update_themes' && 'wp_is_auto_update_enabled_for_type'.
[202] Fix | Delete
[203] Fix | Delete
get_current_screen()->set_help_sidebar(
[204] Fix | Delete
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
[205] Fix | Delete
'<p>' . __( '<a href="https://wordpress.org/documentation/article/work-with-themes/">Documentation on Using Themes</a>' ) . '</p>' .
[206] Fix | Delete
'<p>' . __( '<a href="https://wordpress.org/documentation/article/appearance-themes-screen/">Documentation on Managing Themes</a>' ) . '</p>' .
[207] Fix | Delete
$help_sidebar_autoupdates .
[208] Fix | Delete
'<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
[209] Fix | Delete
);
[210] Fix | Delete
[211] Fix | Delete
if ( current_user_can( 'switch_themes' ) ) {
[212] Fix | Delete
$themes = wp_prepare_themes_for_js();
[213] Fix | Delete
} else {
[214] Fix | Delete
$themes = wp_prepare_themes_for_js( array( wp_get_theme() ) );
[215] Fix | Delete
}
[216] Fix | Delete
[217] Fix | Delete
$theme = ! empty( $_REQUEST['theme'] ) ? sanitize_text_field( $_REQUEST['theme'] ) : '';
[218] Fix | Delete
$search = ! empty( $_REQUEST['search'] ) ? sanitize_text_field( $_REQUEST['search'] ) : '';
[219] Fix | Delete
[220] Fix | Delete
wp_localize_script(
[221] Fix | Delete
'theme',
[222] Fix | Delete
'_wpThemeSettings',
[223] Fix | Delete
array(
[224] Fix | Delete
'themes' => $themes,
[225] Fix | Delete
'settings' => array(
[226] Fix | Delete
'canInstall' => ( ! is_multisite() && current_user_can( 'install_themes' ) ),
[227] Fix | Delete
'installURI' => ( ! is_multisite() && current_user_can( 'install_themes' ) ) ? admin_url( 'theme-install.php' ) : null,
[228] Fix | Delete
'confirmDelete' => __( "Are you sure you want to delete this theme?\n\nClick 'Cancel' to go back, 'OK' to confirm the delete." ),
[229] Fix | Delete
'adminUrl' => parse_url( admin_url(), PHP_URL_PATH ),
[230] Fix | Delete
),
[231] Fix | Delete
'l10n' => array(
[232] Fix | Delete
'addNew' => __( 'Add Theme' ),
[233] Fix | Delete
'search' => __( 'Search installed themes' ),
[234] Fix | Delete
/* translators: %d: Number of themes. */
[235] Fix | Delete
'themesFound' => __( 'Number of Themes found: %d' ),
[236] Fix | Delete
'noThemesFound' => __( 'No themes found. Try a different search.' ),
[237] Fix | Delete
),
[238] Fix | Delete
)
[239] Fix | Delete
);
[240] Fix | Delete
[241] Fix | Delete
add_thickbox();
[242] Fix | Delete
wp_enqueue_script( 'theme' );
[243] Fix | Delete
wp_enqueue_script( 'updates' );
[244] Fix | Delete
[245] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-header.php';
[246] Fix | Delete
?>
[247] Fix | Delete
[248] Fix | Delete
<div class="wrap">
[249] Fix | Delete
<h1 class="wp-heading-inline"><?php esc_html_e( 'Themes' ); ?>
[250] Fix | Delete
<span class="title-count theme-count"><?php echo ! empty( $_GET['search'] ) ? __( '&hellip;' ) : count( $themes ); ?></span>
[251] Fix | Delete
</h1>
[252] Fix | Delete
<?php if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?>
[253] Fix | Delete
<a href="<?php echo esc_url( admin_url( 'theme-install.php' ) ); ?>" class="hide-if-no-js page-title-action"><?php echo esc_html__( 'Add Theme' ); ?></a>
[254] Fix | Delete
<?php endif; ?>
[255] Fix | Delete
<hr class="wp-header-end">
[256] Fix | Delete
<form class="search-form search-themes"><p class="search-box"></p></form>
[257] Fix | Delete
[258] Fix | Delete
<?php
[259] Fix | Delete
if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) {
[260] Fix | Delete
wp_admin_notice(
[261] Fix | Delete
__( 'The active theme is broken. Reverting to the default theme.' ),
[262] Fix | Delete
array(
[263] Fix | Delete
'id' => 'message1',
[264] Fix | Delete
'additional_classes' => array( 'updated' ),
[265] Fix | Delete
'dismissible' => true,
[266] Fix | Delete
)
[267] Fix | Delete
);
[268] Fix | Delete
} elseif ( isset( $_GET['activated'] ) ) {
[269] Fix | Delete
if ( isset( $_GET['previewed'] ) ) {
[270] Fix | Delete
wp_admin_notice(
[271] Fix | Delete
__( 'Settings saved and theme activated.' ) . ' <a href="' . esc_url( home_url( '/' ) ) . '">' . __( 'Visit site' ) . '</a>',
[272] Fix | Delete
array(
[273] Fix | Delete
'id' => 'message2',
[274] Fix | Delete
'additional_classes' => array( 'updated' ),
[275] Fix | Delete
'dismissible' => true,
[276] Fix | Delete
)
[277] Fix | Delete
);
[278] Fix | Delete
} else {
[279] Fix | Delete
wp_admin_notice(
[280] Fix | Delete
__( 'New theme activated.' ) . ' <a href="' . esc_url( home_url( '/' ) ) . '">' . __( 'Visit site' ) . '</a>',
[281] Fix | Delete
array(
[282] Fix | Delete
'id' => 'message2',
[283] Fix | Delete
'additional_classes' => array( 'updated' ),
[284] Fix | Delete
'dismissible' => true,
[285] Fix | Delete
)
[286] Fix | Delete
);
[287] Fix | Delete
}
[288] Fix | Delete
} elseif ( isset( $_GET['deleted'] ) ) {
[289] Fix | Delete
wp_admin_notice(
[290] Fix | Delete
__( 'Theme deleted.' ),
[291] Fix | Delete
array(
[292] Fix | Delete
'id' => 'message3',
[293] Fix | Delete
'additional_classes' => array( 'updated' ),
[294] Fix | Delete
'dismissible' => true,
[295] Fix | Delete
)
[296] Fix | Delete
);
[297] Fix | Delete
} elseif ( isset( $_GET['delete-active-child'] ) ) {
[298] Fix | Delete
wp_admin_notice(
[299] Fix | Delete
__( 'You cannot delete a theme while it has an active child theme.' ),
[300] Fix | Delete
array(
[301] Fix | Delete
'id' => 'message4',
[302] Fix | Delete
'additional_classes' => array( 'error' ),
[303] Fix | Delete
)
[304] Fix | Delete
);
[305] Fix | Delete
} elseif ( isset( $_GET['resumed'] ) ) {
[306] Fix | Delete
wp_admin_notice(
[307] Fix | Delete
__( 'Theme resumed.' ),
[308] Fix | Delete
array(
[309] Fix | Delete
'id' => 'message5',
[310] Fix | Delete
'additional_classes' => array( 'updated' ),
[311] Fix | Delete
'dismissible' => true,
[312] Fix | Delete
)
[313] Fix | Delete
);
[314] Fix | Delete
} elseif ( isset( $_GET['error'] ) && 'resuming' === $_GET['error'] ) {
[315] Fix | Delete
wp_admin_notice(
[316] Fix | Delete
__( 'Theme could not be resumed because it triggered a <strong>fatal error</strong>.' ),
[317] Fix | Delete
array(
[318] Fix | Delete
'id' => 'message6',
[319] Fix | Delete
'additional_classes' => array( 'error' ),
[320] Fix | Delete
)
[321] Fix | Delete
);
[322] Fix | Delete
} elseif ( isset( $_GET['enabled-auto-update'] ) ) {
[323] Fix | Delete
wp_admin_notice(
[324] Fix | Delete
__( 'Theme will be auto-updated.' ),
[325] Fix | Delete
array(
[326] Fix | Delete
'id' => 'message7',
[327] Fix | Delete
'additional_classes' => array( 'updated' ),
[328] Fix | Delete
'dismissible' => true,
[329] Fix | Delete
)
[330] Fix | Delete
);
[331] Fix | Delete
} elseif ( isset( $_GET['disabled-auto-update'] ) ) {
[332] Fix | Delete
wp_admin_notice(
[333] Fix | Delete
__( 'Theme will no longer be auto-updated.' ),
[334] Fix | Delete
array(
[335] Fix | Delete
'id' => 'message8',
[336] Fix | Delete
'additional_classes' => array( 'updated' ),
[337] Fix | Delete
'dismissible' => true,
[338] Fix | Delete
)
[339] Fix | Delete
);
[340] Fix | Delete
}
[341] Fix | Delete
[342] Fix | Delete
$current_theme = wp_get_theme();
[343] Fix | Delete
[344] Fix | Delete
if ( $current_theme->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) {
[345] Fix | Delete
wp_admin_notice(
[346] Fix | Delete
'<strong>' . __( 'Error:' ) . '</strong> ' . $current_theme->errors()->get_error_message(),
[347] Fix | Delete
array(
[348] Fix | Delete
'additional_classes' => array( 'error' ),
[349] Fix | Delete
)
[350] Fix | Delete
);
[351] Fix | Delete
}
[352] Fix | Delete
[353] Fix | Delete
$current_theme_actions = array();
[354] Fix | Delete
[355] Fix | Delete
if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) {
[356] Fix | Delete
$forbidden_paths = array(
[357] Fix | Delete
'themes.php',
[358] Fix | Delete
'theme-editor.php',
[359] Fix | Delete
'site-editor.php',
[360] Fix | Delete
'edit.php?post_type=wp_navigation',
[361] Fix | Delete
);
[362] Fix | Delete
[363] Fix | Delete
foreach ( (array) $submenu['themes.php'] as $item ) {
[364] Fix | Delete
$class = '';
[365] Fix | Delete
[366] Fix | Delete
if ( in_array( $item[2], $forbidden_paths, true ) || str_starts_with( $item[2], 'customize.php' ) ) {
[367] Fix | Delete
continue;
[368] Fix | Delete
}
[369] Fix | Delete
[370] Fix | Delete
// 0 = name, 1 = capability, 2 = file.
[371] Fix | Delete
if ( 0 === strcmp( $self, $item[2] ) && empty( $parent_file )
[372] Fix | Delete
|| $parent_file && $item[2] === $parent_file
[373] Fix | Delete
) {
[374] Fix | Delete
$class = ' current';
[375] Fix | Delete
}
[376] Fix | Delete
[377] Fix | Delete
if ( ! empty( $submenu[ $item[2] ] ) ) {
[378] Fix | Delete
$submenu[ $item[2] ] = array_values( $submenu[ $item[2] ] ); // Re-index.
[379] Fix | Delete
$menu_hook = get_plugin_page_hook( $submenu[ $item[2] ][0][2], $item[2] );
[380] Fix | Delete
[381] Fix | Delete
if ( file_exists( WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}" ) || ! empty( $menu_hook ) ) {
[382] Fix | Delete
$current_theme_actions[] = "<a class='button$class' href='admin.php?page={$submenu[$item[2]][0][2]}'>{$item[0]}</a>";
[383] Fix | Delete
} else {
[384] Fix | Delete
$current_theme_actions[] = "<a class='button$class' href='{$submenu[$item[2]][0][2]}'>{$item[0]}</a>";
[385] Fix | Delete
}
[386] Fix | Delete
} elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) {
[387] Fix | Delete
$menu_file = $item[2];
[388] Fix | Delete
[389] Fix | Delete
if ( current_user_can( 'customize' ) ) {
[390] Fix | Delete
if ( 'custom-header' === $menu_file ) {
[391] Fix | Delete
$current_theme_actions[] = "<a class='button hide-if-no-customize$class' href='customize.php?autofocus[control]=header_image'>{$item[0]}</a>";
[392] Fix | Delete
} elseif ( 'custom-background' === $menu_file ) {
[393] Fix | Delete
$current_theme_actions[] = "<a class='button hide-if-no-customize$class' href='customize.php?autofocus[control]=background_image'>{$item[0]}</a>";
[394] Fix | Delete
}
[395] Fix | Delete
}
[396] Fix | Delete
[397] Fix | Delete
$pos = strpos( $menu_file, '?' );
[398] Fix | Delete
if ( false !== $pos ) {
[399] Fix | Delete
$menu_file = substr( $menu_file, 0, $pos );
[400] Fix | Delete
}
[401] Fix | Delete
[402] Fix | Delete
if ( file_exists( ABSPATH . "wp-admin/$menu_file" ) ) {
[403] Fix | Delete
$current_theme_actions[] = "<a class='button$class' href='{$item[2]}'>{$item[0]}</a>";
[404] Fix | Delete
} else {
[405] Fix | Delete
$current_theme_actions[] = "<a class='button$class' href='themes.php?page={$item[2]}'>{$item[0]}</a>";
[406] Fix | Delete
}
[407] Fix | Delete
}
[408] Fix | Delete
}
[409] Fix | Delete
}
[410] Fix | Delete
[411] Fix | Delete
$class_name = 'theme-browser';
[412] Fix | Delete
if ( ! empty( $_GET['search'] ) ) {
[413] Fix | Delete
$class_name .= ' search-loading';
[414] Fix | Delete
}
[415] Fix | Delete
?>
[416] Fix | Delete
<div class="<?php echo esc_attr( $class_name ); ?>">
[417] Fix | Delete
<div class="themes wp-clearfix">
[418] Fix | Delete
[419] Fix | Delete
<?php
[420] Fix | Delete
/*
[421] Fix | Delete
* This PHP is synchronized with the tmpl-theme template below!
[422] Fix | Delete
*/
[423] Fix | Delete
[424] Fix | Delete
foreach ( $themes as $theme ) :
[425] Fix | Delete
$aria_action = $theme['id'] . '-action';
[426] Fix | Delete
$aria_name = $theme['id'] . '-name';
[427] Fix | Delete
[428] Fix | Delete
$active_class = '';
[429] Fix | Delete
if ( $theme['active'] ) {
[430] Fix | Delete
$active_class = ' active';
[431] Fix | Delete
}
[432] Fix | Delete
?>
[433] Fix | Delete
<div class="theme<?php echo $active_class; ?>">
[434] Fix | Delete
<?php if ( ! empty( $theme['screenshot'][0] ) ) { ?>
[435] Fix | Delete
<div class="theme-screenshot">
[436] Fix | Delete
<img src="<?php echo esc_url( $theme['screenshot'][0] . '?ver=' . $theme['version'] ); ?>" alt="" />
[437] Fix | Delete
</div>
[438] Fix | Delete
<?php } else { ?>
[439] Fix | Delete
<div class="theme-screenshot blank"></div>
[440] Fix | Delete
<?php } ?>
[441] Fix | Delete
[442] Fix | Delete
<?php if ( $theme['hasUpdate'] ) : ?>
[443] Fix | Delete
<?php
[444] Fix | Delete
if ( $theme['updateResponse']['compatibleWP'] && $theme['updateResponse']['compatiblePHP'] ) :
[445] Fix | Delete
if ( $theme['hasPackage'] ) {
[446] Fix | Delete
$new_version_available = __( 'New version available. <button class="button-link" type="button">Update now</button>' );
[447] Fix | Delete
} else {
[448] Fix | Delete
$new_version_available = __( 'New version available.' );
[449] Fix | Delete
}
[450] Fix | Delete
wp_admin_notice(
[451] Fix | Delete
$new_version_available,
[452] Fix | Delete
array(
[453] Fix | Delete
'type' => 'warning',
[454] Fix | Delete
'additional_classes' => array( 'notice-alt', 'inline', 'update-message' ),
[455] Fix | Delete
)
[456] Fix | Delete
);
[457] Fix | Delete
else :
[458] Fix | Delete
$theme_update_error = '';
[459] Fix | Delete
if ( ! $theme['updateResponse']['compatibleWP'] && ! $theme['updateResponse']['compatiblePHP'] ) {
[460] Fix | Delete
$theme_update_error .= sprintf(
[461] Fix | Delete
/* translators: %s: Theme name. */
[462] Fix | Delete
__( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ),
[463] Fix | Delete
$theme['name']
[464] Fix | Delete
);
[465] Fix | Delete
if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
[466] Fix | Delete
$theme_update_error .= sprintf(
[467] Fix | Delete
/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
[468] Fix | Delete
' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
[469] Fix | Delete
self_admin_url( 'update-core.php' ),
[470] Fix | Delete
esc_url( wp_get_update_php_url() )
[471] Fix | Delete
);
[472] Fix | Delete
wp_update_php_annotation( '</p><p><em>', '</em>', false );
[473] Fix | Delete
} elseif ( current_user_can( 'update_core' ) ) {
[474] Fix | Delete
$theme_update_error .= sprintf(
[475] Fix | Delete
/* translators: %s: URL to WordPress Updates screen. */
[476] Fix | Delete
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
[477] Fix | Delete
self_admin_url( 'update-core.php' )
[478] Fix | Delete
);
[479] Fix | Delete
} elseif ( current_user_can( 'update_php' ) ) {
[480] Fix | Delete
$theme_update_error .= sprintf(
[481] Fix | Delete
/* translators: %s: URL to Update PHP page. */
[482] Fix | Delete
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
[483] Fix | Delete
esc_url( wp_get_update_php_url() )
[484] Fix | Delete
);
[485] Fix | Delete
wp_update_php_annotation( '</p><p><em>', '</em>', false );
[486] Fix | Delete
}
[487] Fix | Delete
} elseif ( ! $theme['updateResponse']['compatibleWP'] ) {
[488] Fix | Delete
$theme_update_error .= sprintf(
[489] Fix | Delete
/* translators: %s: Theme name. */
[490] Fix | Delete
__( 'There is a new version of %s available, but it does not work with your version of WordPress.' ),
[491] Fix | Delete
$theme['name']
[492] Fix | Delete
);
[493] Fix | Delete
if ( current_user_can( 'update_core' ) ) {
[494] Fix | Delete
$theme_update_error .= sprintf(
[495] Fix | Delete
/* translators: %s: URL to WordPress Updates screen. */
[496] Fix | Delete
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
[497] Fix | Delete
self_admin_url( 'update-core.php' )
[498] Fix | Delete
);
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function