Ejemplo n.º 1
0
 /**
  * 
  */
 public function tearDown()
 {
     // reset view path
     View::$path = false;
     // reset controller
     unset($this->controller);
 }
Ejemplo n.º 2
0
 /**
  * 
  * @author Joshua Davey
  * @param string $environment
  * @param array $request
  * @param array $server
  */
 public static function setup($application_document_root, $server_document_root)
 {
     // add ending / to document root if it doesn't exist -- important because it differs from unix to windows (or I think that's what it is)
     if (substr($server_document_root, -1) != '/') {
         $server_document_root .= '/';
     }
     // set views directory -- does this belong here?...
     View::$path = self::$pathToProject . 'application/views/';
     // determine dynamic uri path
     self::$uriPathDynamic = self::parseDynamicUri($server_document_root, $application_document_root);
     // determine the relative path to the public directory
     self::$uriPathStatic = self::parseStaticUri($server_document_root, $application_document_root);
     // if the absolute path to the public directory can't be established based on the uriPathStatic
     // we've derived then it's likely the developer is using symlinks to point to their project.
     // In this case we can't determine the paths.
     // Most likely the user has advanced priveledges and is able to set the DocumentRoot in the apache
     // config to point to "path/to/project/public/" and therefore all of our relative paths can be
     // set to "/".
     //
     // Therefore if the developer is using symlinks they must point their DocumentRoot to Madeam's public
     // directory or everything will explode.
     if (!file_exists($server_document_root . self::$uriPathStatic)) {
         self::$uriPathStatic = '/';
         self::$uriPathDynamic = '/';
     }
 }
Ejemplo n.º 3
0
 protected function dispatch($request)
 {
     $this->params = $request;
     $this->componentEvent('initialize');
     $this->beforeFilter();
     $this->componentEvent('startup');
     $view = View::path($request);
     if ($this->hasAction($request['action'])) {
         call_user_func_array(array($this, $request['action']), $request['params']);
         $view = null;
     }
     $output = '';
     if ($this->autoRender) {
         $this->beforeRender();
         $output = $this->render($view);
     }
     $this->componentEvent('shutdown');
     $this->afterFilter();
     return $output;
 }
Ejemplo n.º 4
0
 protected function dispatch($request)
 {
     $this->params = $request;
     $this->fireAction('beforeFilter');
     $view = View::path($request);
     if ($this->hasAction($request['action'])) {
         call_user_func_array(array($this, $request['action']), $request['params']);
         $view = null;
     }
     $output = '';
     if ($this->render) {
         $this->fireAction('beforeRender');
         $output = $this->render($view);
     }
     $this->fireAction('afterFilter');
     return $output;
 }
Ejemplo n.º 5
0
 /**
  * 
  */
 public function tearDown()
 {
     // reset view path
     View::$path = false;
 }
Ejemplo n.º 6
0
<?php

/*
 * Initialize your application
 * including libs
 * plugins
 * etc...
 */
// Debug
error_reporting(E_ALL);
Application::$debug = true;
// MVC interfaces
__include_dir(__DIR__ . '/app/interfaces');
// Template system
View::path(Environment::get('Application.views'));
// load database
__include_dir(__DIR__ . '/app/database', '.table.php');
// load models
__include_dir(__DIR__ . '/app/models');
// load all plugins by default
__include_dir(__DIR__ . '/plugins', '.plugin.php');
// routes
include_once __DIR__ . '/app/routes.php';