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