本文整理汇总了PHP中WC_Admin_Settings::save_fields方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Admin_Settings::save_fields方法的具体用法?PHP WC_Admin_Settings::save_fields怎么用?PHP WC_Admin_Settings::save_fields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WC_Admin_Settings
的用法示例。
在下文中一共展示了WC_Admin_Settings::save_fields方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_options
/**
* Save settings.
*
* Save settings based on WooCommerce save_fields() method.
*
* @since 1.0.0
*/
public function update_options()
{
global $current_section;
if ($current_section == 'shipping_validation') {
WC_Admin_Settings::save_fields($this->get_settings());
}
}
开发者ID:JeroenSormani,项目名称:advanced-shipping-validation-for-woocommerce,代码行数:14,代码来源:class-wcasv-admin-settings.php
示例2: save
/**
* Save settings.
*
* @since 1.0.0
*/
public function save() {
global $current_section;
$settings = $this->get_settings( $current_section );
WC_Admin_Settings::save_fields( $settings );
}
示例3: save
/**
* Save settings
*/
public function save()
{
global $current_section;
$settings = $this->get_settings();
WC_Admin_Settings::save_fields($settings);
if ($current_section) {
do_action('woocommerce_update_options_' . $this->id . '_' . $current_section);
}
}
示例4: save_settings
public function save_settings()
{
WC_Admin_Settings::save_fields($this->settings);
$is_api_working = $this->check_api() ? 1 : 0;
update_option(WC_SiftScience_Options::$is_api_setup, $is_api_working);
if ($is_api_working === 1) {
WC_Admin_Settings::add_message('API is correctly configured');
} else {
WC_Admin_Settings::add_error('API settings are broken');
}
}
示例5: save
/**
* Save settings
*/
public function save()
{
global $current_section, $wpdb;
if (!$current_section) {
$settings = $this->get_settings();
WC_Admin_Settings::save_fields($settings);
} elseif (!empty($_POST['tax_rate_country'])) {
$this->save_tax_rates();
}
$wpdb->query("DELETE FROM `{$wpdb->options}` WHERE `option_name` LIKE ('_transient_wc_tax_rates_%') OR `option_name` LIKE ('_transient_timeout_wc_tax_rates_%')");
}
示例6: save
/**
* Save settings.
*/
public function save()
{
global $current_section, $wpdb;
if (!$current_section) {
$settings = $this->get_settings();
WC_Admin_Settings::save_fields($settings);
} elseif (!empty($_POST['tax_rate_country'])) {
$this->save_tax_rates();
}
WC_Cache_Helper::incr_cache_prefix('taxes');
}
示例7: save
/**
* Save settings
*/
public function save()
{
global $current_section;
if ($current_section == '') {
$settings = $this->rf_genaral_setting();
} elseif ($current_section == 'email_template') {
$settings = $this->rf_email_template_setting();
} else {
$settings = $this->rf_social_share_setting();
}
WC_Admin_Settings::save_fields($settings);
}
示例8: save
/**
* Save settings
*/
public function save()
{
global $current_section;
$settings = $this->get_settings();
WC_Admin_Settings::save_fields($settings);
if ($current_section == 'lists') {
// Each list that has been ticked will be saved.
if (isset($_POST['checkout_lists'])) {
$checkout_lists = $_POST['checkout_lists'];
update_option('mailpoet_woocommerce_subscribe_too', $checkout_lists);
} else {
delete_option('mailpoet_woocommerce_subscribe_too');
}
}
}
示例9: save
/**
* Save settings.
*/
public function save()
{
global $current_section;
if (!$current_section) {
WC_Admin_Settings::save_fields($this->get_settings());
} else {
$wc_emails = WC_Emails::instance();
if (in_array($current_section, array_map('sanitize_title', array_keys($wc_emails->get_emails())))) {
foreach ($wc_emails->get_emails() as $email_id => $email) {
if ($current_section === sanitize_title($email_id)) {
do_action('woocommerce_update_options_' . $this->id . '_' . $email->id);
}
}
} else {
do_action('woocommerce_update_options_' . $this->id . '_' . $current_section);
}
}
}
示例10: save
/**
* Save settings.
*/
public function save()
{
$settings = $this->get_settings();
WC_Admin_Settings::save_fields($settings);
}
示例11: save
/**
* Save settings
*/
public function save()
{
$settings = $this->get_settings();
WC_Admin_Settings::save_fields($settings);
if (isset($_POST['qsot_frontend_css_form_bg'])) {
// Save settings
$colors = array();
foreach (array('form_bg', 'form_border', 'form_action_bg', 'form_helper') as $k) {
$colors[$k] = !empty($_POST['qsot_frontend_css_' . $k]) ? wc_format_hex($_POST['qsot_frontend_css_' . $k]) : '';
}
foreach (array('good_msg', 'bad_msg', 'remove') as $K) {
foreach (array('_bg', '_border', '_text') as $k) {
$colors[$K . $k] = !empty($_POST['qsot_frontend_css_' . $K . $k]) ? wc_format_hex($_POST['qsot_frontend_css_' . $K . $k]) : '';
}
}
foreach (array('past_calendar_item', 'calendar_item') as $K) {
foreach (array('_bg', '_border', '_text', '_text_hover') as $k) {
$colors[$K . $k] = !empty($_POST['qsot_frontend_css_' . $K . $k]) ? wc_format_hex($_POST['qsot_frontend_css_' . $K . $k]) : '';
}
}
// Check the colors.
$valid_colors = true;
foreach ($colors as $color) {
if (!preg_match('/^#[a-f0-9]{6}$/i', $color)) {
$valid_colors = false;
WC_Admin_Settings::add_error(sprintf(__('Error saving the Frontend Styles, %s is not a valid color, please use only valid colors code.', 'opentickets-community-edition'), $color));
break;
}
}
if ($valid_colors) {
$old_colors = get_option('woocommerce_frontend_css_colors');
$options = qsot_options::instance();
$options->{'qsot-event-frontend-colors'} = $colors;
if ($old_colors != $colors) {
QSOT::compile_frontend_styles();
}
}
}
}
示例12: woocommerce_update_options
/**
* Update all settings which are passed.
*
* @access public
* @param array $options
* @return void
*/
function woocommerce_update_options($options)
{
if (!class_exists('WC_Admin_Settings')) {
include 'class-wc-admin-settings.php';
}
WC_Admin_Settings::save_fields($options);
}
示例13: update_settings
/**
* Update this plugin's WC Settings
*
* Hooks into WC's settings api
* which allows for building, saving, and retrieval of options
*
* @since 3.0.0
*/
function update_settings()
{
\WC_Admin_Settings::save_fields(get_settings());
}
示例14: save
/**
* Save settings.
*/
public function save()
{
global $current_section;
switch ($current_section) {
case 'options':
WC_Admin_Settings::save_fields($this->get_settings());
break;
case 'classes':
case '':
break;
default:
$wc_shipping = WC_Shipping::instance();
foreach ($wc_shipping->get_shipping_methods() as $method_id => $method) {
if (in_array($current_section, array($method->id, sanitize_title(get_class($method))))) {
do_action('woocommerce_update_options_' . $this->id . '_' . $method->id);
}
}
break;
}
// Increments the transient version to invalidate cache
WC_Cache_Helper::get_transient_version('shipping', true);
}
示例15: woocommerce_update_options
/**
* Update all settings which are passed.
*
* @param array $options
* @param array $data
*/
function woocommerce_update_options($options, $data = null)
{
if (!class_exists('WC_Admin_Settings')) {
include dirname(__FILE__) . '/class-wc-admin-settings.php';
}
WC_Admin_Settings::save_fields($options, $data);
}