aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVirtualTam <virtualtam@flibidi.net>2018-12-04 00:02:17 +0100
committerVirtualTam <virtualtam@flibidi.net>2019-01-12 23:11:19 +0100
commita932f486f20f3daf8ad657d8d39a6d6c316e66eb (patch)
treee9aeeec1ac6ffc65b129cab2571b2be2ad7cef46
parent9778a1551ce708b9f421a181806412a05410f1fb (diff)
downloadShaarli-a932f486f20f3daf8ad657d8d39a6d6c316e66eb.tar.gz
Shaarli-a932f486f20f3daf8ad657d8d39a6d6c316e66eb.tar.zst
Shaarli-a932f486f20f3daf8ad657d8d39a6d6c316e66eb.zip
namespacing: \Shaarli\Router
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
-rw-r--r--application/Router.php43
-rw-r--r--index.php3
-rw-r--r--plugins/addlink_toolbar/addlink_toolbar.php2
-rw-r--r--plugins/demo_plugin/demo_plugin.php1
-rw-r--r--plugins/isso/isso.php1
-rw-r--r--plugins/markdown/markdown.php1
-rw-r--r--plugins/playvideos/playvideos.php2
-rw-r--r--plugins/pubsubhubbub/pubsubhubbub.php1
-rw-r--r--plugins/qrcode/qrcode.php2
-rw-r--r--tests/RouterTest.php9
-rw-r--r--tests/plugins/PluginAddlinkTest.php2
-rw-r--r--tests/plugins/PluginPlayvideosTest.php2
-rw-r--r--tests/plugins/PluginPubsubhubbubTest.php1
-rw-r--r--tests/plugins/PluginQrcodeTest.php2
14 files changed, 42 insertions, 30 deletions
diff --git a/application/Router.php b/application/Router.php
index beb3165b..05877acd 100644
--- a/application/Router.php
+++ b/application/Router.php
@@ -1,4 +1,5 @@
1<?php 1<?php
2namespace Shaarli;
2 3
3/** 4/**
4 * Class Router 5 * Class Router
@@ -75,43 +76,43 @@ class Router
75 return self::$PAGE_LINKLIST; 76 return self::$PAGE_LINKLIST;
76 } 77 }
77 78
78 if (startsWith($query, 'do='. self::$PAGE_LOGIN) && $loggedIn === false) { 79 if (startsWith($query, 'do=' . self::$PAGE_LOGIN) && $loggedIn === false) {
79 return self::$PAGE_LOGIN; 80 return self::$PAGE_LOGIN;
80 } 81 }
81 82
82 if (startsWith($query, 'do='. self::$PAGE_PICWALL)) { 83 if (startsWith($query, 'do=' . self::$PAGE_PICWALL)) {
83 return self::$PAGE_PICWALL; 84 return self::$PAGE_PICWALL;
84 } 85 }
85 86
86 if (startsWith($query, 'do='. self::$PAGE_TAGCLOUD)) { 87 if (startsWith($query, 'do=' . self::$PAGE_TAGCLOUD)) {
87 return self::$PAGE_TAGCLOUD; 88 return self::$PAGE_TAGCLOUD;
88 } 89 }
89 90
90 if (startsWith($query, 'do='. self::$PAGE_TAGLIST)) { 91 if (startsWith($query, 'do=' . self::$PAGE_TAGLIST)) {
91 return self::$PAGE_TAGLIST; 92 return self::$PAGE_TAGLIST;
92 } 93 }
93 94
94 if (startsWith($query, 'do='. self::$PAGE_OPENSEARCH)) { 95 if (startsWith($query, 'do=' . self::$PAGE_OPENSEARCH)) {
95 return self::$PAGE_OPENSEARCH; 96 return self::$PAGE_OPENSEARCH;
96 } 97 }
97 98
98 if (startsWith($query, 'do='. self::$PAGE_DAILY)) { 99 if (startsWith($query, 'do=' . self::$PAGE_DAILY)) {
99 return self::$PAGE_DAILY; 100 return self::$PAGE_DAILY;
100 } 101 }
101 102
102 if (startsWith($query, 'do='. self::$PAGE_FEED_ATOM)) { 103 if (startsWith($query, 'do=' . self::$PAGE_FEED_ATOM)) {
103 return self::$PAGE_FEED_ATOM; 104 return self::$PAGE_FEED_ATOM;
104 } 105 }
105 106
106 if (startsWith($query, 'do='. self::$PAGE_FEED_RSS)) { 107 if (startsWith($query, 'do=' . self::$PAGE_FEED_RSS)) {
107 return self::$PAGE_FEED_RSS; 108 return self::$PAGE_FEED_RSS;
108 } 109 }
109 110
110 if (startsWith($query, 'do='. self::$PAGE_THUMBS_UPDATE)) { 111 if (startsWith($query, 'do=' . self::$PAGE_THUMBS_UPDATE)) {
111 return self::$PAGE_THUMBS_UPDATE; 112 return self::$PAGE_THUMBS_UPDATE;
112 } 113 }
113 114
114 if (startsWith($query, 'do='. self::$AJAX_THUMB_UPDATE)) { 115 if (startsWith($query, 'do=' . self::$AJAX_THUMB_UPDATE)) {
115 return self::$AJAX_THUMB_UPDATE; 116 return self::$AJAX_THUMB_UPDATE;
116 } 117 }
117 118
@@ -120,23 +121,23 @@ class Router
120 return self::$PAGE_LINKLIST; 121 return self::$PAGE_LINKLIST;
121 } 122 }
122 123
123 if (startsWith($query, 'do='. self::$PAGE_TOOLS)) { 124 if (startsWith($query, 'do=' . self::$PAGE_TOOLS)) {
124 return self::$PAGE_TOOLS; 125 return self::$PAGE_TOOLS;
125 } 126 }
126 127
127 if (startsWith($query, 'do='. self::$PAGE_CHANGEPASSWORD)) { 128 if (startsWith($query, 'do=' . self::$PAGE_CHANGEPASSWORD)) {
128 return self::$PAGE_CHANGEPASSWORD; 129 return self::$PAGE_CHANGEPASSWORD;
129 } 130 }
130 131
131 if (startsWith($query, 'do='. self::$PAGE_CONFIGURE)) { 132 if (startsWith($query, 'do=' . self::$PAGE_CONFIGURE)) {
132 return self::$PAGE_CONFIGURE; 133 return self::$PAGE_CONFIGURE;
133 } 134 }
134 135
135 if (startsWith($query, 'do='. self::$PAGE_CHANGETAG)) { 136 if (startsWith($query, 'do=' . self::$PAGE_CHANGETAG)) {
136 return self::$PAGE_CHANGETAG; 137 return self::$PAGE_CHANGETAG;
137 } 138 }
138 139
139 if (startsWith($query, 'do='. self::$PAGE_ADDLINK)) { 140 if (startsWith($query, 'do=' . self::$PAGE_ADDLINK)) {
140 return self::$PAGE_ADDLINK; 141 return self::$PAGE_ADDLINK;
141 } 142 }
142 143
@@ -148,27 +149,27 @@ class Router
148 return self::$PAGE_DELETELINK; 149 return self::$PAGE_DELETELINK;
149 } 150 }
150 151
151 if (startsWith($query, 'do='. self::$PAGE_PINLINK)) { 152 if (startsWith($query, 'do=' . self::$PAGE_PINLINK)) {
152 return self::$PAGE_PINLINK; 153 return self::$PAGE_PINLINK;
153 } 154 }
154 155
155 if (startsWith($query, 'do='. self::$PAGE_EXPORT)) { 156 if (startsWith($query, 'do=' . self::$PAGE_EXPORT)) {
156 return self::$PAGE_EXPORT; 157 return self::$PAGE_EXPORT;
157 } 158 }
158 159
159 if (startsWith($query, 'do='. self::$PAGE_IMPORT)) { 160 if (startsWith($query, 'do=' . self::$PAGE_IMPORT)) {
160 return self::$PAGE_IMPORT; 161 return self::$PAGE_IMPORT;
161 } 162 }
162 163
163 if (startsWith($query, 'do='. self::$PAGE_PLUGINSADMIN)) { 164 if (startsWith($query, 'do=' . self::$PAGE_PLUGINSADMIN)) {
164 return self::$PAGE_PLUGINSADMIN; 165 return self::$PAGE_PLUGINSADMIN;
165 } 166 }
166 167
167 if (startsWith($query, 'do='. self::$PAGE_SAVE_PLUGINSADMIN)) { 168 if (startsWith($query, 'do=' . self::$PAGE_SAVE_PLUGINSADMIN)) {
168 return self::$PAGE_SAVE_PLUGINSADMIN; 169 return self::$PAGE_SAVE_PLUGINSADMIN;
169 } 170 }
170 171
171 if (startsWith($query, 'do='. self::$GET_TOKEN)) { 172 if (startsWith($query, 'do=' . self::$GET_TOKEN)) {
172 return self::$GET_TOKEN; 173 return self::$GET_TOKEN;
173 } 174 }
174 175
diff --git a/index.php b/index.php
index 3a7dab25..1dec569c 100644
--- a/index.php
+++ b/index.php
@@ -63,12 +63,10 @@ require_once 'application/http/HttpUtils.php';
63require_once 'application/http/UrlUtils.php'; 63require_once 'application/http/UrlUtils.php';
64require_once 'application/updater/UpdaterUtils.php'; 64require_once 'application/updater/UpdaterUtils.php';
65require_once 'application/FileUtils.php'; 65require_once 'application/FileUtils.php';
66require_once 'application/History.php';
67require_once 'application/NetscapeBookmarkUtils.php'; 66require_once 'application/NetscapeBookmarkUtils.php';
68require_once 'application/TimeZone.php'; 67require_once 'application/TimeZone.php';
69require_once 'application/Utils.php'; 68require_once 'application/Utils.php';
70require_once 'application/PluginManager.php'; 69require_once 'application/PluginManager.php';
71require_once 'application/Router.php';
72 70
73use \Shaarli\ApplicationUtils; 71use \Shaarli\ApplicationUtils;
74use \Shaarli\Bookmark\Exception\LinkNotFoundException; 72use \Shaarli\Bookmark\Exception\LinkNotFoundException;
@@ -80,6 +78,7 @@ use \Shaarli\History;
80use \Shaarli\Languages; 78use \Shaarli\Languages;
81use \Shaarli\Render\PageBuilder; 79use \Shaarli\Render\PageBuilder;
82use \Shaarli\Render\ThemeUtils; 80use \Shaarli\Render\ThemeUtils;
81use \Shaarli\Router;
83use \Shaarli\Security\LoginManager; 82use \Shaarli\Security\LoginManager;
84use \Shaarli\Security\SessionManager; 83use \Shaarli\Security\SessionManager;
85use \Shaarli\Thumbnailer; 84use \Shaarli\Thumbnailer;
diff --git a/plugins/addlink_toolbar/addlink_toolbar.php b/plugins/addlink_toolbar/addlink_toolbar.php
index 8c05a231..8bf4ed46 100644
--- a/plugins/addlink_toolbar/addlink_toolbar.php
+++ b/plugins/addlink_toolbar/addlink_toolbar.php
@@ -5,6 +5,8 @@
5 * Adds the addlink input on the linklist page. 5 * Adds the addlink input on the linklist page.
6 */ 6 */
7 7
8use Shaarli\Router;
9
8/** 10/**
9 * When linklist is displayed, add play videos to header's toolbar. 11 * When linklist is displayed, add play videos to header's toolbar.
10 * 12 *
diff --git a/plugins/demo_plugin/demo_plugin.php b/plugins/demo_plugin/demo_plugin.php
index ca520d15..94ce38f8 100644
--- a/plugins/demo_plugin/demo_plugin.php
+++ b/plugins/demo_plugin/demo_plugin.php
@@ -15,6 +15,7 @@
15 */ 15 */
16 16
17use Shaarli\Config\ConfigManager; 17use Shaarli\Config\ConfigManager;
18use Shaarli\Router;
18 19
19/** 20/**
20 * In the footer hook, there is a working example of a translation extension for Shaarli. 21 * In the footer hook, there is a working example of a translation extension for Shaarli.
diff --git a/plugins/isso/isso.php b/plugins/isso/isso.php
index 378c11af..9bdd5909 100644
--- a/plugins/isso/isso.php
+++ b/plugins/isso/isso.php
@@ -5,6 +5,7 @@
5 */ 5 */
6 6
7use Shaarli\Config\ConfigManager; 7use Shaarli\Config\ConfigManager;
8use Shaarli\Router;
8 9
9/** 10/**
10 * Display an error everywhere if the plugin is enabled without configuration. 11 * Display an error everywhere if the plugin is enabled without configuration.
diff --git a/plugins/markdown/markdown.php b/plugins/markdown/markdown.php
index 8823af91..9928a488 100644
--- a/plugins/markdown/markdown.php
+++ b/plugins/markdown/markdown.php
@@ -7,6 +7,7 @@
7 */ 7 */
8 8
9use Shaarli\Config\ConfigManager; 9use Shaarli\Config\ConfigManager;
10use Shaarli\Router;
10 11
11/* 12/*
12 * If this tag is used on a shaare, the description won't be processed by Parsedown. 13 * If this tag is used on a shaare, the description won't be processed by Parsedown.
diff --git a/plugins/playvideos/playvideos.php b/plugins/playvideos/playvideos.php
index c6d6b0cc..bb5b9e98 100644
--- a/plugins/playvideos/playvideos.php
+++ b/plugins/playvideos/playvideos.php
@@ -6,6 +6,8 @@
6 * Note: this plugin adds jQuery. 6 * Note: this plugin adds jQuery.
7 */ 7 */
8 8
9use Shaarli\Router;
10
9/** 11/**
10 * When linklist is displayed, add play videos to header's toolbar. 12 * When linklist is displayed, add play videos to header's toolbar.
11 * 13 *
diff --git a/plugins/pubsubhubbub/pubsubhubbub.php b/plugins/pubsubhubbub/pubsubhubbub.php
index 1872af8a..a7bd34c1 100644
--- a/plugins/pubsubhubbub/pubsubhubbub.php
+++ b/plugins/pubsubhubbub/pubsubhubbub.php
@@ -12,6 +12,7 @@
12use pubsubhubbub\publisher\Publisher; 12use pubsubhubbub\publisher\Publisher;
13use Shaarli\Config\ConfigManager; 13use Shaarli\Config\ConfigManager;
14use Shaarli\Feed\FeedBuilder; 14use Shaarli\Feed\FeedBuilder;
15use Shaarli\Router;
15 16
16/** 17/**
17 * Plugin init function - set the hub to the default appspot one. 18 * Plugin init function - set the hub to the default appspot one.
diff --git a/plugins/qrcode/qrcode.php b/plugins/qrcode/qrcode.php
index 4b59caa0..21908cee 100644
--- a/plugins/qrcode/qrcode.php
+++ b/plugins/qrcode/qrcode.php
@@ -5,6 +5,8 @@
5 * Display a QRCode icon in link list. 5 * Display a QRCode icon in link list.
6 */ 6 */
7 7
8use Shaarli\Router;
9
8/** 10/**
9 * Add qrcode icon to link_plugin when rendering linklist. 11 * Add qrcode icon to link_plugin when rendering linklist.
10 * 12 *
diff --git a/tests/RouterTest.php b/tests/RouterTest.php
index abf1bd5f..0cd49bb8 100644
--- a/tests/RouterTest.php
+++ b/tests/RouterTest.php
@@ -1,15 +1,10 @@
1<?php 1<?php
2 2namespace Shaarli;
3/**
4 * Router tests
5 */
6
7require_once 'application/Router.php';
8 3
9/** 4/**
10 * Unit tests for Router 5 * Unit tests for Router
11 */ 6 */
12class RouterTest extends PHPUnit_Framework_TestCase 7class RouterTest extends \PHPUnit\Framework\TestCase
13{ 8{
14 /** 9 /**
15 * Test findPage: login page output. 10 * Test findPage: login page output.
diff --git a/tests/plugins/PluginAddlinkTest.php b/tests/plugins/PluginAddlinkTest.php
index b6239e7f..f6fea7af 100644
--- a/tests/plugins/PluginAddlinkTest.php
+++ b/tests/plugins/PluginAddlinkTest.php
@@ -4,6 +4,8 @@
4 * PluginPlayvideosTest.php 4 * PluginPlayvideosTest.php
5 */ 5 */
6 6
7use Shaarli\Router;
8
7require_once 'plugins/addlink_toolbar/addlink_toolbar.php'; 9require_once 'plugins/addlink_toolbar/addlink_toolbar.php';
8require_once 'application/Router.php'; 10require_once 'application/Router.php';
9 11
diff --git a/tests/plugins/PluginPlayvideosTest.php b/tests/plugins/PluginPlayvideosTest.php
index 29ad047f..7ee92400 100644
--- a/tests/plugins/PluginPlayvideosTest.php
+++ b/tests/plugins/PluginPlayvideosTest.php
@@ -4,6 +4,8 @@
4 * PluginPlayvideosTest.php 4 * PluginPlayvideosTest.php
5 */ 5 */
6 6
7use Shaarli\Router;
8
7require_once 'plugins/playvideos/playvideos.php'; 9require_once 'plugins/playvideos/playvideos.php';
8require_once 'application/Router.php'; 10require_once 'application/Router.php';
9 11
diff --git a/tests/plugins/PluginPubsubhubbubTest.php b/tests/plugins/PluginPubsubhubbubTest.php
index 69d00936..75f146f2 100644
--- a/tests/plugins/PluginPubsubhubbubTest.php
+++ b/tests/plugins/PluginPubsubhubbubTest.php
@@ -1,5 +1,6 @@
1<?php 1<?php
2use Shaarli\Config\ConfigManager; 2use Shaarli\Config\ConfigManager;
3use Shaarli\Router;
3 4
4require_once 'plugins/pubsubhubbub/pubsubhubbub.php'; 5require_once 'plugins/pubsubhubbub/pubsubhubbub.php';
5require_once 'application/Router.php'; 6require_once 'application/Router.php';
diff --git a/tests/plugins/PluginQrcodeTest.php b/tests/plugins/PluginQrcodeTest.php
index dd632eee..419965eb 100644
--- a/tests/plugins/PluginQrcodeTest.php
+++ b/tests/plugins/PluginQrcodeTest.php
@@ -3,6 +3,8 @@
3 * PluginQrcodeTest.php 3 * PluginQrcodeTest.php
4 */ 4 */
5 5
6use Shaarli\Router;
7
6require_once 'plugins/qrcode/qrcode.php'; 8require_once 'plugins/qrcode/qrcode.php';
7require_once 'application/Router.php'; 9require_once 'application/Router.php';
8 10