本文整理汇总了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;
}