/lib/Haanga/Extension/Filter/Slugify.php
http://github.com/crodas/Haanga · PHP · 16 lines · 14 code · 2 blank · 0 comment · 2 complexity · bf974900930e1ca0489e425a66cfda25 MD5 · raw file
- <?php
- class Haanga_Extension_Filter_Slugify
- {
- static function generator($compiler, $args)
- {
- if (count($args) != 1) {
- $compiler->Error("slugify filter only needs one parameter");
- }
-
- $arg = hexec('strtolower', $args[0]);
- $arg = hexec('str_replace'," ","-",$arg);
- $arg = hexec('preg_replace',"/[^\d\w-_]/",'',$arg);
- return $arg;
- }
- }