public static function url($Mixed)
{
if (!is_string($Mixed)) {
return self::to($Mixed, 'Url');
}
// Preliminary decoding
$Mixed = strip_tags(html_entity_decode($Mixed, ENT_COMPAT, 'UTF-8'));
$Mixed = strtr($Mixed, self::$_UrlTranslations);
$Mixed = preg_replace('`[\']`', '', $Mixed);
// Convert punctuation, symbols, and spaces to hyphens
if (unicodeRegexSupport()) {
$Mixed = preg_replace('`[\\pP\\pS\\s]`u', '-', $Mixed);
} else {
$Mixed = preg_replace('`[\\W_]`', '-', $Mixed);
}
// Lowercase, no trailing or repeat hyphens
$Mixed = preg_replace('`-+`', '-', strtolower($Mixed));
$Mixed = trim($Mixed, '-');
return rawurlencode($Mixed);
}