aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2023-09-02 11:19:01 +0200
committerAndreas Gohr <andi@splitbrain.org>2023-09-02 11:19:01 +0200
commit5c46ca3d85d7c2aafb41fc3bea2c559c28e7f1ef (patch)
treed7e00a97dffc7eb4552aba06a41f9e5a63c99a47
parentab240622ff583dacf3f3d36c86fceed3ed303a83 (diff)
downloaddokuwiki-5c46ca3d85d7c2aafb41fc3bea2c559c28e7f1ef.tar.gz
dokuwiki-5c46ca3d85d7c2aafb41fc3bea2c559c28e7f1ef.zip
simplify URL linking in handler
-rw-r--r--inc/parser/handler.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/inc/parser/handler.php b/inc/parser/handler.php
index 409b0e08d..8910c28fe 100644
--- a/inc/parser/handler.php
+++ b/inc/parser/handler.php
@@ -980,11 +980,11 @@ class Doku_Handler
$title = null;
// add protocol on simple short URLs
- if (substr($url, 0, 3) == 'ftp' && (substr($url, 0, 6) != 'ftp://')) {
+ if (str_starts_with($url, 'ftp') && !str_starts_with($url, 'ftp://')) {
$title = $url;
$url = 'ftp://' . $url;
}
- if (substr($url, 0, 3) == 'www' && (substr($url, 0, 7) != 'http://')) {
+ if (str_starts_with($url, 'www')) {
$title = $url;
$url = 'http://' . $url;
}