當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WC_Payment_Gateways::init方法代碼示例

本文整理匯總了PHP中WC_Payment_Gateways::init方法的典型用法代碼示例。如果您正苦於以下問題:PHP WC_Payment_Gateways::init方法的具體用法?PHP WC_Payment_Gateways::init怎麽用?PHP WC_Payment_Gateways::init使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WC_Payment_Gateways的用法示例。


在下文中一共展示了WC_Payment_Gateways::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_Payment_Gateways::init方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。