aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/bookmark/LinkUtils.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-11-03 12:38:38 +0100
committerArthurHoaro <arthur@hoa.ro>2020-11-03 12:43:35 +0100
commit740b32b520e6b1723512c6f9b78cef6575b1725b (patch)
tree01d976a30db84d4aa3cd2c0e6a429cc5ac15a187 /application/bookmark/LinkUtils.php
parent38b55fbf3d4fdb515d0e82e5a3126d4671652b3e (diff)
downloadShaarli-740b32b520e6b1723512c6f9b78cef6575b1725b.tar.gz
Shaarli-740b32b520e6b1723512c6f9b78cef6575b1725b.tar.zst
Shaarli-740b32b520e6b1723512c6f9b78cef6575b1725b.zip
Default formatter: add a setting to disable auto-linkification
+ update documentation + single parameter for both URL and hashtags Fixes #1094
Diffstat (limited to 'application/bookmark/LinkUtils.php')
-rw-r--r--application/bookmark/LinkUtils.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/application/bookmark/LinkUtils.php b/application/bookmark/LinkUtils.php
index faf5dbfd..17c37979 100644
--- a/application/bookmark/LinkUtils.php
+++ b/application/bookmark/LinkUtils.php
@@ -138,12 +138,17 @@ function space2nbsp($text)
138 * 138 *
139 * @param string $description shaare's description. 139 * @param string $description shaare's description.
140 * @param string $indexUrl URL to Shaarli's index. 140 * @param string $indexUrl URL to Shaarli's index.
141 141 * @param bool $autolink Turn on/off automatic linkifications of URLs and hashtags
142 *
142 * @return string formatted description. 143 * @return string formatted description.
143 */ 144 */
144function format_description($description, $indexUrl = '') 145function format_description($description, $indexUrl = '', $autolink = true)
145{ 146{
146 return nl2br(space2nbsp(hashtag_autolink(text2clickable($description), $indexUrl))); 147 if ($autolink) {
148 $description = hashtag_autolink(text2clickable($description), $indexUrl);
149 }
150
151 return nl2br(space2nbsp($description));
147} 152}
148 153
149/** 154/**