/**
  * Load published modules
  *
  * @access	private
  * @return	array
  */
 function &_load()
 {
     global $mainframe, $Itemid;
     static $modules;
     if (isset($modules)) {
         return $modules;
     }
     $user =& JFactory::getUser();
     $db =& JFactory::getDBO();
     $aid = $user->get('aid', 0);
     $modules = array();
     $wheremenu = isset($Itemid) ? ' AND ( mm.menuid = ' . (int) $Itemid . ' OR mm.menuid = 0 )' : '';
     $query = 'SELECT id, title, module, position, content, showtitle, control, params' . ' FROM #__modules AS m' . ' LEFT JOIN #__modules_menu AS mm ON mm.moduleid = m.id' . ' WHERE m.published = 1' . ' AND m.access <= ' . (int) $aid . ' AND m.client_id = ' . (int) $mainframe->getClientId() . $wheremenu . ' ORDER BY position, ordering';
     $db->setQuery($query);
     if (null === ($modules = $db->loadObjectList())) {
         JError::raiseWarning('SOME_ERROR_CODE', JText::_('Error Loading Modules') . $db->getErrorMsg());
         return false;
     }
     // cACL module check
     if (class_exists('CACL_config')) {
         $config = new CACL_config($db);
         $config->load();
         //$this->_caclConfig = $config;
         self::$_caclConfig = $config;
         $app =& JFactory::getApplication();
         if (FALSE !== strpos(self::$_caclConfig->activate, $app->getName())) {
             check_modules($modules);
         }
     }
     $total = count($modules);
     for ($i = 0; $i < $total; $i++) {
         //determine if this is a custom module
         $file = $modules[$i]->module;
         $custom = substr($file, 0, 4) == 'mod_' ? 0 : 1;
         $modules[$i]->user = $custom;
         // CHECK: custom module name is given by the title field, otherwise it's just 'om' ??
         $modules[$i]->name = $custom ? $modules[$i]->title : substr($file, 4);
         $modules[$i]->style = null;
         $modules[$i]->position = strtolower($modules[$i]->position);
     }
     return $modules;
 }