本文整理汇总了PHP中KunenaRoute::search方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaRoute::search方法的具体用法?PHP KunenaRoute::search怎么用?PHP KunenaRoute::search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KunenaRoute
的用法示例。
在下文中一共展示了KunenaRoute::search方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build
protected static function build()
{
KUNENA_PROFILER ? KunenaProfiler::instance()->start('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null;
if (self::$search === false) {
$user = KunenaUserHelper::getMyself();
$language = JFactory::getDocument()->getLanguage();
$cache = self::getCache();
// FIXME: enable caching after fixing the issues
self::$search = false;
//unserialize($cache->get('search', "com_kunena.route.{$language}.{$user->userid}"));
if (self::$search === false) {
self::$search['home'] = array();
foreach (self::$menu as $item) {
// Joomla! 1.5:
if (!is_object($item) || isset($item->published) && $item->published < 1) {
continue;
}
// Do not add menu items for other languages
if (isset($item->language) && $item->language != '*' && strtolower($item->language) != strtolower($language)) {
continue;
}
if ($item->type == 'alias' && !empty($item->query['Itemid']) && !empty(self::$menu[$item->query['Itemid']])) {
// Follow links
$item = self::$menu[$item->query['Itemid']];
} elseif ($item->type == 'component' && $item->component == 'com_kunena' && isset($item->query['view'])) {
// Save Kunena menu items so that we can make fast searches
$home = self::getHome($item);
self::$search[$item->query['view']][$home ? $home->id : 0][$item->id] = $item->id;
}
}
// FIXME: enable caching after fixing the issues
//$cache->store(serialize(self::$search), 'search', "com_kunena.route.{$language}.{$user->userid}");
}
}
KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null;
}
示例2: build
protected static function build()
{
KUNENA_PROFILER ? KunenaProfiler::instance()->start('function '.__CLASS__.'::'.__FUNCTION__.'()') : null;
if (self::$search === false)
{
$user = KunenaUserHelper::getMyself();
$language = strtolower(JFactory::getDocument()->getLanguage());
self::$search = false;
if (KunenaConfig::getInstance()->get('cache_mid'))
{
// FIXME: Experimental caching.
$cache = self::getCache();
self::$search = unserialize($cache->get('search', "com_kunena.route.v1.{$language}.{$user->userid}"));
}
if (self::$search === false)
{
self::$search['home'] = array();
foreach (self::$menu as $item)
{
// Skip menu items that aren't pointing to Kunena or are using wrong language.
if (($item->component != 'com_kunena' && $item->type != 'alias')
|| ($item->language != '*' && strtolower($item->language) != $language))
{
continue;
}
// Follow links.
if ($item->type == 'alias')
{
if (empty($item->query['Itemid']) || empty(self::$menu[$item->query['Itemid']]))
{
continue;
}
$item = self::$menu[$item->query['Itemid']];
if ($item->component != 'com_kunena' || ($item->language != '*' && strtolower($item->language) != $language))
{
continue;
}
}
// Ignore legacy menu items without view in it.
if (!isset($item->query['view']))
{
continue;
}
// Save Kunena menu items so that we can make fast searches
$home = self::getHome($item);
self::$search[$item->query['view']][$home ? $home->id : 0][$item->id] = $item->id;
}
if (isset($cache))
{
$cache->store(serialize(self::$search), 'search', "com_kunena.route.v1.{$language}.{$user->userid}");
}
}
}
KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function '.__CLASS__.'::'.__FUNCTION__.'()') : null;
}
示例3: build
protected static function build() {
KUNENA_PROFILER ? KunenaProfiler::instance()->start('function '.__CLASS__.'::'.__FUNCTION__.'()') : null;
if (self::$search === false) {
$cache = JFactory::getCache('_system', 'output');
self::$search = unserialize($cache->get('search', 'com_kunena.route'));
if (self::$search === false) {
self::$search['home'] = array();
foreach ( self::$menu as $item ) {
if (! is_object ( $item ))
continue;
$home = self::getHome($item);
// Follow links
if ($item->type == 'menulink' && !empty($item->query['Itemid']) && !empty(self::$menu[$item->query['Itemid']])) {
$item = self::$menu[$item->query['Itemid']];
}
// Save Kunena menu items so that we can make fast searches
if ($item->type == 'component' && $item->component == 'com_kunena' && isset($item->query['view'])) {
self::$search[$item->query['view']][$home ? $home->id : 0][$item->id] = $item->id;
}
}
$cache->store(serialize(self::$search), 'search', 'com_kunena.route');
}
}
KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function '.__CLASS__.'::'.__FUNCTION__.'()') : null;
}