本文整理汇总了PHP中F0FInflector::underscore方法的典型用法代码示例。如果您正苦于以下问题:PHP F0FInflector::underscore方法的具体用法?PHP F0FInflector::underscore怎么用?PHP F0FInflector::underscore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类F0FInflector
的用法示例。
在下文中一共展示了F0FInflector::underscore方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
if(size > 0){
console.log(size);
jQuery('#product-filter-group-clear-<?php
echo F0FInflector::underscore($filtergroup['group_name']);
?>
').show();
jQuery('#j2store-pf-filter-<?php
echo F0FInflector::underscore($filtergroup['group_name']);
?>
').show();
jQuery('#pf-filter-icon-plus-<?php
echo F0FInflector::underscore($filtergroup['group_name']);
?>
').hide();
jQuery('#pf-filter-icon-minus-<?php
echo F0FInflector::underscore($filtergroup['group_name']);
?>
').show();
}
<?php
}
?>
<?php
}
?>
});
</script>
<?php
if ($this->params->get('list_show_filter_price', 0) && isset($this->filters['pricefilters']) && count($this->filters['pricefilters'])) {
?>
<script type="text/javascript">
示例2: getHtml
public function getHtml()
{
$html = '';
$state = $this->getState();
$value = isset($state->value) ? $state->value : '';
$attribs = isset($state->attribs) ? $state->attribs : array();
$placeholder = isset($state->placeholder) ? $state->placeholder : array();
if (isset($state->hasOne)) {
$modelName = $state->hasOne;
$model = F0FModel::getTmpInstance($modelName, 'J2StoreModel');
//check relations
if (isset($state->primaryKey) && isset($state->displayName)) {
$primary_key = $state->primaryKey;
$displayName = $state->displayName;
} else {
$primary_key = $model->getTable()->getKeyName();
$knownFields = $model->getTable()->getKnownFields();
$displayName = $knownFields[1];
}
if (isset($state->ordering) && !empty($state->ordering)) {
$model->setState('filter_order', $state->ordering);
}
$items = $model->enabled(1)->getList();
if (count($items)) {
foreach ($items as $item) {
if (is_array($displayName)) {
$text = '';
foreach ($displayName as $n) {
if (isset($item->{$n})) {
$text .= JText::_($item->{$n}) . ' ';
}
}
} else {
$text = JText::_($item->{$displayName});
}
$this->options[] = JHtml::_('select.option', $item->{$primary_key}, $text);
}
}
}
$idTag = isset($state->idTag) ? $state->idTag : 'j2store_' . F0FInflector::underscore($state->name);
return JHtml::_('select.' . $state->type, $this->options, $state->name, $attribs, 'value', 'text', $value, $idTag);
}
示例3: getOptions
/**
* Create objects for the options
*
* @return array The array of option objects
*/
protected function getOptions()
{
// Field options: title translate and show how much related items
$countAndShowRelated = (string) $this->element['countAndShowRelated'] == 'true';
$translateTitle = (string) $this->element['translateTitle'] == 'true';
$table = $this->form->getModel()->getTable();
// Get relation definitions from fof.xml
$key = $table->getConfigProviderKey() . '.relations';
$relations = $table->getConfigProvider()->get($key, array());
// Get the relation type:
$relationType = '';
foreach ($relations as $relation) {
if ($relation['itemName'] == $this->name) {
$relationType = $relation['type'];
break;
}
}
// Get full relation definitions from F0FTableRelation object:
$relation = $table->getRelations()->getRelation($this->name, $relationType);
$dbOptions = array();
// First implementation: multiple relations. Not using others yet
if ($relation['type'] == 'multiple') {
// Guessing the related table name from the given tableclassname followed the naming-conventions:
list($option, $tableWord, $optItemSingular) = explode('_', F0FInflector::underscore($relation['tableClass']));
$optionsTableName = '#__' . $option . '_' . F0FInflector::pluralize($optItemSingular);
// Get the options table object
$optionsTableObject = F0FTable::getAnInstance($relation['tableClass'], null);
// Get the Items
$db = JFactory::getDbo();
$q = $db->getQuery(true)->select('o.*')->from($db->qn($optionsTableName) . ' as o');
// Should we count and show related items?
if ($countAndShowRelated) {
$q->select('count(' . $db->qn('p.' . $relation['ourPivotKey']) . ') as total');
$q->leftJoin($db->qn($relation['pivotTable']) . ' as p on ' . $db->qn('o.' . $relation['remoteKey']) . ' = ' . $db->qn('p.' . $relation['theirPivotKey']));
$q->group($db->qn('o.' . $relation['remoteKey']));
}
// todo Language-filtering?
$dbOptions = $db->setQuery($q)->loadObjectList($relation['remoteKey']);
}
$options = array();
// Get the field $options on top
foreach ($this->element->children() as $option) {
// Only add <option /> elements.
if ($option->getName() != 'option') {
continue;
}
// Create a new option object based on the <option /> element.
$options[] = JHtml::_('select.option', (string) $option['value'], JText::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)), 'value', 'text', (string) $option['disabled'] == 'true');
}
// Loop through the data and prime the $options array
// Get title column alias:
$titleField = $optionsTableObject->getColumnAlias('title');
$keyField = $relation['remoteKey'];
$enabledField = $optionsTableObject->getColumnAlias('enabled');
foreach ($dbOptions as $dbOption) {
$key = $dbOption->{$keyField};
$value = $dbOption->{$titleField};
$disabled = !$dbOption->{$enabledField} ? true : false;
if ($translateTitle) {
$value = JText::_($value);
}
if ($countAndShowRelated) {
$value = $value . ' (' . $dbOption->total . ')';
}
$options[] = JHtml::_('select.option', $key, $value, 'value', 'text', $disabled);
}
return $options;
}
示例4: get_formatted_order_totals
/**
* Get formatted totals for an order
* Since 3.2
* @return array Totals as an associative array
*/
public function get_formatted_order_totals()
{
$total_rows = array();
$currency = J2Store::currency();
$params = J2Store::config();
$items = $this->getItems();
$taxes = $this->getOrderTaxrates();
$shipping = $this->getOrderShippingRate();
//subtotal
$total_rows['subtotal'] = array('label' => JText::_('J2STORE_CART_SUBTOTAL'), 'value' => $currency->format($this->get_formatted_subtotal($params->get('checkout_price_display_options', 1), $items), $this->currency_code, $this->currency_value));
//shipping
if (!empty($shipping->ordershipping_name)) {
$total_rows['shipping'] = array('label' => JText::_(stripslashes($shipping->ordershipping_name)), 'value' => $currency->format($this->order_shipping, $this->currency_code, $this->currency_value));
}
//shipping tax
if ($this->order_shipping_tax > 0) {
$total_rows['shipping_tax'] = array('label' => JText::_('J2STORE_ORDER_SHIPPING_TAX'), 'value' => $currency->format($this->order_shipping_tax, $this->currency_code, $this->currency_value));
}
//fees
foreach ($this->get_fees() as $fee) {
$total_rows['fee_' . F0FInflector::underscore($fee->name)] = array('label' => JText::_($fee->name), 'value' => $currency->format($this->get_formatted_fees($fee, $params->get('checkout_price_display_options', 1)), $this->currency_code, $this->currency_value));
}
//surcharge @depreicated.
if ($this->order_surcharge > 0) {
$total_rows['surcharge'] = array('label' => JText::_('J2STORE_CART_SURCHARGE'), 'value' => $currency->format($this->order_surcharge, $this->currency_code, $this->currency_value));
}
//discount
foreach ($this->getOrderDiscounts() as $discount) {
if ($discount->discount_amount > 0) {
$link = '';
if ($discount->discount_type == 'coupon') {
$label = JText::sprintf('J2STORE_COUPON_TITLE', $discount->discount_title);
$link = '<a class="j2store-remove remove-icon" href="javascript:void(0)" onClick="jQuery(\'#j2store-cart-form #j2store-cart-task\').val(\'removeCoupon\'); jQuery(\'#j2store-cart-form\').submit();" >X</a>';
} elseif ($discount->discount_type == 'voucher') {
$label = JText::sprintf('J2STORE_VOUCHER_TITLE', $discount->discount_title);
$link = '<a class="j2store-remove remove-icon" href="javascript:void(0)" onClick="jQuery(\'#j2store-cart-form #j2store-cart-task\').val(\'removeVoucher\'); jQuery(\'#j2store-cart-form\').submit();" >X</a>';
} else {
$label = JText::sprintf('J2STORE_DISCOUNT_TITLE', $discount->discount_title);
}
$label .= J2Store::plugin()->eventWithHtml('AfterDisplayDiscountTitle', array($this, $discount));
$value = $currency->format($this->get_formatted_discount($discount, $params->get('checkout_price_display_options', 1)), $this->currency_code, $this->currency_value);
$value .= J2Store::plugin()->eventWithHtml('AfterDisplayDiscountAmount', array($this, $discount));
$total_rows[$discount->discount_code . F0FInflector::underscore($discount->discount_title)] = array('label' => $label, 'link' => $link, 'value' => $value);
}
}
//taxes
if (isset($taxes) && count($taxes)) {
$label = '';
foreach ($taxes as $tax) {
$label = '';
if ($params->get('checkout_price_display_options', 1)) {
$label .= JText::sprintf('J2STORE_CART_TAX_INCLUDED_TITLE', $tax->ordertax_title, floatval($tax->ordertax_percent) . '%');
} else {
$label .= JText::sprintf('J2STORE_CART_TAX_EXCLUDED_TITLE', $tax->ordertax_title, floatval($tax->ordertax_percent) . '%');
}
$value = $currency->format($tax->ordertax_amount, $this->currency_code, $this->currency_value);
$total_rows['tax_' . F0FInflector::underscore($tax->ordertax_title)] = array('label' => $label, 'value' => $value);
}
}
//refund
if ($this->order_refund) {
$total_rows['refund'] = array('label' => JText::_('J2STORE_CART_REFUND'), 'value' => $currency->format($this->order_refund, $this->currency_code, $this->currency_value));
}
$total_rows['grandtotal'] = array('label' => JText::_('J2STORE_CART_GRANDTOTAL'), 'value' => $currency->format($this->get_formatted_grandtotal(), $this->currency_code, $this->currency_value));
//allow plugins to modify
J2Store::plugin()->event('GetFormattedOrderTotals', array($this, $total_rows));
return $total_rows;
}