PluginProbe
ManageWP Worker / 3.9.13
ManageWP Worker v3.9.13
4.9.38 4.9.37 4.9.36 4.9.35 4.9.34 3.8.7 3.8.8 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.18 3.9.19 3.9.2 3.9.20 3.9.21 3.9.22 3.9.23 3.9.24 All 73 releases
worker / installer.class.php

installer.class.php in ManageWP Worker 3.9.13, at installer.class.php

785 lines 30.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*************************************************************
3 *
4 * installer.class.php
5 *
6 * Upgrade WordPress
7 *
8 *
9 * Copyright (c) 2011 Prelovac Media
10 * www.prelovac.com
11 **************************************************************/
12
13 class MMB_Installer extends MMB_Core
14 {
15 function __construct()
16 {
17 @set_time_limit(600);
18 parent::__construct();
19 @include_once(ABSPATH . 'wp-admin/includes/file.php');
20 @include_once(ABSPATH . 'wp-admin/includes/plugin.php');
21 @include_once(ABSPATH . 'wp-admin/includes/theme.php');
22 @include_once(ABSPATH . 'wp-admin/includes/misc.php');
23 @include_once(ABSPATH . 'wp-admin/includes/template.php');
24 @include_once(ABSPATH . 'wp-admin/includes/class-wp-upgrader.php');
25
26 global $wp_filesystem;
27 if (!$wp_filesystem)
28 WP_Filesystem();
29 }
30
31 function mmb_maintenance_mode($enable = false, $maintenance_message = '')
32 {
33 global $wp_filesystem;
34
35 $maintenance_message .= '<?php $upgrading = ' . time() . '; ?>';
36
37 $file = $wp_filesystem->abspath() . '.maintenance';
38 if ($enable) {
39 $wp_filesystem->delete($file);
40 $wp_filesystem->put_contents($file, $maintenance_message, FS_CHMOD_FILE);
41 } else {
42 $wp_filesystem->delete($file);
43 }
44 }
45
46 function install_remote_file($params)
47 {
48 global $wp_filesystem;
49 extract($params);
50
51 if (!isset($package) || empty($package))
52 return array(
53 'error' => '<p>No files received. Internal error.</p>'
54 );
55
56 if (defined('WP_INSTALLING') && file_exists(ABSPATH . '.maintenance'))
57 return array(
58 'error' => '<p>Site under maintanace.</p>'
59 );
60
61 if (!class_exists('WP_Upgrader'))
62 include_once(ABSPATH . 'wp-admin/includes/class-wp-upgrader.php');
63
64 $upgrader_skin = new WP_Upgrader_Skin();
65 $upgrader_skin->done_header = true;
66
67 $upgrader = new WP_Upgrader($upgrader_skin);
68 $destination = $type == 'themes' ? WP_CONTENT_DIR . '/themes' : WP_PLUGIN_DIR;
69 $clear_destination = isset($clear_destination) ? $clear_destination : false;
70
71 foreach ($package as $package_url) {
72 $key = basename($package_url);
73 $install_info[$key] = @$upgrader->run(array(
74 'package' => $package_url,
75 'destination' => $destination,
76 'clear_destination' => $clear_destination, //Do not overwrite files.
77 'clear_working' => true,
78 'hook_extra' => array()
79 ));
80 }
81
82 if ($activate) {
83 if ($type == 'plugins') {
84 include_once(ABSPATH . 'wp-admin/includes/plugin.php');
85 $all_plugins = get_plugins();
86 foreach ($all_plugins as $plugin_slug => $plugin) {
87 $plugin_dir = preg_split('/\//', $plugin_slug);
88 foreach ($install_info as $key => $install) {
89 if (!$install || is_wp_error($install))
90 continue;
91 if ($install['destination_name'] == $plugin_dir[0]) {
92 $install_info[$key]['activated'] = activate_plugin($plugin_slug, '', false);
93 }
94 }
95 }
96 } else if (count($install_info) == 1) {
97 global $wp_themes;
98 include_once(ABSPATH . 'wp-includes/theme.php');
99
100 $wp_themes = null;
101 unset($wp_themes); //prevent theme data caching
102
103 $all_themes = get_themes();
104 foreach ($all_themes as $theme_name => $theme_data) {
105 foreach ($install_info as $key => $install) {
106 if (!$install || is_wp_error($install))
107 continue;
108
109 if ($theme_data['Template'] == $install['destination_name']) {
110 $install_info[$key]['activated'] = switch_theme($theme_data['Template'], $theme_data['Stylesheet']);
111 }
112 }
113 }
114 }
115 }
116 ob_clean();
117 $this->mmb_maintenance_mode(false);
118 return $install_info;
119 }
120
121 function do_upgrade($params = null)
122 {
123 if ($params == null || empty($params))
124 return array(
125 'failed' => 'No upgrades passed.'
126 );
127
128 if (!$this->is_server_writable()) {
129 return array(
130 'error' => 'Failed, please <a target="_blank" href="http://managewp.com/user-guide#ftp">add FTP details</a></a>'
131 );
132 }
133
134 $params = isset($params['upgrades_all']) ? $params['upgrades_all'] : $params;
135
136 $core_upgrade = isset($params['wp_upgrade']) ? $params['wp_upgrade'] : array();
137 $upgrade_plugins = isset($params['upgrade_plugins']) ? $params['upgrade_plugins'] : array();
138 $upgrade_themes = isset($params['upgrade_themes']) ? $params['upgrade_themes'] : array();
139
140 $upgrades = array();
141 $premium_upgrades = array();
142 if (!empty($core_upgrade)) {
143 $upgrades['core'] = $this->upgrade_core($core_upgrade);
144 }
145
146 if (!empty($upgrade_plugins)) {
147 $plugin_files = array();
148 foreach ($upgrade_plugins as $plugin) {
149 if (isset($plugin->file))
150 $plugin_files[$plugin->file] = $plugin->old_version;
151 else
152 $premium_upgrades[md5($plugin->name)] = $plugin;
153 }
154 if (!empty($plugin_files))
155 $upgrades['plugins'] = $this->upgrade_plugins($plugin_files);
156
157 }
158
159 if (!empty($upgrade_themes)) {
160 $theme_temps = array();
161 foreach ($upgrade_themes as $theme) {
162 if (isset($theme['theme_tmp']))
163 $theme_temps[] = $theme['theme_tmp'];
164 else
165 $premium_upgrades[md5($theme['name'])] = $theme;
166 }
167
168 if (!empty($theme_temps))
169 $upgrades['themes'] = $this->upgrade_themes($theme_temps);
170
171 }
172
173 if (!empty($premium_upgrades)) {
174 $premium_upgrades = $this->upgrade_premium($premium_upgrades);
175 if (!empty($premium_upgrades)) {
176 if (!empty($upgrades)) {
177 foreach ($upgrades as $key => $val) {
178 if (isset($premium_upgrades[$key])) {
179 $upgrades[$key] = array_merge_recursive($upgrades[$key], $premium_upgrades[$key]);
180 }
181 }
182 } else {
183 $upgrades = $premium_upgrades;
184 }
185 }
186 }
187 ob_clean();
188 $this->mmb_maintenance_mode(false);
189 return $upgrades;
190 }
191
192 /**
193 * Upgrades WordPress locally
194 *
195 */
196 function upgrade_core($current)
197 {
198 ob_start();
199 if (!function_exists('wp_version_check'))
200 include_once(ABSPATH . '/wp-admin/includes/update.php');
201
202 @wp_version_check();
203
204 $current_update = false;
205 ob_end_flush();
206 ob_end_clean();
207 $core = $this->mmb_get_transient('update_core');
208
209 if (isset($core->updates) && !empty($core->updates)) {
210 $updates = $core->updates[0];
211 $updated = $core->updates[0];
212 if (!isset($updated->response) || $updated->response == 'latest')
213 return array(
214 'upgraded' => ' updated'
215 );
216
217 if ($updated->response == "development" && $current->response == "upgrade") {
218 return array(
219 'upgraded' => '<font color="#900">Unexpected error. Please upgrade manually.</font>'
220 );
221 } else if ($updated->response == $current->response || ($updated->response == "upgrade" && $current->response == "development")) {
222 if ($updated->locale != $current->locale) {
223 foreach ($updates as $update) {
224 if ($update->locale == $current->locale) {
225 $current_update = $update;
226 break;
227 }
228 }
229 if ($current_update == false)
230 return array(
231 'error' => ' Localization mismatch. Try again.'
232 );
233 } else {
234 $current_update = $updated;
235 }
236 } else
237 return array(
238 'error' => ' Transient mismatch. Try again.'
239 );
240 } else
241 return array(
242 'error' => ' Refresh transient failed. Try again.'
243 );
244 if ($current_update != false) {
245 global $mmb_wp_version, $wp_filesystem, $wp_version;
246
247 if (version_compare($wp_version, '3.1.9', '>')) {
248 if (!class_exists('Core_Upgrader'))
249 include_once(ABSPATH . 'wp-admin/includes/class-wp-upgrader.php');
250
251 $core = new Core_Upgrader();
252 $result = $core->upgrade($current_update);
253 $this->mmb_maintenance_mode(false);
254 if (is_wp_error($result)) {
255 return array(
256 'error' => $this->mmb_get_error($result)
257 );
258 } else
259 return array(
260 'upgraded' => ' updated'
261 );
262
263 } else {
264 if (!class_exists('WP_Upgrader')) {
265 include_once(ABSPATH . 'wp-admin/includes/update.php');
266 if (function_exists('wp_update_core')) {
267 $result = wp_update_core($current_update);
268 if (is_wp_error($result)) {
269 return array(
270 'error' => $this->mmb_get_error($result)
271 );
272 } else
273 return array(
274 'upgraded' => ' updated'
275 );
276 }
277 }
278
279 if (class_exists('WP_Upgrader')) {
280 $upgrader_skin = new WP_Upgrader_Skin();
281 $upgrader_skin->done_header = true;
282
283 $upgrader = new WP_Upgrader($upgrader_skin);
284
285 // Is an update available?
286 if (!isset($current_update->response) || $current_update->response == 'latest')
287 return array(
288 'upgraded' => ' updated'
289 );
290
291 $res = $upgrader->fs_connect(array(
292 ABSPATH,
293 WP_CONTENT_DIR
294 ));
295 if (is_wp_error($res))
296 return array(
297 'error' => $this->mmb_get_error($res)
298 );
299
300 $wp_dir = trailingslashit($wp_filesystem->abspath());
301
302 $core_package = false;
303 if (isset($current_update->package) && !empty($current_update->package))
304 $core_package = $current_update->package;
305 elseif (isset($current_update->packages->full) && !empty($current_update->packages->full))
306 $core_package = $current_update->packages->full;
307
308 $download = $upgrader->download_package($core_package);
309 if (is_wp_error($download))
310 return array(
311 'error' => $this->mmb_get_error($download)
312 );
313
314 $working_dir = $upgrader->unpack_package($download);
315 if (is_wp_error($working_dir))
316 return array(
317 'error' => $this->mmb_get_error($working_dir)
318 );
319
320 if (!$wp_filesystem->copy($working_dir . '/wordpress/wp-admin/includes/update-core.php', $wp_dir . 'wp-admin/includes/update-core.php', true)) {
321 $wp_filesystem->delete($working_dir, true);
322 return array(
323 'error' => 'Unable to move update files.'
324 );
325 }
326
327 $wp_filesystem->chmod($wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE);
328
329 require(ABSPATH . 'wp-admin/includes/update-core.php');
330
331
332 $update_core = update_core($working_dir, $wp_dir);
333 ob_end_clean();
334
335 $this->mmb_maintenance_mode(false);
336 if (is_wp_error($update_core))
337 return array(
338 'error' => $this->mmb_get_error($update_core)
339 );
340 ob_end_flush();
341 return array(
342 'upgraded' => 'updated'
343 );
344 } else {
345 return array(
346 'error' => 'failed'
347 );
348 }
349 }
350 } else {
351 return array(
352 'error' => 'failed'
353 );
354 }
355 }
356
357 function upgrade_plugins($plugins = false)
358 {
359 if (!$plugins || empty($plugins))
360 return array(
361 'error' => 'No plugin files for upgrade.'
362 );
363 $return = array();
364 if (class_exists('Plugin_Upgrader') && class_exists('Bulk_Plugin_Upgrader_Skin')) {
365 $upgrader = new Plugin_Upgrader(new Bulk_Plugin_Upgrader_Skin(compact('nonce', 'url')));
366 $result = $upgrader->bulk_upgrade(array_keys($plugins));
367
368 if (!function_exists('wp_update_plugins'))
369 include_once(ABSPATH . 'wp-includes/update.php');
370
371 @wp_update_plugins();
372 $current_plugins = $this->mmb_get_transient('update_plugins');
373
374 if (!empty($result)) {
375 foreach ($result as $plugin_slug => $plugin_info) {
376 if (!$plugin_info || is_wp_error($plugin_info)) {
377 $return[$plugin_slug] = $this->mmb_get_error($plugin_info);
378 } else {
379 if (isset($current_plugins->response[$plugin_slug]) && !empty($current_plugins->response[$plugin_slug])) {
380 $return[$plugin_slug] = false;
381 } else {
382 $return[$plugin_slug] = 1;
383 }
384 }
385 }
386 ob_end_clean();
387 return array(
388 'upgraded' => $return
389 );
390 } else
391 return array(
392 'error' => 'Upgrade failed.'
393 );
394 } else {
395 ob_end_clean();
396 return array(
397 'error' => 'WordPress update required first.'
398 );
399 }
400 }
401
402 function upgrade_themes($themes = false)
403 {
404 if (!$themes || empty($themes))
405 return array(
406 'error' => 'No theme files for upgrade.'
407 );
408 if (class_exists('Theme_Upgrader') && class_exists('Bulk_Theme_Upgrader_Skin')) {
409 $upgrader = new Theme_Upgrader(new Bulk_Theme_Upgrader_Skin(compact('title', 'nonce', 'url', 'theme')));
410 $result = $upgrader->bulk_upgrade($themes);
411
412 if (!function_exists('wp_update_themes'))
413 include_once(ABSPATH . 'wp-includes/update.php');
414
415 @wp_update_themes();
416 $current_themes = $this->mmb_get_transient('update_themes');
417
418 $return = array();
419 if (!empty($result)) {
420 foreach ($result as $theme_tmp => $theme_info) {
421 if (is_wp_error($theme_info) || !$theme_info) {
422 $return[$theme_tmp] = $this->mmb_get_error($theme_info);
423 } else {
424 if (isset($current_themes->response[$theme_tmp]) && !empty($current_themes->response[$theme_tmp])) {
425 $return[$theme_tmp] = false;
426 } else {
427 $return[$theme_tmp] = 1;
428 }
429 }
430 }
431
432 return array(
433 'upgraded' => $return
434 );
435 } else
436 return array(
437 'error' => 'Upgrade failed.'
438 );
439 } else {
440 ob_end_clean();
441 return array(
442 'error' => 'WordPress update required first'
443 );
444 }
445 }
446
447 function upgrade_premium($premium = false)
448 {
449 if (!class_exists('WP_Upgrader'))
450 include_once(ABSPATH . 'wp-admin/includes/class-wp-upgrader.php');
451
452 if (!$premium || empty($premium))
453 return array(
454 'error' => 'No premium files for upgrade.'
455 );
456
457 $upgrader = false;
458 $pr_update = array();
459 $result = array();
460 $premium_update = array();
461 $premium_update = apply_filters('mwp_premium_perform_update', $premium_update);
462
463 if (!empty($premium_update)) {
464 foreach ($premium as $pr) {
465 foreach ($premium_update as $update) {
466 $update = array_change_key_case($update, CASE_LOWER);
467
468 if ($update['name'] == $pr['name']) {
469 $update_result = false;
470 if (isset($update['url'])) {
471 if (defined('WP_INSTALLING') && file_exists(ABSPATH . '.maintenance'))
472 $pr_update[$update['type'] . 's']['upgraded'][md5($update['name'])] = 'Site under maintanace.';
473
474 if ($upgrader == false) {
475 $upgrader_skin = new WP_Upgrader_Skin();
476 $upgrader_skin->done_header = true;
477
478 $upgrader = new WP_Upgrader();
479 }
480
481 @$update_result = $upgrader->run(array(
482 'package' => $update['url'],
483 'destination' => isset($update['type']) && $update['type'] == 'theme' ? WP_CONTENT_DIR . '/themes' : WP_PLUGIN_DIR,
484 'clear_destination' => true,
485 'clear_working' => true,
486 'hook_extra' => array()
487 ));
488 $update_result = !$update_result || is_wp_error($update_result) ? $this->mmb_get_error($update_result) : 1;
489
490 } else if (isset($update['callback'])) {
491 if (is_array($update['callback'])) {
492 $update_result = call_user_func(array(
493 $update['callback'][0],
494 $update['callback'][1]
495 ));
496 } else if (is_string($update['callback'])) {
497 $update_result = call_user_func($update['callback']);
498 } else {
499 $update_result = 'Upgrade function "' . $update['callback'] . '" does not exists.';
500 }
501
502 $update_result = $update_result !== true ? $this->mmb_get_error($update_result) : 1;
503 } else
504 $update_result = 'Bad update params.';
505
506 $pr_update[$update['type'] . 's']['upgraded'][md5($update['name'])] = $update_result;
507 }
508 }
509 }
510 return $pr_update;
511 } else {
512 foreach ($premium as $pr) {
513 $result[$pr['type'] . 's']['upgraded'][md5($pr['name'])] = 'This premium update is not registered.';
514 }
515 return $result;
516 }
517 }
518
519 function get_upgradable_plugins()
520 {
521 $current = $this->mmb_get_transient('update_plugins');
522 $upgradable_plugins = array();
523 if (!empty($current->response)) {
524 if (!function_exists('get_plugin_data'))
525 include_once ABSPATH . 'wp-admin/includes/plugin.php';
526 foreach ($current->response as $plugin_path => $plugin_data) {
527 if ($plugin_path == 'worker/init.php')
528 continue;
529
530 $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_path);
531 if (strlen($data['Name']) > 0 && strlen($data['Version']) > 0) {
532 $current->response[$plugin_path]->name = $data['Name'];
533 $current->response[$plugin_path]->old_version = $data['Version'];
534 $current->response[$plugin_path]->file = $plugin_path;
535 unset($current->response[$plugin_path]->upgrade_notice);
536 $upgradable_plugins[] = $current->response[$plugin_path];
537 }
538 }
539 return $upgradable_plugins;
540 } else
541 return array();
542 }
543
544 function get_upgradable_themes()
545 {
546 $all_themes = get_themes();
547 $upgrade_themes = array();
548
549 $current = $this->mmb_get_transient('update_themes');
550 foreach ((array) $all_themes as $theme_template => $theme_data) {
551 if (!empty($current->response)) {
552 foreach ($current->response as $current_themes => $theme) {
553 if ($theme_data['Template'] == $current_themes) {
554 if (strlen($theme_data['Name']) > 0 && strlen($theme_data['Version']) > 0) {
555 $current->response[$current_themes]['name'] = $theme_data['Name'];
556 $current->response[$current_themes]['old_version'] = $theme_data['Version'];
557 $current->response[$current_themes]['theme_tmp'] = $theme_data['Template'];
558 $upgrade_themes[] = $current->response[$current_themes];
559 }
560 }
561 }
562 }
563 }
564
565 return $upgrade_themes;
566 }
567
568 function get($args)
569 {
570 if (empty($args))
571 return false;
572
573 //Args: $items('plugins,'themes'), $type (active || inactive), $search(name string)
574
575 $return = array();
576 if (is_array($args['items']) && in_array('plugins', $args['items'])) {
577 $return['plugins'] = $this->get_plugins($args);
578 }
579 if (is_array($args['items']) && in_array('themes', $args['items'])) {
580 $return['themes'] = $this->get_themes($args);
581 }
582
583 return $return;
584 }
585
586 function get_plugins($args)
587 {
588 if (empty($args))
589 return false;
590
591 extract($args);
592
593 if (!function_exists('get_plugins')) {
594 include_once(ABSPATH . 'wp-admin/includes/plugin.php');
595 }
596 $all_plugins = get_plugins();
597 $plugins = array(
598 'active' => array(),
599 'inactive' => array()
600 );
601 if (is_array($all_plugins) && !empty($all_plugins)) {
602 $activated_plugins = get_option('active_plugins');
603 if (!$activated_plugins)
604 $activated_plugins = array();
605
606 $br_a = 0;
607 $br_i = 0;
608 foreach ($all_plugins as $path => $plugin) {
609 if ($plugin['Name'] != 'ManageWP - Worker') {
610 if (in_array($path, $activated_plugins)) {
611 $plugins['active'][$br_a]['path'] = $path;
612 $plugins['active'][$br_a]['name'] = $plugin['Name'];
613 $br_a++;
614 }
615
616 if (!in_array($path, $activated_plugins)) {
617 $plugins['inactive'][$br_i]['path'] = $path;
618 $plugins['inactive'][$br_i]['name'] = $plugin['Name'];
619 $br_i++;
620 }
621
622 }
623
624 if ($search) {
625 foreach ($plugins['active'] as $k => $plugin) {
626 if (!stristr($plugin['name'], $search)) {
627 unset($plugins['active'][$k]);
628 }
629 }
630
631 foreach ($plugins['inactive'] as $k => $plugin) {
632 if (!stristr($plugin['name'], $search)) {
633 unset($plugins['inactive'][$k]);
634 }
635 }
636 }
637 }
638 }
639
640 return $plugins;
641 }
642
643 function get_themes($args)
644 {
645 if (empty($args))
646 return false;
647
648 extract($args);
649
650 if (!function_exists('get_themes')) {
651 include_once(ABSPATH . WPINC . '/theme.php');
652 }
653 $all_themes = get_themes();
654 $themes = array(
655 'active' => array(),
656 'inactive' => array()
657 );
658
659 if (is_array($all_themes) && !empty($all_themes)) {
660 $current_theme = get_current_theme();
661
662 $br_a = 0;
663 $br_i = 0;
664 foreach ($all_themes as $theme_name => $theme) {
665 if ($current_theme == $theme_name) {
666 $themes['active'][$br_a]['path'] = $theme['Template'];
667 $themes['active'][$br_a]['name'] = $theme['Name'];
668 $themes['active'][$br_a]['stylesheet'] = $theme['Stylesheet'];
669 $br_a++;
670 }
671
672 if ($current_theme != $theme_name) {
673 $themes['inactive'][$br_i]['path'] = $theme['Template'];
674 $themes['inactive'][$br_i]['name'] = $theme['Name'];
675 $themes['inactive'][$br_i]['stylesheet'] = $theme['Stylesheet'];
676 $br_i++;
677 }
678
679 }
680
681 if ($search) {
682 foreach ($themes['active'] as $k => $theme) {
683 if (!stristr($theme['name'], $search)) {
684 unset($themes['active'][$k]);
685 }
686 }
687
688 foreach ($themes['inactive'] as $k => $theme) {
689 if (!stristr($theme['name'], $search)) {
690 unset($themes['inactive'][$k]);
691 }
692 }
693 }
694 }
695
696 return $themes;
697 }
698
699 function edit($args)
700 {
701 extract($args);
702 $return = array();
703 if ($type == 'plugins') {
704 $return['plugins'] = $this->edit_plugins($args);
705 } elseif ($type == 'themes') {
706 $return['themes'] = $this->edit_themes($args);
707 }
708 return $return;
709 }
710
711 function edit_plugins($args)
712 {
713 extract($args);
714 $return = array();
715 foreach ($items as $item) {
716 switch ($items_edit_action) {
717 case 'activate':
718 $result = activate_plugin($item['path']);
719 break;
720 case 'deactivate':
721 $result = deactivate_plugins(array(
722 $item['path']
723 ));
724 break;
725 case 'delete':
726 $result = delete_plugins(array(
727 $item['path']
728 ));
729 break;
730 default:
731 break;
732 }
733
734 if (is_wp_error($result)) {
735 $result = array(
736 'error' => $result->get_error_message()
737 );
738 } elseif ($result === false) {
739 $result = array(
740 'error' => "Failed to perform action."
741 );
742 } else {
743 $result = "OK";
744 }
745 $return[$item['name']] = $result;
746 }
747
748 return $return;
749 }
750
751 function edit_themes($args)
752 {
753 extract($args);
754 $return = array();
755 foreach ($items as $item) {
756 switch ($items_edit_action) {
757 case 'activate':
758 switch_theme($item['path'], $item['stylesheet']);
759 break;
760 case 'delete':
761 $result = delete_theme($item['path']);
762 break;
763 default:
764 break;
765 }
766
767 if (is_wp_error($result)) {
768 $result = array(
769 'error' => $result->get_error_message()
770 );
771 } elseif ($result === false) {
772 $result = array(
773 'error' => "Failed to perform action."
774 );
775 } else {
776 $result = "OK";
777 }
778 $return[$item['name']] = $result;
779 }
780
781 return $return;
782
783 }
784 }
785 ?>