Пример #1
0
 public function make($name = null, $type = 'empty')
 {
     $view_base = "app/views/";
     if (!$name) {
         Shell::write(" make - ", "cyan") . Shell::write("Enter the name of the view you would like to create.");
         Shell::write(" Example = ", "purple") . Shell::write("make:", "yellow") . Shell::write("name\n", "red");
     } else {
         if (file_exists($view_base . $name . '.blade.php')) {
             Shell::write("That view already exists. \n", 'red');
         } else {
             switch ($type) {
                 case 'empty':
                     $file = '';
                     if (strpos($name, '/')) {
                         $path = explode('/', $name);
                         $path = array_reverse($path);
                         $file = $path[0];
                         $path = array_reverse($path);
                         array_pop($path);
                         $path = implode('/', $path);
                         if (App::service('File')->mkdir($view_base . $path)) {
                             $template = App::service('View')->make('templates.code.view.view-empty');
                             file_put_contents($view_base . $path . '/' . $file . '.blade.php', $template);
                             Shell::write("Created view successfully. \n", 'green');
                         }
                     } else {
                         $template = App::service('View')->make('templates.code.view.view-empty');
                         file_put_contents($view_base . $name . '.blade.php', $template);
                         Shell::write("Created view successfully. \n", 'green');
                     }
                     break;
             }
         }
     }
 }
Пример #2
0
 private function create_route($name, $type)
 {
     if (!file_exists('app/routes/' . $name . '.json')) {
         switch ($type) {
             case 'empty':
                 $fields = ['path', 'controller', 'method'];
                 $properties = [];
                 $run = true;
                 while ($run) {
                     if (Shell::input() == 'exit') {
                         $run = false;
                     }
                     for ($i = 0; $i < count($fields); $i++) {
                         Shell::write("Enter the name of the " . $fields[$i] . " that you wish to give this route. \n", 'light_blue');
                         Shell::write(">>", 'yellow');
                         Shell::set_input(trim(fgets(STDIN, 1024)));
                         $properties[] = Shell::input();
                         if ($i == count($fields) - 1) {
                             $final = array_combine($fields, $properties);
                             $final[] = ['name' => $name];
                             $final = (object) $final;
                             $template = App::service('View')->make('templates.code.route.route-empty', ['name' => $name, 'path' => $final->path, 'controller' => $final->controller, 'method' => $final->method]);
                             file_put_contents('app/routes/' . $name . '.json', $template);
                             Shell::write("The route {$name} has been successfully created \n", 'green');
                             $run = false;
                         }
                     }
                 }
                 break;
         }
     } else {
         Shell::write("That route already exists. \n", 'red');
     }
 }
Пример #3
0
 public function main()
 {
     $this->csrf_key = App::service('Config')->get('csrf.session');
     if (App::service('Input')->exists()) {
         return App::service('Token')->check(App::service('Input')->post('token'));
     } else {
         return true;
     }
     return false;
 }
Пример #4
0
 public function make($name = null, $type = 'empty')
 {
     if (file_exists("app/commands/" . $name . ".php")) {
         Shell::write("{$name} already exists! \n", "red");
     } else {
         if (!$name) {
             Shell::write(" make - ", "cyan") . Shell::write("Enter the name of the command you would like to create.\n", "green");
             Shell::write(" Example = ", "purple") . Shell::write("make:", "yellow") . Shell::write("name\n", "red");
         } else {
             switch ($type) {
                 case 'empty':
                     $command_template = App::service('View')->make('templates.code.command.command-empty', ['name' => $name]);
                     file_put_contents('app/commands/' . $name . '.php', $command_template);
                     Shell::write("Command created successfully! \n", 'green');
                     break;
             }
         }
     }
 }
Пример #5
0
 public function make($name = null, $type = 'empty')
 {
     if (!$name) {
         Shell::write(" make - ", "cyan") . Shell::write("Enter the name of the filter you would like to create.");
         Shell::write(" Example = ", "purple") . Shell::write("make:", "yellow") . Shell::write("name\n", "red");
     } else {
         switch ($type) {
             case 'empty':
                 if (file_exists('app/models/filter/' . $name . '.php')) {
                     Shell::write("That filter already exists. \n", 'red');
                 } else {
                     $template = App::service('View')->make('templates.code.filter.filter-empty', ['name' => $name]);
                     file_put_contents('app/models/filters/' . $name . '.php', $template);
                     Shell::write("Created filter successfully. \n", 'green');
                 }
                 break;
         }
     }
 }
Пример #6
0
 public function make($name = null, $type = 'empty')
 {
     $controller_base = "app/controllers/";
     if (!$name) {
         Shell::write(" make - ", "cyan") . Shell::write("Enter the name of the controller you would like to create.");
         Shell::write(" Example = ", "purple") . Shell::write("make:", "yellow") . Shell::write("name\n", "red");
     } else {
         if (file_exists($controller_base . $name . '.php')) {
             Shell::write("A controller with that name already exists. \n", 'red');
         } else {
             switch ($type) {
                 case 'empty':
                     $template = App::service('View')->make('templates.code.controller.controller-empty', ['name' => $name]);
                     file_put_contents($controller_base . $name . '.php', $template);
                     Shell::write("Successfully created controller. \n", 'green');
                     break;
             }
         }
     }
 }
Пример #7
0
 public function make($name = null, $type = 'empty')
 {
     $services_base = 'app/models/services/';
     if (!$name) {
         Shell::write(" make - ", "cyan") . Shell::write("Enter the name of the service you would like to create.");
         Shell::write(" Example = ", "purple") . Shell::write("make:", "yellow") . Shell::write("name\n", "red");
     } else {
         switch ($type) {
             case 'empty':
                 if (file_exists($services_base . $name . '.php')) {
                     Shell::write("A service with the name {$name} already exists. \n", 'red');
                 } else {
                     $template = App::service('View')->make('templates.code.service.service-empty', ['name' => $name]);
                     file_put_contents($services_base . $name . '.php', $template);
                     Shell::write("Service successfully created \n", 'green');
                 }
                 break;
         }
     }
 }
Пример #8
0
 public static function header()
 {
     $header = App::service('View')->make('templates.code.header');
     $colors = ["dark_grey", "red", "light_red", "yellow", "blue", "green", "light_green", "brown", "light_blue", "cyan", "purple", "light_purple", "white"];
     Shell::write($header . "\n", $colors[rand(0, 12)]);
 }
Пример #9
0
<?php

require_once '../vendor/autoload.php';
use SECC\App;
App::initialize();
 public function index()
 {
     App::service('View')->render('templates.frontend.pages.home');
 }