Ejemplo n.º 1
0
 public static function getApplicationUri($uri = '')
 {
     if ($uri != '') {
         Scratch::singleton()->config->set('application_uri', $uri);
     }
     return Scratch::singleton()->config->get('application_uri');
 }
Ejemplo n.º 2
0
 public function onViewRender()
 {
     header('Content-Type: text/xml');
     $serialiser = new Serialiser();
     $xmlDom = $serialiser->serialise(Scratch::singleton());
     echo $xmlDom->saveXML();
 }
Ejemplo n.º 3
0
 /**
  * Invokes the framework, application and object setup.
  * @return void
  */
 public static function invoke()
 {
     // find the route
     // invoke the controller
     // invoke the action
     // invoke the view
     self::$application = Scratch::singleton();
 }
Ejemplo n.º 4
0
 public function __construct()
 {
     self::$__instance = $this;
     set_exception_handler('exceptionHandler');
     // setup our loader instance
     $this->loader = new Loader();
     // load a few helpers
     $this->loader->helper('uri', FRAMEWORK_PATH . 'helpers');
     // loader the plugins
     $this->plugins = $this->loader->manager('plugins');
     $this->plugins->loadFrameworkPlugins();
     // what shall we load first?
     $this->route = $this->loader->manager('route')->find();
     // load the controller
     $this->controller = $this->loader->controller($this->route->getController());
     $this->controller->invokeAction($this->route->getAction());
 }
Ejemplo n.º 5
0
 /**
  * Loads all the plugins, and prepares them for activation
  * @return void
  */
 public function loadFrameworkPlugins()
 {
     try {
         $pluginsConf = Scratch::singleton()->loader->config('plugins');
     } catch (LoaderConfigNotFound $ex) {
         echo 'Skipping plugins';
         return;
     }
     foreach ($pluginsConf as $pluginName) {
         $plugin = Scratch::singleton()->loader->plugin($pluginName);
         $plugin->setup();
         if (count($plugin->dependancies) >= 0) {
             foreach ($plugin->dependancies as $dependancy) {
                 if (!isset($this->_plugins[$dependancy])) {
                     // load dependacy
                     $dependancyPlugin = Scratch::singleton()->loader->plugin($dependancy);
                     $dependancyPlugin->setup();
                     $this->_plugins[$dependancy] = $dependancyPlugin;
                 }
             }
         }
         $this->loaded[$pluginName] = $plugin;
     }
 }
Ejemplo n.º 6
0
 public function __construct()
 {
     $this->_routes = array();
     Scratch::singleton()->loader->frameworkModel('route');
     $this->_routes = Scratch::singleton()->loader->config('routes');
 }
Ejemplo n.º 7
0
 public function __construct()
 {
     $this->scratch = Scratch::singleton();
 }