Source for file Query.php
Documentation is available at Query.php
* "THE BEER-WARE LICENSE" (Revision 42):
* "Sven Strittmatter" <ausserirdisch@sven-space.de> wrote this file.
* As long as you retain this notice you can do whatever you want with
* this stuff. If we meet some day, and you think this stuff is worth it,
* you can buy me a beer in return.
* @package MediaSearch_Search
* @copyright Copyright (c) 2009 Sven Strittmatter
* @package MediaSearch_Search
* @copyright Copyright (c) 2009 Sven Strittmatter
const ALLOWED_QUOTE = '"';
const DISALLOWED_QUOTE = "'";
$this->queryString = trim($string);
if (!$this->isEmpty() && null === $this->preparedQuery) {
$this->preparedQuery = $this->prepareQuery($this->queryString);
return $this->preparedQuery;
return (strlen($this->queryString) === 0);
private function prepareQuery($string) {
$preparedQuery = $this->split($string);
/*private function removeBadChars($string) {
private function replaceQuotes($string) {
return str_replace(self::DISALLOWED_QUOTE, self::ALLOWED_QUOTE, $string);
private function hasQuotetParts($string) {
return (false === strpos(self::ALLOWED_QUOTE, $string) ? false : true);
private function splitByQuotes($string) {
private function split($string) {
$pattern = '/[\s,._\-\/]+/';
return preg_split($pattern, $string, - 1, PREG_SPLIT_NO_EMPTY);
|