diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-01-18 10:01:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-18 10:01:06 +0100 |
commit | 3fb29fdda04ca86e04422d49b86cf646d53c4f9d (patch) | |
tree | adf8512f93f5559ba87d0c9931969ae4ebea7133 /application/render/PageBuilder.php | |
parent | 796c4c57d085ae4589b53dfe8369ae9ba30ffdaf (diff) | |
parent | e26e2060f5470ce8bf4c5973284bae07b8af170a (diff) | |
download | Shaarli-3fb29fdda04ca86e04422d49b86cf646d53c4f9d.tar.gz Shaarli-3fb29fdda04ca86e04422d49b86cf646d53c4f9d.tar.zst Shaarli-3fb29fdda04ca86e04422d49b86cf646d53c4f9d.zip |
Store bookmarks as PHP objects and add a service layer to retriā¦ (#1307)
Store bookmarks as PHP objects and add a service layer to retrieve them
Diffstat (limited to 'application/render/PageBuilder.php')
-rw-r--r-- | application/render/PageBuilder.php | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/application/render/PageBuilder.php b/application/render/PageBuilder.php index 3f86fc26..65e85aaf 100644 --- a/application/render/PageBuilder.php +++ b/application/render/PageBuilder.php | |||
@@ -5,7 +5,7 @@ namespace Shaarli\Render; | |||
5 | use Exception; | 5 | use Exception; |
6 | use RainTPL; | 6 | use RainTPL; |
7 | use Shaarli\ApplicationUtils; | 7 | use Shaarli\ApplicationUtils; |
8 | use Shaarli\Bookmark\LinkDB; | 8 | use Shaarli\Bookmark\BookmarkServiceInterface; |
9 | use Shaarli\Config\ConfigManager; | 9 | use Shaarli\Config\ConfigManager; |
10 | use Shaarli\Thumbnailer; | 10 | use Shaarli\Thumbnailer; |
11 | 11 | ||
@@ -34,9 +34,9 @@ class PageBuilder | |||
34 | protected $session; | 34 | protected $session; |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * @var LinkDB $linkDB instance. | 37 | * @var BookmarkServiceInterface $bookmarkService instance. |
38 | */ | 38 | */ |
39 | protected $linkDB; | 39 | protected $bookmarkService; |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * @var null|string XSRF token | 42 | * @var null|string XSRF token |
@@ -52,18 +52,18 @@ class PageBuilder | |||
52 | * PageBuilder constructor. | 52 | * PageBuilder constructor. |
53 | * $tpl is initialized at false for lazy loading. | 53 | * $tpl is initialized at false for lazy loading. |
54 | * | 54 | * |
55 | * @param ConfigManager $conf Configuration Manager instance (reference). | 55 | * @param ConfigManager $conf Configuration Manager instance (reference). |
56 | * @param array $session $_SESSION array | 56 | * @param array $session $_SESSION array |
57 | * @param LinkDB $linkDB instance. | 57 | * @param BookmarkServiceInterface $linkDB instance. |
58 | * @param string $token Session token | 58 | * @param string $token Session token |
59 | * @param bool $isLoggedIn | 59 | * @param bool $isLoggedIn |
60 | */ | 60 | */ |
61 | public function __construct(&$conf, $session, $linkDB = null, $token = null, $isLoggedIn = false) | 61 | public function __construct(&$conf, $session, $linkDB = null, $token = null, $isLoggedIn = false) |
62 | { | 62 | { |
63 | $this->tpl = false; | 63 | $this->tpl = false; |
64 | $this->conf = $conf; | 64 | $this->conf = $conf; |
65 | $this->session = $session; | 65 | $this->session = $session; |
66 | $this->linkDB = $linkDB; | 66 | $this->bookmarkService = $linkDB; |
67 | $this->token = $token; | 67 | $this->token = $token; |
68 | $this->isLoggedIn = $isLoggedIn; | 68 | $this->isLoggedIn = $isLoggedIn; |
69 | } | 69 | } |
@@ -125,8 +125,8 @@ class PageBuilder | |||
125 | 125 | ||
126 | $this->tpl->assign('language', $this->conf->get('translation.language')); | 126 | $this->tpl->assign('language', $this->conf->get('translation.language')); |
127 | 127 | ||
128 | if ($this->linkDB !== null) { | 128 | if ($this->bookmarkService !== null) { |
129 | $this->tpl->assign('tags', $this->linkDB->linksCountPerTag()); | 129 | $this->tpl->assign('tags', $this->bookmarkService->bookmarksCountPerTag()); |
130 | } | 130 | } |
131 | 131 | ||
132 | $this->tpl->assign( | 132 | $this->tpl->assign( |
@@ -141,6 +141,8 @@ class PageBuilder | |||
141 | unset($_SESSION['warnings']); | 141 | unset($_SESSION['warnings']); |
142 | } | 142 | } |
143 | 143 | ||
144 | $this->tpl->assign('formatter', $this->conf->get('formatter', 'default')); | ||
145 | |||
144 | // To be removed with a proper theme configuration. | 146 | // To be removed with a proper theme configuration. |
145 | $this->tpl->assign('conf', $this->conf); | 147 | $this->tpl->assign('conf', $this->conf); |
146 | } | 148 | } |