config = include __DIR__.'/conf.php'; if (isset($args[1])) { $this->function = $args[1]; $method = $this->function; if (method_exists($this, $method)) { $arg = isset($args[2]) ? $args[2] : null; $arg2 = isset($args[3]) ? str_replace('-', '', $args[3]) : null; $this->$method($arg, $arg2); } else { $this->help(); } } else { $this->help(); } } /** * Shows help for CLI */ private function help() { $methods = get_class_methods(__CLASS__); echo "\nTry use functions from below: \n"; foreach ($methods as $method) { if ($method == "__construct") { continue; } echo "\t- $method\n"; } } /** * Creates main plugin file based on data from conf.php */ protected function setup() { $name = $this->config['name']; $title = "Plugin Name: ".$name; $domain = $this->config['text-domain']; $class = str_replace(' ', '', $name); $slug = strtolower(str_replace(' ', '-', $name)); if(file_exists($slug.'.php')){ echo "Plugin file already exists."; exit(); } echo "Creating $name plugin.\n"; $file = fopen($slug . '.php', 'w'); $content = "