/** * Setup admin class * * @since 1.0 */ public function __construct() { $this->id = 'social_login'; $this->label = __('Social Login', 'woocommerce-social-login'); parent::__construct(); add_action('woocommerce_admin_field_social_login_providers', array($this, 'social_login_providers_setting')); }
/** * Add various admin hooks/filters * * @since 2.0.0 */ public function __construct() { $this->id = 'customizer'; $this->label = __('Customizer', 'woocommerce-customizer'); parent::__construct(); $this->customizations = get_option('wc_customizer_active_customizations', array()); }
/** * Add this page to settings. */ public function add_settings_page($pages) { if (wc_tax_enabled()) { return parent::add_settings_page($pages); } else { return $pages; } }
/** * @since 2.7.0 * @covers WC_Register_WP_Admin_Settings::register_settings */ public function test_register_settings() { $this->page->expects($this->any())->method('get_sections')->will($this->returnValue(array())); $settings = array(array('id' => 'setting-1', 'type' => 'text', 'option_key' => ''), array('type' => 'no-id', 'option_key' => ''), array('id' => 'setting-2', 'type' => 'textarea', 'option_key' => '')); $this->page->expects($this->any())->method('get_settings')->will($this->returnValue($settings)); $settings = new WC_Register_WP_Admin_Settings($this->page, 'page'); $expected = array(array('id' => 'setting-1', 'type' => 'text', 'label' => '', 'description' => '', 'option_key' => 'setting-1'), array('id' => 'setting-2', 'type' => 'textarea', 'label' => '', 'description' => '', 'option_key' => 'setting-2')); $actual = $settings->register_page_settings(array()); $this->assertEquals($expected, $actual); }
public function __construct() { $this->id = 'wskl-dabory-sms'; $this->label = __('다보리 SMS', 'wskl'); // add_filter( 'woocommerce_settings_tabs_array', array( $this, 'add_settings_page' ), 20 ); // add_action( 'woocommerce_settings_' . $this->id, array( $this, 'output' ) ); // add_action( 'woocommerce_settings_save_' . $this->id, array( $this, 'save' ) ); // add_action( 'woocommerce_sections_' . $this->id, array( $this, 'output_sections' ) ); // this line replaces above four add_* function calls parent::__construct(); // admin_field_{$type} actions // 메시지 공급자 추가 출력 add_action('woocommerce_admin_field_sms_provider_additional', array(__CLASS__, 'provider_additional'), 10, 0); // woocommerce_admin_field_sms_provider_additional 콜백에서, 재차 수행될 커스텀 action add_action('dabory_sms_provider_additional', array('WSKL_Dabory_SMS_Provider_Loading', 'output_provider_additional')); // 메시지 테스트 출력 add_action('woocommerce_admin_field_message_tester', array(__CLASS__, 'message_tester'), 10, 0); // 치환 문자열 정보 add_action('woocommerce_admin_field_magic_text_information', array(__CLASS__, 'output_substitution_information'), 10, 0); }
/** * Add this page to settings. */ public function add_settings_page($pages) { return wc_shipping_enabled() ? parent::add_settings_page($pages) : $pages; }
/** * Save settings, overridden to maybe create the webhook on save * * @since 3.2.0 * @see WC_Settings_Page::save() */ public function save() { parent::save(); $this->maybe_create_webhook(); }
/** * Constructor. */ public function __construct() { $this->label = __('Tax', 'woocommerce'); parent::__construct(); }
/** * Output the settings */ public function output() { global $current_section; if ($current_section) { $base_country = wc_get_base_location(); $not_available_countries = array(); $regions = get_option('wc_price_based_country_regions', array()); foreach ($regions as $key => $value) { foreach ($value['countries'] as $code) { if ($current_section !== $key) { $not_available_countries[] = $code; } } } if ($current_section == 'new_group') { $this->section_settings($not_available_countries); } else { if (isset($regions[$current_section])) { $this->section_settings($not_available_countries, $regions[$current_section]); } } } else { parent::output(); } }
/** * Output the settings */ public function output() { global $current_section; if ($current_section) { $country_groups = get_option('_oga_tfls_countries_groups'); $not_available_countries = array(); if ($country_groups) { foreach ($country_groups as $key => $value) { foreach ($value['countries'] as $code) { if ($current_section !== $key) { $not_available_countries[] = $code; } } } } if ($current_section == 'new_group') { $this->section_settings($not_available_countries); } else { if (isset($country_groups[$current_section])) { $this->section_settings($not_available_countries, $country_groups[$current_section]); } } } else { parent::output(); } wp_enqueue_script('wc-tfls-admin', plugin_dir_url(TFLS_FILE) . 'assets/js/tfls-admin.js', array('woocommerce_settings'), WC_VERSION, true); }