]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
namespacing: \Shaarli\Render\{PageBuilder,ThemeUtils}
authorVirtualTam <virtualtam@flibidi.net>
Sun, 2 Dec 2018 23:46:04 +0000 (00:46 +0100)
committerVirtualTam <virtualtam@flibidi.net>
Sat, 12 Jan 2019 21:47:48 +0000 (22:47 +0100)
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
application/render/PageBuilder.php [moved from application/PageBuilder.php with 93% similarity]
application/render/ThemeUtils.php [moved from application/ThemeUtils.php with 96% similarity]
composer.json
index.php
tests/render/ThemeUtilsTest.php [moved from tests/ThemeUtilsTest.php with 98% similarity]

similarity index 93%
rename from application/PageBuilder.php
rename to application/render/PageBuilder.php
index 2ca95832c60eef3c234b85c3d7a102af1cf7eafa..1df95bfb60d243d989debc0523546c4e8c79eab4 100644 (file)
@@ -1,5 +1,11 @@
 <?php
 
+namespace Shaarli\Render;
+
+use ApplicationUtils;
+use Exception;
+use LinkDB;
+use RainTPL;
 use Shaarli\Config\ConfigManager;
 use Shaarli\Thumbnailer;
 
@@ -37,7 +43,9 @@ class PageBuilder
      */
     protected $token;
 
-    /** @var bool $isLoggedIn Whether the user is logged in **/
+    /**
+     * @var bool $isLoggedIn Whether the user is logged in
+     */
     protected $isLoggedIn = false;
 
     /**
@@ -101,7 +109,7 @@ class PageBuilder
             ApplicationUtils::getVersionHash(SHAARLI_VERSION, $this->conf->get('credentials.salt'))
         );
         $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('untaggedonly', !empty($_SESSION['untaggedonly']));
         $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_height', $this->conf->get('thumbnails.height'));
 
-        if (! empty($_SESSION['warnings'])) {
+        if (!empty($_SESSION['warnings'])) {
             $this->tpl->assign('global_warnings', $_SESSION['warnings']);
             unset($_SESSION['warnings']);
         }
@@ -189,16 +197,16 @@ class PageBuilder
 
     /**
      * 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 = '')
     {
         if (empty($message)) {
             $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->renderPage('404');
     }
similarity index 96%
rename from application/ThemeUtils.php
rename to application/render/ThemeUtils.php
index 16f2f6a2742c701f79d671bcf4d89359584fc4d9..86096c64476bf655626633efb692b0a9b352eacc 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Shaarli;
+namespace Shaarli\Render;
 
 /**
  * Class ThemeUtils
index 8a3d1636e3b1cd9581ad177f92f3227a2d475642..28b0adb510f183504fdc3ae3a65ecaa7dccac9cc 100644 (file)
@@ -39,6 +39,7 @@
             "Shaarli\\Exceptions\\": "application/exceptions",
             "Shaarli\\Feed\\": "application/feed",
             "Shaarli\\Http\\": "application/http",
+            "Shaarli\\Render\\": "application/render",
             "Shaarli\\Security\\": "application/security"
         }
     }
index 66fe30f1921ed3fdb842c275c85d04e42cf4a74c..719b622cd90ece5a89f33fc8796b29fc6d877c68 100644 (file)
--- a/index.php
+++ b/index.php
@@ -67,7 +67,6 @@ require_once 'application/LinkDB.php';
 require_once 'application/LinkFilter.php';
 require_once 'application/LinkUtils.php';
 require_once 'application/NetscapeBookmarkUtils.php';
-require_once 'application/PageBuilder.php';
 require_once 'application/TimeZone.php';
 require_once 'application/Utils.php';
 require_once 'application/PluginManager.php';
@@ -78,9 +77,10 @@ use \Shaarli\Feed\CachedPage;
 use \Shaarli\Feed\FeedBuilder;
 use \Shaarli\History;
 use \Shaarli\Languages;
+use \Shaarli\Render\PageBuilder;
+use \Shaarli\Render\ThemeUtils;
 use \Shaarli\Security\LoginManager;
 use \Shaarli\Security\SessionManager;
-use \Shaarli\ThemeUtils;
 use \Shaarli\Thumbnailer;
 
 // Ensure the PHP version is supported
similarity index 98%
rename from tests/ThemeUtilsTest.php
rename to tests/render/ThemeUtilsTest.php
index e44564be3e398bc2e265a5f8cf7cbc089e31652e..6159a1bdaca24c43b5f98fcf60a92edf51e738c8 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Shaarli;
+namespace Shaarli\Render;
 
 /**
  * Class ThemeUtilsTest