wp/wp-admin/themes.php
author ymh <ymh.work@gmail.com>
Wed, 06 Nov 2013 03:21:17 +0000
changeset 0 d970ebf37754
child 5 5e2f62d02dcd
permissions -rw-r--r--
first import
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
 * Themes administration panel.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
 * @package WordPress
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
 * @subpackage Administration
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
/** WordPress Administration Bootstrap */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
require_once( dirname( __FILE__ ) . '/admin.php' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
if ( !current_user_can('switch_themes') && !current_user_can('edit_theme_options') )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
	wp_die( __( 'Cheatin&#8217; uh?' ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
$wp_list_table = _get_list_table('WP_Themes_List_Table');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 's', 'features', '_ajax_fetch_list_nonce', '_wp_http_referer', 'paged' ), $_SERVER['REQUEST_URI'] );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
if ( current_user_can( 'switch_themes' ) && isset($_GET['action'] ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
	if ( 'activate' == $_GET['action'] ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
		check_admin_referer('switch-theme_' . $_GET['stylesheet']);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
		$theme = wp_get_theme( $_GET['stylesheet'] );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
		if ( ! $theme->exists() || ! $theme->is_allowed() )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
			wp_die( __( 'Cheatin&#8217; uh?' ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
		switch_theme( $theme->get_stylesheet() );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
		wp_redirect( admin_url('themes.php?activated=true') );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
		exit;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
	} elseif ( 'delete' == $_GET['action'] ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
		check_admin_referer('delete-theme_' . $_GET['stylesheet']);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
		$theme = wp_get_theme( $_GET['stylesheet'] );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
		if ( !current_user_can('delete_themes') || ! $theme->exists() )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
			wp_die( __( 'Cheatin&#8217; uh?' ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
		delete_theme($_GET['stylesheet']);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
		wp_redirect( admin_url('themes.php?deleted=true') );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
		exit;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
$wp_list_table->prepare_items();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
$title = __('Manage Themes');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
$parent_file = 'themes.php';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
if ( current_user_can( 'switch_themes' ) ) :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
$help_manage = '<p>' . __('Aside from the default theme included with your WordPress installation, themes are designed and developed by third parties.') . '</p>' .
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
	'<p>' . __('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 Live Preview link (see "Previewing and Customizing" help tab). To change themes, click the Activate link.') . '</p>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
get_current_screen()->add_help_tab( array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
	'id'      => 'overview',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
	'title'   => __('Overview'),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
	'content' => $help_manage
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
if ( current_user_can( 'install_themes' ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
	if ( is_multisite() ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
		$help_install = '<p>' . __('Installing themes on Multisite can only be done from the Network Admin section.') . '</p>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
	} else {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
		$help_install = '<p>' . sprintf( __('If you would like to see more themes to choose from, click on the &#8220;Install Themes&#8221; tab and you will be able to browse or search for additional themes from the <a href="%s" target="_blank">WordPress.org Theme Directory</a>. 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&#8217;re free!'), 'http://wordpress.org/themes/' ) . '</p>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
	get_current_screen()->add_help_tab( array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
		'id'      => 'adding-themes',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    64
		'title'   => __('Adding Themes'),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
		'content' => $help_install
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
	) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    69
add_thickbox();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    70
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    71
endif; // switch_themes
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
if ( current_user_can( 'edit_theme_options' ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    74
	$help_customize =
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    75
		'<p>' . __('Click on the "Live Preview" link under any theme to preview that theme and change theme options in a separate, full-screen view. Any installed theme can be previewed and customized in this way.') . '</p>'.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    76
		'<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.') . '</p>' .
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    77
		'<p>' . __('In the left-hand pane you can edit the theme settings. The settings will 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 "Save &amp; Activate" button at the top of the left-hand pane.') . '</p>' .
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    78
		'<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>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    80
	get_current_screen()->add_help_tab( array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    81
		'id'		=> 'customize-preview-themes',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    82
		'title'		=> __('Previewing and Customizing'),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    83
		'content'	=> $help_customize
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    84
	) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    85
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    86
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    87
get_current_screen()->set_help_sidebar(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    88
	'<p><strong>' . __('For more information:') . '</strong></p>' .
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    89
	'<p>' . __('<a href="http://codex.wordpress.org/Using_Themes" target="_blank">Documentation on Using Themes</a>') . '</p>' .
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    90
	'<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    91
);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    93
wp_enqueue_script( 'theme' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    94
wp_enqueue_script( 'customize-loader' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    95
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    96
require_once( ABSPATH . 'wp-admin/admin-header.php' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    97
?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    98
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    99
<div class="wrap"><?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   100
screen_icon();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   101
if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   102
<h2 class="nav-tab-wrapper">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   103
<a href="themes.php" class="nav-tab nav-tab-active"><?php echo esc_html( $title ); ?></a><a href="<?php echo admin_url( 'theme-install.php'); ?>" class="nav-tab"><?php echo esc_html_x('Install Themes', 'theme'); ?></a>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   104
<?php else : ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   105
<h2><?php echo esc_html( $title ); ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   106
<?php endif; ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   107
</h2>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   108
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   109
if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) : ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   110
<div id="message1" class="updated"><p><?php _e('The active theme is broken. Reverting to the default theme.'); ?></p></div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   111
<?php elseif ( isset($_GET['activated']) ) :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   112
		if ( isset( $_GET['previewed'] ) ) { ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   113
		<div id="message2" class="updated"><p><?php printf( __( 'Settings saved and theme activated. <a href="%s">Visit site</a>' ), home_url( '/' ) ); ?></p></div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   114
		<?php } else { ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   115
<div id="message2" class="updated"><p><?php printf( __( 'New theme activated. <a href="%s">Visit site</a>' ), home_url( '/' ) ); ?></p></div><?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   116
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   117
	elseif ( isset($_GET['deleted']) ) : ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   118
<div id="message3" class="updated"><p><?php _e('Theme deleted.') ?></p></div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   119
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   120
endif;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   121
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   122
$ct = wp_get_theme();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   123
$screenshot = $ct->get_screenshot();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   124
$class = $screenshot ? 'has-screenshot' : '';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   125
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   126
$customize_title = sprintf( __( 'Customize &#8220;%s&#8221;' ), $ct->display('Name') );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   127
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   128
?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   129
<div id="current-theme" class="<?php echo esc_attr( $class ); ?>">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   130
	<?php if ( $screenshot ) : ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   131
		<?php if ( current_user_can( 'edit_theme_options' ) ) : ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   132
		<a href="<?php echo wp_customize_url(); ?>" class="load-customize hide-if-no-customize" title="<?php echo esc_attr( $customize_title ); ?>">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   133
			<img src="<?php echo esc_url( $screenshot ); ?>" alt="<?php esc_attr_e( 'Current theme preview' ); ?>" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   134
		</a>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   135
		<?php endif; ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   136
		<img class="hide-if-customize" src="<?php echo esc_url( $screenshot ); ?>" alt="<?php esc_attr_e( 'Current theme preview' ); ?>" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   137
	<?php endif; ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   138
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   139
	<h3><?php _e('Current Theme'); ?></h3>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   140
	<h4>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   141
		<?php echo $ct->display('Name'); ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   142
	</h4>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   143
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   144
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   145
if ( $ct->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   146
	echo '<p class="error-message">' . sprintf( __( 'ERROR: %s' ), $ct->errors()->get_error_message() ) . '</p>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   147
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   148
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   149
// Certain error codes are less fatal than others. We can still display theme information in most cases.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   150
if ( ! $ct->errors() || ( 1 == count( $ct->errors()->get_error_codes() )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   151
	&& in_array( $ct->errors()->get_error_code(), array( 'theme_no_parent', 'theme_parent_invalid', 'theme_no_index' ) ) ) ) : ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   152
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   153
	<div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   154
		<ul class="theme-info">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   155
			<li><?php printf( __('By %s'), $ct->display('Author') ); ?></li>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   156
			<li><?php printf( __('Version %s'), $ct->display('Version') ); ?></li>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   157
		</ul>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   158
		<p class="theme-description"><?php echo $ct->display('Description'); ?></p>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   159
		<?php if ( $ct->parent() ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   160
			printf( ' <p class="howto">' . __( 'This <a href="%1$s">child theme</a> requires its parent theme, %2$s.' ) . '</p>',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   161
				__( 'http://codex.wordpress.org/Child_Themes' ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   162
				$ct->parent()->display( 'Name' ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   163
		} ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   164
		<?php theme_update_available( $ct ); ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   165
	</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   166
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   167
	<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   168
	// Pretend you didn't see this.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   169
	$options = array();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   170
	if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   171
		foreach ( (array) $submenu['themes.php'] as $item) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   172
			$class = '';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   173
			if ( 'themes.php' == $item[2] || 'theme-editor.php' == $item[2] || 'customize.php' == $item[2] )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   174
				continue;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   175
			// 0 = name, 1 = capability, 2 = file
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   176
			if ( ( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file)) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   177
				$class = ' class="current"';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   178
			if ( !empty($submenu[$item[2]]) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   179
				$submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   180
				$menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   181
				if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   182
					$options[] = "<a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   183
				else
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   184
					$options[] = "<a href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   185
			} else if ( current_user_can($item[1]) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   186
				$menu_file = $item[2];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   187
				if ( false !== ( $pos = strpos( $menu_file, '?' ) ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   188
					$menu_file = substr( $menu_file, 0, $pos );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   189
				if ( file_exists( ABSPATH . "wp-admin/$menu_file" ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   190
					$options[] = "<a href='{$item[2]}'$class>{$item[0]}</a>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   191
				} else {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   192
					$options[] = "<a href='themes.php?page={$item[2]}'$class>{$item[0]}</a>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   193
				}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   194
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   195
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   196
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   197
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   198
	if ( $options || current_user_can( 'edit_theme_options' ) ) :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   199
	?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   200
	<div class="theme-options">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   201
		<?php if ( current_user_can( 'edit_theme_options' ) ) : ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   202
		<a id="customize-current-theme-link" href="<?php echo wp_customize_url(); ?>" class="load-customize hide-if-no-customize" title="<?php echo esc_attr( $customize_title ); ?>"><?php _e( 'Customize' ); ?></a>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   203
		<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   204
		endif; // edit_theme_options
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   205
		if ( $options ) :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   206
		?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   207
		<span><?php _e( 'Options:' )?></span>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   208
		<ul>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   209
			<?php foreach ( $options as $option ) : ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   210
				<li><?php echo $option; ?></li>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   211
			<?php endforeach; ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   212
		</ul>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   213
		<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   214
		endif; // options
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   215
		?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   216
	</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   217
	<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   218
	endif; // options || edit_theme_options
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   219
	?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   220
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   221
<?php endif; // theme errors ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   222
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   223
</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   224
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   225
<br class="clear" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   226
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   227
if ( ! current_user_can( 'switch_themes' ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   228
	echo '</div>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   229
	require( ABSPATH . 'wp-admin/admin-footer.php' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   230
	exit;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   231
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   232
?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   233
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   234
<form class="search-form filter-form" action="" method="get">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   235
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   236
<h3 class="available-themes"><?php _e('Available Themes'); ?></h3>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   237
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   238
<?php if ( !empty( $_REQUEST['s'] ) || !empty( $_REQUEST['features'] ) || $wp_list_table->has_items() ) : ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   239
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   240
<p class="search-box">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   241
	<label class="screen-reader-text" for="theme-search-input"><?php _e('Search Installed Themes'); ?>:</label>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   242
	<input type="search" id="theme-search-input" name="s" value="<?php _admin_search_query(); ?>" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   243
	<?php submit_button( __( 'Search Installed Themes' ), 'button', false, false, array( 'id' => 'search-submit' ) ); ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   244
	<a id="filter-click" href="?filter=1"><?php _e( 'Feature Filter' ); ?></a>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   245
</p>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   246
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   247
<div id="filter-box" style="<?php if ( empty($_REQUEST['filter']) ) echo 'display: none;'; ?>">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   248
<?php $feature_list = get_theme_feature_list(); ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   249
	<div class="feature-filter">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   250
		<p class="install-help"><?php _e('Theme filters') ?></p>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   251
	<?php if ( !empty( $_REQUEST['filter'] ) ) : ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   252
		<input type="hidden" name="filter" value="1" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   253
	<?php endif; ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   254
	<?php foreach ( $feature_list as $feature_name => $features ) :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   255
			$feature_name = esc_html( $feature_name ); ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   256
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   257
		<div class="feature-container">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   258
			<div class="feature-name"><?php echo $feature_name ?></div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   259
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   260
			<ol class="feature-group">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   261
				<?php foreach ( $features as $key => $feature ) :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   262
						$feature_name = $feature;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   263
						$feature_name = esc_html( $feature_name );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   264
						$feature = esc_attr( $feature );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   265
						?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   266
				<li>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   267
					<input type="checkbox" name="features[]" id="feature-id-<?php echo $key; ?>" value="<?php echo $key; ?>" <?php checked( in_array( $key, $wp_list_table->features ) ); ?>/>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   268
					<label for="feature-id-<?php echo $key; ?>"><?php echo $feature_name; ?></label>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   269
				</li>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   270
				<?php endforeach; ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   271
			</ol>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   272
		</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   273
	<?php endforeach; ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   274
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   275
	<div class="feature-container">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   276
		<?php submit_button( __( 'Apply Filters' ), 'button-secondary submitter', false, false, array( 'id' => 'filter-submit' ) ); ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   277
		&nbsp;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   278
		<a id="mini-filter-click" href="<?php echo esc_url( remove_query_arg( array('filter', 'features', 'submit') ) ); ?>"><?php _e( 'Close filters' )?></a>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   279
	</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   280
	<br/>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   281
	</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   282
	<br class="clear"/>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   283
</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   284
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   285
<?php endif; ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   286
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   287
<br class="clear" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   288
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   289
<?php $wp_list_table->display(); ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   290
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   291
</form>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   292
<br class="clear" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   293
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   294
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   295
// List broken themes, if any.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   296
if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_get_themes( array( 'errors' => true ) ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   297
?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   298
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   299
<h3><?php _e('Broken Themes'); ?></h3>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   300
<p><?php _e('The following themes are installed but incomplete. Themes must have a stylesheet and a template.'); ?></p>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   301
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   302
<table id="broken-themes">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   303
	<tr>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   304
		<th><?php _ex('Name', 'theme name'); ?></th>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   305
		<th><?php _e('Description'); ?></th>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   306
	</tr>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   307
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   308
	foreach ( $broken_themes as $broken_theme ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   309
		echo "
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   310
		<tr>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   311
			 <td>" . $broken_theme->get('Name') ."</td>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   312
			 <td>" . $broken_theme->errors()->get_error_message() . "</td>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   313
		</tr>";
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   314
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   315
?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   316
</table>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   317
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   318
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   319
?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   320
</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   321
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   322
<?php require( ABSPATH . 'wp-admin/admin-footer.php' ); ?>