english/administrator/components/com_search/helpers/search.php
/**
	 * Checks an object for search terms (after stripping fields of HTML)
	 *
	 * @param object The object to check
	 * @param string Search words to check for
	 * @param array List of object variables to check against
	 * @returns boolean True if searchTerm is in object, false otherwise
	 */
Checks an object for search terms (after stripping fields of HTML)
@param object The object to check
@param string Search words to check for
@param array List of object variables to check against
@returns boolean True if searchTerm is in object, false otherwise
Checks an object for search terms ( after stripping fields of HTML ) @param object The object to check @param string Search words to check for @param array List of object variables to check against @returns boolean True if searchTerm is in object false otherwise
public static function checkNoHtml($object, $searchTerm, $fields)
	{
		$searchRegex = array(
				'#<script[^>]*>.*?</script>#si',
				'#<style[^>]*>.*?</style>#si',
				'#<!.*?(--|]])>#si',
				'#<[^>]*>#i'
				);
		$terms = explode(' ', $searchTerm);
		if (empty($fields)) return false;
		foreach($fields AS $field) {
			if (!isset($object->$field)) continue;
			$text = $object->$field;
			foreach($searchRegex As $regex) {
				$text = preg_replace($regex, '', $text);
			}
			foreach($terms AS $term) {
				if (JString::stristr($text, $term) !== false) {
					return true;
				}
			}
		}
		return false;
	}
public static function checkNoHtml ( $ object , $ searchTerm , $ fields ) { $ searchRegex = array ( '#<script[^>]*>.*?</script>#si' , '#<style[^>]*>.*?</style>#si' , '#<!.*?(--|]])>#si' , '#<[^>]*>#i' ) ; $ terms = explode ( ' ' , $ searchTerm ) ; if ( empty ( $ fields ) ) return false ; foreach ( $ fields AS $ field ) { if ( ! isset ( $ object -> $ field ) ) continue ; $ text = $ object -> $ field ; foreach ( $ searchRegex As $ regex ) { $ text = preg_replace ( $ regex , '' , $ text ) ; } foreach ( $ terms AS $ term ) { if ( JString :: stristr ( $ text , $ term ) !== false ) { return true ; } } } return false ; }
Checks an object for search terms (after stripping fields of HTML)
 @param object The object to check
 @param string Search words to check for
 @param array List of object variables to check against
 @returns boolean True if searchTerm is in object, false otherwise
Checks an object for search terms ( after stripping fields of HTML ) @param object The object to check @param string Search words to check for @param array List of object variables to check against @returns boolean True if searchTerm is in object false otherwise