author | Anthony Ly <anthonyly.com@gmail.com> |
Mon, 19 Nov 2012 18:26:13 +0100 | |
changeset 194 | 32102edaa81b |
parent 136 | bde1974c263b |
child 204 | 09a1c134465b |
permissions | -rw-r--r-- |
136 | 1 |
<?php |
2 |
/** |
|
3 |
* Update Core administration panel. |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Administration |
|
7 |
*/ |
|
8 |
||
9 |
/** WordPress Administration Bootstrap */ |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
10 |
require_once('./admin.php'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
11 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
12 |
wp_enqueue_style( 'plugin-install' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
13 |
wp_enqueue_script( 'plugin-install' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
14 |
add_thickbox(); |
136 | 15 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
16 |
if ( is_multisite() && ! is_network_admin() ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
17 |
wp_redirect( network_admin_url( 'update-core.php' ) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
18 |
exit(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
19 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
20 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
21 |
if ( ! current_user_can( 'update_core' ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
22 |
wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
136 | 23 |
|
24 |
function list_core_update( $update ) { |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
25 |
global $wp_local_package, $wpdb; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
26 |
static $first_pass = true; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
27 |
|
136 | 28 |
$version_string = ('en_US' == $update->locale && 'en_US' == get_locale() ) ? |
29 |
$update->current : sprintf("%s–<strong>%s</strong>", $update->current, $update->locale); |
|
30 |
$current = false; |
|
31 |
if ( !isset($update->response) || 'latest' == $update->response ) |
|
32 |
$current = true; |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
33 |
$submit = __('Update Now'); |
136 | 34 |
$form_action = 'update-core.php?action=do-core-upgrade'; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
35 |
$php_version = phpversion(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
36 |
$mysql_version = $wpdb->db_version(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
37 |
$show_buttons = true; |
136 | 38 |
if ( 'development' == $update->response ) { |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
39 |
$message = __('You are using a development version of WordPress. You can update to the latest nightly build automatically or download the nightly build and install it manually:'); |
136 | 40 |
$download = __('Download nightly build'); |
41 |
} else { |
|
42 |
if ( $current ) { |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
43 |
$message = sprintf(__('You have the latest version of WordPress. You do not need to update. However, if you want to re-install version %s, you can do so automatically or download the package and re-install manually:'), $version_string); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
44 |
$submit = __('Re-install Now'); |
136 | 45 |
$form_action = 'update-core.php?action=do-core-reinstall'; |
46 |
} else { |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
47 |
$php_compat = version_compare( $php_version, $update->php_version, '>=' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
48 |
if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
49 |
$mysql_compat = true; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
50 |
else |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
51 |
$mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
52 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
53 |
if ( !$mysql_compat && !$php_compat ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
54 |
$message = sprintf( __('You cannot update because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
55 |
elseif ( !$php_compat ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
56 |
$message = sprintf( __('You cannot update because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
57 |
elseif ( !$mysql_compat ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
58 |
$message = sprintf( __('You cannot update because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
59 |
else |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
60 |
$message = sprintf(__('You can update to <a href="http://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
61 |
if ( !$mysql_compat || !$php_compat ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
62 |
$show_buttons = false; |
136 | 63 |
} |
64 |
$download = sprintf(__('Download %s'), $version_string); |
|
65 |
} |
|
66 |
||
67 |
echo '<p>'; |
|
68 |
echo $message; |
|
69 |
echo '</p>'; |
|
70 |
echo '<form method="post" action="' . $form_action . '" name="upgrade" class="upgrade">'; |
|
71 |
wp_nonce_field('upgrade-core'); |
|
72 |
echo '<p>'; |
|
73 |
echo '<input name="version" value="'. esc_attr($update->current) .'" type="hidden"/>'; |
|
74 |
echo '<input name="locale" value="'. esc_attr($update->locale) .'" type="hidden"/>'; |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
75 |
if ( $show_buttons ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
76 |
if ( $first_pass ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
77 |
submit_button( $submit, $current ? 'button' : 'primary', 'upgrade', false ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
78 |
$first_pass = false; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
79 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
80 |
submit_button( $submit, 'button', 'upgrade', false ); |
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 |
echo ' <a href="' . esc_url( $update->download ) . '" class="button">' . $download . '</a> '; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
83 |
} |
136 | 84 |
if ( 'en_US' != $update->locale ) |
85 |
if ( !isset( $update->dismissed ) || !$update->dismissed ) |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
86 |
submit_button( __('Hide this update'), 'button', 'dismiss', false ); |
136 | 87 |
else |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
88 |
submit_button( __('Bring back this update'), 'button', 'undismiss', false ); |
136 | 89 |
echo '</p>'; |
90 |
if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) ) |
|
91 |
echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>'; |
|
92 |
else if ( 'en_US' == $update->locale && get_locale() != 'en_US' ) { |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
93 |
echo '<p class="hint">'.sprintf( __('You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.'), $update->response != 'development' ? $update->current : '' ).'</p>'; |
136 | 94 |
} |
95 |
echo '</form>'; |
|
96 |
||
97 |
} |
|
98 |
||
99 |
function dismissed_updates() { |
|
100 |
$dismissed = get_core_updates( array( 'dismissed' => true, 'available' => false ) ); |
|
101 |
if ( $dismissed ) { |
|
102 |
||
103 |
$show_text = esc_js(__('Show hidden updates')); |
|
104 |
$hide_text = esc_js(__('Hide hidden updates')); |
|
105 |
?> |
|
106 |
<script type="text/javascript"> |
|
107 |
||
108 |
jQuery(function($) { |
|
109 |
$('dismissed-updates').show(); |
|
110 |
$('#show-dismissed').toggle(function(){$(this).text('<?php echo $hide_text; ?>');}, function() {$(this).text('<?php echo $show_text; ?>')}); |
|
111 |
$('#show-dismissed').click(function() { $('#dismissed-updates').toggle('slow');}); |
|
112 |
}); |
|
113 |
</script> |
|
114 |
<?php |
|
115 |
echo '<p class="hide-if-no-js"><a id="show-dismissed" href="#">'.__('Show hidden updates').'</a></p>'; |
|
116 |
echo '<ul id="dismissed-updates" class="core-updates dismissed">'; |
|
117 |
foreach( (array) $dismissed as $update) { |
|
118 |
echo '<li>'; |
|
119 |
list_core_update( $update ); |
|
120 |
echo '</li>'; |
|
121 |
} |
|
122 |
echo '</ul>'; |
|
123 |
} |
|
124 |
} |
|
125 |
||
126 |
/** |
|
127 |
* Display upgrade WordPress for downloading latest or upgrading automatically form. |
|
128 |
* |
|
129 |
* @since 2.7 |
|
130 |
* |
|
131 |
* @return null |
|
132 |
*/ |
|
133 |
function core_upgrade_preamble() { |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
134 |
global $upgrade_error, $wp_version; |
136 | 135 |
|
136 |
$updates = get_core_updates(); |
|
137 |
?> |
|
138 |
<div class="wrap"> |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
139 |
<?php screen_icon('tools'); ?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
140 |
<h2><?php _e('WordPress Updates'); ?></h2> |
136 | 141 |
<?php |
142 |
if ( $upgrade_error ) { |
|
143 |
echo '<div class="error"><p>'; |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
144 |
if ( $upgrade_error == 'themes' ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
145 |
_e('Please select one or more themes to update.'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
146 |
else |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
147 |
_e('Please select one or more plugins to update.'); |
136 | 148 |
echo '</p></div>'; |
149 |
} |
|
150 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
151 |
echo '<p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
152 |
/* translators: %1 date, %2 time. */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
153 |
printf( __('Last checked on %1$s at %2$s.'), date_i18n( get_option( 'date_format' ) ), date_i18n( get_option( 'time_format' ) ) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
154 |
echo ' <a class="button" href="' . esc_url( self_admin_url('update-core.php') ) . '">' . __( 'Check Again' ) . '</a>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
155 |
echo '</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
156 |
|
136 | 157 |
if ( !isset($updates[0]->response) || 'latest' == $updates[0]->response ) { |
158 |
echo '<h3>'; |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
159 |
_e('You have the latest version of WordPress.'); |
136 | 160 |
echo '</h3>'; |
161 |
} else { |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
162 |
echo '<div class="updated inline"><p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
163 |
_e('<strong>Important:</strong> before updating, please <a href="http://codex.wordpress.org/WordPress_Backups">back up your database and files</a>. For help with updates, visit the <a href="http://codex.wordpress.org/Updating_WordPress">Updating WordPress</a> Codex page.'); |
136 | 164 |
echo '</p></div>'; |
165 |
||
166 |
echo '<h3 class="response">'; |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
167 |
_e( 'An updated version of WordPress is available.' ); |
136 | 168 |
echo '</h3>'; |
169 |
} |
|
170 |
||
171 |
echo '<ul class="core-updates">'; |
|
172 |
$alternate = true; |
|
173 |
foreach( (array) $updates as $update ) { |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
174 |
echo '<li>'; |
136 | 175 |
list_core_update( $update ); |
176 |
echo '</li>'; |
|
177 |
} |
|
178 |
echo '</ul>'; |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
179 |
if ( $updates ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
180 |
echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, your site will return to normal.' ) . '</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
181 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
182 |
list( $normalized_version ) = explode( '-', $wp_version ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
183 |
echo '<p>' . sprintf( __( '<a href="%s">Learn more about WordPress %s</a>.' ), esc_url( self_admin_url( 'about.php' ) ), $normalized_version ) . '</p>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
184 |
} |
136 | 185 |
dismissed_updates(); |
186 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
187 |
if ( current_user_can( 'update_plugins' ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
188 |
list_plugin_updates(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
189 |
if ( current_user_can( 'update_themes' ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
190 |
list_theme_updates(); |
136 | 191 |
do_action('core_upgrade_preamble'); |
192 |
echo '</div>'; |
|
193 |
} |
|
194 |
||
195 |
function list_plugin_updates() { |
|
196 |
global $wp_version; |
|
197 |
||
198 |
$cur_wp_version = preg_replace('/-.*$/', '', $wp_version); |
|
199 |
||
200 |
require_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); |
|
201 |
$plugins = get_plugin_updates(); |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
202 |
if ( empty( $plugins ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
203 |
echo '<h3>' . __( 'Plugins' ) . '</h3>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
204 |
echo '<p>' . __( 'Your plugins are all up to date.' ) . '</p>'; |
136 | 205 |
return; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
206 |
} |
136 | 207 |
$form_action = 'update-core.php?action=do-plugin-upgrade'; |
208 |
||
209 |
$core_updates = get_core_updates(); |
|
210 |
if ( !isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=') ) |
|
211 |
$core_update_version = false; |
|
212 |
else |
|
213 |
$core_update_version = $core_updates[0]->current; |
|
214 |
?> |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
215 |
<h3><?php _e( 'Plugins' ); ?></h3> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
216 |
<p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click “Update Plugins”.' ); ?></p> |
136 | 217 |
<form method="post" action="<?php echo $form_action; ?>" name="upgrade-plugins" class="upgrade"> |
218 |
<?php wp_nonce_field('upgrade-core'); ?> |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
219 |
<p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p> |
136 | 220 |
<table class="widefat" cellspacing="0" id="update-plugins-table"> |
221 |
<thead> |
|
222 |
<tr> |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
223 |
<th scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all" /></th> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
224 |
<th scope="col" class="manage-column"><label for="plugins-select-all"><?php _e('Select All'); ?></label></th> |
136 | 225 |
</tr> |
226 |
</thead> |
|
227 |
||
228 |
<tfoot> |
|
229 |
<tr> |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
230 |
<th scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></th> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
231 |
<th scope="col" class="manage-column"><label for="plugins-select-all-2"><?php _e('Select All'); ?></label></th> |
136 | 232 |
</tr> |
233 |
</tfoot> |
|
234 |
<tbody class="plugins"> |
|
235 |
<?php |
|
236 |
foreach ( (array) $plugins as $plugin_file => $plugin_data) { |
|
237 |
$info = plugins_api('plugin_information', array('slug' => $plugin_data->update->slug )); |
|
238 |
// Get plugin compat for running version of WordPress. |
|
239 |
if ( isset($info->tested) && version_compare($info->tested, $cur_wp_version, '>=') ) { |
|
240 |
$compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version); |
|
241 |
} elseif ( isset($info->compatibility[$cur_wp_version][$plugin_data->update->new_version]) ) { |
|
242 |
$compat = $info->compatibility[$cur_wp_version][$plugin_data->update->new_version]; |
|
243 |
$compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $cur_wp_version, $compat[0], $compat[2], $compat[1]); |
|
244 |
} else { |
|
245 |
$compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $cur_wp_version); |
|
246 |
} |
|
247 |
// Get plugin compat for updated version of WordPress. |
|
248 |
if ( $core_update_version ) { |
|
249 |
if ( isset($info->compatibility[$core_update_version][$plugin_data->update->new_version]) ) { |
|
250 |
$update_compat = $info->compatibility[$core_update_version][$plugin_data->update->new_version]; |
|
251 |
$compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $core_update_version, $update_compat[0], $update_compat[2], $update_compat[1]); |
|
252 |
} else { |
|
253 |
$compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $core_update_version); |
|
254 |
} |
|
255 |
} |
|
256 |
// Get the upgrade notice for the new plugin version. |
|
257 |
if ( isset($plugin_data->update->upgrade_notice) ) { |
|
258 |
$upgrade_notice = '<br />' . strip_tags($plugin_data->update->upgrade_notice); |
|
259 |
} else { |
|
260 |
$upgrade_notice = ''; |
|
261 |
} |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
262 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
263 |
$details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin_data->update->slug . '§ion=changelog&TB_iframe=true&width=640&height=662'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
264 |
$details_text = sprintf(__('View version %1$s details'), $plugin_data->update->new_version); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
265 |
$details = sprintf('<a href="%1$s" class="thickbox" title="%2$s">%3$s</a>.', esc_url($details_url), esc_attr($plugin_data->Name), $details_text); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
266 |
|
136 | 267 |
echo " |
268 |
<tr class='active'> |
|
269 |
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' /></th> |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
270 |
<td><p><strong>{$plugin_data->Name}</strong><br />" . sprintf(__('You have version %1$s installed. Update to %2$s.'), $plugin_data->Version, $plugin_data->update->new_version) . ' ' . $details . $compat . $upgrade_notice . "</p></td> |
136 | 271 |
</tr>"; |
272 |
} |
|
273 |
?> |
|
274 |
</tbody> |
|
275 |
</table> |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
276 |
<p><input id="upgrade-plugins-2" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p> |
136 | 277 |
</form> |
278 |
<?php |
|
279 |
} |
|
280 |
||
281 |
function list_theme_updates() { |
|
282 |
$themes = get_theme_updates(); |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
283 |
if ( empty( $themes ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
284 |
echo '<h3>' . __( 'Themes' ) . '</h3>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
285 |
echo '<p>' . __( 'Your themes are all up to date.' ) . '</p>'; |
136 | 286 |
return; |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
287 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
288 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
289 |
$form_action = 'update-core.php?action=do-theme-upgrade'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
290 |
|
136 | 291 |
?> |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
292 |
<h3><?php _e( 'Themes' ); ?></h3> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
293 |
<p><?php _e( 'The following themes have new versions available. Check the ones you want to update and then click “Update Themes”.' ); ?></p> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
294 |
<p><?php printf( __('<strong>Please Note:</strong> Any customizations you have made to theme files will be lost. Please consider using <a href="%s">child themes</a> for modifications.'), _x('http://codex.wordpress.org/Child_Themes', 'Link used in suggestion to use child themes in GUU') ); ?></p> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
295 |
<form method="post" action="<?php echo $form_action; ?>" name="upgrade-themes" class="upgrade"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
296 |
<?php wp_nonce_field('upgrade-core'); ?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
297 |
<p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p> |
136 | 298 |
<table class="widefat" cellspacing="0" id="update-themes-table"> |
299 |
<thead> |
|
300 |
<tr> |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
301 |
<th scope="col" class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></th> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
302 |
<th scope="col" class="manage-column"><label for="themes-select-all"><?php _e('Select All'); ?></label></th> |
136 | 303 |
</tr> |
304 |
</thead> |
|
305 |
||
306 |
<tfoot> |
|
307 |
<tr> |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
308 |
<th scope="col" class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></th> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
309 |
<th scope="col" class="manage-column"><label for="themes-select-all-2"><?php _e('Select All'); ?></label></th> |
136 | 310 |
</tr> |
311 |
</tfoot> |
|
312 |
<tbody class="plugins"> |
|
313 |
<?php |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
314 |
foreach ( $themes as $stylesheet => $theme ) { |
136 | 315 |
echo " |
316 |
<tr class='active'> |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
317 |
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr( $stylesheet ) . "' /></th> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
318 |
<td class='plugin-title'><img src='" . esc_url( $theme->get_screenshot() ) . "' width='64' height='64' style='float:left; padding: 0 5px 5px' /><strong>" . $theme->display('Name') . '</strong> ' . sprintf( __( 'You have version %1$s installed. Update to %2$s.' ), $theme->display('Version'), $theme->update['new_version'] ) . "</td> |
136 | 319 |
</tr>"; |
320 |
} |
|
321 |
?> |
|
322 |
</tbody> |
|
323 |
</table> |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
324 |
<p><input id="upgrade-themes-2" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
325 |
</form> |
136 | 326 |
<?php |
327 |
} |
|
328 |
||
329 |
/** |
|
330 |
* Upgrade WordPress core display. |
|
331 |
* |
|
332 |
* @since 2.7 |
|
333 |
* |
|
334 |
* @return null |
|
335 |
*/ |
|
336 |
function do_core_upgrade( $reinstall = false ) { |
|
337 |
global $wp_filesystem; |
|
338 |
||
339 |
if ( $reinstall ) |
|
340 |
$url = 'update-core.php?action=do-core-reinstall'; |
|
341 |
else |
|
342 |
$url = 'update-core.php?action=do-core-upgrade'; |
|
343 |
$url = wp_nonce_url($url, 'upgrade-core'); |
|
344 |
if ( false === ($credentials = request_filesystem_credentials($url, '', false, ABSPATH)) ) |
|
345 |
return; |
|
346 |
||
347 |
$version = isset( $_POST['version'] )? $_POST['version'] : false; |
|
348 |
$locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US'; |
|
349 |
$update = find_core_update( $version, $locale ); |
|
350 |
if ( !$update ) |
|
351 |
return; |
|
352 |
||
353 |
if ( ! WP_Filesystem($credentials, ABSPATH) ) { |
|
354 |
request_filesystem_credentials($url, '', true, ABSPATH); //Failed to connect, Error and request again |
|
355 |
return; |
|
356 |
} |
|
357 |
?> |
|
358 |
<div class="wrap"> |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
359 |
<?php screen_icon('tools'); ?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
360 |
<h2><?php _e('Update WordPress'); ?></h2> |
136 | 361 |
<?php |
362 |
if ( $wp_filesystem->errors->get_error_code() ) { |
|
363 |
foreach ( $wp_filesystem->errors->get_error_messages() as $message ) |
|
364 |
show_message($message); |
|
365 |
echo '</div>'; |
|
366 |
return; |
|
367 |
} |
|
368 |
||
369 |
if ( $reinstall ) |
|
370 |
$update->response = 'reinstall'; |
|
371 |
||
372 |
$result = wp_update_core($update, 'show_message'); |
|
373 |
||
374 |
if ( is_wp_error($result) ) { |
|
375 |
show_message($result); |
|
376 |
if ('up_to_date' != $result->get_error_code() ) |
|
377 |
show_message( __('Installation Failed') ); |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
378 |
echo '</div>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
379 |
return; |
136 | 380 |
} |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
381 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
382 |
show_message( __('WordPress updated successfully') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
383 |
show_message( '<span class="hide-if-no-js">' . sprintf( __( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%s">here</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
384 |
show_message( '<span class="hide-if-js">' . sprintf( __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
385 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
386 |
</div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
387 |
<script type="text/javascript"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
388 |
window.location = '<?php echo self_admin_url( 'about.php?updated' ); ?>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
389 |
</script> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
390 |
<?php |
136 | 391 |
} |
392 |
||
393 |
function do_dismiss_core_update() { |
|
394 |
$version = isset( $_POST['version'] )? $_POST['version'] : false; |
|
395 |
$locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US'; |
|
396 |
$update = find_core_update( $version, $locale ); |
|
397 |
if ( !$update ) |
|
398 |
return; |
|
399 |
dismiss_core_update( $update ); |
|
400 |
wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') ); |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
401 |
exit; |
136 | 402 |
} |
403 |
||
404 |
function do_undismiss_core_update() { |
|
405 |
$version = isset( $_POST['version'] )? $_POST['version'] : false; |
|
406 |
$locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US'; |
|
407 |
$update = find_core_update( $version, $locale ); |
|
408 |
if ( !$update ) |
|
409 |
return; |
|
410 |
undismiss_core_update( $version, $locale ); |
|
411 |
wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') ); |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
412 |
exit; |
136 | 413 |
} |
414 |
||
415 |
function no_update_actions($actions) { |
|
416 |
return ''; |
|
417 |
} |
|
418 |
||
419 |
$action = isset($_GET['action']) ? $_GET['action'] : 'upgrade-core'; |
|
420 |
||
421 |
$upgrade_error = false; |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
422 |
if ( ( 'do-theme-upgrade' == $action || ( 'do-plugin-upgrade' == $action && ! isset( $_GET['plugins'] ) ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
423 |
&& ! isset( $_POST['checked'] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
424 |
$upgrade_error = $action == 'do-theme-upgrade' ? 'themes' : 'plugins'; |
136 | 425 |
$action = 'upgrade-core'; |
426 |
} |
|
427 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
428 |
$title = __('WordPress Updates'); |
136 | 429 |
$parent_file = 'tools.php'; |
430 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
431 |
get_current_screen()->add_help_tab( array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
432 |
'id' => 'overview', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
433 |
'title' => __('Overview'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
434 |
'content' => |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
435 |
'<p>' . __('This screen lets you update to the latest version of WordPress as well as update your themes and plugins from the WordPress.org repository. When updates are available, the number of available updates will appear in a bubble on the left hand menu as a notification.') . '</p>' . |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
436 |
'<p>' . __('It is very important to keep your WordPress installation up to date for security reasons, so when you see a number appear, make sure you take the time to update, which is an easy process.') . '</p>' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
437 |
) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
438 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
439 |
get_current_screen()->add_help_tab( array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
440 |
'id' => 'how-to-update', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
441 |
'title' => __('How to Update'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
442 |
'content' => |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
443 |
'<p>' . __('Updating your WordPress installation is a simple one-click procedure; just click on the Update button when it says a new version is available.') . '</p>' . |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
444 |
'<p>' . __('To update themes or plugins from this screen, use the checkboxes to make your selection and click on the appropriate Update button. Check the box at the top of the Themes or Plugins section to select all and update them all at once.') . '</p>' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
445 |
) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
446 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
447 |
get_current_screen()->set_help_sidebar( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
448 |
'<p><strong>' . __('For more information:') . '</strong></p>' . |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
449 |
'<p>' . __('<a href="http://codex.wordpress.org/Dashboard_Updates_Screen" target="_blank">Documentation on Updating WordPress</a>') . '</p>' . |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
450 |
'<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
|
451 |
); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
452 |
|
136 | 453 |
if ( 'upgrade-core' == $action ) { |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
454 |
|
136 | 455 |
wp_version_check(); |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
456 |
require_once(ABSPATH . 'wp-admin/admin-header.php'); |
136 | 457 |
core_upgrade_preamble(); |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
458 |
include(ABSPATH . 'wp-admin/admin-footer.php'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
459 |
|
136 | 460 |
} elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) { |
461 |
check_admin_referer('upgrade-core'); |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
462 |
|
136 | 463 |
// do the (un)dismiss actions before headers, |
464 |
// so that they can redirect |
|
465 |
if ( isset( $_POST['dismiss'] ) ) |
|
466 |
do_dismiss_core_update(); |
|
467 |
elseif ( isset( $_POST['undismiss'] ) ) |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
468 |
do_undismiss_core_update(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
469 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
470 |
require_once(ABSPATH . 'wp-admin/admin-header.php'); |
136 | 471 |
if ( 'do-core-reinstall' == $action ) |
472 |
$reinstall = true; |
|
473 |
else |
|
474 |
$reinstall = false; |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
475 |
|
136 | 476 |
if ( isset( $_POST['upgrade'] ) ) |
477 |
do_core_upgrade($reinstall); |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
478 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
479 |
include(ABSPATH . 'wp-admin/admin-footer.php'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
480 |
|
136 | 481 |
} elseif ( 'do-plugin-upgrade' == $action ) { |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
482 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
483 |
if ( ! current_user_can( 'update_plugins' ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
484 |
wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
485 |
|
136 | 486 |
check_admin_referer('upgrade-core'); |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
487 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
488 |
if ( isset( $_GET['plugins'] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
489 |
$plugins = explode( ',', $_GET['plugins'] ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
490 |
} elseif ( isset( $_POST['checked'] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
491 |
$plugins = (array) $_POST['checked']; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
492 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
493 |
wp_redirect( admin_url('update-core.php') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
494 |
exit; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
495 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
496 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
497 |
$url = 'update.php?action=update-selected&plugins=' . urlencode(implode(',', $plugins)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
498 |
$url = wp_nonce_url($url, 'bulk-update-plugins'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
499 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
500 |
$title = __('Update Plugins'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
501 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
502 |
require_once(ABSPATH . 'wp-admin/admin-header.php'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
503 |
echo '<div class="wrap">'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
504 |
screen_icon('plugins'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
505 |
echo '<h2>' . esc_html__('Update Plugins') . '</h2>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
506 |
echo "<iframe src='$url' style='width: 100%; height: 100%; min-height: 750px;' frameborder='0'></iframe>"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
507 |
echo '</div>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
508 |
include(ABSPATH . 'wp-admin/admin-footer.php'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
509 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
510 |
} elseif ( 'do-theme-upgrade' == $action ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
511 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
512 |
if ( ! current_user_can( 'update_themes' ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
513 |
wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
136 | 514 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
515 |
check_admin_referer('upgrade-core'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
516 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
517 |
if ( isset( $_GET['themes'] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
518 |
$themes = explode( ',', $_GET['themes'] ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
519 |
} elseif ( isset( $_POST['checked'] ) ) { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
520 |
$themes = (array) $_POST['checked']; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
521 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
522 |
wp_redirect( admin_url('update-core.php') ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
523 |
exit; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
524 |
} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
525 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
526 |
$url = 'update.php?action=update-selected-themes&themes=' . urlencode(implode(',', $themes)); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
527 |
$url = wp_nonce_url($url, 'bulk-update-themes'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
528 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
529 |
$title = __('Update Themes'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
530 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
531 |
require_once(ABSPATH . 'wp-admin/admin-header.php'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
532 |
echo '<div class="wrap">'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
533 |
screen_icon('themes'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
534 |
echo '<h2>' . esc_html__('Update Themes') . '</h2>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
535 |
echo "<iframe src='$url' style='width: 100%; height: 100%; min-height: 750px;' frameborder='0'></iframe>"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
536 |
echo '</div>'; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
537 |
include(ABSPATH . 'wp-admin/admin-footer.php'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
538 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
539 |
} else { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
540 |
do_action('update-core-custom_' . $action); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
541 |
} |