本文整理汇总了PHP中woocommerce_update_options函数的典型用法代码示例。如果您正苦于以下问题:PHP woocommerce_update_options函数的具体用法?PHP woocommerce_update_options怎么用?PHP woocommerce_update_options使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了woocommerce_update_options函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* Save the settings
*/
function save()
{
global $current_section;
set_transient('wcdn_flush_rewrite_rules', true);
$settings = $this->get_settings($current_section);
woocommerce_update_options($settings);
}
示例2: update_woo_settings
function update_woo_settings()
{
global $woocommerce_settings, $rtWooGLAdmin;
woocommerce_update_options($woocommerce_settings['rtwoogl']);
$endPoint = trailingslashit(get_option('rtwoogl_api_endpoint', ''));
$token = get_option('rtwoogl_private_token', '');
$response = $rtWooGLAdmin->test_connection($endPoint, $token);
if ($response['result'] == 'error') {
update_site_option('rtwoogl_settings_error', '<div id="rtwoogl_message" class="error fade"><p><strong>' . $response['message'] . '</strong></p></div>');
}
}
示例3: woocommerce_update_options
/**
* Update options
*
* @return void
* @since 1.0
* @author Andrea Grillo <andrea.grillo@yithemes.com>
* @author Antonio La Rocca <antonio.larocca@yithemes.com>
* @see woocommerce_update_options function
* @internal fire two action (before and after update): yit_panel_wc_before_update and yit_panel_wc_after_update
*/
public function woocommerce_update_options()
{
if (isset($_POST['yit_panel_wc_options_nonce']) && wp_verify_nonce($_POST['yit_panel_wc_options_nonce'], 'yit_panel_wc_options_' . $this->settings['page'])) {
do_action('yit_panel_wc_before_update');
$yit_options = $this->get_main_array_options();
$current_tab = $this->get_current_tab();
woocommerce_update_options($yit_options[$current_tab]);
do_action('yit_panel_wc_after_update');
} elseif (isset($_REQUEST['yit-action']) && $_REQUEST['yit-action'] == 'wc-options-reset') {
$yit_options = $this->get_main_array_options();
$current_tab = $this->get_current_tab();
foreach ($yit_options[$current_tab] as $id => $option) {
if (isset($option['default'])) {
update_option($option['id'], $option['default']);
}
}
}
}
示例4: update_options
public static function update_options($options)
{
$rule_id = self::$RULE_ID;
if (!empty($rule_id)) {
$settings = self::get_rule_settings_by_id($rule_id);
woocommerce_update_options($settings);
}
}
示例5: woocommerce_update_options
/**
* Update options
*
* @return void
* @since 1.0
* @author Andrea Grillo <andrea.grillo@yithemes.com>
* @author Antonio La Rocca <antonio.larocca@yithemes.com>
* @see woocommerce_update_options function
* @internal fire two action (before and after update): yit_panel_wc_before_update and yit_panel_wc_after_update
*/
public function woocommerce_update_options()
{
if (isset($_POST['yit_panel_wc_options_nonce']) && wp_verify_nonce($_POST['yit_panel_wc_options_nonce'], 'yit_panel_wc_options_' . $this->settings['page'])) {
do_action('yit_panel_wc_before_update');
$yit_options = $this->get_main_array_options();
$current_tab = $this->get_current_tab();
if (version_compare(WC()->version, '2.4.0', '>=')) {
if (!empty($yit_options[$current_tab])) {
foreach ($yit_options[$current_tab] as $option) {
if (isset($option['id']) && isset($_POST[$option['id']]) && isset($option['type']) && !in_array($option['type'], $this->wc_type)) {
$_POST[$option['id']] = maybe_serialize($_POST[$option['id']]);
}
}
}
}
woocommerce_update_options($yit_options[$current_tab]);
do_action('yit_panel_wc_after_update');
} elseif (isset($_REQUEST['yit-action']) && $_REQUEST['yit-action'] == 'wc-options-reset' && isset($_POST['yith_wc_reset_options_nonce']) && wp_verify_nonce($_POST['yith_wc_reset_options_nonce'], 'yith_wc_reset_options_' . $this->settings['page'])) {
$yit_options = $this->get_main_array_options();
$current_tab = $this->get_current_tab();
foreach ($yit_options[$current_tab] as $id => $option) {
if (isset($option['default'])) {
update_option($option['id'], $option['default']);
}
}
}
}
示例6: prdctfltr_update_settings
public static function prdctfltr_update_settings()
{
if (isset($_POST['pfa_taxonomy'])) {
$adv_filters = array();
for ($i = 0; $i < count($_POST['pfa_taxonomy']); $i++) {
$adv_filters['pfa_title'][$i] = $_POST['pfa_title'][$i];
$adv_filters['pfa_taxonomy'][$i] = $_POST['pfa_taxonomy'][$i];
$adv_filters['pfa_include'][$i] = isset($_POST['pfa_include'][$i]) ? $_POST['pfa_include'][$i] : array();
$adv_filters['pfa_orderby'][$i] = isset($_POST['pfa_orderby'][$i]) ? $_POST['pfa_orderby'][$i] : '';
$adv_filters['pfa_order'][$i] = isset($_POST['pfa_order'][$i]) ? $_POST['pfa_order'][$i] : '';
$adv_filters['pfa_multiselect'][$i] = isset($_POST['pfa_multiselect'][$i]) ? $_POST['pfa_multiselect'][$i] : 'no';
$adv_filters['pfa_relation'][$i] = isset($_POST['pfa_relation'][$i]) ? $_POST['pfa_relation'][$i] : 'IN';
$adv_filters['pfa_adoptive'][$i] = isset($_POST['pfa_adoptive'][$i]) ? $_POST['pfa_adoptive'][$i] : 'no';
$adv_filters['pfa_none'][$i] = isset($_POST['pfa_none'][$i]) ? $_POST['pfa_none'][$i] : 'no';
$adv_filters['pfa_limit'][$i] = isset($_POST['pfa_limit'][$i]) ? $_POST['pfa_limit'][$i] : '';
$adv_filters['pfa_hierarchy'][$i] = isset($_POST['pfa_hierarchy'][$i]) ? $_POST['pfa_hierarchy'][$i] : 'no';
$adv_filters['pfa_hierarchy_mode'][$i] = isset($_POST['pfa_hierarchy_mode'][$i]) ? $_POST['pfa_hierarchy_mode'][$i] : 'no';
$adv_filters['pfa_mode'][$i] = isset($_POST['pfa_mode'][$i]) ? $_POST['pfa_mode'][$i] : 'showall';
$adv_filters['pfa_style'][$i] = isset($_POST['pfa_style'][$i]) ? $_POST['pfa_style'][$i] : 'pf_attr_text';
$adv_filters['pfa_term_customization'][$i] = isset($_POST['pfa_term_customization'][$i]) ? $_POST['pfa_term_customization'][$i] : '';
}
update_option('wc_settings_prdctfltr_advanced_filters', $adv_filters);
}
if (isset($_POST['pfr_taxonomy'])) {
$rng_filters = array();
for ($i = 0; $i < count($_POST['pfr_taxonomy']); $i++) {
$rng_filters['pfr_title'][$i] = $_POST['pfr_title'][$i];
$rng_filters['pfr_taxonomy'][$i] = $_POST['pfr_taxonomy'][$i];
$rng_filters['pfr_include'][$i] = isset($_POST['pfr_include'][$i]) ? $_POST['pfr_include'][$i] : array();
$rng_filters['pfr_orderby'][$i] = isset($_POST['pfr_orderby'][$i]) ? $_POST['pfr_orderby'][$i] : '';
$rng_filters['pfr_order'][$i] = isset($_POST['pfr_order'][$i]) ? $_POST['pfr_order'][$i] : '';
$rng_filters['pfr_style'][$i] = isset($_POST['pfr_style'][$i]) ? $_POST['pfr_style'][$i] : 'flat';
$rng_filters['pfr_grid'][$i] = isset($_POST['pfr_grid'][$i]) ? $_POST['pfr_grid'][$i] : 'no';
$rng_filters['pfr_custom'][$i] = isset($_POST['pfr_custom'][$i]) ? $_POST['pfr_custom'][$i] : 'no';
}
update_option('wc_settings_prdctfltr_range_filters', $rng_filters);
}
if (isset($_POST['wc_settings_prdctfltr_active_filters'])) {
update_option('wc_settings_prdctfltr_active_filters', $_POST['wc_settings_prdctfltr_active_filters']);
}
woocommerce_update_options(self::prdctfltr_get_settings('update'));
delete_transient('prdctfltr_default');
}
示例7: save
/**
* Save settings
*/
public function save()
{
global $woocommerce, $woocommerce_settings, $current_section;
$settings = $this->get_settings();
include_once MailPoet_WooCommerce_Add_on()->wc_plugin_path() . 'admin/settings/settings-save.php';
$current_section = empty($_REQUEST['section']) ? 'general' : sanitize_text_field(urldecode($_REQUEST['section']));
woocommerce_update_options($settings);
if ($current_section == 'lists') {
// Each list of newsletters that have 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');
}
}
}
示例8: dhwc_product_brand_save_admin_settings
/**
* dhwc_product_brand_save_admin_settings function
*/
function dhwc_product_brand_save_admin_settings()
{
woocommerce_update_options(dhwc_product_brand_get_admin_settings());
}
示例9: save_settings
/**
* Save settings in a single field in the database for each tab's fields (one field per tab).
*/
public function save_settings()
{
global $woocommerce_settings;
// Make sure our settings fields are recognised.
$this->add_settings_fields();
$current_tab = $this->get_tab_in_view(current_filter(), 'woocommerce_update_options_');
woocommerce_update_options($woocommerce_settings[$current_tab]);
}
示例10: update_subscription_settings
/**
* Uses the WooCommerce options API to save settings via the @see woocommerce_update_options() function.
*
* @uses woocommerce_update_options()
* @uses self::get_settings()
* @since 1.0
*/
public static function update_subscription_settings()
{
// Make sure automatic payments are on when manual renewals are switched off
if (!isset($_POST[self::$option_prefix . '_accept_manual_renewals']) && isset($_POST[self::$option_prefix . '_turn_off_automatic_payments'])) {
unset($_POST[self::$option_prefix . '_turn_off_automatic_payments']);
}
woocommerce_update_options(self::get_settings());
}
示例11: update_settings
public static function update_settings()
{
global $current_section;
woocommerce_update_options(self::get_settings($current_section));
}
示例12: wcla_update_options
public function wcla_update_options()
{
woocommerce_update_options(WCLA_Utilities::get_fields());
}
示例13: save_settings
/**
* Save the 'Pre-Orders' settings page
*
* @since 1.0
*/
public function save_settings()
{
woocommerce_update_options($this->get_settings());
}
示例14: update_admin_settings
public static function update_admin_settings()
{
woocommerce_update_options(self::get_admin_form());
}
示例15: save_settings
/**
* save_settings()
*
* Save settings in a single field in the database for each tab's fields (one field per tab).
*/
function save_settings()
{
global $woocommerce_settings;
// Make sure our settings fields are recognised.
$this->add_settings_fields();
$current_tab = $this->get_tab_in_view(current_filter(), 'woocommerce_update_options_');
woocommerce_update_options($woocommerce_settings[$current_tab]);
// This is to prevent html being stripped until the WC settings api supports custom field saving
if (isset($_POST['wc_cvo_s_price_text'])) {
$data = wp_unslash(wp_kses_post($_POST['wc_cvo_s_price_text']));
update_option('wc_cvo_s_price_text', $data);
}
}