/xandra.org/www/application/classes/Dust/Filter/EncodeUriComponent.php
https://bitbucket.org/ekkl/tanora · PHP · 19 lines · 16 code · 3 blank · 0 comment · 1 complexity · fb4e9b42c7c638a8f3f32f10c766492a MD5 · raw file
- <?php
- namespace Dust\Filter;
- class EncodeUriComponent implements Filter {
- public static $replacers;
-
- public function apply($item) {
- if (!is_string($item)) return $item;
- return strtr(rawurlencode($item), EncodeUriComponent::$replacers);
- }
-
- }
- EncodeUriComponent::$replacers = [
- '%21' => '!',
- '%2A' => '*',
- '%27' => "'",
- '%28' => '(',
- '%29' => ')'
- ];