namespacing: \Shaarli\Router
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
This commit is contained in:
parent
9778a1551c
commit
a932f486f2
14 changed files with 42 additions and 30 deletions
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
namespace Shaarli;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Router
|
* Class Router
|
||||||
|
@ -75,43 +76,43 @@ public static function findPage($query, $get, $loggedIn)
|
||||||
return self::$PAGE_LINKLIST;
|
return self::$PAGE_LINKLIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startsWith($query, 'do='. self::$PAGE_LOGIN) && $loggedIn === false) {
|
if (startsWith($query, 'do=' . self::$PAGE_LOGIN) && $loggedIn === false) {
|
||||||
return self::$PAGE_LOGIN;
|
return self::$PAGE_LOGIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startsWith($query, 'do='. self::$PAGE_PICWALL)) {
|
if (startsWith($query, 'do=' . self::$PAGE_PICWALL)) {
|
||||||
return self::$PAGE_PICWALL;
|
return self::$PAGE_PICWALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startsWith($query, 'do='. self::$PAGE_TAGCLOUD)) {
|
if (startsWith($query, 'do=' . self::$PAGE_TAGCLOUD)) {
|
||||||
return self::$PAGE_TAGCLOUD;
|
return self::$PAGE_TAGCLOUD;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startsWith($query, 'do='. self::$PAGE_TAGLIST)) {
|
if (startsWith($query, 'do=' . self::$PAGE_TAGLIST)) {
|
||||||
return self::$PAGE_TAGLIST;
|
return self::$PAGE_TAGLIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startsWith($query, 'do='. self::$PAGE_OPENSEARCH)) {
|
if (startsWith($query, 'do=' . self::$PAGE_OPENSEARCH)) {
|
||||||
return self::$PAGE_OPENSEARCH;
|
return self::$PAGE_OPENSEARCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startsWith($query, 'do='. self::$PAGE_DAILY)) {
|
if (startsWith($query, 'do=' . self::$PAGE_DAILY)) {
|
||||||
return self::$PAGE_DAILY;
|
return self::$PAGE_DAILY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startsWith($query, 'do='. self::$PAGE_FEED_ATOM)) {
|
if (startsWith($query, 'do=' . self::$PAGE_FEED_ATOM)) {
|
||||||
return self::$PAGE_FEED_ATOM;
|
return self::$PAGE_FEED_ATOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startsWith($query, 'do='. self::$PAGE_FEED_RSS)) {
|
if (startsWith($query, 'do=' . self::$PAGE_FEED_RSS)) {
|
||||||
return self::$PAGE_FEED_RSS;
|
return self::$PAGE_FEED_RSS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startsWith($query, 'do='. self::$PAGE_THUMBS_UPDATE)) {
|
if (startsWith($query, 'do=' . self::$PAGE_THUMBS_UPDATE)) {
|
||||||
return self::$PAGE_THUMBS_UPDATE;
|
return self::$PAGE_THUMBS_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startsWith($query, 'do='. self::$AJAX_THUMB_UPDATE)) {
|
if (startsWith($query, 'do=' . self::$AJAX_THUMB_UPDATE)) {
|
||||||
return self::$AJAX_THUMB_UPDATE;
|
return self::$AJAX_THUMB_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,23 +121,23 @@ public static function findPage($query, $get, $loggedIn)
|
||||||
return self::$PAGE_LINKLIST;
|
return self::$PAGE_LINKLIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startsWith($query, 'do='. self::$PAGE_TOOLS)) {
|
if (startsWith($query, 'do=' . self::$PAGE_TOOLS)) {
|
||||||
return self::$PAGE_TOOLS;
|
return self::$PAGE_TOOLS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startsWith($query, 'do='. self::$PAGE_CHANGEPASSWORD)) {
|
if (startsWith($query, 'do=' . self::$PAGE_CHANGEPASSWORD)) {
|
||||||
return self::$PAGE_CHANGEPASSWORD;
|
return self::$PAGE_CHANGEPASSWORD;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startsWith($query, 'do='. self::$PAGE_CONFIGURE)) {
|
if (startsWith($query, 'do=' . self::$PAGE_CONFIGURE)) {
|
||||||
return self::$PAGE_CONFIGURE;
|
return self::$PAGE_CONFIGURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startsWith($query, 'do='. self::$PAGE_CHANGETAG)) {
|
if (startsWith($query, 'do=' . self::$PAGE_CHANGETAG)) {
|
||||||
return self::$PAGE_CHANGETAG;
|
return self::$PAGE_CHANGETAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startsWith($query, 'do='. self::$PAGE_ADDLINK)) {
|
if (startsWith($query, 'do=' . self::$PAGE_ADDLINK)) {
|
||||||
return self::$PAGE_ADDLINK;
|
return self::$PAGE_ADDLINK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,27 +149,27 @@ public static function findPage($query, $get, $loggedIn)
|
||||||
return self::$PAGE_DELETELINK;
|
return self::$PAGE_DELETELINK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startsWith($query, 'do='. self::$PAGE_PINLINK)) {
|
if (startsWith($query, 'do=' . self::$PAGE_PINLINK)) {
|
||||||
return self::$PAGE_PINLINK;
|
return self::$PAGE_PINLINK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startsWith($query, 'do='. self::$PAGE_EXPORT)) {
|
if (startsWith($query, 'do=' . self::$PAGE_EXPORT)) {
|
||||||
return self::$PAGE_EXPORT;
|
return self::$PAGE_EXPORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startsWith($query, 'do='. self::$PAGE_IMPORT)) {
|
if (startsWith($query, 'do=' . self::$PAGE_IMPORT)) {
|
||||||
return self::$PAGE_IMPORT;
|
return self::$PAGE_IMPORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startsWith($query, 'do='. self::$PAGE_PLUGINSADMIN)) {
|
if (startsWith($query, 'do=' . self::$PAGE_PLUGINSADMIN)) {
|
||||||
return self::$PAGE_PLUGINSADMIN;
|
return self::$PAGE_PLUGINSADMIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startsWith($query, 'do='. self::$PAGE_SAVE_PLUGINSADMIN)) {
|
if (startsWith($query, 'do=' . self::$PAGE_SAVE_PLUGINSADMIN)) {
|
||||||
return self::$PAGE_SAVE_PLUGINSADMIN;
|
return self::$PAGE_SAVE_PLUGINSADMIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startsWith($query, 'do='. self::$GET_TOKEN)) {
|
if (startsWith($query, 'do=' . self::$GET_TOKEN)) {
|
||||||
return self::$GET_TOKEN;
|
return self::$GET_TOKEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,12 +63,10 @@
|
||||||
require_once 'application/http/UrlUtils.php';
|
require_once 'application/http/UrlUtils.php';
|
||||||
require_once 'application/updater/UpdaterUtils.php';
|
require_once 'application/updater/UpdaterUtils.php';
|
||||||
require_once 'application/FileUtils.php';
|
require_once 'application/FileUtils.php';
|
||||||
require_once 'application/History.php';
|
|
||||||
require_once 'application/NetscapeBookmarkUtils.php';
|
require_once 'application/NetscapeBookmarkUtils.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';
|
||||||
require_once 'application/Router.php';
|
|
||||||
|
|
||||||
use \Shaarli\ApplicationUtils;
|
use \Shaarli\ApplicationUtils;
|
||||||
use \Shaarli\Bookmark\Exception\LinkNotFoundException;
|
use \Shaarli\Bookmark\Exception\LinkNotFoundException;
|
||||||
|
@ -80,6 +78,7 @@
|
||||||
use \Shaarli\Languages;
|
use \Shaarli\Languages;
|
||||||
use \Shaarli\Render\PageBuilder;
|
use \Shaarli\Render\PageBuilder;
|
||||||
use \Shaarli\Render\ThemeUtils;
|
use \Shaarli\Render\ThemeUtils;
|
||||||
|
use \Shaarli\Router;
|
||||||
use \Shaarli\Security\LoginManager;
|
use \Shaarli\Security\LoginManager;
|
||||||
use \Shaarli\Security\SessionManager;
|
use \Shaarli\Security\SessionManager;
|
||||||
use \Shaarli\Thumbnailer;
|
use \Shaarli\Thumbnailer;
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
* Adds the addlink input on the linklist page.
|
* Adds the addlink input on the linklist page.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Shaarli\Router;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When linklist is displayed, add play videos to header's toolbar.
|
* When linklist is displayed, add play videos to header's toolbar.
|
||||||
*
|
*
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Shaarli\Config\ConfigManager;
|
use Shaarli\Config\ConfigManager;
|
||||||
|
use Shaarli\Router;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In the footer hook, there is a working example of a translation extension for Shaarli.
|
* In the footer hook, there is a working example of a translation extension for Shaarli.
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Shaarli\Config\ConfigManager;
|
use Shaarli\Config\ConfigManager;
|
||||||
|
use Shaarli\Router;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display an error everywhere if the plugin is enabled without configuration.
|
* Display an error everywhere if the plugin is enabled without configuration.
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Shaarli\Config\ConfigManager;
|
use Shaarli\Config\ConfigManager;
|
||||||
|
use Shaarli\Router;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If this tag is used on a shaare, the description won't be processed by Parsedown.
|
* If this tag is used on a shaare, the description won't be processed by Parsedown.
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
* Note: this plugin adds jQuery.
|
* Note: this plugin adds jQuery.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Shaarli\Router;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When linklist is displayed, add play videos to header's toolbar.
|
* When linklist is displayed, add play videos to header's toolbar.
|
||||||
*
|
*
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
use pubsubhubbub\publisher\Publisher;
|
use pubsubhubbub\publisher\Publisher;
|
||||||
use Shaarli\Config\ConfigManager;
|
use Shaarli\Config\ConfigManager;
|
||||||
use Shaarli\Feed\FeedBuilder;
|
use Shaarli\Feed\FeedBuilder;
|
||||||
|
use Shaarli\Router;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plugin init function - set the hub to the default appspot one.
|
* Plugin init function - set the hub to the default appspot one.
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
* Display a QRCode icon in link list.
|
* Display a QRCode icon in link list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Shaarli\Router;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add qrcode icon to link_plugin when rendering linklist.
|
* Add qrcode icon to link_plugin when rendering linklist.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,15 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
|
namespace Shaarli;
|
||||||
/**
|
|
||||||
* Router tests
|
|
||||||
*/
|
|
||||||
|
|
||||||
require_once 'application/Router.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for Router
|
* Unit tests for Router
|
||||||
*/
|
*/
|
||||||
class RouterTest extends PHPUnit_Framework_TestCase
|
class RouterTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Test findPage: login page output.
|
* Test findPage: login page output.
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
* PluginPlayvideosTest.php
|
* PluginPlayvideosTest.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Shaarli\Router;
|
||||||
|
|
||||||
require_once 'plugins/addlink_toolbar/addlink_toolbar.php';
|
require_once 'plugins/addlink_toolbar/addlink_toolbar.php';
|
||||||
require_once 'application/Router.php';
|
require_once 'application/Router.php';
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
* PluginPlayvideosTest.php
|
* PluginPlayvideosTest.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Shaarli\Router;
|
||||||
|
|
||||||
require_once 'plugins/playvideos/playvideos.php';
|
require_once 'plugins/playvideos/playvideos.php';
|
||||||
require_once 'application/Router.php';
|
require_once 'application/Router.php';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
use Shaarli\Config\ConfigManager;
|
use Shaarli\Config\ConfigManager;
|
||||||
|
use Shaarli\Router;
|
||||||
|
|
||||||
require_once 'plugins/pubsubhubbub/pubsubhubbub.php';
|
require_once 'plugins/pubsubhubbub/pubsubhubbub.php';
|
||||||
require_once 'application/Router.php';
|
require_once 'application/Router.php';
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
* PluginQrcodeTest.php
|
* PluginQrcodeTest.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Shaarli\Router;
|
||||||
|
|
||||||
require_once 'plugins/qrcode/qrcode.php';
|
require_once 'plugins/qrcode/qrcode.php';
|
||||||
require_once 'application/Router.php';
|
require_once 'application/Router.php';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue