/** * Creates new domain * * @return bool */ protected function _createComponent() { $objController = new Steelcode_Project_Controller($this->_location); $paths = array("{$this->_location}/application/controllers/{$this->_name}", "{$this->_location}/application/views/{$this->_name}"); foreach ($paths as $path) { $this->_path = $path; if (!mkdir($this->_path)) { $this->_setErrorText("Error! Could not create domain:\n\t- {$this->_path}"); return false; } } $objController->setDomain($this->_name); $objController->create('index'); $this->_setMessageText("Done! Successfully created new domain:\n\t- {$this->_name}"); return true; }
/** * Creates a new application * * @return bool */ protected function _createComponent() { $this->_path = "{$this->_location}/{$this->_name}"; $file404 = dirname(ABSPATH) . '/includes/404.php'; $samples = ABSPATH . 'example'; if (!mkdir($this->_path)) { $this->_setErrorText("* Error! Could not create application:\n\t- {$this->_name}"); return false; } if (!copy("{$samples}/index.php", "{$this->_path}/index.php")) { $this->_setErrorText("* Error! Could not create index file"); return false; } if (!copy("{$samples}/.htaccess", "{$this->_path}/.htaccess")) { $this->_setErrorText("* Error! Could not create .htaccess file"); return false; } foreach ($this->_dirTree as $directory) { if (!mkdir("{$this->_path}/{$directory}")) { $this->_setErrorText("* Error! Could not create directory:\n\t- {$directory}"); return false; } if (!copy($file404, "{$this->_path}/{$directory}/index.php")) { $this->_setErrorText("* Error! Could not create file:\n\t- index.php"); return false; } } try { /* Create bootstrap file */ $objBootstrap = new Steelcode_Project_Bootstrap($this->_path); $objBootstrap->create('Bootstrap.php'); /* Write configuration object */ $objConfig = new Steelcode_Project_Config($this->_path); $objConfig->create('database'); /* Create index and page-not-found controllers */ $objController = new Steelcode_Project_Controller($this->_path); $objController->setDomain('error'); $objController->create('index'); $objController->setViewSource($file404); $objController->create('page-not-found'); $objController->removeViewSource(); $objController->setDomain('index'); $objController->create('index'); /* Create default layout */ $objLayouts = new Steelcode_Project_Layout($this->_path); $objLayouts->create('layout'); /* Create sample model */ $objModels = new Steelcode_Project_Model($this->_path); $objModels->create('application'); } catch (Steelcode_Project_Exception $ex) { $this->_setErrorText($ex->getMessage()); return false; } $this->_setMessageText("Done! Successfully created new application:\n\t- {$this->_name}"); return true; }