cleanse tags of non-tag characters when canonicalizing

This commit is contained in:
Evan Prodromou 2011-08-02 13:49:00 -04:00
parent e0238e7c17
commit 10ce44c297

View File

@ -1096,8 +1096,11 @@ function common_tag_link($tag)
function common_canonical_tag($tag) function common_canonical_tag($tag)
{ {
// only alphanum
$tag = preg_replace('/[^\pL\pN]/', '', $tag);
$tag = mb_convert_case($tag, MB_CASE_LOWER, "UTF-8"); $tag = mb_convert_case($tag, MB_CASE_LOWER, "UTF-8");
return str_replace(array('-', '_', '.'), '', $tag); $tag = substr($tag, 0, 64);
return $tag;
} }
function common_valid_profile_tag($str) function common_valid_profile_tag($str)