本文整理汇总了PHP中WC_Admin_Settings类的典型用法代码示例。如果您正苦于以下问题:PHP WC_Admin_Settings类的具体用法?PHP WC_Admin_Settings怎么用?PHP WC_Admin_Settings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WC_Admin_Settings类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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 );
}
开发者ID:helloworld-digital,项目名称:katemorgan,代码行数:13,代码来源:class-wwp-settings.php
示例2: 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);
}
}
开发者ID:joshquila,项目名称:demo2-youse,代码行数:12,代码来源:class-wc-settings-page.php
示例3: output
/**
* Outputs a custom textarea template in plugin options panel
*
* @since 1.0.0
* @return void
* @author Alberto Ruggiero
*/
public static function output($option)
{
$custom_attributes = array();
if (!empty($option['custom_attributes']) && is_array($option['custom_attributes'])) {
foreach ($option['custom_attributes'] as $attribute => $attribute_value) {
$custom_attributes[] = esc_attr($attribute) . '="' . esc_attr($attribute_value) . '"';
}
}
$option_value = WC_Admin_Settings::get_option($option['id'], $option['default']);
?>
<tr valign="top">
<th scope="row" class="titledesc">
<label for="<?php
echo esc_attr($option['id']);
?>
"><?php
echo esc_html($option['title']);
?>
</label>
</th>
<td class="forminp forminp-<?php
echo sanitize_title($option['type']);
?>
">
<textarea
name="<?php
echo esc_attr($option['id']);
?>
"
id="<?php
echo esc_attr($option['id']);
?>
"
style="<?php
echo esc_attr($option['css']);
?>
"
class="<?php
echo esc_attr($option['class']);
?>
"
<?php
echo implode(' ', $custom_attributes);
?>
><?php
echo esc_textarea($option_value);
?>
</textarea><br /><br />
<span class="description"><?php
echo $option['desc'];
?>
</span>
</td>
</tr>
<?php
}
开发者ID:yarwalker,项目名称:ecobyt,代码行数:64,代码来源:custom-textarea.php
示例4: output
/**
* Output the settings
*/
public function output()
{
global $current_section;
if ($current_section == '') {
$GLOBALS['hide_save_button'] = true;
}
$settings = $this->get_settings($current_section);
WC_Admin_Settings::output_fields($settings);
$this->show_table_products();
}
开发者ID:WP-Panda,项目名称:m.video,代码行数:13,代码来源:class-settings-products.php
示例5: output
/**
* Render the settings for the current section
*
* @since 2.0.0
*/
public function output()
{
$settings = $this->get_settings();
// inject the actual setting value before outputting the fields
// ::output_fields() uses get_option() but customizations are stored
// in a single option so this dynamically returns the correct value
foreach ($this->customizations as $filter => $value) {
add_filter("pre_option_{$filter}", array($this, 'get_customization'));
}
WC_Admin_Settings::output_fields($settings);
}
开发者ID:yarwalker,项目名称:ecobyt,代码行数:16,代码来源:class-wc-customizer-settings.php
示例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();
}
$wpdb->query("DELETE FROM `{$wpdb->options}` WHERE `option_name` LIKE ('_transient_wc_tax_rates_%') OR `option_name` LIKE ('_transient_timeout_wc_tax_rates_%')");
}
开发者ID:ayoayco,项目名称:upbeat,代码行数:14,代码来源:class-wc-settings-tax.php
示例7: 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');
}
开发者ID:estrategasdigitales,项目名称:venone,代码行数:14,代码来源:class-wc-settings-tax.php
示例8: 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');
}
}
开发者ID:Fermiac,项目名称:woocommerce-siftscience,代码行数:11,代码来源:class-wc-siftscience-hooks-admin.php
示例9: 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);
}
开发者ID:javolero,项目名称:dabba,代码行数:15,代码来源:referfriend-settings.php
示例10: save
/**
* Save the Targets settings
*/
public function save()
{
try {
$this->verify_request(WooCommerce_Grow_Helpers::get_field('_wpnonce', $_REQUEST), 'woocommerce-grow-targets');
$is_calculate_growth = null !== WooCommerce_Grow_Helpers::get_field('calculate_growth', $_POST) ? true : false;
// Calculate and Growth settings
if ($is_calculate_growth) {
$initial_revenue_number = WooCommerce_Grow_Helpers::get_field('initial_revenue_number', $_POST);
$initial_orders_number = WooCommerce_Grow_Helpers::get_field('initial_orders_number', $_POST);
$initial_sessions_number = WooCommerce_Grow_Helpers::get_field('initial_sessions_number', $_POST);
$initial_cr_number = WooCommerce_Grow_Helpers::get_field('initial_cr_number', $_POST);
$initial_aov_number = WooCommerce_Grow_Helpers::get_field('initial_aov_number', $_POST);
// Call to GA to get sessions for the last month
$ga = WooCommerce_Grow_Google_Analytics::get_instance();
$month = date('m', strtotime('first day of previous month'));
$year = date('Y');
list($start_date, $end_date) = WooCommerce_Grow_Helpers::get_first_and_last_of_the_month($month, $year);
$initial_sessions = $ga->get_sessions_for_month($month, $year);
$filters = array('date_min' => $start_date, 'date_max' => $end_date);
$reports = WooCommerce_Grow_Helpers::setup_wc_reports($filters);
$initial_revenue = WooCommerce_Grow_Helpers::get_wc_total_sales($reports);
$initial_orders = WooCommerce_Grow_Helpers::get_wc_total_orders($reports);
WooCommerce_Grow_Helpers::add_debug_log('Revenue: ' . $initial_revenue);
WooCommerce_Grow_Helpers::add_debug_log('Orders: ' . $initial_orders);
$initial_cr = WooCommerce_Grow_Helpers::calculate_cr($initial_orders, $initial_sessions);
$initial_aov = WooCommerce_Grow_Helpers::calculate_aov($initial_revenue, $initial_orders);
$growth_rate = WooCommerce_Grow_Helpers::get_field('growth_rate', $_POST);
// Save the initial options
WooCommerce_Grow_Helpers::update_option('initial_revenue_number', $initial_revenue);
WooCommerce_Grow_Helpers::update_option('initial_orders_number', $initial_orders);
WooCommerce_Grow_Helpers::update_option('initial_sessions_number', $initial_sessions);
WooCommerce_Grow_Helpers::update_option('initial_cr_number', $initial_cr);
WooCommerce_Grow_Helpers::update_option('initial_aov_number', $initial_aov);
WooCommerce_Grow_Helpers::update_option('growth_rate', $growth_rate);
$months = WooCommerce_Grow_Helpers::get_twelve_months_ahead();
foreach ($months as $month) {
$target_sessions = WooCommerce_Grow_Helpers::calculate_growth($initial_sessions, $growth_rate);
$target_cr = WooCommerce_Grow_Helpers::calculate_growth($initial_cr, $growth_rate);
$target_aov = WooCommerce_Grow_Helpers::calculate_growth($initial_aov, $growth_rate);
$targets['sessions_percentage'][$month['year']][$month['month']] = ceil($target_sessions);
$targets['cr_percentage'][$month['year']][$month['month']] = $target_cr;
$targets['aov_percentage'][$month['year']][$month['month']] = $target_aov;
$targets['revenue_percentage'][$month['year']][$month['month']] = wc_format_decimal($target_sessions * $target_cr * $target_aov, 2);
$targets['orders_percentage'][$month['year']][$month['month']] = ceil($target_sessions * $target_cr);
}
WooCommerce_Grow_Helpers::update_option('monthly_targets', $targets);
}
} catch (Exception $e) {
WC_Admin_Settings::add_error($e->getMessage());
}
}
开发者ID:raisonon,项目名称:woocommerce-grow,代码行数:54,代码来源:class-woocommerce-grow-page-targets.php
示例11: 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');
}
}
}
开发者ID:alikagitci,项目名称:honda.yedekleri,代码行数:18,代码来源:class-mailpoet-woocommerce-settings.php
示例12: load_options
/**
* Load user options into class
*
* @return void
*/
protected function load_options()
{
$this->enabled = $this->get_option('enabled');
$this->registration_enabled = WC_Admin_Settings::get_option('woocommerce_enable_signup_and_login_from_checkout') === 'yes' ? true : false;
$this->profiles_enabled = $this->registration_enabled && $this->get_option('enable_profiles') === 'yes';
$this->title = $this->get_option('title');
$this->description = $this->get_option('description');
$this->card_types = $this->get_option('card_types');
$this->mode = $this->get_option('mode', 'capture');
$this->sandbox = $this->get_option('sandbox');
$this->site = $this->get_option('site');
$this->env_key = $this->sandbox == 'no' ? 'production' : 'sandbox';
$port = $this->cc_ports[$this->env_key];
$this->api_credentials = array('url' => "https://{$this->site}.{$this->domain}:{$port}{$this->rest_path}", 'mid' => $this->get_option("{$this->env_key}_mid"), 'user' => $this->get_option("{$this->env_key}_user"), 'pass' => $this->get_option("{$this->env_key}_password"));
$this->verification = array('void_cvv' => $this->get_option('void_cvv'), 'void_avs' => $this->get_option('void_avs'));
}
开发者ID:RexAK,项目名称:woocommerce-cardconnect-2,代码行数:21,代码来源:class-wc-gateway-cardconnect.php
示例13: woogle_update_license_key_status
function woogle_update_license_key_status()
{
$result = woogle_activate_license_key();
if ($result == NULL) {
update_option('woogle_license_key_validated', '0');
update_option('woogle_license_key_expires', '0');
WC_Admin_Settings::add_error(__('Your Woogle License Key is invalid!', 'woogle'));
} elseif ($result->license == 'valid' || $result->license == 'expired') {
update_option('woogle_license_key_validated', '1');
update_option('woogle_license_key_expires', $result->expires);
WC_Admin_Settings::add_message(__('Your Woogle License Key is valid!', 'woogle'));
} else {
update_option('woogle_license_key_validated', '0');
update_option('woogle_license_key_expires', '0');
WC_Admin_Settings::add_error(__('Your Woogle License Key is invalid!', 'woogle'));
}
}
开发者ID:bear12345678,项目名称:keylessoption,代码行数:17,代码来源:license.php
示例14: output
/**
* Output the settings
*/
public function output()
{
global $current_section;
// Load shipping methods so we can show any global options they may have
$shipping_methods = WC()->shipping->load_shipping_methods();
if ($current_section) {
foreach ($shipping_methods as $method) {
if (strtolower(get_class($method)) == strtolower($current_section) && $method->has_settings()) {
$method->admin_options();
break;
}
}
} else {
$settings = $this->get_settings();
WC_Admin_Settings::output_fields($settings);
}
}
开发者ID:englsergio,项目名称:allsensations,代码行数:20,代码来源:class-wc-rewards-2.php
示例15: 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);
}
}
}
开发者ID:tlovett1,项目名称:woocommerce,代码行数:21,代码来源:class-wc-settings-emails.php
示例16: save
/**
* Save the settings
*/
public static function save()
{
global $current_section, $current_tab;
if (empty($_REQUEST['_wpnonce']) || !wp_verify_nonce($_REQUEST['_wpnonce'], 'wc-crm-settings')) {
die(__('Action failed. Please refresh the page and retry.', 'woocommerce'));
}
// Trigger actions
do_action('wc_crm_settings_save_' . $current_tab);
do_action('wc_crm_update_options_' . $current_tab);
do_action('wc_crm_update_options');
self::add_message(__('Your settings have been saved.', 'woocommerce'));
WC_Admin_Settings::check_download_folder_protection();
// Re-add endpoints and flush rules
WC()->query->init_query_vars();
WC()->query->add_endpoints();
flush_rewrite_rules();
do_action('wc_crm_settings_saved');
}
开发者ID:sajidshah,项目名称:le-dolci,代码行数:21,代码来源:wc_crm_settings.php
示例17: notices
/**
* Notices.
*/
private function notices()
{
if (isset($_GET['trashed'])) {
$trashed = absint($_GET['trashed']);
WC_Admin_Settings::add_message(sprintf(_n('1 webhook moved to the Trash.', '%d webhooks moved to the Trash.', $trashed, 'woocommerce'), $trashed));
}
if (isset($_GET['untrashed'])) {
$untrashed = absint($_GET['untrashed']);
WC_Admin_Settings::add_message(sprintf(_n('1 webhook restored from the Trash.', '%d webhooks restored from the Trash.', $untrashed, 'woocommerce'), $untrashed));
}
if (isset($_GET['deleted'])) {
$deleted = absint($_GET['deleted']);
WC_Admin_Settings::add_message(sprintf(_n('1 webhook permanently deleted.', '%d webhooks permanently deleted.', $deleted, 'woocommerce'), $deleted));
}
if (isset($_GET['updated'])) {
WC_Admin_Settings::add_message(__('Webhook updated successfully.', 'woocommerce'));
}
if (isset($_GET['created'])) {
WC_Admin_Settings::add_message(__('Webhook created successfully.', 'woocommerce'));
}
}
开发者ID:abesamislyndon,项目名称:femaccms,代码行数:24,代码来源:class-wc-settings-webhooks.php
示例18: check_pdf_template_version
public function check_pdf_template_version($settings)
{
$templates = array('woocommerce_gzdp_invoice_template_attachment', 'woocommerce_gzdp_invoice_template_attachment_first');
foreach ($templates as $template) {
if ($file = get_option($template)) {
$file = get_attached_file($file);
if (!$file) {
continue;
}
try {
$invoice = new WC_GZDP_Invoice_Preview();
$pdf = new WC_GZDP_PDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->set_invoice($invoice);
$pdf->setTemplate($invoice->get_pdf_template());
$pdf->addPage();
} catch (Exception $e) {
delete_option($template);
WC_Admin_Settings::add_error(_x('Your PDF template seems be converted (version > 1.4) or compressed. Please convert (http://convert.neevia.com/pdfconvert/) your pdf file to version 1.4 or lower before uploading.', 'invoices', 'woocommerce-germanized-pro'));
}
}
}
}
开发者ID:radscheit,项目名称:unicorn,代码行数:22,代码来源:class-wc-gzdp-invoice-helper.php
示例19: pages
/**
* Manage activations
*/
public function pages()
{
// Anything you need to do before a page is loaded
do_action('woocommerce_grow_pages_start');
// Get current tab
$current_tab = empty($_GET['tab']) ? 'dashboard' : sanitize_title($_GET['tab']);
$this->add_woocommerce_grow_pages();
// Save settings if data has been posted
if (!empty($_POST)) {
$this->save($current_tab);
}
// Add any posted messages
if (!empty($_GET['wc_grow_error'])) {
WC_Admin_Settings::add_error(stripslashes($_GET['wc_error']));
}
if (!empty($_GET['wc_grow_message'])) {
WC_Admin_Settings::add_message(stripslashes($_GET['wc_message']));
}
WC_Admin_Settings::show_messages();
// Add tabs on the Grow page
$tabs = apply_filters('woocommerce_grow_page_tabs_array', array());
include 'views/html-grow-page.php';
}
开发者ID:raisonon,项目名称:woocommerce-grow,代码行数:26,代码来源:class-woocommerce-grow-menu.php
示例20: save
/**
* Save settings.
*/
public function save()
{
global $current_section;
$wc_payment_gateways = WC_Payment_Gateways::instance();
if (!$current_section) {
WC_Admin_Settings::save_fields($this->get_settings());
$wc_payment_gateways->process_admin_options();
} else {
foreach ($wc_payment_gateways->payment_gateways() as $gateway) {
if (in_array($current_section, array($gateway->id, sanitize_title(get_class($gateway))))) {
do_action('woocommerce_update_options_payment_gateways_' . $gateway->id);
$wc_payment_gateways->init();
}
}
}
}
开发者ID:woocommerce,项目名称:woocommerce,代码行数:19,代码来源:class-wc-settings-checkout.php
注:本文中的WC_Admin_Settings类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论