本文整理汇总了PHP中wc_site_is_https函数的典型用法代码示例。如果您正苦于以下问题:PHP wc_site_is_https函数的具体用法?PHP wc_site_is_https怎么用?PHP wc_site_is_https使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wc_site_is_https函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_settings
/**
* Get settings array.
*
* @return array
*/
public function get_settings()
{
$settings = apply_filters('woocommerce_payment_gateways_settings', array(array('title' => __('Checkout process', 'woocommerce'), 'type' => 'title', 'id' => 'checkout_process_options'), array('title' => __('Coupons', 'woocommerce'), 'desc' => __('Enable the use of coupons', 'woocommerce'), 'id' => 'woocommerce_enable_coupons', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => 'start', 'desc_tip' => __('Coupons can be applied from the cart and checkout pages.', 'woocommerce')), array('desc' => __('Calculate coupon discounts sequentially', 'woocommerce'), 'id' => 'woocommerce_calc_discounts_sequentially', 'default' => 'no', 'type' => 'checkbox', 'desc_tip' => __('When applying multiple coupons, apply the first coupon to the full price and the second coupon to the discounted price and so on.', 'woocommerce'), 'checkboxgroup' => 'end', 'autoload' => false), array('title' => __('Checkout process', 'woocommerce'), 'desc' => __('Enable guest checkout', 'woocommerce'), 'desc_tip' => __('Allows customers to checkout without creating an account.', 'woocommerce'), 'id' => 'woocommerce_enable_guest_checkout', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => 'start', 'autoload' => false), array('desc' => __('Force secure checkout', 'woocommerce'), 'id' => 'woocommerce_force_ssl_checkout', 'default' => 'no', 'type' => 'checkbox', 'checkboxgroup' => '', 'show_if_checked' => 'option', 'desc_tip' => sprintf(__('Force SSL (HTTPS) on the checkout pages (<a href="%s" target="_blank">an SSL Certificate is required</a>).', 'woocommerce'), 'https://docs.woocommerce.com/document/ssl-and-https/#section-3')), 'unforce_ssl_checkout' => array('desc' => __('Force HTTP when leaving the checkout', 'woocommerce'), 'id' => 'woocommerce_unforce_ssl_checkout', 'default' => 'no', 'type' => 'checkbox', 'checkboxgroup' => 'end', 'show_if_checked' => 'yes'), array('type' => 'sectionend', 'id' => 'checkout_process_options'), array('title' => __('Checkout pages', 'woocommerce'), 'desc' => __('These pages need to be set so that WooCommerce knows where to send users to checkout.', 'woocommerce'), 'type' => 'title', 'id' => 'checkout_page_options'), array('title' => __('Cart page', 'woocommerce'), 'desc' => sprintf(__('Page contents: [%s]', 'woocommerce'), apply_filters('woocommerce_cart_shortcode_tag', 'woocommerce_cart')), 'id' => 'woocommerce_cart_page_id', 'type' => 'single_select_page', 'default' => '', 'class' => 'wc-enhanced-select-nostd', 'css' => 'min-width:300px;', 'desc_tip' => true), array('title' => __('Checkout page', 'woocommerce'), 'desc' => sprintf(__('Page contents: [%s]', 'woocommerce'), apply_filters('woocommerce_checkout_shortcode_tag', 'woocommerce_checkout')), 'id' => 'woocommerce_checkout_page_id', 'type' => 'single_select_page', 'default' => '', 'class' => 'wc-enhanced-select-nostd', 'css' => 'min-width:300px;', 'desc_tip' => true), array('title' => __('Terms and conditions', 'woocommerce'), 'desc' => __('If you define a "Terms" page the customer will be asked if they accept them when checking out.', 'woocommerce'), 'id' => 'woocommerce_terms_page_id', 'default' => '', 'class' => 'wc-enhanced-select-nostd', 'css' => 'min-width:300px;', 'type' => 'single_select_page', 'desc_tip' => true, 'autoload' => false), array('type' => 'sectionend', 'id' => 'checkout_page_options'), array('title' => __('Checkout endpoints', 'woocommerce'), 'type' => 'title', 'desc' => __('Endpoints are appended to your page URLs to handle specific actions during the checkout process. They should be unique.', 'woocommerce'), 'id' => 'account_endpoint_options'), array('title' => __('Pay', 'woocommerce'), 'desc' => __('Endpoint for the "Checkout → Pay" page.', 'woocommerce'), 'id' => 'woocommerce_checkout_pay_endpoint', 'type' => 'text', 'default' => 'order-pay', 'desc_tip' => true), array('title' => __('Order received', 'woocommerce'), 'desc' => __('Endpoint for the "Checkout → Order received" page.', 'woocommerce'), 'id' => 'woocommerce_checkout_order_received_endpoint', 'type' => 'text', 'default' => 'order-received', 'desc_tip' => true), array('title' => __('Add payment method', 'woocommerce'), 'desc' => __('Endpoint for the "Checkout → Add payment method" page.', 'woocommerce'), 'id' => 'woocommerce_myaccount_add_payment_method_endpoint', 'type' => 'text', 'default' => 'add-payment-method', 'desc_tip' => true), array('title' => __('Delete payment method', 'woocommerce'), 'desc' => __('Endpoint for the delete payment method page.', 'woocommerce'), 'id' => 'woocommerce_myaccount_delete_payment_method_endpoint', 'type' => 'text', 'default' => 'delete-payment-method', 'desc_tip' => true), array('title' => __('Set default payment method', 'woocommerce'), 'desc' => __('Endpoint for the setting a default payment method page.', 'woocommerce'), 'id' => 'woocommerce_myaccount_set_default_payment_method_endpoint', 'type' => 'text', 'default' => 'set-default-payment-method', 'desc_tip' => true), array('type' => 'sectionend', 'id' => 'checkout_endpoint_options'), array('title' => __('Payment gateways', 'woocommerce'), 'desc' => __('Installed gateways are listed below. Drag and drop gateways to control their display order on the frontend.', 'woocommerce'), 'type' => 'title', 'id' => 'payment_gateways_options'), array('type' => 'payment_gateways'), array('type' => 'sectionend', 'id' => 'payment_gateways_options')));
if (wc_site_is_https()) {
unset($settings['unforce_ssl_checkout']);
}
return apply_filters('woocommerce_get_settings_' . $this->id, $settings);
}
开发者ID:woocommerce,项目名称:woocommerce,代码行数:13,代码来源:class-wc-settings-checkout.php
示例2: wc_checkout_is_https
/**
* Backports wc_checkout_is_https() to 2.4.x
*
* @since 4.3.0-beta
* @return bool
*/
public static function wc_checkout_is_https()
{
if (self::is_wc_version_gte_2_5()) {
return wc_checkout_is_https();
} else {
return wc_site_is_https() || 'yes' === get_option('woocommerce_force_ssl_checkout') || class_exists('WordPressHTTPS') || strstr(wc_get_page_permalink('checkout'), 'https:');
}
}
开发者ID:DustinHartzler,项目名称:TheCLEFT,代码行数:14,代码来源:class-sv-wc-plugin-compatibility.php
示例3: wc_checkout_is_https
/**
* Check if the checkout is configured for https. Look at options, WP HTTPS plugin, or the permalink itself.
*
* @since 2.5.0
* @return bool
*/
function wc_checkout_is_https()
{
return wc_site_is_https() || 'yes' === get_option('woocommerce_force_ssl_checkout') || class_exists('WordPressHTTPS') || strstr(wc_get_page_permalink('checkout'), 'https:');
}
开发者ID:robbenz,项目名称:plugs,代码行数:10,代码来源:wc-conditional-functions.php
示例4: admin_notices
/**
* Check if SSL is enabled and notify the user
*/
public function admin_notices()
{
if ($this->enabled == 'no') {
return;
}
$addons = class_exists('WC_Subscriptions_Order') || class_exists('WC_Pre_Orders_Order') ? '_addons' : '';
// Check required fields
if (!$this->secret_key) {
echo '<div class="error"><p>' . sprintf(__('Stripe error: Please enter your secret key <a href="%s">here</a>', 'woocommerce-gateway-stripe'), admin_url('admin.php?page=wc-settings&tab=checkout§ion=wc_gateway_stripe' . $addons)) . '</p></div>';
return;
} elseif (!$this->publishable_key) {
echo '<div class="error"><p>' . sprintf(__('Stripe error: Please enter your publishable key <a href="%s">here</a>', 'woocommerce-gateway-stripe'), admin_url('admin.php?page=wc-settings&tab=checkout§ion=wc_gateway_stripe' . $addons)) . '</p></div>';
return;
}
// Simple check for duplicate keys
if ($this->secret_key == $this->publishable_key) {
echo '<div class="error"><p>' . sprintf(__('Stripe error: Your secret and publishable keys match. Please check and re-enter.', 'woocommerce-gateway-stripe'), admin_url('admin.php?page=wc-settings&tab=checkout§ion=wc_gateway_stripe' . $addons)) . '</p></div>';
return;
}
// Show message if enabled and FORCE SSL is disabled and WordpressHTTPS plugin is not detected
if (function_exists('wc_site_is_https') && !wc_site_is_https() && ('no' === get_option('woocommerce_force_ssl_checkout') && !class_exists('WordPressHTTPS'))) {
echo '<div class="error"><p>' . sprintf(__('Stripe is enabled, but the <a href="%s">force SSL option</a> is disabled; your checkout may not be secure! Please enable SSL and ensure your server has a valid SSL certificate - Stripe will only work in test mode.', 'woocommerce-gateway-stripe'), admin_url('admin.php?page=wc-settings&tab=checkout')) . '</p></div>';
}
}
开发者ID:developmentDM2,项目名称:The-Haute-Mess,代码行数:27,代码来源:class-wc-gateway-stripe.php
示例5: admin_notices
/**
* Check if SSL is enabled and notify the user
*/
public function admin_notices()
{
if ('no' === $this->enabled) {
return;
}
// Show message if enabled and FORCE SSL is disabled and WordpressHTTPS plugin is not detected.
if (function_exists('wc_site_is_https') && !wc_site_is_https() && ('no' === get_option('woocommerce_force_ssl_checkout') && !class_exists('WordPressHTTPS'))) {
echo '<div class="error stripe-ssl-message"><p>' . sprintf(__('Stripe is enabled, but the <a href="%s">force SSL option</a> is disabled; your checkout may not be secure! Please enable SSL and ensure your server has a valid SSL certificate - Stripe will only work in test mode.', 'woocommerce-gateway-stripe'), admin_url('admin.php?page=wc-settings&tab=checkout')) . '</p></div>';
}
}
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:13,代码来源:class-wc-gateway-stripe.php
示例6: get_index
/**
* Get the site index.
*
* This endpoint describes the capabilities of the site.
*
* @since 2.3
* @return array Index entity
*/
public function get_index()
{
// General site data
$available = array('store' => array('name' => get_option('blogname'), 'description' => get_option('blogdescription'), 'URL' => get_option('siteurl'), 'wc_version' => WC()->version, 'version' => WC_API::VERSION, 'routes' => array(), 'meta' => array('timezone' => wc_timezone_string(), 'currency' => get_woocommerce_currency(), 'currency_format' => get_woocommerce_currency_symbol(), 'currency_position' => get_option('woocommerce_currency_pos'), 'thousand_separator' => get_option('woocommerce_price_thousand_sep'), 'decimal_separator' => get_option('woocommerce_price_decimal_sep'), 'price_num_decimals' => wc_get_price_decimals(), 'tax_included' => wc_prices_include_tax(), 'weight_unit' => get_option('woocommerce_weight_unit'), 'dimension_unit' => get_option('woocommerce_dimension_unit'), 'ssl_enabled' => 'yes' === get_option('woocommerce_force_ssl_checkout') || wc_site_is_https(), 'permalinks_enabled' => '' !== get_option('permalink_structure'), 'generate_password' => 'yes' === get_option('woocommerce_registration_generate_password'), 'links' => array('help' => 'https://woothemes.github.io/woocommerce-rest-api-docs/'))));
// Find the available routes
foreach ($this->get_routes() as $route => $callbacks) {
$data = array();
$route = preg_replace('#\\(\\?P(<\\w+?>).*?\\)#', '$1', $route);
foreach (self::$method_map as $name => $bitmask) {
foreach ($callbacks as $callback) {
// Skip to the next route if any callback is hidden
if ($callback[1] & self::HIDDEN_ENDPOINT) {
continue 3;
}
if ($callback[1] & $bitmask) {
$data['supports'][] = $name;
}
if ($callback[1] & self::ACCEPT_DATA) {
$data['accepts_data'] = true;
}
// For non-variable routes, generate links
if (strpos($route, '<') === false) {
$data['meta'] = array('self' => get_woocommerce_api_url($route));
}
}
}
$available['store']['routes'][$route] = apply_filters('woocommerce_api_endpoints_description', $data);
}
return apply_filters('woocommerce_api_index', $available);
}
开发者ID:tlovett1,项目名称:woocommerce,代码行数:38,代码来源:class-wc-api-server.php
示例7: test_wc_site_is_https
/**
* Test wc_site_is_https().
*/
public function test_wc_site_is_https()
{
$this->assertFalse(wc_site_is_https());
add_filter('pre_option_home', array($this, '_https_url'));
$this->assertTrue(wc_site_is_https());
}
开发者ID:pelmered,项目名称:woocommerce,代码行数:9,代码来源:conditional-functions.php
示例8: unforce_https_template_redirect
/**
* Template redirect - if we end up on a page ensure it has the correct http/https url.
*/
public static function unforce_https_template_redirect()
{
if (function_exists('is_customize_preview') && is_customize_preview()) {
return;
}
if (!wc_site_is_https() && is_ssl() && $_SERVER['REQUEST_URI'] && !is_checkout() && !is_ajax() && !is_account_page() && apply_filters('woocommerce_unforce_ssl_checkout', true)) {
if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) {
wp_safe_redirect(preg_replace('|^https://|', 'http://', $_SERVER['REQUEST_URI']));
exit;
} else {
wp_safe_redirect('http://' . (!empty($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST']) . $_SERVER['REQUEST_URI']);
exit;
}
}
}
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:18,代码来源:class-wc-https.php
注:本文中的wc_site_is_https函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论