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


PHP Shopp::esc_html__方法代码示例

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


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

示例1: discount_remove

 /**
  * Displays a remove link the shopper can click to unapply a discount
  *
  * @see ShoppCartThemeAPI::discounts() Used within a shopp('cart.discounts') loop
  * @api `shopp('cart.discount-remove')`
  * @since 1.1
  *
  * @param string     $result  The output
  * @param array      $options The options
  * - **class**: `shoppui-remove-sign` The class attribute for the link
  * - **label**: `<span class="hidden">Remove Discount</span>` The text label of the link
  * @param ShoppCart  $O       The working object
  * @return string The remove discount link
  **/
 public static function discount_remove($result, $options, $O)
 {
     $Discount = ShoppOrder()->Discounts->current();
     if (!$Discount->applies()) {
         return false;
     }
     $defaults = array('class' => 'shoppui-remove-sign', 'label' => '<span class="hidden">' . Shopp::esc_html__('Remove Discount') . '</span>');
     $options = array_merge($defaults, $options);
     extract($options, EXTR_SKIP);
     return '<a href="' . Shopp::url(array('removecode' => $Discount->id()), 'cart') . '" class="' . $class . '">' . $label . '</a>';
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:25,代码来源:cart.php

示例2: variants

    /**
     * Iterate over the product variants or provide markup for a product variants chooser widget
     *
     * @api `shopp('product.variants')`
     * @since 1.1
     *
     * @param string       $result  The output
     * @param array        $options The options
     * - **mode**: `loop` (loop, single, multiple) Iterate over the variants with `loop` or provide an variant chooser widget using a `single` drop-down menu for all variants or `multiple` menus
     * - **defaults**: Specify a default option that is displayed as the initial selection for the `menu`
     * - **before_menu**: Markup to add before the widget
     * - **after_menu**: Markup to add after the widget
     * - **label**: `on` (on,off) Show or hide the menu name labels from the `menu` widget
     * - **format**: `%l (+%p)` The variant option label format
     *   - **%p**: shows the current variant price including available discounts.
     *   - **%l**: show the option label.
     *   - **%s**: show the stock amount of a product in inventory
     *   - **%d**: show the discount amount of an on sale variant.
     *   - **%r**: show the original price (the non-sale price) of the product variant.
     *   - **%u**: show the SKU for the product variant.
     * - **required**: `You must select the options for this item before you can add it to your shopping cart.` The error message to show when adding to the cart without selecting an variant when the **required** option is `on`
     * - **taxes**: Include or exclude taxes from prices
     * - **class**: The class attribute specifies one or more class-names for the menu elements
     * @param ShoppProduct $O       The working object
     * @return bool|string True if the next variant exists, or false otherwise, or the variant chooser markup
     **/
    public static function variants($result, $options, $O)
    {
        $string = '';
        if (!isset($options['mode'])) {
            if (!isset($O->_prices_loop)) {
                reset($O->prices);
                $O->_prices_loop = true;
            } else {
                next($O->prices);
            }
            $price = current($O->prices);
            while (false !== $price && ('N/A' == $price->type || 'variation' != $price->context)) {
                $price = next($O->prices);
            }
            if (false !== current($O->prices)) {
                return true;
            } else {
                $O->_prices_loop = false;
                return false;
            }
        }
        if (shopp_setting_enabled('inventory') && $O->outofstock) {
            return false;
        }
        // Completely out of stock, hide menus
        if (!isset($options['taxes'])) {
            $options['taxes'] = null;
        }
        $defaults = array('defaults' => '', 'disabled' => 'show', 'pricetags' => 'show', 'before_menu' => '', 'after_menu' => '', 'format' => '%l (%p)', 'label' => 'on', 'mode' => 'multiple', 'taxes' => null, 'required' => __('You must select the options for this item before you can add it to your shopping cart.', 'Shopp'));
        $options = array_merge($defaults, $options);
        extract($options);
        $taxes = isset($taxes) ? Shopp::str_true($taxes) : null;
        $taxrates = self::_taxes($O, 'price');
        $collection_class = ShoppCollection() && isset(ShoppCollection()->slug) ? 'category-' . ShoppCollection()->slug : '';
        if ('single' == $mode) {
            if (!empty($before_menu)) {
                $string .= $before_menu . "\n";
            }
            if (Shopp::str_true($label)) {
                $string .= '<label for="product-options' . (int) $O->id . '">' . Shopp::esc_html__('Options') . ': </label> ' . "\n";
            }
            $string .= '<select name="products[' . (int) $O->id . '][price]" id="product-options' . (int) $O->id . '" class="' . esc_attr($collection_class) . ' product' . (int) $O->id . ' options">';
            if (!empty($defaults)) {
                $string .= '<option value="">' . esc_html($options['defaults']) . '</option>' . "\n";
            }
            foreach ($O->prices as $pricing) {
                if ('variation' != $pricing->context) {
                    continue;
                }
                $currently = Shopp::str_true($pricing->sale) ? $pricing->promoprice : $pricing->price;
                $disable = $pricing->type == 'N/A' || Shopp::str_true($pricing->inventory) && $pricing->stock == 0;
                $currently = self::_taxed((double) $currently, $O, $pricing->tax, $taxes);
                $discount = 0 == $pricing->price ? 0 : 100 - round($pricing->promoprice * 100 / $pricing->price);
                $_ = new StdClass();
                $_->p = 'Donation' != $pricing->type && !$disable ? money($currently) : false;
                $_->l = $pricing->label;
                $_->i = Shopp::str_true($pricing->inventory);
                $_->s = $_->i ? (int) $pricing->stock : false;
                $_->u = $pricing->sku;
                $_->tax = Shopp::str_true($pricing->tax);
                $_->t = $pricing->type;
                $_->r = $pricing->promoprice != $pricing->price ? money($pricing->price) : false;
                $_->d = $discount > 0 ? $discount : false;
                if (!$disable || 'show' == $disabled) {
                    $string .= '<option value="' . $pricing->id . '"' . ($disable ? ' disabled="disabled"' : '') . '>' . esc_html(self::_variant_formatlabel($format, $_)) . '</option>' . "\n";
                }
            }
            $string .= '</select>';
            if (!empty($options['after_menu'])) {
                $string .= $options['after_menu'] . "\n";
            }
        } else {
            if (!isset($O->options)) {
                return;
//.........这里部分代码省略.........
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:101,代码来源:product.php


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