コード例 #1
0
ファイル: DataBase.php プロジェクト: druto/framework
 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;
 }
コード例 #2
0
ファイル: Template.php プロジェクト: druto/framework
 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;
 }
コード例 #3
0
ファイル: alias.php プロジェクト: druto/druto
<?php

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