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; }
function setValue($dimension, $value) { if (!isset(OPCcache::$cachedResult)) { OPCcache::$cachedResult = array(); } OPCcache::$cachedResult[$dimension] = $value; OPCcache::store($value, $dimension); }
function getPrefered() { $db = JFactory::getDBO(); $q = 'select template from #__template_styles where home = 1 and client_id = 0 limit 0,1'; $db->setQuery($q); $template = $db->loadResult(); $colors2 = OPCcache::get('css_' . $template); if (!empty($colors2)) { $colors = $colors2; return $colors; } $templateDir = JPATH_SITE . DS . 'templates' . DS . $template; if (!file_exists($templateDir)) { return; } $files = JFolder::files($templateDir, '.css', true, true, array()); $colors = array(); $this->getColors($files, $colors); OPCcache::store($colors, 'css_' . $template); return $colors; }