예제 #1
0
파일: Html.php 프로젝트: biGGs24/sgl2
 /**
  * HTML renderer decorator
  *
  * @param SGL2_Response $data
  * @param string $templateEngine
  */
 public function __construct($response, $templateEngine = null)
 {
     $registry = SGL2_Registry::getInstance();
     //  prepare renderer class
     if (is_null($templateEngine)) {
         $templateEngine = $registry->getConfig()->site->templateEngine;
     }
     $templateEngine = ucfirst($templateEngine);
     $rendererClass = 'SGL2_View_Renderer_Html_' . $templateEngine;
     parent::__construct($response, new $rendererClass());
 }
예제 #2
0
 public function testAppContext()
 {
     $config = new Zend_Config_Ini(SGL2_PATH . '/tests/config.ini', 'staging');
     $registry = SGL2_Registry::createInstance($config);
     $registry2 = SGL2_Registry::getInstance();
     $this->assertThat($registry, $this->identicalTo($registry2));
     $this->assertTrue(SGL2_Registry::hasInstance());
     $registry->set('foo', new Foo());
     $this->assertSame($registry->get('foo'), $registry2->get('foo'));
     $this->assertTrue(is_a($registry->get('foo'), 'Foo'));
 }
예제 #3
0
파일: Registry.php 프로젝트: biGGs24/sgl2
 public static function createInstance(Zend_Config $config, $name = null, $class = __CLASS__)
 {
     if (null === $name) {
         $name = $config->app->name;
     }
     self::$current = $name;
     self::$instances[$name] = new $class();
     if (!self::$instances[$name] instanceof SGL2_Context) {
         throw new Exception(sprintf('Class "%s" is not of the type SGL2_Context.', $class));
     }
     self::$instances[$name]->init($config);
     return self::$instances[$name];
 }
예제 #4
0
파일: Front.php 프로젝트: biGGs24/sgl2
 public function dispatch()
 {
     $registry = SGL2_Registry::getInstance();
     $request = $registry->getRequest();
     $response = $registry->getResponse();
     $router = $registry->getRouter();
     $ret = false;
     try {
         $aRet = $router->route($request->getUri());
         $ret = $this->processRequest($registry, $request, $response);
     } catch (Exception $e) {
         throw $e;
     }
     return $ret;
 }
예제 #5
0
파일: Bootstrap.php 프로젝트: biGGs24/sgl2
 public function __construct()
 {
     $config = new Zend_Config_Ini(PROJECT_PATH . '/var/config.ini', 'staging');
     $registry = SGL2_Registry::createInstance($config);
     $this->registry = $registry;
 }
예제 #6
0
 public function __construct(SGL2_Registry $registry)
 {
     $this->registry = $registry;
     $this->dispatcher = $registry->getEventDispatcher();
 }