当前位置: 首页>>代码示例>>PHP>>正文


PHP WC_Admin_Settings::get_settings_pages方法代码示例

本文整理汇总了PHP中WC_Admin_Settings::get_settings_pages方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Admin_Settings::get_settings_pages方法的具体用法?PHP WC_Admin_Settings::get_settings_pages怎么用?PHP WC_Admin_Settings::get_settings_pages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WC_Admin_Settings的用法示例。


在下文中一共展示了WC_Admin_Settings::get_settings_pages方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create_options

 /**
  * Default options.
  *
  * Sets up the default options used on the settings page.
  */
 private static function create_options()
 {
     // Include settings so that we can run through defaults
     include_once dirname(__FILE__) . '/admin/class-wc-admin-settings.php';
     $settings = WC_Admin_Settings::get_settings_pages();
     foreach ($settings as $section) {
         if (!method_exists($section, 'get_settings')) {
             continue;
         }
         $subsections = array_unique(array_merge(array(''), array_keys($section->get_sections())));
         foreach ($subsections as $subsection) {
             foreach ($section->get_settings($subsection) as $value) {
                 if (isset($value['default']) && isset($value['id'])) {
                     $autoload = isset($value['autoload']) ? (bool) $value['autoload'] : true;
                     add_option($value['id'], $value['default'], '', $autoload ? 'yes' : 'no');
                 }
             }
         }
     }
 }
开发者ID:woocommerce,项目名称:woocommerce,代码行数:25,代码来源:class-wc-install.php

示例2: create_options

 /**
  * Default options
  *
  * Sets up the default options used on the settings page
  *
  * @access public
  */
 function create_options()
 {
     // Include settings so that we can run through defaults
     include_once 'admin/class-wc-admin-settings.php';
     $settings = WC_Admin_Settings::get_settings_pages();
     foreach ($settings as $section) {
         if (!method_exists($section, 'get_settings')) {
             continue;
         }
         foreach ($section->get_settings() as $value) {
             if (isset($value['default']) && isset($value['id'])) {
                 $autoload = isset($value['autoload']) ? (bool) $value['autoload'] : true;
                 add_option($value['id'], $value['default'], '', $autoload ? 'yes' : 'no');
             }
         }
         // Special case to install the inventory settings.
         if ($section instanceof WC_Settings_Products) {
             foreach ($section->get_settings('inventory') as $value) {
                 if (isset($value['default']) && isset($value['id'])) {
                     $autoload = isset($value['autoload']) ? (bool) $value['autoload'] : true;
                     add_option($value['id'], $value['default'], '', $autoload ? 'yes' : 'no');
                 }
             }
         }
     }
 }
开发者ID:anagio,项目名称:woocommerce,代码行数:33,代码来源:class-wc-install.php

示例3: register_wp_admin_settings

 /**
  * Register WC settings from WP-API to the REST API.
  * @since  2.7.0
  */
 public function register_wp_admin_settings()
 {
     $pages = WC_Admin_Settings::get_settings_pages();
     foreach ($pages as $page) {
         new WC_Register_WP_Admin_Settings($page, 'page');
     }
     $emails = WC_Emails::instance();
     foreach ($emails->get_emails() as $email) {
         new WC_Register_WP_Admin_Settings($email, 'email');
     }
 }
开发者ID:tlovett1,项目名称:woocommerce,代码行数:15,代码来源:class-wc-api.php

示例4: get_woocommerce_settings_fields

 public function get_woocommerce_settings_fields()
 {
     if (!defined('WC_VERSION') || !class_exists('WC_Admin_Settings')) {
         return false;
     }
     if (!empty($this->settings)) {
         return $this->settings;
     }
     $settings_cache_key = 'stream_connector_woocommerce_settings_' . sanitize_key(WC_VERSION);
     if ($settings_transient = get_transient($settings_cache_key)) {
         $settings = $settings_transient['settings'];
         $settings_pages = $settings_transient['settings_pages'];
     } else {
         global $woocommerce;
         $settings = array();
         $settings_pages = array();
         foreach (\WC_Admin_Settings::get_settings_pages() as $page) {
             // Get ID / Label of the page, since they're protected, by hacking into
             // the callback filter for 'woocommerce_settings_tabs_array'
             $info = $page->add_settings_page(array());
             $page_id = key($info);
             $page_label = current($info);
             $sections = $page->get_sections();
             if (empty($sections)) {
                 $sections[''] = $page_label;
             }
             $settings_pages[$page_id] = $page_label;
             // Remove non-fields ( sections, titles and whatever )
             $fields = array();
             foreach ($sections as $section_key => $section_label) {
                 $_fields = array_filter($page->get_settings($section_key), function ($item) {
                     return isset($item['id']) && !in_array($item['type'], array('title', 'sectionend'));
                 });
                 foreach ($_fields as $field) {
                     $title = isset($field['title']) ? $field['title'] : (isset($field['desc']) ? $field['desc'] : 'N/A');
                     $fields[$field['id']] = array('title' => $title, 'page' => 'wc-settings', 'tab' => $page_id, 'section' => $section_key, 'type' => esc_html__('setting', 'stream'));
                 }
             }
             // Store fields in the global array to be searched later
             $settings = array_merge($settings, $fields);
         }
         // Provide additional context for each of the settings pages
         array_walk($settings_pages, function (&$value) {
             $value .= ' ' . esc_html__('Settings', 'stream');
         });
         // Load Payment Gateway Settings
         $payment_gateway_settings = array();
         $payment_gateways = $woocommerce->payment_gateways();
         foreach ($payment_gateways->payment_gateways as $section_key => $payment_gateway) {
             $title = $payment_gateway->title;
             $key = $payment_gateway->plugin_id . $payment_gateway->id . '_settings';
             $payment_gateway_settings[$key] = array('title' => $title, 'page' => 'wc-settings', 'tab' => 'checkout', 'section' => strtolower($section_key), 'type' => esc_html__('payment gateway', 'stream'));
         }
         $settings = array_merge($settings, $payment_gateway_settings);
         // Load Shipping Method Settings
         $shipping_method_settings = array();
         $shipping_methods = $woocommerce->shipping();
         foreach ($shipping_methods->shipping_methods as $section_key => $shipping_method) {
             $title = $shipping_method->title;
             $key = $shipping_method->plugin_id . $shipping_method->id . '_settings';
             $shipping_method_settings[$key] = array('title' => $title, 'page' => 'wc-settings', 'tab' => 'shipping', 'section' => strtolower($section_key), 'type' => esc_html__('shipping method', 'stream'));
         }
         $settings = array_merge($settings, $shipping_method_settings);
         // Load Email Settings
         $email_settings = array();
         $emails = $woocommerce->mailer();
         foreach ($emails->emails as $section_key => $email) {
             $title = $email->title;
             $key = $email->plugin_id . $email->id . '_settings';
             $email_settings[$key] = array('title' => $title, 'page' => 'wc-settings', 'tab' => 'email', 'section' => strtolower($section_key), 'type' => esc_html__('email', 'stream'));
         }
         $settings = array_merge($settings, $email_settings);
         // Tools page
         $tools_page = array('tools' => esc_html__('Tools', 'stream'));
         $settings_pages = array_merge($settings_pages, $tools_page);
         // Cache the results
         $settings_cache = array('settings' => $settings, 'settings_pages' => $settings_pages);
         set_transient($settings_cache_key, $settings_cache, MINUTE_IN_SECONDS * 60 * 6);
     }
     $custom_settings = $this->get_custom_settings();
     $this->settings = array_merge($settings, $custom_settings);
     $this->settings_pages = $settings_pages;
     return $this->settings;
 }
