@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | * but after, you can only update existing globals. |
| 427 | 427 | * |
| 428 | 428 | * @param string $name |
| 429 | - * @param mixed $value |
|
| 429 | + * @param string $value |
|
| 430 | 430 | * |
| 431 | 431 | * @return $this |
| 432 | 432 | * @throws Exception |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | * Adds a filter to this Dwoo instance, it will be used to filter the output of all the templates rendered by this |
| 577 | 577 | * instance. |
| 578 | 578 | * |
| 579 | - * @param mixed $callback a callback or a filter name if it is autoloaded from a plugin directory |
|
| 579 | + * @param Smarty\Filter\Adapter $callback a callback or a filter name if it is autoloaded from a plugin directory |
|
| 580 | 580 | * @param bool $autoload if true, the first parameter must be a filter name from one of the plugin directories |
| 581 | 581 | * |
| 582 | 582 | * @return void |
@@ -1614,7 +1614,7 @@ discard block |
||
| 1614 | 1614 | * @param mixed $value the value to assign |
| 1615 | 1615 | * @param string $scope the variable string, using dwoo variable syntax (i.e. "var.subvar[subsubvar]->property") |
| 1616 | 1616 | * |
| 1617 | - * @return bool true if assigned correctly or false if a problem occured while parsing the var string |
|
| 1617 | + * @return null|false true if assigned correctly or false if a problem occured while parsing the var string |
|
| 1618 | 1618 | */ |
| 1619 | 1619 | public function assignInScope($value, $scope) |
| 1620 | 1620 | { |
@@ -44,51 +44,51 @@ |
||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | switch ($format) { |
| 47 | - case 'html': |
|
| 48 | - return htmlspecialchars((string)$value, ENT_QUOTES, $charset); |
|
| 49 | - case 'htmlall': |
|
| 50 | - return htmlentities((string)$value, ENT_QUOTES, $charset); |
|
| 51 | - case 'url': |
|
| 52 | - return rawurlencode((string)$value); |
|
| 53 | - case 'urlpathinfo': |
|
| 54 | - return str_replace('%2F', '/', rawurlencode((string)$value)); |
|
| 55 | - case 'quotes': |
|
| 56 | - return preg_replace("#(?<!\\\\)'#", "\\'", (string)$value); |
|
| 57 | - case 'hex': |
|
| 58 | - $out = ''; |
|
| 59 | - $cnt = strlen((string)$value); |
|
| 60 | - for ($i = 0; $i < $cnt; ++ $i) { |
|
| 61 | - $out .= '%' . bin2hex((string)$value[$i]); |
|
| 62 | - } |
|
| 47 | + case 'html': |
|
| 48 | + return htmlspecialchars((string)$value, ENT_QUOTES, $charset); |
|
| 49 | + case 'htmlall': |
|
| 50 | + return htmlentities((string)$value, ENT_QUOTES, $charset); |
|
| 51 | + case 'url': |
|
| 52 | + return rawurlencode((string)$value); |
|
| 53 | + case 'urlpathinfo': |
|
| 54 | + return str_replace('%2F', '/', rawurlencode((string)$value)); |
|
| 55 | + case 'quotes': |
|
| 56 | + return preg_replace("#(?<!\\\\)'#", "\\'", (string)$value); |
|
| 57 | + case 'hex': |
|
| 58 | + $out = ''; |
|
| 59 | + $cnt = strlen((string)$value); |
|
| 60 | + for ($i = 0; $i < $cnt; ++ $i) { |
|
| 61 | + $out .= '%' . bin2hex((string)$value[$i]); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - return $out; |
|
| 65 | - case 'hexentity': |
|
| 66 | - $out = ''; |
|
| 67 | - $cnt = strlen((string)$value); |
|
| 68 | - for ($i = 0; $i < $cnt; ++ $i) { |
|
| 69 | - $out .= '&#x' . bin2hex((string)$value[$i]) . ';'; |
|
| 70 | - } |
|
| 64 | + return $out; |
|
| 65 | + case 'hexentity': |
|
| 66 | + $out = ''; |
|
| 67 | + $cnt = strlen((string)$value); |
|
| 68 | + for ($i = 0; $i < $cnt; ++ $i) { |
|
| 69 | + $out .= '&#x' . bin2hex((string)$value[$i]) . ';'; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - return $out; |
|
| 73 | - case 'javascript': |
|
| 74 | - case 'js': |
|
| 75 | - return strtr((string)$value, array( |
|
| 76 | - '\\' => '\\\\', |
|
| 77 | - "'" => "\\'", |
|
| 78 | - '"' => '\\"', |
|
| 79 | - "\r" => '\\r', |
|
| 80 | - "\n" => '\\n', |
|
| 81 | - '</' => '<\/' |
|
| 82 | - )); |
|
| 83 | - case 'mail': |
|
| 84 | - return str_replace(array( |
|
| 85 | - '@', |
|
| 86 | - '.' |
|
| 87 | - ), array( |
|
| 88 | - ' (AT) ', |
|
| 89 | - ' (DOT) ' |
|
| 90 | - ), (string)$value); |
|
| 91 | - default: |
|
| 92 | - $dwoo->triggerError('Escape\'s format argument must be one of : html, htmlall, url, urlpathinfo, hex, hexentity, javascript or mail, "' . $format . '" given.', E_USER_WARNING); |
|
| 72 | + return $out; |
|
| 73 | + case 'javascript': |
|
| 74 | + case 'js': |
|
| 75 | + return strtr((string)$value, array( |
|
| 76 | + '\\' => '\\\\', |
|
| 77 | + "'" => "\\'", |
|
| 78 | + '"' => '\\"', |
|
| 79 | + "\r" => '\\r', |
|
| 80 | + "\n" => '\\n', |
|
| 81 | + '</' => '<\/' |
|
| 82 | + )); |
|
| 83 | + case 'mail': |
|
| 84 | + return str_replace(array( |
|
| 85 | + '@', |
|
| 86 | + '.' |
|
| 87 | + ), array( |
|
| 88 | + ' (AT) ', |
|
| 89 | + ' (DOT) ' |
|
| 90 | + ), (string)$value); |
|
| 91 | + default: |
|
| 92 | + $dwoo->triggerError('Escape\'s format argument must be one of : html, htmlall, url, urlpathinfo, hex, hexentity, javascript or mail, "' . $format . '" given.', E_USER_WARNING); |
|
| 93 | 93 | } |
| 94 | 94 | } |