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


PHP WC_Shipping::init方法代码示例

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


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

示例1: init

 /**
  * Init WooCommerce when WordPress Initialises.
  *
  * @access public
  * @return void
  */
 function init()
 {
     // Set up localisation
     $this->load_plugin_textdomain();
     // Variables
     $this->template_url = apply_filters('woocommerce_template_url', 'woocommerce/');
     // Load class instances
     $this->payment_gateways = new WC_Payment_gateways();
     // Payment gateways. Loads and stores payment methods
     $this->shipping = new WC_Shipping();
     // Shipping class. loads and stores shipping methods
     $this->countries = new WC_Countries();
     // Countries class
     $this->integrations = new WC_Integrations();
     // Integrations class
     // Init shipping, payment gateways, and integrations
     $this->shipping->init();
     $this->payment_gateways->init();
     $this->integrations->init();
     // Classes/actions loaded for the frontend and for ajax requests
     if (!is_admin() || defined('DOING_AJAX')) {
         // Class instances
         $this->cart = new WC_Cart();
         // Cart class, stores the cart contents
         $this->customer = new WC_Customer();
         // Customer class, sorts out session data such as location
         $this->query = new WC_Query();
         // Query class, handles front-end queries and loops
         // Load messages
         $this->load_messages();
         // Hooks
         add_filter('template_include', array(&$this, 'template_loader'));
         add_filter('comments_template', array(&$this, 'comments_template_loader'));
         add_filter('wp_redirect', array(&$this, 'redirect'), 1, 2);
         add_action('template_redirect', array(&$this, 'buffer_checkout'));
         add_action('wp_enqueue_scripts', array(&$this, 'frontend_scripts'));
         add_action('wp_print_scripts', array(&$this, 'check_jquery'), 25);
         add_action('wp_head', array(&$this, 'generator'));
         add_action('wp_head', array(&$this, 'wp_head'));
         add_filter('body_class', array(&$this, 'output_body_class'));
         add_action('wp_footer', array(&$this, 'output_inline_js'), 25);
     }
     // Actions
     add_action('the_post', array(&$this, 'setup_product_data'));
     add_action('admin_footer', array(&$this, 'output_inline_js'), 25);
     // Email Actions
     $email_actions = array('woocommerce_low_stock', 'woocommerce_no_stock', 'woocommerce_product_on_backorder', 'woocommerce_order_status_pending_to_processing', 'woocommerce_order_status_pending_to_completed', 'woocommerce_order_status_pending_to_on-hold', 'woocommerce_order_status_failed_to_processing', 'woocommerce_order_status_failed_to_completed', 'woocommerce_order_status_pending_to_processing', 'woocommerce_order_status_pending_to_on-hold', 'woocommerce_order_status_completed', 'woocommerce_new_customer_note');
     foreach ($email_actions as $action) {
         add_action($action, array(&$this, 'send_transactional_email'));
     }
     // Actions for SSL
     if (!is_admin() || defined('DOING_AJAX')) {
         add_action('template_redirect', array(&$this, 'ssl_redirect'));
         $filters = array('post_thumbnail_html', 'widget_text', 'wp_get_attachment_url', 'wp_get_attachment_image_attributes', 'wp_get_attachment_url', 'option_siteurl', 'option_homeurl', 'option_home', 'option_url', 'option_wpurl', 'option_stylesheet_url', 'option_template_url', 'script_loader_src', 'style_loader_src', 'template_directory_uri', 'stylesheet_directory_uri', 'site_url');
         foreach ($filters as $filter) {
             add_filter($filter, array(&$this, 'force_ssl'));
         }
     }
     // Register globals for WC environment
     $this->register_globals();
     // Init user roles
     $this->init_user_roles();
     // Init WooCommerce taxonomies
     $this->init_taxonomy();
     // Init Images sizes
     $this->init_image_sizes();
     // Init styles
     if (!is_admin()) {
         $this->init_styles();
     }
     // Trigger API requests
     $this->api_requests();
     // Init action
     do_action('woocommerce_init');
 }
开发者ID:TyRichards,项目名称:river_of_life,代码行数:81,代码来源:woocommerce.php


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