示例#1
0
 /**
  * Genera la Lista de control de acceso
  */
 protected function createAcl()
 {
     $this->acl = new \Zend_Acl();
     $accessRoles = $this->getAccessRolesFromDatabase();
     $securityActions = $this->getSecurityActionsFromDatabase();
     $this->addAccessRoles($accessRoles);
     $this->addSecurityActions($securityActions);
     $this->grantPermissions();
     if ($this->enableCache) {
         $this->cache->save('acl', $this->acl);
     }
 }
示例#2
0
 /**
  *
  * @param string $string
  * @param string $language
  * @return string
  */
 public function translate($string, $language)
 {
     $key = "{$string}-to-{$language}";
     if ($this->cache->exists($key)) {
         return $this->cache->load($key);
     }
     if ($this->hasTranslate($string, $language)) {
         $strings = $this->getDBStrings($language);
         $string = $strings[$string];
         $this->cache->save($key, $string);
     }
     return $string;
 }
示例#3
0
文件: Chain.php 项目: Eximagen/sochi
 /**
  * Load
  * @param string $key
  * @return mixed
  */
 public function load($key)
 {
     if (!$this->exists($key)) {
         return null;
     }
     if ($this->primaryStorage->exists($key)) {
         return $this->primaryStorage->load($key);
     }
     if ($this->secondaryStorage->exists($key)) {
         $object = $this->secondaryStorage->load($key);
         $this->primaryStorage->save($key, $object);
         return $object;
     }
 }
示例#4
0
文件: Menu.php 项目: Eximagen/sochi
 /**
  *
  * @param  $menu
  * @param AbstractMenuRenderer $renderer
  * @return string
  */
 public function buildAndRender(AbstractMenuRenderer $renderer)
 {
     $keyStorage = 'menu_html_' . $this->role;
     if ($this->cache->exists($keyStorage)) {
         return $this->cache->load($keyStorage);
     }
     $this->build();
     $html = $this->render($this->getUserMenu(), $renderer);
     if (null == $renderer) {
         $this->cache->save($keyStorage, $html);
     }
     return $html;
 }