Public Member Functions

Robo47_Filter_SanitizeUrl Class Reference

List of all members.

Public Member Functions

 filter ($value)

Detailed Description

Definition at line 33 of file SanitizeUrl.php.


Member Function Documentation

Robo47_Filter_SanitizeUrl::filter ( value  ) 
Parameters:
string $value
Returns:
string

Definition at line 41 of file SanitizeUrl.php.

    {
        // all signs to replace
        $search = array('ä' => 'ae',
            'ö' => 'oe',
            'ü' => 'ue',
            'ß' => 's',
            'Ä' => 'Ae',
            'Ö' => 'Oe',
            'Ü' => 'Ue',
            'ß' => 's',
            ' ' => '-');

        // replace them
        $value = str_replace(array_keys($search), $search, $value);

        // remove everything which is not a-z 0-9 or - or .
        $value = preg_replace('~[^a-z0-9\.\-_]~i', '-', $value);

        // remove double -
        $value = preg_replace('~(-)+~', '-', $value);

        // remove trailing -
        return trim($value, '-');
    }


The documentation for this class was generated from the following file: