@@ -22,28 +22,28 @@ |
||
22 | 22 | |
23 | 23 | // sets up shutdown function to display profiler |
24 | 24 | register_shutdown_function(function () use ($container) { |
25 | - if ( |
|
26 | - !isset($_COOKIE['debugger']) || |
|
27 | - $_COOKIE['debugger'] != 'display' |
|
28 | - ) { |
|
29 | - return; |
|
30 | - } |
|
31 | - |
|
32 | - $dbProfiles = $container['db_connection_locator'] |
|
33 | - ->getRead() |
|
34 | - ->getProfiler() |
|
35 | - ->getProfiles(); |
|
36 | - $dbProfiles = array_filter($dbProfiles, function ($profile) { |
|
37 | - return $profile['function'] == 'perform'; |
|
38 | - }); |
|
39 | - $dbProfiles = array_map(function ($profile) { |
|
40 | - return [ |
|
41 | - 'sql' => trim(preg_replace('/\s+/', ' ', $profile['statement'])), |
|
42 | - 'parameters' => $profile['bind_values'], |
|
43 | - 'time' => $profile['duration'], |
|
44 | - ]; |
|
45 | - }, $dbProfiles); |
|
46 | - $container['profiler']->setProfiledQueries($dbProfiles); |
|
47 | - $container['profiler']->setDisplay(new Particletree\Pqp\Display()); |
|
48 | - $container['profiler']->display($container['db_connection_locator']->getRead()); |
|
25 | + if ( |
|
26 | + !isset($_COOKIE['debugger']) || |
|
27 | + $_COOKIE['debugger'] != 'display' |
|
28 | + ) { |
|
29 | + return; |
|
30 | + } |
|
31 | + |
|
32 | + $dbProfiles = $container['db_connection_locator'] |
|
33 | + ->getRead() |
|
34 | + ->getProfiler() |
|
35 | + ->getProfiles(); |
|
36 | + $dbProfiles = array_filter($dbProfiles, function ($profile) { |
|
37 | + return $profile['function'] == 'perform'; |
|
38 | + }); |
|
39 | + $dbProfiles = array_map(function ($profile) { |
|
40 | + return [ |
|
41 | + 'sql' => trim(preg_replace('/\s+/', ' ', $profile['statement'])), |
|
42 | + 'parameters' => $profile['bind_values'], |
|
43 | + 'time' => $profile['duration'], |
|
44 | + ]; |
|
45 | + }, $dbProfiles); |
|
46 | + $container['profiler']->setProfiledQueries($dbProfiles); |
|
47 | + $container['profiler']->setDisplay(new Particletree\Pqp\Display()); |
|
48 | + $container['profiler']->display($container['db_connection_locator']->getRead()); |
|
49 | 49 | }); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | |
23 | 23 | // sets up shutdown function to display profiler |
24 | -register_shutdown_function(function () use ($container) { |
|
24 | +register_shutdown_function(function() use ($container) { |
|
25 | 25 | if ( |
26 | 26 | !isset($_COOKIE['debugger']) || |
27 | 27 | $_COOKIE['debugger'] != 'display' |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | ->getRead() |
34 | 34 | ->getProfiler() |
35 | 35 | ->getProfiles(); |
36 | - $dbProfiles = array_filter($dbProfiles, function ($profile) { |
|
36 | + $dbProfiles = array_filter($dbProfiles, function($profile) { |
|
37 | 37 | return $profile['function'] == 'perform'; |
38 | 38 | }); |
39 | - $dbProfiles = array_map(function ($profile) { |
|
39 | + $dbProfiles = array_map(function($profile) { |
|
40 | 40 | return [ |
41 | 41 | 'sql' => trim(preg_replace('/\s+/', ' ', $profile['statement'])), |
42 | 42 | 'parameters' => $profile['bind_values'], |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | |
26 | 26 | // timezones are fun |
27 | 27 | date_default_timezone_set('America/Phoenix'); // todo - belongs in configuration |
28 | -$container['default_timezone'] = function ($c) { |
|
28 | +$container['default_timezone'] = function($c) { |
|
29 | 29 | return new DateTimeZone('America/Phoenix'); |
30 | 30 | }; |
31 | 31 | |
32 | 32 | |
33 | 33 | // configure the db connections holder |
34 | 34 | $db_connections = new Aura\Sql\ConnectionLocator(); |
35 | -$db_connections->setDefault(function () use ($config) { |
|
35 | +$db_connections->setDefault(function() use ($config) { |
|
36 | 36 | $connection = $config->database->slave; |
37 | 37 | return new Aura\Sql\ExtendedPdo( |
38 | 38 | "mysql:host={$connection->host}", |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $connection->password |
41 | 41 | ); |
42 | 42 | }); |
43 | -$db_connections->setWrite('master', function () use ($config) { |
|
43 | +$db_connections->setWrite('master', function() use ($config) { |
|
44 | 44 | $connection = $config->database->master; |
45 | 45 | return new Aura\Sql\ExtendedPdo( |
46 | 46 | "mysql:host={$connection->host}", |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $connection->password |
49 | 49 | ); |
50 | 50 | }); |
51 | -$db_connections->setRead('slave', function () use ($config) { |
|
51 | +$db_connections->setRead('slave', function() use ($config) { |
|
52 | 52 | $connection = $config->database->slave; |
53 | 53 | $pdo = new Aura\Sql\ExtendedPdo( |
54 | 54 | "mysql:host={$connection->host}", |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | |
67 | 67 | |
68 | 68 | // setup mail handler |
69 | -$container['mail'] = $container->factory(function ($c) { |
|
69 | +$container['mail'] = $container->factory(function($c) { |
|
70 | 70 | return new Jacobemerick\Archangel\Archangel(); |
71 | 71 | }); |
72 | 72 | |
73 | 73 | |
74 | 74 | // setup the logger |
75 | -$container['setup_logger'] = $container->protect(function ($name) use ($container) { |
|
75 | +$container['setup_logger'] = $container->protect(function($name) use ($container) { |
|
76 | 76 | $logger = new Monolog\Logger($name); |
77 | 77 | |
78 | 78 | $logPath = __DIR__ . "/../logs/{$name}.log"; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | $handle = @fopen($config_path, 'r'); |
12 | 12 | if ($handle === false) { |
13 | - throw new RuntimeException("Could not load config"); |
|
13 | + throw new RuntimeException("Could not load config"); |
|
14 | 14 | } |
15 | 15 | $config = fread($handle, filesize($config_path)); |
16 | 16 | fclose($handle); |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $config = json_decode($config); |
19 | 19 | $last_json_error = json_last_error(); |
20 | 20 | if ($last_json_error !== JSON_ERROR_NONE) { |
21 | - throw new RuntimeException("Could not parse config - JSON error detected"); |
|
21 | + throw new RuntimeException("Could not parse config - JSON error detected"); |
|
22 | 22 | } |
23 | 23 | $container['config'] = $config; |
24 | 24 | |
@@ -26,64 +26,64 @@ discard block |
||
26 | 26 | // timezones are fun |
27 | 27 | date_default_timezone_set('America/Phoenix'); // todo - belongs in configuration |
28 | 28 | $container['default_timezone'] = function ($c) { |
29 | - return new DateTimeZone('America/Phoenix'); |
|
29 | + return new DateTimeZone('America/Phoenix'); |
|
30 | 30 | }; |
31 | 31 | |
32 | 32 | |
33 | 33 | // configure the db connections holder |
34 | 34 | $db_connections = new Aura\Sql\ConnectionLocator(); |
35 | 35 | $db_connections->setDefault(function () use ($config) { |
36 | - $connection = $config->database->slave; |
|
37 | - return new Aura\Sql\ExtendedPdo( |
|
38 | - "mysql:host={$connection->host}", |
|
39 | - $connection->user, |
|
40 | - $connection->password |
|
41 | - ); |
|
36 | + $connection = $config->database->slave; |
|
37 | + return new Aura\Sql\ExtendedPdo( |
|
38 | + "mysql:host={$connection->host}", |
|
39 | + $connection->user, |
|
40 | + $connection->password |
|
41 | + ); |
|
42 | 42 | }); |
43 | 43 | $db_connections->setWrite('master', function () use ($config) { |
44 | - $connection = $config->database->master; |
|
45 | - return new Aura\Sql\ExtendedPdo( |
|
46 | - "mysql:host={$connection->host}", |
|
47 | - $connection->user, |
|
48 | - $connection->password |
|
49 | - ); |
|
44 | + $connection = $config->database->master; |
|
45 | + return new Aura\Sql\ExtendedPdo( |
|
46 | + "mysql:host={$connection->host}", |
|
47 | + $connection->user, |
|
48 | + $connection->password |
|
49 | + ); |
|
50 | 50 | }); |
51 | 51 | $db_connections->setRead('slave', function () use ($config) { |
52 | - $connection = $config->database->slave; |
|
53 | - $pdo = new Aura\Sql\ExtendedPdo( |
|
54 | - "mysql:host={$connection->host}", |
|
55 | - $connection->user, |
|
56 | - $connection->password |
|
57 | - ); |
|
58 | - |
|
59 | - $profiler = new Aura\Sql\Profiler(); |
|
60 | - $profiler->setActive(true); |
|
61 | - $pdo->setProfiler($profiler); |
|
62 | - |
|
63 | - return $pdo; |
|
52 | + $connection = $config->database->slave; |
|
53 | + $pdo = new Aura\Sql\ExtendedPdo( |
|
54 | + "mysql:host={$connection->host}", |
|
55 | + $connection->user, |
|
56 | + $connection->password |
|
57 | + ); |
|
58 | + |
|
59 | + $profiler = new Aura\Sql\Profiler(); |
|
60 | + $profiler->setActive(true); |
|
61 | + $pdo->setProfiler($profiler); |
|
62 | + |
|
63 | + return $pdo; |
|
64 | 64 | }); |
65 | 65 | $container['db_connection_locator'] = $db_connections; |
66 | 66 | |
67 | 67 | |
68 | 68 | // setup mail handler |
69 | 69 | $container['mail'] = $container->factory(function ($c) { |
70 | - return (new Jacobemerick\Archangel\Archangel())->setLogger($c['logger']); |
|
70 | + return (new Jacobemerick\Archangel\Archangel())->setLogger($c['logger']); |
|
71 | 71 | }); |
72 | 72 | |
73 | 73 | |
74 | 74 | // setup the logger |
75 | 75 | $container['setup_logger'] = $container->protect(function ($name) use ($container) { |
76 | - $logger = new Monolog\Logger($name); |
|
76 | + $logger = new Monolog\Logger($name); |
|
77 | 77 | |
78 | - $logPath = __DIR__ . "/../logs/{$name}.log"; |
|
79 | - $streamHandler = new Monolog\Handler\StreamHandler($logPath, Monolog\Logger::INFO); |
|
80 | - $streamHandler->setFormatter( |
|
81 | - new Monolog\Formatter\LineFormatter("[%datetime%] %channel%.%level_name%: %message%\n") |
|
82 | - ); |
|
83 | - $logger->pushHandler($streamHandler); |
|
78 | + $logPath = __DIR__ . "/../logs/{$name}.log"; |
|
79 | + $streamHandler = new Monolog\Handler\StreamHandler($logPath, Monolog\Logger::INFO); |
|
80 | + $streamHandler->setFormatter( |
|
81 | + new Monolog\Formatter\LineFormatter("[%datetime%] %channel%.%level_name%: %message%\n") |
|
82 | + ); |
|
83 | + $logger->pushHandler($streamHandler); |
|
84 | 84 | |
85 | - Monolog\ErrorHandler::register($logger); |
|
86 | - $container['logger'] = $logger; |
|
85 | + Monolog\ErrorHandler::register($logger); |
|
86 | + $container['logger'] = $logger; |
|
87 | 87 | }); |
88 | 88 | |
89 | 89 |
@@ -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 | } |