本文整理汇总了PHP中WC_HTTPS类的典型用法代码示例。如果您正苦于以下问题:PHP WC_HTTPS类的具体用法?PHP WC_HTTPS怎么用?PHP WC_HTTPS使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WC_HTTPS类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_icon
/**
* get_icon function.
*
* @access public
* @return string
*/
public function get_icon()
{
$icon = '<img src="' . WC_HTTPS::force_https_url(WC()->plugin_url() . '/assets/images/icons/credit-cards/visa.svg') . '" alt="Visa" width="32" style="margin-left: 0.3em" />';
$icon .= '<img src="' . WC_HTTPS::force_https_url(WC()->plugin_url() . '/assets/images/icons/credit-cards/mastercard.svg') . '" alt="Mastercard" width="32" style="margin-left: 0.3em" />';
$icon .= '<img src="' . WC_HTTPS::force_https_url(WC()->plugin_url() . '/assets/images/icons/credit-cards/amex.svg') . '" alt="Amex" width="32" style="margin-left: 0.3em" />';
$icon .= '<img src="' . WC_HTTPS::force_https_url(WC()->plugin_url() . '/assets/images/icons/credit-cards/discover.svg') . '" alt="Discover" width="32" style="margin-left: 0.3em" />';
return apply_filters('woocommerce_gateway_icon', $icon, $this->id);
}
示例2: get_icon
/**
* get_icon function.
*
* @access public
* @return string
*/
public function get_icon()
{
$icon = '<img src="' . WC_HTTPS::force_https_url(WC()->plugin_url() . '/assets/images/icons/credit-cards/visa.png') . '" alt="Visa" />';
$icon .= '<img src="' . WC_HTTPS::force_https_url(WC()->plugin_url() . '/assets/images/icons/credit-cards/mastercard.png') . '" alt="Mastercard" />';
$icon .= '<img src="' . WC_HTTPS::force_https_url(WC()->plugin_url() . '/assets/images/icons/credit-cards/amex.png') . '" alt="Amex" />';
if ('USD' === get_woocommerce_currency()) {
$icon .= '<img src="' . WC_HTTPS::force_https_url(WC()->plugin_url() . '/assets/images/icons/credit-cards/discover.png') . '" alt="Discover" />';
$icon .= '<img src="' . WC_HTTPS::force_https_url(WC()->plugin_url() . '/assets/images/icons/credit-cards/jcb.png') . '" alt="JCB" />';
$icon .= '<img src="' . WC_HTTPS::force_https_url(plugins_url('/assets/images/diners.png', dirname(__FILE__))) . '" alt="Diners" />';
}
if ($this->bitcoin) {
$icon .= '<img src="' . WC_HTTPS::force_https_url(plugins_url('/assets/images/bitcoin.png', dirname(__FILE__))) . '" alt="Bitcoin" />';
}
return apply_filters('woocommerce_gateway_icon', $icon, $this->id);
}
示例3: get_icon
/**
* get_icon function.
*
* @access public
* @return string
*/
public function get_icon()
{
$ext = version_compare(WC()->version, '2.6', '>=') ? '.svg' : '.png';
$style = version_compare(WC()->version, '2.6', '>=') ? 'style="margin-left: 0.3em"' : '';
$icon = '<img src="' . WC_HTTPS::force_https_url(WC()->plugin_url() . '/assets/images/icons/credit-cards/visa' . $ext) . '" alt="Visa" width="32" ' . $style . ' />';
$icon .= '<img src="' . WC_HTTPS::force_https_url(WC()->plugin_url() . '/assets/images/icons/credit-cards/mastercard' . $ext) . '" alt="Mastercard" width="32" ' . $style . ' />';
$icon .= '<img src="' . WC_HTTPS::force_https_url(WC()->plugin_url() . '/assets/images/icons/credit-cards/amex' . $ext) . '" alt="Amex" width="32" ' . $style . ' />';
if ('USD' === get_woocommerce_currency()) {
$icon .= '<img src="' . WC_HTTPS::force_https_url(WC()->plugin_url() . '/assets/images/icons/credit-cards/discover' . $ext) . '" alt="Discover" width="32" ' . $style . ' />';
$icon .= '<img src="' . WC_HTTPS::force_https_url(WC()->plugin_url() . '/assets/images/icons/credit-cards/jcb' . $ext) . '" alt="JCB" width="32" ' . $style . ' />';
$icon .= '<img src="' . WC_HTTPS::force_https_url(WC()->plugin_url() . '/assets/images/icons/credit-cards/diners' . $ext) . '" alt="Diners" width="32" ' . $style . ' />';
}
if ($this->bitcoin) {
$icon .= '<img src="' . WC_HTTPS::force_https_url(plugins_url('/assets/images/bitcoin' . $ext, WC_STRIPE_MAIN_FILE)) . '" alt="Bitcoin" width="32" ' . $style . ' />';
}
return apply_filters('woocommerce_gateway_icon', $icon, $this->id);
}
示例4: elseif
$card_type = $card_meta['cardtype'];
if ('American Express' == $card_type) {
$card_type_img = 'amex';
} elseif ('Diners Club' == $card_type) {
$card_type_img = 'diners';
} else {
$card_type_img = strtolower($card_type);
}
$cc_last4 = substr($card_meta['token'], -4);
$is_default = $card_meta['is_default'];
$cc_exp = $card_meta['expiry'];
?>
<tr>
<td>
<img src="<?php
echo WC_HTTPS::force_https_url(WC()->plugin_url() . '/assets/images/icons/credit-cards/' . $card_type_img . '.png');
?>
" alt=""/>
<?php
printf(__('%s ending in %s %s', 'woocommerce-payeezy'), $card_type, $cc_last4, 'yes' == $is_default ? '(default)' : '');
?>
</td>
<td><?php
printf(__('%s/%s'), substr($cc_exp, 0, 2), substr($cc_exp, -2));
?>
</td>
<td>
<a href="#" data-id="<?php
echo esc_attr($card->ID);
?>
" data-title="<?php
示例5: force_ssl
/**
* @deprecated 2.1.0
* @param $content
* @return string
*/
public function force_ssl($content)
{
_deprecated_function('Woocommerce->force_ssl', '2.1', 'WC_HTTPS::force_https_url');
return WC_HTTPS::force_https_url($content);
}
示例6: get_icon
/**
* get_icon function.
*
* @access public
* @return string
*/
public function get_icon()
{
switch (WC()->countries->get_base_country()) {
case 'US':
$allowed = array('visa', 'mastercard', 'amex', 'discover', 'diners', 'jcb');
break;
default:
$allowed = array('visa', 'mastercard', 'amex');
break;
}
$icon = '';
foreach ($allowed as $name) {
$icon .= '<img src="' . WC_HTTPS::force_https_url(WC()->plugin_url() . '/assets/images/icons/credit-cards/' . $name . '.png') . '" alt="' . $this->cards[$name] . '" style="width:40px;" />';
}
return apply_filters('woocommerce_gateway_icon', $icon, $this->id);
}
示例7: get_sample_check_html
/**
* Get the sample check image HTML
*
* @since 4.0.0
* @return string sample check image HTML
*/
protected function get_sample_check_html()
{
$image_url = WC_HTTPS::force_https_url($this->get_gateway()->get_plugin()->get_payment_gateway_framework_assets_url() . '/images/sample-check.png');
$html = sprintf('<div class="js-sv-wc-payment-gateway-echeck-form-sample-check" style="display: none;"><img width="541" height="270" src="%s" /></div>', esc_url($image_url));
/**
* Payment Gateway Payment Form Sample eCheck HTML.
*
* Filters the HTML rendered for the same eCheck image.
*
* @since 4.0.0
* @param string $html
* @param \SV_WC_Payment_Gateway_Payment_Form $this payment form instance
*/
return apply_filters('wc_' . $this->get_gateway()->get_id() . '_payment_form_sample_check_html', $html, $this);
}
示例8: forceSSL
/**
*
* Envia mesajes de error al checkout segun la version
* @author ivelazquex <isai.velazquez@gmail.com>
* @param $url string
* @return string
*/
private function forceSSL($url)
{
global $woocommerce;
if (class_exists('WC_HTTPS')) {
// version >= 2.3
return WC_HTTPS::force_https_url($url);
} else {
// version < 2.3
return $woocommerce->force_ssl($url);
}
}
示例9: get_icon
/**
* Add selected card icons to payment method label, defaults to Visa/MC/Amex/Discover
*/
public function get_icon()
{
global $woocommerce;
$icon = '';
if ($this->icon) {
if (get_option('woocommerce_force_ssl_checkout') == 'no') {
// use icon provided by filter
$icon = '<img src="' . esc_url($this->icon) . '" alt="' . esc_attr($this->title) . '" />';
} else {
// use icon provided by filter
$icon = '<img src="' . esc_url(WC_HTTPS::force_https_url($this->icon)) . '" alt="' . esc_attr($this->title) . '" />';
}
} elseif (!empty($this->cardtypes)) {
if (get_option('woocommerce_force_ssl_checkout') == 'no') {
// display icons for the selected card types
foreach ($this->cardtypes as $card_type) {
$icon .= '<img src="' . esc_url($this->get_plugin_url() . '/assets/card-' . strtolower(str_replace(' ', '-', $card_type)) . '.png') . '" alt="' . esc_attr(strtolower($card_type)) . '" />';
}
} else {
// display icons for the selected card types
foreach ($this->cardtypes as $card_type) {
$icon .= '<img src="' . esc_url(WC_HTTPS::force_https_url($this->get_plugin_url()) . '/assets/card-' . strtolower(str_replace(' ', '-', $card_type)) . '.png') . '" alt="' . esc_attr(strtolower($card_type)) . '" />';
}
}
}
return apply_filters('woocommerce_gateway_icon', $icon, $this->id);
}
示例10: gateway_icon_create
/**
* gateway_icon_create
*
* Helper to get the a gateway icon image tag
*
* @access protected
* @return void
*/
protected function gateway_icon_create($icon, $max_height)
{
$icon_url = WC_HTTPS::force_https_url(plugin_dir_url(__FILE__) . 'assets/images/cards/' . $icon . '.png');
return '<img src="' . $icon_url . '" alt="' . esc_attr($this->get_title()) . '" style="max-height:' . $max_height . '"/>';
}
示例11: get_payment_method_image_url
/**
* Returns the payment method image URL (if any) for the given $type, ie
* if $type is 'amex' a URL to the american express card icon will be
* returned. If $type is 'echeck', a URL to the echeck icon will be
* returned.
*
* @since 1.0.0
* @param string $type the payment method cc type or name
* @return string the image URL or null
*/
public function get_payment_method_image_url($type)
{
$image_type = strtolower($type);
// translate card name to type as needed
switch ($image_type) {
case 'american express':
$image_type = 'amex';
break;
case 'discover':
$image_type = 'disc';
break;
case 'mastercard':
$image_type = 'mc';
break;
case 'paypal':
$image_type = 'paypal';
break;
case 'visa debit':
$image_type = 'visa-debit';
break;
case 'visa electron':
$image_type = 'visa-electron';
break;
case 'card':
$image_type = 'cc-plain';
break;
// default: accept $type as is
}
// use plain card image if type is not known
if (!$image_type) {
if ($this->is_credit_card_gateway()) {
$image_type = 'cc-plain';
}
}
/**
* Payment Gateway Fallback to PNG Filter.
*
* Allow actors to enable the use of PNGs over SVGs for payment icon images.
*
* @since 4.0.0
* @param bool $use_svg true by default, false to use PNGs
*/
$image_extension = apply_filters('wc_payment_gateway_' . $this->get_plugin()->get_id() . '_use_svg', true) ? '.svg' : '.png';
// first, is the card image available within the plugin?
if (is_readable($this->get_plugin()->get_payment_gateway_framework_assets_path() . '/images/card-' . $image_type . $image_extension)) {
return WC_HTTPS::force_https_url($this->get_plugin()->get_payment_gateway_framework_assets_url() . '/images/card-' . $image_type . $image_extension);
}
// default: is the card image available within the framework?
if (is_readable($this->get_plugin()->get_payment_gateway_framework_assets_path() . '/images/card-' . $image_type . $image_extension)) {
return WC_HTTPS::force_https_url($this->get_plugin()->get_payment_gateway_framework_assets_url() . '/images/card-' . $image_type . $image_extension);
}
return null;
}
示例12: get_icon
/**
* get_icon function.
*
* @return string
*/
public function get_icon()
{
$icon = $this->icon ? '<img src="' . WC_HTTPS::force_https_url($this->icon) . '" alt="' . esc_attr($this->get_title()) . '" />' : '';
return apply_filters('woocommerce_gateway_icon', $icon, $this->id);
}
示例13: get_icon
/**
* get_icon function.
*
* @return string
*/
public function get_icon()
{
$link = null;
switch (WC()->countries->get_base_country()) {
case 'US':
case 'NZ':
case 'CZ':
case 'HU':
case 'MY':
$icon = 'https://www.paypalobjects.com/webstatic/mktg/logo/AM_mc_vs_dc_ae.jpg';
break;
case 'TR':
$icon = 'https://www.paypalobjects.com/webstatic/mktg/logo-center/logo_paypal_odeme_secenekleri.jpg';
break;
case 'GB':
$icon = 'https://www.paypalobjects.com/webstatic/mktg/Logo/AM_mc_vs_ms_ae_UK.png';
break;
case 'MX':
$icon = array('https://www.paypal.com/es_XC/Marketing/i/banner/paypal_visa_mastercard_amex.png', 'https://www.paypal.com/es_XC/Marketing/i/banner/paypal_debit_card_275x60.gif');
$link = 'https://www.paypal.com/mx/cgi-bin/webscr?cmd=xpt/Marketing/general/WIPaypal-outside';
break;
case 'FR':
$icon = 'https://www.paypalobjects.com/webstatic/mktg/logo-center/logo_paypal_moyens_paiement_fr.jpg';
break;
case 'AU':
$icon = 'https://www.paypalobjects.com/webstatic/en_AU/mktg/logo/Solutions-graphics-1-184x80.jpg';
break;
case 'DK':
$icon = 'https://www.paypalobjects.com/webstatic/mktg/logo-center/logo_PayPal_betalingsmuligheder_dk.jpg';
break;
case 'RU':
$icon = 'https://www.paypalobjects.com/webstatic/ru_RU/mktg/business/pages/logo-center/AM_mc_vs_dc_ae.jpg';
break;
case 'NO':
$icon = 'https://www.paypalobjects.com/webstatic/mktg/logo-center/banner_pl_just_pp_319x110.jpg';
break;
case 'CA':
$icon = 'https://www.paypalobjects.com/webstatic/en_CA/mktg/logo-image/AM_mc_vs_dc_ae.jpg';
break;
case 'HK':
$icon = 'https://www.paypalobjects.com/webstatic/en_HK/mktg/logo/AM_mc_vs_dc_ae.jpg';
break;
case 'SG':
$icon = 'https://www.paypalobjects.com/webstatic/en_SG/mktg/Logos/AM_mc_vs_dc_ae.jpg';
break;
case 'TW':
$icon = 'https://www.paypalobjects.com/webstatic/en_TW/mktg/logos/AM_mc_vs_dc_ae.jpg';
break;
case 'TH':
$icon = 'https://www.paypalobjects.com/webstatic/en_TH/mktg/Logos/AM_mc_vs_dc_ae.jpg';
break;
default:
$icon = WC_HTTPS::force_https_url(WC()->plugin_url() . '/includes/gateways/paypal/assets/images/paypal.png');
$link = null;
break;
}
if (is_null($link)) {
$link = 'https://www.paypal.com/' . strtolower(WC()->countries->get_base_country()) . '/webapps/mpp/paypal-popup';
}
if (is_array($icon)) {
$icon_html = '';
foreach ($icon as $i) {
$icon_html .= '<img src="' . esc_attr($i) . '" alt="PayPal Acceptance Mark" />';
}
} else {
$icon_html = '<img src="' . esc_attr(apply_filters('woocommerce_paypal_icon', $icon)) . '" alt="PayPal Acceptance Mark" />';
}
if ($link) {
$what_is_paypal = sprintf('<a href="%1$s" class="about_paypal" onclick="javascript:window.open(\'%1$s\',\'WIPaypal\',\'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=1060, height=700\'); return false;" title="' . esc_attr__('What is PayPal?', 'woocommerce') . '">' . esc_attr__('What is PayPal?', 'woocommerce') . '</a>', esc_url($link));
} else {
$what_is_paypal = '';
}
return apply_filters('woocommerce_gateway_icon', $icon_html . $what_is_paypal, $this->id);
}
示例14: get_icon
/**
* get_icon function.
*
* @access public
* @return string
*/
public function get_icon()
{
$icon = '<br>';
if (is_array($this->cardtypes)) {
$card_types = array_reverse($this->cardtypes);
foreach ($card_types as $card_type) {
$icon .= '<img src="' . WC_HTTPS::force_https_url(WC()->plugin_url() . '/assets/images/icons/credit-cards/' . $card_type . '.png') . '" alt="' . $card_type . '" />';
}
}
return apply_filters('woocommerce_gateway_icon', $icon, $this->id);
}
示例15: get_icon
/**
* get_icon function.
*
* @see WC_Payment_Gateway::get_icon()
* @return string card icons
*/
public function get_icon()
{
global $wc_elavon_vm;
$icon = '';
if ($this->icon) {
// default behavior
$icon = '<img src="' . esc_url(WC_HTTPS::force_https_url($this->icon)) . '" alt="' . esc_attr($this->title) . '" />';
} elseif ($this->cardtypes) {
// display icons for the selected card types
$icon = '';
foreach ($this->cardtypes as $cardtype) {
if (file_exists(wc_elavon_vm()->get_plugin_path() . '/assets/images/card-' . strtolower($cardtype) . '.png')) {
$icon .= '<img src="' . esc_url(WC_HTTPS::force_https_url(wc_elavon_vm()->get_plugin_url() . '/assets/images/card-' . strtolower($cardtype) . '.png')) . '" alt="' . esc_attr(strtolower($cardtype)) . '" />';
}
}
}
return apply_filters('woocommerce_gateway_icon', $icon, $this->id);
}