aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/front/controller/admin/ShaarePublishController.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-10-22 16:21:03 +0200
committerArthurHoaro <arthur@hoa.ro>2020-11-05 17:54:42 +0100
commitb3bd8c3e8d367975980043e772f7cd78b7f96bc6 (patch)
treeec79899ea564c093d8b0578f3e614881a4ea7c3d /application/front/controller/admin/ShaarePublishController.php
parent48df9f45b8c4b2995c1e04146071628668531b37 (diff)
downloadShaarli-b3bd8c3e8d367975980043e772f7cd78b7f96bc6.tar.gz
Shaarli-b3bd8c3e8d367975980043e772f7cd78b7f96bc6.tar.zst
Shaarli-b3bd8c3e8d367975980043e772f7cd78b7f96bc6.zip
Feature: support any tag separator
So it allows to have multiple words tags. Breaking change: commas ',' are no longer a default separator. Fixes #594
Diffstat (limited to 'application/front/controller/admin/ShaarePublishController.php')
-rw-r--r--application/front/controller/admin/ShaarePublishController.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/application/front/controller/admin/ShaarePublishController.php b/application/front/controller/admin/ShaarePublishController.php
index 18afc2d1..625a5680 100644
--- a/application/front/controller/admin/ShaarePublishController.php
+++ b/application/front/controller/admin/ShaarePublishController.php
@@ -113,7 +113,10 @@ class ShaarePublishController extends ShaarliAdminController
113 $bookmark->setDescription($request->getParam('lf_description')); 113 $bookmark->setDescription($request->getParam('lf_description'));
114 $bookmark->setUrl($request->getParam('lf_url'), $this->container->conf->get('security.allowed_protocols', [])); 114 $bookmark->setUrl($request->getParam('lf_url'), $this->container->conf->get('security.allowed_protocols', []));
115 $bookmark->setPrivate(filter_var($request->getParam('lf_private'), FILTER_VALIDATE_BOOLEAN)); 115 $bookmark->setPrivate(filter_var($request->getParam('lf_private'), FILTER_VALIDATE_BOOLEAN));
116 $bookmark->setTagsString($request->getParam('lf_tags')); 116 $bookmark->setTagsString(
117 $request->getParam('lf_tags'),
118 $this->container->conf->get('general.tags_separator', ' ')
119 );
117 120
118 if ($this->container->conf->get('thumbnails.mode', Thumbnailer::MODE_NONE) !== Thumbnailer::MODE_NONE 121 if ($this->container->conf->get('thumbnails.mode', Thumbnailer::MODE_NONE) !== Thumbnailer::MODE_NONE
119 && true !== $this->container->conf->get('general.enable_async_metadata', true) 122 && true !== $this->container->conf->get('general.enable_async_metadata', true)
@@ -128,7 +131,7 @@ class ShaarePublishController extends ShaarliAdminController
128 $data = $formatter->format($bookmark); 131 $data = $formatter->format($bookmark);
129 $this->executePageHooks('save_link', $data); 132 $this->executePageHooks('save_link', $data);
130 133
131 $bookmark->fromArray($data); 134 $bookmark->fromArray($data, $this->container->conf->get('general.tags_separator', ' '));
132 $this->container->bookmarkService->set($bookmark); 135 $this->container->bookmarkService->set($bookmark);
133 136
134 // If we are called from the bookmarklet, we must close the popup: 137 // If we are called from the bookmarklet, we must close the popup:
@@ -221,6 +224,11 @@ class ShaarePublishController extends ShaarliAdminController
221 224
222 protected function buildFormData(array $link, bool $isNew, Request $request): array 225 protected function buildFormData(array $link, bool $isNew, Request $request): array
223 { 226 {
227 $link['tags'] = strlen($link['tags']) > 0
228 ? $link['tags'] . $this->container->conf->get('general.tags_separator', ' ')
229 : $link['tags']
230 ;
231
224 return escape([ 232 return escape([
225 'link' => $link, 233 'link' => $link,
226 'link_is_new' => $isNew, 234 'link_is_new' => $isNew,