예제 #1
0
파일: dispatcher.php 프로젝트: bermi/akelos
 public function dispatchAppServer($context)
 {
     $_ENV = $_SERVER = $context['env'];
     @parse_str($_ENV['QUERY_STRING'], $_GET);
     $_GET['ak'] = $_ENV['PATH_INFO'];
     Ak::unsetStaticVar('AkRequestSingleton');
     Ak::unsetStaticVar('AkRouterSingleton');
     Ak::unsetStaticVar('AkUrlWriterSingleton');
     AkConfig::setOption('Request.remote_ip', '127.0.0.1');
     try {
         $time_start = microtime(true);
         AK_ENABLE_PROFILER && AkDebug::profile(__CLASS__ . '::' . __FUNCTION__ . '() call');
         $this->Request = AkRequest::getInstance();
         $this->Response = new AkResponse();
         $path = ltrim(str_replace('..', '.', $context['env']['REQUEST_URI']), '/. ');
         if (empty($path) && file_exists(AK_PUBLIC_DIR . DS . 'index.html')) {
             $Controller = new AkActionController();
             $Controller->Response = $this->Response;
             $Controller->renderText(file_get_contents(AK_PUBLIC_DIR . DS . 'index.html'));
             return $Controller->Response;
         } elseif (!empty($path) && file_exists(AK_PUBLIC_DIR . DS . $path)) {
             $Controller = new AkActionController();
             $Controller->Response = $this->Response;
             $Controller->sendFile(AK_PUBLIC_DIR . DS . $path, array('stream' => false));
             return $Controller->Response;
         } else {
             if ($this->Controller = $this->Request->recognize()) {
                 $this->Controller->ak_time_start = $time_start;
                 AK_ENABLE_PROFILER && AkDebug::profile('Request::recognize() completed');
                 $this->Controller->process($this->Request, $this->Response);
             }
             return $this->Response;
         }
     } catch (Exception $e) {
         if (isset($this->Controller) && method_exists($this->Controller, 'render_error')) {
             $this->Controller->render_error($e);
         } else {
             $ExceptionDispatcher = new AkExceptionDispatcher();
             $ExceptionDispatcher->renderException($e);
         }
     }
 }
예제 #2
0
 function __construct()
 {
     parent::__construct();
     $this->beforeFilter('initFrameworkSetup');
 }
예제 #3
0
파일: index.php 프로젝트: joeymetal/v1
<?php

include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
$ActionController = new AkActionController();
$ActionController->handleRequest();
예제 #4
0
 function getPluginHelpers()
 {
     $helper_names = AkActionController::addPluginHelper(false);
     // Trick for getting helper names set by AkPlugin::addHelper
     if (empty($helper_names)) {
         return array();
     } elseif ($this->plugin_helpers == 'all') {
         return $helper_names;
     } else {
         $selected_helper_names = array();
         foreach (Ak::toArray($this->plugin_helpers) as $helper_name) {
             $helper_name = AkInflector::camelize($helper_name);
             if ($path = array_shift(array_keys($helper_names, AkInflector::camelize($helper_name)))) {
                 $selected_helper_names[$path] = $helper_names[$path];
             }
         }
         return $selected_helper_names;
     }
 }
예제 #5
0
파일: controller.php 프로젝트: bermi/akelos
 public function setPerformedToTrue()
 {
     $this->Controller->expect('_hasPerformed', array(true));
 }
예제 #6
0
파일: AkPlugin.php 프로젝트: joeymetal/v1
 function addHelper($helper_name, $helper_path = null)
 {
     $helper_name = AkInflector::camelize($helper_name);
     $helper_path = empty($helper_path) ? $this->getPath().DS.'lib'.DS.AkInflector::underscore($helper_name).'.php' : $helper_path;
     AkActionController::addPluginHelper($helper_name, array('path' => $helper_path));
 }
예제 #7
0
 function setPerformedToTrue()
 {
     $this->Controller->expects($this->any())->method('_hasPerformed')->will($this->returnValue(true));
 }