mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 03:01:43 +09:00
As now, encodeHTML() can process a normal array
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8874 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
1975acc8ad
commit
1d27b6ae7a
2 changed files with 21 additions and 9 deletions
|
|
@ -47,19 +47,22 @@ class Security
|
|||
$varName0 = array_shift($varName);
|
||||
if($use_context) {
|
||||
$var = Context::get($varName0);
|
||||
} else {
|
||||
} elseif($varName0) {
|
||||
$var = $is_object ? $this->_targetVar->{$varName0} : $this->_targetVar[$varName0];
|
||||
} else {
|
||||
$var = $this->_targetVar;
|
||||
}
|
||||
$var = $this->_encodeHTML($var, $varName);
|
||||
|
||||
if($var !== false) {
|
||||
if($use_context) {
|
||||
Context::set($varName0, $var);
|
||||
} elseif($is_object) {
|
||||
$this->_targetVar->{$varName0} = $var;
|
||||
} else {
|
||||
$this->_targetVar[$varName0] = $var;
|
||||
}
|
||||
if($var === false) return false;
|
||||
|
||||
if($use_context) {
|
||||
Context::set($varName0, $var);
|
||||
} elseif($varName0) {
|
||||
if($is_object) $this->_targetVar->{$varName0} = $var;
|
||||
else $this->_targetVar[$varName0] = $var;
|
||||
} else {
|
||||
$this->_targetVar = $var;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -108,6 +108,15 @@ class SecurityTest extends PHPUnit_Framework_TestCase
|
|||
$this->assertEquals(Context::get('object1'), $obj);
|
||||
}
|
||||
|
||||
public function testEncodeHTML_CustomContext()
|
||||
{
|
||||
$array = array('Hello', 'World', '<b>Bold</b> is not bald');
|
||||
|
||||
// array with no nested objects or arrays
|
||||
$security = new Security($array);
|
||||
$returned = $security->encodeHTML('.');
|
||||
$this->assertEquals($returned, array('Hello', 'World', '<b>Bold</b> is not bald'));
|
||||
}
|
||||
}
|
||||
|
||||
$mock_vars = array();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue