本文整理汇总了PHP中DataHandler::cleanStringsForSearch方法的典型用法代码示例。如果您正苦于以下问题:PHP DataHandler::cleanStringsForSearch方法的具体用法?PHP DataHandler::cleanStringsForSearch怎么用?PHP DataHandler::cleanStringsForSearch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataHandler
的用法示例。
在下文中一共展示了DataHandler::cleanStringsForSearch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: select
/**
* @desc
* @param $typeOfReturn
* @param $id
* @param $active
* @param $name
* @param $title
* @param $hat
* @param $description
* @param $content
* @param $author
* @param $template_url
* @param $slug
* @param $key_words
* @param $date
* @param $date_symbol
* @param $date_in
* @param $date_in_symbol
* @param $date_out
* @param $date_out_symbol
* @param $order_type
* @param $quant_limit
* @param $quant_started
* @param $search
* @param $locale
* @return unknown_type
*/
public function select($typeOfReturn = NULL, $id = NULL, $active = NULL, $name = NULL, $title = NULL, $hat = NULL, $description = NULL, $content = NULL, $author = NULL, $template_url = NULL, $slug = NULL, $key_words = NULL, $date = NULL, $date_symbol = ">=", $date_in = NULL, $date_in_symbol = ">=", $date_out = NULL, $date_out_symbol = ">=", $order_type = NULL, $quant_limit = NULL, $quant_started = NULL, $search = NULL, $locale = NULL)
{
$arrayFilter = array();
//
//SELECT
// count(content.id) as count_total ,
// content.*
//FROM
// content
// INNER JOIN
// therm
// ON `therm`.table = 'content'
// AND `therm`.therm = 'key_words'
// AND `therm`.locale = 'pt_BR'
// AND `therm`.value LIKE '%bill%'
//
//WHERE
// 1
// AND `content`.active = '1'
// AND `content`.id = `therm`.table_id
// GROUP BY `therm`.table_id
//é necessario passar a string a ser procurado e o locale para ralizar um search
$is_search = $search != NULL && $locale != NULL ? TRUE : FALSE;
if ($search) {
$search = urldecode($search);
$search = DataHandler::cleanStringsForSearch($search);
$search = str_replace(" ", "%", $search);
}
//echo Debug::li("prucura: ".$search." - locale: ".$locale);exit();
$query = "SELECT\r\n\t\t\t\t\t\t\t`content`.* ";
$query .= "FROM \r\n\t\t\t\t\t \t\tcontent ";
if ($is_search) {
$query .= "INNER JOIN \r\n\t\t\t\t\t\t\ttherm \r\n\t\t\t\t\t\t\t\tON `therm`.table = 'content' \r\n\t\t\t\t\t\t\t\tAND `therm`.therm = 'key_words' \r\n\t\t\t\t\t\t\t\tAND `therm`.locale = '{$locale}' \r\n\t\t\t\t\t\t\t\tAND `therm`.value LIKE '%{$search}%' \r\n\t\t\t\t\t\t\t\t";
}
$query .= " WHERE 1 ";
if ($is_search) {
$query .= " AND `content`.active = '1' \r\n\t\t\t\t\t\tAND `content`.id = `therm`.table_id\r\n\t\t\t\t\t\t\r\n\t\t\t";
}
$this->addFilter($query, $id, $active, $name, $title, $hat, $description, $content, $author, $template_url, $slug, $key_words, $date, $date_symbol, $date_in, $date_in_symbol, $date_out, $date_out_symbol, $order_type);
$queryCount = "SELECT\r\n\t\t\t\t\t\t\tcount(content.id) as count_total ";
$queryCount .= " FROM \r\n\t\t\t\t\t \t\tcontent ";
if ($is_search) {
$queryCount .= " INNER JOIN \r\n\t\t\t\t\t\t\ttherm \r\n\t\t\t\t\t\t\t\tON `therm`.table = 'content' \r\n\t\t\t\t\t\t\t\tAND `therm`.therm = 'key_words' \r\n\t\t\t\t\t\t\t\tAND `therm`.locale = '{$locale}' \r\n\t\t\t\t\t\t\t\tAND `therm`.value LIKE '%{$search}%' \r\n\t\t\t\t\t\t\t\t";
}
$queryCount .= " WHERE 1 ";
if ($is_search) {
$queryCount .= " AND `content`.active = '1' \r\n\t\t\t\t\t\t\t AND `content`.id = `therm`.table_id\r\n\t\t\t";
}
//Debug::print_r($query);exit();
//print_r($queryCount);exit();
$this->addFilter($queryCount, $id, $active, $name, $title, $hat, $description, $content, $author, $template_url, $slug, $key_words, $date, $date_symbol, $date_in, $date_in_symbol, $date_out, $date_out_symbol, $order_type);
//limite
$query .= parent::limit($quant_limit, $quant_started);
// Debug::print_r($query);exit();
//executa a query
$ReturnDataVO = parent::query($query);
// echo $queryCount;exit();
//executa a query para gerar count total
$ReturnTotalDataVO = parent::query($queryCount);
if ($ReturnDataVO->success) {
switch ($typeOfReturn) {
case DbInterface::RETURN_ARRAY:
$ReturnDataVO->fetchAll(ReturnDataVO::TYPE_FETCH_ARRAY);
break;
case DbInterface::RETURN_VO:
$ReturnDataVO->fetchAllVO($this);
break;
case DbInterface::RETURN_STD_OBJECT:
default:
//retornar tudo em objeto
$ReturnDataVO->fetchAll(ReturnDataVO::TYPE_FETCH_OBJECT);
break;
}
//.........这里部分代码省略.........
示例2: setKeyWords
/**
* @param $key_words
* @param $locale
* @return void
*/
public function setKeyWords($key_words, $locale = NULL)
{
if ($locale == NULL) {
$this->key_words = DataHandler::cleanStringsForSearch($key_words);
} else {
$this->addTherms(ContentVO::TERM_KEY_WORDS, $locale, DataHandler::cleanStringsForSearch($key_words));
}
}