@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | ], |
27 | 27 | ]; |
28 | 28 | |
29 | - return array_map(function ($row) { |
|
29 | + return array_map(function($row) { |
|
30 | 30 | return (object) $row; |
31 | 31 | }, $paths); |
32 | 32 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | ], |
49 | 49 | ]; |
50 | 50 | |
51 | - return array_map(function ($row) { |
|
51 | + return array_map(function($row) { |
|
52 | 52 | return (object) $row; |
53 | 53 | }, $paths); |
54 | 54 | } |
@@ -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(); |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $namespace = 'portfolio'; |
4 | -require_once __DIR__ . '/../../bootstrap.php'; |
|
4 | +require_once __DIR__.'/../../bootstrap.php'; |
|
5 | 5 | |
6 | 6 | // route |
7 | 7 | Loader::loadInstance('router', 'Router'); |
@@ -3,4 +3,4 @@ |
||
3 | 3 | error_reporting(E_ALL); |
4 | 4 | date_default_timezone_set('America/Chicago'); |
5 | 5 | |
6 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
6 | +require_once __DIR__.'/../vendor/autoload.php'; |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | 'Cache-Control: no-cache', |
11 | 11 | 'Content-Language: en', |
12 | 12 | 'Content-Type: application/json', |
13 | - 'Expires: ' . self::get_date(time() - 1), |
|
14 | - 'Last-Modified: ' . self::get_date(), |
|
13 | + 'Expires: '.self::get_date(time() - 1), |
|
14 | + 'Last-Modified: '.self::get_date(), |
|
15 | 15 | 'X-Powered-By: jacobemerick.com'); |
16 | 16 | self::send($array); |
17 | 17 | } |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | 'Cache-Control: no-cache', |
24 | 24 | 'Content-Language: en', |
25 | 25 | 'Content-Type: text/html', |
26 | - 'Expires: ' . self::get_date(time() - 1), |
|
27 | - 'Last-Modified: ' . self::get_date(), |
|
26 | + 'Expires: '.self::get_date(time() - 1), |
|
27 | + 'Last-Modified: '.self::get_date(), |
|
28 | 28 | 'X-Powered-By: jacobemerick.com'); |
29 | 29 | self::send($array); |
30 | 30 | } |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | 'Cache-Control: no-cache', |
43 | 43 | 'Content-Language: en', |
44 | 44 | 'Content-Type: text/html', |
45 | - 'Expires: ' . self::get_date(time() - 1), |
|
46 | - 'Last-Modified: ' . self::get_date(), |
|
45 | + 'Expires: '.self::get_date(time() - 1), |
|
46 | + 'Last-Modified: '.self::get_date(), |
|
47 | 47 | 'X-Powered-By: jacobemerick.com'); |
48 | 48 | self::send($array); |
49 | 49 | } |
@@ -55,18 +55,18 @@ discard block |
||
55 | 55 | 'Cache-Control: no-cache', |
56 | 56 | 'Content-Language: en', |
57 | 57 | 'Content-Type: text/html', |
58 | - 'Expires: ' . self::get_date(time() - 1), |
|
59 | - 'Last-Modified: ' . self::get_date(), |
|
58 | + 'Expires: '.self::get_date(time() - 1), |
|
59 | + 'Last-Modified: '.self::get_date(), |
|
60 | 60 | 'X-Powered-By: jacobemerick.com'); |
61 | 61 | self::send($array); |
62 | 62 | } |
63 | 63 | |
64 | 64 | private static function send($array, $gzip = true) |
65 | 65 | { |
66 | - if($gzip) |
|
66 | + if ($gzip) |
|
67 | 67 | self::start_gzipping(); |
68 | 68 | |
69 | - foreach($array as $row) |
|
69 | + foreach ($array as $row) |
|
70 | 70 | { |
71 | 71 | header($row, TRUE); |
72 | 72 | } |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | |
75 | 75 | private static function get_date($timestamp = false) |
76 | 76 | { |
77 | - if($timestamp == 0) |
|
77 | + if ($timestamp == 0) |
|
78 | 78 | $timestamp = time(); |
79 | 79 | return gmdate('D, d M Y H:i:s \G\M\T', $timestamp); |
80 | 80 | } |
81 | 81 | |
82 | 82 | private static function start_gzipping() |
83 | 83 | { |
84 | - if(!ob_start('ob_gzhandler')) |
|
84 | + if (!ob_start('ob_gzhandler')) |
|
85 | 85 | ob_start(); |
86 | 86 | } |
87 | 87 |
@@ -26,16 +26,16 @@ discard block |
||
26 | 26 | |
27 | 27 | switch ($type) { |
28 | 28 | case 'full miles' : |
29 | - $this->content = number_format(round($number / (12 * 3 * 1760))) . ' miles'; |
|
29 | + $this->content = number_format(round($number / (12 * 3 * 1760))).' miles'; |
|
30 | 30 | break; |
31 | 31 | case 'tenth miles' : |
32 | - $this->content = round($number / (12 * 3 * 1760), 1) . ' miles'; |
|
32 | + $this->content = round($number / (12 * 3 * 1760), 1).' miles'; |
|
33 | 33 | break; |
34 | 34 | case 'yards' : |
35 | - $this->content = number_format(round($number / (12 * 3))) . ' yards'; |
|
35 | + $this->content = number_format(round($number / (12 * 3))).' yards'; |
|
36 | 36 | break; |
37 | 37 | case 'feet' : |
38 | - $this->content = number_format(round($number / 12)) . "'"; |
|
38 | + $this->content = number_format(round($number / 12))."'"; |
|
39 | 39 | break; |
40 | 40 | case 'inches' : |
41 | 41 | $feet = floor($number / 12); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | $this->content = ''; |
52 | - $this->content .= number_format($feet) . "'"; |
|
52 | + $this->content .= number_format($feet)."'"; |
|
53 | 53 | if (isset($inches) && $inches > 0) { |
54 | 54 | $this->content .= " {$inches}\""; |
55 | 55 | } |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | { |
41 | 41 | $match_count = preg_match_all($pattern, $this->content, $matches, PREG_SET_ORDER); |
42 | 42 | |
43 | - if($match_count < 1) |
|
43 | + if ($match_count < 1) |
|
44 | 44 | return; |
45 | 45 | |
46 | - foreach($matches as $match) |
|
46 | + foreach ($matches as $match) |
|
47 | 47 | { |
48 | 48 | $full_match = array_shift($match); |
49 | 49 | $placeholder = $this->create_placeholder($full_match); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | private function create_placeholder($text) |
58 | 58 | { |
59 | - return md5($text . rand()); |
|
59 | + return md5($text.rand()); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | private function create_full_match_pattern($text) |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | { |
80 | 80 | $match_count = preg_match_all($pattern, $this->content, $matches, PREG_SET_ORDER); |
81 | 81 | |
82 | - if($match_count < 1) |
|
82 | + if ($match_count < 1) |
|
83 | 83 | return; |
84 | 84 | |
85 | - foreach($matches as $match) |
|
85 | + foreach ($matches as $match) |
|
86 | 86 | { |
87 | 87 | $full_match = array_shift($match); |
88 | 88 | $full_match_pattern = $this->create_full_match_pattern($full_match); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | private function replace_element_patterns() |
101 | 101 | { |
102 | - foreach($this->replacement_array as $key => $replace) |
|
102 | + foreach ($this->replacement_array as $key => $replace) |
|
103 | 103 | { |
104 | 104 | $this->content = str_replace($key, $replace, $this->content); |
105 | 105 | } |
@@ -27,20 +27,20 @@ discard block |
||
27 | 27 | protected function execute() |
28 | 28 | { |
29 | 29 | $args = func_get_args(); |
30 | - if(count($args) < 1) |
|
30 | + if (count($args) < 1) |
|
31 | 31 | { |
32 | 32 | trigger_error('Someone called SmartTrimContent w/o defining a length... bad!'); |
33 | 33 | return; |
34 | 34 | } |
35 | 35 | |
36 | - if(count($args) == 2) |
|
36 | + if (count($args) == 2) |
|
37 | 37 | $etc = $args[1]; |
38 | 38 | else |
39 | 39 | $etc = self::$ETC; |
40 | 40 | |
41 | 41 | $length = $args[0]; |
42 | 42 | |
43 | - if($length < strlen($this->content)) |
|
43 | + if ($length < strlen($this->content)) |
|
44 | 44 | $this->trim_string($length); |
45 | 45 | else |
46 | 46 | $etc = ''; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | $last_right_bracket_position = strripos($content, self::$RIGHT_BRACKET); |
56 | 56 | $last_left_bracket_position = strripos($content, self::$LEFT_BRACKET); |
57 | - if($last_left_bracket_position > $last_right_bracket_position) |
|
57 | + if ($last_left_bracket_position > $last_right_bracket_position) |
|
58 | 58 | $content = substr($content, 0, $last_left_bracket_position); |
59 | 59 | $content = trim($content); |
60 | 60 | |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | $content = current($content); |
74 | 74 | |
75 | 75 | $max_length = $length; |
76 | - foreach($matches[0] as $match) |
|
76 | + foreach ($matches[0] as $match) |
|
77 | 77 | { |
78 | 78 | $max_length += strlen($match[0]); |
79 | - if($max_length <= $match[1]) |
|
79 | + if ($max_length <= $match[1]) |
|
80 | 80 | break; |
81 | 81 | |
82 | - $content = substr($content, 0, $match[1]) . $match[0] . substr($content, $match[1]); |
|
82 | + $content = substr($content, 0, $match[1]).$match[0].substr($content, $match[1]); |
|
83 | 83 | } |
84 | 84 | |
85 | - if(substr($content, -7) == '</p><p>') |
|
85 | + if (substr($content, -7) == '</p><p>') |
|
86 | 86 | $content = substr($content, 0, -7); |
87 | 87 | |
88 | 88 | return $content; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $tags_preg = $this->get_tags_preg(self::$EXCLUDE_TAGS); |
95 | 95 | preg_match_all($tags_preg, $content, $matches, PREG_OFFSET_CAPTURE); |
96 | 96 | |
97 | - if(count($matches[1]) % 2 == 1) |
|
97 | + if (count($matches[1]) % 2 == 1) |
|
98 | 98 | { |
99 | 99 | $cut_tag = end($matches[1]); |
100 | 100 | $cut_tag_position = $cut_tag[1] - 1; |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | preg_match_all($tags_preg, $content, $matches); |
113 | 113 | $open_tags = array(); |
114 | 114 | |
115 | - foreach($matches[1] as $tag) |
|
115 | + foreach ($matches[1] as $tag) |
|
116 | 116 | { |
117 | - if(in_array($tag, $open_tags)) |
|
117 | + if (in_array($tag, $open_tags)) |
|
118 | 118 | { |
119 | 119 | $key = array_search($tag, $open_tags); |
120 | 120 | unset($open_tags[$key]); |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | $open_tags = array_reverse($open_tags); |
127 | - if(count($open_tags) > 0) |
|
127 | + if (count($open_tags) > 0) |
|
128 | 128 | { |
129 | - foreach($open_tags as $key => $open_tag) |
|
129 | + foreach ($open_tags as $key => $open_tag) |
|
130 | 130 | { |
131 | - if($key == count($open_tags) - 1) |
|
131 | + if ($key == count($open_tags) - 1) |
|
132 | 132 | $content .= $etc; |
133 | 133 | $content .= "</{$open_tag}>"; |
134 | 134 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | private function get_tags_preg($tag_array) |
143 | 143 | { |
144 | - return '@</?(' . implode('|', $tag_array) . ')@'; |
|
144 | + return '@</?('.implode('|', $tag_array).')@'; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | } |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | static private function form_url_array($host, $uri) |
16 | 16 | { |
17 | 17 | $uri = substr($uri, 1); |
18 | - if(strpos($uri, '?')) |
|
18 | + if (strpos($uri, '?')) |
|
19 | 19 | $uri = substr($uri, 0, strpos($uri, '?')); |
20 | 20 | $uri_array = explode('/', $uri); |
21 | 21 | |
22 | - if(!Loader::isLive()) |
|
22 | + if (!Loader::isLive()) |
|
23 | 23 | $host = substr($host, strpos($host, '.') + 1); |
24 | 24 | |
25 | 25 | self::$array['host'] = $host; |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | $base .= '/'; |
42 | 42 | |
43 | 43 | self::$array['base'] = $base; |
44 | - self::$array['uri'] = '/' . implode('/', $uri_array); |
|
44 | + self::$array['uri'] = '/'.implode('/', $uri_array); |
|
45 | 45 | |
46 | - if(end($uri_array) == '') |
|
46 | + if (end($uri_array) == '') |
|
47 | 47 | $uri_array = array_slice($uri_array, 0, count($uri_array) - 1); |
48 | 48 | self::$array['pieces'] = (array) $uri_array; |
49 | 49 | } |
@@ -71,21 +71,21 @@ discard block |
||
71 | 71 | static function getExtension() |
72 | 72 | { |
73 | 73 | $file = self::getPiece(-1); |
74 | - if(substr($file, -1) == '/') |
|
74 | + if (substr($file, -1) == '/') |
|
75 | 75 | return false; |
76 | - return substr($file, strrpos($file, '.') + 1);; |
|
76 | + return substr($file, strrpos($file, '.') + 1); ; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | static function getPiece($piece = null) |
80 | 80 | { |
81 | - if(!$piece) |
|
81 | + if (!$piece) |
|
82 | 82 | return self::$array['pieces']; |
83 | 83 | |
84 | - if($piece == -1) |
|
84 | + if ($piece == -1) |
|
85 | 85 | return end(self::$array['pieces']); |
86 | 86 | |
87 | 87 | $piece = $piece - 1; |
88 | - if(array_key_exists($piece, self::$array['pieces'])) |
|
88 | + if (array_key_exists($piece, self::$array['pieces'])) |
|
89 | 89 | return self::$array['pieces'][$piece]; |
90 | 90 | return; |
91 | 91 | } |