backward-compatibility-functions.php
5 years ago
class-commands.php
5 years ago
class-updraft-abstract-logger.php
6 years ago
class-updraft-email-logger.php
8 years ago
class-updraft-file-logger.php
6 years ago
class-updraft-log-levels.php
8 years ago
class-updraft-logger-interface.php
8 years ago
class-updraft-logger.php
8 years ago
class-updraft-php-logger.php
6 years ago
class-updraft-resmushit-task.php
5 years ago
class-updraft-ring-logger.php
8 years ago
class-updraft-smush-manager-commands.php
5 years ago
class-updraft-smush-manager.php
5 years ago
class-updraft-smush-task.php
5 years ago
class-updraftcentral-wp-optimize-commands.php
7 years ago
class-wp-optimization.php
5 years ago
class-wp-optimize-browser-cache.php
5 years ago
class-wp-optimize-gzip-compression.php
5 years ago
class-wp-optimize-htaccess.php
6 years ago
class-wp-optimize-install-or-update-notice.php
5 years ago
class-wp-optimize-options.php
5 years ago
class-wp-optimize-transients-cache.php
6 years ago
class-wp-optimize-updates.php
5 years ago
class-wp-optimizer.php
5 years ago
updraft-notices.php
5 years ago
updraftcentral.php
5 years ago
wp-optimize-database-information.php
5 years ago
wp-optimize-notices.php
5 years ago
class-updraftcentral-wp-optimize-commands.php
43 lines
| 1 | <?php |
| 2 | if (!defined('WPO_PLUGIN_MAIN_PATH')) die('No direct access allowed'); |
| 3 | |
| 4 | /** |
| 5 | * This is a small glue class, which makes available all the commands in WP_Optimize_Commands, and translates the response from WP_Optimize_Commands (which is either data to return, or a WP_Error) into the format used by UpdraftCentral. |
| 6 | */ |
| 7 | class UpdraftCentral_WP_Optimize_Commands extends UpdraftCentral_Commands { |
| 8 | |
| 9 | private $commands; |
| 10 | |
| 11 | /** |
| 12 | * Class constructor |
| 13 | */ |
| 14 | public function __construct() { |
| 15 | if (!class_exists('WP_Optimize_Commands')) include_once(WPO_PLUGIN_MAIN_PATH.'includes/class-commands.php'); |
| 16 | $this->commands = new WP_Optimize_Commands(); |
| 17 | |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * Magic method to pass on the command to WP_Optimize_Commands |
| 22 | * |
| 23 | * @param String $name - command name |
| 24 | * @param Array $arguments - command parameters |
| 25 | * |
| 26 | * @return Array - response |
| 27 | */ |
| 28 | public function __call($name, $arguments) { |
| 29 | |
| 30 | if (!is_callable(array($this->commands, $name))) { |
| 31 | return $this->_generic_error_response('wp_optimize_no_such_command', $name); |
| 32 | } |
| 33 | |
| 34 | $result = call_user_func_array(array($this->commands, $name), $arguments); |
| 35 | |
| 36 | if (is_wp_error($result)) { |
| 37 | return $this->_generic_error_response($result->get_error_code(), $result->get_error_data()); |
| 38 | } else { |
| 39 | return $this->_response($result); |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 |