X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/af50974463450c98503e763a7836a50e260461a9..refs/tags/wordpress-4.4.1:/wp-admin/themes.php diff --git a/wp-admin/themes.php b/wp-admin/themes.php index bf265b8f..bf65884f 100644 --- a/wp-admin/themes.php +++ b/wp-admin/themes.php @@ -9,23 +9,50 @@ /** WordPress Administration Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); -if ( !current_user_can('switch_themes') && !current_user_can('edit_theme_options') ) - wp_die( __( 'Cheatin’ uh?' ), 403 ); +if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) ) { + wp_die( + '
' . __( 'You are not allowed to edit theme options on this site.' ) . '
', + 403 + ); +} if ( current_user_can( 'switch_themes' ) && isset($_GET['action'] ) ) { if ( 'activate' == $_GET['action'] ) { check_admin_referer('switch-theme_' . $_GET['stylesheet']); $theme = wp_get_theme( $_GET['stylesheet'] ); - if ( ! $theme->exists() || ! $theme->is_allowed() ) - wp_die( __( 'Cheatin’ uh?' ), 403 ); + + if ( ! $theme->exists() || ! $theme->is_allowed() ) { + wp_die( + '' . __( 'The requested theme does not exist.' ) . '
', + 403 + ); + } + switch_theme( $theme->get_stylesheet() ); wp_redirect( admin_url('themes.php?activated=true') ); exit; } elseif ( 'delete' == $_GET['action'] ) { check_admin_referer('delete-theme_' . $_GET['stylesheet']); $theme = wp_get_theme( $_GET['stylesheet'] ); - if ( !current_user_can('delete_themes') || ! $theme->exists() ) - wp_die( __( 'Cheatin’ uh?' ), 403 ); + + if ( ! current_user_can( 'delete_themes' ) ) { + wp_die( + '' . __( 'You are not allowed to delete this item.' ) . '
', + 403 + ); + } + + if ( ! $theme->exists() ) { + wp_die( + '' . __( 'The requested theme does not exist.' ) . '
', + 403 + ); + } + $active = wp_get_theme(); if ( $active->get( 'Template' ) == $_GET['stylesheet'] ) { wp_redirect( admin_url( 'themes.php?delete-active-child=true' ) ); @@ -47,7 +74,8 @@ if ( current_user_can( 'switch_themes' ) ) { '' . __( 'The current theme is displayed highlighted as the first theme.' ) . '
'; + '' . __( 'The current theme is displayed highlighted as the first theme.' ) . '
' . + '' . __( 'The search for installed themes will search for terms in their name, description, author, or tag.' ) . ' ' . __( 'The search results will be updated as you type.' ) . '
'; get_current_screen()->add_help_tab( array( 'id' => 'overview', @@ -87,7 +115,7 @@ if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) get_current_screen()->set_help_sidebar( '' . __( 'For more information:' ) . '
' . - '' . __( 'Documentation on Using Themes' ) . '
' . + '' . __( 'Documentation on Using Themes' ) . '
' . '' . __( 'Support Forums' ) . '
' ); @@ -107,9 +135,11 @@ wp_localize_script( 'theme', '_wpThemeSettings', array( 'adminUrl' => parse_url( admin_url(), PHP_URL_PATH ), ), 'l10n' => array( - 'addNew' => __( 'Add New Theme' ), - 'search' => __( 'Search Installed Themes' ), + 'addNew' => __( 'Add New Theme' ), + 'search' => __( 'Search Installed Themes' ), 'searchPlaceholder' => __( 'Search installed themes...' ), // placeholder (no ellipsis) + 'themesFound' => __( 'Number of Themes found: %d' ), + 'noThemesFound' => __( 'No themes found. Try a different search.' ), ), ) ); @@ -121,23 +151,23 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?>Visit site' ), home_url( '/' ) ); ?>
Visit site' ), home_url( '/' ) ); ?>
Visit site' ), home_url( '/' ) ); ?>
Visit site' ), home_url( '/' ) ); ?>