@@ -4,5 +4,5 @@ |
||
4 | 4 | |
5 | 5 | interface ChangelogRepositoryInterface |
6 | 6 | { |
7 | - public function getChanges($limit = null, $offset = 0); |
|
7 | + public function getChanges($limit = null, $offset = 0); |
|
8 | 8 | } |
@@ -4,9 +4,9 @@ |
||
4 | 4 | |
5 | 5 | interface ActivityRepositoryInterface |
6 | 6 | { |
7 | - public function getActivityById($id); |
|
8 | - public function getActivities($limit = null, $offset = 0); |
|
9 | - public function getActivitiesCount(); |
|
10 | - public function getActivitiesByType($type, $limit = null, $offset = 0); |
|
11 | - public function getActivitiesByTypeCount($type); |
|
7 | + public function getActivityById($id); |
|
8 | + public function getActivities($limit = null, $offset = 0); |
|
9 | + public function getActivitiesCount(); |
|
10 | + public function getActivitiesByType($type, $limit = null, $offset = 0); |
|
11 | + public function getActivitiesByTypeCount($type); |
|
12 | 12 | } |
@@ -10,10 +10,10 @@ |
||
10 | 10 | |
11 | 11 | public function __construct() |
12 | 12 | { |
13 | - parent::__construct(); |
|
13 | + parent::__construct(); |
|
14 | 14 | |
15 | - global $container; |
|
16 | - $this->activityRepository = new Jacobemerick\Web\Domain\Stream\Activity\MysqlActivityRepository($container['db_connection_locator']); |
|
15 | + global $container; |
|
16 | + $this->activityRepository = new Jacobemerick\Web\Domain\Stream\Activity\MysqlActivityRepository($container['db_connection_locator']); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | protected function set_head_data() |
@@ -45,7 +45,7 @@ |
||
45 | 45 | |
46 | 46 | protected function get_list_results() |
47 | 47 | { |
48 | - return $this->activityRepository->getActivities(self::$POSTS_PER_PAGE, $this->offset); |
|
48 | + return $this->activityRepository->getActivities(self::$POSTS_PER_PAGE, $this->offset); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | protected function get_list_description() |
@@ -38,8 +38,9 @@ discard block |
||
38 | 38 | protected function get_page_number() |
39 | 39 | { |
40 | 40 | $page = URLDecode::getPiece(2); |
41 | - if(isset($page) && is_numeric($page)) |
|
42 | - return $page; |
|
41 | + if(isset($page) && is_numeric($page)) { |
|
42 | + return $page; |
|
43 | + } |
|
43 | 44 | return 1; |
44 | 45 | } |
45 | 46 | |
@@ -58,25 +59,29 @@ discard block |
||
58 | 59 | |
59 | 60 | protected function get_list_next_link() |
60 | 61 | { |
61 | - if($this->page == 1) |
|
62 | - return; |
|
63 | - if($this->page == 2) |
|
64 | - return Loader::getRootUrl('lifestream'); |
|
62 | + if($this->page == 1) { |
|
63 | + return; |
|
64 | + } |
|
65 | + if($this->page == 2) { |
|
66 | + return Loader::getRootUrl('lifestream'); |
|
67 | + } |
|
65 | 68 | return Loader::getRootUrl('lifestream') . 'page/' . ($this->page - 1) . '/'; |
66 | 69 | } |
67 | 70 | |
68 | 71 | protected function get_list_prev_link() |
69 | 72 | { |
70 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
71 | - return; |
|
73 | + if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) { |
|
74 | + return; |
|
75 | + } |
|
72 | 76 | return Loader::getRootUrl('lifestream') . 'page/' . ($this->page + 1) . '/'; |
73 | 77 | } |
74 | 78 | |
75 | 79 | private $total_post_count; |
76 | 80 | protected function get_total_post_count() |
77 | 81 | { |
78 | - if(!isset($this->total_post_count)) |
|
79 | - $this->total_post_count = $this->activityRepository->getActivitiesCount(); |
|
82 | + if(!isset($this->total_post_count)) { |
|
83 | + $this->total_post_count = $this->activityRepository->getActivitiesCount(); |
|
84 | + } |
|
80 | 85 | return $this->total_post_count; |
81 | 86 | } |
82 | 87 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | protected function get_page_number() |
39 | 39 | { |
40 | 40 | $page = URLDecode::getPiece(2); |
41 | - if(isset($page) && is_numeric($page)) |
|
41 | + if (isset($page) && is_numeric($page)) |
|
42 | 42 | return $page; |
43 | 43 | return 1; |
44 | 44 | } |
@@ -58,24 +58,24 @@ discard block |
||
58 | 58 | |
59 | 59 | protected function get_list_next_link() |
60 | 60 | { |
61 | - if($this->page == 1) |
|
61 | + if ($this->page == 1) |
|
62 | 62 | return; |
63 | - if($this->page == 2) |
|
63 | + if ($this->page == 2) |
|
64 | 64 | return Loader::getRootUrl('lifestream'); |
65 | - return Loader::getRootUrl('lifestream') . 'page/' . ($this->page - 1) . '/'; |
|
65 | + return Loader::getRootUrl('lifestream').'page/'.($this->page - 1).'/'; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | protected function get_list_prev_link() |
69 | 69 | { |
70 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
70 | + if (($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
71 | 71 | return; |
72 | - return Loader::getRootUrl('lifestream') . 'page/' . ($this->page + 1) . '/'; |
|
72 | + return Loader::getRootUrl('lifestream').'page/'.($this->page + 1).'/'; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | private $total_post_count; |
76 | 76 | protected function get_total_post_count() |
77 | 77 | { |
78 | - if(!isset($this->total_post_count)) |
|
78 | + if (!isset($this->total_post_count)) |
|
79 | 79 | $this->total_post_count = $this->activityRepository->getActivitiesCount(); |
80 | 80 | return $this->total_post_count; |
81 | 81 | } |
@@ -97,8 +97,9 @@ discard block |
||
97 | 97 | protected function get_page_number() |
98 | 98 | { |
99 | 99 | $page = URLDecode::getPiece(3); |
100 | - if(isset($page) && is_numeric($page)) |
|
101 | - return $page; |
|
100 | + if(isset($page) && is_numeric($page)) { |
|
101 | + return $page; |
|
102 | + } |
|
102 | 103 | return 1; |
103 | 104 | } |
104 | 105 | |
@@ -117,25 +118,29 @@ discard block |
||
117 | 118 | |
118 | 119 | protected function get_list_next_link() |
119 | 120 | { |
120 | - if($this->page == 1) |
|
121 | - return; |
|
122 | - if($this->page == 2) |
|
123 | - return Loader::getRootUrl('lifestream') . $this->tag . '/'; |
|
121 | + if($this->page == 1) { |
|
122 | + return; |
|
123 | + } |
|
124 | + if($this->page == 2) { |
|
125 | + return Loader::getRootUrl('lifestream') . $this->tag . '/'; |
|
126 | + } |
|
124 | 127 | return Loader::getRootUrl('lifestream') . $this->tag . '/page/' . ($this->page - 1) . '/'; |
125 | 128 | } |
126 | 129 | |
127 | 130 | protected function get_list_prev_link() |
128 | 131 | { |
129 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
130 | - return; |
|
132 | + if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) { |
|
133 | + return; |
|
134 | + } |
|
131 | 135 | return Loader::getRootUrl('lifestream') . $this->tag . '/page/' . ($this->page + 1) . '/'; |
132 | 136 | } |
133 | 137 | |
134 | 138 | private $total_post_count; |
135 | 139 | protected function get_total_post_count() |
136 | 140 | { |
137 | - if(!isset($this->total_post_count)) |
|
138 | - $this->total_post_count = $this->activityRepository->getActivitiesByTypeCount($this->tag); |
|
141 | + if(!isset($this->total_post_count)) { |
|
142 | + $this->total_post_count = $this->activityRepository->getActivitiesByTypeCount($this->tag); |
|
143 | + } |
|
139 | 144 | return $this->total_post_count; |
140 | 145 | } |
141 | 146 |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | case 'distance' : |
58 | 58 | return 'Run, Jacob, and Hike'; |
59 | 59 | break; |
60 | - case 'github' : |
|
61 | - return 'Jacob, Code Monkey'; |
|
62 | - break; |
|
60 | + case 'github' : |
|
61 | + return 'Jacob, Code Monkey'; |
|
62 | + break; |
|
63 | 63 | case 'hulu' : |
64 | 64 | return 'Jacob watches Hulu'; |
65 | 65 | break; |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | case 'distance' : |
86 | 86 | return 'All the cool kids like to be in shape. Jacob goes running and hiking.'; |
87 | 87 | break; |
88 | - case 'github' : |
|
89 | - return 'Since he is trying to be a developer, Jacob codes. Here is some code that he pushed around on the Githubs.'; |
|
90 | - break; |
|
88 | + case 'github' : |
|
89 | + return 'Since he is trying to be a developer, Jacob codes. Here is some code that he pushed around on the Githubs.'; |
|
90 | + break; |
|
91 | 91 | case 'hulu' : |
92 | 92 | return 'Occasionally Jacob chills and watches some Hulu. Well, used to, anyways.'; |
93 | 93 | break; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | private function get_title() |
48 | 48 | { |
49 | - switch($this->tag) |
|
49 | + switch ($this->tag) |
|
50 | 50 | { |
51 | 51 | case 'blog' : |
52 | 52 | return 'Jacob has a Blog'; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | private function get_description() |
76 | 76 | { |
77 | - switch($this->tag) |
|
77 | + switch ($this->tag) |
|
78 | 78 | { |
79 | 79 | case 'blog' : |
80 | 80 | return 'Yeah, Jacob has a blog. Check out his posting activity.'; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | protected function get_page_number() |
104 | 104 | { |
105 | 105 | $page = URLDecode::getPiece(3); |
106 | - if(isset($page) && is_numeric($page)) |
|
106 | + if (isset($page) && is_numeric($page)) |
|
107 | 107 | return $page; |
108 | 108 | return 1; |
109 | 109 | } |
@@ -123,24 +123,24 @@ discard block |
||
123 | 123 | |
124 | 124 | protected function get_list_next_link() |
125 | 125 | { |
126 | - if($this->page == 1) |
|
126 | + if ($this->page == 1) |
|
127 | 127 | return; |
128 | - if($this->page == 2) |
|
129 | - return Loader::getRootUrl('lifestream') . $this->tag . '/'; |
|
130 | - return Loader::getRootUrl('lifestream') . $this->tag . '/page/' . ($this->page - 1) . '/'; |
|
128 | + if ($this->page == 2) |
|
129 | + return Loader::getRootUrl('lifestream').$this->tag.'/'; |
|
130 | + return Loader::getRootUrl('lifestream').$this->tag.'/page/'.($this->page - 1).'/'; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | protected function get_list_prev_link() |
134 | 134 | { |
135 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
135 | + if (($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
136 | 136 | return; |
137 | - return Loader::getRootUrl('lifestream') . $this->tag . '/page/' . ($this->page + 1) . '/'; |
|
137 | + return Loader::getRootUrl('lifestream').$this->tag.'/page/'.($this->page + 1).'/'; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | private $total_post_count; |
141 | 141 | protected function get_total_post_count() |
142 | 142 | { |
143 | - if(!isset($this->total_post_count)) |
|
143 | + if (!isset($this->total_post_count)) |
|
144 | 144 | $this->total_post_count = $this->activityRepository->getActivitiesByTypeCount($this->tag); |
145 | 145 | return $this->total_post_count; |
146 | 146 | } |
@@ -59,6 +59,9 @@ discard block |
||
59 | 59 | $this->add_posts($youtube_result, 'youtube'); |
60 | 60 | } |
61 | 61 | |
62 | + /** |
|
63 | + * @param string $type |
|
64 | + */ |
|
62 | 65 | private function remove_existing($result, $type) |
63 | 66 | { |
64 | 67 | foreach($result as $key => $row) |
@@ -70,6 +73,9 @@ discard block |
||
70 | 73 | return $result; |
71 | 74 | } |
72 | 75 | |
76 | + /** |
|
77 | + * @param string $type |
|
78 | + */ |
|
73 | 79 | private function add_posts($result, $type) |
74 | 80 | { |
75 | 81 | foreach($result as $row) |
@@ -17,8 +17,9 @@ discard block |
||
17 | 17 | |
18 | 18 | public static function instance() |
19 | 19 | { |
20 | - if(!isset(self::$instance)) |
|
21 | - self::$instance = new Loader(); |
|
20 | + if(!isset(self::$instance)) { |
|
21 | + self::$instance = new Loader(); |
|
22 | + } |
|
22 | 23 | return self::$instance; |
23 | 24 | } |
24 | 25 | |
@@ -107,8 +108,9 @@ discard block |
||
107 | 108 | foreach((array) $files as $file) |
108 | 109 | { |
109 | 110 | $file_path = self::instance()->get_path($type, $file); |
110 | - if(in_array($file_path, self::instance()->get_included_files()) && $type !== 'view') |
|
111 | - continue; |
|
111 | + if(in_array($file_path, self::instance()->get_included_files()) && $type !== 'view') { |
|
112 | + continue; |
|
113 | + } |
|
112 | 114 | |
113 | 115 | // if(!file_exists($file_path)) |
114 | 116 | // Debugger::logMessage("Requested file does not exist: {$type}, {$file}"); |
@@ -160,10 +162,11 @@ discard block |
||
160 | 162 | |
161 | 163 | $reflectionObject = self::create_reflection_class($file); |
162 | 164 | |
163 | - if($reflectionObject->hasMethod('__construct')) |
|
164 | - return $reflectionObject->newInstanceArgs($data); |
|
165 | - else |
|
166 | - return $reflectionObject->newInstance(); |
|
165 | + if($reflectionObject->hasMethod('__construct')) { |
|
166 | + return $reflectionObject->newInstanceArgs($data); |
|
167 | + } else { |
|
168 | + return $reflectionObject->newInstance(); |
|
169 | + } |
|
167 | 170 | } |
168 | 171 | |
169 | 172 | public static function getRoot() |
@@ -173,17 +173,17 @@ |
||
173 | 173 | return self::instance()->is_live; |
174 | 174 | } |
175 | 175 | |
176 | - public static function getRootURL($site = '') |
|
177 | - { |
|
178 | - if (strlen($site) > 0) { |
|
179 | - $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http'; |
|
180 | - if ($site == 'waterfalls' && self::instance()->is_live) { |
|
181 | - return "{$protocol}://www.waterfallsofthekeweenaw.com/"; |
|
182 | - } else { |
|
183 | - return $protocol . '://' . (self::instance()->is_live ? '' : 'dev.') . $site . '.jacobemerick.com/'; |
|
184 | - } |
|
185 | - } |
|
186 | - return '/'; |
|
187 | - } |
|
176 | + public static function getRootURL($site = '') |
|
177 | + { |
|
178 | + if (strlen($site) > 0) { |
|
179 | + $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http'; |
|
180 | + if ($site == 'waterfalls' && self::instance()->is_live) { |
|
181 | + return "{$protocol}://www.waterfallsofthekeweenaw.com/"; |
|
182 | + } else { |
|
183 | + return $protocol . '://' . (self::instance()->is_live ? '' : 'dev.') . $site . '.jacobemerick.com/'; |
|
184 | + } |
|
185 | + } |
|
186 | + return '/'; |
|
187 | + } |
|
188 | 188 | |
189 | 189 | } |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | |
18 | 18 | public static function instance() |
19 | 19 | { |
20 | - if(!isset(self::$instance)) |
|
20 | + if (!isset(self::$instance)) |
|
21 | 21 | self::$instance = new Loader(); |
22 | 22 | return self::$instance; |
23 | 23 | } |
24 | 24 | |
25 | 25 | private function get_root() |
26 | 26 | { |
27 | - if(!isset($this->root)) |
|
27 | + if (!isset($this->root)) |
|
28 | 28 | { |
29 | 29 | $current_directory = dirname(__FILE__); |
30 | 30 | $current_directory = substr($current_directory, 0, -7); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | private static function get_extension($type) |
54 | 54 | { |
55 | - switch($type) |
|
55 | + switch ($type) |
|
56 | 56 | { |
57 | 57 | case 'collector' : |
58 | 58 | case 'controller' : |
@@ -104,15 +104,15 @@ discard block |
||
104 | 104 | |
105 | 105 | public static function load($type, $files, $data = array()) |
106 | 106 | { |
107 | - foreach((array) $files as $file) |
|
107 | + foreach ((array) $files as $file) |
|
108 | 108 | { |
109 | 109 | $file_path = self::instance()->get_path($type, $file); |
110 | - if(in_array($file_path, self::instance()->get_included_files()) && $type !== 'view') |
|
110 | + if (in_array($file_path, self::instance()->get_included_files()) && $type !== 'view') |
|
111 | 111 | continue; |
112 | 112 | |
113 | 113 | self::instance()->add_included_file($file_path); |
114 | 114 | |
115 | - switch($type) |
|
115 | + switch ($type) |
|
116 | 116 | { |
117 | 117 | case 'images' : |
118 | 118 | case 'scripts' : |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | |
143 | 143 | $reflectionObject = self::create_reflection_class($file); |
144 | 144 | |
145 | - if( |
|
145 | + if ( |
|
146 | 146 | $reflectionObject->hasMethod('instance') && |
147 | 147 | $reflectionObject->getMethod('instance')->isStatic()) |
148 | 148 | { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | $reflectionObject = self::create_reflection_class($file); |
159 | 159 | |
160 | - if($reflectionObject->hasMethod('__construct')) |
|
160 | + if ($reflectionObject->hasMethod('__construct')) |
|
161 | 161 | return $reflectionObject->newInstanceArgs($data); |
162 | 162 | else |
163 | 163 | return $reflectionObject->newInstance(); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | if ($site == 'waterfalls' && self::instance()->is_live) { |
181 | 181 | return "{$protocol}://www.waterfallsofthekeweenaw.com/"; |
182 | 182 | } else { |
183 | - return $protocol . '://' . (self::instance()->is_live ? '' : 'dev.') . $site . '.jacobemerick.com/'; |
|
183 | + return $protocol.'://'.(self::instance()->is_live ? '' : 'dev.').$site.'.jacobemerick.com/'; |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | return '/'; |
@@ -19,7 +19,7 @@ |
||
19 | 19 | (object) array( |
20 | 20 | 'match' => '/get/portfolioImage.json', |
21 | 21 | 'controller' => 'GetPortfolioImageController'), |
22 | - ); |
|
22 | + ); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | } |
@@ -25,37 +25,37 @@ |
||
25 | 25 | |
26 | 26 | private function get_sites() |
27 | 27 | { |
28 | - return [ |
|
29 | - [ |
|
30 | - 'url' => 'https://home.jacobemerick.com/', |
|
31 | - 'title' => "Jacob Emerick's Home", |
|
32 | - 'name' => 'Home' |
|
33 | - ], |
|
34 | - [ |
|
35 | - 'url' => 'https://blog.jacobemerick.com/', |
|
36 | - 'title' => "Jacob Emerick's Blog", |
|
37 | - 'name' => 'Blog' |
|
38 | - ], |
|
39 | - [ |
|
40 | - 'url' => 'https://lifestream.jacobemerick.com/', |
|
41 | - 'title' => "Jacob Emerick's Lifestream", |
|
42 | - 'name' => 'Lifestream' |
|
43 | - ], |
|
44 | - [ |
|
45 | - 'url' => 'https://map.jacobemerick.com/', |
|
46 | - 'title' => "Jacob Emerick's Hiking Map", |
|
47 | - 'name' => 'Map' |
|
48 | - ], |
|
49 | - [ |
|
50 | - 'url' => 'https://portfolio.jacobemerick.com/', |
|
51 | - 'title' => "Jacob Emerick's Portfolio", |
|
52 | - 'name' => 'Portfolio', |
|
53 | - ], |
|
54 | - [ |
|
55 | - 'url' => 'https://www.waterfallsofthekeweenaw.com/', |
|
56 | - 'title' => 'Waterfalls of the Keweenaw', |
|
57 | - 'name' => 'Waterfalls' |
|
58 | - ] |
|
28 | + return [ |
|
29 | + [ |
|
30 | + 'url' => 'https://home.jacobemerick.com/', |
|
31 | + 'title' => "Jacob Emerick's Home", |
|
32 | + 'name' => 'Home' |
|
33 | + ], |
|
34 | + [ |
|
35 | + 'url' => 'https://blog.jacobemerick.com/', |
|
36 | + 'title' => "Jacob Emerick's Blog", |
|
37 | + 'name' => 'Blog' |
|
38 | + ], |
|
39 | + [ |
|
40 | + 'url' => 'https://lifestream.jacobemerick.com/', |
|
41 | + 'title' => "Jacob Emerick's Lifestream", |
|
42 | + 'name' => 'Lifestream' |
|
43 | + ], |
|
44 | + [ |
|
45 | + 'url' => 'https://map.jacobemerick.com/', |
|
46 | + 'title' => "Jacob Emerick's Hiking Map", |
|
47 | + 'name' => 'Map' |
|
48 | + ], |
|
49 | + [ |
|
50 | + 'url' => 'https://portfolio.jacobemerick.com/', |
|
51 | + 'title' => "Jacob Emerick's Portfolio", |
|
52 | + 'name' => 'Portfolio', |
|
53 | + ], |
|
54 | + [ |
|
55 | + 'url' => 'https://www.waterfallsofthekeweenaw.com/', |
|
56 | + 'title' => 'Waterfalls of the Keweenaw', |
|
57 | + 'name' => 'Waterfalls' |
|
58 | + ] |
|
59 | 59 | ]; |
60 | 60 | } |
61 | 61 |
@@ -18,8 +18,9 @@ discard block |
||
18 | 18 | |
19 | 19 | private static function get_router_name() |
20 | 20 | { |
21 | - if(Request::isAJAX()) |
|
22 | - return 'AJAXRouter'; |
|
21 | + if(Request::isAJAX()) { |
|
22 | + return 'AJAXRouter'; |
|
23 | + } |
|
23 | 24 | |
24 | 25 | switch(URLDecode::getSite()) |
25 | 26 | { |
@@ -72,16 +73,18 @@ discard block |
||
72 | 73 | |
73 | 74 | $redirect_uri = $this->check_for_special_redirect($redirect_uri); |
74 | 75 | |
75 | - if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
76 | - $redirect_uri .= '/'; |
|
76 | + if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') { |
|
77 | + $redirect_uri .= '/'; |
|
78 | + } |
|
77 | 79 | |
78 | 80 | if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
79 | 81 | $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http'; |
80 | 82 | $redirect_uri = $protocol . '://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
81 | 83 | } |
82 | 84 | |
83 | - if($redirect_uri == URLDecode::getURI()) |
|
84 | - return; |
|
85 | + if($redirect_uri == URLDecode::getURI()) { |
|
86 | + return; |
|
87 | + } |
|
85 | 88 | |
86 | 89 | $controller_check = $redirect_uri; |
87 | 90 | if(substr($redirect_uri, 0, 4) == 'http') { |
@@ -115,11 +118,13 @@ discard block |
||
115 | 118 | { |
116 | 119 | foreach($this->get_direct_array() as $check) |
117 | 120 | { |
118 | - if($uri == $check->match) |
|
119 | - return "{$this->get_primary_folder()}/{$check->controller}"; |
|
121 | + if($uri == $check->match) { |
|
122 | + return "{$this->get_primary_folder()}/{$check->controller}"; |
|
123 | + } |
|
120 | 124 | |
121 | - if(preg_match("@^{$check->match}$@", $uri)) |
|
122 | - return "{$this->get_primary_folder()}/{$check->controller}"; |
|
125 | + if(preg_match("@^{$check->match}$@", $uri)) { |
|
126 | + return "{$this->get_primary_folder()}/{$check->controller}"; |
|
127 | + } |
|
123 | 128 | } |
124 | 129 | |
125 | 130 | return '/Error404Controller'; |
@@ -127,8 +132,9 @@ discard block |
||
127 | 132 | |
128 | 133 | final private function get_primary_folder() |
129 | 134 | { |
130 | - if(Request::isAjax()) |
|
131 | - return 'ajax'; |
|
135 | + if(Request::isAjax()) { |
|
136 | + return 'ajax'; |
|
137 | + } |
|
132 | 138 | |
133 | 139 | return URLDecode::getSite(); |
134 | 140 | } |
@@ -75,19 +75,19 @@ discard block |
||
75 | 75 | if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
76 | 76 | $redirect_uri .= '/'; |
77 | 77 | |
78 | - if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
|
79 | - $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http'; |
|
80 | - $redirect_uri = $protocol . '://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
|
81 | - } |
|
78 | + if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
|
79 | + $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http'; |
|
80 | + $redirect_uri = $protocol . '://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
|
81 | + } |
|
82 | 82 | |
83 | 83 | if($redirect_uri == URLDecode::getURI()) |
84 | 84 | return; |
85 | 85 | |
86 | 86 | $controller_check = $redirect_uri; |
87 | 87 | if(substr($redirect_uri, 0, 4) == 'http') { |
88 | - $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http'; |
|
88 | + $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http'; |
|
89 | 89 | $controller_check = preg_replace('@^' . $protocol . '://([a-z\.]+)@', '', $redirect_uri); |
90 | - } |
|
90 | + } |
|
91 | 91 | |
92 | 92 | $controller = $this->get_controller($controller_check); |
93 | 93 | if($controller == '/Error404Controller') |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | { |
139 | 139 | return ( |
140 | 140 | URLDecode::getExtension() != 'json' && |
141 | - strstr(URLDecode::getURI(), '#') === false); |
|
141 | + strstr(URLDecode::getURI(), '#') === false); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | } |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | |
19 | 19 | private static function get_router_name() |
20 | 20 | { |
21 | - if(Request::isAJAX()) |
|
21 | + if (Request::isAJAX()) |
|
22 | 22 | return 'AJAXRouter'; |
23 | 23 | |
24 | - switch(URLDecode::getSite()) |
|
24 | + switch (URLDecode::getSite()) |
|
25 | 25 | { |
26 | 26 | case 'ajax' : |
27 | 27 | return 'AjaxRouter'; |
@@ -65,42 +65,42 @@ discard block |
||
65 | 65 | |
66 | 66 | final protected function check_for_redirect($redirect_uri) |
67 | 67 | { |
68 | - foreach($this->get_redirect_array() as $check) |
|
68 | + foreach ($this->get_redirect_array() as $check) |
|
69 | 69 | { |
70 | 70 | $redirect_uri = preg_replace($check->pattern, $check->replace, $redirect_uri); |
71 | 71 | } |
72 | 72 | |
73 | 73 | $redirect_uri = $this->check_for_special_redirect($redirect_uri); |
74 | 74 | |
75 | - if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
75 | + if ($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
76 | 76 | $redirect_uri .= '/'; |
77 | 77 | |
78 | 78 | if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') { |
79 | 79 | $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http'; |
80 | - $redirect_uri = $protocol . '://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
|
80 | + $redirect_uri = $protocol.'://'.(!Loader::isLive() ? 'dev' : 'www').'.waterfallsofthekeweenaw.com'.$redirect_uri; |
|
81 | 81 | } |
82 | 82 | |
83 | - if($redirect_uri == URLDecode::getURI()) |
|
83 | + if ($redirect_uri == URLDecode::getURI()) |
|
84 | 84 | return; |
85 | 85 | |
86 | 86 | $controller_check = $redirect_uri; |
87 | - if(substr($redirect_uri, 0, 4) == 'http') { |
|
87 | + if (substr($redirect_uri, 0, 4) == 'http') { |
|
88 | 88 | $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http'; |
89 | - $controller_check = preg_replace('@^' . $protocol . '://([a-z\.]+)@', '', $redirect_uri); |
|
89 | + $controller_check = preg_replace('@^'.$protocol.'://([a-z\.]+)@', '', $redirect_uri); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | $controller = $this->get_controller($controller_check); |
93 | - if($controller == '/Error404Controller') |
|
93 | + if ($controller == '/Error404Controller') |
|
94 | 94 | { |
95 | 95 | Loader::loadNew('controller', '/Error404Controller') |
96 | 96 | ->activate(); |
97 | 97 | exit; |
98 | 98 | } |
99 | 99 | |
100 | - if(substr($redirect_uri, 0, 4) != 'http') |
|
100 | + if (substr($redirect_uri, 0, 4) != 'http') |
|
101 | 101 | { |
102 | 102 | $redirect_uri = substr($redirect_uri, 1); |
103 | - $redirect_uri = URLDecode::getBase() . $redirect_uri; |
|
103 | + $redirect_uri = URLDecode::getBase().$redirect_uri; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | Loader::loadNew('controller', '/Error301Controller', (array) $redirect_uri) |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | |
115 | 115 | final private function get_controller($uri) |
116 | 116 | { |
117 | - foreach($this->get_direct_array() as $check) |
|
117 | + foreach ($this->get_direct_array() as $check) |
|
118 | 118 | { |
119 | - if($uri == $check->match) |
|
119 | + if ($uri == $check->match) |
|
120 | 120 | return "{$this->get_primary_folder()}/{$check->controller}"; |
121 | 121 | |
122 | - if(preg_match("@^{$check->match}$@", $uri)) |
|
122 | + if (preg_match("@^{$check->match}$@", $uri)) |
|
123 | 123 | return "{$this->get_primary_folder()}/{$check->controller}"; |
124 | 124 | } |
125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | final private function get_primary_folder() |
130 | 130 | { |
131 | - if(Request::isAjax()) |
|
131 | + if (Request::isAjax()) |
|
132 | 132 | return 'ajax'; |
133 | 133 | |
134 | 134 | return URLDecode::getSite(); |