isAdmin()) { return true; } // Set the variables $input = JFactory::getApplication()->input; $extension = $input->get('option', '', 'cmd'); // Check if the highlighter is enabled. if (!JComponentHelper::getParams($extension)->get('highlight_terms', 1)) { return true; } // Check if the highlighter should be activated in this environment. if (JFactory::getDocument()->getType() !== 'html' || $input->get('tmpl', '', 'cmd') === 'component') { return true; } // Get the terms to highlight from the request. $terms = $input->request->get('highlight', null, 'base64'); $terms = $terms ? json_decode(base64_decode($terms)) : null; // Check the terms. if (empty($terms)) { return true; } // Clean the terms array $filter = JFilterInput::getInstance(); $cleanTerms = array(); foreach ($terms as $term) { $cleanTerms[] = htmlspecialchars($filter->clean($term, 'string')); } // Activate the highlighter. JHtml::_('behavior.highlighter', $cleanTerms); // Adjust the component buffer. $doc = JFactory::getDocument(); $buf = $doc->getBuffer('component'); $buf = '
' . $buf . '
'; $doc->setBuffer($buf, 'component'); return true; } }