]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/nickname.php
Removed plugin Google-Analytics as this is free/libre and decentralized
[quix0rs-gnu-social.git] / lib / nickname.php
index d0cb08c63bb1f67d217bbc9c312d487df7fc416c..1ed0abbe78dbfcec46365c97f73684cb2ff34b83 100644 (file)
@@ -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}';