X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/449d082fcc4873c1f7d363a0d9f7409be7f6e77d..2376fb745f4ae8c6bd2353127524e0b28005143d:/wp-admin/themes.php diff --git a/wp-admin/themes.php b/wp-admin/themes.php index 15b3e5bf..72589324 100644 --- a/wp-admin/themes.php +++ b/wp-admin/themes.php @@ -7,38 +7,70 @@ */ /** WordPress Administration Bootstrap */ -require_once('admin.php'); +require_once('./admin.php'); -if ( isset($_GET['action']) ) { - check_admin_referer('switch-theme_' . $_GET['template']); +if ( !current_user_can('switch_themes') && !current_user_can('edit_theme_options') ) + wp_die( __( 'Cheatin’ uh?' ) ); - if ('activate' == $_GET['action']) { +if ( current_user_can('switch_themes') && isset($_GET['action']) ) { + if ( 'activate' == $_GET['action'] ) { + check_admin_referer('switch-theme_' . $_GET['template']); switch_theme($_GET['template'], $_GET['stylesheet']); wp_redirect('themes.php?activated=true'); exit; + } else if ( 'delete' == $_GET['action'] ) { + check_admin_referer('delete-theme_' . $_GET['template']); + if ( !current_user_can('delete_themes') ) + wp_die( __( 'Cheatin’ uh?' ) ); + delete_theme($_GET['template']); + wp_redirect('themes.php?deleted=true'); + exit; } } $title = __('Manage Themes'); $parent_file = 'themes.php'; +if ( current_user_can( 'switch_themes' ) ) : + +$help = '

' . __('Aside from the default theme included with your WordPress installation, themes are designed and developed by third parties.') . '

'; +$help .= '

' . __('You can see your active theme at the top of the screen. Below are the other themes you have installed that are not currently in use. You can see what your site would look like with one of these themes by clicking the Preview link. To change themes, click the Activate link.') . '

'; +if ( current_user_can('install_themes') ) + $help .= '

' . 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 licensed under the GNU General Public License, version 2, just like WordPress. Oh, and they’re free!'), 'http://wordpress.org/extend/themes/') . '

'; + +$help .= '

' . __('For more information:') . '

'; +$help .= '

' . __('Documentation on Using Themes') . '

'; +$help .= '

' . __('Support Forums') . '

'; +add_contextual_help($current_screen, $help); + add_thickbox(); wp_enqueue_script( 'theme-preview' ); -require_once('admin-header.php'); +endif; + +require_once('./admin-header.php'); +if ( is_multisite() && current_user_can('edit_themes') ) { + ?>

Network Themes screen before they appear here.'), admin_url( 'ms-themes.php') ); ?>

-

- -

Visit site'), get_bloginfo('url') . '/'); ?>

+

+ +

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

+

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

+

- name]); -ksort( $themes ); +uksort( $themes, "strnatcasecmp" ); $theme_total = count( $themes ); $per_page = 15; @@ -60,60 +92,25 @@ $page_links = paginate_links( array( )); $themes = array_slice( $themes, $start, $per_page ); - -/** - * Check if there is an update for a theme available. - * - * Will display link, if there is an update available. - * - * @since 2.7.0 - * - * @param object $theme Theme data object. - * @return bool False if no valid info was passed. - */ -function theme_update_available( $theme ) { - static $themes_update; - if ( !isset($themes_update) ) - $themes_update = get_option('update_themes'); - - if ( is_object($theme) && isset($theme->stylesheet) ) - $stylesheet = $theme->stylesheet; - elseif ( is_array($theme) && isset($theme['Stylesheet']) ) - $stylesheet = $theme['Stylesheet']; - else - return false; //No valid info passed. - - if ( isset($themes_update->response[ $stylesheet ]) ) { - $update = $themes_update->response[ $stylesheet ]; - $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']); //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list. - $update_url = wp_nonce_url('update.php?action=upgrade-theme&theme=' . urlencode($stylesheet), 'upgrade-theme_' . $stylesheet); - - if ( ! current_user_can('update_themes') ) - printf( __('

There is a new version of %1$s available. View version %3$s Details.

'), $ct->name, $details_url, $update['new_version']); - else if ( empty($update->package) ) - printf( __('

There is a new version of %1$s available. View version %3$s Details automatic upgrade unavailable for this theme.

'), $ct->name, $details_url, $update['new_version']); - else - printf( __('

There is a new version of %1$s available. View version %3$s Details or upgrade automatically.

'), $ct->name, $details_url, $update['new_version'], $update_url ); - } -} - ?>
-

+

screenshot ) : ?> -<?php _e('Current theme preview'); ?> +<?php _e('Current theme preview'); ?> -

