namespacing: \Shaarli\Render\{PageBuilder,ThemeUtils}

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
This commit is contained in:
VirtualTam 2018-12-03 00:46:04 +01:00
parent 51753e403f
commit 8c0f19c797
5 changed files with 19 additions and 10 deletions

View File

@ -1,5 +1,11 @@
<?php <?php
namespace Shaarli\Render;
use ApplicationUtils;
use Exception;
use LinkDB;
use RainTPL;
use Shaarli\Config\ConfigManager; use Shaarli\Config\ConfigManager;
use Shaarli\Thumbnailer; use Shaarli\Thumbnailer;
@ -37,7 +43,9 @@ class PageBuilder
*/ */
protected $token; protected $token;
/** @var bool $isLoggedIn Whether the user is logged in **/ /**
* @var bool $isLoggedIn Whether the user is logged in
*/
protected $isLoggedIn = false; protected $isLoggedIn = false;
/** /**
@ -101,7 +109,7 @@ class PageBuilder
ApplicationUtils::getVersionHash(SHAARLI_VERSION, $this->conf->get('credentials.salt')) ApplicationUtils::getVersionHash(SHAARLI_VERSION, $this->conf->get('credentials.salt'))
); );
$this->tpl->assign('index_url', index_url($_SERVER)); $this->tpl->assign('index_url', index_url($_SERVER));
$visibility = ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : ''; $visibility = !empty($_SESSION['visibility']) ? $_SESSION['visibility'] : '';
$this->tpl->assign('visibility', $visibility); $this->tpl->assign('visibility', $visibility);
$this->tpl->assign('untaggedonly', !empty($_SESSION['untaggedonly'])); $this->tpl->assign('untaggedonly', !empty($_SESSION['untaggedonly']));
$this->tpl->assign('pagetitle', $this->conf->get('general.title', 'Shaarli')); $this->tpl->assign('pagetitle', $this->conf->get('general.title', 'Shaarli'));
@ -126,7 +134,7 @@ class PageBuilder
$this->tpl->assign('thumbnails_width', $this->conf->get('thumbnails.width')); $this->tpl->assign('thumbnails_width', $this->conf->get('thumbnails.width'));
$this->tpl->assign('thumbnails_height', $this->conf->get('thumbnails.height')); $this->tpl->assign('thumbnails_height', $this->conf->get('thumbnails.height'));
if (! empty($_SESSION['warnings'])) { if (!empty($_SESSION['warnings'])) {
$this->tpl->assign('global_warnings', $_SESSION['warnings']); $this->tpl->assign('global_warnings', $_SESSION['warnings']);
unset($_SESSION['warnings']); unset($_SESSION['warnings']);
} }
@ -189,16 +197,16 @@ class PageBuilder
/** /**
* Render a 404 page (uses the template : tpl/404.tpl) * Render a 404 page (uses the template : tpl/404.tpl)
* usage : $PAGE->render404('The link was deleted') * usage: $PAGE->render404('The link was deleted')
* *
* @param string $message A messate to display what is not found * @param string $message A message to display what is not found
*/ */
public function render404($message = '') public function render404($message = '')
{ {
if (empty($message)) { if (empty($message)) {
$message = t('The page you are trying to reach does not exist or has been deleted.'); $message = t('The page you are trying to reach does not exist or has been deleted.');
} }
header($_SERVER['SERVER_PROTOCOL'] .' '. t('404 Not Found')); header($_SERVER['SERVER_PROTOCOL'] . ' ' . t('404 Not Found'));
$this->tpl->assign('error_message', $message); $this->tpl->assign('error_message', $message);
$this->renderPage('404'); $this->renderPage('404');
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Shaarli; namespace Shaarli\Render;
/** /**
* Class ThemeUtils * Class ThemeUtils

View File

@ -39,6 +39,7 @@
"Shaarli\\Exceptions\\": "application/exceptions", "Shaarli\\Exceptions\\": "application/exceptions",
"Shaarli\\Feed\\": "application/feed", "Shaarli\\Feed\\": "application/feed",
"Shaarli\\Http\\": "application/http", "Shaarli\\Http\\": "application/http",
"Shaarli\\Render\\": "application/render",
"Shaarli\\Security\\": "application/security" "Shaarli\\Security\\": "application/security"
} }
} }

View File

@ -67,7 +67,6 @@ require_once 'application/LinkDB.php';
require_once 'application/LinkFilter.php'; require_once 'application/LinkFilter.php';
require_once 'application/LinkUtils.php'; require_once 'application/LinkUtils.php';
require_once 'application/NetscapeBookmarkUtils.php'; require_once 'application/NetscapeBookmarkUtils.php';
require_once 'application/PageBuilder.php';
require_once 'application/TimeZone.php'; require_once 'application/TimeZone.php';
require_once 'application/Utils.php'; require_once 'application/Utils.php';
require_once 'application/PluginManager.php'; require_once 'application/PluginManager.php';
@ -78,9 +77,10 @@ use \Shaarli\Feed\CachedPage;
use \Shaarli\Feed\FeedBuilder; use \Shaarli\Feed\FeedBuilder;
use \Shaarli\History; use \Shaarli\History;
use \Shaarli\Languages; use \Shaarli\Languages;
use \Shaarli\Render\PageBuilder;
use \Shaarli\Render\ThemeUtils;
use \Shaarli\Security\LoginManager; use \Shaarli\Security\LoginManager;
use \Shaarli\Security\SessionManager; use \Shaarli\Security\SessionManager;
use \Shaarli\ThemeUtils;
use \Shaarli\Thumbnailer; use \Shaarli\Thumbnailer;
// Ensure the PHP version is supported // Ensure the PHP version is supported

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Shaarli; namespace Shaarli\Render;
/** /**
* Class ThemeUtilsTest * Class ThemeUtilsTest