X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fnickname.php;h=1ed0abbe78dbfcec46365c97f73684cb2ff34b83;hb=refs%2Fheads%2Fupstream-changes%2Fgoogle-analytics-removal;hp=d0cb08c63bb1f67d217bbc9c312d487df7fc416c;hpb=6ed66d9c7617332e9ea253e1f48583b4d9dbf45c;p=quix0rs-gnu-social.git diff --git a/lib/nickname.php b/lib/nickname.php index d0cb08c63b..1ed0abbe78 100644 --- a/lib/nickname.php +++ b/lib/nickname.php @@ -27,8 +27,7 @@ class Nickname * Nickname::normalize() to get the canonical form, or Nickname::isValid() * if you just need to check if it's properly formatted. * - * This, DISPLAY_FMT, and CANONICAL_FMT replace the old NICKNAME_FMT, - * but be aware that these should not be enclosed in []s. + * This, DISPLAY_FMT, and CANONICAL_FMT should not be enclosed in []s. * * @fixme would prefer to define in reference to the other constants */ @@ -36,6 +35,7 @@ class Nickname /** * Regex fragment for acceptable user-formatted variant of a nickname. + * * This includes some chars such as underscore which will be removed * from the normalized canonical form, but still must fit within * field length limits. @@ -44,11 +44,18 @@ class Nickname * Nickname::normalize() to get the canonical form, or Nickname::isValid() * if you just need to check if it's properly formatted. * - * This and CANONICAL_FMT replace the old NICKNAME_FMT, but be aware - * that these should not be enclosed in []s. + * This, INPUT_FMT and CANONICAL_FMT should not be enclosed in []s. */ const DISPLAY_FMT = '[0-9a-zA-Z_]{1,64}'; + /** + * Simplified regex fragment for acceptable full WebFinger ID of a user + * + * We could probably use an email regex here, but mainly we are interested + * in matching it in our URLs, like https://social.example/user@example.com + */ + const WEBFINGER_FMT = '[0-9a-zA-Z_]{1,64}\@[0-9a-zA-Z_-.]{3,255}'; + /** * Regex fragment for checking a canonical nickname. * @@ -60,8 +67,7 @@ class Nickname * there are multiple possible denormalized forms for each valid * canonical-form name. * - * This and DISPLAY_FMT replace the old NICKNAME_FMT, but be aware - * that these should not be enclosed in []s. + * This, INPUT_FMT and DISPLAY_FMT should not be enclosed in []s. */ const CANONICAL_FMT = '[0-9a-z]{1,64}';