@@ -2,8 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Jacobemerick\Web\Domain\Blog\Tag; |
| 4 | 4 | |
| 5 | -interface TagRepositoryInterface |
|
| 6 | -{ |
|
| 5 | +interface TagRepositoryInterface |
|
| 6 | +{
|
|
| 7 | 7 | public function findTagByTitle($title); |
| 8 | 8 | public function getAllTags(); |
| 9 | 9 | public function getTagCloud(); |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Jacobemerick\Web\Domain\Blog\Introduction; |
| 4 | 4 | |
| 5 | -interface IntroductionRepositoryInterface |
|
| 6 | -{ |
|
| 5 | +interface IntroductionRepositoryInterface |
|
| 6 | +{
|
|
| 7 | 7 | public function findByType($type, $value = ''); |
| 8 | 8 | } |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Jacobemerick\Web\Domain\Stream\Changelog; |
| 4 | 4 | |
| 5 | -interface ChangelogRepositoryInterface |
|
| 6 | -{ |
|
| 5 | +interface ChangelogRepositoryInterface |
|
| 6 | +{
|
|
| 7 | 7 | public function getChanges($limit = null, $offset = 0); |
| 8 | 8 | } |
@@ -2,8 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Jacobemerick\Web\Domain\Stream\Activity; |
| 4 | 4 | |
| 5 | -interface ActivityRepositoryInterface |
|
| 6 | -{ |
|
| 5 | +interface ActivityRepositoryInterface |
|
| 6 | +{
|
|
| 7 | 7 | public function getActivityById($id); |
| 8 | 8 | public function getActivities($limit = null, $offset = 0); |
| 9 | 9 | public function getActivitiesCount(); |
@@ -2,11 +2,11 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | Loader::load('router', 'Router'); |
| 4 | 4 | |
| 5 | -class PortfolioRouter extends Router |
|
| 6 | -{ |
|
| 5 | +class PortfolioRouter extends Router |
|
| 6 | +{
|
|
| 7 | 7 | |
| 8 | - protected function get_redirect_array() |
|
| 9 | - { |
|
| 8 | + protected function get_redirect_array() |
|
| 9 | + {
|
|
| 10 | 10 | $paths = [ |
| 11 | 11 | [ |
| 12 | 12 | 'pattern' => '@/index.(html|htm|php)$@', |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | }, $paths); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - protected function get_direct_array() |
|
| 35 | - { |
|
| 34 | + protected function get_direct_array() |
|
| 35 | + {
|
|
| 36 | 36 | $paths = [ |
| 37 | 37 | [ |
| 38 | 38 | 'match' => '/', |
@@ -2,19 +2,19 @@ |
||
| 2 | 2 | |
| 3 | 3 | Loader::load('router', 'Router'); |
| 4 | 4 | |
| 5 | -class SiteRouter extends Router |
|
| 6 | -{ |
|
| 5 | +class SiteRouter extends Router |
|
| 6 | +{
|
|
| 7 | 7 | |
| 8 | - protected function get_redirect_array() |
|
| 9 | - { |
|
| 8 | + protected function get_redirect_array() |
|
| 9 | + {
|
|
| 10 | 10 | return array( |
| 11 | 11 | (object) array( |
| 12 | 12 | 'pattern' => '@/index.(html|htm|php)$@', |
| 13 | 13 | 'replace' => '/')); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - protected function get_direct_array() |
|
| 17 | - { |
|
| 16 | + protected function get_direct_array() |
|
| 17 | + {
|
|
| 18 | 18 | return array( |
| 19 | 19 | (object) array( |
| 20 | 20 | 'match' => '/', |
@@ -2,11 +2,11 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | Loader::load('router', 'Router'); |
| 4 | 4 | |
| 5 | -class LifestreamRouter extends Router |
|
| 6 | -{ |
|
| 5 | +class LifestreamRouter extends Router |
|
| 6 | +{
|
|
| 7 | 7 | |
| 8 | - protected function get_redirect_array() |
|
| 9 | - { |
|
| 8 | + protected function get_redirect_array() |
|
| 9 | + {
|
|
| 10 | 10 | return array( |
| 11 | 11 | (object) array( |
| 12 | 12 | 'pattern' => '@/index.(html|htm|php)$@', |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | 'replace' => '/')); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - protected function get_direct_array() |
|
| 35 | - { |
|
| 34 | + protected function get_direct_array() |
|
| 35 | + {
|
|
| 36 | 36 | return array( |
| 37 | 37 | (object) array( |
| 38 | 38 | 'match' => '/', |
@@ -4,22 +4,25 @@ discard block |
||
| 4 | 4 | 'Request', |
| 5 | 5 | 'URLDecode')); |
| 6 | 6 | |
| 7 | -abstract class Router |
|
| 8 | -{ |
|
| 7 | +abstract class Router |
|
| 8 | +{
|
|
| 9 | 9 | |
| 10 | - public function __construct() {} |
|
| 10 | + public function __construct() |
|
| 11 | + {
|
|
| 12 | +} |
|
| 11 | 13 | |
| 12 | - public static function instance() |
|
| 13 | - { |
|
| 14 | + public static function instance() |
|
| 15 | + {
|
|
| 14 | 16 | $router_name = self::get_router_name(); |
| 15 | 17 | $router = Loader::loadNew('router', $router_name); |
| 16 | 18 | $router->route(); |
| 17 | 19 | } |
| 18 | 20 | |
| 19 | - private static function get_router_name() |
|
| 20 | - { |
|
| 21 | - if(Request::isAJAX()) |
|
| 22 | - return 'AJAXRouter'; |
|
| 21 | + private static function get_router_name() |
|
| 22 | + {
|
|
| 23 | + if(Request::isAJAX()) {
|
|
| 24 | + return 'AJAXRouter'; |
|
| 25 | + } |
|
| 23 | 26 | |
| 24 | 27 | switch(URLDecode::getSite()) |
| 25 | 28 | { |
@@ -49,8 +52,8 @@ discard block |
||
| 49 | 52 | Loader::loadNew('controller', '/Error404Controller')->activate(); |
| 50 | 53 | } |
| 51 | 54 | |
| 52 | - protected function route() |
|
| 53 | - { |
|
| 55 | + protected function route() |
|
| 56 | + {
|
|
| 54 | 57 | $uri = URLDecode::getURI(); |
| 55 | 58 | |
| 56 | 59 | $this->check_for_redirect($uri); |
@@ -63,8 +66,8 @@ discard block |
||
| 63 | 66 | abstract protected function get_redirect_array(); |
| 64 | 67 | abstract protected function get_direct_array(); |
| 65 | 68 | |
| 66 | - final protected function check_for_redirect($redirect_uri) |
|
| 67 | - { |
|
| 69 | + final protected function check_for_redirect($redirect_uri) |
|
| 70 | + {
|
|
| 68 | 71 | foreach($this->get_redirect_array() as $check) |
| 69 | 72 | { |
| 70 | 73 | $redirect_uri = preg_replace($check->pattern, $check->replace, $redirect_uri); |
@@ -72,16 +75,18 @@ discard block |
||
| 72 | 75 | |
| 73 | 76 | $redirect_uri = $this->check_for_special_redirect($redirect_uri); |
| 74 | 77 | |
| 75 | - if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
| 76 | - $redirect_uri .= '/'; |
|
| 78 | + if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') {
|
|
| 79 | + $redirect_uri .= '/'; |
|
| 80 | + } |
|
| 77 | 81 | |
| 78 | 82 | if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
| 79 | 83 | $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http'; |
| 80 | 84 | $redirect_uri = $protocol . '://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
| 81 | 85 | } |
| 82 | 86 | |
| 83 | - if($redirect_uri == URLDecode::getURI()) |
|
| 84 | - return; |
|
| 87 | + if($redirect_uri == URLDecode::getURI()) {
|
|
| 88 | + return; |
|
| 89 | + } |
|
| 85 | 90 | |
| 86 | 91 | $controller_check = $redirect_uri; |
| 87 | 92 | if(substr($redirect_uri, 0, 4) == 'http') { |
@@ -107,35 +112,38 @@ discard block |
||
| 107 | 112 | ->activate(); |
| 108 | 113 | } |
| 109 | 114 | |
| 110 | - protected function check_for_special_redirect($uri) |
|
| 111 | - { |
|
| 115 | + protected function check_for_special_redirect($uri) |
|
| 116 | + {
|
|
| 112 | 117 | return $uri; |
| 113 | 118 | } |
| 114 | 119 | |
| 115 | - final private function get_controller($uri) |
|
| 116 | - { |
|
| 120 | + final private function get_controller($uri) |
|
| 121 | + {
|
|
| 117 | 122 | foreach($this->get_direct_array() as $check) |
| 118 | 123 | { |
| 119 | - if($uri == $check->match) |
|
| 120 | - return "{$this->get_primary_folder()}/{$check->controller}"; |
|
| 124 | + if($uri == $check->match) {
|
|
| 125 | + return "{$this->get_primary_folder()}/{$check->controller}";
|
|
| 126 | + } |
|
| 121 | 127 | |
| 122 | - if(preg_match("@^{$check->match}$@", $uri)) |
|
| 123 | - return "{$this->get_primary_folder()}/{$check->controller}"; |
|
| 128 | + if(preg_match("@^{$check->match}$@", $uri)) {
|
|
| 129 | + return "{$this->get_primary_folder()}/{$check->controller}";
|
|
| 130 | + } |
|
| 124 | 131 | } |
| 125 | 132 | |
| 126 | 133 | return '/Error404Controller'; |
| 127 | 134 | } |
| 128 | 135 | |
| 129 | - final private function get_primary_folder() |
|
| 130 | - { |
|
| 131 | - if(Request::isAjax()) |
|
| 132 | - return 'ajax'; |
|
| 136 | + final private function get_primary_folder() |
|
| 137 | + {
|
|
| 138 | + if(Request::isAjax()) {
|
|
| 139 | + return 'ajax'; |
|
| 140 | + } |
|
| 133 | 141 | |
| 134 | 142 | return URLDecode::getSite(); |
| 135 | 143 | } |
| 136 | 144 | |
| 137 | - private function requires_trailing_slash() |
|
| 138 | - { |
|
| 145 | + private function requires_trailing_slash() |
|
| 146 | + {
|
|
| 139 | 147 | return ( |
| 140 | 148 | URLDecode::getExtension() != 'json' && |
| 141 | 149 | strstr(URLDecode::getURI(), '#') === false); |
@@ -2,19 +2,19 @@ |
||
| 2 | 2 | |
| 3 | 3 | Loader::load('router', 'Router'); |
| 4 | 4 | |
| 5 | -final class HomeRouter extends Router |
|
| 6 | -{ |
|
| 5 | +final class HomeRouter extends Router |
|
| 6 | +{
|
|
| 7 | 7 | |
| 8 | - protected function get_redirect_array() |
|
| 9 | - { |
|
| 8 | + protected function get_redirect_array() |
|
| 9 | + {
|
|
| 10 | 10 | return array( |
| 11 | 11 | (object) array( |
| 12 | 12 | 'pattern' => '@/index.(html|htm|php)$@', |
| 13 | 13 | 'replace' => '')); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - protected function get_direct_array() |
|
| 17 | - { |
|
| 16 | + protected function get_direct_array() |
|
| 17 | + {
|
|
| 18 | 18 | return array( |
| 19 | 19 | (object) array( |
| 20 | 20 | 'match' => '/', |