本文整理汇总了PHP中menuoptions函数的典型用法代码示例。如果您正苦于以下问题:PHP menuoptions函数的具体用法?PHP menuoptions怎么用?PHP menuoptions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了menuoptions函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rules_meta_box
function rules_meta_box ($Promotion) {
$targets = array(
'Cart' => __('shopping cart','Ecart'),
);
$target = '<select name="target" id="promotion-target" class="small">';
$target .= menuoptions($targets,$Promotion->target,true);
$target .= '</select>';
if (empty($Promotion->search)) $Promotion->search = "all";
$logic = '<select name="search" class="small">';
$logic .= menuoptions(array('any'=>__('any','Ecart'),'all' => __('all','Ecart')),$Promotion->search,true);
$logic .= '</select>';
?>
<p><strong><?php printf(__('Apply discount to %s','Ecart'),$target,$logic); ?> <strong id="target-property"></strong></strong></p>
<table class="form-table" id="cartitem"></table>
<p><strong><?php printf(__('When %s of these conditions match the','Ecart'),$logic); ?> <strong id="rule-target">:</strong></strong></p>
<table class="form-table" id="rules"></table>
<?php
}
示例2: save_meta_box
function save_meta_box ($Product) {
global $Ecart;
$workflows = array(
"continue" => __('Continue Editing','Ecart'),
"close" => __('Products Manager','Ecart'),
"new" => __('New Product','Ecart'),
"next" => __('Edit Next','Ecart'),
"previous" => __('Edit Previous','Ecart')
);
$date_format = get_option('date_format');
$time_format = get_option('time_format');
?>
<div id="misc-publishing-actions">
<input type="hidden" name="id" value="<?php echo $Product->id; ?>" />
<div class="misc-pub-section misc-pub-section-last">
<input type="hidden" name="status" value="draft" /><input type="checkbox" name="status" value="publish" id="published" tabindex="11" <?php if ($Product->status == "publish") echo ' checked="checked"'?> /><label for="published"><strong> <?php if ($Product->published() && !empty($Product->id)) _e('Published','Ecart'); else _e('Publish','Ecart'); ?></strong> <span id="publish-status"><?php if ($Product->publish>1) printf(__('on: %s'),"</span><br />".date($date_format.' @ '.$time_format,$Product->publish)); else echo "</span>"; ?></label> <span id="schedule-toggling"><div style="display:none !important;"><button type="button" name="schedule-toggle" id="schedule-toggle" class="button-secondary"><?php if ($Product->publish>1) _e('Edit','Ecart'); else _e('Schedule','Ecart'); ?></button></div></span>
<div id="scheduling">
<div id="schedule-calendar" class="calendar-wrap">
<?php
$dateorder = date_format_order(true);
foreach ($dateorder as $type => $format):
if ($previous == "s" && $type[0] == "s") continue;
if ("month" == $type): ?><input type="text" name="publish[month]" id="publish-month" title="<?php _e('Month','Ecart'); ?>" size="2" maxlength="2" value="<?php echo ($Product->publish>1)?date("n",$Product->publish):''; ?>" class="publishdate selectall" /><?php elseif ("day" == $type): ?><input type="text" name="publish[date]" id="publish-date" title="<?php _e('Day','Ecart'); ?>" size="2" maxlength="2" value="<?php echo ($Product->publish>1)?date("j",$Product->publish):''; ?>" class="publishdate selectall" /><?php elseif ("year" == $type): ?><input type="text" name="publish[year]" id="publish-year" title="<?php _e('Year','Ecart'); ?>" size="4" maxlength="4" value="<?php echo ($Product->publish>1)?date("Y",$Product->publish):''; ?>" class="publishdate selectall" /><?php elseif ($type[0] == "s"): echo "/"; endif; $previous = $type[0]; ?><?php endforeach; ?>
<br />
<input type="text" name="publish[hour]" id="publish-hour" title="<?php _e('Hour','Ecart'); ?>" size="2" maxlength="2" value="<?php echo ($Product->publish>1)?date("g",$Product->publish):date('g'); ?>" class="publishdate selectall" />:<input type="text" name="publish[minute]" id="publish-minute" title="<?php _e('Minute','Ecart'); ?>" size="2" maxlength="2" value="<?php echo ($Product->publish>1)?date("i",$Product->publish):date('i'); ?>" class="publishdate selectall" />
<select name="publish[meridiem]" class="publishdate">
<?php echo menuoptions(array('AM' => __('AM','Ecart'),'PM' => __('PM','Ecart')),date('A',$Product->publish),true); ?>
</select>
</div>
</div>
</div>
</div>
<div id="major-publishing-actions">
<select name="settings[workflow]" id="workflow">
<?php echo menuoptions($workflows,$Ecart->Settings->get('workflow'),true); ?>
</select>
<input type="submit" class="button-primary" name="save" value="<?php _e('Save Product','Ecart'); ?>" />
</div>
<?php
}
示例3: save_meta_box
function save_meta_box($Product)
{
global $Shopp;
$workflows = array("continue" => __('Continue Editing', 'Shopp'), "close" => __('Products Manager', 'Shopp'), "new" => __('New Product', 'Shopp'), "next" => __('Edit Next', 'Shopp'), "previous" => __('Edit Previous', 'Shopp'));
?>
<div><input type="hidden" name="id" value="<?php
echo $Product->id;
?>
" /></div>
<div id="major-publishing-actions">
<select name="settings[workflow]" id="workflow">
<?php
echo menuoptions($workflows, $Shopp->Settings->get('workflow'), true);
?>
</select>
<input type="submit" class="button-primary" name="save" value="<?php
_e('Save Product', 'Shopp');
?>
" />
</div>
<?php
}
示例4: _e
<div class="optionrow fix">
<div class="optiontitle fix">
<strong><label for="showcase-order"><?php _e('Product Images Order','Ecart'); ?></label></strong><br>
</div>
<div class="theinputs">
<div class="optioninputs">
<br/>
<select name="settings[product_image_order]" id="showcase-order">
<?php echo menuoptions($orderOptions,$this->Settings->get('product_image_order'),true); ?>
</select> by
<select name="settings[product_image_orderby]" id="showcase-orderby">
<?php echo menuoptions($orderBy,$this->Settings->get('product_image_orderby'),true); ?>
</select>
<br />
<br>
<br>
</div>
</div>
<div class="theexplanation">
<div class="context"></div>
<p><?php _e('Set the default display order of your product pictures.','Ecart'); ?></p>
</div>
<div class="clear"></div>
示例5: shortcode
/**
* ecartregcust::shortcode()
*
* @return
*/
public function shortcode()
{
$data = array();
$data['show_form'] = true;
$data['ecart_account_type'] = $this->ecart_account_type;
$this->show_billing = (isset($this->options['ecartreg_show_billing']) && $this->options['ecartreg_show_billing'] == 1) ? true : false;
global $Ecart;
$base = $Ecart->Settings->get('base_operations');
$countries = $Ecart->Settings->get('target_markets');
$selected_country = (isset($_POST['billing']['country'])) ? $_POST['billing']['country'] : $base['country'];
$data['countries_select_html'] = menuoptions($countries,$selected_country,true);
$data['show_billing'] = $this->show_billing;
if (isset($_POST['customer']))
{
$user = $this->add_user();
if (!$user)
{
$data['form_error'] = $this->form_error;
}
else
{
$this->user = $user;
$data['show_form'] = false;
$data['form_success'] = 'Thank you for registering.';
do_action('scr_registration_success');
}
}
$html = $this->view('library.register.form.php', $data);
return ($html !== false) ? $html : '';
}
示例6: 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;
}
示例7: _e
<td scope="row" valign="top" class="rate"><input type="text" name="settings[taxrates][${id}][rate]" id="tax-rate" value="${rate}" size="7" class="selectall" tabindex="1" /><br /><label for="tax-rate"><?php
_e('Tax Rate', 'Shopp');
?>
</label><br />
<input type="hidden" name="settings[taxrates][${id}][compound]" value="off" /><label><input type="checkbox" id="tax-compound" name="settings[taxrates][${id}][compound]" value="on" ${compounded} tabindex="4" /> <?php
Shopp::_e('Compound');
?>
</label></td>
<td scope="row" class="conditions">
<select name="settings[taxrates][${id}][country]" class="country" tabindex="2">${countries}</select><select name="settings[taxrates][${id}][zone]" class="zone no-zones" tabindex="3">${zones}</select>
<?php
echo ShoppUI::button('add', 'addrule');
?>
<?php
$options = array('any' => Shopp::__('any'), 'all' => strtolower(Shopp::__('All')));
$menu = '<select name="settings[taxrates][${id}][logic]" class="logic">' . menuoptions($options, false, true) . '</select>';
?>
<div class="conditionals no-conditions">
<p><label><?php
printf(__('Apply tax rate when %s of the following conditions match', 'Shopp'), $menu);
?>
:</label></p>
<ul>
${conditions}
</ul>
</div>
</td>
<td>
<div class="local-rates panel subpanel no-local-rates">
<div class="label"><label><?php
_e('Local Rates', 'Shopp');
示例8: tag
//.........这里部分代码省略.........
$value_override = array("text","hidden","password","textarea","menu");
/// Allowable attributes for textarea inputs
$textarea_attrs = array('accesskey','title','tabindex','class','disabled','required');
if (!$name) { // Iterator for order data
if (!isset($this->_customer_info_loop)) {
reset($this->Customer->info->named);
$this->_customer_info_loop = true;
} else next($this->Customer->info->named);
if (current($this->Customer->info->named) !== false) return true;
else {
unset($this->_customer_info_loop);
return false;
}
}
if (isset($this->Customer->info->named[$name])) $info = $this->Customer->info->named[$name];
if ($name && $mode == "value") return $info;
if (!in_array($type,$allowed_types)) $type = 'hidden';
if (empty($title)) $title = $name;
$id = 'customer-info-'.sanitize_title_with_dashes($name);
if (in_array($type,$value_override) && !empty($info))
$value = $info;
switch (strtolower($type)) {
case "textarea":
return '<textarea name="info['.$name.']" cols="'.$cols.'" rows="'.$rows.'" id="'.$id.'" '.inputattrs($op,$textarea_attrs).'>'.$value.'</textarea>';
break;
case "menu":
if (is_string($options)) $options = explode(',',$options);
return '<select name="info['.$name.']" id="'.$id.'" '.inputattrs($op,$select_attrs).'>'.menuoptions($options,$value).'</select>';
break;
default:
return '<input type="'.$type.'" name="info['.$name.']" id="'.$id.'" '.inputattrs($op).' />';
break;
}
break;
// SHIPPING TAGS
case "shipping": return (!empty($this->shipped)); break;
case "shipping-address":
if ($options['mode'] == "value") return $this->Shipping->address;
if (!empty($this->Shipping->address))
$options['value'] = $this->Shipping->address;
return '<input type="text" name="shipping[address]" id="shipping-address" '.inputattrs($options).' />';
break;
case "shipping-xaddress":
if ($options['mode'] == "value") return $this->Shipping->xaddress;
if (!empty($this->Shipping->xaddress))
$options['value'] = $this->Shipping->xaddress;
return '<input type="text" name="shipping[xaddress]" id="shipping-xaddress" '.inputattrs($options).' />';
break;
case "shipping-city":
if ($options['mode'] == "value") return $this->Shipping->city;
if (!empty($this->Shipping->city))
$options['value'] = $this->Shipping->city;
return '<input type="text" name="shipping[city]" id="shipping-city" '.inputattrs($options).' />';
break;
case "shipping-province":
case "shipping-state":
if ($options['mode'] == "value") return $this->Shipping->state;
if (!isset($options['selected'])) $options['selected'] = false;
if (!empty($this->Shipping->state)) {
示例9: _e
<?php _e('Enable this to make Ecart behaviors available across all of your WordPress posts and pages.','Ecart'); ?></div>
<!-- admin logger under construction -->
<label for="error-notifications"><?php _e('Error Notifications','Ecart'); ?></label>
<ul id="error_notify">
<?php foreach ($notification_errors as $id => $level): ?>
<li><input type="checkbox" name="settings[error_notifications][]" id="error-notification-<?php echo $id; ?>" value="<?php echo $id; ?>"<?php if (in_array($id,$notifications)) echo ' checked="checked"'; ?>/><label for="error-notification-<?php echo $id; ?>"> <?php echo $level; ?></label></li>
<?php endforeach; ?>
</ul>
<label for="error-notifications"><?php _e("Send email notifications of the selected errors to the merchant's email address.","Ecart"); ?></label>
<label for="error-logging"><?php _e('Error Logging','Ecart'); ?></label>
<select name="settings[error_logging]" id="error-logging">
<?php echo menuoptions($errorlog_levels,$this->Settings->get('error_logging'),true); ?>
</select><br />
<label for="error-notifications"><?php _e("Limit logging errors up to the level of the selected error type.","Ecart"); ?></label>
<?php if (count($recentlog) > 0): ?>
<label for="error-logging"><?php _e('Error Log','Ecart'); ?></label>
<div id="errorlog"><ol><?php foreach ($recentlog as $line): ?>
<li><?php echo esc_html($line); ?></li>
<?php endforeach; ?></ol></div>
<p class="alignright"><button name="resetlog" id="resetlog" value="resetlog" class="button"><small><?php _e("Reset Log","Ecart"); ?></small></button></p>
<?php endif; ?>
示例10: tag
//.........这里部分代码省略.........
if ($Ecart->Settings->get('promo_limit') > 0 &&
count($this->discounts) >= $Ecart->Settings->get('promo_limit')) return false;
if (!isset($options['value'])) $options['value'] = __("Apply Promo Code","Ecart");
$result = '<ul><li>';
if ($Ecart->Errors->exist()) {
$result .= '<p class="error">';
$errors = $Ecart->Errors->source('CartDiscounts');
foreach ((array)$errors as $error) if (!empty($error)) $result .= $error->message(true,false);
$result .= '</p>';
}
$result .= '<span><input type="text" id="promocode" name="promocode" value="" size="10" /></span>';
$result .= '<span><input type="submit" id="apply-code" name="update" '.inputattrs($options,$submit_attrs).' /></span>';
$result .= '</li></ul>';
return $result;
case "has-shipping-methods":
return apply_filters(
'ecart_shipping_hasestimates',
(!empty($this->shipping) && !$this->noshipping),
$this->shipping
); break;
case "needs-shipped": return (!empty($this->shipped)); break;
case "hasshipcosts":
case "has-shipcosts":
case "hasship-costs":
case "has-ship-costs": return ($this->Totals->shipping > 0); break;
case "needs-shipping-estimates":
$markets = $Ecart->Settings->get('target_markets');
return (!empty($this->shipped) && !$this->noshipping && ($this->showpostcode || count($markets) > 1));
break;
case "shipping-estimates":
if (empty($this->shipped)) return "";
$base = $Ecart->Settings->get('base_operations');
$markets = $Ecart->Settings->get('target_markets');
$Shipping = &$Ecart->Order->Shipping;
if (empty($markets)) return "";
foreach ($markets as $iso => $country) $countries[$iso] = $country;
if (!empty($Shipping->country)) $selected = $Shipping->country;
else $selected = $base['country'];
$result .= '<ul><li>';
if ((isset($options['postcode']) && value_is_true($options['postcode'])) || $this->showpostcode) {
$result .= '<span>';
$result .= '<input type="text" name="shipping[postcode]" id="shipping-postcode" size="6" value="'.$Shipping->postcode.'" /> ';
$result .= '</span>';
}
if (count($countries) > 1) {
$result .= '<span>';
$result .= '<select name="shipping[country]" id="shipping-country">';
$result .= menuoptions($countries,$selected,true);
$result .= '</select>';
$result .= '</span>';
} else $result .= '<input type="hidden" name="shipping[country]" id="shipping-country" value="'.key($markets).'" />';
$result .= '<br class="clear" /></li></ul>';
return $result;
break;
}
$result = "";
switch ($property) {
case "subtotal": $result = $this->Totals->subtotal; break;
case "shipping":
if (empty($this->shipped)) return "";
if (isset($options['label'])) {
$options['currency'] = "false";
if ($this->freeshipping) {
$result = $Ecart->Settings->get('free_shipping_text');
if (empty($result)) $result = __('Free Shipping!','Ecart');
}
else $result = $options['label'];
} else {
if ($this->Totals->shipping === null)
return __("Enter Postal Code","Ecart");
elseif ($this->Totals->shipping === false)
return __("Not Available","Ecart");
else $result = $this->Totals->shipping;
}
break;
case "hastaxes":
case "has-taxes":
return ($this->Totals->tax > 0); break;
case "tax":
if ($this->Totals->tax > 0) {
if (isset($options['label'])) {
$options['currency'] = "false";
$result = $options['label'];
} else $result = $this->Totals->tax;
} else $options['currency'] = "false";
break;
case "total":
$result = $this->Totals->total;
break;
}
if (isset($options['currency']) && !value_is_true($options['currency'])) return $result;
if (is_numeric($result)) return '<span class="ecart_cart_'.$property.'">'.money($result).'</span>';
return false;
}
示例11: _e
<div class="context"></div>
<p><?php _e('Set the digital products download limit per product for your store.','Ecart'); ?></p>
</div>
<div class="clear"></div>
</div>
<!-- these settings are hidden - still under development please do not enable -->
<table class="form-table" class="notavailable" style="display:none !important;">
<tr>
<th scope="row" valign="top"><label for="download-timelimit"><?php _e('Time Limit','Ecart'); ?></label></th>
<td><select name="settings[download_timelimit]" id="download-timelimit">
<option value=""><?php _e('No Limit','Ecart'); ?></option>
<?php echo menuoptions($time,$this->Settings->get('download_timelimit'),true); ?>
</select>
</td>
</tr>
<tr>
<th scope="row" valign="top"><label for="download-restriction"><?php _e('IP Restriction','Ecart'); ?></label></th>
<td><input type="hidden" name="settings[download_restriction]" value="off" />
<label for="download-restriction"><input type="checkbox" name="settings[download_restriction]" id="download-restriction" value="ip" <?php echo ($this->Settings->get('download_restriction') == "ip")?'checked="checked" ':'';?> /> <?php _e('Restrict to the computer the product is purchased from','Ecart'); ?></label></td>
</tr>
</table>
</form>
</div>
<script type="text/javascript">
/* <![CDATA[ */
示例12: order_data
/**
* Provides a custom text field for collecting any number of custom order fields
*
* @api `shopp('checkout.order-data')`
* @since 1.0
*
* @param string $result The output
* @param array $options The options
* - **name**: **REQUIRED** The name of the customer info field
* - **mode**: `input` (input, value) Provide the `input` markup or the current `value` of the `name` field
* - **type**: `hidden` (textarea, menu, hidden, radio, checkbox, button, submit) The type of input markup to generate
* - **options**: Comma-separated option values
* - **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`
* - **alt**: Specifies an alternate text for images (only for type="image")
* - **checked**: Specifies that an `<input>` element should be pre-selected when the page loads (for type="checkbox" or type="radio")
* - **class**: The class attribute specifies one or more class-names for an element
* - **disabled**: Specifies that an `<input>` element should be disabled
* - **format**: Specifies special field formatting class names for JS validation
* - **minlength**: Sets a minimum length for the field enforced by JS validation
* - **maxlength**: Specifies the maximum number of characters allowed in an `<input>` element
* - **placeholder**: Specifies a short hint that describes the expected value of an `<input>` element
* - **readonly**: Specifies that an input field is read-only
* - **required**: Adds a class that specified an input field must be filled out before submitting the form, enforced by JS
* - **size**: Specifies the width, in characters, of an `<input>` element
* - **src**: Specifies the URL of the image to use as a submit button (only for type="image")
* - **tabindex**: Specifies the tabbing order of an element
* - **cols**: Specifies the visible width of a `<textarea>`
* - **rows**: Specifies the visible number of lines in a `<textarea>`
* - **title**: Specifies extra information about an element
* - **value**: Specifies the value of an `<input>` element
* @param ShoppOrder $O The working object
* @return string The custom order data field markup
**/
public static function order_data($result, $options, $O)
{
$select_attrs = array('title', 'class', 'disabled', 'required', 'size', 'tabindex', 'accesskey');
$defaults = array('name' => false, 'data' => false, 'mode' => false, 'title' => '', 'type' => 'hidden', 'value' => '', 'options' => '');
if (isset($options['name']) && array_key_exists($options['name'], ShoppOrder()->data)) {
$defaults['value'] = ShoppOrder()->data[$options['name']];
}
if (isset($options['type']) && 'textarea' == $options['type']) {
$defaults['cols'] = '30';
$defaults['rows'] = '3';
}
$op = array_merge($defaults, $options);
extract($op);
// Allowed input types
$allowed_types = array("text", "hidden", "password", "checkbox", "radio", "textarea", "menu");
// Input types that can override option-specified value with the loaded data value
$value_override = array("text", "hidden", "password", "textarea", "menu");
/// Allowable attributes for textarea inputs
$textarea_attrs = array('accesskey', 'title', 'tabindex', 'class', 'disabled', 'required', 'maxlength');
if (!$name) {
// Iterator for order data
if (!isset($O->_data_loop)) {
reset($O->data);
$O->_data_loop = true;
} else {
next($O->data);
}
if (current($O->data) !== false) {
return true;
} else {
unset($O->_data_loop);
return false;
}
}
if (isset($O->data[$name])) {
$data = $O->data[$name];
}
if ($name && $mode == "value") {
return apply_filters('shopp_checkout_order_data', $data);
}
if (!in_array($type, $allowed_types)) {
$type = 'hidden';
}
if (empty($title)) {
$title = $name;
}
$id = 'order-data-' . sanitize_title_with_dashes($name);
if (in_array($type, $value_override) && !empty($data)) {
$op['value'] = $value = $data;
}
switch (strtolower($type)) {
case "textarea":
return '<textarea name="data[' . $name . ']" cols="' . $cols . '" rows="' . $rows . '" id="' . $id . '" ' . inputattrs($op, $textarea_attrs) . '>' . $value . '</textarea>';
break;
case "menu":
$menuvalues = true;
if (is_string($options)) {
$menuvalues = false;
$options = explode(',', $options);
}
return '<select name="data[' . $name . ']" id="' . $id . '" ' . inputattrs($op, $select_attrs) . '>' . menuoptions($options, $value, $menuvalues) . '</select>';
break;
default:
return '<input type="' . $type . '" name="data[' . $name . ']" id="' . $id . '" ' . inputattrs($op) . ' />';
break;
}
//.........这里部分代码省略.........
示例13: form
function form($options) {
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title'); ?></label>
<input type="text" name="<?php echo $this->get_field_name('title'); ?>" id="<?php echo $this->get_field_id('title'); ?>" class="widefat" value="<?php echo $options['title']; ?>"></p>
<p><select id="<?php echo $this->get_field_id('source'); ?>" name="<?php echo $this->get_field_name('source'); ?>" class="widefat"><option value="category"<?php echo $options['source'] == "category"?' selected="selected"':''; ?>><?php _e('From a category','Ecart'); ?></option><option value="product"<?php echo $options['source'] == "product"?' selected="selected"':''; ?>><?php _e('By product','Ecart'); ?></option></select></p>
<?php
if (ECART_PRETTYURLS) $label = __('Category Slug/ID','Ecart');
else $label = __('Category ID','Ecart');
?>
<p id="<?php echo $this->get_field_id('category-fields'); ?>" class="hidden">
<label for="<?php echo $this->get_field_id('category'); ?>"><?php echo $label; ?></label>
<input type="text" name="<?php echo $this->get_field_name('category'); ?>" id="<?php echo $this->get_field_id('category'); ?>" class="widefat" value="<?php echo $options['category']; ?>">
<br /><br />
<select id="<?php echo $this->get_field_id('limit'); ?>" name="<?php echo $this->get_field_name('limit'); ?>">
<?php $limits = array(1,2,3,4,5,6,7,8,9,10,15,20,25);
echo menuoptions($limits,$options['limit']); ?>
</select>
<select id="<?php echo $this->get_field_id('order'); ?>" name="<?php echo $this->get_field_name('order'); ?>">
<?php
$sortoptions = array(
"bestselling" => __('Bestselling','Ecart'),
"highprice" => __('Highest Price','Ecart'),
"lowprice" => __('Lowest Price','Ecart'),
"newest" => __('Newest','Ecart'),
"oldest" => __('Oldest','Ecart'),
"random" => __('Random','Ecart')
);
echo menuoptions($sortoptions,$options['order'],true);
?>
</select>
<label for="<?php echo $this->get_field_id('order'); ?>"><?php _e('products','Ecart'); ?></label>
</p>
<?php
if (ECART_PRETTYURLS) $label = __('Product Slug/ID(s)','Ecart');
else $label = __('Product ID(s)','Ecart');
?>
<p id="<?php echo $this->get_field_id('product-fields'); ?>" class="hidden">
<label for="<?php echo $this->get_field_id('product'); ?>"><?php echo $label; ?></label>
<input type="text" name="<?php echo $this->get_field_name('product'); ?>" id="<?php echo $this->get_field_id('product'); ?>" class="widefat" value="<?php echo $options['product']; ?>">
<small><?php _e('Use commas to specify multiple products','Ecart')?></small></p>
<script type="text/javascript">
(function($) {
$(window).ready(function () {
var categoryui = $('#<?php echo $this->get_field_id("category-fields"); ?>');
var productui = $('#<?php echo $this->get_field_id("product-fields"); ?>');
$('#<?php echo $this->get_field_id("source"); ?>').change(function () {
if ($(this).val() == "category") {
productui.hide();
categoryui.show();
}
if ($(this).val() == "product") {
categoryui.hide();
productui.show();
}
}).change();
});
})(jQuery)
</script>
<?php
}
示例14: category
/**
* Loads all categories for the product list manager category filter menu
*
* @author Jonathan Davis
* @return string HTML for a drop-down menu of categories
**/
public function category($id)
{
global $wpdb;
$p = "{$wpdb->posts} AS p";
$where = array();
$joins[$wpdb->term_relationships] = "INNER JOIN {$wpdb->term_relationships} AS tr ON (p.ID=tr.object_id)";
$joins[$wpdb->term_taxonomy] = "INNER JOIN {$wpdb->term_taxonomy} AS tt ON (tr.term_taxonomy_id=tt.term_taxonomy_id AND tt.term_id={$id})";
if (-1 == $id) {
$joins[$wpdb->term_relationships] = "LEFT JOIN {$wpdb->term_relationships} AS tr ON (p.ID=tr.object_id)";
unset($joins[$wpdb->term_taxonomy]);
$where[] = 'tr.object_id IS NULL';
$where[] = "p.post_status='publish'";
$where[] = "p.post_type='shopp_product'";
}
$where = empty($where) ? '' : ' WHERE ' . join(' AND ', $where);
if ('catalog-products' == $id) {
$products = sDB::query("SELECT p.id,p.post_title AS name FROM {$p} {$where} ORDER BY name ASC", 'array', 'col', 'name', 'id');
} else {
$products = sDB::query("SELECT p.id,p.post_title AS name FROM {$p} " . join(' ', $joins) . $where . " ORDER BY name ASC", 'array', 'col', 'name', 'id');
}
return menuoptions($products, 0, true);
}
示例15: _e
<div class="optionrow fix">
<div class="optiontitle fix">
<strong><label for="weight-unit"><?php _e('Product Dimension Unit','Ecart'); ?></label></strong><br>
</div>
<div class="theinputs">
<div class="optioninputs">
<br/>
<select name="settings[dimension_unit]" id="dimension-unit">
<option value="">Please select an option »</option>
<?php
if ($base['units'] == "imperial") $units = array("in" => __("inches (in)","Ecart"),"ft" => __("feet (ft)","Ecart"));
else $units = array("cm"=>__("centimeters (cm)","Ecart"),"m"=>__("meters (m)","Ecart"));
echo menuoptions($units,$this->Settings->get('dimension_unit'),true);
?>
</select><br />
<br>
<br>
</div>
</div>
<div class="theexplanation">
<div class="context"></div>
<p><?php _e('Please select your dimension unit, this will be used for shipping products','Ecart'); ?></p>
</div>
<div class="clear"></div>
</div>