PageRenderTime 27ms CodeModel.GetById 25ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 1<?php
 2
 3class Haanga_Extension_Filter_Slugify
 4{
 5    static function generator($compiler, $args)
 6    {
 7        if (count($args) != 1) {
 8            $compiler->Error("slugify filter only needs one parameter");
 9        }
10      
11        $arg = hexec('strtolower', $args[0]);
12        $arg = hexec('str_replace'," ","-",$arg);
13        $arg = hexec('preg_replace',"/[^\d\w-_]/",'',$arg);
14        return $arg;
15    }
16}