Permalink
Browse files

updating the Shield class to add the Template property, adding more f…

…luency to the other classes
  • Loading branch information...
1 parent bbe5d23 commit 3dcde8f6b952e9ab9db02eacdd4a9976ee0e6719 @enygma committed Aug 9, 2012
Showing with 17 additions and 7 deletions.
  1. +2 −2 Shield/Shield.php
  2. +1 −0 Shield/Template.php
  3. +14 −5 Shield/View.php
View
@@ -95,10 +95,10 @@ private function init()
$bs = new Bootstrap($this->di);
- $template = new Template($config);
+ $this->template = new Template($config);
// set up the view and logger objects
- $this->view = new View($config,$template);
+ $this->view = new View($config, $this->template);
$this->log = new Log($config);
$this->di->register(array($this->view, $this->log));
View
@@ -70,6 +70,7 @@ public function setTemplateDir($dir=null)
if (realpath($templatePath) !== false) {
$this->templateDir = realpath($templatePath);
}
+ return $this;
}
/**
View
@@ -68,6 +68,7 @@ public function setViewDir($dir=null)
if (realpath($viewPath) !== false) {
$this->_viewDir = realpath($viewPath);
}
+ return $this;
}
/**
@@ -91,12 +92,18 @@ public function getViewDir()
*/
public function set($index, $value, $escape=true)
{
- if ($escape === true) {
- // escape all values
- $value = htmlspecialchars($value, ENT_QUOTES);
+ if (!is_array($index)) {
+ $index = array($index => $value);
}
-
- $this->values[$index] = $value;
+ foreach ($index as $i => $value) {
+ if ($escape === true) {
+ // escape all values
+ $value = htmlspecialchars($value, ENT_QUOTES);
+ }
+ $this->values[$i] = $value;
+ }
+
+ return $this;
}
/**
@@ -119,6 +126,7 @@ public function get($index)
public function setContentType($type)
{
$this->contentType = $type;
+ return $this;
}
/**
@@ -141,6 +149,7 @@ public function getContentType()
public function setCharset($charset)
{
$this->charset = $charset;
+ return $this;
}
/**

0 comments on commit 3dcde8f

Please sign in to comment.