开发者ID:evgenykireev,项目名称:stream,代码行数:84,代码来源:class-connector-woocommerce.php

示例5: print_panel

 /**
  * Print custom tab of settings for Stripe subpanel
  *
  * @return void
  * @since 1.0.0
  */
 public function print_panel()
 {
     $panel_template = YITH_WCSTRIPE_DIR . '/templates/admin/settings-tab.php';
     if (!file_exists($panel_template)) {
         return;
     }
     global $current_section;
     $current_section = 'yith_wcstripe_gateway';
     if (defined('YITH_WCSTRIPE_PREMIUM')) {
         $current_section .= YITH_WCStripe_Premium::addons_installed() ? '_addons' : '_advanced';
     }
     WC_Admin_Settings::get_settings_pages();
     if (!empty($_POST)) {
         $gateways = WC()->payment_gateways()->payment_gateways();
         $gateways[YITH_WCStripe::$gateway_id]->process_admin_options();
     }
     include_once $panel_template;
 }
开发者ID:VitaliyProdan,项目名称:wp_shop,代码行数:24,代码来源:class-yith-stripe-admin.php

示例6: print_credit_card_panel

 /**
  * Print custom tab of settings for Authorize.net subpanel
  *
  * @return void
  * @since 1.0.0
  */
 public function print_credit_card_panel()
 {
     if (file_exists(YITH_WCAUTHNET_DIR . '/templates/admin/settings-tab.php')) {
         global $current_section;
         $current_section = 'yith_wcauthnet_credit_card_gateway';
         WC_Admin_Settings::get_settings_pages();
         if (!empty($_POST)) {
             YITH_WCAUTHNET_Credit_Card_Gateway()->process_admin_options();
         }
         include_once YITH_WCAUTHNET_DIR . '/templates/admin/settings-tab.php';
     }
 }
开发者ID:yarwalker,项目名称:ecobyt,代码行数:18,代码来源:class.yith-wcauthnet-admin.php

示例7: register_wp_admin_settings

 /**
  * Register WC settings from WP-API to the REST API.
  * @since  2.7.0
  */
 public function register_wp_admin_settings()
 {
     $pages = WC_Admin_Settings::get_settings_pages();
     foreach ($pages as $page) {
         new WC_Register_WP_Admin_Settings($page);
     }
 }
开发者ID:jimlove7273,项目名称:woocommerce,代码行数:11,代码来源:class-wc-api.php

示例8: print_woocommerce_settings_tabs

    /**
     * Print WooCommerce settings tabs on order status manager screens
     *
     * Simulates a simplified version of WC_Admin_Settings::output and
     * `html-admin-settings.php` from WC core
     *
     * @since 1.0.0
     */
    public function print_woocommerce_settings_tabs()
    {
        if (!$this->is_order_status_manager_screen()) {
            return;
        }
        WC_Admin_Settings::get_settings_pages();
        // Get tabs for the settings page
        $tabs = apply_filters('woocommerce_settings_tabs_array', array());
        ?>
			<div class="wrap woocommerce">
				<div class="icon32 icon32-woocommerce-settings" id="icon-woocommerce"><br /></div><h2 class="nav-tab-wrapper woo-nav-tab-wrapper">
					<?php 
        foreach ($tabs as $name => $label) {
            echo '<a href="' . admin_url('admin.php?page=wc-settings&tab=' . $name) . '" class="nav-tab">' . $label . '</a>';
        }
        do_action('woocommerce_settings_tabs');
        ?>
				</h2>
			</div>
		<?php 
    }
开发者ID:seoduda,项目名称:Patua,代码行数:29,代码来源:class-wc-order-status-manager-admin.php


注:本文中的WC_Admin_Settings::get_settings_pages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。