aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVirtualTam <virtualtam@flibidi.net>2018-12-03 00:46:04 +0100
committerVirtualTam <virtualtam@flibidi.net>2019-01-12 22:47:48 +0100
commit8c0f19c7971e1a4534347ce9d6d82a0a45799711 (patch)
tree51cc8c616b9614bf81c011161908319634a82b47
parent51753e403fa69c0ce124ede27d300477e3e799ca (diff)
downloadShaarli-8c0f19c7971e1a4534347ce9d6d82a0a45799711.tar.gz
Shaarli-8c0f19c7971e1a4534347ce9d6d82a0a45799711.tar.zst
Shaarli-8c0f19c7971e1a4534347ce9d6d82a0a45799711.zip
namespacing: \Shaarli\Render\{PageBuilder,ThemeUtils}
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
-rw-r--r--application/render/PageBuilder.php (renamed from application/PageBuilder.php)20
-rw-r--r--application/render/ThemeUtils.php (renamed from application/ThemeUtils.php)2
-rw-r--r--composer.json1
-rw-r--r--index.php4
-rw-r--r--tests/render/ThemeUtilsTest.php (renamed from tests/ThemeUtilsTest.php)2
5 files changed, 19 insertions, 10 deletions
diff --git a/application/PageBuilder.php b/application/render/PageBuilder.php
index 2ca95832..1df95bfb 100644
--- a/application/PageBuilder.php
+++ b/application/render/PageBuilder.php
@@ -1,5 +1,11 @@
1<?php 1<?php
2 2
3namespace Shaarli\Render;
4
5use ApplicationUtils;
6use Exception;
7use LinkDB;
8use RainTPL;
3use Shaarli\Config\ConfigManager; 9use Shaarli\Config\ConfigManager;
4use Shaarli\Thumbnailer; 10use Shaarli\Thumbnailer;
5 11
@@ -37,7 +43,9 @@ class PageBuilder
37 */ 43 */
38 protected $token; 44 protected $token;
39 45
40 /** @var bool $isLoggedIn Whether the user is logged in **/ 46 /**
47 * @var bool $isLoggedIn Whether the user is logged in
48 */
41 protected $isLoggedIn = false; 49 protected $isLoggedIn = false;
42 50
43 /** 51 /**
@@ -101,7 +109,7 @@ class PageBuilder
101 ApplicationUtils::getVersionHash(SHAARLI_VERSION, $this->conf->get('credentials.salt')) 109 ApplicationUtils::getVersionHash(SHAARLI_VERSION, $this->conf->get('credentials.salt'))
102 ); 110 );
103 $this->tpl->assign('index_url', index_url($_SERVER)); 111 $this->tpl->assign('index_url', index_url($_SERVER));
104 $visibility = ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : ''; 112 $visibility = !empty($_SESSION['visibility']) ? $_SESSION['visibility'] : '';
105 $this->tpl->assign('visibility', $visibility); 113 $this->tpl->assign('visibility', $visibility);
106 $this->tpl->assign('untaggedonly', !empty($_SESSION['untaggedonly'])); 114 $this->tpl->assign('untaggedonly', !empty($_SESSION['untaggedonly']));
107 $this->tpl->assign('pagetitle', $this->conf->get('general.title', 'Shaarli')); 115 $this->tpl->assign('pagetitle', $this->conf->get('general.title', 'Shaarli'));
@@ -126,7 +134,7 @@ class PageBuilder
126 $this->tpl->assign('thumbnails_width', $this->conf->get('thumbnails.width')); 134 $this->tpl->assign('thumbnails_width', $this->conf->get('thumbnails.width'));
127 $this->tpl->assign('thumbnails_height', $this->conf->get('thumbnails.height')); 135 $this->tpl->assign('thumbnails_height', $this->conf->get('thumbnails.height'));
128 136
129 if (! empty($_SESSION['warnings'])) { 137 if (!empty($_SESSION['warnings'])) {
130 $this->tpl->assign('global_warnings', $_SESSION['warnings']); 138 $this->tpl->assign('global_warnings', $_SESSION['warnings']);
131 unset($_SESSION['warnings']); 139 unset($_SESSION['warnings']);
132 } 140 }
@@ -189,16 +197,16 @@ class PageBuilder
189 197
190 /** 198 /**
191 * Render a 404 page (uses the template : tpl/404.tpl) 199 * Render a 404 page (uses the template : tpl/404.tpl)
192 * usage : $PAGE->render404('The link was deleted') 200 * usage: $PAGE->render404('The link was deleted')
193 * 201 *
194 * @param string $message A messate to display what is not found 202 * @param string $message A message to display what is not found
195 */ 203 */
196 public function render404($message = '') 204 public function render404($message = '')
197 { 205 {
198 if (empty($message)) { 206 if (empty($message)) {
199 $message = t('The page you are trying to reach does not exist or has been deleted.'); 207 $message = t('The page you are trying to reach does not exist or has been deleted.');
200 } 208 }
201 header($_SERVER['SERVER_PROTOCOL'] .' '. t('404 Not Found')); 209 header($_SERVER['SERVER_PROTOCOL'] . ' ' . t('404 Not Found'));
202 $this->tpl->assign('error_message', $message); 210 $this->tpl->assign('error_message', $message);
203 $this->renderPage('404'); 211 $this->renderPage('404');
204 } 212 }
diff --git a/application/ThemeUtils.php b/application/render/ThemeUtils.php
index 16f2f6a2..86096c64 100644
--- a/application/ThemeUtils.php
+++ b/application/render/ThemeUtils.php
@@ -1,6 +1,6 @@
1<?php 1<?php
2 2
3namespace Shaarli; 3namespace Shaarli\Render;
4 4
5/** 5/**
6 * Class ThemeUtils 6 * Class ThemeUtils
diff --git a/composer.json b/composer.json
index 8a3d1636..28b0adb5 100644
--- a/composer.json
+++ b/composer.json
@@ -39,6 +39,7 @@
39 "Shaarli\\Exceptions\\": "application/exceptions", 39 "Shaarli\\Exceptions\\": "application/exceptions",
40 "Shaarli\\Feed\\": "application/feed", 40 "Shaarli\\Feed\\": "application/feed",
41 "Shaarli\\Http\\": "application/http", 41 "Shaarli\\Http\\": "application/http",
42 "Shaarli\\Render\\": "application/render",
42 "Shaarli\\Security\\": "application/security" 43 "Shaarli\\Security\\": "application/security"
43 } 44 }
44 } 45 }
diff --git a/index.php b/index.php
index 66fe30f1..719b622c 100644
--- a/index.php
+++ b/index.php
@@ -67,7 +67,6 @@ require_once 'application/LinkDB.php';
67require_once 'application/LinkFilter.php'; 67require_once 'application/LinkFilter.php';
68require_once 'application/LinkUtils.php'; 68require_once 'application/LinkUtils.php';
69require_once 'application/NetscapeBookmarkUtils.php'; 69require_once 'application/NetscapeBookmarkUtils.php';
70require_once 'application/PageBuilder.php';
71require_once 'application/TimeZone.php'; 70require_once 'application/TimeZone.php';
72require_once 'application/Utils.php'; 71require_once 'application/Utils.php';
73require_once 'application/PluginManager.php'; 72require_once 'application/PluginManager.php';
@@ -78,9 +77,10 @@ use \Shaarli\Feed\CachedPage;
78use \Shaarli\Feed\FeedBuilder; 77use \Shaarli\Feed\FeedBuilder;
79use \Shaarli\History; 78use \Shaarli\History;
80use \Shaarli\Languages; 79use \Shaarli\Languages;
80use \Shaarli\Render\PageBuilder;
81use \Shaarli\Render\ThemeUtils;
81use \Shaarli\Security\LoginManager; 82use \Shaarli\Security\LoginManager;
82use \Shaarli\Security\SessionManager; 83use \Shaarli\Security\SessionManager;
83use \Shaarli\ThemeUtils;
84use \Shaarli\Thumbnailer; 84use \Shaarli\Thumbnailer;
85 85
86// Ensure the PHP version is supported 86// Ensure the PHP version is supported
diff --git a/tests/ThemeUtilsTest.php b/tests/render/ThemeUtilsTest.php
index e44564be..6159a1bd 100644
--- a/tests/ThemeUtilsTest.php
+++ b/tests/render/ThemeUtilsTest.php
@@ -1,6 +1,6 @@
1<?php 1<?php
2 2
3namespace Shaarli; 3namespace Shaarli\Render;
4 4
5/** 5/**
6 * Class ThemeUtilsTest 6 * Class ThemeUtilsTest