From e50527b4579bc78c294d50034e085cefc966cd17 Mon Sep 17 00:00:00 2001 From: KuJoe Date: Sat, 18 May 2024 22:49:31 -0400 Subject: [PATCH 1/2] Automatically convert URLs into clickable links in posts and pages Properly formatted URLs are detected and converted to clickable links in posts and pages. Ignores URLs already clickable and removes

added to some links at the end of lines. --- system/includes/functions.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/system/includes/functions.php b/system/includes/functions.php index aa76d080..13fed72e 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -560,6 +560,10 @@ function get_posts($posts, $page = 1, $perpage = 0) $post->views = null; } + // Automatically convert URLs to clickable links + $urlpattern = '#(https?://(?!.*?)[^\s]+)

#i'; + $post->body = preg_replace($urlpattern, '$1', $post->body); + $tmp[] = $post; } @@ -638,6 +642,10 @@ function get_pages($pages, $page = 1, $perpage = 0) $post->views = null; } + // Automatically convert URLs to clickable links + $urlpattern = '#(https?://(?!.*?)[^\s]+)

#i'; + $post->body = preg_replace($urlpattern, '$1', $post->body); + $tmp[] = $post; } @@ -727,6 +735,10 @@ function get_subpages($sub_pages, $page = 1, $perpage = 0) $post->views = null; } + // Automatically convert URLs to clickable links + $urlpattern = '#(https?://(?!.*?)[^\s]+)

#i'; + $post->body = preg_replace($urlpattern, '$1', $post->body); + $tmp[] = $post; } From a7f0ca17f58b2ffd4fed23f8418e0acd2c937f09 Mon Sep 17 00:00:00 2001 From: KuJoe Date: Sun, 19 May 2024 03:50:35 -0400 Subject: [PATCH 2/2] Revert "Automatically convert URLs into clickable links in posts and pages" This reverts commit e50527b4579bc78c294d50034e085cefc966cd17. --- system/includes/functions.php | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/system/includes/functions.php b/system/includes/functions.php index 13fed72e..aa76d080 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -560,10 +560,6 @@ function get_posts($posts, $page = 1, $perpage = 0) $post->views = null; } - // Automatically convert URLs to clickable links - $urlpattern = '#(https?://(?!.*?)[^\s]+)

#i'; - $post->body = preg_replace($urlpattern, '$1', $post->body); - $tmp[] = $post; } @@ -642,10 +638,6 @@ function get_pages($pages, $page = 1, $perpage = 0) $post->views = null; } - // Automatically convert URLs to clickable links - $urlpattern = '#(https?://(?!.*?)[^\s]+)

#i'; - $post->body = preg_replace($urlpattern, '$1', $post->body); - $tmp[] = $post; } @@ -735,10 +727,6 @@ function get_subpages($sub_pages, $page = 1, $perpage = 0) $post->views = null; } - // Automatically convert URLs to clickable links - $urlpattern = '#(https?://(?!.*?)[^\s]+)

#i'; - $post->body = preg_replace($urlpattern, '$1', $post->body); - $tmp[] = $post; }