Beispiel #1
0
 public function get_all_keys()
 {
     $dir = IO_FS::Dir($this->path);
     $query = IO_FS::Query()->recursive();
     $keys = array();
     foreach ($query->apply_to($dir) as $name => $object) {
         $key = trim(str_replace($this->path, '', $name), '/');
         $key = str_replace('/', ':', $key);
         if ($this->has($key)) {
             $keys[] = $key;
         }
     }
     return $keys;
 }
Beispiel #2
0
 public static function find_all_modules()
 {
     $dir = __DIR__;
     Core::load('IO.FS');
     $q = IO_FS::Query()->glob('*.php')->recursive(true);
     $result = array();
     foreach ($q->apply_to(IO_FS::Dir($dir)) as $name => $file) {
         $real_path = realpath($file);
         $path_to_file = trim(str_replace($dir, '', $name), '/ ');
         $module = str_replace('.php', '', $path_to_file);
         $module = str_replace('/', '.', $module);
         $result[$module] = $real_path;
     }
     Core::load('Events');
     Events::call('core.find_all_modules', $result);
     return $result;
 }
Beispiel #3
0
 /**
  * @param string $path
  */
 public function __construct($path)
 {
     $this->path = (string) $path;
     $this->dir_iterator = IO_FS::Dir($this->path)->query(IO_FS::Query()->glob('*.php')->recursive(true));
     $this->dir_iterator->rewind();
     $this->current = Dev_Source::Module($this->module_name($this->dir_iterator->current()->path));
 }
Beispiel #4
0
 public function assets_dump($from, &$result = array())
 {
     $from = IO_FS::dir($this->dir($from));
     if ($from->exists()) {
         foreach (IO_FS::Query()->recursive()->apply_to($from) as $f) {
             $dest = Templates_HTML::file_to_docroot('file://' . $f->path, $this->asset_dump_dir($f->path, $from->path));
             $result[$f->path] = $dest;
         }
     }
     return $this;
 }
Beispiel #5
0
 /**
  * Конструктор
  *
  * @param IO_FS_Dir   $dir
  * @param IO_FS_Query $query
  */
 public function __construct(IO_FS_Dir $dir, IO_FS_Query $query = null)
 {
     $this->dir = $dir;
     $this->query = $query ? $query : IO_FS::Query();
 }