slugify strings for usage in urls
- normalizes and lowers the string
- replaces non-ascii chars with a dash (-)
- some chars (i.e. quotes) are plain removed

@note uses ::normalize, see notes there

@param  string $data utf-8 encoded
@return string
962171
public static function slugify($data) {
	// flatten the data
	$data = self::normalize($data);
	$data = mb_strtolower($data);
	
	// remove certain chars
	$data = str_replace(['"', "'"], '', $data);
	
	// replace most chars
	$data = preg_replace('/[^a-z0-9]/', '-', $data);
	
	// cleanup
	$data = trim($data, '-');
	
	return $data;
}
195893
public static function slugify($slug)
    {
        $slug = preg_replace('/\xE3\x80\x80/', ' ', $slug);
        $slug = str_replace('-', ' ', $slug);
        $slug = preg_replace('#[:\#\*"@+=;!><&\.%()\]\/\'\\\\|\[]#', "\x20", $slug);
        $slug = str_replace('?', '', $slug);
        $slug = trim(mb_strtolower($slug, 'UTF-8'));
        $slug = preg_replace('#\x20+#', '-', $slug);
        return $slug;
    }
1240480
public function slugify($text)
    {
        $text = $this->slugifier->slugify($text);

        // jackrabbit can not handle node-names which contains a number followed by "e" e.g. 10e
        $text = preg_replace('((\d+)([eE]))', '$1-$2', $text);

        return $text;
    }
852412
protected function _normalizeEOL($data)
    {
        return strtr($data, array(
            "\r\n" => $this->sep,
            "\r" => $this->sep,
            "\n" => $this->sep
        ));
    }
779482
public function slug($string, $replacement = '-')
    {
        $options = $this->config;
        $regex = $options['regex'];
        unset($options['regex']);

        return Slugify::create($regex, $options)->slugify($string, $replacement);
    }
11303
public function extractUrlAliasFromData($data)
    {
        $urlAlias = new UrlAlias();

        list($type, $destination) = $this->matchTypeAndDestination($data['action']);
        $urlAlias->id = $data['parent'] . '-' . $data['text_md5'];
        $urlAlias->pathData = $this->normalizePathData($data['raw_path_data']);
        $urlAlias->languageCodes = $this->languageMaskGenerator->extractLanguageCodesFromMask($data['lang_mask']);
        $urlAlias->alwaysAvailable = $this->languageMaskGenerator->isAlwaysAvailable($data['lang_mask']);
        $urlAlias->isHistory = isset($data['is_path_history']) ? $data['is_path_history'] : !$data['is_original'];
        $urlAlias->isCustom = (bool)$data['is_alias'];
        $urlAlias->forward = $data['is_alias'] && $data['alias_redirects'];
        $urlAlias->destination = $destination;
        $urlAlias->type = $type;

        return $urlAlias;
    }
1236522
final protected function sanitize($data)
    {
        // Recursively loop through the data array and return the sanitized data
        $sanitized = [];
        if (is_array($data)) {
            foreach ($data as $key => $value) {
                $sanitized[$key] = $this->sanitize($value);
            }
        } else {
            $sanitized = trim(strip_tags($data));
        }
        return $sanitized;
    }
416124
public function encode(string $data): string
    {
        $data = str_split($data);
        $data = array_map("ord", $data);

        $leadingZeroes = 0;
        while (!empty($data) && 0 === $data[0]) {
            $leadingZeroes++;
            array_shift($data);
        }
        $converted = $this->baseConvert($data, 256, 62);
        if (0 < $leadingZeroes) {
            $converted = array_merge(
                array_fill(0, $leadingZeroes, 0),
                $converted
            );
        }
        return implode("", array_map(function ($index) {
            return $this->options["characters"][$index];
        }, $converted));
    }
1331796
private static function filterEscape($data)
    {
        return array_filter(array_map(function ($elem) {
            if (is_array($elem)) {
                return self::filterEscape($elem);
            }
            return addslashes($elem); // @codingStandardsIgnoreLine
        }, $data));
    }
4976
public function formatUrl($string)
        {
            // Allow only alphanumerics, underscores and dashes
            $string = preg_replace('/([^a-zA-Z0-9_\-]+)/', '-', strtolower($string));
            // Replace extra spaces and dashes with single dash
            $string = preg_replace('/\s+/', '-', $string);
            $string = preg_replace('|-+|', '-', $string);
            // Trim extra dashes from beginning and end
            $string = trim($string, '-');

            return $string;
        }
309803
static public function stripslashes($data) 
	{
	    if(!is_array($data)) return stripslashes($data);
	    
	    foreach($data as $key => $val) {
	        $data[$key] = static::stripslashes($val);
	    }
	    
	    return $data;
	}
47953
public static function utf8Decode($data) {
		if (is_string($data)) {
			return utf8_decode($data);

		} else if (is_array($data)) {
			foreach ($data as $key => $value) {
				$data[utf8_decode($key)] = self::utf8Decode($value);
			}

		} else if (is_object($data)) {
			foreach ($data as $key => $value) {
				$data->{$key} = self::utf8Decode($value);
			}
		}

		return $data;
	}
1312383
protected function _url($data)
  {
    if (is_array($data)) {
      return array_map([
        $this,
        '_url'
      ], $data);
    } elseif (is_scalar($data)) {
      return str_replace([
        '+',
        '!',
        '*',
        "'",
        '(',
        ')'
      ], [
        ' ',
        '%21',
        '%2A',
        '%27',
        '%28',
        '%29'
      ], rawurlencode($data));
    }
    return '';
  }
1177467
public function slugify($str)
    {
        $str = mb_strtolower(trim($str));
        $str = str_replace(array('å','ä','ö'), array('a','a','o'), $str);
        $str = preg_replace('/[^a-z0-9-]/', '-', $str);
        $str = trim(preg_replace('/-+/', '-', $str), '-');
        return $str;
    }
1306222
public static function slugify($str, $delimiter = '-')
    {
        $temp = preg_replace(
            '/[^a-z0-9]/',
            $delimiter,
            strtolower(trim(strip_tags($str)))
        );

        return preg_replace('/-{2,}/', $delimiter, $temp);
    }
758556
public function replaceParametersScalar($data)
	{
		$count = preg_match_all('/%[a-z\\._]+%/i', $data, $matches);

		if (!$count) {
			return $data;
		}

		$replacements = array();

		foreach ($matches as $expression) {
			$parameter = trim($expression[0], '%');
			$replacements[$expression[0]] = $this->getParameter($parameter);
		}

		return strtr($data, $replacements);
	}
319093
protected function convertEncoding($data)
    {
        if (!$this->shouldConvert) {
            return $data;
        }
        return $this->stringConverter->convert("$data", 'utf-8', $this->getOption(self::ENCODING));
    }