public function filegenerator() { $codes = self::codegenerator(); $files = $codes['files_body']; $name = $codes['component_name']; if (!joosFile::is_writable(JPATH_APP_BASE . '/components/')) { return array('success' => false, 'message' => 'Не хватает прав для создания каталога компонента'); } $component_root = JPATH_APP_BASE . '/components/' . $name; if (joosFile::exists($component_root)) { return array('success' => false, 'message' => 'Каталог компонента уже существует'); } $dir_structure = array('{app}/components/{name}', '{app}/components/{name}/helpers', '{app}/components/{name}/media', '{app}/components/{name}/media/js', '{app}/components/{name}/media/css', '{app}/components/{name}/models', '{app}/components/{name}/views', '{app}/components/{name}/views_admin'); $oldumask = umask(0); foreach ($dir_structure as $dir) { $create_dir = strtr($dir, array('{app}' => JPATH_APP_BASE, '{name}' => $name)); joosFolder::create($create_dir, 0777); } foreach ($files as $file_name => $file_body) { echo $file_name . "\n"; joosFile::put_content(sprintf('%s/components/%s/%s.php', JPATH_APP_BASE, $name, $file_name), $file_body); } umask($oldumask); //_xdump($files); }
public static function init() { self::$cache_folder = JPATH_BASE_CACHE . DS . 'jscache'; joosFolder::exists(self::$cache_folder) ? null : joosFolder::create(self::$cache_folder); self::$data = array(); }