X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/8f374b7233bc2815ccc387e448d208c5434eb961..53a5df18dd17a11c18781e78349feb3e139096b4:/wp-admin/themes.php?ds=sidebyside diff --git a/wp-admin/themes.php b/wp-admin/themes.php index c892705e..edb0cad9 100644 --- a/wp-admin/themes.php +++ b/wp-admin/themes.php @@ -7,20 +7,22 @@ */ /** WordPress Administration Bootstrap */ -require_once('./admin.php'); +require_once( dirname( __FILE__ ) . '/admin.php' ); if ( !current_user_can('switch_themes') && !current_user_can('edit_theme_options') ) wp_die( __( 'Cheatin’ uh?' ) ); $wp_list_table = _get_list_table('WP_Themes_List_Table'); +$_SERVER['REQUEST_URI'] = remove_query_arg( array( 's', 'features', '_ajax_fetch_list_nonce', '_wp_http_referer', 'paged' ), $_SERVER['REQUEST_URI'] ); + 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?' ) ); - switch_theme($_GET['template'], $_GET['stylesheet']); + switch_theme( $theme->get_stylesheet() ); wp_redirect( admin_url('themes.php?activated=true') ); exit; } elseif ( 'delete' == $_GET['action'] ) { @@ -54,7 +56,7 @@ if ( current_user_can( 'install_themes' ) ) { if ( is_multisite() ) { $help_install = '

' . __('Installing themes on Multisite can only be done from the Network Admin section.') . '

'; } else { - $help_install = '

' . sprintf( __('If you would like to see more themes to choose from, click on the “Install Themes” tab and you will be able to browse or search for additional themes from the WordPress.org Theme Directory. Themes in the WordPress.org Theme Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!'), 'http://wordpress.org/extend/themes/' ) . '

'; + $help_install = '

' . sprintf( __('If you would like to see more themes to choose from, click on the “Install Themes” tab and you will be able to browse or search for additional themes from the WordPress.org Theme Directory. Themes in the WordPress.org Theme Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!'), 'http://wordpress.org/themes/' ) . '

'; } get_current_screen()->add_help_tab( array( @@ -64,6 +66,8 @@ if ( current_user_can( 'install_themes' ) ) { ) ); } +add_thickbox(); + endif; // switch_themes if ( current_user_can( 'edit_theme_options' ) ) { @@ -89,7 +93,7 @@ get_current_screen()->set_help_sidebar( wp_enqueue_script( 'theme' ); wp_enqueue_script( 'customize-loader' ); -require_once('./admin-header.php'); +require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?>

-

Visit site.' ), home_url( '/' ) ); ?>

- -

widgets settings screen to configure them.'), admin_url( 'widgets.php' ) ); ?>

+

Visit site' ), home_url( '/' ) ); ?>

+

Visit site' ), home_url( '/' ) ); ?>

@@ -139,12 +141,26 @@ $customize_title = sprintf( __( 'Customize “%s”' ), $ct->display('Na display('Name'); ?> +errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) { + echo '

' . sprintf( __( 'ERROR: %s' ), $ct->errors()->get_error_message() ) . '

'; +} + +// Certain error codes are less fatal than others. We can still display theme information in most cases. +if ( ! $ct->errors() || ( 1 == count( $ct->errors()->get_error_codes() ) + && in_array( $ct->errors()->get_error_code(), array( 'theme_no_parent', 'theme_parent_invalid', 'theme_no_index' ) ) ) ) : ?> +

display('Description'); ?>

+ parent() ) { + printf( '

' . __( 'This child theme requires its parent theme, %2$s.' ) . '

', + __( 'http://codex.wordpress.org/Child_Themes' ), + $ct->parent()->display( 'Name' ) ); + } ?>
@@ -154,7 +170,7 @@ $customize_title = sprintf( __( 'Customize “%s”' ), $ct->display('Na if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) { foreach ( (array) $submenu['themes.php'] as $item) { $class = ''; - if ( 'themes.php' == $item[2] || 'theme-editor.php' == $item[2] ) + if ( 'themes.php' == $item[2] || 'theme-editor.php' == $item[2] || 'customize.php' == $item[2] ) continue; // 0 = name, 1 = capability, 2 = file if ( ( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file)) ) @@ -167,7 +183,10 @@ $customize_title = sprintf( __( 'Customize “%s”' ), $ct->display('Na else $options[] = "{$item[0]}"; } else if ( current_user_can($item[1]) ) { - if ( file_exists(ABSPATH . 'wp-admin/' . $item[2]) ) { + $menu_file = $item[2]; + if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) + $menu_file = substr( $menu_file, 0, $pos ); + if ( file_exists( ABSPATH . "wp-admin/$menu_file" ) ) { $options[] = "{$item[0]}"; } else { $options[] = "{$item[0]}"; @@ -191,19 +210,23 @@ $customize_title = sprintf( __( 'Customize “%s”' ), $ct->display('Na
  • +
    + +
    '; - require( './admin-footer.php' ); + require( ABSPATH . 'wp-admin/admin-footer.php' ); exit; } ?> @@ -282,11 +305,9 @@ if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_ + " . $broken_theme->get('Name') ." " . $broken_theme->errors()->get_error_message() . " "; @@ -298,4 +319,4 @@ if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_ ?> - +