Merge branch 'release/0.4.0'

This commit is contained in:
Justin Hileman
2010-10-30 18:12:58 -04:00
3 changed files with 7 additions and 6 deletions
+5 -4
View File
@@ -385,7 +385,7 @@ class Mustache {
$otag = preg_quote($this->_otag, '/'); $otag = preg_quote($this->_otag, '/');
$ctag = preg_quote($this->_ctag, '/'); $ctag = preg_quote($this->_ctag, '/');
$this->_tagRegEx = '/' . $otag . "([#\^\/=!>\\{&])?(.+?)\\1?" . $ctag . "+/s"; $this->_tagRegEx = '/' . $otag . "([#\^\/=!<>\\{&])?(.+?)\\1?" . $ctag . "+/s";
$html = ''; $html = '';
$matches = array(); $matches = array();
@@ -442,6 +442,7 @@ class Mustache {
return $this->_renderComment($tag_name); return $this->_renderComment($tag_name);
break; break;
case '>': case '>':
case '<':
return $this->_renderPartial($tag_name); return $this->_renderPartial($tag_name);
break; break;
case '{': case '{':
@@ -469,7 +470,7 @@ class Mustache {
* @return string * @return string
*/ */
protected function _renderEscaped($tag_name) { protected function _renderEscaped($tag_name) {
return htmlentities($this->_getVariable($tag_name), null, $this->_charset); return htmlentities($this->_getVariable($tag_name), ENT_COMPAT, $this->_charset);
} }
/** /**
@@ -521,7 +522,7 @@ class Mustache {
$otag = preg_quote($this->_otag, '/'); $otag = preg_quote($this->_otag, '/');
$ctag = preg_quote($this->_ctag, '/'); $ctag = preg_quote($this->_ctag, '/');
$this->_tagRegEx = '/' . $otag . "([#\^\/=!>\\{&])?(.+?)\\1?" . $ctag . "+/s"; $this->_tagRegEx = '/' . $otag . "([#\^\/=!<>\\{&])?(.+?)\\1?" . $ctag . "+/s";
return ''; return '';
} }
@@ -608,7 +609,7 @@ class Mustache {
} else if (isset($view->$tag_name)) { } else if (isset($view->$tag_name)) {
return $view->$tag_name; return $view->$tag_name;
} }
} else if (isset($view[$tag_name])) { } else if (array_key_exists($tag_name, $view)) {
return $view[$tag_name]; return $view[$tag_name];
} }
} }
+1 -1
View File
@@ -1,5 +1,5 @@
<?php <?php
class Escaped extends Mustache { class Escaped extends Mustache {
public $title = "Bear > Shark"; public $title = '"Bear" > "Shark"';
} }
+1 -1
View File
@@ -1 +1 @@
<h1>Bear &gt; Shark</h1> <h1>&quot;Bear&quot; &gt; &quot;Shark&quot;</h1>