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


PHP WC_AJAX::get_endpoint方法代码示例

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


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

示例1: frontend_scripts

 /**
  * Front end styles and scripts.
  *
  * @return void
  */
 public static function frontend_scripts()
 {
     wp_register_style('wcsatt-css', WCS_ATT()->plugin_url() . '/assets/css/wcsatt-frontend.css', false, WCS_ATT::VERSION, 'all');
     wp_enqueue_style('wcsatt-css');
     if (is_cart()) {
         wp_register_script('wcsatt-cart', WCS_ATT()->plugin_url() . '/assets/js/wcsatt-cart.js', array('jquery', 'wc-country-select', 'wc-address-i18n'), WCS_ATT::VERSION, true);
     }
     wp_enqueue_script('wcsatt-cart');
     $params = array('update_cart_option_nonce' => wp_create_nonce('wcsatt_update_cart_option'), 'wc_ajax_url' => WCS_ATT_Core_Compatibility::is_wc_version_gte_2_4() ? WC_AJAX::get_endpoint("%%endpoint%%") : WC()->ajax_url());
     wp_localize_script('wcsatt-cart', 'wcsatt_cart_params', $params);
 }
开发者ID:VictorArgote,项目名称:woocommerce-subscribe-to-all-the-things,代码行数:16,代码来源:class-wcsatt-display.php

示例2: get_script_data

 /**
  * Return data for script handles.
  * @access private
  * @param  string $handle
  * @return array|bool
  */
 private static function get_script_data($handle)
 {
     global $wp;
     switch ($handle) {
         case 'woocommerce':
             return array('ajax_url' => WC()->ajax_url(), 'wc_ajax_url' => WC_AJAX::get_endpoint("%%endpoint%%"));
             break;
         case 'wc-geolocation':
             return array('wc_ajax_url' => WC_AJAX::get_endpoint("%%endpoint%%"), 'home_url' => home_url(), 'is_cart' => is_cart() ? '1' : '0', 'is_account_page' => is_account_page() ? '1' : '0', 'is_checkout' => is_checkout() ? '1' : '0', 'hash' => isset($_GET['v']) ? wc_clean($_GET['v']) : '');
             break;
         case 'wc-single-product':
             return array('i18n_required_rating_text' => esc_attr__('Please select a rating', 'woocommerce'), 'review_rating_required' => get_option('woocommerce_review_rating_required'));
             break;
         case 'wc-checkout':
             return array('ajax_url' => WC()->ajax_url(), 'wc_ajax_url' => WC_AJAX::get_endpoint("%%endpoint%%"), 'update_order_review_nonce' => wp_create_nonce('update-order-review'), 'apply_coupon_nonce' => wp_create_nonce('apply-coupon'), 'remove_coupon_nonce' => wp_create_nonce('remove-coupon'), 'option_guest_checkout' => get_option('woocommerce_enable_guest_checkout'), 'checkout_url' => WC_AJAX::get_endpoint("checkout"), 'is_checkout' => is_page(wc_get_page_id('checkout')) && empty($wp->query_vars['order-pay']) && !isset($wp->query_vars['order-received']) ? 1 : 0, 'debug_mode' => defined('WP_DEBUG') && WP_DEBUG, 'i18n_checkout_error' => esc_attr__('Error processing checkout. Please try again.', 'woocommerce'));
             break;
         case 'wc-address-i18n':
             return array('locale' => json_encode(WC()->countries->get_country_locale()), 'locale_fields' => json_encode(WC()->countries->get_country_locale_field_selectors()), 'i18n_required_text' => esc_attr__('required', 'woocommerce'));
             break;
         case 'wc-cart':
             return array('ajax_url' => WC()->ajax_url(), 'wc_ajax_url' => WC_AJAX::get_endpoint("%%endpoint%%"), 'update_shipping_method_nonce' => wp_create_nonce("update-shipping-method"));
             break;
         case 'wc-cart-fragments':
             return array('ajax_url' => WC()->ajax_url(), 'wc_ajax_url' => WC_AJAX::get_endpoint("%%endpoint%%"), 'fragment_name' => apply_filters('woocommerce_cart_fragment_name', 'wc_fragments'));
             break;
         case 'wc-add-to-cart':
             return array('ajax_url' => WC()->ajax_url(), 'wc_ajax_url' => WC_AJAX::get_endpoint("%%endpoint%%"), 'i18n_view_cart' => esc_attr__('View Cart', 'woocommerce'), 'cart_url' => apply_filters('woocommerce_add_to_cart_redirect', WC()->cart->get_cart_url()), 'is_cart' => is_cart(), 'cart_redirect_after_add' => get_option('woocommerce_cart_redirect_after_add'));
             break;
         case 'wc-add-to-cart-variation':
             return array('i18n_no_matching_variations_text' => esc_attr__('Sorry, no products matched your selection. Please choose a different combination.', 'woocommerce'), 'i18n_unavailable_text' => esc_attr__('Sorry, this product is unavailable. Please choose a different combination.', 'woocommerce'));
             break;
         case 'wc-country-select':
             return array('countries' => json_encode(array_merge(WC()->countries->get_allowed_country_states(), WC()->countries->get_shipping_country_states())), 'i18n_select_state_text' => esc_attr__('Select an option…', 'woocommerce'), 'i18n_matches_1' => _x('One result is available, press enter to select it.', 'enhanced select', 'woocommerce'), 'i18n_matches_n' => _x('%qty% results are available, use up and down arrow keys to navigate.', 'enhanced select', 'woocommerce'), 'i18n_no_matches' => _x('No matches found', 'enhanced select', 'woocommerce'), 'i18n_ajax_error' => _x('Loading failed', 'enhanced select', 'woocommerce'), 'i18n_input_too_short_1' => _x('Please enter 1 or more characters', 'enhanced select', 'woocommerce'), 'i18n_input_too_short_n' => _x('Please enter %qty% or more characters', 'enhanced select', 'woocommerce'), 'i18n_input_too_long_1' => _x('Please delete 1 character', 'enhanced select', 'woocommerce'), 'i18n_input_too_long_n' => _x('Please delete %qty% characters', 'enhanced select', 'woocommerce'), 'i18n_selection_too_long_1' => _x('You can only select 1 item', 'enhanced select', 'woocommerce'), 'i18n_selection_too_long_n' => _x('You can only select %qty% items', 'enhanced select', 'woocommerce'), 'i18n_load_more' => _x('Loading more results…', 'enhanced select', 'woocommerce'), 'i18n_searching' => _x('Searching…', 'enhanced select', 'woocommerce'));
             break;
     }
     return false;
 }
