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


PHP Shopp::inputattrs方法代码示例

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


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

示例1: payoptions


//.........这里部分代码省略.........
  **/
 public static function payoptions($result, $options, $O)
 {
     $select_attrs = array('title', 'class', 'disabled', 'required', 'size', 'tabindex', 'accesskey');
     if ($O->Cart->orderisfree()) {
         return false;
     }
     $Payments = $O->Payments;
     $payment_methods = apply_filters('shopp_payment_methods', $Payments->count());
     if ($payment_methods <= 1) {
         return false;
     }
     // Skip if only one gateway is active
     $defaults = array('default' => null, 'exclude' => false, 'type' => 'menu', 'mode' => false, 'logos' => false);
     $options = array_merge($defaults, $options);
     extract($options, EXTR_SKIP);
     unset($options['type']);
     if ($mode === 'loop') {
         if (!isset($O->_pay_loop)) {
             $Payments->rewind();
             $O->_pay_loop = true;
         } else {
             $Payments->next();
         }
         if (false !== $Payments->current()) {
             return true;
         } else {
             unset($O->_pay_loop);
             return false;
         }
     }
     $excludes = array_map('sanitize_title_with_dashes', explode(',', $exclude));
     $payoptions = $Payments->keys();
     $payoptions = array_diff($payoptions, $excludes);
     if (!$Payments->userset()) {
         $Payments->selected($default);
     }
     $SelectedPayment = $Payments->selected();
     $output = '';
     switch ($type) {
         case "list":
             $output .= '<span><ul>';
             if ($logos) {
                 // Add payment logos
                 $logos = explode(' ', strtolower($logos));
                 $logoclasses = array('shoppui-cards');
                 foreach ($logos as $ls) {
                     if (in_array($ls, array('icon', 'small', 'big', 'huge', 'shadow'))) {
                         $logoclasses[] = $ls;
                     }
                 }
                 $logoclasses = join(' ', $logoclasses);
             }
             foreach ($payoptions as $value) {
                 if (in_array($value, $excludes)) {
                     continue;
                 }
                 $Payoption = $Payments->get($value);
                 $options['value'] = $value;
                 $options['checked'] = $SelectedPayment->slug == $Payoption->slug ? true : false;
                 if (false === $options['checked']) {
                     unset($options['checked']);
                 }
                 $label = $Payoption->label;
                 if ($logos) {
                     $label = '&nbsp;<span class="' . esc_attr($logoclasses) . '">';
                     if (empty($Payoption->cards)) {
                         $label .= '<span class="shoppui-' . esc_attr($Payoption->slug) . '">' . esc_html($Payoption->label) . '</span>&nbsp;';
                     } else {
                         foreach ($Payoption->cards as $card) {
                             $label .= '<span class="shoppui-' . esc_attr($card) . '">' . esc_html($card) . '</span>';
                         }
                     }
                     $label .= '</span>';
                 }
                 $output .= '<li><label><input type="radio" name="paymethod" ' . Shopp::inputattrs($options) . ' /> ' . $label . '</label></li>';
             }
             $output .= '</ul></span>';
             break;
         case "hidden":
             if (!isset($options['value']) && $default) {
                 $options['value'] = $O->paymethod;
             }
             $output .= '<input type="hidden" name="paymethod"' . Shopp::inputattrs($options) . ' />';
             break;
         default:
             $output .= '<select name="paymethod" ' . Shopp::inputattrs($options, $select_attrs) . '>';
             foreach ($payoptions as $value) {
                 if (in_array($value, $excludes)) {
                     continue;
                 }
                 $Payoption = $Payments->get($value);
                 $selected = $SelectedPayment->slug == $Payoption->slug ? ' selected="selected"' : '';
                 $output .= '<option value="' . $value . '"' . $selected . '>' . $Payoption->label . '</option>';
             }
             $output .= '</select>';
             break;
     }
     return $output;
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:101,代码来源:checkout.php

示例2: inputattrs

/**
 * @deprecated Use Shopp::inputattrs()
 **/
function inputattrs($options, $allowed = array())
{
    return Shopp::inputattrs($options, $allowed);
}
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:7,代码来源:Core.php


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