/** * Do something before dispatch * @see Hush_App_Dispatcher */ public function __init() { // Auto load dao $this->dao = new Ihush_Dao(); // Super admin $this->view->_sa = $this->sa = defined('__ACL_SA') ? __ACL_SA : 'sa'; // Setting acl control object $this->view->_acl = $this->acl = Ihush_Acl_Backend::getInstance(); }
/** * Get static or cached acl object * * @return Ihush_Acl_Backend */ public static function getInstance() { if (!self::$_acl) { $class_name = __CLASS__; require_once 'Ihush/Cache.php'; // we store cache in 60 seconds $cache = Ihush_Cache::factory('File', 60); if (!(self::$_acl = $cache->load($class_name))) { self::$_acl = new $class_name(); // init the acl object $cache->save(self::$_acl, $class_name); } } return self::$_acl; }