@@ -4,5 +4,5 @@ |
||
4 | 4 | |
5 | 5 | interface WatercourseRepositoryInterface |
6 | 6 | { |
7 | - public function getWatercourseList(); |
|
7 | + public function getWatercourseList(); |
|
8 | 8 | } |
@@ -4,5 +4,5 @@ |
||
4 | 4 | |
5 | 5 | interface WaterfallRepositoryInterface |
6 | 6 | { |
7 | - public function getWaterfalls($limit = null, $offset= 0); |
|
7 | + public function getWaterfalls($limit = null, $offset= 0); |
|
8 | 8 | } |
@@ -4,5 +4,5 @@ |
||
4 | 4 | |
5 | 5 | interface WaterfallRepositoryInterface |
6 | 6 | { |
7 | - public function getWaterfalls($limit = null, $offset= 0); |
|
7 | + public function getWaterfalls($limit = null, $offset = 0); |
|
8 | 8 | } |
@@ -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() |
@@ -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,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,10 +104,10 @@ 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 | // if(!file_exists($file_path)) |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | self::instance()->add_included_file($file_path); |
117 | 117 | |
118 | - switch($type) |
|
118 | + switch ($type) |
|
119 | 119 | { |
120 | 120 | case 'images' : |
121 | 121 | case 'scripts' : |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | $reflectionObject = self::create_reflection_class($file); |
147 | 147 | |
148 | - if( |
|
148 | + if ( |
|
149 | 149 | $reflectionObject->hasMethod('instance') && |
150 | 150 | $reflectionObject->getMethod('instance')->isStatic()) |
151 | 151 | { |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | |
161 | 161 | $reflectionObject = self::create_reflection_class($file); |
162 | 162 | |
163 | - if($reflectionObject->hasMethod('__construct')) |
|
163 | + if ($reflectionObject->hasMethod('__construct')) |
|
164 | 164 | return $reflectionObject->newInstanceArgs($data); |
165 | 165 | else |
166 | 166 | return $reflectionObject->newInstance(); |
@@ -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 | } |
@@ -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,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,14 +65,14 @@ 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') { |
@@ -80,23 +80,23 @@ discard block |
||
80 | 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 | 89 | $controller_check = preg_replace('@^' . $protocol . '://([a-z\.]+)@', '', $redirect_uri); |
90 | 90 | |
91 | 91 | $controller = $this->get_controller($controller_check); |
92 | - if($controller == '/Error404Controller') |
|
92 | + if ($controller == '/Error404Controller') |
|
93 | 93 | { |
94 | 94 | Loader::loadNew('controller', '/Error404Controller') |
95 | 95 | ->activate(); |
96 | 96 | exit; |
97 | 97 | } |
98 | 98 | |
99 | - if(substr($redirect_uri, 0, 4) != 'http') |
|
99 | + if (substr($redirect_uri, 0, 4) != 'http') |
|
100 | 100 | { |
101 | 101 | $redirect_uri = substr($redirect_uri, 1); |
102 | 102 | $redirect_uri = URLDecode::getBase() . $redirect_uri; |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | |
114 | 114 | final private function get_controller($uri) |
115 | 115 | { |
116 | - foreach($this->get_direct_array() as $check) |
|
116 | + foreach ($this->get_direct_array() as $check) |
|
117 | 117 | { |
118 | - if($uri == $check->match) |
|
118 | + if ($uri == $check->match) |
|
119 | 119 | return "{$this->get_primary_folder()}/{$check->controller}"; |
120 | 120 | |
121 | - if(preg_match("@^{$check->match}$@", $uri)) |
|
121 | + if (preg_match("@^{$check->match}$@", $uri)) |
|
122 | 122 | return "{$this->get_primary_folder()}/{$check->controller}"; |
123 | 123 | } |
124 | 124 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | |
128 | 128 | final private function get_primary_folder() |
129 | 129 | { |
130 | - if(Request::isAjax()) |
|
130 | + if (Request::isAjax()) |
|
131 | 131 | return 'ajax'; |
132 | 132 | |
133 | 133 | return URLDecode::getSite(); |
@@ -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 | } |