예제 #1
0
 function testStripSlashesDeep()
 {
     $testPatterns = array('\\"Hello\\"' => '"Hello"', '\\"Hi\\"' => '"Hi"', "\\\\\\x" => 'x', "\\'you\\'" => "'you'");
     foreach ($testPatterns as $input => $expected) {
         $actual = org_tubepress_impl_util_StringUtils::stripslashes_deep($input);
         $this->assertTrue($actual === $expected, "{$actual} did not equal expected {$expected}");
     }
 }
 protected function _magic($name, $value)
 {
     /** If it's an array, send each element through the filter. */
     if (is_array($value)) {
         foreach ($value as $key => $subValue) {
             $value[$key] = $this->_magic($key, $subValue);
         }
         return $value;
     }
     /** We're only interested in strings. */
     if (!is_string($value)) {
         return $value;
     }
     $toReturn = trim($value);
     $toReturn = htmlspecialchars($toReturn, ENT_NOQUOTES);
     $toReturn = org_tubepress_impl_util_StringUtils::stripslashes_deep($toReturn);
     $toReturn = $this->_booleanMagic($toReturn);
     return $toReturn;
 }