本文整理汇总了PHP中pb_backupbuddy::plugin_path方法的典型用法代码示例。如果您正苦于以下问题:PHP pb_backupbuddy::plugin_path方法的具体用法?PHP pb_backupbuddy::plugin_path怎么用?PHP pb_backupbuddy::plugin_path使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pb_backupbuddy
的用法示例。
在下文中一共展示了pb_backupbuddy::plugin_path方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run($arguments)
{
$arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
$profile = $arguments['profile'];
if ('db' == $profile) {
// db profile is always index 1.
$profile = '1';
} elseif ('full' == $profile) {
// full profile is always index 2.
$profile = '2';
}
if (is_numeric($profile)) {
if (isset(pb_backupbuddy::$options['profiles'][$profile])) {
$profileArray = pb_backupbuddy::$options['profiles'][$profile];
} else {
return array('api' => '0', 'status' => 'error', 'message' => 'Error #2332904: Invalid profile ID `' . htmlentities($profile) . '`. Profile with this number was not found. Try deactivating then reactivating the plugin. If this fails please reset the plugin Settings back to Defaults from the Settings page.');
}
} else {
return array('api' => '0', 'status' => 'error', 'message' => 'Error #85489548955. Invalid profile ID not numeric: `' . htmlentities($profile) . '`.');
}
require_once pb_backupbuddy::plugin_path() . '/classes/backup.php';
pb_backupbuddy::$classes['backup'] = new pb_backupbuddy_backup();
// Set serial ahead of time so can be used by AJAX before backup procedure actually begins.
$serial = pb_backupbuddy::random_string(10);
$profileArray['backup_mode'] = '2';
// Force modern mode when running under sync.
// Run the backup!
if (pb_backupbuddy::$classes['backup']->start_backup_process($profileArray, 'manual', array(), array(), 'it-sync', $serial, array()) !== true) {
return array('api' => '0', 'status' => 'error', 'message' => 'Error #435832: Backup failed. See BackupBuddy log for details.');
}
return array('api' => '0', 'status' => 'ok', 'message' => 'Backup initiated successfully.');
}
示例2: get_archives_list
/**
* get_archives_list()
*
* Returns an array of backup archive zip filenames found.
*
* @return array Array of .zip filenames; path NOT included.
*/
function get_archives_list() {
if ( !isset( pb_backupbuddy::$classes['zipbuddy'] ) ) {
require_once( pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php' );
pb_backupbuddy::$classes['zipbuddy'] = new pluginbuddy_zipbuddy( ABSPATH );
}
// List backup files in this directory.
$backup_archives_glob = glob( ABSPATH . 'backup*.zip' );
if ( !is_array( $backup_archives_glob ) || empty( $backup_archives_glob ) ) { // On failure glob() returns false or an empty array depending on server settings so normalize here.
$backup_archives_glob = array();
}
foreach( $backup_archives_glob as $backup_archive ) {
$comment = pb_backupbuddy::$classes['zipbuddy']->get_comment( $backup_archive );
if ( $comment === false ) {
$comment = '';
}
$this_archive = array(
'file' => basename( $backup_archive ),
'comment' => $comment,
);
$backup_archives[] = $this_archive;
}
unset( $backup_archives_glob );
return $backup_archives;
}
示例3: backupbuddy_register_sync_verbs
function backupbuddy_register_sync_verbs($api)
{
$verbs = array('backupbuddy-run-backup' => 'Ithemes_Sync_Verb_Backupbuddy_Run_Backup', 'backupbuddy-list-profiles' => 'Ithemes_Sync_Verb_Backupbuddy_List_Profiles', 'backupbuddy-list-schedules' => 'Ithemes_Sync_Verb_Backupbuddy_List_Schedules', 'backupbuddy-list-destinations' => 'Ithemes_Sync_Verb_Backupbuddy_List_Destinations', 'backupbuddy-get-overview' => 'Ithemes_Sync_Verb_Backupbuddy_Get_Overview', 'backupbuddy-get-latestBackupProcess' => 'Ithemes_Sync_Verb_Backupbuddy_Get_LatestBackupProcess', 'backupbuddy-get-everything' => 'Ithemes_Sync_Verb_Backupbuddy_Get_Everything', 'backupbuddy-get-importbuddy' => 'Ithemes_Sync_Verb_Backupbuddy_Get_Importbuddy');
foreach ($verbs as $name => $class) {
$api->register($name, $class, pb_backupbuddy::plugin_path() . "/classes/ithemes-sync/{$name}.php");
}
}
示例4: upgrader_instantiate
function upgrader_instantiate($plugin_slug)
{
$args = array('parent' => $this, 'remote_url' => 'http://updater2.ithemes.com/index.php', 'version' => pb_backupbuddy::settings('version'), 'plugin_slug' => pb_backupbuddy::settings('slug'), 'plugin_path' => plugin_basename(pb_backupbuddy::plugin_path() . '/' . pb_backupbuddy::settings('init')), 'plugin_url' => pb_backupbuddy::plugin_url(), 'product' => pb_backupbuddy::settings('slug'), 'time' => 43200, 'return_format' => 'json', 'method' => 'POST', 'upgrade_action' => 'check');
// Instantiate object of latest updater (by namespace) and apply to this plugin's pluginbuddy class (in this namespace).
//$class_name = $plugin_namespace . "\\updater";
$target_plugin_class_name = 'pb_' . $plugin_slug . '_updater';
$this_plugin_class_name = 'pb_' . $this->_slug;
//$this_plugin_class_name::$_updater = new $target_plugin_class_name( $args );
pb_backupbuddy::$_updater = new $target_plugin_class_name($args);
}
示例5: run
public function run($arguments)
{
$arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
if (true === ($results = pb_backupbuddy_destinations::test($settings))) {
return array('api' => '0', 'status' => 'ok', 'message' => 'Supported destinations retrieved.');
} else {
return array('api' => '0', 'status' => 'error', 'message' => $results);
}
}
示例6: run
public function run($arguments)
{
$arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
$response = pb_backupbuddy_destinations::delete($arguments['id'], true);
if (true === $response) {
return array('api' => '0', 'status' => 'ok', 'message' => 'Destination deleted.');
} else {
return array('api' => '0', 'status' => 'error', 'message' => 'Error #384783783: Failure deleting destination.');
}
}
示例7: run
public function run($arguments)
{
$arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
if (!class_exists('backupbuddy_core')) {
require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
}
$overview = backupbuddy_api0::getOverview();
// If archive file is set but actual file does not exist then clear out value.
if (isset($overview['lastBackupStats']['archiveFile']) && !file_exists($overview['lastBackupStats']['archiveFile'])) {
$overview['lastBackupStats']['archiveFile'] = '';
}
return array('version' => '4', 'status' => 'ok', 'message' => 'Overview retrieved successfully.', 'overview' => $overview);
}
示例8: backupbuddy_register_sync_verbs
function backupbuddy_register_sync_verbs($api)
{
$verbs = array('backupbuddy-run-backup' => 'Ithemes_Sync_Verb_Backupbuddy_Run_Backup', 'backupbuddy-list-profiles' => 'Ithemes_Sync_Verb_Backupbuddy_List_Profiles', 'backupbuddy-list-schedules' => 'Ithemes_Sync_Verb_Backupbuddy_List_Schedules', 'backupbuddy-get-overview' => 'Ithemes_Sync_Verb_Backupbuddy_Get_Overview');
foreach ($verbs as $name => $class) {
$api->register($name, $class, pb_backupbuddy::plugin_path() . "/classes/ithemes-sync/{$name}.php");
}
//For testing:
/*
require_once( pb_backupbuddy::plugin_path() . "/classes/ithemes-sync/backupbuddy-get-overview.php" );
$apple = new Ithemes_Sync_Verb_Backupbuddy_Get_Overview;
error_log( $apple->run( array() ), true );
*/
}
示例9: process_scheduled_backup
function process_scheduled_backup($cron_id)
{
if (!isset(pb_backupbuddy::$options)) {
$this->load();
}
pb_backupbuddy::status('details', 'cron_process_scheduled_backup: ' . $cron_id);
if (!isset(pb_backupbuddy::$classes['core'])) {
require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
pb_backupbuddy::$classes['core'] = new pb_backupbuddy_core();
}
$preflight_message = '';
$preflight_checks = pb_backupbuddy::$classes['core']->preflight_check();
foreach ($preflight_checks as $preflight_check) {
if ($preflight_check['success'] !== true) {
pb_backupbuddy::status('warning', $preflight_check['message']);
}
}
if (is_array(pb_backupbuddy::$options['schedules'][$cron_id])) {
// If schedule is disabled then just return. Bail out!
if (isset(pb_backupbuddy::$options['schedules'][$cron_id]['on_off']) && pb_backupbuddy::$options['schedules'][$cron_id]['on_off'] == '0') {
pb_backupbuddy::status('message', 'Schedule `' . $cron_id . '` NOT run due to being disabled based on this schedule\'s settings.');
return;
}
pb_backupbuddy::$options['schedules'][$cron_id]['last_run'] = time();
// update last run time.
pb_backupbuddy::save();
if (!isset(pb_backupbuddy::$classes['backup'])) {
require_once pb_backupbuddy::plugin_path() . '/classes/backup.php';
pb_backupbuddy::$classes['backup'] = new pb_backupbuddy_backup();
}
// If any remote destinations are set then add these to the steps to perform after the backup.
$post_backup_steps = array();
$destinations = explode('|', pb_backupbuddy::$options['schedules'][$cron_id]['remote_destinations']);
foreach ($destinations as $destination) {
if (isset($destination) && $destination != '') {
array_push($post_backup_steps, array('function' => 'send_remote_destination', 'args' => array($destination), 'start_time' => 0, 'finish_time' => 0, 'attempts' => 0));
}
}
if (pb_backupbuddy::$options['schedules'][$cron_id]['delete_after'] == '1') {
array_push($post_backup_steps, array('function' => 'post_remote_delete', 'args' => array(), 'start_time' => 0, 'finish_time' => 0, 'attempts' => 0));
}
if (pb_backupbuddy::$classes['backup']->start_backup_process(pb_backupbuddy::$options['schedules'][$cron_id]['type'], 'scheduled', array(), $post_backup_steps, pb_backupbuddy::$options['schedules'][$cron_id]['title']) !== true) {
error_log('FAILURE #4455484589 IN BACKUPBUDDY.');
echo __('Error #4564658344443: Backup failure', 'it-l10n-backupbuddy');
echo pb_backupbuddy::$classes['backup']->get_errors();
}
}
pb_backupbuddy::status('details', 'Finished cron_process_scheduled_backup.');
}
示例10: factory
/**
* Factory
*
* @param string $method Signature method
*
* @return HTTP_OAuth_Signature_Common Signature instance
*/
public static function factory($method)
{
$method = str_replace('-', '_', $method);
$class = 'HTTP_OAuth_Signature_' . $method;
$file = str_replace('_', '/', $class) . '.php';
include_once pb_backupbuddy::plugin_path() . '/destinations/dropbox/lib/dropbuddy/pear_includes/' . $file;
if (class_exists($class) === false) {
throw new InvalidArgumentException('No such signature class');
}
$instance = new $class();
if (!$instance instanceof HTTP_OAuth_Signature_Common) {
throw new InvalidArgumentException('Signature class does not extend HTTP_OAuth_Signature_Common');
}
return $instance;
}
示例11: __construct
public function __construct($force_methods = array())
{
pb_backupbuddy::status('details', 'textreplacebuddy: Loading textreplacebuddy library.');
// Handles command line execution.
require_once pb_backupbuddy::plugin_path() . '/lib/commandbuddy/commandbuddy.php';
$this->_commandbuddy = new pb_backupbuddy_commandbuddy();
// Set mechanism for dumping / restoring.
if (count($force_methods) > 0) {
// Mechanism forced. Overriding automatic check.
pb_backupbuddy::status('message', 'textreplacebuddy: Settings overriding automatic detection of available database dump methods. Using forced override methods: `' . implode(',', $force_methods) . '`.');
$this->_methods = $force_methods;
} else {
// No method defined; auto-detect the best.
$this->_methods = $this->available_textreplace_methods();
}
pb_backupbuddy::status('message', 'textreplacebuddy: Detected text replacement methods: `' . implode(',', $this->_methods) . '`.');
}
示例12: _connect
private function _connect($settings)
{
if (true === self::$_isConnected) {
// Already connected.
return $settings;
}
set_include_path(pb_backupbuddy::plugin_path() . '/destinations/gdrive/' . PATH_SEPARATOR . get_include_path());
require_once pb_backupbuddy::plugin_path() . '/destinations/gdrive/Google/Client.php';
require_once pb_backupbuddy::plugin_path() . '/destinations/gdrive/Google/Http/MediaFileUpload.php';
require_once pb_backupbuddy::plugin_path() . '/destinations/gdrive/Google/Service/Drive.php';
$client_id = $settings['client_id'];
$client_secret = $settings['client_secret'];
$redirect_uri = 'urn:ietf:wg:oauth:2.0:oob';
self::$_client = new Google_Client();
self::$_client->setClientId($client_id);
self::$_client->setClientSecret($client_secret);
self::$_client->setRedirectUri($redirect_uri);
self::$_client->setAccessType('offline');
// Required so that Google will use the refresh token.
self::$_client->addScope("https://www.googleapis.com/auth/drive");
self::$_drive = new Google_Service_Drive(self::$_client);
self::$_client->setAccessToken($settings['tokens']);
/*
try {
$result = self::$_client->authenticate(); // $auth_code
} catch (Exception $e) {
pb_backupbuddy::alert( 'Error Authenticating: ' . $e->getMessage() . ' Please go back, check codes, and try again.' );
return false;
}
*/
// Update tokens in settings.
$oldAccessTokens = json_decode($settings['tokens']['refreshToken'], true);
$newAccessToken = self::$_client->getAccessToken();
//print_r( $newAccessToken );
/*
$accessTokens = json_decode( $newAccessToken, true );
$accessTokens['refreshToken'] = $oldAccessTokens['refreshToken'];
$settings['tokens'] = json_encode( $settings['tokens'] ); // Re-encode in JSON
self::$_client->setAccessToken( $settings['tokens'] );
*/
$settings['tokens'] = $newAccessToken;
self::$_isConnected = true;
return $settings;
}
示例13: backupbuddy
public function backupbuddy()
{
$function = str_replace(array('/', '\\'), '', pb_backupbuddy::_GET('function'));
if ('' == $function) {
$function = str_replace(array('/', '\\'), '', pb_backupbuddy::_POST('function'));
}
$file = pb_backupbuddy::plugin_path() . '/controllers/ajax/' . $function . '.php';
if (!file_exists($file)) {
die('0');
}
pb_backupbuddy::load();
//pb_backupbuddy::$ui->ajax_header();
require_once 'ajax/' . $function . '.php';
//pb_backupbuddy::$ui->ajax_footer();
//die();
die;
}
示例14: process_rackspace_copy
function process_rackspace_copy($rs_backup, $rs_username, $rs_api_key, $rs_container, $rs_server)
{
pb_backupbuddy::set_greedy_script_limits();
require_once pb_backupbuddy::plugin_path() . '/lib/rackspace/cloudfiles.php';
$auth = new CF_Authentication($rs_username, $rs_api_key, NULL, $rs_server);
$auth->authenticate();
$conn = new CF_Connection($auth);
// Set container
$container = $conn->get_container($rs_container);
// Get file from Rackspace
$rsfile = $container->get_object($rs_backup);
$destination_file = ABSPATH . 'wp-content/uploads/backupbuddy_backups/' . $rs_backup;
if (file_exists($destination_file)) {
$destination_file = str_replace('backup-', 'backup_copy_' . pb_backupbuddy::random_string(5) . '-', $destination_file);
}
$fso = fopen(ABSPATH . 'wp-content/uploads/backupbuddy_backups/' . $rs_backup, 'w');
$rsfile->stream($fso);
fclose($fso);
}
示例15: run
public function run($arguments)
{
$arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
if ('' == $arguments['password']) {
// no password send in arguments.
if (!isset(pb_backupbuddy::$options)) {
pb_backupbuddy::load();
}
if ('' == pb_backupbuddy::$options['importbuddy_pass_hash']) {
// no default password is set on Settings page.
return array('api' => '0', 'status' => 'error', 'message' => 'No ImportBuddy password was entered and no default has been set on the Settings page.');
} else {
// Use default.
$importbuddy_pass_hash = pb_backupbuddy::$options['importbuddy_pass_hash'];
}
} else {
// Password passed in arguments.
$importbuddy_pass_hash = md5($arguments['password']);
}
require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
return array('api' => '4', 'status' => 'ok', 'message' => 'ImportBuddy retrieved.', 'importbuddy' => base64_encode(backupbuddy_core::importbuddy('', $importbuddy_pass_hash, $returnNotEcho = true)));
}