コード例 #1
0
ファイル: View.class.php プロジェクト: szigi/ClearPage
 /**
  *
  *
  * @param string $page The page we would like to load.
  * @param array  $vars Optional. The values, the requested page requires.
  */
 public static function prepare($page, array $vars = [])
 {
     $activeFolder = './Solutions/' . Projects::get()->active() . '/Views/';
     self::loadHeader($activeFolder, $vars);
     self::loadContent($activeFolder, $page, $vars);
     self::$footer = file_get_contents($activeFolder . 'foot.master.php');
     return self::$header . self::$content . self::$footer;
 }
コード例 #2
0
ファイル: Kernel.class.php プロジェクト: szigi/ClearPage
 /**
  * Instantiates a given class, with an optional array of parameters.
  *
  * @param string $className The name of the class to be instantiated.
  * @return Object
  */
 private static function loadClass($className)
 {
     // We replace the "App" keyword in the namespace to the active
     // solution's name.
     $className = strtr($className, ['App' => Projects::get()->active()]);
     try {
         $reflector = new ReflectionClass($className);
     } catch (Exception $e) {
         echo $e->getMessage();
         exit;
     }
     // We get the constructor.
     $constructor = $reflector->getConstructor();
     // If the constructor is null, that means we have no dependencies
     // to resolve, and we can just instantiate the class.
     if (is_null($constructor)) {
         return $reflector->newInstance();
     }
     // If there is constructor, we need to resolve all its
     // dependencies (if any).
     $args = self::resolveParameters($constructor->getParameters());
     // Finally, instantiate the class.
     return $reflector->newInstanceArgs($args);
 }
コード例 #3
0
ファイル: Project.class.php プロジェクト: szigi/ClearPage
 /**
  * The constructor.
  */
 public function __construct()
 {
     $this->name = Projects::get()->active();
     $this->projectInfo = './Solutions/' . $this->name . '/project.info.php';
 }
コード例 #4
0
ファイル: index.php プロジェクト: szigi/ClearPage
<?php

$start = microtime(true);
header('Content-Type: text/html; charset=utf-8');
include_once './System/Http/autoload.php';
use System\Config\Projects;
include_once './Solutions/' . Projects::get()->active() . '/routes.php';
$end = microtime(true);