コード例 #1
0
ファイル: moojon.cache.class.php プロジェクト: steview/moojon
 protected static function factory($class)
 {
     if (!self::$instance) {
         self::$instance = new $class();
     }
     return self::$instance;
 }
コード例 #2
0
ファイル: moojon.flash.class.php プロジェクト: steview/moojon
 protected static function post_set($key, $value = null, $data = null)
 {
     $flash_key = moojon_config::get('flash_key');
     $flash = array();
     if (!($flash = moojon_session::get_or_null($flash_key))) {
         $flash = array();
     }
     $flash[$key] = $value;
     moojon_session::set($flash_key, $flash);
     moojon_cache::disable();
 }
コード例 #3
0
 public static function render($path, $variables = array(), $uri = null)
 {
     if (moojon_cache::get_enabled() && $uri) {
         $cache_path = moojon_paths::get_cache_path($uri);
         if (moojon_cache::expired($uri)) {
             moojon_files::put_file_contents($cache_path, self::expose($path, $variables));
         }
         return moojon_files::get_file_contents($cache_path);
     } else {
         return self::expose($path, $variables);
     }
 }
コード例 #4
0
ファイル: moojon.uri.class.php プロジェクト: steview/moojon
 protected function __construct()
 {
     $uri = array_key_exists('REQUEST_URI', $_SERVER) ? $_SERVER['REQUEST_URI'] : $_SERVER['PATH_INFO'];
     $this->uri = self::clean_uri($uri);
     if ($match = moojon_routes::map($this->uri)) {
         $config = array_merge(moojon_config::get_data(), moojon_config::read(moojon_paths::get_project_config_environment_app_directory(ENVIRONMENT, $match->get('app'))));
         if (array_key_exists('secure', $config) && $config['secure'] === true && !moojon_security::authenticate()) {
             moojon_cache::disable();
             $pattern = ':app/:controller/:action';
             $match = new moojon_route_match($pattern, array_merge($match->get_params(), array('app' => $config['security_app'], 'controller' => $config['security_controller'], 'action' => $config['security_action'])), new moojon_route($pattern));
             $this->uri = $config['security_app'] . '/' . $config['security_controller'] . '/' . $config['security_action'];
         }
         $this->match = $match;
         $this->data = $this->match->get_params();
         $this->route = $this->match->get_route();
         self::try_define('APP', $this->data['app']);
         self::try_define('CONTROLLER', $this->data['controller']);
         self::try_define('ACTION', $this->data['action']);
     } else {
         self::_404($this->uri);
     }
 }