/** * Get a array of registered Destination's for Backups * * @return array BackWPup_Destinations */ public static function get_registered_destinations() { //only run it one time if (!empty(self::$registered_destinations)) { return self::$registered_destinations; } //add BackWPup Destinations // to folder self::$registered_destinations['FOLDER'] = array('class' => 'BackWPup_Destination_Folder', 'info' => array('ID' => 'FOLDER', 'name' => __('Folder', 'backwpup'), 'description' => __('Backup to Folder', 'backwpup')), 'can_sync' => FALSE, 'needed' => array('php_version' => '', 'functions' => array(), 'classes' => array()), 'autoload' => array()); // backup with mail self::$registered_destinations['EMAIL'] = array('class' => 'BackWPup_Destination_Email', 'info' => array('ID' => 'EMAIL', 'name' => __('Email', 'backwpup'), 'description' => __('Backup sent via email', 'backwpup')), 'can_sync' => FALSE, 'needed' => array('php_version' => '5.2.4', 'functions' => array(), 'classes' => array()), 'autoload' => array()); // backup to ftp self::$registered_destinations['FTP'] = array('class' => 'BackWPup_Destination_Ftp', 'info' => array('ID' => 'FTP', 'name' => __('FTP', 'backwpup'), 'description' => __('Backup to FTP', 'backwpup')), 'can_sync' => FALSE, 'needed' => array('mphp_version' => '', 'functions' => array('ftp_nb_fput'), 'classes' => array()), 'autoload' => array()); // backup to dropbox self::$registered_destinations['DROPBOX'] = array('class' => 'BackWPup_Destination_Dropbox', 'info' => array('ID' => 'DROPBOX', 'name' => __('Dropbox', 'backwpup'), 'description' => __('Backup to Dropbox', 'backwpup')), 'can_sync' => FALSE, 'needed' => array('php_version' => '', 'functions' => array('curl_exec'), 'classes' => array()), 'autoload' => array()); // Backup to S3 self::$registered_destinations['S3'] = array('class' => 'BackWPup_Destination_S3', 'info' => array('ID' => 'S3', 'name' => __('S3 Service', 'backwpup'), 'description' => __('Backup to an S3 Service', 'backwpup')), 'can_sync' => FALSE, 'needed' => array('php_version' => '5.3.3', 'functions' => array('curl_exec'), 'classes' => array('XMLWriter')), 'autoload' => array('Aws\\Common' => dirname(__FILE__) . '/vendor', 'Aws\\S3' => dirname(__FILE__) . '/vendor', 'Symfony\\Component\\EventDispatcher' => dirname(__FILE__) . '/vendor', 'Guzzle' => dirname(__FILE__) . '/vendor')); // backup to MS Azure self::$registered_destinations['MSAZURE'] = array('class' => 'BackWPup_Destination_MSAzure', 'info' => array('ID' => 'MSAZURE', 'name' => __('MS Azure', 'backwpup'), 'description' => __('Backup to Microsoft Azure (Blob)', 'backwpup')), 'can_sync' => FALSE, 'needed' => array('php_version' => '5.3.2', 'functions' => array(), 'classes' => array()), 'autoload' => array('WindowsAzure' => dirname(__FILE__) . '/vendor')); // backup to Rackspace Cloud self::$registered_destinations['RSC'] = array('class' => 'BackWPup_Destination_RSC', 'info' => array('ID' => 'RSC', 'name' => __('RSC', 'backwpup'), 'description' => __('Backup to Rackspace Cloud Files', 'backwpup')), 'can_sync' => FALSE, 'needed' => array('php_version' => '5.3.3', 'functions' => array('curl_exec'), 'classes' => array()), 'autoload' => array('OpenCloud' => dirname(__FILE__) . '/vendor', 'Guzzle' => dirname(__FILE__) . '/vendor', 'Psr' => dirname(__FILE__) . '/vendor')); // backup to Sugarsync self::$registered_destinations['SUGARSYNC'] = array('class' => 'BackWPup_Destination_SugarSync', 'info' => array('ID' => 'SUGARSYNC', 'name' => __('SugarSync', 'backwpup'), 'description' => __('Backup to SugarSync', 'backwpup')), 'can_sync' => FALSE, 'needed' => array('php_version' => '', 'functions' => array('curl_exec'), 'classes' => array()), 'autoload' => array()); //Hook for adding Destinations like above self::$registered_destinations = apply_filters('backwpup_register_destination', self::$registered_destinations); //check BackWPup Destinations foreach (self::$registered_destinations as $dest_key => $dest) { self::$registered_destinations[$dest_key]['error'] = ''; // check PHP Version if (!empty($dest['needed']['php_version']) && version_compare(PHP_VERSION, $dest['needed']['php_version'], '<')) { self::$registered_destinations[$dest_key]['error'] .= sprintf(__('PHP Version %1$s is to low, you need Version %2$s or above.', 'backwpup'), PHP_VERSION, $dest['needed']['php_version']) . ' '; self::$registered_destinations[$dest_key]['class'] = NULL; } //check functions exists if (!empty($dest['needed']['functions'])) { foreach ($dest['needed']['functions'] as $function_need) { if (!function_exists($function_need)) { self::$registered_destinations[$dest_key]['error'] .= sprintf(__('Missing function "%s".', 'backwpup'), $function_need) . ' '; self::$registered_destinations[$dest_key]['class'] = NULL; } } } //check classes exists if (!empty($dest['needed']['classes'])) { foreach ($dest['needed']['classes'] as $class_need) { if (!class_exists($class_need)) { self::$registered_destinations[$dest_key]['error'] .= sprintf(__('Missing class "%s".', 'backwpup'), $class_need) . ' '; self::$registered_destinations[$dest_key]['class'] = NULL; } } } //add class/namespace to auto load if (!empty(self::$registered_destinations[$dest_key]['class']) && !empty(self::$registered_destinations[$dest_key]['autoload'])) { self::$autoload = array_merge(self::$autoload, self::$registered_destinations[$dest_key]['autoload']); } } return self::$registered_destinations; }