public static function getWords() { if (self::$words !== null) { return self::$words; } self::$words = array(); if (@$_GET['mark']) { self::$words = array_merge(self::$words, preg_split('/\\s+/', trim($_GET['mark']))); } $referer = @$_SERVER['HTTP_REFERER']; if ($referer) { if (preg_match('/(?:\\?|&)words=([^&]+)(?:&|$)/', $referer, $match)) { self::$words = array_merge(self::$words, preg_split('/\\s+/', trim(urldecode($match[1])))); } if (preg_match('/(?:\\?|&)tags=([^&]+)(?:&|$)/', $referer, $match)) { self::$words = array_merge(self::$words, preg_split('/\\s+/', trim(urldecode($match[1])))); } if (preg_match('/http:\\/\\/www\\.google\\.\\w+\\/.*(?:\\?|&)q=([^&]+)(?:&|$)/', $referer, $match)) { self::$words = array_merge(self::$words, preg_split('/\\s+/', trim(urldecode($match[1])))); } if (preg_match('/http:\\/\\/www\\.bing\\.\\w+\\/.*(?:\\?|&)q=([^&]+)(?:&|$)/', $referer, $match)) { self::$words = array_merge(self::$words, preg_split('/\\s+/', trim(urldecode($match[1])))); } } return self::$words; }
function i18n_search_mark($content) { require_once GSPLUGINPATH . 'i18n_search/marker.class.php'; return I18nSearchMarker::mark($content, I18nSearchMarker::getWords()); }