diff --git a/Shield/Shield.php b/Shield/Shield.php index 99d0ec6..146a3b1 100644 --- a/Shield/Shield.php +++ b/Shield/Shield.php @@ -69,10 +69,10 @@ public function __construct() { // set the APPPATH constant if (!defined('APPPATH')) { - define('APPPATH',__DIR__.'../app'); + define('APPPATH', __DIR__.'../app'); } - // force all error messages + // some global config spl_autoload_register(array($this, '_load')); set_error_handler(array($this, '_errorHandler')); set_exception_handler(array($this, '_exceptionHandler')); @@ -80,6 +80,11 @@ public function __construct() // include our exceptions include_once 'Exception.php'; + $this->init(); + } + + private function init() + { // make our DI container $this->di = new Di(); @@ -133,7 +138,7 @@ public function __call($func, $args) if (isset($args[2])) { // we've been given a route-specific config, set it up! - $this->di->get('Config')->setConfig($args[2],'route::'.$path); + $this->di->get('Config')->setConfig($args[2], 'route::'.$path); } if (isset($args[1])) { diff --git a/Shield/View.php b/Shield/View.php index 44a54ed..f6e4527 100644 --- a/Shield/View.php +++ b/Shield/View.php @@ -112,7 +112,8 @@ public function setContentType($type) */ public function getContentType() { - return $this->contentType; + $cfg = $this->di->get('Config')->get('view.content-type'); + return ($cfg !== null) ? $cfg : $this->contentType; } /** @@ -132,7 +133,9 @@ public function setCharset($charset) */ public function getCharset() { - return $this->charset; + // see if its in the config first + $cfg = $this->di->get('Config')->get('view.charset'); + return ($cfg !== null) ? $cfg : $this->charset; } /**