aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/formatter/FormatterFactory.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-01-18 11:33:23 +0100
committerArthurHoaro <arthur@hoa.ro>2020-01-18 11:39:26 +0100
commita39acb2518f272df8a601af72c13eabe2719dcb8 (patch)
treefb8bda9de5bea9d73553c3d54610eb211d7de6fb /application/formatter/FormatterFactory.php
parent3fb29fdda04ca86e04422d49b86cf646d53c4f9d (diff)
downloadShaarli-a39acb2518f272df8a601af72c13eabe2719dcb8.tar.gz
Shaarli-a39acb2518f272df8a601af72c13eabe2719dcb8.tar.zst
Shaarli-a39acb2518f272df8a601af72c13eabe2719dcb8.zip
Fix an issue with private tags and fix nomarkdown tag
The new bookmark service wasn't handling private tags properly. nomarkdown tag is now shown only for logged in user in bookmarks, and hidden for everyone in tag clouds/lists. Fixes #726
Diffstat (limited to 'application/formatter/FormatterFactory.php')
-rw-r--r--application/formatter/FormatterFactory.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/application/formatter/FormatterFactory.php b/application/formatter/FormatterFactory.php
index 0d2c0466..5f282f68 100644
--- a/application/formatter/FormatterFactory.php
+++ b/application/formatter/FormatterFactory.php
@@ -16,14 +16,19 @@ class FormatterFactory
16 /** @var ConfigManager instance */ 16 /** @var ConfigManager instance */
17 protected $conf; 17 protected $conf;
18 18
19 /** @var bool */
20 protected $isLoggedIn;
21
19 /** 22 /**
20 * FormatterFactory constructor. 23 * FormatterFactory constructor.
21 * 24 *
22 * @param ConfigManager $conf 25 * @param ConfigManager $conf
26 * @param bool $isLoggedIn
23 */ 27 */
24 public function __construct(ConfigManager $conf) 28 public function __construct(ConfigManager $conf, bool $isLoggedIn)
25 { 29 {
26 $this->conf = $conf; 30 $this->conf = $conf;
31 $this->isLoggedIn = $isLoggedIn;
27 } 32 }
28 33
29 /** 34 /**
@@ -33,7 +38,7 @@ class FormatterFactory
33 * 38 *
34 * @return BookmarkFormatter instance. 39 * @return BookmarkFormatter instance.
35 */ 40 */
36 public function getFormatter($type = null) 41 public function getFormatter(string $type = null)
37 { 42 {
38 $type = $type ? $type : $this->conf->get('formatter', 'default'); 43 $type = $type ? $type : $this->conf->get('formatter', 'default');
39 $className = '\\Shaarli\\Formatter\\Bookmark'. ucfirst($type) .'Formatter'; 44 $className = '\\Shaarli\\Formatter\\Bookmark'. ucfirst($type) .'Formatter';
@@ -41,6 +46,6 @@ class FormatterFactory
41 $className = '\\Shaarli\\Formatter\\BookmarkDefaultFormatter'; 46 $className = '\\Shaarli\\Formatter\\BookmarkDefaultFormatter';
42 } 47 }
43 48
44 return new $className($this->conf); 49 return new $className($this->conf, $this->isLoggedIn);
45 } 50 }
46} 51}