PluginProbe ʕ •ᴥ•ʔ
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel / 1.3.2
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel v1.3.2
trunk 0.9.0 0.9.1 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0 1.2.1 1.2.10 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.14 1.4.15 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0
wp-all-export / src / Http / Router.php
wp-all-export / src / Http Last commit date
JsonResponse.php 9 years ago Request.php 9 years ago Response.php 8 years ago Router.php 8 years ago
Router.php
32 lines
1 <?php
2
3 namespace Wpae\Http;
4
5
6 class Router
7 {
8 public function route($route, $secure = true)
9 {
10 $container = new \Wpae\Di\WpaeDi(array());
11
12 $request = new Request(file_get_contents('php://input'));
13
14 $q = $route;
15 $routeParts = explode('/', $q);
16 if($secure){
17 $controller = 'Wpae\\App\\Controller\\'.ucwords($routeParts[0]).'Controller';
18 } else {
19 $controller = 'Wpae\\App\\UnsecuredController\\'.ucwords($routeParts[0]).'Controller';
20 }
21 $action = ucwords($routeParts[1]).'Action';
22
23 $controller = new $controller($container);
24 $response = $controller->$action($request);
25
26 if(!$response instanceof \Wpae\Http\Response) {
27 throw new \Exception('The controller must return an HttpResponse instance.');
28 }
29
30 $response->render();
31 }
32 }