diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-11-03 12:38:38 +0100 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-11-03 12:43:35 +0100 |
commit | 740b32b520e6b1723512c6f9b78cef6575b1725b (patch) | |
tree | 01d976a30db84d4aa3cd2c0e6a429cc5ac15a187 /application/bookmark/LinkUtils.php | |
parent | 38b55fbf3d4fdb515d0e82e5a3126d4671652b3e (diff) | |
download | Shaarli-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.php | 11 |
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 | */ |
144 | function format_description($description, $indexUrl = '') | 145 | function 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 | /** |