4 * |
4 * |
5 * @package WordPress |
5 * @package WordPress |
6 * @subpackage Administration |
6 * @subpackage Administration |
7 */ |
7 */ |
8 |
8 |
9 if ( ! defined( 'IFRAME_REQUEST' ) && isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) ) { |
9 if ( ! defined( 'IFRAME_REQUEST' ) |
|
10 && isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ), true ) |
|
11 ) { |
10 define( 'IFRAME_REQUEST', true ); |
12 define( 'IFRAME_REQUEST', true ); |
11 } |
13 } |
12 |
14 |
13 /** WordPress Administration Bootstrap */ |
15 /** WordPress Administration Bootstrap */ |
14 require_once( dirname( __FILE__ ) . '/admin.php' ); |
16 require_once __DIR__ . '/admin.php'; |
15 |
17 |
16 include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
18 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
19 |
|
20 wp_enqueue_script( 'wp-a11y' ); |
17 |
21 |
18 if ( isset( $_GET['action'] ) ) { |
22 if ( isset( $_GET['action'] ) ) { |
19 $plugin = isset( $_REQUEST['plugin'] ) ? trim( $_REQUEST['plugin'] ) : ''; |
23 $plugin = isset( $_REQUEST['plugin'] ) ? trim( $_REQUEST['plugin'] ) : ''; |
20 $theme = isset( $_REQUEST['theme'] ) ? urldecode( $_REQUEST['theme'] ) : ''; |
24 $theme = isset( $_REQUEST['theme'] ) ? urldecode( $_REQUEST['theme'] ) : ''; |
21 $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : ''; |
25 $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : ''; |
22 |
26 |
23 if ( 'update-selected' == $action ) { |
27 if ( 'update-selected' === $action ) { |
24 if ( ! current_user_can( 'update_plugins' ) ) { |
28 if ( ! current_user_can( 'update_plugins' ) ) { |
25 wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) ); |
29 wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) ); |
26 } |
30 } |
27 |
31 |
28 check_admin_referer( 'bulk-update-plugins' ); |
32 check_admin_referer( 'bulk-update-plugins' ); |
46 $upgrader = new Plugin_Upgrader( new Bulk_Plugin_Upgrader_Skin( compact( 'nonce', 'url' ) ) ); |
50 $upgrader = new Plugin_Upgrader( new Bulk_Plugin_Upgrader_Skin( compact( 'nonce', 'url' ) ) ); |
47 $upgrader->bulk_upgrade( $plugins ); |
51 $upgrader->bulk_upgrade( $plugins ); |
48 |
52 |
49 iframe_footer(); |
53 iframe_footer(); |
50 |
54 |
51 } elseif ( 'upgrade-plugin' == $action ) { |
55 } elseif ( 'upgrade-plugin' === $action ) { |
52 if ( ! current_user_can( 'update_plugins' ) ) { |
56 if ( ! current_user_can( 'update_plugins' ) ) { |
53 wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) ); |
57 wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) ); |
54 } |
58 } |
55 |
59 |
56 check_admin_referer( 'upgrade-plugin_' . $plugin ); |
60 check_admin_referer( 'upgrade-plugin_' . $plugin ); |
58 $title = __( 'Update Plugin' ); |
62 $title = __( 'Update Plugin' ); |
59 $parent_file = 'plugins.php'; |
63 $parent_file = 'plugins.php'; |
60 $submenu_file = 'plugins.php'; |
64 $submenu_file = 'plugins.php'; |
61 |
65 |
62 wp_enqueue_script( 'updates' ); |
66 wp_enqueue_script( 'updates' ); |
63 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
67 require_once ABSPATH . 'wp-admin/admin-header.php'; |
64 |
68 |
65 $nonce = 'upgrade-plugin_' . $plugin; |
69 $nonce = 'upgrade-plugin_' . $plugin; |
66 $url = 'update.php?action=upgrade-plugin&plugin=' . urlencode( $plugin ); |
70 $url = 'update.php?action=upgrade-plugin&plugin=' . urlencode( $plugin ); |
67 |
71 |
68 $upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact( 'title', 'nonce', 'url', 'plugin' ) ) ); |
72 $upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact( 'title', 'nonce', 'url', 'plugin' ) ) ); |
69 $upgrader->upgrade( $plugin ); |
73 $upgrader->upgrade( $plugin ); |
70 |
74 |
71 include( ABSPATH . 'wp-admin/admin-footer.php' ); |
75 require_once ABSPATH . 'wp-admin/admin-footer.php'; |
72 |
76 |
73 } elseif ( 'activate-plugin' == $action ) { |
77 } elseif ( 'activate-plugin' === $action ) { |
74 if ( ! current_user_can( 'update_plugins' ) ) { |
78 if ( ! current_user_can( 'update_plugins' ) ) { |
75 wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) ); |
79 wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) ); |
76 } |
80 } |
77 |
81 |
78 check_admin_referer( 'activate-plugin_' . $plugin ); |
82 check_admin_referer( 'activate-plugin_' . $plugin ); |
89 |
93 |
90 if ( isset( $_GET['failure'] ) ) { |
94 if ( isset( $_GET['failure'] ) ) { |
91 echo '<p>' . __( 'Plugin failed to reactivate due to a fatal error.' ) . '</p>'; |
95 echo '<p>' . __( 'Plugin failed to reactivate due to a fatal error.' ) . '</p>'; |
92 |
96 |
93 error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); |
97 error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); |
94 @ini_set( 'display_errors', true ); //Ensure that Fatal errors are displayed. |
98 ini_set( 'display_errors', true ); // Ensure that fatal errors are displayed. |
95 wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin ); |
99 wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin ); |
96 include( WP_PLUGIN_DIR . '/' . $plugin ); |
100 include WP_PLUGIN_DIR . '/' . $plugin; |
97 } |
101 } |
98 iframe_footer(); |
102 iframe_footer(); |
99 } elseif ( 'install-plugin' == $action ) { |
103 } elseif ( 'install-plugin' === $action ) { |
100 |
104 |
101 if ( ! current_user_can( 'install_plugins' ) ) { |
105 if ( ! current_user_can( 'install_plugins' ) ) { |
102 wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) ); |
106 wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) ); |
103 } |
107 } |
104 |
108 |
105 include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api.. |
109 include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; // For plugins_api(). |
106 |
110 |
107 check_admin_referer( 'install-plugin_' . $plugin ); |
111 check_admin_referer( 'install-plugin_' . $plugin ); |
108 $api = plugins_api( |
112 $api = plugins_api( |
109 'plugin_information', |
113 'plugin_information', |
110 array( |
114 array( |
120 } |
124 } |
121 |
125 |
122 $title = __( 'Plugin Installation' ); |
126 $title = __( 'Plugin Installation' ); |
123 $parent_file = 'plugins.php'; |
127 $parent_file = 'plugins.php'; |
124 $submenu_file = 'plugin-install.php'; |
128 $submenu_file = 'plugin-install.php'; |
125 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
129 require_once ABSPATH . 'wp-admin/admin-header.php'; |
126 |
130 |
|
131 /* translators: %s: Plugin name and version. */ |
127 $title = sprintf( __( 'Installing Plugin: %s' ), $api->name . ' ' . $api->version ); |
132 $title = sprintf( __( 'Installing Plugin: %s' ), $api->name . ' ' . $api->version ); |
128 $nonce = 'install-plugin_' . $plugin; |
133 $nonce = 'install-plugin_' . $plugin; |
129 $url = 'update.php?action=install-plugin&plugin=' . urlencode( $plugin ); |
134 $url = 'update.php?action=install-plugin&plugin=' . urlencode( $plugin ); |
130 if ( isset( $_GET['from'] ) ) { |
135 if ( isset( $_GET['from'] ) ) { |
131 $url .= '&from=' . urlencode( stripslashes( $_GET['from'] ) ); |
136 $url .= '&from=' . urlencode( stripslashes( $_GET['from'] ) ); |
132 } |
137 } |
133 |
138 |
134 $type = 'web'; //Install plugin type, From Web or an Upload. |
139 $type = 'web'; // Install plugin type, From Web or an Upload. |
135 |
140 |
136 $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact( 'title', 'url', 'nonce', 'plugin', 'api' ) ) ); |
141 $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact( 'title', 'url', 'nonce', 'plugin', 'api' ) ) ); |
137 $upgrader->install( $api->download_link ); |
142 $upgrader->install( $api->download_link ); |
138 |
143 |
139 include( ABSPATH . 'wp-admin/admin-footer.php' ); |
144 require_once ABSPATH . 'wp-admin/admin-footer.php'; |
140 |
145 |
141 } elseif ( 'upload-plugin' == $action ) { |
146 } elseif ( 'upload-plugin' === $action ) { |
142 |
147 |
143 if ( ! current_user_can( 'upload_plugins' ) ) { |
148 if ( ! current_user_can( 'upload_plugins' ) ) { |
144 wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) ); |
149 wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) ); |
145 } |
150 } |
146 |
151 |
149 $file_upload = new File_Upload_Upgrader( 'pluginzip', 'package' ); |
154 $file_upload = new File_Upload_Upgrader( 'pluginzip', 'package' ); |
150 |
155 |
151 $title = __( 'Upload Plugin' ); |
156 $title = __( 'Upload Plugin' ); |
152 $parent_file = 'plugins.php'; |
157 $parent_file = 'plugins.php'; |
153 $submenu_file = 'plugin-install.php'; |
158 $submenu_file = 'plugin-install.php'; |
154 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
159 require_once ABSPATH . 'wp-admin/admin-header.php'; |
155 |
160 |
156 $title = sprintf( __( 'Installing Plugin from uploaded file: %s' ), esc_html( basename( $file_upload->filename ) ) ); |
161 /* translators: %s: File name. */ |
|
162 $title = sprintf( __( 'Installing plugin from uploaded file: %s' ), esc_html( basename( $file_upload->filename ) ) ); |
157 $nonce = 'plugin-upload'; |
163 $nonce = 'plugin-upload'; |
158 $url = add_query_arg( array( 'package' => $file_upload->id ), 'update.php?action=upload-plugin' ); |
164 $url = add_query_arg( array( 'package' => $file_upload->id ), 'update.php?action=upload-plugin' ); |
159 $type = 'upload'; //Install plugin type, From Web or an Upload. |
165 $type = 'upload'; // Install plugin type, From Web or an Upload. |
160 |
166 |
161 $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact( 'type', 'title', 'nonce', 'url' ) ) ); |
167 $overwrite = isset( $_GET['overwrite'] ) ? sanitize_text_field( $_GET['overwrite'] ) : ''; |
162 $result = $upgrader->install( $file_upload->package ); |
168 $overwrite = in_array( $overwrite, array( 'update-plugin', 'downgrade-plugin' ), true ) ? $overwrite : ''; |
|
169 |
|
170 $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact( 'type', 'title', 'nonce', 'url', 'overwrite' ) ) ); |
|
171 $result = $upgrader->install( $file_upload->package, array( 'overwrite_package' => $overwrite ) ); |
163 |
172 |
164 if ( $result || is_wp_error( $result ) ) { |
173 if ( $result || is_wp_error( $result ) ) { |
165 $file_upload->cleanup(); |
174 $file_upload->cleanup(); |
166 } |
175 } |
167 |
176 |
168 include( ABSPATH . 'wp-admin/admin-footer.php' ); |
177 require_once ABSPATH . 'wp-admin/admin-footer.php'; |
169 |
178 |
170 } elseif ( 'upgrade-theme' == $action ) { |
179 } elseif ( 'upload-plugin-cancel-overwrite' === $action ) { |
|
180 if ( ! current_user_can( 'upload_plugins' ) ) { |
|
181 wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) ); |
|
182 } |
|
183 |
|
184 check_admin_referer( 'plugin-upload-cancel-overwrite' ); |
|
185 |
|
186 // Make sure the attachment still exists, or File_Upload_Upgrader will call wp_die() |
|
187 // that shows a generic "Please select a file" error. |
|
188 if ( ! empty( $_GET['package'] ) ) { |
|
189 $attachment_id = (int) $_GET['package']; |
|
190 |
|
191 if ( get_post( $attachment_id ) ) { |
|
192 $file_upload = new File_Upload_Upgrader( 'pluginzip', 'package' ); |
|
193 $file_upload->cleanup(); |
|
194 } |
|
195 } |
|
196 |
|
197 wp_redirect( self_admin_url( 'plugin-install.php' ) ); |
|
198 exit; |
|
199 } elseif ( 'upgrade-theme' === $action ) { |
171 |
200 |
172 if ( ! current_user_can( 'update_themes' ) ) { |
201 if ( ! current_user_can( 'update_themes' ) ) { |
173 wp_die( __( 'Sorry, you are not allowed to update themes for this site.' ) ); |
202 wp_die( __( 'Sorry, you are not allowed to update themes for this site.' ) ); |
174 } |
203 } |
175 |
204 |
178 wp_enqueue_script( 'updates' ); |
207 wp_enqueue_script( 'updates' ); |
179 |
208 |
180 $title = __( 'Update Theme' ); |
209 $title = __( 'Update Theme' ); |
181 $parent_file = 'themes.php'; |
210 $parent_file = 'themes.php'; |
182 $submenu_file = 'themes.php'; |
211 $submenu_file = 'themes.php'; |
183 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
212 require_once ABSPATH . 'wp-admin/admin-header.php'; |
184 |
213 |
185 $nonce = 'upgrade-theme_' . $theme; |
214 $nonce = 'upgrade-theme_' . $theme; |
186 $url = 'update.php?action=upgrade-theme&theme=' . urlencode( $theme ); |
215 $url = 'update.php?action=upgrade-theme&theme=' . urlencode( $theme ); |
187 |
216 |
188 $upgrader = new Theme_Upgrader( new Theme_Upgrader_Skin( compact( 'title', 'nonce', 'url', 'theme' ) ) ); |
217 $upgrader = new Theme_Upgrader( new Theme_Upgrader_Skin( compact( 'title', 'nonce', 'url', 'theme' ) ) ); |
189 $upgrader->upgrade( $theme ); |
218 $upgrader->upgrade( $theme ); |
190 |
219 |
191 include( ABSPATH . 'wp-admin/admin-footer.php' ); |
220 require_once ABSPATH . 'wp-admin/admin-footer.php'; |
192 } elseif ( 'update-selected-themes' == $action ) { |
221 } elseif ( 'update-selected-themes' === $action ) { |
193 if ( ! current_user_can( 'update_themes' ) ) { |
222 if ( ! current_user_can( 'update_themes' ) ) { |
194 wp_die( __( 'Sorry, you are not allowed to update themes for this site.' ) ); |
223 wp_die( __( 'Sorry, you are not allowed to update themes for this site.' ) ); |
195 } |
224 } |
196 |
225 |
197 check_admin_referer( 'bulk-update-themes' ); |
226 check_admin_referer( 'bulk-update-themes' ); |
214 |
243 |
215 $upgrader = new Theme_Upgrader( new Bulk_Theme_Upgrader_Skin( compact( 'nonce', 'url' ) ) ); |
244 $upgrader = new Theme_Upgrader( new Bulk_Theme_Upgrader_Skin( compact( 'nonce', 'url' ) ) ); |
216 $upgrader->bulk_upgrade( $themes ); |
245 $upgrader->bulk_upgrade( $themes ); |
217 |
246 |
218 iframe_footer(); |
247 iframe_footer(); |
219 } elseif ( 'install-theme' == $action ) { |
248 } elseif ( 'install-theme' === $action ) { |
220 |
249 |
221 if ( ! current_user_can( 'install_themes' ) ) { |
250 if ( ! current_user_can( 'install_themes' ) ) { |
222 wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) ); |
251 wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) ); |
223 } |
252 } |
224 |
253 |
225 include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); //for themes_api.. |
254 include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; // For themes_api(). |
226 |
255 |
227 check_admin_referer( 'install-theme_' . $theme ); |
256 check_admin_referer( 'install-theme_' . $theme ); |
228 $api = themes_api( |
257 $api = themes_api( |
229 'theme_information', |
258 'theme_information', |
230 array( |
259 array( |
232 'fields' => array( |
261 'fields' => array( |
233 'sections' => false, |
262 'sections' => false, |
234 'tags' => false, |
263 'tags' => false, |
235 ), |
264 ), |
236 ) |
265 ) |
237 ); //Save on a bit of bandwidth. |
266 ); // Save on a bit of bandwidth. |
238 |
267 |
239 if ( is_wp_error( $api ) ) { |
268 if ( is_wp_error( $api ) ) { |
240 wp_die( $api ); |
269 wp_die( $api ); |
241 } |
270 } |
242 |
271 |
243 $title = __( 'Install Themes' ); |
272 $title = __( 'Install Themes' ); |
244 $parent_file = 'themes.php'; |
273 $parent_file = 'themes.php'; |
245 $submenu_file = 'themes.php'; |
274 $submenu_file = 'themes.php'; |
246 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
275 require_once ABSPATH . 'wp-admin/admin-header.php'; |
247 |
276 |
|
277 /* translators: %s: Theme name and version. */ |
248 $title = sprintf( __( 'Installing Theme: %s' ), $api->name . ' ' . $api->version ); |
278 $title = sprintf( __( 'Installing Theme: %s' ), $api->name . ' ' . $api->version ); |
249 $nonce = 'install-theme_' . $theme; |
279 $nonce = 'install-theme_' . $theme; |
250 $url = 'update.php?action=install-theme&theme=' . urlencode( $theme ); |
280 $url = 'update.php?action=install-theme&theme=' . urlencode( $theme ); |
251 $type = 'web'; //Install theme type, From Web or an Upload. |
281 $type = 'web'; // Install theme type, From Web or an Upload. |
252 |
282 |
253 $upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact( 'title', 'url', 'nonce', 'plugin', 'api' ) ) ); |
283 $upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact( 'title', 'url', 'nonce', 'plugin', 'api' ) ) ); |
254 $upgrader->install( $api->download_link ); |
284 $upgrader->install( $api->download_link ); |
255 |
285 |
256 include( ABSPATH . 'wp-admin/admin-footer.php' ); |
286 require_once ABSPATH . 'wp-admin/admin-footer.php'; |
257 |
287 |
258 } elseif ( 'upload-theme' == $action ) { |
288 } elseif ( 'upload-theme' === $action ) { |
259 |
289 |
260 if ( ! current_user_can( 'upload_themes' ) ) { |
290 if ( ! current_user_can( 'upload_themes' ) ) { |
261 wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) ); |
291 wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) ); |
262 } |
292 } |
263 |
293 |
267 |
297 |
268 $title = __( 'Upload Theme' ); |
298 $title = __( 'Upload Theme' ); |
269 $parent_file = 'themes.php'; |
299 $parent_file = 'themes.php'; |
270 $submenu_file = 'theme-install.php'; |
300 $submenu_file = 'theme-install.php'; |
271 |
301 |
272 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
302 require_once ABSPATH . 'wp-admin/admin-header.php'; |
273 |
303 |
274 $title = sprintf( __( 'Installing Theme from uploaded file: %s' ), esc_html( basename( $file_upload->filename ) ) ); |
304 /* translators: %s: File name. */ |
|
305 $title = sprintf( __( 'Installing theme from uploaded file: %s' ), esc_html( basename( $file_upload->filename ) ) ); |
275 $nonce = 'theme-upload'; |
306 $nonce = 'theme-upload'; |
276 $url = add_query_arg( array( 'package' => $file_upload->id ), 'update.php?action=upload-theme' ); |
307 $url = add_query_arg( array( 'package' => $file_upload->id ), 'update.php?action=upload-theme' ); |
277 $type = 'upload'; //Install plugin type, From Web or an Upload. |
308 $type = 'upload'; // Install theme type, From Web or an Upload. |
278 |
309 |
279 $upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact( 'type', 'title', 'nonce', 'url' ) ) ); |
310 $overwrite = isset( $_GET['overwrite'] ) ? sanitize_text_field( $_GET['overwrite'] ) : ''; |
280 $result = $upgrader->install( $file_upload->package ); |
311 $overwrite = in_array( $overwrite, array( 'update-theme', 'downgrade-theme' ), true ) ? $overwrite : ''; |
|
312 |
|
313 $upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact( 'type', 'title', 'nonce', 'url', 'overwrite' ) ) ); |
|
314 $result = $upgrader->install( $file_upload->package, array( 'overwrite_package' => $overwrite ) ); |
281 |
315 |
282 if ( $result || is_wp_error( $result ) ) { |
316 if ( $result || is_wp_error( $result ) ) { |
283 $file_upload->cleanup(); |
317 $file_upload->cleanup(); |
284 } |
318 } |
285 |
319 |
286 include( ABSPATH . 'wp-admin/admin-footer.php' ); |
320 require_once ABSPATH . 'wp-admin/admin-footer.php'; |
287 |
321 |
|
322 } elseif ( 'upload-theme-cancel-overwrite' === $action ) { |
|
323 if ( ! current_user_can( 'upload_themes' ) ) { |
|
324 wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) ); |
|
325 } |
|
326 |
|
327 check_admin_referer( 'theme-upload-cancel-overwrite' ); |
|
328 |
|
329 // Make sure the attachment still exists, or File_Upload_Upgrader will call wp_die() |
|
330 // that shows a generic "Please select a file" error. |
|
331 if ( ! empty( $_GET['package'] ) ) { |
|
332 $attachment_id = (int) $_GET['package']; |
|
333 |
|
334 if ( get_post( $attachment_id ) ) { |
|
335 $file_upload = new File_Upload_Upgrader( 'themezip', 'package' ); |
|
336 $file_upload->cleanup(); |
|
337 } |
|
338 } |
|
339 |
|
340 wp_redirect( self_admin_url( 'theme-install.php' ) ); |
|
341 exit; |
288 } else { |
342 } else { |
289 /** |
343 /** |
290 * Fires when a custom plugin or theme update request is received. |
344 * Fires when a custom plugin or theme update request is received. |
291 * |
345 * |
292 * The dynamic portion of the hook name, `$action`, refers to the action |
346 * The dynamic portion of the hook name, `$action`, refers to the action |
293 * provided in the request for wp-admin/update.php. Can be used to |
347 * provided in the request for wp-admin/update.php. Can be used to |
294 * provide custom update functionality for themes and plugins. |
348 * provide custom update functionality for themes and plugins. |
295 * |
349 * |
296 * @since 2.8.0 |
350 * @since 2.8.0 |
297 */ |
351 */ |
298 do_action( "update-custom_{$action}" ); |
352 do_action( "update-custom_{$action}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
299 } |
353 } |
300 } |
354 } |