public function init() { $this->oAuth = new Module_Auth(); if ($iSessionTimeout = $this->oLithium->getConfig('General.Session_timeout')) { $this->oAuth->setTimeout($iSessionTimeout); } // load xajax lib Loader::loadClass('Library_Xajax', 'LXajax'); $this->oXajax = new LXajax(); $this->oXajax->registerXajaxFunctions($this); // if xajax call end executing rest of code if ($this->isAjaxCall()) { parent::init(); return; } // sprawdzanie czy uzytkownik niezalogowany if (!$this->isUserAllowed() && $this->getName() != "Login") { $this->redirect('/login'); return; } parent::init(); $this->mTemplate->headers = $this->oXajax->getJavascript(); $this->mTemplate->menu = $this->getMenu(); $this->mTemplate->aResources = []; }
public function __construct() { //ucitana SimpleImage klasa iz foldera classes parent::__construct(); Loader::loadClass("SimpleImage"); Loader::loadModel($this, "users"); $this->loginModule = new loginController(); }
public function testLoadClass() { $exists1 = Loader::loadClass('\\JooS\\VarSpace'); $this->assertTrue($exists1); $exists2 = Loader::loadClass('JooS_Exception_Class_Not_Exists'); $this->assertFalse($exists2); $exists3 = Loader::loadClass('PHPUnit_Framework_TestCase'); $this->assertTrue($exists3); }
/** * @covers Xmf\Loader::loadClass */ public function testLoadClass() { $x = Loader::loadClass(__CLASS__); $this->assertSame(true, $x); $x = Loader::loadClass('Xmf\\DebugTest'); $this->assertSame(true, $x); $x = Loader::loadClass('thisClassdoesntexists'); $this->assertSame(false, $x); }
public function prepare(&$groups) { if (!self::$filter) { $filter = array('__META__' => array('module' => 'TimeIt')); $items = $this->getItems($groups); // load the categories system if (!($class = Loader::loadClass('CategoryRegistryUtil'))) { z_exit('Unable to load class [CategoryRegistryUtil] ...'); } $properties = CategoryRegistryUtil::getRegisteredModuleCategories('TimeIt', 'TimeIt_events'); foreach ($properties as $prop => $catid) { $filter[$prop] = $items; } self::$filter = DBUtil::generateCategoryFilterWhere('TimeIt_events', false, $filter); } }
public function init() { // load xajax lib Loader::loadClass('Library_Xajax', 'LXajax'); //$this->oXajax = new LXajax(); $this->oXajax = new LXajax(null, null, array('debug' => true)); $this->oXajax->registerXajaxFunctions($this); // if xajax call end executing rest of code if ($this->oXajax->isAjaxCall()) { parent::init(); // prevent from sending master view $this->mTemplate = null; return; } parent::init(); $this->mTemplate->headers = $this->oXajax->getJavascript(); }
/** * Add/edit albums */ function mediashare_editapi_addAlbum(&$args) { $dom = ZLanguage::getModuleDomain('mediashare'); // Check basic access (but don't do fine grained Mediashare access check) if (!SecurityUtil::checkPermission('mediashare::', '::', ACCESS_EDIT)) { return LogUtil::registerPermissionError(); } // Set defaults // FIXME: what if not logged in - how about 'owner' ??? if (!isset($args['ownerId'])) { $args['ownerId'] = pnUserGetVar('uid'); } if (!isset($args['template']) || empty($args['template'])) { // Include null test $args['template'] = pnModGetVar('mediashare', 'defaultAlbumTemplate', 'Standard'); } // Parse extapp URL and add extapp data if (!mediashare_editapi_extappLocateApp($args)) { return false; } Loader::loadClass('RandomUtil'); $album = array('ownerId' => (int) $args['ownerId'], 'createdDate' => DateUtil::getDatetime(), 'title' => $args['title'], 'keywords' => $args['keywords'], 'summary' => $args['summary'], 'description' => $args['description'], 'template' => $args['template'], 'parentAlbumId' => (int) $args['parentAlbumId'], 'thumbnailSize' => (int) pnModGetVar('mediashare', 'thumbnailSize'), 'viewKey' => RandomUtil::getInteger(100000000, 999999999, true) * 10000 + RandomUtil::getInteger(1, 9999), 'extappURL' => $args['extappURL'], 'extappData' => $args['extappData']); $album = DBUtil::insertObject($album, 'mediashare_albums', 'id'); if ($album === false) { return LogUtil::registerError(__f('Error in %1$s: %2$s.', array('editapi.addAlbum', 'Could not add the new album.'), $dom)); } if (!pnModAPIFunc('mediashare', 'edit', 'updateNestedSetValues')) { return false; } if (!pnModAPIFunc('mediashare', 'edit', 'setDefaultAccess', array('albumId' => $album['id']))) { return false; } pnModCallHooks('item', 'create', "album-{$album['id']}", array('module' => 'mediashare', 'albumId' => $album['id'])); if (!pnModAPIFunc('mediashare', 'edit', 'updateKeywords', array('itemId' => $album['id'], 'type' => 'album', 'keywords' => $args['keywords']))) { return false; } if (!pnModAPIFunc('mediashare', 'edit', 'fetchExternalImages', array('albumId' => $album['id']))) { return false; } return $album['id']; }
<?php /** * Модуль видео. Поиск видео по YT, по собственной базе. Вывод, добавление, комментирование файлов. * @author Тимур 22.09.10 <*****@*****.**> * @version 1.0 */ //require_once "engine/libs/mysql/MySQLConnector.php"; Loader::loadClass('engine/libs/video/Zend/Loader.php'); Loader::loadClass("engine/libs/mysql/MySQLConnector.php"); class VideoThing extends MySQLConnector { /** * Количество файлов на странице. * @var integer */ const FILES_COUNT = 5; /** * Консртуктор. Выполняется подключение базового класса YT. */ function __construct() { $rootdir = $_SERVER["DOCUMENT_ROOT"]; substr($rootdir, -1) == "/" ? $rootdir : ($rootdir = $rootdir . "/"); $clientLibraryPath = 'engine/libs/video'; $oldPath = set_include_path($rootdir . $clientLibraryPath); Zend_Loader::loadClass('Zend_Gdata_YouTube'); parent::__construct(); $string = "CREATE TABLE IF NOT EXISTS `Videos` (\n\t\t\t `id` int(11) NOT NULL,\n\t\t\t `videoID` varchar(255) DEFAULT NULL,\n\t\t\t `title` varchar(255) DEFAULT NULL,\n\t\t\t `comment` varchar(500) DEFAULT NULL,\n\t\t\t `user` int(11) NOT NULL,\n\t\t\t `sqrty` int(11) DEFAULT NULL,\n\t\t\t `sq_list` varchar(1000) NOT NULL,\n\t\t\t PRIMARY KEY (`id`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=cp1251 ;"; $this->_sql->query($string); }
<?php //require_once '../../engine/modules/user/UserRegister.php'; require_once '../../engine/kernel/classLoader.php'; //это в любом случае на первом месте само собой /* * было так * require_once "../../engine/libs/mysql/MySQLConnector.php"; * а стало так * Loader::loadClass("engine/libs/mysql/MySQLConnector.php"); */ //Loader::loadClass("engine/modules/user/UserFull.php"); Loader::loadClass("engine/libs/mysql/MySQLConnector.php"); Loader::loadClass("engine/modules/video/Video.php"); Loader::loadClass("config/databaseConsts.php"); switch ($_POST["type"]) { case "add": die(add2my($_POST)); break; case "del": die(delVideo($_POST)); break; default: break; } function myOrUserVideos($postParams, $getParams, $siteParams) { /*$user=new User(); $visitor = $user->id;*/ //$userocheg=new UserFull(); $userocheg->id;
public function __construct() { Loader::loadClass("Navigation"); }
/** * modify block settings * * @author The Zikula Development Team * @param array $blockinfo a blockinfo structure * @return output the bock form */ public function modify($blockinfo) { // Get current content $vars = BlockUtil::varsFromContent($blockinfo['content']); // Defaults if (!isset($vars['hourfrom'])) { $vars['hourfrom'] = -1; } if (!isset($vars['hourto'])) { $vars['hourto'] = -1; } if (!isset($vars['monfrom'])) { $vars['monfrom'] = -1; } if (!isset($vars['monto'])) { $vars['monto'] = -1; } if (!isset($vars['mdayfrom'])) { $vars['mdayfrom'] = -1; } if (!isset($vars['mdayto'])) { $vars['mdayto'] = -1; } if (!isset($vars['wdayfrom'])) { $vars['wdayfrom'] = -1; } if (!isset($vars['wdayto'])) { $vars['wdayto'] = -1; } if (!isset($vars['cache_time'])) { $vars['cache_time'] = 120; } if (!isset($vars['cache_dir'])) { $vars['cache_dir'] = 'any_cache'; } if (!isset($vars['ballooncolor'])) { $vars['ballooncolor'] = 'grey'; } $ballooncolor = $vars['ballooncolor']; $this->view->assign('balloonselected' . $ballooncolor, 'selected="selected"'); if (!isset($vars['enablefacebookshare'])) { $vars['enablefacebookshare'] = false; } // Create output object $this->view->caching = false; // Select categories only if enabled for the module $enablecategorization = ModUtil::getVar($this->name, 'enablecategorization'); if ($enablecategorization) { // load the categories system if (!Loader::loadClass('CategoryRegistryUtil')) { return LogUtil::registerError(__f('Error! Could not load [%s] class.'), 'CategoryRegistryUtil'); } // Get the registrered categories for the module $catregistry = CategoryRegistryUtil::getRegisteredModuleCategories($this->name, 'quotes'); $this->view->assign('catregistry', $catregistry); } $this->view->assign('enablecategorization', $enablecategorization); $this->view->assign($vars); // assign the block vars if (!isset($vars['category']) || !is_array($vars['category'])) { $vars['category'] = array(); } $this->view->assign('category', $vars['category']); $this->view->assign('hours', range(0, 23)); $this->view->assign('months', range(1, 12)); $this->view->assign('wdays', range(1, 7)); $this->view->assign('mdays', range(1, 31)); // return the output return $this->view->fetch('quotes_block_quote_modify.tpl'); }
<?php require_once "Loader.php"; require_once 'Router.php'; include_once realpath("controllers/baseController.php"); include_once realpath("models/baseModel.php"); Loader::loadClass('Session'); Loader::loadClass('Cookie'); Session::start(); //Loader::loadClass('Cookie'); //Cookie::set('interval', "100", "1", "/", false, false); //Cookie::set('intervalDrugi', "100", "1", "/", false, false); //$cookie = Cookie::get("interval"); //var_dump($cookie); //$del = Cookie::delete("intervalDrugi"); //var_dump($del); /** * $_GET['rt'] automatski setova u .htaccess fajlu regularnim izrazom */ $route = new Router($_GET['rt']); $controller = $route->getController(); $method = $route->getMethod(); $params = $route->getParams(); Loader::loadController($controller, $method, $params);
$request = Request::current(); list($res, $priv, $crl) = explode('/', $mod_path); $result = array('success' => false); $testRes = $res; $testPriv = $priv; //初始化action if (empty($res)) { $res = 'home'; } if (empty($priv)) { $priv = 'index'; } isset($g_timer) && $g_timer->setMarker('dust.main start check role'); isset($g_timer) && $g_timer->setMarker('dust.main over checked'); $ctl_class = !empty($crl) ? ucfirst($res) . '_' . ucfirst($priv) . '_' . ucfirst($crl) : ucfirst($res) . '_' . ucfirst($priv); Loader::loadClass($ctl_class); if (($_SERVER['REQUEST_URI'] == '/' && (empty($testRes) && empty($testPriv)) || strpos($_SERVER['REQUEST_URI'], ".")) && class_exists($ctl_class, false)) { $ctl_obj = new $ctl_class(); isset($g_timer) && $g_timer->setMarker('dust.main class instanced'); // TODO: cache process $cached = checkCached($res, $priv, $crl, $request->format); if (is_array($cached) && isset($cached['life']) && isset($cached['cache_key'])) { $cache_life = $cached['life']; $cache_key = $cached['cache_key']; } else { $cache_life = intval($cached); $cache_key = sprintf("huitong_www_ac_%u_%s", crc32($_SERVER['REQUEST_URI']), $request->format); } if (!$request->isPost() && $cache_life > 0) { $cache = Cache_Memcache::getInstance(); $result = $cache->get($cache_key);
/** * modify block settings * * @author The Zikula Development Team * @param array $blockinfo a blockinfo structure * @return output the bock form */ public function modify($blockinfo) { // Get current content $vars = BlockUtil::varsFromContent($blockinfo['content']); // Defaults if (!isset($vars['cache_time'])) { $vars['cache_time'] = 600; } if (!isset($vars['cache_dir'])) { $vars['cache_dir'] = 'any_cache'; } if (!isset($vars['enablefacebookshare'])) { $vars['enablefacebookshare'] = false; } // Create output object $this->view->caching = false; # Admin output changes often, we do not want caching // Select categories only if enabled for the module $enablecategorization = ModUtil::getVar($this->name, 'enablecategorization'); if ($enablecategorization) { // load the categories system if (!Loader::loadClass('CategoryRegistryUtil')) { return LogUtil::registerError(__f('Error! Could not load [%s] class.'), 'CategoryRegistryUtil'); } // Get the registrered categories for the module $catregistry = CategoryRegistryUtil::getRegisteredModuleCategories($this->name, 'ephem'); $this->view->assign('catregistry', $catregistry); } $this->view->assign('enablecategorization', $enablecategorization); $this->view->assign($vars); // assign the block vars if (!isset($vars['category']) || !is_array($vars['category'])) { $vars['category'] = array(); } $this->view->assign('category', $vars['category']); // return the output return $this->view->fetch('ephemerides_block_ephemeride_modify.tpl'); }
/** * create placeholder for categories */ private function _feeds_createdefaultcategory($regpath = '/__SYSTEM__/Modules/Global') { // load necessary classes Loader::loadClass('CategoryUtil'); Loader::loadClassFromModule('Categories', 'Category'); Loader::loadClassFromModule('Categories', 'CategoryRegistry'); // get the language code $lang = ZLanguage::getLanguageCode(); $dom = ZLanguage::getModuleDomain('Feeds'); // get the category path for which we're going to insert our place holder category $rootcat = CategoryUtil::getCategoryByPath('/__SYSTEM__/Modules'); $fCat = CategoryUtil::getCategoryByPath('/__SYSTEM__/Modules/Feeds'); if (!$fCat) { // create placeholder for all the module categories $cat = new Categories_DBObject_Category(); $cat->setDataField('parent_id', $rootcat['id']); $cat->setDataField('name', 'Feeds'); $cat->setDataField('display_name', array($lang => __('Feeds', $dom))); $cat->setDataField('display_desc', array($lang => __('Feed Reader.', $dom))); if (!$cat->validate('admin')) { return false; } $cat->insert(); $cat->update(); } // get the category path for which the feeds will be classified $rootcat = CategoryUtil::getCategoryByPath($regpath); if ($rootcat) { // create an entry in the categories registry $registry = new Categories_DBObject_Registry(); $registry->setDataField('modname', 'Feeds'); $registry->setDataField('table', 'feeds'); $registry->setDataField('property', 'Main'); $registry->setDataField('category_id', $rootcat['id']); $registry->insert(); } else { return false; } return true; }
/** * PHP Magic Method to handle class auto load * @param string $className class which must be loaded */ function __autoload($className) { Loader::loadClass($className); }
public function init() { $this->oAuth = new Module_Auth(); if ($iSessionTimeout = $this->oLithium->getConfig('General.Session_timeout')) { $this->oAuth->setTimeout($iSessionTimeout); } // load xajax lib Loader::loadClass('Library_Xajax', 'LXajax'); $this->oXajax = new LXajax(); // if xajax call end executing rest of code if ($this->isAjaxCall()) { parent::init(); return; } // sprawdzanie czy uzytkownik niezalogowany if (!$this->oAuth->isLoggedIn()) { // przed wywolaniem konstruktora rodzica ustawiamy sciezke do layoutu View::setDefaultTemplateDir('ciao_new/'); parent::init(); // wiadomosc powitalna $this->mTemplate->aWelcomeMessage = array('sDinnersFullName' => '', 'sText' => $this->getLang('catering.welcome_text_not_loggedin')); $aMenu['Menu uzytkownika']['login'] = array('sTarget' => '/user/login/', 'sText' => $this->getLang('user.login')); // $aMenu[ 'Menu uzytkownika' ][] = array(); // $aMenu['Menu uzytkownika']['register'] = array('sTarget' => '/user/register/', 'sText' => $this->getLang('user.register')); } else { // logged in $this->oCurrentUser = $this->oAuth->getLoggedInUser(); if (!empty($this->aRolesAllowed) && !in_array($this->oCurrentUser->get('role_id')->name, $this->aRolesAllowed)) { $this->redirect('/'); echo ' '; } if (is_null($sLayout = $this->oCurrentUser->propertie('template'))) { $iLayoutId = (int) $this->oCurrentUser->layout_id; if ($iLayoutId != 0) { $oLayout = new Model_Layout($iLayoutId); $aLayout = $oLayout->getRow(); $this->oCurrentUser->propertie('template', $aLayout['path']); } else { $this->oCurrentUser->propertie('template', ''); } } View::setDefaultTemplateDir($this->oCurrentUser->propertie('template')); parent::init(); //dodajemy info o posilku na dzis $this->showOrdersForToday(); $this->mTemplate->header_username = $this->getLang('catering.header_username', $this->oCurrentUser->name); $aMenu['Menu uzytkownika'][] = array('sTarget' => '/', 'sText' => 'Strona glowna'); $aMenu['Menu uzytkownika'][] = array(); $aMenu['Menu uzytkownika'][] = array('sTarget' => '/catering/enrol/', 'sText' => $this->getLang('catering.enrol')); $aMenu['Menu uzytkownika'][] = array(); $aMenu['Menu uzytkownika'][] = array('sTarget' => '/user/settings/', 'sText' => 'Ustawienia'); $aMenu['Menu uzytkownika'][] = array(); $aMenu['Menu uzytkownika']['login'] = array('sTarget' => '/user/logout/', 'sText' => $this->getLang('user.logout')); $this->sRole = $this->oCurrentUser->get('role_id')->name; switch ($this->sRole) { case 'admin': $sTitle = $this->getLang('account.administration'); $aMenu[$sTitle][] = array('sTarget' => '/account/', 'sText' => $this->getLang('account.settings')); $aMenu[$sTitle][] = array(); $aMenu[$sTitle][] = array('sTarget' => '/account/user/', 'sText' => $this->getLang('account.add_user')); $aMenu[$sTitle][] = array(); $aMenu[$sTitle][] = array('sTarget' => '/account/users/', 'sText' => $this->getLang('account.user_list')); case 'moderator': $sTitle = $this->getLang('account.dinners_menu'); $aMenu[$sTitle][] = array('sTarget' => '/account/types/', 'sText' => 'Typy skladnikow'); $aMenu[$sTitle][] = array(); $aMenu[$sTitle][] = array('sTarget' => '/account/course/', 'sText' => 'Dodaj skladnik'); $aMenu[$sTitle][] = array(); $aMenu[$sTitle][] = array('sTarget' => '/account/courses/', 'sText' => 'Lista skladnikow'); $aMenu[$sTitle][] = array(); $aMenu[$sTitle][] = array('sTarget' => '/account/meals/', 'sText' => 'Dania'); $aMenu[$sTitle][] = array(); $aMenu[$sTitle][] = array('sTarget' => '/account/orders/', 'sText' => 'Edycja zamowien'); $sTitle = $this->getLang('account.summary_menu'); $aMenu[$sTitle][] = array('sTarget' => '/account/summary/users/', 'sText' => 'Kosztow na dzien'); $aMenu[$sTitle][] = array(); $aMenu[$sTitle][] = array('sTarget' => '/account/summary/', 'sText' => 'Zamowienia'); break; } } // set images for sorter Module_Sorter::setImageUrl('arrow-sort-up.gif', Module_Sorter::SORT_ASC); Module_Sorter::setImageUrl('arrow-sort-down.gif', Module_Sorter::SORT_DESC); $this->mTemplate->aMeta = array(); $this->mTemplate->title = 'Catering'; $this->mTemplate->menu = $aMenu; }
if($_SERVER['SERVER_ADDR']=='127.0.0.1') { /*PHP error settings*/ error_reporting(E_ALL ^ E_NOTICE); ini_set('display_errors','On'); $sConfig = 'development'; } else { } //load config $aConfig = parse_ini_file("applications/{$sConfig}.ini", true); //constants $oLoader->loadClass('Constants'); //call Bootstrap include('applications/Bootstrap.php'); $oController = $oLoader->loadController($controller); //call action $oController->$action(); $oLoader->renderView($oController, $action);
/** * Set the class name to use for the default registry instance. * Does not affect the currently initialized instance, it only applies * for the next time you instantiate. * * @param string $registryClassName * @return void * @throws \RuntimeException if the registry is initialized or if the * class name is not valid. */ public static function setClassName($registryClassName = '\\Zend\\Registry') { if (self::$_registry !== null) { throw new \RuntimeException('Registry is already initialized'); } if (!is_string($registryClassName)) { throw new \RuntimeException("Argument is not a class name"); } /** * @see Zend\\Loader */ if (!class_exists($registryClassName)) { Loader::loadClass($registryClassName); } self::$_registryClassName = $registryClassName; }
/** * Return some useful News links * * Syntax used in menutree * {ext:Blocks:news:[flat=BOOL&links=view,add,cat,arch|ALL]} * Params in [] are optional and * flat - true or false, if set to true links are ungrouped (default is false) * links - list of elements, default is ALL, avaiable items: * - view - link to main News view * - add - link do Submit News form * - cat - list of News categories * - arch - link to News archive * Items are displayed in order provided in menutree * * @param array $args['item'] menu node to be replaced * @param string $args['lang'] current menu language * @param string $args['extrainfo'] additional params * @return mixed array of links if successful, false otherwise */ public function news($args) { $dom = ZLanguage::getModuleDomain('menutree'); $item = isset($args['item']) && !empty($args['item']) ? $args['item'] : null; $lang = isset($args['lang']) && !empty($args['lang']) ? $args['lang'] : null; $bid = isset($args['bid']) && !empty($args['bid']) ? $args['bid'] : null; $extrainfo = isset($args['extrainfo']) && !empty($args['extrainfo']) ? $args['extrainfo'] : null; // $item ang lang params are required if (!$item || !$lang) { return false; } // is there is extrainfo - convert it into array, parse_str is quite handy if ($extrainfo) { parse_str($extrainfo, $extrainfo); } $extrainfo['flat'] = isset($extrainfo['flat']) ? (bool) $extrainfo['flat'] : false; $extrainfo['links'] = isset($extrainfo['links']) ? explode(',', $extrainfo['links']) : array('all'); // get id for first element, use api func to aviod id conflicts inside menu $idoffset = Blocks_MenutreeUtil::getIdOffset($item['id']); $lineno = 0; // load plugin language file $modinfo = ModUtil::getInfo(ModUtil::getIdFromName('News')); $links = array(); // build some link // you may use associative array keys if (!$extrainfo['flat']) { $links['news'] = array($lang => array('id' => $idoffset++, 'name' => $item['name'], 'href' => ModUtil::url('News'), 'title' => $item['title'], 'className' => $item['className'], 'state' => $item['state'], 'lang' => $lang, 'lineno' => $lineno++, 'parent' => $item['parent'])); } $parentNode = !$extrainfo['flat'] ? $links['news'][$lang]['id'] : $item['parent']; if (in_array('all', $extrainfo['links']) || in_array('view', $extrainfo['links'])) { $links['view'] = array($lang => array('id' => $idoffset++, 'name' => $modinfo['displayname'], 'href' => ModUtil::url('News'), 'title' => __('View news', $dom), 'className' => '', 'state' => 1, 'lang' => $lang, 'lineno' => $lineno++, 'parent' => $parentNode)); } if (in_array('all', $extrainfo['links']) || in_array('arch', $extrainfo['links'])) { $links['arch'] = array($lang => array('id' => $idoffset++, 'name' => __('Archive', $dom), 'href' => ModUtil::url('News', 'user', 'archives'), 'title' => __('Archive', $dom), 'className' => '', 'state' => 1, 'lang' => $lang, 'lineno' => $lineno++, 'parent' => $parentNode)); } if (in_array('all', $extrainfo['links']) || in_array('add', $extrainfo['links'])) { $links['add'] = array($lang => array('id' => $idoffset++, 'name' => __('Submit news', $dom), 'href' => ModUtil::url('News', 'user', 'new'), 'title' => __('Submit news', $dom), 'className' => '', 'state' => 1, 'lang' => $lang, 'lineno' => $lineno++, 'parent' => $parentNode)); } if (in_array('all', $extrainfo['links']) || in_array('cat', $extrainfo['links'])) { if (!$extrainfo['flat']) { $links['cat'] = array($lang => array('id' => $idoffset++, 'name' => __('Categories', $dom), 'href' => ModUtil::url('News'), 'title' => __('Categories', $dom), 'className' => '', 'state' => 1, 'lang' => $lang, 'lineno' => $lineno++, 'parent' => $parentNode)); } $catParentNode = !$extrainfo['flat'] ? $links['cat'][$lang]['id'] : $item['parent']; Loader::loadClass('CategoryRegistryUtil'); Loader::loadClass('CategoryUtil'); $catregistry = CategoryRegistryUtil::getRegisteredModuleCategories('News', 'stories'); if (!empty($catregistry)) { $multicategory = count($catregistry) > 1; $catLinks = array(); foreach ($catregistry as $prop => $catid) { if ($multicategory && !$extrainfo['flat']) { $parentCategory = CategoryUtil::getCategoryByID($catid); $catLinks[$catid] = array($lang => array('id' => $idoffset++, 'name' => isset($parentCategory['display_name'][$lang]) && !empty($parentCategory['display_name'][$lang]) ? $parentCategory['display_name'][$lang] : $parentCategory['name'], 'href' => '', 'title' => isset($parentCategory['display_name'][$lang]) && !empty($parentCategory['display_name'][$lang]) ? $parentCategory['display_name'][$lang] : $parentCategory['name'], 'className' => '', 'state' => 1, 'lang' => $lang, 'lineno' => $lineno++, 'parent' => $catParentNode)); } $categories = CategoryUtil::getSubCategories($catid); foreach ($categories as $cat) { $catLinks[$cat['id']] = array($lang => array('id' => $idoffset++, 'name' => isset($cat['display_name'][$lang]) && !empty($cat['display_name'][$lang]) ? $cat['display_name'][$lang] : $cat['name'], 'href' => ModUtil::url('News', 'user', 'view', array('prop' => $prop, 'cat' => $cat['name'])), 'title' => isset($cat['display_name'][$lang]) && !empty($cat['display_name'][$lang]) ? $cat['display_name'][$lang] : $cat['name'], 'className' => '', 'state' => 1, 'lang' => $lang, 'lineno' => $lineno++, 'parent' => isset($catLinks[$cat['parent_id']]) ? $catLinks[$cat['parent_id']][$lang]['id'] : $catParentNode)); } } } elseif (!$extrainfo['flat']) { unset($links['cat']); } } // sort links in order provided in menutree if (!in_array('all', $extrainfo['links'])) { $sortedLinks = array(); if (!$extrainfo['flat']) { $sortedLinks[] = $links['news']; } foreach ($extrainfo['links'] as $l) { if (isset($links[$l]) && !empty($links[$l])) { $sortedLinks[] = $links[$l]; } if ($l == 'cat') { $sortedLinks = array_merge((array) $sortedLinks, (array) $catLinks); } } $links = $sortedLinks; } return $links; }