Ejemplo n.º 1
0
 public static function cmd_all()
 {
     \System\Init::basic();
     $all = self::get_all();
     $path = \System\Composer::resolve('/etc/init.d/test.php');
     foreach ($all as $key => $val) {
         $cmd = implode(';', array("cd '" . BASE_DIR . "'", "phpunit --bootstrap '" . $path . "' --colors --test-suffix .php '" . $val . "'"));
         \Helper\Cli::out($val);
         $out = passthru($cmd);
         \Helper\Cli::out();
     }
 }
Ejemplo n.º 2
0
 /** Create instance from JSON
  * @param string $json
  */
 public static function from_path($path)
 {
     $model = get_called_class();
     $file = null;
     // If file_exists throws error, path is inaccessible
     if (!@file_exists($path)) {
         $path = \System\Composer::resolve($path);
     }
     if ($path) {
         $file = new $model(array("path" => dirname($path), "name" => basename($path), "keep" => true));
     }
     return $file;
 }
Ejemplo n.º 3
0
 public function resolve()
 {
     if ($this->src == 'static') {
         if ($this->use_cache) {
             $file = BASE_DIR . $this::DIR_CACHE . DIRECTORY_SEPARATOR . $this->name_full;
         } else {
             $file = \System\Composer::resolve($this::DIR_STATIC . DIRECTORY_SEPARATOR . $this->name_full);
         }
     } else {
         $file = $this::DIR_MEDIA . DIRECTORY_SEPARATOR . $this->name_full;
     }
     if (any($file)) {
         $cname = $this::CLASS_FILE;
         $this->file_path = $file;
         $this->file_point = $cname::from_path($file);
         if ($this->file_point) {
             $this->exists = $this->file_point->exists();
         } else {
             $this->exists = false;
         }
     } else {
         $this->exists = false;
     }
 }
Ejemplo n.º 4
0
 public function get_template_path($name)
 {
     return \System\Composer::resolve(\System\Template::DIR_TEMPLATE . '/' . $name . '.' . $this->get_suffix());
 }
Ejemplo n.º 5
0
 public function get_file_path()
 {
     return \System\Composer::resolve(self::DIR . '/' . $this->get_filename());
 }
Ejemplo n.º 6
0
 public static function dump_core($modules = false)
 {
     self::load_all();
     $str = '<?php ';
     $lists = array(get_declared_interfaces(), get_declared_classes());
     foreach ($lists as $list) {
         foreach ($list as $name) {
             $index = strpos($name, 'Module');
             if ($modules && $index === 0 || !$modules && $index !== 0) {
                 $base = self::DIR_CLASS;
                 if ($index === 0) {
                     $base = self::DIR_LIB;
                 }
                 $file_name = $base . '/' . self::get_class_file_name($name, true);
                 $file_path = \System\Composer::resolve($file_name);
                 if ($file_path) {
                     $cont = php_strip_whitespace($file_path);
                     $str .= preg_replace('/^<\\?(php)?(.*)(\\?>)?$/s', '$2', $cont);
                 }
             }
         }
     }
     return $str;
 }
Ejemplo n.º 7
0
 public function get_context_processors()
 {
     $list = !!$this->context ? $this->context : $this->request->context;
     $files = array();
     foreach ($list as $name) {
         $file_path = \System\Composer::resolve('/lib/context/' . $name . '.php');
         if ($file_path) {
             array_push($files, $file_path);
         } else {
             throw new \System\Error\Config('Failed to find context processor.', $name);
         }
     }
     return $files;
 }