public static function setViewScript($path) { self::$_viewScript = $path; }
} else { $action = null; $actionProcessed = 'default'; } if (isset($_REQUEST['controller'])) { $controller = $_REQUEST['controller']; $controllerProcessed = strtolower($controller); while (false !== ($pos = strpos($actionProcessed, '_')) || false !== ($pos = strpos($controllerProcessed, '-'))) { $actionProcessed = substr($actionProcessed, 0, $pos) . strtoupper(substr($actionProcessed, $pos + 1, 1)) . substr($actionProcessed, $pos + 2); } $controllerProcessed = strtoupper(substr($controller, 0, 1)) . substr($controller, 1); } else { $controller = null; $controllerProcessed = 'Index'; } Log::debug(sprintf('index.php: routing finished (controller = %s, action = %s)', $logController, $logAction)); // Dispatch Log::debug(sprintf('index.php: dispatcherization started (controller = %s, action = %s)', $controllerProcessed, $actionProcessed)); ob_start(); Lpf_Dispatcher::dispatch(null, $actionProcessed); $cont = ob_get_flush(); Log::debug(sprintf('index.php: dispatcherization finished (controller = %s, action = %s)', $controllerProcessed, $actionProcessed)); // Cache if ($cont && $action != 'register' && $action != 'all_users') { $cacheTime = array('default' => 30 * 60, 'user_page' => 15 * 60, 'all_users' => 30 * 60, 'get' => 5 * 60); $cacheTimeSeconds = isset($cacheTime[$action]) ? $cacheTime[$action] : 10 * 60; $m = new Lpf_Memcache('habrometr'); $m->set($_SERVER['REQUEST_URI'], $cont . "\r\n<!-- cached version " . date('r') . ' -->', 0, $cacheTimeSeconds); Log::debug(sprintf('index.php: cache saved for `%s` expire in %d seconds', $_SERVER['REQUEST_URI'], $cacheTimeSeconds)); } Log::debug(sprintf('index.php: finished (%s)', $_SERVER['REQUEST_URI']));
public function defaultAction() { Lpf_Dispatcher::getView()->version = Habrometr_Model::VERSION; }