web/wp-admin/theme-install.php
author Anthony Ly <anthonyly.com@gmail.com>
Wed, 19 Dec 2012 17:46:52 -0800
changeset 204 09a1c134465b
parent 194 32102edaa81b
permissions -rw-r--r--
man wordpress + plugins order post + slideshow
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
136
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
     1
<?php
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
     2
/**
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
     3
 * Install theme administration panel.
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
     4
 *
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
     5
 * @package WordPress
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
     6
 * @subpackage Administration
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
     7
 */
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
     8
194
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
     9
if ( !defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'theme-information' == $_GET['tab'] ) )
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    10
	define( 'IFRAME_REQUEST', true );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    11
136
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    12
/** WordPress Administration Bootstrap */
194
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    13
require_once('./admin.php');
136
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    14
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    15
if ( ! current_user_can('install_themes') )
194
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    16
	wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) );
136
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    17
194
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    18
if ( is_multisite() && ! is_network_admin() ) {
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    19
	wp_redirect( network_admin_url( 'theme-install.php' ) );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    20
	exit();
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    21
}
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    22
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    23
$wp_list_table = _get_list_table('WP_Theme_Install_List_Table');
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    24
$pagenum = $wp_list_table->get_pagenum();
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    25
$wp_list_table->prepare_items();
136
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    26
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    27
$title = __('Install Themes');
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    28
$parent_file = 'themes.php';
194
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    29
if ( !is_network_admin() )
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    30
	$submenu_file = 'themes.php';
136
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    31
194
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    32
wp_enqueue_script( 'theme-install' );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    33
wp_enqueue_script( 'theme' );
136
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    34
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    35
$body_id = $tab;
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    36
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    37
do_action('install_themes_pre_' . $tab); //Used to override the general interface, Eg, install or theme information.
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    38
194
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    39
$help_overview =
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    40
	'<p>' . sprintf(__('You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the <a href="%s" target="_blank">WordPress.org Theme Directory</a>. These themes are designed and developed by third parties, are available free of charge, and are compatible with the license WordPress uses.'), 'http://wordpress.org/extend/themes/') . '</p>' .
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    41
	'<p>' . __('You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter. Alternately, you can browse the themes that are Featured, Newest, or Recently Updated. When you find a theme you like, you can preview it or install it.') . '</p>' .
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    42
	'<p>' . __('You can Upload a theme manually if you have already downloaded its ZIP archive onto your computer (make sure it is from a trusted and original source). You can also do it the old-fashioned way and copy a downloaded theme&#8217;s folder via FTP into your <code>/wp-content/themes</code> directory.') . '</p>';
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    43
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    44
get_current_screen()->add_help_tab( array(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    45
	'id'      => 'overview',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    46
	'title'   => __('Overview'),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    47
	'content' => $help_overview
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    48
) );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    49
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    50
$help_installing =
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    51
	'<p>' . __('Once you have generated a list of themes, you can preview and install any of them. Click on the thumbnail of the theme you&#8217;re interested in previewing. It will open up in a full-screen Preview page to give you a better idea of how that theme will look.') . '</p>' .
204
09a1c134465b man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents: 194
diff changeset
    52
	'<p>' . __('To install the theme so you can preview it with your site&#8217;s content and customize its theme options, click the "Install" button at the top of the left-hand pane. The theme files will be downloaded to your website automatically. When this is complete, the theme is now available for activation, which you can do by clicking the "Activate" link, or by navigating to your Manage Themes screen and clicking the "Live Preview" link under any installed theme&#8217;s thumbnail image.') . '</p>';
194
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    53
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    54
get_current_screen()->add_help_tab( array(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    55
	'id'      => 'installing',
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    56
	'title'   => __('Previewing and Installing'),
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    57
	'content' => $help_installing
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    58
) );
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    59
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    60
get_current_screen()->set_help_sidebar(
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    61
	'<p><strong>' . __('For more information:') . '</strong></p>' .
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    62
	'<p>' . __('<a href="http://codex.wordpress.org/Using_Themes#Adding_New_Themes" target="_blank">Documentation on Adding New Themes</a>') . '</p>' .
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    63
	'<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    64
);
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    65
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    66
include(ABSPATH . 'wp-admin/admin-header.php');
136
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    67
?>
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    68
<div class="wrap">
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    69
<?php
194
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    70
screen_icon();
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    71
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    72
if ( is_network_admin() ) : ?>
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    73
<h2><?php echo esc_html( $title ); ?></h2>
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    74
<?php else : ?>
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    75
<h2 class="nav-tab-wrapper"><a href="themes.php" class="nav-tab"><?php echo esc_html_x('Manage Themes', 'theme'); ?></a><a href="theme-install.php" class="nav-tab nav-tab-active"><?php echo esc_html( $title ); ?></a></h2>
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    76
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    77
<?php
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    78
endif;
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    79
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    80
$wp_list_table->views(); ?>
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    81
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    82
<br class="clear" />
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    83
<?php do_action('install_themes_' . $tab, $paged); ?>
136
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    84
</div>
bde1974c263b merge from wordpress
ymh@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    85
<?php
194
32102edaa81b MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents: 136
diff changeset
    86
include(ABSPATH . 'wp-admin/admin-footer.php');