aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php38
1 files changed, 21 insertions, 17 deletions
diff --git a/include/text.php b/include/text.php
index e02becf31..bbf0b5b98 100644
--- a/include/text.php
+++ b/include/text.php
@@ -2000,30 +2000,34 @@ function legal_webbie($s) {
if(! strlen($s))
return '';
+ // WARNING: This regex will not work in a federated environment.
+ // You will probably want something like
+ // preg_replace('/([^a-z0-9\_])/','',strtolower($s));
- // Has to start with a lowercase alphabetic character - not a number.
- // This is so we can differentiate between something like channel=123
- // and channel=foo and lookup the first by numeric id and the second
- // by nickname.
+ $r = preg_replace('/([^a-z0-9\-\_\.])/','',strtolower($s));
- $x = $s;
- do {
- $s = $x;
- $x = preg_replace('/^([^a-z])(.*?)/',"$2",$s);
- } while($x != $s);
+ $x = [ 'input' => $s, 'output' => $r ];
+ call_hooks('legal_webbie',$x);
+ return $x['output'];
- // Use the lowest common denominator rules (letters, numbers, and underscore)
- // if the site configuration allows federation with other networks
+}
+
+function legal_webbie_text() {
+
+ // WARNING: This will not work in a federated environment.
+
+ $s = t('a-z, 0-9, -, _, and . only');
+
+ $x = [ 'text' => $s ];
+ call_hooks('legal_webbie_text',$x);
+ return $x['text'];
- if(Zlib\System::get_server_role() === 'pro') {
- return preg_replace('/([^a-z0-9\-\_\.])/','',$x);
- }
- else {
- return preg_replace('/([^a-z0-9\_])/','',$x);
- }
}
+
+
+
function check_webbie($arr) {