mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Fix net admin theme deletion over FTP. see #16117
git-svn-id: http://svn.automattic.com/wordpress/trunk@17237 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
50d3a36764
commit
9b88439cb6
@ -43,17 +43,19 @@ function current_theme_info() {
|
||||
* @since 2.8.0
|
||||
*
|
||||
* @param string $template Template directory of the theme to delete
|
||||
* @param string $redirect Redirect to page when complete.
|
||||
* @return mixed
|
||||
*/
|
||||
function delete_theme($template) {
|
||||
function delete_theme($template, $redirect = '') {
|
||||
global $wp_filesystem;
|
||||
|
||||
if ( empty($template) )
|
||||
return false;
|
||||
|
||||
ob_start();
|
||||
$url = wp_nonce_url('themes.php?action=delete&template=' . $template, 'delete-theme_' . $template);
|
||||
if ( false === ($credentials = request_filesystem_credentials($url)) ) {
|
||||
if ( empty( $redirect ) )
|
||||
$redirect = wp_nonce_url('themes.php?action=delete&template=' . $template, 'delete-theme_' . $template);
|
||||
if ( false === ($credentials = request_filesystem_credentials($redirect)) ) {
|
||||
$data = ob_get_contents();
|
||||
ob_end_clean();
|
||||
if ( ! empty($data) ){
|
||||
|
@ -160,7 +160,7 @@ if ( $action ) {
|
||||
} // Endif verify-delete
|
||||
|
||||
foreach ( $themes as $theme )
|
||||
$delete_result = delete_theme( $theme );
|
||||
$delete_result = delete_theme( $theme, esc_url( add_query_arg( array('verify-delete' => 1), $_SERVER['REQUEST_URI'] ) ) );
|
||||
wp_redirect( add_query_arg( 'deleted', count( $themes ), $referer ) );
|
||||
exit;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user