本文整理汇总了PHP中vmTrace函数的典型用法代码示例。如果您正苦于以下问题:PHP vmTrace函数的具体用法?PHP vmTrace怎么用?PHP vmTrace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vmTrace函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getListQuery
function getListQuery()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('group_size.*')->from('#__tsmart_group_size AS group_size');
$user = JFactory::getUser();
$shared = '';
if (vmAccess::manager()) {
//$query->where('transferaddon.shared=1','OR');
}
$search = vRequest::getCmd('search', false);
if (empty($search)) {
$search = vRequest::getString('search', false);
}
// add filters
if ($search) {
$db = JFactory::getDBO();
$search = '"%' . $db->escape($search, true) . '%"';
$query->where('group_size.group_name LIKE ' . $search);
}
if (empty($this->_selectedOrdering)) {
vmTrace('empty _getOrdering');
}
if (empty($this->_selectedOrderingDir)) {
vmTrace('empty _selectedOrderingDir');
}
$query->order('group_size.' . $this->_selectedOrdering . ' ' . $this->_selectedOrderingDir);
//echo $query->dump();
return $query;
}
示例2: getListQuery
function getListQuery()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('*')->from('#__tsmart_coupons AS coupons');
if (empty($this->_selectedOrdering)) {
vmTrace('empty _getOrdering');
}
if (empty($this->_selectedOrderingDir)) {
vmTrace('empty _selectedOrderingDir');
}
$query->order($this->_selectedOrdering . ' ' . $this->_selectedOrderingDir);
return $query;
}
示例3: displayProductCustomfieldSelected
/**
* There are too many functions doing almost the same for my taste
* the results are sometimes slighty different and makes it hard to work with it, therefore here the function for future proxy use
*
*/
public static function displayProductCustomfieldSelected($product, $html, $trigger)
{
if (isset($product->param)) {
vmTrace('param found, seek and destroy');
return false;
}
$row = 0;
if (!class_exists('shopFunctionsF')) {
require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
}
$variantmods = isset($product->customProductData) ? $product->customProductData : $product->product_attribute;
if (empty($variantmods)) {
$productDB = VmModel::getModel('product')->getProduct($product->virtuemart_product_id);
if ($productDB) {
$product->customfields = $productDB->customfields;
}
}
if (!is_array($variantmods)) {
$variantmods = json_decode($variantmods, true);
}
$productCustoms = array();
foreach ((array) $product->customfields as $prodcustom) {
//We just add the customfields to be shown in the cart to the variantmods
if (is_object($prodcustom)) {
if ($prodcustom->is_cart_attribute and !$prodcustom->is_input) {
if (!is_array($variantmods[$prodcustom->virtuemart_custom_id])) {
$variantmods[$prodcustom->virtuemart_custom_id] = array();
}
$variantmods[$prodcustom->virtuemart_custom_id][$prodcustom->virtuemart_customfield_id] = false;
} else {
if (!empty($variantmods) and !empty($variantmods[$prodcustom->virtuemart_custom_id])) {
}
}
$productCustoms[$prodcustom->virtuemart_customfield_id] = $prodcustom;
}
}
foreach ((array) $variantmods as $custom_id => $customfield_ids) {
if (!is_array($customfield_ids)) {
$customfield_ids = array($customfield_ids => false);
}
foreach ($customfield_ids as $customfield_id => $params) {
if (empty($productCustoms) or !isset($productCustoms[$customfield_id])) {
continue;
}
$productCustom = $productCustoms[$customfield_id];
//The stored result in vm2.0.14 looks like this {"48":{"textinput":{"comment":"test"}}}
//and now {"32":[{"invala":"100"}]}
if (!empty($productCustom)) {
$otag = ' <span class="product-field-type-' . $productCustom->field_type . '">';
if ($productCustom->field_type == "E") {
$tmp = '';
if (!class_exists('vmCustomPlugin')) {
require VMPATH_PLUGINLIBS . DS . 'vmcustomplugin.php';
}
JPluginHelper::importPlugin('vmcustom');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger($trigger . 'VM3', array(&$product, &$productCustom, &$tmp));
if (!empty($tmp)) {
$html .= $otag . $tmp;
}
} else {
$value = '';
if ($productCustom->field_type == 'G') {
$db = JFactory::getDBO();
$db->setQuery('SELECT `product_name` FROM `#__virtuemart_products_' . VmConfig::$vmlang . '` WHERE virtuemart_product_id=' . (int) $productCustom->customfield_value);
$child = $db->loadObject();
$value = $child->product_name;
} elseif ($productCustom->field_type == 'M') {
$customFieldModel = VmModel::getModel('customfields');
$value = $customFieldModel->displayCustomMedia($productCustom->customfield_value, 'product', $productCustom->width, $productCustom->height, self::$useAbsUrls);
} elseif ($productCustom->field_type == 'S') {
if ($productCustom->is_list and $productCustom->is_input) {
$value = vmText::_($params);
} else {
$value = vmText::_($productCustom->customfield_value);
}
} elseif ($productCustom->field_type == 'A') {
$value = vmText::_($product->{$productCustom->customfield_value});
//vmdebug('Customfield A',$productCustom,$productCustom->customfield_value);
} elseif ($productCustom->field_type == 'C') {
//vmdebug('displayProductCustomfieldSelected C',$productCustom,$productCustom->selectoptions);
foreach ($productCustom->options->{$product->virtuemart_product_id} as $k => $option) {
$value .= '<span> ';
if (!empty($productCustom->selectoptions[$k]->clabel) and in_array($productCustom->selectoptions[$k]->voption, self::$dimensions)) {
$value .= vmText::_('COM_VIRTUEMART_' . $productCustom->selectoptions[$k]->voption);
$rd = $productCustom->selectoptions[$k]->clabel;
if (is_numeric($rd) and is_numeric($option)) {
$value .= ' ' . number_format(round((double) $option, (int) $rd), $rd);
}
} else {
if (!empty($productCustom->selectoptions[$k]->clabel)) {
$value .= vmText::_($productCustom->selectoptions[$k]->clabel);
}
$value .= ' ' . vmText::_($option) . ' ';
}
//.........这里部分代码省略.........
示例4: getProduct
/**
* This function creates a product with the attributes of the parent.
*
* @param int $virtuemart_product_id
* @param boolean $front for frontend use
* @param boolean $withCalc calculate prices?
* @param boolean published
* @param int quantity
* @param boolean load customfields
*/
public function getProduct($virtuemart_product_id = NULL, $front = TRUE, $withCalc = TRUE, $onlyPublished = TRUE, $quantity = 1, $virtuemart_shoppergroup_ids = 0)
{
//vmSetStartTime('getProduct');
if (isset($virtuemart_product_id)) {
$virtuemart_product_id = $this->setId($virtuemart_product_id);
} else {
if (empty($this->_id)) {
vmdebug('Can not return product with empty id');
return FALSE;
} else {
$virtuemart_product_id = $this->_id;
}
}
$checkedProductKey = $this->checkIfCached($virtuemart_product_id, $front, $withCalc, $onlyPublished, $quantity, $virtuemart_shoppergroup_ids);
if ($checkedProductKey[0]) {
if (self::$_products[$checkedProductKey[1]] === false) {
return false;
} else {
//vmTime('getProduct return cached clone','getProduct');
return clone self::$_products[$checkedProductKey[1]];
}
}
$productKey = $checkedProductKey[1];
if ($this->memory_limit < ($mem = round(memory_get_usage(FALSE) / (1024 * 1024), 2))) {
vmdebug('Memory limit reached in model product getProduct(' . $virtuemart_product_id . '), consumed: ' . $mem . 'M');
vmError('Memory limit reached in model product getProduct() ' . $virtuemart_product_id);
return false;
}
$child = $this->getProductSingle($virtuemart_product_id, $front, $quantity, true, $virtuemart_shoppergroup_ids);
if (!$child->published && $onlyPublished) {
self::$_products[$productKey] = false;
vmTime('getProduct return false, not published', 'getProduct');
return FALSE;
}
if (!isset($child->orderable)) {
$child->orderable = TRUE;
}
//store the original parent id
$pId = $child->virtuemart_product_id;
$ppId = $child->product_parent_id;
$published = $child->published;
if (!empty($pId)) {
$child->allIds[] = $pId;
}
$i = 0;
$runtime = microtime(TRUE) - $this->starttime;
//Check for all attributes to inherited by parent products
while (!empty($child->product_parent_id)) {
$runtime = microtime(TRUE) - $this->starttime;
if ($runtime >= $this->maxScriptTime) {
vmdebug('Max execution time reached in model product getProduct() ', $child);
vmError('Max execution time reached in model product getProduct() ' . $child->product_parent_id);
break;
} else {
if ($i > 10) {
vmdebug('Time: ' . $runtime . ' Too many child products in getProduct() ', $child);
vmError('Time: ' . $runtime . ' Too many child products in getProduct() ' . $child->product_parent_id);
break;
}
}
//$child->allIds[] = $child->product_parent_id;
if (!empty($child->product_parent_id)) {
$child->allIds[] = $child->product_parent_id;
}
$parentProduct = $this->getProductSingle($child->product_parent_id, $front, $quantity);
if ($child->product_parent_id === $parentProduct->product_parent_id) {
vmError('Error, parent product with virtuemart_product_id = ' . $parentProduct->virtuemart_product_id . ' has same parent id like the child with virtuemart_product_id ' . $child->virtuemart_product_id);
vmTrace('Error, parent product with virtuemart_product_id = ' . $parentProduct->virtuemart_product_id . ' has same parent id like the child with virtuemart_product_id ' . $child->virtuemart_product_id);
break;
}
$attribs = get_object_vars($parentProduct);
foreach ($attribs as $k => $v) {
if ('product_in_stock' != $k and 'product_ordered' != $k) {
// Do not copy parent stock into child
if (strpos($k, '_') !== 0 and empty($child->{$k})) {
$child->{$k} = $v;
// vmdebug($child->product_parent_id.' $child->$k',$child->$k);
}
}
}
$i++;
if ($child->product_parent_id != $parentProduct->product_parent_id) {
$child->product_parent_id = $parentProduct->product_parent_id;
} else {
$child->product_parent_id = 0;
}
}
//vmdebug('getProduct Time: '.$runtime);
$child->published = $published;
$child->virtuemart_product_id = $pId;
//.........这里部分代码省略.........
示例5: get
/**
* Main filter function, called by the others with set Parameters
* The standard filter is non restrictiv.
*
* @author Max Milbers
* @param $name
* @param null $default
* @param int $filter
* @param int $flags
* @return mixed|null
*/
public static function get($name, $default = null, $filter = FILTER_UNSAFE_RAW, $flags = FILTER_FLAG_NO_ENCODE,$source = 0){
//vmSetStartTime();
if(!empty($name)){
if($source===0){
$source = $_REQUEST;
} else if($source=='GET'){
$source = $_GET;
if(JVM_VERSION>2){
$router = JFactory::getApplication()->getRouter();
$vars = $router->getVars();
if($router->getMode() and !empty($vars)){
$source = array_merge($_GET,$vars);
}
}
} else if($source=='POST'){
$source = $_POST;
}
if(!isset($source[$name])){
return $default;
}
//if(strpos($name,'[]'!==FALSE)){
return self::filter($source[$name],$filter,$flags);
} else {
vmTrace('empty name in vRequest::get');
return $default;
}
}
示例6: getListQuery
function getListQuery()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('faq.*,categoryfaq.categoryfaq_name')->from('#__tsmart_faq AS faq')->leftJoin('#__tsmart_categoryfaq AS categoryfaq ON categoryfaq.tsmart_categoryfaq_id=faq.tsmart_categoryfaq_id');
$user = JFactory::getUser();
$shared = '';
if (vmAccess::manager()) {
//$query->where('transferaddon.shared=1','OR');
}
$search = vRequest::getCmd('search', false);
if (empty($search)) {
$search = vRequest::getString('search', false);
}
// add filters
if ($search) {
$db = JFactory::getDBO();
$search = '"%' . $db->escape($search, true) . '%"';
$query->where('faq.title LIKE ' . $search);
}
if (empty($this->_selectedOrdering)) {
vmTrace('empty _getOrdering');
}
if (empty($this->_selectedOrderingDir)) {
vmTrace('empty _selectedOrderingDir');
}
$query->order($this->_selectedOrdering . ' ' . $this->_selectedOrderingDir);
return $query;
}
示例7: displayProductCustomfieldSelected
/**
* There are too many functions doing almost the same for my taste
* the results are sometimes slighty different and makes it hard to work with it, therefore here the function for future proxy use
*
*/
public static function displayProductCustomfieldSelected($product, $html, $trigger)
{
if (isset($product->param)) {
vmTrace('param found, seek and destroy');
return false;
}
$row = 0;
if (!class_exists('shopFunctionsF')) {
require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
}
$variantmods = isset($product->customProductData) ? $product->customProductData : $product->product_attribute;
if (empty($variantmods)) {
$productDB = VmModel::getModel('product')->getProduct($product->virtuemart_product_id);
if ($productDB) {
$product->customfields = $productDB->customfields;
}
}
if (!is_array($variantmods)) {
$variantmods = json_decode($variantmods, true);
}
$productCustoms = array();
foreach ($product->customfields as $prodcustom) {
//We just add the customfields to be shown in the cart to the variantmods
if (is_object($prodcustom)) {
if ($prodcustom->is_cart_attribute and !$prodcustom->is_input) {
$variantmods[$prodcustom->virtuemart_custom_id] = $prodcustom->virtuemart_customfield_id;
} else {
if (!empty($variantmods) and !empty($variantmods[$prodcustom->virtuemart_custom_id])) {
}
}
$productCustoms[$prodcustom->virtuemart_customfield_id] = $prodcustom;
}
}
foreach ($variantmods as $custom_id => $customfield_ids) {
if (!is_array($customfield_ids)) {
$customfield_ids = array($customfield_ids => false);
}
foreach ($customfield_ids as $customfield_id => $params) {
if (empty($productCustoms) or !isset($productCustoms[$customfield_id])) {
continue;
}
$productCustom = $productCustoms[$customfield_id];
//The stored result in vm2.0.14 looks like this {"48":{"textinput":{"comment":"test"}}}
//and now {"32":[{"invala":"100"}]}
if (!empty($productCustom)) {
$html .= ' <span class="product-field-type-' . $productCustom->field_type . '">';
if ($productCustom->field_type == "E") {
//$product->productCustom = $productCustom;
//$product->row = $row;
//
if (!class_exists('vmCustomPlugin')) {
require JPATH_VM_PLUGINS . DS . 'vmcustomplugin.php';
}
JPluginHelper::importPlugin('vmcustom');
$dispatcher = JDispatcher::getInstance();
//vmdebug('displayProductCustomfieldSelected is PLUGIN use trigger '.$trigger,$product->virtuemart_product_id,$productCustom->virtuemart_customfield_id,$productCustom->custom_element);
$dispatcher->trigger($trigger . 'VM3', array(&$product, &$productCustom, &$html));
} else {
//vmdebug('customFieldDisplay $productCustom by self::getProductCustomField $variant: '.$variant.' $selected: '.$selected,$productCustom);
$value = '';
if ($productCustom->field_type == "G") {
$db = JFactory::getDBO();
$db->setQuery('SELECT `product_name` FROM `#__virtuemart_products_' . VmConfig::$vmlang . '` WHERE virtuemart_product_id=' . (int) $productCustom->customfield_value);
$child = $db->loadObject();
$value = $child->product_name;
} elseif ($productCustom->field_type == "M") {
// $html .= $productCustom->custom_title.' '.self::displayCustomMedia($productCustom->custom_value);
$value = self::displayCustomMedia($productCustom->customfield_value);
} elseif ($productCustom->field_type == "S") {
//$value = $productCustom->custom_title.' '.vmText::_($productCustom->customfield_value);
$value = $productCustom->customfield_value;
} else {
// $html .= $productCustom->custom_title.' '.$productCustom->custom_value;
//vmdebug('customFieldDisplay',$productCustom);
$value = $productCustom->customfield_value;
}
$html .= ShopFunctionsF::translateTwoLangKeys($productCustom->custom_title, $value);
}
$html .= '</span><br />';
} else {
// falldown method if customfield are deleted
foreach ((array) $customfield_id as $key => $value) {
$html .= '<br/ >Couldnt find customfield' . ($key ? '<span>' . $key . ' </span>' : '') . $value;
}
//vmdebug ('CustomsFieldOrderDisplay, $item->productCustom empty? ' . $variant);
vmdebug('customFieldDisplay, $productCustom is EMPTY ' . $customfield_id);
}
}
}
return $html . '</div>';
}
示例8: setCryptedFields
/**
* Sets fields encrypted
* @author Max Milbers
* @param $fieldNames
*/
public function setCryptedFields($fieldNames)
{
if (!$fieldNames) {
vmTrace('setEncrytped fields false not catched');
return;
}
if (!is_array($fieldNames)) {
$fieldNames = array($fieldNames);
}
if (isset($fieldNames[$this->_pkey])) {
unset($fieldNames[$this->_pkey]);
}
$this->_cryptedFields = $fieldNames;
}
示例9: getListQuery
function getListQuery()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('payment.*')->from('#__tsmart_payment AS payment')->leftJoin('#__tsmart_currencies AS currencies USING(tsmart_currency_id)')->select('CONCAT(currencies.currency_code_3," ",currencies.currency_symbol) AS currency_symbol');
//get list tour apply
$query1 = $db->getQuery(true);
$query1->select('GROUP_CONCAT(products_en_gb.product_name)')->from('#__tsmart_tour_id_payment_id AS tour_id_payment_id')->leftJoin('#__tsmart_products_en_gb AS products_en_gb USING(tsmart_product_id)')->where('tour_id_payment_id.tsmart_payment_id=payment.tsmart_payment_id');
$query->select("({$query1}) AS list_tour");
//end get list tour apply
$user = JFactory::getUser();
$shared = '';
if (vmAccess::manager()) {
//$query->where('payment.shared=1','OR');
}
$search = vRequest::getCmd('search', false);
if (empty($search)) {
$search = vRequest::getString('search', false);
}
// add filters
if ($search) {
$db = JFactory::getDBO();
$search = '"%' . $db->escape($search, true) . '%"';
$query->where('payment.title LIKE ' . $search);
}
if (empty($this->_selectedOrdering)) {
vmTrace('empty _getOrdering');
}
if (empty($this->_selectedOrderingDir)) {
vmTrace('empty _selectedOrderingDir');
}
$query->order($this->_selectedOrdering . ' ' . $this->_selectedOrderingDir);
return $query;
}
示例10: getListQuery
function getListQuery()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query1 = $db->getQuery(true);
$query1->select('GROUP_CONCAT(products_en_gb.tsmart_product_id)')->from('#__tsmart_products_en_gb AS products_en_gb')->leftJoin('#__tsmart_products AS products USING(tsmart_product_id)')->leftJoin('#__tsmart_tour_id_hotel_addon_id AS tour_id_hotel_addon_id1 USING(tsmart_product_id)')->where('tour_id_hotel_addon_id1.tsmart_hotel_addon_id=hotel_addon.tsmart_hotel_addon_id');
$query->select('hotel_addon.*,hotel.hotel_name,cityarea.city_area_name,cityarea.tsmart_cityarea_id')->from('#__tsmart_hotel_addon AS hotel_addon')->leftJoin('#__tsmart_hotel AS hotel USING(tsmart_hotel_id)')->leftJoin('#__tsmart_cityarea AS cityarea ON cityarea.tsmart_cityarea_id=hotel.tsmart_cityarea_id')->select('(' . $query1 . ') AS list_tsmart_product_id');
$user = JFactory::getUser();
$shared = '';
if ($search = $this->getState('filter.search')) {
$search = '"%' . $db->escape($search, true) . '%"';
$query->where('(hotel_addon.tsmart_hotel_addon_id LIKE ' . $search . ' OR hotel.hotel_name LIKE ' . $search . ')');
}
if ($location_city = $this->getState('filter.location_city')) {
$query->where('cityarea.tsmart_cityarea_id=' . (int) $location_city);
}
if ($vail_from = $this->getState('filter.vail_from')) {
$vail_from = JFactory::getDate($vail_from);
$query->where('hotel_addon.vail_from >=' . $query->q($vail_from->toSql()));
}
if ($vail_to = $this->getState('filter.vail_to')) {
$vail_to = JFactory::getDate($vail_to);
$query->where('hotel_addon.vail_to<=' . $query->q($vail_to->toSql()));
}
// Filter by published state
$state = $this->getState('filter.state');
if (is_numeric($state)) {
$query->where('hotel_addon.published = ' . (int) $state);
} elseif ($state === '') {
$query->where('(hotel_addon.published IN (0, 1))');
}
if (empty($this->_selectedOrdering)) {
vmTrace('empty _getOrdering');
}
if (empty($this->_selectedOrderingDir)) {
vmTrace('empty _selectedOrderingDir');
}
$query->order($this->_selectedOrdering . ' ' . $this->_selectedOrderingDir);
return $query;
}
示例11: get
/**
* Main filter function, called by the others with set Parameters
* The standard filter is non restrictiv.
*
* @author Max Milbers
* @param $name
* @param null $default
* @param int $filter
* @param int $flags
* @return mixed|null
*/
public static function get($name, $default = null, $filter = FILTER_UNSAFE_RAW, $flags = FILTER_FLAG_STRIP_LOW)
{
//vmSetStartTime();
if (!empty($name)) {
if (!isset($_REQUEST[$name])) {
return $default;
}
//if(strpos($name,'[]'!==FALSE)){
if (is_array($_REQUEST[$name])) {
return filter_var_array($_REQUEST[$name], $filter);
} else {
return filter_var($_REQUEST[$name], $filter, $flags);
}
} else {
vmTrace('empty name in vRequest::get');
return $default;
}
}
示例12: getListQuery
function getListQuery()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('excursion_addon.*')->from('#__tsmart_excursion_addon AS excursion_addon')->leftJoin('me1u8_tsmart_cityarea AS cityarea USING(tsmart_cityarea_id)')->select('cityarea.city_area_name AS city_area_name');
$user = JFactory::getUser();
$shared = '';
if (vmAccess::manager()) {
//$query->where('excursionaddon.shared=1','OR');
}
$search = vRequest::getCmd('search', false);
if (empty($search)) {
$search = vRequest::getString('search', false);
}
// add filters
if ($search) {
$db = JFactory::getDBO();
$search = '"%' . $db->escape($search, true) . '%"';
$query->where('excursion_addon.excursion_addon_name LIKE ' . $search);
}
if (empty($this->_selectedOrdering)) {
vmTrace('empty _getOrdering');
}
if (empty($this->_selectedOrderingDir)) {
vmTrace('empty _selectedOrderingDir');
}
$query->order($this->_selectedOrdering . ' ' . $this->_selectedOrderingDir);
return $query;
}
示例13: vmWarn
<?php
$attentionText = JText::_('COM_VIRTUEMART_MIGRATION_WARN_VM1_EXTENSIONS');
vmWarn($attentionText);
echo $attentionText;
vmTrace('Called by');
示例14: vmError
/**
* Shows an error message, sensible information should be only in the first one, the second one is for non BE users
* @author Max Milbers
*/
function vmError($descr, $publicdescr = '')
{
$msg = '';
if (VmConfig::$maxMessageCount < VmConfig::$maxMessage + 5) {
if (empty($descr)) {
vmTrace('vmError message empty');
}
$lang = JFactory::getLanguage();
JLoader::register('Permissions', JPATH_VM_ADMINISTRATOR . '/helpers/permissions.php');
if (Permissions::getInstance()->check('admin')) {
//$app = JFactory::getApplication();
$descr = $lang->_($descr);
$msg = 'vmError: ' . $descr;
} else {
if (!empty($publicdescr)) {
$msg = $lang->_($publicdescr);
}
}
} else {
if (VmConfig::$maxMessageCount == VmConfig::$maxMessage + 5) {
$msg = 'Max messages reached';
} else {
return false;
}
}
if (!empty($msg)) {
VmConfig::$maxMessageCount++;
$app = JFactory::getApplication();
$app->enqueueMessage($msg, 'error');
return $msg;
}
return $msg;
}
示例15: saveAddressInCart
function saveAddressInCart($data, $type, $putIntoSession = true, $prefix = '')
{
// VirtueMartModelUserfields::getUserFields() won't work
if (!class_exists('VirtueMartModelUserfields')) {
require VMPATH_ADMIN . DS . 'models' . DS . 'userfields.php';
}
$userFieldsModel = VmModel::getModel('userfields');
if ($type == 'STaddress' or $type == 'BTaddress') {
vmTrace('STaddress found, seek and destroy');
}
$prepareUserFields = $userFieldsModel->getUserFieldsFor('cart', $type);
if (!is_array($data)) {
$data = get_object_vars($data);
}
if ($type == 'ST') {
$this->STsameAsBT = 0;
} else {
// BT
if (empty($data['email'])) {
$jUser = JFactory::getUser();
$address['email'] = $jUser->email;
}
}
$address = array();
if (!class_exists('vmFilter')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'vmfilter.php';
}
foreach ($prepareUserFields as $fld) {
if (!empty($fld->name)) {
$name = $fld->name;
if (!isset($data[$prefix . $name])) {
$tmp = vRequest::getString($prefix . $name, false);
if ($tmp) {
$data[$prefix . $name] = $tmp;
} else {
if ($fld->required and isset($this->{$type}[$name])) {
//Why we have this fallback to the already stored value?
$data[$prefix . $name] = $this->{$type}[$name];
}
}
/*if($fld->type=='text'){
} else {
vmdebug('my fld ',$fld);
}*/
}
if (isset($data[$prefix . $name])) {
if (!empty($data[$prefix . $name])) {
if (is_array($data[$prefix . $name])) {
foreach ($data[$prefix . $name] as $k => $v) {
$data[$prefix . $name][$k] = self::filterCartInput($v);
}
} else {
$data[$prefix . $name] = self::filterCartInput($data[$prefix . $name]);
}
}
$address[$name] = $data[$prefix . $name];
} else {
//vmdebug('Data not found for type '.$type.' and name '.$prefix.$name.' ');
}
}
}
//dont store passwords in the session
unset($address['password']);
unset($address['password2']);
$this->{$type} = $address;
if ($putIntoSession) {
$this->setCartIntoSession(true);
}
}