function searchtext() { jimport('joomla.filesystem.file'); jimport('joomla.filesystem.folder'); require_once JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'helpers' . DS . 'cache.php'; $search = JRequest::getVar('searchwhat', '', 'post', 'string', JREQUEST_ALLOWRAW); if (empty($search)) { return ''; } $searchext = JRequest::getVar('ext'); if (empty($searchext)) { return ''; } if ($searchext == '*') { $searchext = '.'; } else { $searchext = '.' . $searchext; } $xc = JRequest::getVar('excludecache', false); $cs = JRequest::getVar('casesensitive', false); $ftest = OPCcache::getValue('opcsearch' . $searchext); if (empty($ftest)) { $files = JFolder::files(JPATH_SITE, $searchext, true, true); } else { $files = $ftest; } OPCcache::store($files, 'opcsearch' . $searchext); $os = JRequest::getVar('onlysmall', false); $resa = array(); foreach ($files as $f) { // exclude cache: if ($xc) { if (stripos($f, 'cache') !== false) { continue; } } if ($os) { if (filesize($f) > 500000) { continue; } } $data = file_get_contents($f); if (!$cs) { if (stripos($data, $search) !== false) { $resa[] = $f; } } else { if (strpos($data, $search) !== false) { $resa[] = $f; } } } $ret = implode($resa, "<br />\n"); return $ret; }
/** * Calculates the effecting Shipment prices for the calculation * @copyright (c) 2009 VirtueMart Team. All rights reserved. * @author Max Milbers * @author Valerie Isaksen * @param $code The Id of the coupon * @return $rules ids of the coupons */ function calculateShipmentPrice($cart, $ship_id, $checkAutomaticSelected = true) { $val = OPCcache::getValue(calculationHelperOPC::$_forhash); if (!empty($val)) { $this->_cartData['shipmentName'] = $val['shipmentName']; OPCcache::arrayMerge($this->_cartPrices, $val); return $this->_cartPrices; } $this->_cartData['shipmentName'] = JText::_('COM_VIRTUEMART_CART_NO_SHIPMENT_SELECTED'); $this->_cartPrices['shipmentValue'] = 0; //could be automatically set to a default set in the globalconfig $this->_cartPrices['shipmentTax'] = 0; $this->_cartPrices['salesPriceShipment'] = 0; $this->_cartPrices['shipment_calc_id'] = 0; // check if there is only one possible shipment method $automaticSelectedShipment = $cart->CheckAutomaticSelectedShipment($this->_cartPrices, $checkAutomaticSelected); if ($automaticSelectedShipment) { $ship_id = $cart->virtuemart_shipmentmethod_id; } if (empty($ship_id)) { $arr = OPCcache::getSearch('shipment', $this->_cartPrices); $arr['shipmentName'] = $this->_cartData['shipmentName']; $val = OPCcache::setValue(calculationHelperOPC::$_forhash, $arr); return $this->_cartPrices; } // Handling shipment plugins if (!class_exists('vmPSPlugin')) { require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php'; } JPluginHelper::importPlugin('vmshipment'); $dispatcher = JDispatcher::getInstance(); $returnValues = $dispatcher->trigger('plgVmonSelectedCalculatePriceShipment', array($cart, &$this->_cartPrices, &$this->_cartData['shipmentName'])); /* * Plugin return true if shipment rate is still valid * false if not any more */ $shipmentValid = 0; foreach ($returnValues as $returnValue) { $shipmentValid += $returnValue; } if (!$shipmentValid) { $cart->virtuemart_shipmentmethod_id = 0; $cart->setCartIntoSession(); } // store the cached response $arr = OPCcache::getSearch('shipment', $this->_cartPrices); $arr['shipmentName'] = $this->_cartData['shipmentName']; $val = OPCcache::setValue(calculationHelperOPC::$_forhash, $arr); return $this->_cartPrices; }
public function plgVmDisplayListFEShipmentOPC(&$cart, $selected = 0, &$htmlIn) { if (!isset($cart->vendorId)) { $cart->vendorId = 1; } if ($this->_type != 'vmshipment') { return; } $pluginmethod_id = $this->_idName; //virtuemart_shipmentmethod_id $pluginName = $this->_psType . '_name'; // shipment_name $pluginName = $this->_name; $data = array($selected, $pluginmethod_id, $pluginName); $hash = OPCcache::getGeneralCacheHash('plgVmDisplayListFEShipment', $cart, $data); $val = OPCcache::getValue($hash); VmPlugin::$iCount++; if (!empty($val)) { if (empty($val[0])) { break; //return $val[0]; } else { foreach ($val[1] as $vala) { $htmlIn[] = $vala; } return true; } } $htmlIn2 = array(); $val = $this->plgVmDisplayListFEShipmentOPCNocache($cart, $selected, $htmlIn2); $html = ''; if (is_array($htmlIn2)) { foreach ($htmlIn2 as $h) { if (is_array($h)) { foreach ($h as $h2) { $html .= $h2; } } else { $html .= $h; } } } else { $html = $htmlIn2; } if (!empty($html) || stripos($html, 'virtuemart_shipmentmethod_id') !== false) { if (stripos($html, 'error') === false) { $val2 = OPCcache::setValue($hash, array($val, $htmlIn2)); } } if (!empty($htmlIn2)) { $htmlIn = array_merge($htmlIn, $htmlIn2); } return $val; }