addColumn("name", 'string', Array('null' => false)); \$table->addColumn("time", 'timestamp', Array('null' => true, 'default'=>null)); \$table->addColumn("areaid", 'integer', Array('null' => false)); \$table->addTimestamps(); \$table->addSoftDelete(); \$table->create(); Migrator::getInstance()->update_plugin_version('{{PLUGIN_NAME}}', '1.0.0'); return; } //if (\$pluginversion < '1.0.1') { //\$table = Wrapper::get_table('{{PLUGIN_NAME}}'); //Migrator::getInstance()->update_plugin_version('{{PLUGIN_NAME}}', '1.0.1'); //return; //} } EOL; private $versionBase = <<name = '{{PLUGIN_NAME}}'; \$plugin->version = '0.0.1'; //\$plugin->require = Array( ["name" => "plugin_name", "version" => 'x.x.x'] ); EOL; private $controllerBase = << '', 'min' => 0, 'max' => 100000, 'step' => 2); const _tableName = '{{TABLE_NAME}}'; //const _properties = Array('id', 'name'); //const _timestamps = true; //const _softdelete = true; //const _connectionName = ''; } EOL; private $routeBase = <<langBase = str_replace("{{PLUGIN_NAME}}", $plugin_name, $this->langBase); $this->langBase = str_replace("{{PLUGIN_NAME_PRETTY}}", $plugin_name_pretty, $this->langBase); file_put_contents(DIR_APP.$subname . '/' . $name . '/lang/en.php', $this->langBase); file_put_contents(DIR_APP.$subname . '/' . $name . '/lang/'.APP_LANG.'.php', $this->langBase); $this->migrationBase = str_replace("{{PLUGIN_NAME}}", $plugin_name, $this->migrationBase); file_put_contents(DIR_APP.$subname . '/' . $name . '/db/Migrate.php', $this->migrationBase); $this->routeBase = str_replace("{{NAMESPACE}}", $namespace, $this->routeBase); $this->routeBase = str_replace("{{PLUGIN_NAME}}", $plugin_name, $this->routeBase); $this->routeBase = str_replace("{{CONTROLLER}}", $controller, $this->routeBase); file_put_contents(DIR_APP.$subname . '/' . $name . '/Routes.php', $this->routeBase); $this->objectBase = str_replace("{{NAMESPACE}}", $namespace.'\Classes', $this->objectBase); $this->objectBase = str_replace("{{OBJECT}}", $object, $this->objectBase); $this->objectBase = str_replace("{{TABLE_NAME}}", $name, $this->objectBase); file_put_contents(DIR_APP.$subname . '/' . $name . "/classes/$object.php", $this->objectBase); $this->controllerBase = str_replace("{{NAMESPACE}}", $namespace, $this->controllerBase); $this->controllerBase = str_replace("{{OBJECT}}", $object, $this->controllerBase); $this->controllerBase = str_replace("{{OBJECT_LOWER}}",strlower($object), $this->controllerBase); $this->controllerBase = str_replace("{{CONTROLLER}}", $controller, $this->controllerBase); file_put_contents(DIR_APP.$subname . '/' . $name . "/$controller.php", $this->controllerBase); } function listRoutes(){ echo str_pad('VERB', 10, ' ', STR_PAD_BOTH) . "||"; echo str_pad('URI' , 35, ' ', STR_PAD_BOTH) . "||"; echo str_pad('W', 5, ' ', STR_PAD_BOTH) . "||"; echo str_pad('FUNCTION', 60, ' ', STR_PAD_BOTH) . "\n"; echo str_pad('', 120, '-') . "\n"; foreach(\Routes\RouteCollection::returnRoutes() as $route){ echo str_pad(implode($route->_verb , ', '), 10, ' ', STR_PAD_BOTH) . "||"; echo str_pad($route->_uri, 35, ' ', STR_PAD_RIGHT) . "||"; echo str_pad($route->_weight, 5, ' ', STR_PAD_BOTH). "||"; if( gettype($route->_callback[0]) == 'object' ){ echo str_pad('Clousure', 60, ' ', STR_PAD_RIGHT); }else{ echo str_pad($route->_callback[0], 30, ' ', STR_PAD_RIGHT); } echo "\n"; } } function createTags(){ $outputs = shell_exec("grep -Rnsi '@ctag' . | sed s/\ //g | sed s/*@ctag/\ /g"); $outputs = preg_split('/\R/', $outputs); $return = $this->ctagsHeader . "\n"; foreach($outputs as $output){ $line = explode(' ', str_replace('\\t', '', $output) ); @$line = $line[1] . "\t " . str_replace('./', '', explode(':', $line[0])[0]) . "\t ".$line[1] . "\n"; if( strpos($line, 'app/core/generator/GeneratorController.php') ){ continue; } $return .= $line; //echo "Generating: ".$line."\n"; } file_put_contents(DIR_ROOT.'tags', $return); } }