public function initialize(Controller $controller) { // Verify AuthTicket Config exists & we have a secret Configure::load('auth_ticket'); if (Configure::read('auth_ticket.secret') == null) { // FAILZOR throw new InternalErrorException('AuthTicketComponent was unable to setup sucessfully. Missing secret.'); } $this->_key = Configure::consume('auth_ticket.secret'); $this->_defaultExpiration = Configure::read('auth_ticket.default_expiration') != null ? Configure::read('auth_ticket.default_expiration') : $this->_defaultExpiration; $this->_cookieName = Configure::read('auth_ticket.cookie_name') != null ? Configure::read('auth_ticket.cookie_name') : $this->_cookieName; $this->_domain = Configure::read('auth_ticket.domain') != null ? Configure::read('auth_ticket.domain') : $this->_cookieName; }
/** * startup callback * * @param \Cake\Event\Event $event Event. * @throws Exception If API Key is not provided * @return void */ public function startup(Event $event) { $key = Configure::consume('Openweathermap.key'); if (isset($key) && !empty($key)) { $this->config('key', $key); } else { throw new \Exception(__d('openweathermap', 'API Key must be provided')); } $lang = Configure::consume('Openweathermap.lang'); if (isset($lang) && !empty($lang)) { $this->config('lang', $lang); } $units = Configure::consume('Openweathermap.units'); if (isset($units) && !empty($units)) { $this->config('units', $units); } }
/** * testConsumeEmpty * * @return void */ public function testConsumeEmpty() { Configure::write('Test', array('key' => 'value', 'key2' => 'value2')); $result = Configure::consume(''); $this->assertNull($result); $result = Configure::consume(null); $this->assertNull($result); }
<?php $handlerConfig = Hash::merge(array('engine' => 'RedisSession.RedisSession', 'userMap' => true), Configure::consume('RedisSession.handler')); Configure::write('Session', Hash::merge(Configure::read('Session'), array('defaults' => 'php', 'handler' => $handlerConfig))); if (isset($handlerConfig['userMap'])) { if (extension_loaded('wddx')) { ini_set('session.serialize_handler', 'wddx'); } else { CakeLog::critical('wddx not available. user map not enabled'); } } if (class_exists('CroogoNav')) { CroogoNav::add('extensions.children.RedisSession', array('title' => __d('redis_session', 'Login Sessions'), 'url' => array('plugin' => 'redis_session', 'controller' => 'session_stores', 'action' => 'index'), 'children' => array())); }