本文整理汇总了PHP中pb_backupbuddy_settings::add_setting方法的典型用法代码示例。如果您正苦于以下问题:PHP pb_backupbuddy_settings::add_setting方法的具体用法?PHP pb_backupbuddy_settings::add_setting怎么用?PHP pb_backupbuddy_settings::add_setting使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pb_backupbuddy_settings
的用法示例。
在下文中一共展示了pb_backupbuddy_settings::add_setting方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
return false;
});
});
function pb_backupbuddy_selectdestination( destination_id, destination_title, callback_data, delete_after, mode ) {
window.location.href = '<?php
echo pb_backupbuddy::page_url();
?>
&custom=remoteclient&destination_id=' + destination_id;
}
</script>
<?php
/* BEGIN CONFIGURING PLUGIN SETTINGS FORM */
$settings_form = new pb_backupbuddy_settings('settings', '', 'tab=0', 350);
$settings_form->add_setting(array('type' => 'title', 'name' => 'title_general', 'title' => __('General', 'it-l10n-backupbuddy')));
$settings_form->add_setting(array('type' => 'password', 'name' => 'importbuddy_pass_hash', 'title' => __('ImportBuddy password', 'it-l10n-backupbuddy'), 'tip' => __('[Example: myp@ssw0rD] - Required password for running the ImportBuddy import/migration script. This prevents unauthorized access when using this tool. You should not use your WordPress password here.', 'it-l10n-backupbuddy'), 'value' => $importbuddy_pass_dummy_text, 'css' => 'width: 120px;', 'after' => ' <span style="white-space: nowrap;">Confirm: <input style="width: 120px;" type="password" name="pb_backupbuddy_importbuddy_pass_hash_confirm" value="' . $importbuddy_pass_dummy_text . '"></span>'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'backup_directory', 'title' => __('Custom local storage directory', 'it-l10n-backupbuddy'), 'tip' => __('Leave blank for default. To customize, enter a full local path where all backup ZIP files will be saved to. This directory must have proper write and read permissions. Upon changing, any backups in the existing directory will be moved to the new directory. Note: This is only where local backups will be, not remotely stored backups. Remote storage is configured on the Remote Destinations page.', 'it-l10n-backupbuddy'), 'rules' => '', 'css' => 'width: 250px;', 'before' => '<span style="white-space: nowrap;">', 'after' => ' <span class="description">' . __('Blank for default', 'it-l10n-backupbuddy') . ':</span> <span class="code" style="background: #EAEAEA; white-space: normal;">' . backupbuddy_core::_getBackupDirectoryDefault() . '</span>'));
$settings_form->add_setting(array('type' => 'select', 'name' => 'role_access', 'title' => __('BackupBuddy access permission', 'it-l10n-backupbuddy'), 'options' => array('administrator' => __('Administrator (default)', 'it-l10n-backupbuddy'), 'moderate_comments' => __('Editor (moderate_comments)', 'it-l10n-backupbuddy'), 'edit_published_posts' => __('Author (edit_published_posts)', 'it-l10n-backupbuddy'), 'edit_posts' => __('Contributor (edit_posts)', 'it-l10n-backupbuddy')), 'tip' => __('[Default: Administrator] - Allow other user levels to access BackupBuddy. Use extreme caution as users granted access will have FULL access to BackupBuddy and your backups, including remote destinations. This is a potential security hole if used improperly. Use caution when selecting any other user roles or giving users in such roles access. Not applicable to Multisite installations.', 'it-l10n-backupbuddy'), 'after' => ' <span class="description">Use caution changing from "administrator".</span>', 'rules' => 'required'));
require_once '_email.php';
$settings_form->add_setting(array('type' => 'title', 'name' => 'title_archivestoragelimits', 'title' => __('Local Archive Storage Limits', 'it-l10n-backupbuddy') . ' ' . pb_backupbuddy::video('PmXLw_tS42Q#45', __('Archive Storage Limits Tutorial', 'it-l10n-backupbuddy'), false)));
$settings_form->add_setting(array('type' => 'text', 'name' => 'archive_limit', 'title' => __('Limit number of local backups to keep', 'it-l10n-backupbuddy'), 'tip' => __('[Example: 10] - Maximum number of local archived backups to store (remote archive limits are configured per destination on their respective settings pages). Any new backups created after this limit is met will result in your oldest backup(s) being deleted to make room for the newer ones. Changes to this setting take place once a new backup is made. Set to zero (0) for no limit.', 'it-l10n-backupbuddy'), 'rules' => 'required|string[0-500]|int', 'css' => 'width: 50px;', 'after' => ' backups. <span class="description">0 for no limit.</span>'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'archive_limit_size', 'title' => __('Size limit of all local backups combined', 'it-l10n-backupbuddy'), 'tip' => __('[Example: 350] - Maximum size (in MB) to allow your total local archives to reach (remote archive limits are configured per destination on their respective settings pages). Any new backups created after this limit is met will result in your oldest backup(s) being deleted to make room for the newer ones. Changes to this setting take place once a new backup is made. Set to zero (0) for no limit.', 'it-l10n-backupbuddy'), 'rules' => 'required|string[0-500]|int', 'css' => 'width: 50px;', 'after' => ' MB. <span class="description">0 for no limit.</span>'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'archive_limit_age', 'title' => __('Age limit of local backups', 'it-l10n-backupbuddy'), 'tip' => __('[Example: 90] - Maximum age (in days) to allow your local archives to reach (remote archive limits are configured per destination on their respective settings pages). Any backups exceeding this age will be deleted as new backups are created. Changes to this setting take place once a new backup is made. Set to zero (0) for no limit.', 'it-l10n-backupbuddy'), 'rules' => 'required|string[0-99999]|int', 'css' => 'width: 50px;', 'after' => ' days. <span class="description">0 for no limit.</span>'));
if (is_multisite()) {
$settings_form->add_setting(array('type' => 'title', 'name' => 'title_multisite', 'title' => __('Multisite', 'it-l10n-backupbuddy')));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'multisite_export', 'title' => __('Allow individual site exports by administrators?', 'it-l10n-backupbuddy') . ' ' . pb_backupbuddy::video('_oKGIzzuVzw', __('Multisite export', 'it-l10n-backupbuddy'), false), 'options' => array('unchecked' => '0', 'checked' => '1'), 'tip' => __('[Default: disabled] - When enabled individual sites may be exported by Administrators of the individual site. Network Administrators always see this menu (notes with the words SuperAdmin in parentheses in the menu when only SuperAdmins have access to the feature).', 'it-l10n-backupbuddy'), 'rules' => 'required', 'after' => '<span class="description"> ' . __('Check to extend Site Exporting functionality to subsite Administrators.', 'it-l10n-backupbuddy') . '</span>'));
}
$profile = 0;
// Defaults index.
$settings_form->add_setting(array('type' => 'title', 'name' => 'title_database', 'title' => __('Database Defaults', 'it-l10n-backupbuddy')));
示例2: date
$remote_destinations_html .= pb_backupbuddy::$options['remote_destinations'][$destination]['title'];
$remote_destinations_html .= ' (' . pb_backupbuddy::$classes['core']->pretty_destination_type(pb_backupbuddy::$options['remote_destinations'][$destination]['type']) . ') ';
$remote_destinations_html .= '<img class="pb_remotedestionation_delete" src="' . pb_backupbuddy::plugin_url() . '/images/bullet_delete.png" style="vertical-align: -3px; cursor: pointer;" title="' . __('Remove remote destination from this schedule.', 'it-l10n-backupbuddy') . '" />';
$remote_destinations_html .= '</li>';
}
}
$remote_destinations = '<ul id="pb_backupbuddy_remotedestinations_list">' . $remote_destinations_html . '</ul>';
} else {
$mode = 'add';
$data['mode_title'] = __('Add New Schedule', 'it-l10n-backupbuddy');
$savepoint = false;
$first_run_value = date('m/d/Y h:i a', time() + (get_option('gmt_offset') * 3600 + 86400));
$remote_destinations = '<ul id="pb_backupbuddy_remotedestinations_list"></ul>';
}
$schedule_form = new pb_backupbuddy_settings('scheduling', $savepoint, 'edit=' . pb_backupbuddy::_GET('edit'), 250);
$schedule_form->add_setting(array('type' => 'text', 'name' => 'title', 'title' => 'Schedule name', 'tip' => __('This is a name for your reference only.', 'it-l10n-backupbuddy'), 'rules' => 'required'));
$schedule_form->add_setting(array('type' => 'radio', 'name' => 'type', 'title' => 'Backup type', 'options' => array('db' => 'Database only', 'full' => 'Full backup'), 'tip' => __('Full backups contain all files (except exclusions) and your database. Database only backups consist of an export of your mysql database; no WordPress files or media. Database backups are typically much smaller and faster to perform and are typically the most quickly changing part of a site.', 'it-l10n-backupbuddy'), 'rules' => 'required'));
$schedule_form->add_setting(array('type' => 'select', 'name' => 'interval', 'title' => 'Backup interval', 'options' => array('monthly' => 'Monthly', 'twicemonthly' => 'Twice Monthly', 'weekly' => 'Weekly', 'daily' => 'Daily', 'hourly' => 'Hourly'), 'tip' => __('Time period between backups.', 'it-l10n-backupbuddy'), 'rules' => 'required'));
$schedule_form->add_setting(array('type' => 'text', 'name' => 'first_run', 'title' => 'Date/time of next run', 'tip' => __('IMPORTANT: For scheduled events to occur someone (or you) must visit this site on or after the scheduled time. If no one visits your site for a long period of time some backup events may not be triggered.', 'it-l10n-backupbuddy'), 'rules' => 'required', 'default' => $first_run_value, 'after' => ' ' . __('Currently', 'it-l10n-backupbuddy') . ' <code>' . date('m/d/Y h:i a ' . get_option('gmt_offset'), time() + get_option('gmt_offset') * 3600) . ' UTC</code> ' . __('based on', 'it-l10n-backupbuddy') . ' <a href="' . admin_url('options-general.php') . '">' . __('WordPress settings', 'it-l10n-backupbuddy') . '</a>.'));
$schedule_form->add_setting(array('type' => 'text', 'name' => 'remote_destinations', 'title' => 'Remote backup destination', 'rules' => '', 'css' => 'display: none;', 'after' => $remote_destinations . '<a href="' . pb_backupbuddy::ajax_url('destination_picker') . '&TB_iframe=1&width=640&height=600" class="thickbox button secondary-button" style="margin-top: 3px;" title="' . __('Select a Destination', 'it-l10n-backupbuddy') . '">' . __('+ Add Remote Destination', 'it-l10n-backupbuddy') . '</a>'));
$schedule_form->add_setting(array('type' => 'checkbox', 'name' => 'delete_after', 'title' => 'Delete local backup after remote send?', 'options' => array('checked' => '1', 'unchecked' => '0'), 'rules' => ''));
// PROCESS ADDING SCHEDULE.
$submitted_schedule = $schedule_form->process();
// Handles processing the submitted form (if applicable).
if ($submitted_schedule != '' && count($submitted_schedule['errors']) == 0) {
// ADD SCHEDULE.
if (pb_backupbuddy::_GET('edit') == '') {
$error = false;
$schedule = pb_backupbuddy::settings('schedule_defaults');
$schedule['title'] = $submitted_schedule['data']['title'];
if (isset($submitted_schedule['data']['type'])) {
示例3: date
$remote_destinations_html .= pb_backupbuddy::$options['remote_destinations'][$destination]['title'];
$remote_destinations_html .= ' (' . backupbuddy_core::pretty_destination_type(pb_backupbuddy::$options['remote_destinations'][$destination]['type']) . ') ';
$remote_destinations_html .= '<img class="pb_remotedestionation_delete" src="' . pb_backupbuddy::plugin_url() . '/images/redminus.png" style="vertical-align: -3px; cursor: pointer;" title="' . __('Remove remote destination from this schedule.', 'it-l10n-backupbuddy') . '" />';
$remote_destinations_html .= '</li>';
}
}
$remote_destinations = '<ul id="pb_backupbuddy_remotedestinations_list">' . $remote_destinations_html . '</ul>';
} else {
$mode = 'add';
$data['mode_title'] = __('Add New Schedule', 'it-l10n-backupbuddy');
$savepoint = false;
$first_run_value = date('m/d/Y h:i a', time() + (get_option('gmt_offset') * 3600 + 86400));
$remote_destinations = '<ul id="pb_backupbuddy_remotedestinations_list"></ul>';
}
$schedule_form = new pb_backupbuddy_settings('scheduling', $savepoint, 'edit=' . pb_backupbuddy::_GET('edit'), 250);
$schedule_form->add_setting(array('type' => 'text', 'name' => 'title', 'title' => 'Schedule name', 'tip' => __('This is a name for your reference only.', 'it-l10n-backupbuddy'), 'rules' => 'required'));
$profile_list = array();
foreach (pb_backupbuddy::$options['profiles'] as $profile_id => $profile) {
if ($profile_id == 0) {
continue;
}
// default profile.
if ($profile['type'] == 'full') {
$pretty_type = 'Full';
} elseif ($profile['type'] == 'db') {
$pretty_type = 'Database Only';
} elseif ($profile['type'] == 'files') {
$pretty_type = 'Files Only';
} else {
$pretty_type = 'Unknown';
}
示例4: configure
public static function configure($destination_settings, $mode)
{
// Initialize destination.
$destination_class = self::_init_destination($destination_settings['type']);
if (!class_exists($destination_class)) {
echo '{Error #546893498a. Destination configuration file missing. Missing class: `' . $destination_class . '`}';
return false;
}
// Default settings.
// Get default settings from class. Was using a variable class name but had to change this for PHP 5.2 compat.
$vars = get_class_vars($destination_class);
$default_settings = $vars['default_settings'];
unset($vars);
$destination_settings = array_merge($default_settings, $destination_settings);
// Merge in defaults.
// Get default info from class. Was using a variable class name but had to change this for PHP 5.2 compat.
$vars = get_class_vars($destination_class);
$default_info = $vars['destination_info'];
unset($vars);
$destination_info = array_merge(self::$_destination_info_defaults, $default_info);
// Merge in defaults.
$settings_form = new pb_backupbuddy_settings('settings', $destination_settings, 'sending=' . pb_backupbuddy::_GET('sending'));
$settings_form->add_setting(array('type' => 'hidden', 'name' => 'type', 'value' => $destination_settings['type']));
$config_file = pb_backupbuddy::plugin_path() . '/destinations/' . $destination_settings['type'] . '/_configure.php';
if (file_exists($config_file)) {
require $config_file;
} else {
echo '{Error #54556543. Missing destination config file `' . $config_file . '`.}';
return false;
}
return $settings_form;
}
示例5: array
});
function pb_backupbuddy_selectdestination( destination_id, destination_title, callback_data ) {
window.location.href = '<?php
echo pb_backupbuddy::page_url();
?>
&custom=remoteclient&destination_id=' + destination_id;
}
</script>
<?php
echo '<br>';
/* BEGIN CONFIGURING PLUGIN SETTINGS FORM */
$settings_form = new pb_backupbuddy_settings('settings', '', 'tab=0', 320);
$settings_form->add_setting(array('type' => 'title', 'name' => 'title_general', 'title' => __('General', 'it-l10n-backupbuddy')));
$settings_form->add_setting(array('type' => 'password', 'name' => 'importbuddy_pass_hash', 'title' => __('ImportBuddy & RepairBuddy password', 'it-l10n-backupbuddy'), 'tip' => __('[Example: myp@ssw0rD] - Required password for running the ImportBuddy import/migration script. This prevents unauthorized access when using this tool. You should not use your WordPress password here.', 'it-l10n-backupbuddy'), 'value' => $importbuddy_pass_dummy_text, 'after' => ' Confirm: <input type="password" name="pb_backupbuddy_importbuddy_pass_hash_confirm" value="' . $importbuddy_pass_dummy_text . '">'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'backup_directory', 'title' => __('Local storage directory for backups', 'it-l10n-backupbuddy'), 'tip' => __('Local directory where all backup ZIP files will be saved to. This directory must have proper write and read permissions. Upon changing, any backups in the existing directory will be moved to the new directory. Note: This is only where local backups will be, not remotely stored backups. Remote storage is configured on the Remote Destinations page.', 'it-l10n-backupbuddy'), 'rules' => 'required', 'css' => 'width: 325px;', 'after' => ' <a style="cursor: pointer;" onClick="jQuery(\'#pb_backupbuddy_backup_directory\').val(\'' . str_replace('\\', '/', ABSPATH) . 'wp-content/uploads/backupbuddy_backups/\');">Reset Default</a>'));
$settings_form->add_setting(array('type' => 'select', 'name' => 'role_access', 'title' => __('BackupBuddy access permission', 'it-l10n-backupbuddy'), 'options' => array('administrator' => __('Administrator (default)', 'it-l10n-backupbuddy'), 'moderate_comments' => __('Editor (moderate_comments)', 'it-l10n-backupbuddy'), 'edit_published_posts' => __('Author (edit_published_posts)', 'it-l10n-backupbuddy'), 'edit_posts' => __('Contributor (edit_posts)', 'it-l10n-backupbuddy')), 'tip' => __('[Default: Administrator] - Allow other user levels to access BackupBuddy. Use extreme caution as users granted access will have FULL access to BackupBuddy and your backups, including remote destinations. This is a potential security hole if used improperly. Use caution when selecting any other user roles or giving users in such roles access. Not applicable to Multisite installations.', 'it-l10n-backupbuddy'), 'after' => ' <span class="description">Use caution changing from "administrator".</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'archive_name_format', 'options' => array('unchecked' => 'date', 'checked' => 'datetime'), 'title' => __('Add time in backup file name', 'it-l10n-backupbuddy'), 'tip' => __('[Default: disabled (date only)] - When enabled your backup filename will display the time the backup was created in addition to the default date. This is useful when making multiple backups in a one day period.', 'it-l10n-backupbuddy'), 'css' => '', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'backup_reminders', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Enable backup reminders for edits', 'it-l10n-backupbuddy'), 'tip' => __('[Default: enabled] - When enabled links will be displayed upon post or page edits and during WordPress upgrades to remind and allow rapid backing up after modifications or before upgrading.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '', 'rules' => 'required'));
require_once '_email.php';
$settings_form->add_setting(array('type' => 'title', 'name' => 'title_archivestoragelimits', 'title' => __('Local Archive Storage Limits', 'it-l10n-backupbuddy') . ' ' . pb_backupbuddy::video('PmXLw_tS42Q#45', __('Archive Storage Limits Tutorial', 'it-l10n-backupbuddy'), false)));
$settings_form->add_setting(array('type' => 'text', 'name' => 'archive_limit', 'title' => __('Maximum number of local backups to keep', 'it-l10n-backupbuddy'), 'tip' => __('[Example: 10] - Maximum number of local archived backups to store (remote archive limits are configured per destination on their respective settings pages). Any new backups created after this limit is met will result in your oldest backup(s) being deleted to make room for the newer ones. Changes to this setting take place once a new backup is made. Set to zero (0) for no limit.', 'it-l10n-backupbuddy'), 'rules' => 'required|string[0-500]', 'css' => 'width: 50px;', 'after' => ' backups'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'archive_limit_size', 'title' => __('Maximum size of all local backups combined', 'it-l10n-backupbuddy'), 'tip' => __('[Example: 350] - Maximum size (in MB) to allow your total local archives to reach (remote archive limits are configured per destination on their respective settings pages). Any new backups created after this limit is met will result in your oldest backup(s) being deleted to make room for the newer ones. Changes to this setting take place once a new backup is made. Set to zero (0) for no limit.', 'it-l10n-backupbuddy'), 'rules' => 'required|string[0-500]', 'css' => 'width: 50px;', 'after' => ' MB'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'archive_limit_age', 'title' => __('Maximum age of local backups', 'it-l10n-backupbuddy'), 'tip' => __('[Example: 90] - Maximum age (in days) to allow your local archives to reach (remote archive limits are configured per destination on their respective settings pages). Any backups exceeding this age will be deleted as new backups are created. Changes to this setting take place once a new backup is made. Set to zero (0) for no limit.', 'it-l10n-backupbuddy'), 'rules' => 'required|string[0-99999]', 'css' => 'width: 50px;', 'after' => ' days'));
if (is_multisite()) {
$settings_form->add_setting(array('type' => 'title', 'name' => 'title_multisite', 'title' => __('Multisite', 'it-l10n-backupbuddy')));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'multisite_export', 'title' => __('Allow individual site exports by administrators?', 'it-l10n-backupbuddy') . ' ' . pb_backupbuddy::video('_oKGIzzuVzw', __('Multisite export', 'it-l10n-backupbuddy'), false), 'options' => array('unchecked' => '0', 'checked' => '1'), 'tip' => __('[Default: disabled] - When enabled individual sites may be exported by Administrators of the individual site. Network Administrators always see this menu (notes with the words SuperAdmin in parentheses in the menu when only SuperAdmins have access to the feature).', 'it-l10n-backupbuddy'), 'rules' => 'required', 'after' => '<span class="description"> ' . __('Check to extend Site Exporting functionality to subsite Administrators.', 'it-l10n-backupbuddy') . '</span>'));
}
$profile = 0;
示例6: array
});
</script>
<style>
.bb-alternate-zip-options {
display: none;
}
</style>
<?php
$settings_form = new pb_backupbuddy_settings('advanced_settings', '', 'tab=1', 320);
$settings_form->add_setting(array('type' => 'title', 'name' => 'title_basic', 'title' => __('Basic Operation', 'it-l10n-backupbuddy')));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'backup_reminders', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Enable backup reminders', 'it-l10n-backupbuddy'), 'tip' => __('[Default: enabled] - When enabled links will be displayed upon post or page edits and during WordPress upgrades to remind and allow rapid backing up after modifications or before upgrading.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'select', 'name' => 'archive_name_format', 'options' => array('date' => 'Date only [default]', 'datetime' => 'Date + time (12hr format)', 'datetime24' => 'Date + time (24hr format)', 'timestamp' => 'Unix Timestamp'), 'title' => __('Backup file name date/time', 'it-l10n-backupbuddy'), 'tip' => __('[Default: disabled (date only)] - When enabled your backup filename will display the time the backup was created in addition to the default date. This is useful when making multiple backups in a one day period.', 'it-l10n-backupbuddy'), 'css' => '', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'archive_name_profile', 'options' => array('unchecked' => 0, 'checked' => 1), 'title' => __('Add the backup profile to backup file name', 'it-l10n-backupbuddy'), 'tip' => __('[Default: disabled] - When enabled your backup filename will display the backup profile used to initiate the backup. This is useful when making multiple backups from different profiles.', 'it-l10n-backupbuddy'), 'css' => '', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'lock_archives_directory', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Lock archive directory (high security)', 'it-l10n-backupbuddy'), 'tip' => __('[Default: disabled] - When enabled all downloads of archives via the web will be prevented under all circumstances via .htaccess file. If your server permits it, they will only be unlocked temporarily on click to download. If your server does not support this unlocking then you will have to access the archives via the server (such as by FTP).', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('May prevent downloading backups within WordPress on incompatible servers', 'it-l10n-backupbuddy'), 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'include_importbuddy', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Include ImportBuddy in full backup archive', 'it-l10n-backupbuddy'), 'tip' => __('[Default: enabled] - When enabled, the importbuddy.php (restoration tool) file will be included within the backup archive ZIP file in the location `/' . str_replace(ABSPATH, '', backupbuddy_core::getTempDirectory()) . ' xxxxxxxxxx/ importbuddy.php` where the x\'s match the unique random string in the backup ZIP filename.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => ' <span style="white-space: nowrap;"><span class="description">' . __('Located in backup', 'it-l10n-backupbuddy') . ':</span> <span class="code" style="white-space: normal; background: #EAEAEA;"">/' . str_replace(ABSPATH, '', backupbuddy_core::getTempDirectory()) . 'xxxxxxxxxx/importbuddy.php</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'select', 'name' => 'default_backup_tab', 'title' => __('Default backup tab', 'it-l10n-backupbuddy'), 'options' => array('0' => __('Overview', 'it-l10n-backupbuddy'), '1' => __('Status Log', 'it-l10n-backupbuddy')), 'tip' => sprintf(__('[Default: Overview] - The default tab open during a backup is the overview tab. A more technical view is available in the Status tab.', 'it-l10n-backupbuddy')), 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'disable_localization', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Disable language localization', 'it-l10n-backupbuddy'), 'tip' => __('[Default: Unchecked] When checked language localization support will be disabled. BackupBuddy will revert to full English language mode. Use this to display logs in English for support.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Check to run BackupBuddy in English. This is useful for support.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'limit_single_cron_per_pass', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Limit to one action per cron pass', 'it-l10n-backupbuddy'), 'tip' => __('[Default: Checked] When checked only one BackupBuddy cron action may run per PHP page load. Subsequent actions will be rescheduled for the next page load. This only impacts BackupBuddy cron actions.', 'it-l10n-backupbuddy'), 'css' => '', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'use_internal_cron', 'options' => array('unchecked' => 0, 'checked' => 1), 'title' => __('Force internal cron', 'it-l10n-backupbuddy'), 'tip' => __('[Default: disabled] - When enabled BackupBuddy will attempt to bypass the WordPress cron in favor of its own internal cron system. This is a partial workaround only. Example use case: A web host\'s caching is blocking the wp-cron from functioning.', 'it-l10n-backupbuddy'), 'css' => '', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'remote_send_timeout_retries', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Retry timed out remote sends', 'it-l10n-backupbuddy'), 'tip' => __('[Default: Checked] When checked BackupBuddy will attempt ONCE at resending a timed out remote destination send.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Check to re-attempt timed out sends once.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'set_greedy_execution_time', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Attempt to override PHP max execution time', 'it-l10n-backupbuddy'), 'tip' => __('[Default: Unchecked] When checked BackupBuddy will attempt to override the default PHP maximum execution time to 7200 seconds. Note that almost all shared hosting providers block this attempt.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Check to force execution time override attempt (most hosts block this).', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'archive_limit_size_big', 'title' => __('Maximum local storage usage', 'it-l10n-backupbuddy'), 'tip' => __('[Example: 50000] - Maximum size (in MB) to allow BackupBuddy to use. This is a safeguard limit which should be set HIGHER than any other local archive size limits.', 'it-l10n-backupbuddy'), 'rules' => 'required|int|int', 'css' => 'width: 75px;', 'after' => ' MB. <span class="description">0 for no limit.</span>'));
$settings_form->add_setting(array('type' => 'title', 'name' => 'title_logging', 'title' => __('Logging', 'it-l10n-backupbuddy')));
$log_file = backupbuddy_core::getLogDirectory() . 'log-' . pb_backupbuddy::$options['log_serial'] . '.txt';
$settings_form->add_setting(array('type' => 'select', 'name' => 'log_level', 'title' => '<b>' . __('Logging Level', 'it-l10n-backupbuddy') . '</b>', 'options' => array('0' => __('None', 'it-l10n-backupbuddy'), '1' => __('Errors Only (default)', 'it-l10n-backupbuddy'), '2' => __('Errors & Warnings', 'it-l10n-backupbuddy'), '3' => __('Everything (troubleshooting mode)', 'it-l10n-backupbuddy')), 'tip' => sprintf(__('[Default: Errors Only] - This option controls how much activity is logged for records or troubleshooting. Logs may be viewed from the Logs / Other tab on the Settings page. Additionally when in Everything / Troubleshooting mode error emails will contain encrypted troubleshooting data for support. Log file: %s', 'it-l10n-backupbuddy'), $log_file), 'rules' => 'required'));
示例7: configure
public static function configure($destination_settings, $mode, $destination_id = '')
{
//$destination_id = $destination_settings['id'];
pb_backupbuddy::status('details', 'Configuring destination.');
if (false === ($destination = self::_init_destination($destination_settings))) {
$error = '{Error #546893498ac. Cannot load destination. This may be due to your PHP version being too old to support this destination (most likely) or its init file is missing.}';
echo $error;
pb_backupbuddy::status('error', $error);
return false;
}
$destination_settings = $destination['settings'];
// Settings with defaults applied, normalized, etc.
//$destination_info = $destination['info'];
$settings_form = new pb_backupbuddy_settings('settings', $destination_settings, pb_backupbuddy::ajax_url('destination_picker') . '&destination_id=' . $destination_id . '&sending=' . pb_backupbuddy::_GET('sending'));
$settings_form->add_setting(array('type' => 'hidden', 'name' => 'type', 'value' => $destination_settings['type']));
$config_file = pb_backupbuddy::plugin_path() . '/destinations/' . $destination_settings['type'] . '/_configure.php';
pb_backupbuddy::status('details', 'Loading destination configure file `' . $config_file . '`.');
if (file_exists($config_file)) {
require $config_file;
} else {
$error = '{Error #54556543. Missing destination config file `' . $config_file . '`.}';
echo $error;
pb_backupbuddy::status('error', $error);
return false;
}
return $settings_form;
}
示例8: die
<?php
if (!is_admin()) {
die('Access Denied.');
}
$settings_form = new pb_backupbuddy_settings('advanced_settings', '', 'tab=1', 320);
$settings_form->add_setting(array('type' => 'title', 'name' => 'title_basic', 'title' => __('Basic Operation', 'it-l10n-backupbuddy')));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'backup_reminders', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Enable backup reminders for edits', 'it-l10n-backupbuddy'), 'tip' => __('[Default: enabled] - When enabled links will be displayed upon post or page edits and during WordPress upgrades to remind and allow rapid backing up after modifications or before upgrading.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'archive_name_format', 'options' => array('unchecked' => 'date', 'checked' => 'datetime'), 'title' => __('Add time in backup file name', 'it-l10n-backupbuddy'), 'tip' => __('[Default: disabled (date only)] - When enabled your backup filename will display the time the backup was created in addition to the default date. This is useful when making multiple backups in a one day period.', 'it-l10n-backupbuddy'), 'css' => '', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'lock_archives_directory', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Lock archive directory (high security)', 'it-l10n-backupbuddy'), 'tip' => __('[Default: disabled] - When enabled all downloads of archives via the web will be prevented under all circumstances via .htaccess file. If your server permits it, they will only be unlocked temporarily on click to download. If your server does not support this unlocking then you will have to access the archives via the server (such as by FTP).', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('May prevent downloading backups within WordPress on incompatible servers', 'it-l10n-backupbuddy'), 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'include_importbuddy', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Include ImportBuddy in full backup archive', 'it-l10n-backupbuddy'), 'tip' => __('[Default: enabled] - When enabled, the importbuddy.php (restoration tool) file will be included within the backup archive ZIP file in the location `/' . str_replace(ABSPATH, '', backupbuddy_core::getTempDirectory()) . ' xxxxxxxxxx/ importbuddy.php` where the x\'s match the unique random string in the backup ZIP filename.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => ' <span style="white-space: nowrap;"><span class="description">' . __('Located in backup', 'it-l10n-backupbuddy') . ':</span> <span class="code" style="white-space: normal; background: #EAEAEA;"">/' . str_replace(ABSPATH, '', backupbuddy_core::getTempDirectory()) . 'xxxxxxxxxx/importbuddy.php</span>', 'rules' => 'required'));
$log_file = backupbuddy_core::getLogDirectory() . 'log-' . pb_backupbuddy::$options['log_serial'] . '.txt';
$settings_form->add_setting(array('type' => 'select', 'name' => 'log_level', 'title' => __('Logging Level', 'it-l10n-backupbuddy'), 'options' => array('0' => __('None', 'it-l10n-backupbuddy'), '1' => __('Errors Only', 'it-l10n-backupbuddy'), '2' => __('Errors & Warnings', 'it-l10n-backupbuddy'), '3' => __('Everything (troubleshooting mode)', 'it-l10n-backupbuddy')), 'tip' => sprintf(__('[Default: Errors Only] - This option controls how much activity is logged for records or troubleshooting. Logs may be viewed from the Logs / Other tab on the Settings page. Additionally when in Everything / Troubleshooting mode error emails will contain encrypted troubleshooting data for support. Log file: %s', 'it-l10n-backupbuddy'), $log_file), 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'select', 'name' => 'default_backup_tab', 'title' => __('Default backup tab', 'it-l10n-backupbuddy'), 'options' => array('0' => __('Overview', 'it-l10n-backupbuddy'), '1' => __('Status Log', 'it-l10n-backupbuddy')), 'tip' => sprintf(__('[Default: Overview] - The default tab open during a backup is the overview tab. A more technical view is available in the Status tab.', 'it-l10n-backupbuddy')), 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'max_site_log_size', 'title' => __('Maximum log file size', 'it-l10n-backupbuddy'), 'tip' => __('[Default: 10 MB] - If the log file exceeds this size then it will be cleared to prevent it from using too much space.'), 'rules' => 'required|int', 'css' => 'width: 50px;', 'after' => ' MB'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'disable_localization', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Disable language localization', 'it-l10n-backupbuddy'), 'tip' => __('[Default: Unchecked] When checked language localization support will be disabled. BackupBuddy will revert to full English language mode. Use this to display logs in English for support.', 'it-l10n-backupbuddy') . '</span>', 'css' => '', 'after' => '<span class="description"> ' . __('Check to run BackupBuddy in English. This is useful for support.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'title', 'name' => 'title_advanced', 'title' => __('Technical & Server Compatibility', 'it-l10n-backupbuddy')));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'delete_archives_pre_backup', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Delete all backup archives prior to backups', 'it-l10n-backupbuddy'), 'tip' => __('[Default: disabled] - When enabled all local backup archives will be deleted prior to each backup. This is useful if in compatibilty mode to prevent backing up existing files.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Use is exclusions are malfunctioning or for special purposes.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'disable_https_local_ssl_verify', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Disable local SSL certificate verification', 'it-l10n-backupbuddy'), 'tip' => __('[Default: Disabled] When checked, WordPress will skip local https SSL verification.', 'it-l10n-backupbuddy') . '</span>', 'css' => '', 'after' => '<span class="description"> ' . __('Workaround if local SSL verification fails (ie. for loopback & local CA cert issues).', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'prevent_flush', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Prevent Flushing', 'it-l10n-backupbuddy'), 'tip' => __('[Default: not prevented (unchecked)] - Rarely some servers die unexpectedly when flush() or ob_flush() are called multiple times during the same PHP process. Checking this prevents these from ever being called during backups.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Check if directed by support.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'save_comment_meta', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Save meta data in comment', 'it-l10n-backupbuddy'), 'tip' => __('[Default: Enabled] When enabled, BackupBuddy will store general backup information in the ZIP comment header such as Site URL, backup type & time, serial, etc. during backup creation.', 'it-l10n-backupbuddy') . '</span>', 'css' => '', 'after' => '<span class="description"> ' . __('If backups hang when saving meta data disabling skips this process.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'profiles#0#integrity_check', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Perform integrity check on backup files', 'it-l10n-backupbuddy'), 'tip' => __('[Default: enabled] - By default each backup file is checked for integrity and completion the first time it is viewed on the Backup page. On some server configurations this may cause memory problems as the integrity checking process is intensive. If you are experiencing out of memory errors on the Backup file listing, you can uncheck this to disable this feature.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Disable if the backup page will not load or backups hang on integrity check.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'backup_cron_rescheduling', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Reschedule missing crons in manual backups', 'it-l10n-backupbuddy'), 'tip' => __('[Default: disabled] - To proceed to subsequent steps during backups BackupBuddy schedules the next step with the WordPress cron system. If this cron goes missing the backup cannot proceed. This feature instructs BackupBuddy to attempt to re-schedule this cron as it occurs.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Check if directed by support.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'select', 'name' => 'backup_mode', 'title' => __('Default global backup mode', 'it-l10n-backupbuddy'), 'options' => array('1' => __('Classic (v1.x) - Entire backup in single PHP page load', 'it-l10n-backupbuddy'), '2' => __('Modern (v2.x+) - Split across page loads via WP cron', 'it-l10n-backupbuddy')), 'tip' => __('[Default: Modern] - If you are encountering difficulty backing up due to WordPress cron, HTTP Loopbacks, or other features specific to version 2.x you can try classic mode which runs like BackupBuddy v1.x did.', 'it-l10n-backupbuddy'), 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'title', 'name' => 'title_database', 'title' => __('Database', 'it-l10n-backupbuddy')));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'profiles#0#skip_database_dump', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Skip database dump on backup', 'it-l10n-backupbuddy'), 'tip' => __('[Default: disabled] - (WARNING: This prevents BackupBuddy from backing up the database during any kind of backup. This is for troubleshooting / advanced usage only to work around being unable to backup the database.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Completely bypass backing up database for all database types. Use caution.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required', 'orientation' => 'vertical'));
$settings_form->add_setting(array('type' => 'select', 'name' => 'database_method_strategy', 'title' => __('Database method strategy', 'it-l10n-backupbuddy'), 'options' => array('php' => __('PHP-based: Supports automated chunked resuming - default', 'it-l10n-backupbuddy'), 'commandline' => __('Commandline: Fast but does not support resuming', 'it-l10n-backupbuddy'), 'all' => __('All Available: ( PHP [chunking] > Commandline via exec() )', 'it-l10n-backupbuddy')), 'tip' => __('[Default: PHP-based] - Normally use PHP-based which supports chunking (as of BackupBuddy v5) to support larger databases. Commandline-based database dumps use mysqldump which is very fast and efficient but cannot be broken up into smaller steps if it is too large which could result in timeouts on larger servers.', 'it-l10n-backupbuddy'), 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'breakout_tables', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Break out big table dumps into steps', 'it-l10n-backupbuddy'), 'tip' => __('[Default: enabled] When enabled, BackupBuddy will dump some of the commonly larger tables in separate steps. Note this only applies to command-line based dumps as PHP-based dumps automatically support chunking with resume on table and/or row as needed.', 'it-l10n-backupbuddy') . '</span>', 'css' => '', 'after' => '<span class="description"> ' . __('Commandline method: Break up dumping of big tables (chunking)', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'phpmysqldump_maxrows', 'title' => __('Compatibility mode max rows per select', 'it-l10n-backupbuddy'), 'tip' => __('[Default: *blank*] - When BackupBuddy is using compatibility mdoe mysql dumping (via PHP), BackupBuddy selects data from the database. Reducing this number has BackupBuddy grab smaller portions from the database at a time. Leave blank to use built in default (around 2000 rows per select).', 'it-l10n-backupbuddy'), 'css' => 'width: 50px;', 'after' => ' rows. <span class="description"> ' . __('Blank for default.', 'it-l10n-backupbuddy') . ' (~1000 rows/select)</span>', 'rules' => 'int'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'max_execution_time', 'title' => __('Maximum time per chunk', 'it-l10n-backupbuddy'), 'tip' => __('[Default: *blank*] - The maximum amount of time BackupBuddy should allow a database import chunk to run. BackupBuddy by default limits each chunk to your Maximum PHP runtime when using the default PHP-based method. If your database dump step is timing out then lowering this value will instruct the script to limit each `chunk` to allow it to finish within this time period. Raising this value above your servers limits will not increase or override server settings.', 'it-l10n-backupbuddy'), 'css' => 'width: 50px;', 'after' => ' sec. <span class="description"> ' . __('Blank for detected default.', 'it-l10n-backupbuddy') . ' (' . backupbuddy_core::detectMaxExecutionTime() . ' sec)</span>', 'rules' => 'int'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'ignore_command_length_check', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Ignore command line length check results', 'it-l10n-backupbuddy'), 'tip' => __('[Default: disabled] - WARNING: BackupBuddy attempts to determine your system\'s maximum command line length to insure that database operation commands do not get inadvertantly cut off. On some systems it is not possible to reliably detect this information which could result infalling back into compatibility mode even though the system is capable of running in normal operational modes. This option instructs BackupBuddy to ignore the results of the command line length check.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Check if directed by support.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
示例9:
line-height: 1.6em;
}
body > div {
margin: 0 !important;
padding: 0 !important;
}
tr {
margin: 0 !important;
padding: 0 !important;
}
</style>
<?php
$settings_form = new pb_backupbuddy_settings('profile_settings', '', 'action=pb_backupbuddy_backup_profile_settings&profile=' . $profile, 320);
$settings_form->add_setting(array('type' => 'title', 'name' => 'title_database', 'title' => __('Database', 'it-l10n-backupbuddy')));
require_once pb_backupbuddy::plugin_path() . '/views/settings/_database.php';
if ('full' == pb_backupbuddy::$options['profiles'][$profile]['type']) {
$settings_form->add_setting(array('type' => 'title', 'name' => 'title_files', 'title' => __('Files & Directories', 'it-l10n-backupbuddy')));
require_once pb_backupbuddy::plugin_path() . '/views/settings/_files.php';
}
require_once pb_backupbuddy::plugin_path() . '/views/settings/_profiles-advanced.php';
// If global tables then set table includes & excludes to -1.
$field = 'pb_backupbuddy_profiles#' . $profile . '#profile_globaltables';
if (isset($_POST[$field]) && $_POST[$field] == '1') {
$_POST['pb_backupbuddy_profiles#' . $profile . '#mysqldump_additional_includes'] = '-1';
$_POST['pb_backupbuddy_profiles#' . $profile . '#mysqldump_additional_excludes'] = '-1';
}
// If global excludes then set excludes to -1.
$field = 'pb_backupbuddy_profiles#' . $profile . '#profile_globalexcludes';
if (isset($_POST[$field]) && $_POST[$field] == '1') {
示例10: path
} else {
?>
<script type="text/javascript">
jQuery( '#pb_backupbuddy_ib_sent' ).html( 'ImportBuddy file send failure. Verify your destination settings & check logs for details.' );
</script>
<?php
}
}
wp_enqueue_script('thickbox');
wp_print_scripts('thickbox');
wp_print_styles('thickbox');
pb_backupbuddy::$ui->title(__('Restore / Migrate', 'it-l10n-backupbuddy'));
/********* Begin Migrate Settings Form *********/
$migrate_form = new pb_backupbuddy_settings('migrate', false, '', 200);
// form_name, savepoint, action_destination, title_width
$migrate_form->add_setting(array('type' => 'text', 'name' => 'web_address', 'title' => __('Website address', 'it-l10n-backupbuddy'), 'tip' => __('Website address that corresponds to the FTP path.ß', 'it-l10n-backupbuddy'), 'rules' => 'required|string[1-500]', 'default' => 'http://', 'css' => 'width: 200px;', 'after' => ' <span class="description">(ftp path must correspond to this address)</span>'));
$migrate_form->add_setting(array('type' => 'text', 'name' => 'ftp_server', 'title' => __('FTP server address', 'it-l10n-backupbuddy'), 'tip' => __('FTP server address. This must correspond to the website address URL, including path, to the destination site.', 'it-l10n-backupbuddy'), 'rules' => 'required|string[1-500]', 'css' => 'width: 200px;'));
$migrate_form->add_setting(array('type' => 'text', 'name' => 'ftp_username', 'title' => __('FTP username', 'it-l10n-backupbuddy'), 'rules' => 'required|string[1-500]', 'css' => 'width: 200px;'));
$migrate_form->add_setting(array('type' => 'text', 'name' => 'ftp_password', 'title' => __('FTP password', 'it-l10n-backupbuddy'), 'rules' => 'required|string[1-500]', 'css' => 'width: 200px;'));
$migrate_form->add_setting(array('type' => 'text', 'name' => 'ftp_path', 'title' => __('FTP remote path (optional)', 'it-l10n-backupbuddy'), 'tip' => __('This is the remote path / directory for the server. You may use an FTP client to connect to your FTP to determine the exact path.', 'it-l10n-backupbuddy'), 'rules' => 'required|string[1-500]', 'after' => ' <span class="description">(must correspond to website address)</span>', 'css' => 'width: 200px;'));
$migrate_form->add_setting(array('type' => 'checkbox', 'name' => 'ftps', 'title' => __('Use FTPs encryption', 'it-l10n-backupbuddy'), 'options' => array('unchecked' => '0', 'checked' => '1'), 'rules' => 'required'));
$result = $migrate_form->process();
// Handles processing the submitted form (if applicable).
echo '<pre>' . print_r($result, true) . '</pre>';
if (count($result['errors']) > 0) {
// Form errors.
} else {
// No errors.
}
$view_data['migrate_form'] =& $migrate_form;
// For use in view.
示例11: die
<?php
if (!is_admin()) {
die('Access Denied.');
}
echo '<br>';
$settings_form = new pb_backupbuddy_settings('advanced_settings', '', 'tab=2', 320);
$settings_form->add_setting(array('type' => 'title', 'name' => 'title_basic', 'title' => __('Basic Operation', 'it-l10n-backupbuddy')));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'lock_archives_directory', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Lock archive directory (high security)', 'it-l10n-backupbuddy'), 'tip' => __('[Default: disabled] - When enabled all downloads of archives via the web will be prevented under all circumstances via .htaccess file. If your server permits it, they will only be unlocked temporarily on click to download. If your server does not support this unlocking then you will have to access the archives via the server (such as by FTP).', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Check for enhanced security to block backup downloading.', 'it-l10n-backupbuddy') . ' This may<br> result in an inability to download backups while enabled on some servers.</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'delete_archives_pre_backup', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Delete all backup archives prior to backups', 'it-l10n-backupbuddy'), 'tip' => __('[Default: disabled] - When enabled all local backup archives will be deleted prior to each backup. This is useful if in compatibilty mode to prevent backing up existing files.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Check if using compatibilty mode & exclusions are unavailable.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'include_importbuddy', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Include ImportBuddy in full backup archive', 'it-l10n-backupbuddy'), 'tip' => __('[Default: enabled] - When enabled, the importbuddy.php file will be included within the backup archive ZIP file. This file can be used to restore your site. Inclusion in the ZIP file itself insures you always have access to it. importbuddy.php is only included in full backups and only when this option is enabled.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Uncheck to skip adding ImportBuddy to backup archive.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'disable_https_local_ssl_verify', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Disable local SSL certificate verification', 'it-l10n-backupbuddy'), 'tip' => __('[Default: Disabled] When checked, WordPress will skip local https SSL verification.', 'it-l10n-backupbuddy') . '</span>', 'css' => '', 'after' => '<span class="description"> Check if local SSL verification fails (ie. for loopbacks).</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'save_comment_meta', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Save meta data in comment', 'it-l10n-backupbuddy'), 'tip' => __('[Default: Enabled] When enabled, BackupBuddy will store general backup information in the ZIP comment header such as Site URL, backup type & time, serial, etc. during backup creation.', 'it-l10n-backupbuddy') . '</span>', 'css' => '', 'after' => '<span class="description"> Uncheck to skip storing meta data in zip comment.</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'profiles#0#integrity_check', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Perform integrity check on backup files', 'it-l10n-backupbuddy'), 'tip' => __('[Default: enabled] - By default each backup file is checked for integrity and completion the first time it is viewed on the Backup page. On some server configurations this may cause memory problems as the integrity checking process is intensive. If you are experiencing out of memory errors on the Backup file listing, you can uncheck this to disable this feature.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Uncheck if having problems viewing your backup listing.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'select', 'name' => 'backup_mode', 'title' => __('Manual backup mode', 'it-l10n-backupbuddy'), 'options' => array('1' => __('Classic (v1.x)', 'it-l10n-backupbuddy'), '2' => __('Modern (v2.x)', 'it-l10n-backupbuddy')), 'tip' => __('[Default: Modern] - If you are encountering difficulty backing up due to WordPress cron, HTTP Loopbacks, or other features specific to version 2.x you can try classic mode which runs like BackupBuddy v1.x did.', 'it-l10n-backupbuddy'), 'rules' => 'required'));
$log_file = WP_CONTENT_DIR . '/uploads/pb_' . pb_backupbuddy::settings('slug') . '/log-' . pb_backupbuddy::$options['log_serial'] . '.txt';
$settings_form->add_setting(array('type' => 'select', 'name' => 'log_level', 'title' => __('Logging / Debug level', 'it-l10n-backupbuddy'), 'options' => array('0' => __('None', 'it-l10n-backupbuddy'), '1' => __('Errors Only', 'it-l10n-backupbuddy'), '2' => __('Errors & Warnings', 'it-l10n-backupbuddy'), '3' => __('Everything (debug mode)', 'it-l10n-backupbuddy')), 'tip' => sprintf(__('[Default: Errors Only] - This option controls how much activity is logged for records or debugging. When in debug mode error emails will contain encrypted debugging data for support. Log file: %s', 'it-l10n-backupbuddy'), $log_file), 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'max_site_log_size', 'title' => __('Maximum log file size', 'it-l10n-backupbuddy'), 'tip' => __('[Default: 10 MB] - If the log file exceeds this size then it will be cleared to prevent it from using too much space.'), 'rules' => 'required', 'css' => 'width: 50px;', 'after' => ' MB'));
$settings_form->add_setting(array('type' => 'title', 'name' => 'title_database', 'title' => __('Database', 'it-l10n-backupbuddy')));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'profiles#0#skip_database_dump', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Skip database dump on backup', 'it-l10n-backupbuddy'), 'tip' => __('[Default: disabled] - (WARNING: This prevents BackupBuddy from backing up the database during any kind of backup. This is for troubleshooting / advanced usage only to work around being unable to backup the database.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Check if to completely bypass backing up database. Use with caution.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'breakout_tables', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Break out big table dumps into steps', 'it-l10n-backupbuddy'), 'tip' => __('[Default: Disabled] Currently in beta. Breaks up some commonly known database tables to be backed up separately rather than all at once. Helps with larger databases.', 'it-l10n-backupbuddy') . '</span>', 'css' => '', 'after' => '<span class="description"> Check to backup large tables in separate steps to help handle large databases.</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'force_mysqldump_compatibility', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Force compatibility mode database dump', 'it-l10n-backupbuddy'), 'tip' => __('[Default: disabled] - WARNING: This forces the potentially slower mode of database dumping. Under normal circumstances mysql dump compatibility mode is automatically entered as needed without user intervention.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Check to force PHP-based database dump instead of command line. Pre-v3.x mode.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'ignore_command_length_check', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Ignore command line length check results', 'it-l10n-backupbuddy'), 'tip' => __('[Default: disabled] - WARNING: BackupBuddy attempts to determine your system\'s maximum command line length to insure that database operation commands do not get inadvertantly cut off. On some systems it is not possible to reliably detect this information which could result infalling back into compatibility mode even though the system is capable of running in normal operational modes. This option instructs BackupBuddy to ignore the results of the command line length check.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Check if directed by support.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'title', 'name' => 'title_zip', 'title' => __('Zip', 'it-l10n-backupbuddy')));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'compression', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Enable zip compression', 'it-l10n-backupbuddy'), 'tip' => __('[Default: enabled] - ZIP compression decreases file sizes of stored backups. If you are encountering timeouts due to the script running too long, disabling compression may allow the process to complete faster.', 'it-l10n-backupbuddy'), 'css' => '', 'after' => '<span class="description"> ' . __('Uncheck for large sites causing backups to not complete.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'select', 'name' => 'zip_method_strategy', 'title' => __('Zip method strategy', 'it-l10n-backupbuddy'), 'options' => array('1' => __('Best Available', 'it-l10n-backupbuddy'), '2' => __('All Available', 'it-l10n-backupbuddy'), '3' => __('Force Compatibility', 'it-l10n-backupbuddy')), 'tip' => __('[Default: Best Only] - Normally use Best Available but if the server is unreliable in this mode can try All Available or Force Compatibility', 'it-l10n-backupbuddy'), 'after' => '<span class="description"> ' . __('Select Force Compatibility if absolutely necessary.', 'it-l10n-backupbuddy') . '</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'alternative_zip_2', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Alternative zip system (BETA)', 'it-l10n-backupbuddy'), 'tip' => __('[Default: Disabled] Use if directed by support.', 'it-l10n-backupbuddy') . '</span>', 'css' => '', 'after' => '<span class="description"> Check if directed by support.</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'disable_zipmethod_caching', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Disable zip method caching', 'it-l10n-backupbuddy'), 'tip' => __('[Default: Disabled] Use if directed by support. Bypasses caching available zip methods so they are always displayed in logs. When unchecked BackupBuddy will cache command line zip testing for a few minutes so it does not run too often. This means that your backup status log may not always show the test results unless you disable caching.', 'it-l10n-backupbuddy') . '</span>', 'css' => '', 'after' => '<span class="description"> Check if directed by support to always log zip detection.</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'ignore_zip_warnings', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Ignore zip archive warnings', 'it-l10n-backupbuddy'), 'tip' => __('[Default: Disabled] When enabled BackupBuddy will ignore non-fatal warnings encountered during the backup process such as inability to read or access a file, symlink problems, etc. These non-fatal warnings will still be logged.', 'it-l10n-backupbuddy') . '</span>', 'css' => '', 'after' => '<span class="description"> Check to ignore non-fatal errors when zipping files.</span>', 'rules' => 'required'));
$settings_form->add_setting(array('type' => 'checkbox', 'name' => 'ignore_zip_symlinks', 'options' => array('unchecked' => '0', 'checked' => '1'), 'title' => __('Ignore/do-not-follow symbolic links', 'it-l10n-backupbuddy'), 'tip' => __('[Default: Enabled] When enabled BackupBuddy will ignore/not-follow symbolic links encountered during the backup process', 'it-l10n-backupbuddy') . '</span>', 'css' => '', 'after' => '<span class="description"> Check to ignore/not-follow symbolic links when zipping files.</span>', 'rules' => 'required'));
$settings_form->process();
示例12: htmlentities
?>
<div id="pluginbuddy-tabs">
<ul>
<li><a href="#pluginbuddy-tabs-server"><span>Server</span></a></li>
<li><a href="#pluginbuddy-tabs-upload"><span>Upload</span></a></li>
<li><a href="#pluginbuddy-tabs-stash"><span>Stash</span></a></li>
</ul>
<div id="pluginbuddy-tabs-stash">
<div class="tabs-item">
<?php
//print_r( $_POST );
$credentials_form = new pb_backupbuddy_settings('pre_settings', false, 'step=1&upload=stash#pluginbuddy-tabs-stash');
// name, savepoint|false, additional querystring
$credentials_form->add_setting(array('type' => 'hidden', 'name' => 'password', 'default' => htmlentities(pb_backupbuddy::_POST('password'))));
$credentials_form->add_setting(array('type' => 'hidden', 'name' => 'options', 'default' => htmlspecialchars(serialize(pb_backupbuddy::$options))));
$credentials_form->add_setting(array('type' => 'text', 'name' => 'itxapi_username', 'title' => __('iThemes username', 'it-l10n-backupbuddy'), 'tip' => __('[Example: kerfuffle] - Your iThemes.com / PluginBuddy membership username.', 'it-l10n-backupbuddy'), 'rules' => 'required|string[1-45]'));
$credentials_form->add_setting(array('type' => 'password', 'name' => 'itxapi_password_raw', 'title' => __('iThemes password', 'it-l10n-backupbuddy'), 'tip' => __('[Example: 48dsds!s08K%x2s] - Your iThemes.com / PluginBuddy membership password.', 'it-l10n-backupbuddy'), 'rules' => 'required|string[1-45]'));
$settings_result = $credentials_form->process();
$login_welcome = __('Log in with your iThemes.com member account to begin.', 'it-l10n-backupbuddy');
if (count($settings_result) == 0) {
// No form submitted.
echo $login_welcome;
$credentials_form->display_settings('Submit');
} else {
// Form submitted.
if (count($settings_result['errors']) > 0) {
// Form errors.
echo $login_welcome;
pb_backupbuddy::alert(implode('<br>', $settings_result['errors']));
示例13: htmlspecialchars
<?php
$ITXAPI_KEY = 'ixho7dk0p244n0ob';
$ITXAPI_URL = 'http://api.ithemes.com';
$credentials_form = new pb_backupbuddy_settings('pre_settings', false, 'step=1&upload=stash#pluginbuddy-tabs-stash');
// name, savepoint|false, additional querystring
$credentials_form->add_setting(array('type' => 'hidden', 'name' => 'pass_hash', 'default' => PB_PASSWORD));
$credentials_form->add_setting(array('type' => 'hidden', 'name' => 'options', 'default' => htmlspecialchars(serialize(pb_backupbuddy::$options))));
$credentials_form->add_setting(array('type' => 'text', 'name' => 'itxapi_username', 'title' => __('iThemes username', 'it-l10n-backupbuddy'), 'rules' => 'required|string[1-45]'));
$credentials_form->add_setting(array('type' => 'password', 'name' => 'itxapi_password_raw', 'title' => __('iThemes password', 'it-l10n-backupbuddy'), 'rules' => 'required|string[1-45]'));
$settings_result = $credentials_form->process();
$login_welcome = __('Connect to Stash with your iThemes.com member account to select a backup to restore.', 'it-l10n-backupbuddy') . '<br><br>';
if (count($settings_result) == 0) {
// No form submitted.
echo $login_welcome;
$credentials_form->display_settings('Connect to Stash');
} else {
// Form submitted.
if (count($settings_result['errors']) > 0) {
// Form errors.
echo $login_welcome;
pb_backupbuddy::alert(implode('<br>', $settings_result['errors']));
$credentials_form->display_settings('Connect to Stash');
} else {
// No form errors; process!
$itx_helper_file = dirname(dirname(__FILE__)) . '/classes/class.itx_helper.php';
require_once $itx_helper_file;
$itxapi_username = $settings_result['data']['itxapi_username'];
$itxapi_password = ITXAPI_Helper::get_password_hash($itxapi_username, $settings_result['data']['itxapi_password_raw']);
// Generates hash for use as password for API.
$requestcore_file = dirname(dirname(__FILE__)) . '/lib/requestcore/requestcore.class.php';
示例14: elseif
}
</style>
<?php
$settings_form = new pb_backupbuddy_settings('profile_settings', '', 'action=pb_backupbuddy_backupbuddy&function=profile_settings&profile=' . $profile, 320);
if (pb_backupbuddy::$options['profiles'][$profile]['type'] == 'db') {
$prettyType = __('Database Only', 'it-l10n-backupbuddy');
} elseif (pb_backupbuddy::$options['profiles'][$profile]['type'] == 'full') {
$prettyType = __('Full', 'it-l10n-backupbuddy');
} elseif (pb_backupbuddy::$options['profiles'][$profile]['type'] == 'files') {
$prettyType = __('Files Only', 'it-l10n-backupbuddy');
} else {
$prettyType = 'unknown(' . htmlentities(pb_backupbuddy::$options['profiles'][$profile]['type']) . ')';
}
$settings_form->add_setting(array('type' => 'title', 'name' => 'title_type', 'title' => $prettyType . ' Profile'));
$settings_form->add_setting(array('type' => 'text', 'name' => 'profiles#' . $profile . '#title', 'title' => __('Profile Name', 'it-l10n-backupbuddy'), 'tip' => __('Enter a descriptive profile name for this profile for your use.', 'it-l10n-backupbuddy'), 'rules' => 'required|string[0-75]'));
// Database Settings
if ('files' != pb_backupbuddy::$options['profiles'][$profile]['type']) {
$settings_form->add_setting(array('type' => 'title', 'name' => 'title_database', 'title' => __('Database', 'it-l10n-backupbuddy')));
require_once pb_backupbuddy::plugin_path() . '/views/settings/_database.php';
}
// Full / Files Settings
if ('full' == pb_backupbuddy::$options['profiles'][$profile]['type'] || 'files' == pb_backupbuddy::$options['profiles'][$profile]['type']) {
$settings_form->add_setting(array('type' => 'title', 'name' => 'title_files', 'title' => __('Files & Directories', 'it-l10n-backupbuddy')));
require_once pb_backupbuddy::plugin_path() . '/views/settings/_files.php';
}
require_once pb_backupbuddy::plugin_path() . '/views/settings/_profiles-advanced.php';
// If global tables then set table includes & excludes to -1.
$field = 'pb_backupbuddy_profiles#' . $profile . '#profile_globaltables';
if (isset($_POST[$field]) && $_POST[$field] == '1') {
示例15: array
$credentials_form = new pb_backupbuddy_settings('pre_settings', false, 'upload=stash#pluginbuddy-tabs-stash');
// name, savepoint|false, additional querystring
/*
$credentials_form->add_setting( array(
'type' => 'hidden',
'name' => 'pass_hash',
'default' => PB_PASSWORD,
) );
$credentials_form->add_setting( array(
'type' => 'hidden',
'name' => 'options',
'default' => htmlspecialchars( serialize( pb_backupbuddy::$options ) ),
) );
*/
$credentials_form->add_setting(array('type' => 'text', 'name' => 'itxapi_username', 'title' => __('iThemes username', 'it-l10n-backupbuddy'), 'rules' => 'required|string[1-45]'));
$credentials_form->add_setting(array('type' => 'password', 'name' => 'itxapi_password_raw', 'title' => __('iThemes password', 'it-l10n-backupbuddy'), 'rules' => 'required|string[1-45]'));
$settings_result = $credentials_form->process();
$login_welcome = __('Connect to Stash with your iThemes.com member account to select a backup to restore.', 'it-l10n-backupbuddy') . '<br><br>';
if (count($settings_result) == 0) {
// No form submitted.
echo $login_welcome;
$credentials_form->display_settings('Connect to Stash');
} else {
// Form submitted.
if (count($settings_result['errors']) > 0) {
// Form errors.
echo $login_welcome;
pb_backupbuddy::alert(implode('<br>', $settings_result['errors']));
$credentials_form->display_settings('Connect to Stash');
} else {