本文整理汇总了PHP中SearchEngine::searchTypeObjects方法的典型用法代码示例。如果您正苦于以下问题:PHP SearchEngine::searchTypeObjects方法的具体用法?PHP SearchEngine::searchTypeObjects怎么用?PHP SearchEngine::searchTypeObjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchEngine
的用法示例。
在下文中一共展示了SearchEngine::searchTypeObjects方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadSearchTypeObjects
/**
* Loads the search type objects.
*/
public static function loadSearchTypeObjects()
{
if (self::$searchTypeObjects !== null) {
return;
}
// get cache
WCF::getCache()->addResource('searchableMessageTypes-' . PACKAGE_ID, WCF_DIR . 'cache/cache.searchableMessageTypes-' . PACKAGE_ID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderSearchableMessageType.class.php');
self::$searchTypeData = WCF::getCache()->get('searchableMessageTypes-' . PACKAGE_ID);
// get objects
self::$searchTypeObjects = array();
foreach (self::$searchTypeData as $type) {
// calculate class path
$path = '';
if (empty($type['packageDir'])) {
$path = WCF_DIR;
} else {
$path = FileUtil::getRealPath(WCF_DIR . $type['packageDir']);
}
// include class file
if (!file_exists($path . $type['classPath'])) {
throw new SystemException("unable to find class file '" . $path . $type['classPath'] . "'", 11000);
}
require_once $path . $type['classPath'];
// create instance
$className = StringUtil::getClassName($type['classPath']);
if (!class_exists($className)) {
throw new SystemException("unable to find class '" . $className . "'", 11001);
}
self::$searchTypeObjects[$type['typeName']] = new $className();
}
}