本文整理汇总了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 = ' <span class="' . esc_attr($logoclasses) . '">';
if (empty($Payoption->cards)) {
$label .= '<span class="shoppui-' . esc_attr($Payoption->slug) . '">' . esc_html($Payoption->label) . '</span> ';
} 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;
}
示例2: inputattrs
/**
* @deprecated Use Shopp::inputattrs()
**/
function inputattrs($options, $allowed = array())
{
return Shopp::inputattrs($options, $allowed);
}