本文整理匯總了PHP中vB_Search_Core::create_criteria方法的典型用法代碼示例。如果您正苦於以下問題:PHP vB_Search_Core::create_criteria方法的具體用法?PHP vB_Search_Core::create_criteria怎麽用?PHP vB_Search_Core::create_criteria使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vB_Search_Core
的用法示例。
在下文中一共展示了vB_Search_Core::create_criteria方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: create_from_array
/**
* Create the results based on a list of ids return from the search implmentation
*
* @param vB_Current_User $user
* @param vB_Search_Criteria criteria for the search
* @return vB_Search_Results
*/
public static function create_from_array($user, $result_array)
{
global $vbulletin;
$results = new vB_Search_Results();
$results->user = $user;
$results->criteria = vB_Search_Core::create_criteria(vB_Search_Core::SEARCH_ADVANCED);
$results->criteria->set_grouped(vB_Search_Core::GROUP_NO);
$sanitized_results = array();
foreach ($result_array as $result) {
//if we only have the type and the id, add a dummy group id.
//we won't use it, but the code expects it.
if (count($result) == 2) {
$result[] = 0;
}
$sanitized_results[] = $result;
}
$results->results = $sanitized_results;
//move log_search call after get_results to allow for any changes to the $criteria
//object that might be made by the searchcontroller
$results->searchid = $results->log_search();
$results->dateline = TIMENOW;
$results->cache_results();
$searchtime = 0;
//todo: do we need to set $results->searchtime here as well?
$results->searchtime = $searchtime;
$results->complete_search($searchtime);
return $results;
}