开发者ID:mselango,项目名称:driz-project,代码行数:43,代码来源:class-wc-frontend-scripts.php

示例3: enqueue_scripts

 /**
  * Enqueue the scripts and styles in the page
  */
 public function enqueue_scripts()
 {
     // scripts
     $min = !(defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '.min' : '';
     wp_register_script('yith-woocompare-main', YITH_WOOCOMPARE_ASSETS_URL . '/js/woocompare' . $min . '.js', array('jquery'), $this->version, true);
     // enqueue and add localize
     wp_enqueue_script('yith-woocompare-main');
     wp_localize_script('yith-woocompare-main', 'yith_woocompare', array('ajaxurl' => version_compare(WC()->version, '2.4', '>=') ? WC_AJAX::get_endpoint("%%endpoint%%") : admin_url('admin-ajax.php', 'relative'), 'actionadd' => $this->action_add, 'actionremove' => $this->action_remove, 'actionview' => $this->action_view, 'added_label' => apply_filters('yith_woocompare_compare_added_label', __('Added', 'yith-woocommerce-compare')), 'table_title' => apply_filters('yith_woocompare_compare_table_title', __('Product Comparison', 'yith-woocommerce-compare')), 'auto_open' => get_option('yith_woocompare_auto_open', 'yes'), 'loader' => YITH_WOOCOMPARE_ASSETS_URL . '/images/loader.gif', 'button_text' => get_option('yith_woocompare_button_text')));
     // colorbox
     wp_enqueue_style('jquery-colorbox', YITH_WOOCOMPARE_ASSETS_URL . '/css/colorbox.css');
     wp_enqueue_script('jquery-colorbox', YITH_WOOCOMPARE_ASSETS_URL . '/js/jquery.colorbox-min.js', array('jquery'), '1.4.21', true);
     // widget
     if (is_active_widget(false, false, 'yith-woocompare-widget', true) && !is_admin()) {
         wp_enqueue_style('yith-woocompare-widget', YITH_WOOCOMPARE_ASSETS_URL . '/css/widget.css');
     }
 }
开发者ID:websideas,项目名称:Mondova,代码行数:19,代码来源:class.yith-woocompare-frontend.php

示例4: enqueue_scripts

 /**
  * Enqueue the scripts and styles in the page
  */
 public function enqueue_scripts()
 {
     // scripts
     wp_enqueue_script('yith-woocompare-main', YITH_WOOCOMPARE_ASSETS_URL . '/js/woocompare.js', array('jquery'), $this->version, true);
     wp_localize_script('yith-woocompare-main', 'yith_woocompare', array('ajaxurl' => WC_AJAX::get_endpoint("%%endpoint%%"), 'actionadd' => $this->action_add, 'actionremove' => $this->action_remove, 'actionview' => $this->action_view, 'added_label' => __('Added', 'yith-woocommerce-compare'), 'table_title' => __('Product Comparison', 'yith-woocommerce-compare'), 'auto_open' => get_option('yith_woocompare_auto_open', 'yes'), 'loader' => YITH_WOOCOMPARE_ASSETS_URL . '/images/loader.gif', 'button_text' => get_option('yith_woocompare_button_text')));
     // colorbox
     wp_enqueue_style('jquery-colorbox', YITH_WOOCOMPARE_ASSETS_URL . '/css/colorbox.css');
     wp_enqueue_script('jquery-colorbox', YITH_WOOCOMPARE_ASSETS_URL . '/js/jquery.colorbox-min.js', array('jquery'), '1.4.21', true);
     // widget
     if (is_active_widget(false, false, 'yith-woocompare-widget', true) && !is_admin()) {
         wp_enqueue_style('yith-woocompare-widget', YITH_WOOCOMPARE_ASSETS_URL . '/css/widget.css');
     }
 }
开发者ID:mautd29388,项目名称:naturel,代码行数:16,代码来源:class.yith-woocompare-frontend.php

示例5: get_script_data

 /**
  * Return data for script handles.
  * @access private
  * @param  string $handle
  * @return array|bool
  */
 private static function get_script_data($handle)
 {
     global $wp;
     switch ($handle) {
         case 'woocommerce':
             return array('ajax_url' => WC()->ajax_url(), 'wc_ajax_url' => WC_AJAX::get_endpoint("%%endpoint%%"));
             break;
         case 'wc-geolocation':
             return array('wc_ajax_url' => WC_AJAX::get_endpoint("%%endpoint%%"), 'home_url' => home_url(), 'is_available' => !(is_cart() || is_account_page() || is_checkout() || is_customize_preview()) ? '1' : '0', 'hash' => isset($_GET['version']) ? wc_clean($_GET['version']) : '');
             break;
         case 'wc-single-product':
             return array('i18n_required_rating_text' => esc_attr__('Please select a rating', 'woocommerce'), 'review_rating_required' => get_option('woocommerce_review_rating_required'), 'flexslider' => apply_filters('woocommerce_single_product_carousel_options', array('rtl' => is_rtl(), 'animation' => 'slide', 'smoothHeight' => true, 'directionNav' => false, 'controlNav' => 'thumbnails', 'slideshow' => false, 'animationSpeed' => 500)));
             break;
         case 'wc-checkout':
             return array('ajax_url' => WC()->ajax_url(), 'wc_ajax_url' => WC_AJAX::get_endpoint("%%endpoint%%"), 'update_order_review_nonce' => wp_create_nonce('update-order-review'), 'apply_coupon_nonce' => wp_create_nonce('apply-coupon'), 'remove_coupon_nonce' => wp_create_nonce('remove-coupon'), 'option_guest_checkout' => get_option('woocommerce_enable_guest_checkout'), 'checkout_url' => WC_AJAX::get_endpoint("checkout"), 'is_checkout' => is_page(wc_get_page_id('checkout')) && empty($wp->query_vars['order-pay']) && !isset($wp->query_vars['order-received']) ? 1 : 0, 'debug_mode' => defined('WP_DEBUG') && WP_DEBUG, 'i18n_checkout_error' => esc_attr__('Error processing checkout. Please try again.', 'woocommerce'));
             break;
         case 'wc-address-i18n':
             return array('locale' => json_encode(WC()->countries->get_country_locale()), 'locale_fields' => json_encode(WC()->countries->get_country_locale_field_selectors()), 'i18n_required_text' => esc_attr__('required', 'woocommerce'));
             break;
         case 'wc-cart':
             return array('ajax_url' => WC()->ajax_url(), 'wc_ajax_url' => WC_AJAX::get_endpoint("%%endpoint%%"), 'update_shipping_method_nonce' => wp_create_nonce("update-shipping-method"), 'apply_coupon_nonce' => wp_create_nonce("apply-coupon"), 'remove_coupon_nonce' => wp_create_nonce("remove-coupon"));
             break;
         case 'wc-cart-fragments':
             return array('ajax_url' => WC()->ajax_url(), 'wc_ajax_url' => WC_AJAX::get_endpoint("%%endpoint%%"), 'fragment_name' => apply_filters('woocommerce_cart_fragment_name', 'wc_fragments'));
             break;
         case 'wc-add-to-cart':
             return array('ajax_url' => WC()->ajax_url(), 'wc_ajax_url' => WC_AJAX::get_endpoint("%%endpoint%%"), 'i18n_view_cart' => esc_attr__('View cart', 'woocommerce'), 'cart_url' => apply_filters('woocommerce_add_to_cart_redirect', wc_get_cart_url()), 'is_cart' => is_cart(), 'cart_redirect_after_add' => get_option('woocommerce_cart_redirect_after_add'));
             break;
         case 'wc-add-to-cart-variation':
             // We also need the wp.template for this script :)
             wc_get_template('single-product/add-to-cart/variation.php');
             return array('wc_ajax_url' => WC_AJAX::get_endpoint("%%endpoint%%"), 'i18n_no_matching_variations_text' => esc_attr__('Sorry, no products matched your selection. Please choose a different combination.', 'woocommerce'), 'i18n_make_a_selection_text' => esc_attr__('Please select some product options before adding this product to your cart.', 'woocommerce'), 'i18n_unavailable_text' => esc_attr__('Sorry, this product is unavailable. Please choose a different combination.', 'woocommerce'));
             break;
         case 'wc-country-select':
             return array('countries' => json_encode(array_merge(WC()->countries->get_allowed_country_states(), WC()->countries->get_shipping_country_states())), 'i18n_select_state_text' => esc_attr__('Select an option…', 'woocommerce'), 'i18n_matches_1' => _x('One result is available, press enter to select it.', 'enhanced select', 'woocommerce'), 'i18n_matches_n' => _x('%qty% results are available, use up and down arrow keys to navigate.', 'enhanced select', 'woocommerce'), 'i18n_no_matches' => _x('No matches found', 'enhanced select', 'woocommerce'), 'i18n_ajax_error' => _x('Loading failed', 'enhanced select', 'woocommerce'), 'i18n_input_too_short_1' => _x('Please enter 1 or more characters', 'enhanced select', 'woocommerce'), 'i18n_input_too_short_n' => _x('Please enter %qty% or more characters', 'enhanced select', 'woocommerce'), 'i18n_input_too_long_1' => _x('Please delete 1 character', 'enhanced select', 'woocommerce'), 'i18n_input_too_long_n' => _x('Please delete %qty% characters', 'enhanced select', 'woocommerce'), 'i18n_selection_too_long_1' => _x('You can only select 1 item', 'enhanced select', 'woocommerce'), 'i18n_selection_too_long_n' => _x('You can only select %qty% items', 'enhanced select', 'woocommerce'), 'i18n_load_more' => _x('Loading more results…', 'enhanced select', 'woocommerce'), 'i18n_searching' => _x('Searching…', 'enhanced select', 'woocommerce'));
             break;
         case 'wc-password-strength-meter':
             return array('min_password_strength' => apply_filters('woocommerce_min_password_strength', 3), 'i18n_password_error' => esc_attr__('Please enter a stronger password.', 'woocommerce'), 'i18n_password_hint' => esc_attr__('The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ & ).', 'woocommerce'));
             break;
     }
     return false;
 }
开发者ID:shivapoudel,项目名称:woocommerce,代码行数:48,代码来源:class-wc-frontend-scripts.php


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