@@ 141-169 (lines=29) @@ | ||
138 | ||
139 | include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
140 | ||
141 | } elseif ( 'upload-plugin' == $action ) { |
|
142 | ||
143 | if ( ! current_user_can( 'upload_plugins' ) ) { |
|
144 | wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) ); |
|
145 | } |
|
146 | ||
147 | check_admin_referer('plugin-upload'); |
|
148 | ||
149 | $file_upload = new File_Upload_Upgrader('pluginzip', 'package'); |
|
150 | ||
151 | $title = __('Upload Plugin'); |
|
152 | $parent_file = 'plugins.php'; |
|
153 | $submenu_file = 'plugin-install.php'; |
|
154 | require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
155 | ||
156 | $title = sprintf( __('Installing Plugin from uploaded file: %s'), esc_html( basename( $file_upload->filename ) ) ); |
|
157 | $nonce = 'plugin-upload'; |
|
158 | $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. |
|
160 | ||
161 | $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) ); |
|
162 | $result = $upgrader->install( $file_upload->package ); |
|
163 | ||
164 | if ( $result || is_wp_error($result) ) |
|
165 | $file_upload->cleanup(); |
|
166 | ||
167 | include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
168 | ||
169 | } elseif ( 'upgrade-theme' == $action ) { |
|
170 | ||
171 | if ( ! current_user_can('update_themes') ) |
|
172 | wp_die(__('Sorry, you are not allowed to update themes for this site.')); |
|
@@ 246-277 (lines=32) @@ | ||
243 | ||
244 | include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
245 | ||
246 | } elseif ( 'upload-theme' == $action ) { |
|
247 | ||
248 | if ( ! current_user_can( 'upload_themes' ) ) { |
|
249 | wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) ); |
|
250 | } |
|
251 | ||
252 | check_admin_referer('theme-upload'); |
|
253 | ||
254 | $file_upload = new File_Upload_Upgrader('themezip', 'package'); |
|
255 | ||
256 | wp_enqueue_script( 'customize-loader' ); |
|
257 | ||
258 | $title = __('Upload Theme'); |
|
259 | $parent_file = 'themes.php'; |
|
260 | $submenu_file = 'theme-install.php'; |
|
261 | ||
262 | require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
263 | ||
264 | $title = sprintf( __('Installing Theme from uploaded file: %s'), esc_html( basename( $file_upload->filename ) ) ); |
|
265 | $nonce = 'theme-upload'; |
|
266 | $url = add_query_arg(array('package' => $file_upload->id), 'update.php?action=upload-theme'); |
|
267 | $type = 'upload'; //Install plugin type, From Web or an Upload. |
|
268 | ||
269 | $upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) ); |
|
270 | $result = $upgrader->install( $file_upload->package ); |
|
271 | ||
272 | if ( $result || is_wp_error($result) ) |
|
273 | $file_upload->cleanup(); |
|
274 | ||
275 | include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
276 | ||
277 | } else { |
|
278 | /** |
|
279 | * Fires when a custom plugin or theme update request is received. |
|
280 | * |