本文整理汇总了PHP中UpdraftPlus_Options::mass_options_update方法的典型用法代码示例。如果您正苦于以下问题:PHP UpdraftPlus_Options::mass_options_update方法的具体用法?PHP UpdraftPlus_Options::mass_options_update怎么用?PHP UpdraftPlus_Options::mass_options_update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UpdraftPlus_Options
的用法示例。
在下文中一共展示了UpdraftPlus_Options::mass_options_update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_settings
public function save_settings($settings)
{
global $updraftplus;
// Make sure that settings filters are registered
UpdraftPlus_Options::admin_init();
$return_array = array('saved' => true, 'changed' => array());
$add_to_post_keys = array('updraft_interval', 'updraft_interval_database', 'updraft_starttime_files', 'updraft_starttime_db', 'updraft_startday_files', 'updraft_startday_db');
//If database and files are on same schedule, override the db day/time settings
if (isset($settings['updraft_interval_database']) && isset($settings['updraft_interval_database']) && $settings['updraft_interval_database'] == $settings['updraft_interval'] && isset($settings['updraft_starttime_files'])) {
$settings['updraft_starttime_db'] = $settings['updraft_starttime_files'];
$settings['updraft_startday_db'] = $settings['updraft_startday_files'];
}
foreach ($add_to_post_keys as $key) {
// For add-ons that look at $_POST to find saved settings, add the relevant keys to $_POST so that they find them there
if (isset($settings[$key])) {
$_POST[$key] = $settings[$key];
}
}
// Wipe the extra retention rules, as they are not saved correctly if the last one is deleted
UpdraftPlus_Options::update_updraft_option('updraft_retain_extrarules', array());
UpdraftPlus_Options::update_updraft_option('updraft_email', array());
UpdraftPlus_Options::update_updraft_option('updraft_report_warningsonly', array());
UpdraftPlus_Options::update_updraft_option('updraft_report_wholebackup', array());
UpdraftPlus_Options::update_updraft_option('updraft_extradbs', array());
UpdraftPlus_Options::update_updraft_option('updraft_include_more_path', array());
$relevant_keys = $updraftplus->get_settings_keys();
if (method_exists('UpdraftPlus_Options', 'mass_options_update')) {
$settings = UpdraftPlus_Options::mass_options_update($settings);
$mass_updated = true;
}
foreach ($settings as $key => $value) {
// $exclude_keys = array('option_page', 'action', '_wpnonce', '_wp_http_referer');
// if (!in_array($key, $exclude_keys)) {
if (in_array($key, $relevant_keys)) {
if ($key == "updraft_service" && is_array($value)) {
foreach ($value as $subkey => $subvalue) {
if ($subvalue == '0') {
unset($value[$subkey]);
}
}
}
$updated = empty($mass_updated) ? UpdraftPlus_Options::update_updraft_option($key, $value) : true;
// Add information on what has changed to array to loop through to update links etc.
if ($updated) {
$return_array['changed'][$key] = $value;
} elseif (empty($mass_updated) && $key == 'updraft_interval') {
//To schedule a database when the interval is not changed.
$updraftplus->schedule_backup($value);
} elseif (empty($mass_updated) && $key == 'updraft_interval_database') {
$updraftplus->schedule_backup_database($value);
}
} else {
// When last active, it was catching: option_page, action, _wpnonce, _wp_http_referer, updraft_s3_endpoint, updraft_dreamobjects_endpoint. The latter two are empty; probably don't need to be in the page at all.
//error_log("Non-UD key when saving from POSTed data: ".$key);
}
}
// Checking for various possible messages
$updraft_dir = $updraftplus->backups_dir_location(false);
$really_is_writable = $updraftplus->really_is_writable($updraft_dir);
$dir_info = $this->really_writable_message($really_is_writable, $updraft_dir);
$button_title = esc_attr(__('This button is disabled because your backup directory is not writable (see the settings).', 'updraftplus'));
$return_array['backup_now_message'] = $this->backup_now_remote_message();
$return_array['backup_dir'] = array('writable' => $really_is_writable, 'message' => $dir_info, 'button_title' => $button_title);
//Because of the single AJAX call, we need to remove the existing UD messages from the 'all_admin_notices' action
remove_all_actions('all_admin_notices');
//Moving from 2 to 1 ajax call
ob_start();
$service = UpdraftPlus_Options::get_updraft_option('updraft_service');
$this->setup_all_admin_notices_global($service);
$this->setup_all_admin_notices_udonly($service);
do_action('all_admin_notices');
if (!$really_is_writable) {
//Check if writable
$this->show_admin_warning_unwritable();
}
if ($return_array['saved'] == true) {
//
$this->show_admin_warning(__('Your settings have been saved.', 'updraftplus'), 'updated fade');
}
$messages_output = ob_get_contents();
ob_clean();
// Backup schedule output
$this->next_scheduled_backups_output();
$scheduled_output = ob_get_clean();
$return_array['messages'] = $messages_output;
$return_array['scheduled'] = $scheduled_output;
return $return_array;
}