@@ -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 | } |
@@ -7,108 +7,108 @@ |
||
7 | 7 | class MysqlActivityRepository implements ActivityRepositoryInterface |
8 | 8 | { |
9 | 9 | |
10 | - /** @var ConnectionLocator */ |
|
11 | - protected $connections; |
|
10 | + /** @var ConnectionLocator */ |
|
11 | + protected $connections; |
|
12 | 12 | |
13 | - /** |
|
14 | - * @param ConnectonLocator $connections |
|
15 | - */ |
|
16 | - public function __construct(ConnectionLocator $connections) |
|
17 | - { |
|
18 | - $this->connections = $connections; |
|
19 | - } |
|
13 | + /** |
|
14 | + * @param ConnectonLocator $connections |
|
15 | + */ |
|
16 | + public function __construct(ConnectionLocator $connections) |
|
17 | + { |
|
18 | + $this->connections = $connections; |
|
19 | + } |
|
20 | 20 | |
21 | - /** |
|
22 | - * @param integer $id |
|
23 | - * |
|
24 | - * @return array|false |
|
25 | - */ |
|
26 | - public function getActivityById($id) |
|
27 | - { |
|
28 | - $query = " |
|
21 | + /** |
|
22 | + * @param integer $id |
|
23 | + * |
|
24 | + * @return array|false |
|
25 | + */ |
|
26 | + public function getActivityById($id) |
|
27 | + { |
|
28 | + $query = " |
|
29 | 29 | SELECT * |
30 | 30 | FROM `jpemeric_stream`.`activity` |
31 | 31 | WHERE `id` = :id |
32 | 32 | LIMIT 1"; |
33 | - $bindings = [ |
|
34 | - 'id' => $id, |
|
35 | - ]; |
|
33 | + $bindings = [ |
|
34 | + 'id' => $id, |
|
35 | + ]; |
|
36 | 36 | |
37 | - return $this |
|
38 | - ->connections |
|
39 | - ->getRead() |
|
40 | - ->fetchOne($query, $bindings); |
|
41 | - } |
|
37 | + return $this |
|
38 | + ->connections |
|
39 | + ->getRead() |
|
40 | + ->fetchOne($query, $bindings); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @param integer $limit |
|
45 | - * @param integer $offset |
|
46 | - * |
|
47 | - * @return array|false |
|
48 | - */ |
|
49 | - public function getActivities($limit = null, $offset = 0) |
|
50 | - { |
|
51 | - $query = " |
|
43 | + /** |
|
44 | + * @param integer $limit |
|
45 | + * @param integer $offset |
|
46 | + * |
|
47 | + * @return array|false |
|
48 | + */ |
|
49 | + public function getActivities($limit = null, $offset = 0) |
|
50 | + { |
|
51 | + $query = " |
|
52 | 52 | SELECT * |
53 | 53 | FROM `jpemeric_stream`.`activity` |
54 | 54 | ORDER BY `datetime` DESC"; |
55 | - if (!is_null($limit)) { |
|
56 | - $query .= " |
|
55 | + if (!is_null($limit)) { |
|
56 | + $query .= " |
|
57 | 57 | LIMIT {$offset}, {$limit}"; |
58 | - } |
|
58 | + } |
|
59 | 59 | |
60 | - return $this |
|
61 | - ->connections |
|
62 | - ->getRead() |
|
63 | - ->fetchAll($query); |
|
64 | - } |
|
60 | + return $this |
|
61 | + ->connections |
|
62 | + ->getRead() |
|
63 | + ->fetchAll($query); |
|
64 | + } |
|
65 | 65 | |
66 | - public function getActivitiesCount() |
|
67 | - { |
|
68 | - $query = " |
|
66 | + public function getActivitiesCount() |
|
67 | + { |
|
68 | + $query = " |
|
69 | 69 | SELECT COUNT(1) AS `count` |
70 | 70 | FROM `jpemeric_stream`.`activity`"; |
71 | 71 | |
72 | - return $this |
|
73 | - ->connections |
|
74 | - ->getRead() |
|
75 | - ->fetchValue($query); |
|
76 | - } |
|
72 | + return $this |
|
73 | + ->connections |
|
74 | + ->getRead() |
|
75 | + ->fetchValue($query); |
|
76 | + } |
|
77 | 77 | |
78 | - public function getActivitiesByType($type, $limit = null, $offset = 0) |
|
79 | - { |
|
80 | - $query = " |
|
78 | + public function getActivitiesByType($type, $limit = null, $offset = 0) |
|
79 | + { |
|
80 | + $query = " |
|
81 | 81 | SELECT * |
82 | 82 | FROM `jpemeric_stream`.`activity` |
83 | 83 | WHERE `type` = :type |
84 | 84 | ORDER BY `datetime` DESC"; |
85 | - if (!is_null($limit)) { |
|
86 | - $query .= " |
|
85 | + if (!is_null($limit)) { |
|
86 | + $query .= " |
|
87 | 87 | LIMIT {$offset}, {$limit}"; |
88 | - } |
|
89 | - $bindings = [ |
|
90 | - 'type' => $type, |
|
91 | - ]; |
|
88 | + } |
|
89 | + $bindings = [ |
|
90 | + 'type' => $type, |
|
91 | + ]; |
|
92 | 92 | |
93 | - return $this |
|
94 | - ->connections |
|
95 | - ->getRead() |
|
96 | - ->fetchAll($query, $bindings); |
|
97 | - } |
|
93 | + return $this |
|
94 | + ->connections |
|
95 | + ->getRead() |
|
96 | + ->fetchAll($query, $bindings); |
|
97 | + } |
|
98 | 98 | |
99 | - public function getActivitiesByTypeCount($type) |
|
100 | - { |
|
101 | - $query = " |
|
99 | + public function getActivitiesByTypeCount($type) |
|
100 | + { |
|
101 | + $query = " |
|
102 | 102 | SELECT COUNT(1) AS `count` |
103 | 103 | FROM `jpemeric_stream`.`activity` |
104 | 104 | WHERE `type` = :type"; |
105 | - $bindings = [ |
|
106 | - 'type' => $type, |
|
107 | - ]; |
|
105 | + $bindings = [ |
|
106 | + 'type' => $type, |
|
107 | + ]; |
|
108 | 108 | |
109 | - return $this |
|
110 | - ->connections |
|
111 | - ->getRead() |
|
112 | - ->fetchValue($query, $bindings); |
|
113 | - } |
|
109 | + return $this |
|
110 | + ->connections |
|
111 | + ->getRead() |
|
112 | + ->fetchValue($query, $bindings); |
|
113 | + } |
|
114 | 114 | } |
@@ -7,37 +7,37 @@ |
||
7 | 7 | class MysqlChangelogRepository implements ChangelogRepositoryInterface |
8 | 8 | { |
9 | 9 | |
10 | - /** @var ConnectionLocator */ |
|
11 | - protected $connections; |
|
10 | + /** @var ConnectionLocator */ |
|
11 | + protected $connections; |
|
12 | 12 | |
13 | - /** |
|
14 | - * @param ConnectonLocator $connections |
|
15 | - */ |
|
16 | - public function __construct(ConnectionLocator $connections) |
|
17 | - { |
|
18 | - $this->connections = $connections; |
|
19 | - } |
|
13 | + /** |
|
14 | + * @param ConnectonLocator $connections |
|
15 | + */ |
|
16 | + public function __construct(ConnectionLocator $connections) |
|
17 | + { |
|
18 | + $this->connections = $connections; |
|
19 | + } |
|
20 | 20 | |
21 | - /** |
|
22 | - * @param integer $limit |
|
23 | - * @param integer $offset |
|
24 | - * |
|
25 | - * @return array|false |
|
26 | - */ |
|
27 | - public function getChanges($limit = null, $offset = 0) |
|
28 | - { |
|
29 | - $query = " |
|
21 | + /** |
|
22 | + * @param integer $limit |
|
23 | + * @param integer $offset |
|
24 | + * |
|
25 | + * @return array|false |
|
26 | + */ |
|
27 | + public function getChanges($limit = null, $offset = 0) |
|
28 | + { |
|
29 | + $query = " |
|
30 | 30 | SELECT `message`, `message_short`, `datetime`, `commit_link` |
31 | 31 | FROM `jpemeric_stream`.`changelog` |
32 | 32 | ORDER BY `datetime` DESC"; |
33 | - if (!is_null($limit)) { |
|
34 | - $query .= " |
|
33 | + if (!is_null($limit)) { |
|
34 | + $query .= " |
|
35 | 35 | LIMIT {$offset}, {$limit}"; |
36 | - } |
|
36 | + } |
|
37 | 37 | |
38 | - return $this |
|
39 | - ->connections |
|
40 | - ->getRead() |
|
41 | - ->fetchAll($query); |
|
42 | - } |
|
38 | + return $this |
|
39 | + ->connections |
|
40 | + ->getRead() |
|
41 | + ->fetchAll($query); |
|
42 | + } |
|
43 | 43 | } |