本文整理汇总了PHP中pb_backupbuddy::settings方法的典型用法代码示例。如果您正苦于以下问题:PHP pb_backupbuddy::settings方法的具体用法?PHP pb_backupbuddy::settings怎么用?PHP pb_backupbuddy::settings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pb_backupbuddy
的用法示例。
在下文中一共展示了pb_backupbuddy::settings方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($form_name, $save_point = '', $additional_query_string = '')
{
$this->_form_name = $form_name;
$this->_save_point = $save_point;
$this->_additional_query_string = $additional_query_string;
$this->_prefix = 'pb_' . pb_backupbuddy::settings('slug') . '_';
}
示例2: api
function api()
{
die('0');
// TODO: Internal security lockout.
if (!isset(pb_backupbuddy::$options['api_key_test']) || pb_backupbuddy::$options['api_key_test'] == '') {
die('0');
}
if (pb_backupbuddy::$options['api_key_test'] != 'dsnfilasbfisybfdjybfjalybsfaklsbfa') {
die('0');
}
$run = pb_backupbuddy::_POST('run');
// TODO: TESTING temp allow GET method:
if ('' == $run) {
$run = pb_backupbuddy::_GET('run');
}
if ('' == $run) {
die(json_encode(array('success' => false, 'error' => 'Error #489384: Missing run command.')));
} else {
if (false === ($return = call_user_func('backupbuddy_api::' . $run))) {
die(json_encode(array('success' => false, 'error' => 'Error #328983: Command failed.')));
} else {
die(json_encode(array('success' => true, 'version' => pb_backupbuddy::settings('version'), 'data' => $return)));
}
}
die;
}
示例3: backup_step_status
public function backup_step_status()
{
$serial = pb_backupbuddy::_GET('serial');
pb_backupbuddy::load();
pb_backupbuddy::$ui->ajax_header();
echo '<h3>Backup Process Technical Details</h3>';
echo '<b>Step Details:</b><br>';
echo '<textarea style="width: 100%; height: 120px;" wrap="off">';
foreach (pb_backupbuddy::$options['backups'][$serial]['steps'] as $step) {
if ($step['function'] == 'send_remote_destination') {
foreach ($step['args'] as $destination) {
echo "Remote destinations for this backup:\n`" . pb_backupbuddy::$options['remote_destinations'][$destination]['title'] . "` of type `" . pb_backupbuddy::$options['remote_destinations'][$destination]['type'] . "` with ID `{$destination}`.\n\n";
}
}
}
echo "Step details:\n";
print_r(pb_backupbuddy::$options['backups'][$serial]);
echo '</textarea><br><br>';
// Output status log if it exists.
$log_directory = WP_CONTENT_DIR . '/uploads/pb_' . pb_backupbuddy::settings('slug') . '/';
$serial_file = $log_directory . 'status-' . $serial . '_' . pb_backupbuddy::$options['log_serial'] . '.txt';
if (file_exists($serial_file)) {
echo '<b>Log Details:</b><br>';
echo '<textarea style="width: 100%; height: 120px;" wrap="off">';
echo file_get_contents($serial_file);
echo '</textarea><br><br>';
}
echo 'This information is primarily used for troubleshooting when working with support. If you are encountering problems providing this information to support may assist in troubleshooting.';
pb_backupbuddy::$ui->ajax_footer();
die;
}
示例4: __construct
function __construct($form_name, $save_point_or_custom_mode, $additional_query_string = '', $custom_title_width = '')
{
$this->_form_name = $form_name;
$this->_prefix = 'pb_' . pb_backupbuddy::settings('slug') . '_';
$this->_savepoint = $save_point_or_custom_mode;
$this->_custom_title_width = $custom_title_width;
// TODO: no need to pass savepoint here? below:
$this->_form = new pb_backupbuddy_form($form_name, $save_point_or_custom_mode, $additional_query_string);
}
示例5: 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);
}
示例6: _connect
private static function _connect($accessToken)
{
try {
self::$_dbxClient = new dbx\Client($accessToken, 'BackupBuddy v' . pb_backupbuddy::settings('version'));
} catch (\Exception $e) {
pb_backupbuddy::alert('Dropbox Error: ' . $e->getMessage() . '<br><br>' . pb_backupbuddy::$ui->button(pb_backupbuddy::page_url(), '← go back & retry'), true);
return false;
}
pb_backupbuddy::status('details', 'Connected to Dropbox.');
return true;
}
示例7: run_periodic
public static function run_periodic($backup_age_limit = 172800, $die_on_fail = true)
{
if (is_multisite()) {
// For Multisite only run on main Network site.
if (!is_main_site()) {
return;
}
}
pb_backupbuddy::status('message', 'Starting periodic housekeeeping procedure for BackupBuddy v' . pb_backupbuddy::settings('version') . '.');
require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
if (!isset(pb_backupbuddy::$options)) {
pb_backupbuddy::load();
}
// Top priority. Security related or otherwise crucial to run first.
self::no_recent_backup_reminder();
backupbuddy_core::verify_directories($skipTempGeneration = true);
// Verify directory existance and anti-directory browsing is in place everywhere.
self::check_high_security_mode($die_on_fail);
self::remove_importbuddy_file();
self::remove_importbuddy_dir();
self::remove_rollback_files();
// Potential large file/dir cleanup. May bog down site.
self::cleanup_temp_dir($backup_age_limit);
self::remove_temp_zip_dirs($backup_age_limit);
// Robustness -- handle re-processing timeouts, verifying schedules, etc.
self::process_timed_out_backups();
self::process_timed_out_sends();
self::validate_bb_schedules_in_wp();
// More minor cleanup.
self::remove_temp_tables();
self::remove_wp_schedules_with_no_bb_schedule();
self::trim_old_notifications();
self::trim_remote_send_stats();
self::s3_cancel_multipart_pieces();
self::s32_cancel_multipart_pieces();
self::cleanup_local_destination_temp();
self::purge_logs();
self::purge_large_logs();
self::clear_cron_send();
// PHP tests.
self::schedule_php_runtime_tests();
self::schedule_php_memory_tests();
@clearstatcache();
// Clears file info stat cache.
pb_backupbuddy::status('message', 'Finished periodic housekeeping cleanup procedure.');
}
示例8: remoteAPI
public function remoteAPI($endpoint)
{
$response = wp_remote_post($this->_state['apiURL'], array('method' => 'POST', 'timeout' => 10, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), 'body' => array('backupbuddyVersion' => pb_backupbuddy::settings('version'), 'run' => $endpoint), 'cookies' => array()));
if (is_wp_error($response)) {
return $this->_error($response->get_error_message());
} else {
if (null === ($return = json_decode($response['body'], true))) {
return $this->_error('Error #45434: Unable to decode json response `' . $response['body'] . '`.');
} else {
if (true !== $return['success']) {
return $this->_error('Error #3289379: API did not report success.');
} else {
return $return['data'];
}
}
}
}
示例9: remoteAPI
public function remoteAPI($endpoint)
{
$response = wp_remote_post($this->_state['apiURL'], array('method' => 'POST', 'timeout' => 10, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), 'body' => array('backupbuddy_api' => 'true', 'api_key' => 'xxx', 'backupbuddy_version' => pb_backupbuddy::settings('version'), 'verb' => $endpoint), 'cookies' => array()));
if (is_wp_error($response)) {
return $this->_error($response->get_error_message());
} else {
if (null === ($return = json_decode($response['body'], true))) {
return $this->_error('Error #4543664: Unable to decode json response. Verify remote site API URL, API key, and that the remote site has the API enabled. Return data: `' . htmlentities($response['body']) . '`.');
} else {
if (true !== $return['success']) {
return $this->_error('Error #3289379: API did not report success.');
} else {
return $return['data'];
}
}
}
}
示例10: form
/**
* \WP_Widget::form() Override
*
* Displays the widget form on the widget selection page for setting widget settings.
* Widget defaults are pre-merged into $instance right before this function is called.
* Use $widget->get_field_id() and $widget->get_field_name() to get field IDs and names for form elements.
* Anything to display should be echo'd out.
* @see WP_Widget class
*
* @param $instance array Associative array containing the options set previously in this form and/or the widget defaults (merged already).
* @return null
*/
function form($instance)
{
$instance = array_merge((array) pb_backupbuddy::settings('widget_defaults'), (array) $instance);
if (empty(pb_backupbuddy::$options['groups'])) {
echo 'You must create a PluginBuddy Carousel group to place this widget. Please do so within the plugin\'s page.';
} else {
?>
<label for="<?php
echo $this->get_field_id('group');
?>
">
Carousel Group:
<select class="widefat" id="<?php
echo $this->get_field_id('group');
?>
" name="<?php
echo $this->get_field_name('group');
?>
">
<?php
foreach ((array) pb_backupbuddy::$options['groups'] as $id => $group) {
if ($instance['group'] == $id) {
$select = ' selected ';
} else {
$select = '';
}
echo '<option value="' . $id . '"' . $select . '>' . stripslashes($group['title']) . ' (' . count($group['images']) . ' images)</option>';
}
?>
</select>
</label>
<input type="hidden" id="<?php
echo $this->get_field_id('submit');
?>
" name="<?php
echo $this->get_field_name('submit');
?>
" value="1" />
<?php
}
}
示例11: backup_step_status
public function backup_step_status()
{
$serial = pb_backupbuddy::_GET('serial');
pb_backupbuddy::load();
pb_backupbuddy::$ui->ajax_header();
echo '<h3>Backup Process Technical Details</h3>';
echo '<b>Step Details:</b><br>';
echo '<textarea style="width: 100%; height: 120px;" wrap="off">';
print_r(pb_backupbuddy::$options['backups'][$serial]);
echo '</textarea><br><br>';
// Output status log if it exists.
$log_directory = WP_CONTENT_DIR . '/uploads/pb_' . pb_backupbuddy::settings('slug') . '/';
$serial_file = $log_directory . 'status-' . $serial . '_' . pb_backupbuddy::$options['log_serial'] . '.txt';
if (file_exists($serial_file)) {
echo '<b>Log Details:</b><br>';
echo '<textarea style="width: 100%; height: 120px;" wrap="off">';
echo file_get_contents($serial_file);
echo '</textarea><br><br>';
}
echo 'This information is primarily used for troubleshooting when working with support. If you are encountering problems providing this information to support may assist in troubleshooting.';
pb_backupbuddy::$ui->ajax_footer();
die;
}
示例12: array_push
}
array_push($tests, $parent_class_test);
// Set up ZipBuddy when within BackupBuddy
require_once pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php';
pb_backupbuddy::$classes['zipbuddy'] = new pluginbuddy_zipbuddy(backupbuddy_core::getBackupDirectory());
require_once pb_backupbuddy::plugin_path() . '/lib/mysqlbuddy/mysqlbuddy.php';
global $wpdb;
pb_backupbuddy::$classes['mysqlbuddy'] = new pb_backupbuddy_mysqlbuddy(DB_HOST, DB_NAME, DB_USER, DB_PASSWORD, $wpdb->prefix);
// $database_host, $database_name, $database_user, $database_pass, $old_prefix, $force_method = array()
}
// PHP VERSION
if (!defined('pluginbuddy_importbuddy')) {
$php_minimum = pb_backupbuddy::settings('php_minimum');
} else {
// importbuddy value.
$php_minimum = pb_backupbuddy::settings('php_minimum');
}
$parent_class_test = array('title' => 'PHP Version', 'suggestion' => '>= ' . $php_minimum . ' (5.2.16+ best)', 'value' => phpversion(), 'tip' => __('Version of PHP currently running on this site.', 'it-l10n-backupbuddy'));
if (version_compare(PHP_VERSION, $php_minimum, '<=')) {
$parent_class_test['status'] = __('FAIL', 'it-l10n-backupbuddy');
} else {
$parent_class_test['status'] = __('OK', 'it-l10n-backupbuddy');
}
array_push($tests, $parent_class_test);
// PHP max_execution_time
$parent_class_test = array('title' => 'PHP max_execution_time (server-reported)', 'suggestion' => '>= ' . '30 seconds (30+ best)', 'value' => ini_get('max_execution_time'), 'tip' => __('Maximum amount of time that PHP allows scripts to run. After this limit is reached the script is killed. The more time available the better. 30 seconds is most common though 60 seconds is ideal.', 'it-l10n-backupbuddy'));
if (str_ireplace('s', '', ini_get('max_execution_time')) < 30) {
$parent_class_test['status'] = __('WARNING', 'it-l10n-backupbuddy');
} else {
$parent_class_test['status'] = __('OK', 'it-l10n-backupbuddy');
}
示例13: die
<?php
if (!is_admin()) {
die('Access denied.');
}
// Display site size listing in table.
/* site_size_listing()
*
* Display site site listing on Server Info page.
*
*/
$profile_id = 0;
if (is_numeric(pb_backupbuddy::_GET('profile'))) {
if (isset(pb_backupbuddy::$options['profiles'][pb_backupbuddy::_GET('profile')])) {
$profile_id = pb_backupbuddy::_GET('profile');
pb_backupbuddy::$options['profiles'][pb_backupbuddy::_GET('profile')] = array_merge(pb_backupbuddy::settings('profile_defaults'), pb_backupbuddy::$options['profiles'][pb_backupbuddy::_GET('profile')]);
// Set defaults if not set.
} else {
pb_backupbuddy::alert('Error #45849458b: Invalid profile ID number `' . htmlentities(pb_backupbuddy::_GET('profile')) . '`. Displaying with default profile.', true);
}
}
echo '<!-- profile: ' . $profile_id . ' -->';
$exclusions = backupbuddy_core::get_directory_exclusions(pb_backupbuddy::$options['profiles'][$profile_id]);
$result = pb_backupbuddy::$filesystem->dir_size_map(ABSPATH, ABSPATH, $exclusions, $dir_array);
if (0 == $result) {
pb_backupbuddy::alert('Error #5656653. Unable to access directory map listing for directory `' . ABSPATH . '`.');
die;
}
$total_size = pb_backupbuddy::$options['stats']['site_size'] = $result[0];
$total_size_excluded = pb_backupbuddy::$options['stats']['site_size_excluded'] = $result[1];
pb_backupbuddy::$options['stats']['site_size_updated'] = time();
示例14: addNotification
public static function addNotification($slug, $title, $message, $data = array(), $urgent = false, $time = '')
{
if ('' == $time) {
$time = time();
}
// Create this new notification data.
$notification = array('slug' => $slug, 'time' => $time, 'title' => $title, 'message' => $message, 'data' => $data, 'urgent' => false);
$notification = array_merge(pb_backupbuddy::settings('notification_defaults'), $notification);
// Apply defaults.
// Load current notifications.
$notificationArray = self::getNotifications();
// Add to current notifications.
$notificationArray[] = $notification;
// Save.
self::replaceNotifications($notificationArray);
}
示例15: remoteCall
public static function remoteCall($remoteAPI, $verb, $moreParams = array(), $timeout, $file = '', $fileData = '', $seekTo = '', $isFileTest = '', $isFileDone = false, $fileSize = '', $filePath = '', $returnRaw = false)
{
pb_backupbuddy::status('details', 'Preparing remote API call verb `' . $verb . '`.');
$now = time();
$body = array('backupbuddy_api_key' => $remoteAPI['key_public'], 'backupbuddy_version' => pb_backupbuddy::settings('version'), 'verb' => $verb, 'now' => $now);
if (!is_numeric($timeout)) {
$timeout = backupbuddy_constants::DEPLOYMENT_REMOTE_API_DEFAULT_TIMEOUT;
}
pb_backupbuddy::status('details', 'remoteCall() HTTP wait timeout: `' . $timeout . '` seconds.');
$filecrc = '';
if ('' != $file) {
pb_backupbuddy::status('details', 'Remote API sending file `' . $file . '`.');
$fileData = base64_encode($fileData);
// Sadly we cannot safely transmit binary data over curl without using an actual file. base64 encoding adds 37% size overhead.
$filecrc = sprintf("%u", crc32($fileData));
$body['filename'] = basename($file);
if ('' != $filePath) {
$body['filepath'] = $filePath;
}
$body['filedata'] = $fileData;
$body['filedatalen'] = strlen($fileData);
$body['filecrc'] = $filecrc;
if (true === $isFileTest) {
$body['filetest'] = '1';
} else {
$body['filetest'] = '0';
}
if (true === $isFileDone) {
$body['filedone'] = '1';
} else {
$body['filedone'] = '0';
}
$body['seekto'] = $seekTo;
// Location to seek to before writing this part.
if ('' != $fileSize) {
$body['filetotalsize'] = $fileSize;
}
}
if (!is_array($moreParams)) {
error_log('BackupBuddy Error #4893783447 remote_api.php; $moreParams must be passed as array.');
}
$body = array_merge($body, $moreParams);
//print_r( $apiKey );
$body['signature'] = md5($now . $verb . $remoteAPI['key_public'] . $remoteAPI['key_secret'] . $filecrc);
if (defined('BACKUPBUDDY_DEV') && true === BACKUPBUDDY_DEV) {
error_log('BACKUPBUDDY_DEV-remote api http body SEND- ' . print_r($body, true));
}
$response = wp_remote_post($remoteAPI['siteurl'], array('method' => 'POST', 'timeout' => $timeout - 2, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array('Referer' => $remoteAPI['siteurl']), 'body' => $body, 'cookies' => array()));
if (is_wp_error($response)) {
return self::_error('Error #9037: Unable to connect to remote server or unexpected response. Details: `' . $response->get_error_message() . '` - URL: `' . $remoteAPI['siteurl'] . '`.');
} else {
if (true === $returnRaw) {
return $response['body'];
}
//error_log( '3333Response: ' . $response['body'] );
if (null === ($return = json_decode($response['body'], true))) {
return self::_error('Error #8001: Unable to decode json response. Verify remote site API URL `' . $remoteAPI['siteurl'] . '`, API key, and that the remote site has the API enabled in its wp-config.php by adding <i>define( \'BACKUPBUDDY_API_ENABLE\', true );</i> somewhere ABOVE the line "That\'s all, stop editing!". Return data: `' . htmlentities(stripslashes_deep($response['body'])) . '`.');
} else {
if (!isset($return['success']) || true !== $return['success']) {
// Fail.
$error = '';
if (isset($return['error'])) {
$error = $return['error'];
} else {
$error = 'Error #838438734: No error given. Full response: "' . $return . '".';
}
return self::_error('Error #3289379: API did not report success. Error details: `' . $error . '`.');
} else {
// Success.
if (isset($return['message'])) {
pb_backupbuddy::status('details', 'Response message from API: ' . $return['message'] . '".');
}
return $return;
}
}
}
}