本文整理汇总了PHP中inputattrs函数的典型用法代码示例。如果您正苦于以下问题:PHP inputattrs函数的具体用法?PHP inputattrs怎么用?PHP inputattrs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了inputattrs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: button
/**
* Renders a styled button element
*
* @author Jonathan Davis
* @since 1.1
*
* @param int $column The table column to add the element to
* @param array $attributes Element attributes; requires a 'name' attribute
*
* @return void
**/
public function button($column = 0, array $attributes = array())
{
$defaults = array('type' => 'button', 'label' => '', 'disabled' => false, 'content' => __('Button', 'Shopp'), 'value' => '', 'class' => '');
$attributes = array_merge($defaults, $attributes);
$attributes['id'] = "{$this->id}-" . sanitize_title_with_dashes($attributes['name']);
$attributes['class'] = 'button-secondary' . ('' == $attributes['class'] ? '' : ' ' . $attributes['class']);
extract($attributes);
$this->ui('<button type="' . $type . '" name="' . $name . '" id="' . $id . '"' . inputattrs($attributes) . '>' . $content . '</button>', $column);
if (!empty($label)) {
$this->ui('<br /><label for="' . $id . '">' . $label . '</label>', $column);
}
}
示例2: submit
/**
* submit
*
* replaces the submit button the checkout form with a PayPal checkout button image
*
* @author Jonathan Davis
* @since 1.1
*
* @return array The modified list of button tags
**/
public function submit($tag = false, array $options = array(), array $attrs = array())
{
$tag[$this->settings['label']] = '<input type="image" name="process" src="' . esc_url($this->buttonurl()) . '" class="checkout-button" ' . inputattrs($options, $attrs) . ' />';
return $tag;
}
示例3: tag
//.........这里部分代码省略.........
'type' => 'hidden',
'option' => 'ecart',
'blog_option' => __('Search the blog','Ecart'),
'shop_option' => __('Search the shop','Ecart'),
'label_before' => '',
'label_after' => '',
'checked' => false
);
$options = array_merge($defaults,$options);
extract($options);
$searching = is_search(); // Flag when searching (the blog or ecart)
$shopsearch = ($Storefront !== false && $Storefront->searching); // Flag when searching ecart
$allowed = array("accesskey","alt","checked","class","disabled","format", "id",
"minlength","maxlength","readonly","required","size","src","tabindex","title","value");
$options['value'] = ($option == "ecart");
// Reset the checked option
unset($options['checked']);
// If searching the blog, check the non-store search option
if ($searching && !$shopsearch && $option != "ecart") $options['checked'] = "checked";
// If searching the storefront, mark the store search option
if ($shopsearch && $option == "ecart") $options['checked'] = "checked";
// Override any other settings with the supplied default 'checked' option
if (!$searching && $checked) $options['checked'] = $checked;
switch ($type) {
case "checkbox":
$input = '<input type="checkbox" name="catalog"'.inputattrs($options,$allowed).' />';
break;
case "radio":
$input = '<input type="radio" name="catalog"'.inputattrs($options,$allowed).' />';
break;
case "menu":
$allowed = array("accesskey","alt","class","disabled","format", "id",
"readonly","required","size","tabindex","title");
$input = '<select name="catalog"'.inputattrs($options,$allowed).'>';
$input .= '<option value="">'.$blog_option.'</option>';
$input .= '<option value="1"'.($shopsearch || (!$searching && $option == 'ecart')?' selected="selected"':'').'>'.$shop_option.'</option>';
$input .= '</select>';
break;
default:
$allowed = array("alt","class","disabled","format","id","readonly","title","value");
$input = '<input type="hidden" name="catalog"'.inputattrs($options,$allowed).' />';
break;
}
$before = (!empty($label_before))?'<label>'.$label_before:'<label>';
$after = (!empty($label_after))?$label_after.'</label>':'</label>';
return $before.$input.$after;
break;
case "zoom-options":
$defaults = array( // Colorbox 1.3.15
'transition' => 'elastic', // The transition type. Can be set to 'elastic', 'fade', or 'none'.
'speed' => 350, // Sets the speed of the fade and elastic transitions, in milliseconds.
'href' => false, // This can be used as an alternative anchor URL or to associate a URL for non-anchor elements such as images or form buttons. Example: $('h1').colorbox({href:'welcome.html'})
'title' => false, // This can be used as an anchor title alternative for ColorBox.
'rel' => false, // This can be used as an anchor rel alternative for ColorBox. This allows the user to group any combination of elements together for a gallery, or to override an existing rel so elements are not grouped together. Example: $('#example a').colorbox({rel:'group1'}) Note: The value can also be set to 'nofollow' to disable grouping.
'width' => false, // Set a fixed total width. This includes borders and buttons. Example: '100%', '500px', or 500
'height' => false, // Set a fixed total height. This includes borders and buttons. Example: '100%', '500px', or 500
示例4: state
/**
* Helper method to render markup for state/province input fields
*
* @internal
* @since 1.3
*
* @param string $result The output
* @param array $options The options
* - **mode**: `input` (input, value) Displays the field `input` or the current value of the property
* - **type**: `menu` (menu, text) Changes the input type to a drop-down menu or text input field
* - **options**: A comma-separated list of options for the drop-down menu when the **type** is set to `menu`
* - **required**: `auto` (auto,on,off) Sets the field to be required automatically, always `on` or disabled `off`
* - **class**: The class attribute specifies one or more class-names for the input
* - **label**: The label shown as the default option of the drop-down menu when the **type** is set to `menu`
* - **address**: `billing` (billing,shipping) Used to specify which address the field takes input for
* @param ShoppCustomer $O The working object
* @return string The state input markup
**/
private static function state($result, $options, $O)
{
$defaults = array('mode' => 'input', 'type' => 'menu', 'options' => '', 'required' => 'auto', 'class' => '', 'label' => '', 'address' => 'billing');
$options = array_merge($defaults, $options);
$options['address'] = self::valid_address($options['address']);
$Address = self::AddressObject($options['address']);
if (!isset($options['value'])) {
$options['value'] = $Address->state;
}
$options['selected'] = $options['value'];
$options['id'] = "{$options['address']}-state";
extract($options, EXTR_SKIP);
if ('value' == $mode) {
return $value;
}
$countries = (array) shopp_setting('target_markets');
$select_attrs = array('title', 'required', 'class', 'disabled', 'required', 'size', 'tabindex', 'accesskey');
$country = ShoppBaseLocale()->country();
if (!empty($Address->country)) {
$country = $Address->country;
}
if (!array_key_exists($country, $countries)) {
$country = key($countries);
}
$regions = Lookup::country_zones();
$states = isset($regions[$country]) ? $regions[$country] : array();
if (!empty($options['options']) && empty($states)) {
$states = explode(',', $options['options']);
}
$classes = false === strpos($class, ' ') ? explode(' ', $class) : array();
$classes[] = $id;
if ('auto' == $required) {
unset($options['required']);
// prevent inputattrs from handling required=auto
$classes[] = 'auto-required';
}
$options['class'] = join(' ', $classes);
if ('text' == $type) {
return '<input type="text" name="' . $address . '[state]" id="' . $id . '" ' . inputattrs($options) . '/>';
}
$options['disabled'] = 'disabled';
$options['class'] = join(' ', array_merge($classes, array('disabled', 'hidden')));
$result = '<select name="' . $address . '[state]" id="' . $id . '-menu" ' . inputattrs($options, $select_attrs) . '>' . '<option value="">' . $label . '</option>' . (!empty($states) ? menuoptions($states, $selected, true) : '') . '</select>';
unset($options['disabled']);
$options['class'] = join(' ', $classes);
$result .= '<input type="text" name="' . $address . '[state]" id="' . $id . '" ' . inputattrs($options) . '/>';
return $result;
}
示例5: checkouttag
//.........这里部分代码省略.........
$errors = $this->data->Errors->get(SHOPP_COMM_ERR);
foreach ((array) $errors as $error) {
if (!empty($error)) {
$result .= $error->message();
}
}
return $result;
// if (isset($options['show']) && $options['show'] == "code") return $this->data->OrderError->code;
// return $this->data->OrderError->message;
break;
case "cart-summary":
ob_start();
include SHOPP_TEMPLATES . "/summary.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
break;
case "loggedin":
return $this->data->login;
break;
case "notloggedin":
return !$this->data->login && $Shopp->Settings->get('account_system') != "none";
break;
case "email-login":
// Deprecating
// Deprecating
case "loginname-login":
// Deprecating
// Deprecating
case "account-login":
if (!empty($_POST['account-login'])) {
$options['value'] = $_POST['account-login'];
}
return '<input type="text" name="account-login" id="account-login"' . inputattrs($options) . ' />';
break;
case "password-login":
if (!empty($_POST['password-login'])) {
$options['value'] = $_POST['password-login'];
}
return '<input type="password" name="password-login" id="password-login" ' . inputattrs($options) . ' />';
break;
case "submit-login":
// Deprecating
// Deprecating
case "login-button":
$string = '<input type="hidden" name="process-login" id="process-login" value="false" />';
$string .= '<input type="submit" name="submit-login" id="submit-login" ' . inputattrs($options) . ' />';
return $string;
break;
case "firstname":
if ($options['mode'] == "value") {
return $this->data->Order->Customer->firstname;
}
if (!empty($this->data->Order->Customer->firstname)) {
$options['value'] = $this->data->Order->Customer->firstname;
}
return '<input type="text" name="firstname" id="firstname" ' . inputattrs($options) . ' />';
break;
case "lastname":
if ($options['mode'] == "value") {
return $this->data->Order->Customer->lastname;
}
if (!empty($this->data->Order->Customer->lastname)) {
$options['value'] = $this->data->Order->Customer->lastname;
}
return '<input type="text" name="lastname" id="lastname" ' . inputattrs($options) . ' />';
示例6: submit
/**
* Provides the checkout form submit button markup
*
* @api `shopp('checkout.submit')`
* @since 1.0
*
* @param string $result The output
* @param array $options The options
* - **accesskey**: Specifies a shortcut key to activate/focus an element. Linux/Windows: `[Alt]`+`accesskey`, Mac: `[Ctrl]``[Opt]`+`accesskey`
* - **class**: `checkout-button` The class attribute specifies one or more class-names for an element
* - **disabled**: Specifies that an `<input>` element should be disabled
* - **tabindex**: Specifies the tabbing order of an element
* - **title**: Specifies extra information about an element
* - **label**: `Submit Order` Specifies the label of the submit button element
* - **wrapclass**: The class attribute for the submit button `<span>` wrapper
* @param ShoppOrder $O The working object
* @return string The submit button markup
**/
public static function submit($result, $options, $O)
{
$submit_attrs = array('title', 'class', 'label', 'value', 'disabled', 'tabindex', 'accesskey');
if (!isset($options['label'])) {
$options['label'] = Shopp::__('Submit Order');
}
$options['class'] = isset($options['class']) ? $options['class'] . ' checkout-button' : 'checkout-button';
$wrapclass = '';
if (isset($options['wrapclass'])) {
$wrapclass = ' ' . $options['wrapclass'];
}
$buttons = array('<input type="submit" name="process" id="checkout-button" ' . inputattrs($options, $submit_attrs) . ' />');
if (!$O->Cart->orderisfree()) {
$buttons = apply_filters('shopp_checkout_submit_button', $buttons, $options, $submit_attrs);
}
$_ = array();
foreach ($buttons as $label => $button) {
$_[] = '<span class="payoption-button payoption-' . sanitize_title_with_dashes($label) . ($label === 0 ? $wrapclass : '') . '">' . $button . '</span>';
}
return join("\n", $_);
}
示例7: update_button
/**
* Display a cart update button
*
* When a shopper clicks the update button, the cart is submitted and all
* cart totals are recalculated.
*
* @api `shopp('cart.update-button')`
* @since 1.0
*
* @param string $result The output
* @param array $options The options
* @param ShoppCart $O The working object
* - **autocomplete**: (on, off) Specifies whether an `<input>` element should have autocomplete enabled
* - **accesskey**: Specifies a shortcut key to activate/focus an element. Linux/Windows: `[Alt]`+`accesskey`, Mac: `[Ctrl]``[Opt]`+`accesskey`
* - **class**: The class attribute specifies one or more class-names for an element
* - **disabled**: Specifies that an `<input>` element should be disabled
* - **placeholder**: Specifies a short hint that describes the expected value of an `<input>` element
* - **required**: Adds a class that specified an input field must be filled out before submitting the form, enforced by JS
* - **tabindex**: Specifies the tabbing order of an element
* - **title**: Specifies extra information about an element
* - **label**: Specifies the button label value
* @return string The markup for the update button
*/
public static function update_button($result, $options, $O)
{
$submit_attrs = array('title', 'value', 'disabled', 'tabindex', 'accesskey', 'class', 'autocomplete', 'placeholder', 'required');
$defaults = array('label' => Shopp::__('Update Subtotal'), 'class' => 'update-button');
$options = array_merge($defaults, $options);
if (false !== strpos($options['class'], 'update-button')) {
$options['class'] .= ' update-button';
}
return '<input type="submit" name="update"' . inputattrs($options, $submit_attrs) . ' />';
}
示例8: update_button
/**
* Provides markup for a submit button to update shipping estimates
*
* By default this button is hidden unless the JS environment is unavailable (disabled or broken).
*
* @api `shopp('shipping.update-button')`
* @since 1.2
*
* @param string $result The output
* @param array $options The options
* - **label**: `Update Shipping` The label for the submit button
* - **class**: `update-button hide-if-js`
* - **autocomplete**: (on, off) Specifies whether an `<input>` element should have autocomplete enabled
* - **accesskey**: Specifies a shortcut key to activate/focus an element. Linux/Windows: `[Alt]`+`accesskey`, Mac: `[Ctrl]``[Opt]`+`accesskey`
* - **class**: The class attribute specifies one or more class-names for an element
* - **disabled**: Specifies that an `<input>` element should be disabled
* - **placeholder**: Specifies a short hint that describes the expected value of an `<input>` element
* - **required**: Adds a class that specified an input field must be filled out before submitting the form, enforced by JS
* - **tabindex**: Specifies the tabbing order of an element
* - **title**: Specifies extra information about an element
* @param ShoppShiprates $O The working object
* @return string The button markup
**/
public static function update_button($result, $options, $O)
{
$submit_attrs = array('title', 'label', 'disabled', 'tabindex', 'accesskey', 'class');
$stdclasses = 'update-button hide-if-js';
$defaults = array('label' => Shopp::__('Update Shipping'), 'class' => '');
$options = array_merge($defaults, $options);
$options['class'] .= " {$stdclasses}";
return '<input type="submit" name="update-shipping"' . inputattrs($options, $submit_attrs) . ' />';
}
示例9: tag
//.........这里部分代码省略.........
$result .= '<select name="products[' . $this->id . '][quantity]" id="quantity-' . $this->id . '">';
foreach ($qtys as $qty) {
$amount = $qty;
$selected = isset($this->quantity) ? $this->quantity : 1;
if ($variation->type == "Donation" && $variation->donation['var'] == "on") {
if ($variation->donation['min'] == "on" && $amount < $variation->price) {
continue;
}
$amount = money($amount);
$selected = $variation->price;
} else {
if ($this->inventory && $amount > $this->pricerange['max']['stock']) {
continue;
}
}
$result .= '<option' . ($qty == $selected ? ' selected="selected"' : '') . ' value="' . $qty . '">' . $amount . '</option>';
}
$result .= '</select>';
if ($options['labelpos'] == "after") {
$result .= " {$label}";
}
return $result;
}
if (valid_input($options['input'])) {
if (!isset($options['size'])) {
$options['size'] = 3;
}
if ($variation->type == "Donation" && $variation->donation['var'] == "on") {
if ($variation->donation['min']) {
$options['value'] = $variation->price;
}
$options['class'] .= " currency";
}
$result = '<input type="' . $options['input'] . '" name="products[' . $this->id . '][quantity]" id="quantity-' . $this->id . '"' . inputattrs($options) . ' />';
}
if ($options['labelpos'] == "after") {
$result .= " {$label}";
}
return $result;
break;
case "input":
if (!isset($options['type']) || $options['type'] != "menu" && $options['type'] != "textarea" && !valid_input($options['type'])) {
$options['type'] = "text";
}
if (!isset($options['name'])) {
return "";
}
if ($options['type'] == "menu") {
$result = '<select name="products[' . $this->id . '][data][' . $options['name'] . ']" id="data-' . $options['name'] . '-' . $this->id . '">';
if (isset($options['options'])) {
$menuoptions = preg_split('/,(?=(?:[^\\"]*\\"[^\\"]*\\")*(?![^\\"]*\\"))/', $options['options']);
}
if (is_array($menuoptions)) {
foreach ($menuoptions as $option) {
$selected = "";
$option = trim($option, '"');
if (isset($options['default']) && $options['default'] == $option) {
$selected = ' selected="selected"';
}
$result .= '<option value="' . $option . '"' . $selected . '>' . $option . '</option>';
}
}
$result .= '</select>';
} elseif ($options['type'] == "textarea") {
if (isset($options['cols'])) {
$cols = ' cols="' . $options['cols'] . '"';
示例10: tag
function tag($id, $property, $options = array())
{
global $Shopp;
// Return strings with no options
switch ($property) {
case "id":
return $id;
case "name":
return $this->name;
case "link":
case "url":
return SHOPP_PERMALINKS ? $Shopp->shopuri . $this->slug : add_query_arg('shopp_pid', $this->product, $Shopp->shopuri);
case "sku":
return $this->sku;
}
$taxes = false;
if (isset($options['taxes'])) {
$taxes = $options['taxes'];
}
if ($property == "unitprice" || $property == "total" || $property == "options") {
$taxrate = shopp_taxrate($taxes, $this->taxable);
}
// Handle currency values
$result = "";
switch ($property) {
case "unitprice":
$result = (double) $this->unitprice + $this->unitprice * $taxrate;
break;
case "total":
$result = (double) $this->total + $this->total * $taxrate;
break;
case "tax":
$result = (double) $this->tax;
break;
}
if (is_float($result)) {
if (isset($options['currency']) && !value_is_true($options['currency'])) {
return $result;
} else {
return money($result);
}
}
// Handle values with complex options
switch ($property) {
case "quantity":
$result = $this->quantity;
if ($this->type == "Donation" && $this->donation['var'] == "on") {
return $result;
}
if (isset($options['input']) && $options['input'] == "menu") {
if (!isset($options['value'])) {
$options['value'] = $this->quantity;
}
if (!isset($options['options'])) {
$values = "1-15,20,25,30,35,40,45,50,60,70,80,90,100";
} else {
$values = $options['options'];
}
if (strpos($values, ",") !== false) {
$values = explode(",", $values);
} else {
$values = array($values);
}
$qtys = array();
foreach ($values as $value) {
if (strpos($value, "-") !== false) {
$value = explode("-", $value);
if ($value[0] >= $value[1]) {
$qtys[] = $value[0];
} else {
for ($i = $value[0]; $i < $value[1] + 1; $i++) {
$qtys[] = $i;
}
}
} else {
$qtys[] = $value;
}
}
$result = '<select name="items[' . $id . '][' . $property . ']">';
foreach ($qtys as $qty) {
$result .= '<option' . ($qty == $this->quantity ? ' selected="selected"' : '') . ' value="' . $qty . '">' . $qty . '</option>';
}
$result .= '</select>';
} elseif (isset($options['input']) && valid_input($options['input'])) {
if (!isset($options['size'])) {
$options['size'] = 5;
}
if (!isset($options['value'])) {
$options['value'] = $this->quantity;
}
$result = '<input type="' . $options['input'] . '" name="items[' . $id . '][' . $property . ']" id="items-' . $id . '-' . $property . '" ' . inputattrs($options) . '/>';
} else {
$result = $this->quantity;
}
break;
case "remove":
$label = __("Remove");
if (isset($options['label'])) {
$label = $options['label'];
}
//.........这里部分代码省略.........
示例11: button
public static function button($button, $name, array $options = array())
{
$buttons = array('add' => array('class' => 'add', 'title' => Shopp::__('Add'), 'icon' => 'shoppui-plus', 'type' => 'submit'), 'delete' => array('class' => 'delete', 'title' => Shopp::__('Delete'), 'icon' => 'shoppui-minus', 'type' => 'submit'));
if (isset($buttons[$button])) {
$options = array_merge($buttons[$button], $options);
}
$types = array('submit', 'button');
if (!in_array($options['type'], $types)) {
$options['type'] = 'submit';
}
$type = $options['type'];
$title = $options['title'];
$icon = $options['icon'];
return '<button type="' . $type . '" name="' . $name . '"' . inputattrs($options) . '><span class="' . $icon . '"><span class="hidden">' . $title . '</span></span></button>';
}
示例12: submit
function submit ($tag=false,$options=array(),$attrs=array()) {
$tag[$this->settings['label']] = '<input type="image" name="process" src="'.$this->buttonurl.'" '.inputattrs($options,$attrs).' />';
return $tag;
}
示例13: submit
function submit ($tag=false,$options=array(),$attrs=array()) {
$type = "live";
if ($this->settings['testmode'] == "on") $type = "test";
$buttonuri = $this->urls['button'][$type];
$buttonuri .= '?merchant_id='.$this->settings['id'];
$buttonuri .= '&'.$this->settings['button'];
$buttonuri .= '&style='.$this->settings['buttonstyle'];
$buttonuri .= '&variant=text';
$buttonuri .= '&loc='.$this->settings['location'];
$tag[$this->settings['label']] = '<input type="image" name="process" src="'.$buttonuri.'" '.inputattrs($options,$attrs).' />';
return $tag;
}
示例14: submit
function submit($tag = false, $options = array(), $attrs = array())
{
$tag[$this->settings['label']] = '<span class="billmate_cardpay"><span class="col2" style="width:134px"><img src="' . content_url() . '/shopp-addons/gateways/' . $this->module . '/bm_kort_l.png"/></span><span>' . __(' Visa & MasterCard', 'shopp-billmate-cardpay') . '</span><input type="image" name="process" src="' . content_url() . '/shopp-addons/gateways/' . $this->module . '/betala_kort_knapp.gif" id="checkout-button" ' . inputattrs($options, $attrs) . ' /></span><style type="text/css">
.billmate_cardpay b,.billmate_cardpay span{
color:#888888!important
}
.billmate_cardpay {
float: right;
width: 68.3%;
text-align:left;
font-family:"Helvetica Neue",Arial,Helvetica,"Nimbus Sans L",sans-serif;
}
.billmate_cardpay span{
float: left;
padding-right: 33px;
width: 170px;
}
.billmate_cardpay img{
border:0px none!important;
}
.billmate_cardpay span{
font-size:14px;
}
.billmate_cardpay .checkout-button{
clear: right;
float: right;
}
</style>
<script type="text/javascript">
jQuery(document).ready(function(){
setTimeout(function(){
var maxBillmateCardPay = 0;
jQuery(".shopp.shipmethod").each(function(){
var val = parseInt( jQuery(this).parent().find("strong").html().replace(",00 kr",""));
if(val > maxBillmateCardPay && jQuery(this).attr("checked")!= "checked" ){
jQuery(".shopp.shipmethod").removeAttr("checked");
jQuery(this).attr("checked","checked");
jQuery(this).trigger("change");
}
});
},2000);
});
</script>';
return $tag;
}
示例15: tag
//.........这里部分代码省略.........
$currently = ($pricetag->sale == "on")?$pricetag->promoprice:$pricetag->price;
if ($taxrate > 0) $currently = $currently+($currently*$taxrate);
$string .= '<option value="'.$option['id'].'">'.$option['name'].' (+'.money($currently).')</option>'."\n";
}
$string .= '</select>';
}
if (!empty($options['after_menu'])) $string .= $options['after_menu']."\n";
}
return $string;
break;
case "donation":
case "amount":
case "quantity":
if ($this->outofstock) return false;
$inputs = array('text','menu');
$defaults = array(
'value' => 1,
'input' => 'text', // accepts text,menu
'labelpos' => 'before',
'label' => '',
'options' => '1-15,20,25,30,40,50,75,100',
'size' => 3
);
$options = array_merge($defaults,$options);
$_options = $options;
extract($options);
unset($_options['label']); // Interferes with the text input value when passed to inputattrs()
$labeling = '<label for="quantity-'.$this->id.'">'.$label.'</label>';
if (!isset($this->_prices_loop)) reset($this->prices);
$variation = current($this->prices);
$_ = array();
if ("before" == $labelpos) $_[] = $labeling;
if ("menu" == $input) {
if ($this->inventory && $this->max['stock'] == 0) return "";
if (strpos($options,",") !== false) $options = explode(",",$options);
else $options = array($options);
$qtys = array();
foreach ((array)$options as $v) {
if (strpos($v,"-") !== false) {
$v = explode("-",$v);
if ($v[0] >= $v[1]) $qtys[] = $v[0];
else for ($i = $v[0]; $i < $v[1]+1; $i++) $qtys[] = $i;
} else $qtys[] = $v;
}
$_[] = '<select name="products['.$this->id.'][quantity]" id="quantity-'.$this->id.'">';
foreach ($qtys as $qty) {
$amount = $qty;
$selection = (isset($this->quantity))?$this->quantity:1;
if ($variation->type == "Donation" && $variation->donation['var'] == "on") {
if ($variation->donation['min'] == "on" && $amount < $variation->price) continue;
$amount = money($amount);
$selection = $variation->price;
} else {
if ($this->inventory && $amount > $this->max['stock']) continue;
}