Esempio n. 1
0
 public function connect($dbConfig = null)
 {
     if (isset($dbConfig)) {
         $this->conn = mysqli_connect($dbConfig['host'], $dbConfig['username'], $dbConfig['password'], $dbConfig['db']);
     } else {
         $default = Config::get('database.default');
         $dbConfig = Config::get('database.' . $default);
         $this->conn = mysqli_connect($dbConfig['host'], $dbConfig['username'], $dbConfig['password'], $dbConfig['db']);
     }
     if (mysqli_connect_errno()) {
         throw new DataBaseException('Database connection failed: ' . mysqli_connect_error(), E_USER_ERROR);
     }
     return $this;
 }
Esempio n. 2
0
 function display()
 {
     $defaultTemplate = Config::get('app.template.default', 'default');
     $this->templateBaseURL = BASEURL . '/Templates/' . $defaultTemplate;
     $templatePath = TEMPLATESDIR . '/' . $defaultTemplate . '/index.php';
     $this->content = $this->getViewContent();
     ob_start();
     include $templatePath;
     $output = ob_get_contents();
     ob_end_clean();
     $css = HTML::getCSS(true);
     $js = HTML::getJS(true);
     $output = preg_replace('/<\\/head>/i', $css . "</head>", $output, 1);
     $output = preg_replace('/<\\/body>/i', $js . "</body>", $output, 1);
     echo $output;
 }
Esempio n. 3
0
<?php

use Druto\Configs\Config;
$aliases = Druto\Configs\Config::get('app.aliases', array());
foreach ($aliases as $key => $val) {
    class_alias($val, $key);
}