| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('WPO_PLUGIN_MAIN_PATH')) die('No direct access allowed'); |
| 4 |
|
| 5 |
/** |
| 6 |
* This file is the bootstrapper for UpdraftCentral integration: i.e. it registers what is necessary to deal with commands in the wpoptimize namespace. |
| 7 |
*/ |
| 8 |
class WP_Optimize_UpdraftCentral { |
| 9 |
|
| 10 |
public function __construct() { |
| 11 |
add_filter('updraftplus_remotecontrol_command_classes', array($this, 'updraftcentral_remotecontrol_command_classes')); |
| 12 |
add_filter('updraftcentral_remotecontrol_command_classes', array($this, 'updraftcentral_remotecontrol_command_classes')); |
| 13 |
add_action('updraftcentral_command_class_wanted', array($this, 'updraftcentral_command_class_wanted')); |
| 14 |
} |
| 15 |
|
| 16 |
/** |
| 17 |
* Register our class |
| 18 |
* |
| 19 |
* @param string $command_classes Passing over an array of command classes. |
| 20 |
*/ |
| 21 |
public function updraftcentral_remotecontrol_command_classes($command_classes) { |
| 22 |
if (is_array($command_classes)) $command_classes['wpoptimize'] = 'UpdraftCentral_WP_Optimize_Commands'; |
| 23 |
return $command_classes; |
| 24 |
} |
| 25 |
|
| 26 |
/** |
| 27 |
* Load the class when required |
| 28 |
* |
| 29 |
* @param string $command_php_class Passing over if there are any command classes. |
| 30 |
*/ |
| 31 |
public function updraftcentral_command_class_wanted($command_php_class) { |
| 32 |
if ('UpdraftCentral_WP_Optimize_Commands' == $command_php_class) { |
| 33 |
// This fragment is only needed for compatibility with UD < 1.12.30 - thenceforth, the class can be assumed to exist. |
| 34 |
if (!class_exists('UpdraftCentral_Commands')) { |
| 35 |
include_once(apply_filters('updraftcentral_command_base_class_at', UPDRAFTPLUS_DIR.'/central/commands.php')); |
| 36 |
} |
| 37 |
include_once(WPO_PLUGIN_MAIN_PATH.'includes/class-updraftcentral-wp-optimize-commands.php'); |
| 38 |
} |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
new WP_Optimize_UpdraftCentral(); |
| 43 |
|