title, $ct->version, $ct->author) ; ?>

-

description; ?>

-parent_theme) { ?> -

%2$s. The stylesheet files are located in %3$s. %4$s uses templates from %5$s. Changes made to the templates will affect both themes.'), $ct->title, $ct->template_dir, $ct->stylesheet_dir, $ct->title, $ct->parent_theme); ?>

+

title, $ct->version, $ct->author) ; ?>

+

description; ?>

+parent_theme ) { ?> +

%2$s. The stylesheet files are located in %3$s. %4$s uses templates from %5$s. Changes made to the templates will affect both themes.'), $ct->title, str_replace( WP_CONTENT_DIR, '', $ct->template_dir ), str_replace( WP_CONTENT_DIR, '', $ct->stylesheet_dir ), $ct->title, $ct->parent_theme); ?>

-

%2$s.'), $ct->title, $ct->template_dir, $ct->stylesheet_dir); ?>

+

%2$s.'), $ct->title, str_replace( WP_CONTENT_DIR, '', $ct->template_dir ), str_replace( WP_CONTENT_DIR, '', $ct->stylesheet_dir ) ); ?>

tags ) : ?>

tags); ?>

@@ -121,10 +118,20 @@ function theme_update_available( $theme ) {
+
+'; + require( './admin-footer.php' ); + exit; +} +?>

+ +
' . __( 'Displaying %s–%s of %s' ) . '%s', @@ -136,7 +143,6 @@ function theme_update_available( $theme ) {
- $theme_name ) { $author = $themes[$theme_name]['Author']; $screenshot = $themes[$theme_name]['Screenshot']; $stylesheet_dir = $themes[$theme_name]['Stylesheet Dir']; - $preview_link = clean_url( get_option('home') . '/'); - $preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true', 'width' => 600, 'height' => 400 ), $preview_link ) ); - $preview_text = attribute_escape( sprintf( __('Preview of "%s"'), $title ) ); + $template_dir = $themes[$theme_name]['Template Dir']; + $parent_theme = $themes[$theme_name]['Parent Theme']; + $theme_root = $themes[$theme_name]['Theme Root']; + $theme_root_uri = $themes[$theme_name]['Theme Root URI']; + $preview_link = esc_url(get_option('home') . '/'); + if ( is_ssl() ) + $preview_link = str_replace( 'http://', 'https://', $preview_link ); + $preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true' ), $preview_link ) ); + $preview_text = esc_attr( sprintf( __('Preview of “%s”'), $title ) ); $tags = $themes[$theme_name]['Tags']; - $thickbox_class = 'thickbox'; + $thickbox_class = 'thickbox thickbox-preview'; $activate_link = wp_nonce_url("themes.php?action=activate&template=".urlencode($template)."&stylesheet=".urlencode($stylesheet), 'switch-theme_' . $template); - $activate_text = attribute_escape( sprintf( __('Activate "%s"'), $title ) ); + $activate_text = esc_attr( sprintf( __('Activate “%s”'), $title ) ); + $actions = array(); + $actions[] = '' . __('Activate') . ''; + $actions[] = '' . __('Preview') . ''; + if ( current_user_can('delete_themes') ) + $actions[] = '' . __('Delete') . ''; + $actions = apply_filters('theme_action_links', $actions, $themes[$theme_name]); + + $actions = implode ( ' | ', $actions ); ?> - + - + -

-

+

+

+ + +

%2$s. The stylesheet files are located in %3$s. %4$s uses templates from %5$s. Changes made to the templates will affect both themes.'), $title, str_replace( WP_CONTENT_DIR, '', $template_dir ), str_replace( WP_CONTENT_DIR, '', $stylesheet_dir ), $title, $parent_theme); ?>

+ +

%2$s.'), $title, str_replace( WP_CONTENT_DIR, '', $template_dir ), str_replace( WP_CONTENT_DIR, '', $stylesheet_dir ) ); ?>

+ -

+

- -
- - + +

Install Themes tab above.'), 'theme-install.php'); + else + printf(__('Only the current theme is available to you. Contact the %s administrator for information about accessing additional themes.'), get_site_option('site_name')); + ?>

+
@@ -213,13 +247,13 @@ foreach ( $cols as $col => $theme_name ) { -

-

+

+

- +
@@ -246,10 +280,6 @@ if ( count($broken_themes) ) { - -

-

WordPress theme directory. To install a theme you generally just need to upload the theme folder into your wp-content/themes directory. Once a theme is uploaded, you should see it on this page.'); ?>

- - +