getId():0; HookRegistry::register('TemplateManager::display',array(&$this, 'displayTemplateCallback')); return true; } return false; } function parse_quote_string($query_string) { /* urldecode the string and setup variables */ $query_string = urldecode($query_string); $quote_flag = false; $word = ''; $terms = array(); /* loop through character by character and move terms to an array */ for ($i=0; $iqueryTerms = array(); if (($referer = getenv('HTTP_REFERER')) == '') return false; $urlParts = parse_url($referer); if (!isset($urlParts['query'])) return false; $queryArray = explode('&', $urlParts['query']); foreach ($queryArray as $var) { $varArray = explode('=', $var); if (in_array($varArray[0], $queryVariableNames) && !empty($varArray[1])) { $this->queryTerms += $this->parse_quote_string($varArray[1]); } } if (empty($this->queryTerms)) return false; $templateMgr->addStylesheet(Request::getBaseUrl() . '/' . $this->getPluginPath() . '/sehl.css'); $templateMgr->register_outputfilter(array(&$this, 'outputFilter')); return false; } function outputFilter($output, &$smarty) { // Cannot trust strpos to accept a full string for the needle. $fromDiv = strstr($output, ''); $startIndex = strlen($output) - strlen($fromDiv) + $endOfBodyTagOffset + 1; $scanPart = substr($output, $startIndex); foreach ($this->queryTerms as $q) { // Thanks to Brian Suda http://suda.co.uk/projects/SEHL/ $newOutput = ''; $pat = '/((<[^!][\/]*?[^<>]*?>)([^<]*))|||((([^<]*))/si'; preg_match_all($pat, $scanPart, $tag_matches); for ($i=0; $i< count($tag_matches[0]); $i++) { if ( (preg_match('/\$3\$4\$5",' '.$tag_matches[3][$i].' '); $newOutput .= substr($holder,1,(strlen($holder)-2)); } } $scanPart = $newOutput; } return (substr($output, 0, $startIndex) . $newOutput); } function getDisplayName() { return __('plugins.generic.sehl.name'); } function getDescription() { return __('plugins.generic.sehl.description'); } } ?>