%PDF- %PDF-
Direktori : /home/lightco1/www/ilfanale.com.au/plugins/search/jsnpagebuildersearch/ |
Current File : /home/lightco1/www/ilfanale.com.au/plugins/search/jsnpagebuildersearch/jsnpagebuildersearch.php |
<?php /** * @version $Id$ * @package JSN_PageBuilder * @author JoomlaShine Team <support@joomlashine.com> * @copyright Copyright (C) 2012 JoomlaShine.com. All Rights Reserved. * @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html * * Websites: http://www.joomlashine.com * Technical Support: Feedback - http://www.joomlashine.com/contact-us/get-support.html */ defined('_JEXEC') or die('Restricted access'); if (file_exists(JPATH_ROOT . '/plugins/search/content/content.php') && JPluginHelper::getPlugin('search','content')) { include_once JPATH_ROOT . '/plugins/search/content/content.php'; include_once JPATH_ROOT . '/administrator/components/com_pagebuilder/helpers/shortcode.php'; class plgSearchJsnPagebuilderSearch extends PlgSearchContent { /** * Search content (articles). * The SQL must return the following fields that are used in a common display * routine: href, title, section, created, text, browsernav. * * @param string $text Target search string. * @param string $phrase Matching option (possible values: exact|any|all). Default is "any". * @param string $ordering Ordering option (possible values: newest|oldest|popular|alpha|category). Default is "newest". * @param mixed $areas An array if the search it to be restricted to areas or null to search all areas. * * @return array Search results. * * @since 1.6 */ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null) { $shortCodeRegex = JSNPagebuilderHelpersShortcode::getShortcodeRegex(); $results = @parent::onContentSearch($text, $phrase, $ordering, $areas); foreach ($results as $_result) { $_result->text = self::removeShortCode($_result->text, $shortCodeRegex); } return $results; } private static function removeShortCode($text, $shortCodeRegex) { if (is_array($text)) { $removeShortCodeText = ""; foreach ($text as $_text) { preg_match_all("/" . $shortCodeRegex . "/s", $_text, $tmp_params, PREG_PATTERN_ORDER); if (count($tmp_params[5]) > 0) { $removeShortCodeText .= self::removeShortCode($tmp_params[5], $shortCodeRegex); } else { $removeShortCodeText .= $_text; } } return $removeShortCodeText; } else { preg_match_all("/" . $shortCodeRegex . "/s", $text, $tmp_params, PREG_PATTERN_ORDER); if (count($tmp_params[5]) > 0) { return self::removeShortCode($tmp_params[5], $shortCodeRegex); } else { return $text; } } } } }