public static function getApplicationUri($uri = '')
 {
     if ($uri != '') {
         Scratch::singleton()->config->set('application_uri', $uri);
     }
     return Scratch::singleton()->config->get('application_uri');
 }
示例#2
0
 public function onViewRender()
 {
     header('Content-Type: text/xml');
     $serialiser = new Serialiser();
     $xmlDom = $serialiser->serialise(Scratch::singleton());
     echo $xmlDom->saveXML();
 }
 /**
  * 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();
 }
 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());
 }
 /**
  * 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;
     }
 }
示例#6
0
 public function __construct()
 {
     $this->_routes = array();
     Scratch::singleton()->loader->frameworkModel('route');
     $this->_routes = Scratch::singleton()->loader->config('routes');
 }
 public function __construct()
 {
     $this->scratch = Scratch::singleton();
 }