public function testConfigure()
 {
     $this->object->configure();
     $array = array();
     $this->assertThat($this->container->getConstant('controller.paths'), $this->equalTo($array));
     $this->assertThat($this->container->getConstant('command.paths'), $this->equalTo($array));
     $this->assertThat($this->container->getConstant('view.paths'), $this->equalTo($array));
 }
示例#2
0
 public static function getInstance()
 {
     if (self::$instance == false) {
         self::$instance = new WebApplication();
     }
     return self::$instance;
 }
 /**
  * 控制器初始化方法,每次请求必须先调用的方法,action子类可以重写这个方法进行页面的初始化
  */
 public function C_start()
 {
     $webApp = WebApplication::getInstance();
     //注册当前app的配置信息
     $this->assign('appConfigs', $webApp->getConfigs());
     $this->assign('params', $webApp->getHttpRequest()->getParameters());
 }
 /**
  * Override for walkthrough tests. Need to store the config data so certain values can
  *  be reset to the original config value when resetting the application to run another walkthrough.
  */
 public function __construct($config = null)
 {
     parent::__construct($config);
     $this->configLanguageValue = $this->language;
     $this->configTimeZoneValue = $this->timeZoneHelper->getTimeZone();
     // We need explicitly to raise this event, because CApplication::run() method
     // where OnBeginRequest event is raised is never called
     // For more informationn check: app/protected/tests/common/bootstrap.php
     if ($this->hasEventHandler('onBeginRequest')) {
         $this->onBeginRequest(new CEvent($this));
     }
 }
示例#5
0
	public function __construct($root_dir, $template_dir = 'templates/doctor') {
		parent::__construct($root_dir, $template_dir);
	}
 /**
  * Caches the response
  * @param \ride\web\WebApplication $web
  * @return null
  */
 public function cacheResponse(WebApplication $web)
 {
     if (!isset($this->cache)) {
         return;
     }
     if (!isset($this->cacheTtl)) {
         $this->cacheTtl = 0;
     }
     $request = $web->getRequest();
     $response = $web->getResponse();
     $cacheKey = 'node.response.' . StringHelper::safeString($request->getUrl());
     if ($this->log) {
         $this->log->logDebug('Caching the request', 'Ttl: ' . $this->cacheTtl . ' - ' . $cacheKey, ApplicationListener::LOG_SOURCE);
     }
     $cachedResponse = $this->cache->create($cacheKey);
     $cachedResponse->setValue($response);
     $cachedResponse->setTtl($this->cacheTtl);
     $this->cache->set($cachedResponse);
 }
 /**
  * 控制器初始化方法,每次请求必须先调用的方法,action子类可以重写这个方法进行页面的初始化
  */
 public function C_start()
 {
     $webApp = WebApplication::getInstance();
     //注册当前app的配置信息
     $this->assign('appConfigs', $webApp->getConfigs());
 }
示例#8
0
 public function destroy($sid)
 {
     switch (Session::$source) {
         case 'mysql':
             $sql = "DELETE FROM " . Session::$sessionStore . " WHERE id = '{$sid}'";
             $results = mysql_query($sql, Session::$link);
             WebApplication::setCookie(Session::$sessionCookie, '', time() - 42000);
             break;
         case 'mysqli':
             $sql = "DELETE FROM " . Session::$sessionStore . " WHERE id = '{$sid}'";
             Session::$link->query($sql);
             WebApplication::setCookie(Session::$sessionCookie, '', time() - 42000);
             break;
         case 'mongo':
             break;
         case 'memcache':
             Session::$link->delete($sid);
             break;
     }
 }
示例#9
0
文件: index.php 项目: ruxon/app
<?php

if (file_exists(dirname(__FILE__) . '/vendor/autoload.php')) {
    require_once dirname(__FILE__) . '/vendor/autoload.php';
}
require_once dirname(__FILE__) . '/ruxon/kernel/kernel.php';
Core::init(WebApplication::getInstance());
Core::app()->run();
 /**
  * Creates a web application object from a given configuration section
  *
  * @param   string profile
  * @param   string application app name
  * @param   string url
  * @return  xp.scriptlet.WebApplication
  * @throws  lang.IllegalStateException if the web is misconfigured
  */
 protected function configuredApp($profile, $application, $url)
 {
     $section = 'app::' . $application;
     if (!$this->prop->hasSection($section)) {
         throw new IllegalStateException('Web misconfigured: Section ' . $section . ' mapped by ' . $url . ' missing');
     }
     $app = new WebApplication($application);
     $app->setScriptlet($this->readString($profile, $section, 'class', ''));
     // Configuration base
     $app->setConfig($this->readString($profile, $section, 'prop-base', '{WEBROOT}/etc'));
     // Determine debug level
     $flags = WebDebug::NONE;
     foreach ($this->readArray($profile, $section, 'debug', array()) as $lvl) {
         $flags |= WebDebug::flagNamed($lvl);
     }
     $app->setDebug($flags);
     // Initialization arguments
     $app->setArguments($this->readArray($profile, $section, 'init-params', array()));
     // Environment
     $app->setEnvironment($this->readHash($profile, $section, 'init-envs', new Hashmap())->toArray());
     return $app;
 }
 /**
  * Adding expected WebApplication method.
  */
 public function findModule($moduleID)
 {
     return WebApplication::findModuleInApplication($moduleID);
 }
示例#12
0
<?php

defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
require __DIR__ . '/../../vendor/autoload.php';
require __DIR__ . '/../../Yii.php';
require __DIR__ . '/../../common/config/bootstrap.php';
require __DIR__ . '/../config/bootstrap.php';
$config = yii\helpers\ArrayHelper::merge(require __DIR__ . '/../../common/config/main.php', require __DIR__ . '/../../common/config/main-local.php', require __DIR__ . '/../config/main.php', require __DIR__ . '/../config/main-local.php');
$application = new WebApplication($config);
$application->run();
示例#13
0
 public function __construct($config = null)
 {
     parent::__construct($config);
 }