@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | protected function check_for_special_redirect($uri) |
| 47 | 47 | {
|
| 48 | - if(preg_match('@^/post_([0-9]{4}-[0-9]{2}-[0-9]{2})_([a-z0-9-]+)(/?)$@', $uri, $matches))
|
|
| 48 | + if (preg_match('@^/post_([0-9]{4}-[0-9]{2}-[0-9]{2})_([a-z0-9-]+)(/?)$@', $uri, $matches))
|
|
| 49 | 49 | {
|
| 50 | 50 | Loader::load('collector', 'blog/PostCollector');
|
| 51 | 51 | $post = PostCollector::getPostByURI($matches[2]); |
| 52 | - if(!$post) |
|
| 52 | + if (!$post) |
|
| 53 | 53 | {
|
| 54 | 54 | Loader::loadNew('controller', '/Error404Controller')
|
| 55 | 55 | ->activate(); |
@@ -61,21 +61,21 @@ discard block |
||
| 61 | 61 | else |
| 62 | 62 | {
|
| 63 | 63 | $post_uri = URLDecode::getPiece(1); |
| 64 | - if($post_uri !== null) |
|
| 64 | + if ($post_uri !== null) |
|
| 65 | 65 | {
|
| 66 | 66 | Loader::load('collector', 'blog/PostCollector');
|
| 67 | 67 | $post = PostCollector::getPostByURI($post_uri); |
| 68 | 68 | |
| 69 | - if($post != false) |
|
| 69 | + if ($post != false) |
|
| 70 | 70 | {
|
| 71 | 71 | Loader::load('utility', 'Content');
|
| 72 | 72 | $uri = Content::instance('URLSafe', "/{$post->category}/{$post->title_url}/")->activate();
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | - if($uri == '/search/') |
|
| 76 | + if ($uri == '/search/') |
|
| 77 | 77 | {
|
| 78 | - if(Request::getGet('submit') == 'Submit Search' && Request::getGet('search'))
|
|
| 78 | + if (Request::getGet('submit') == 'Submit Search' && Request::getGet('search'))
|
|
| 79 | 79 | {
|
| 80 | 80 | $uri .= Request::getGet('search');
|
| 81 | 81 | $uri .= '/'; |
@@ -27,12 +27,12 @@ |
||
| 27 | 27 | |
| 28 | 28 | protected function check_for_special_redirect($uri) |
| 29 | 29 | {
|
| 30 | - if(preg_match('@^/piece/([a-z0-9-]+)(/?)$@', $uri, $matches))
|
|
| 30 | + if (preg_match('@^/piece/([a-z0-9-]+)(/?)$@', $uri, $matches))
|
|
| 31 | 31 | {
|
| 32 | 32 | Loader::load('collector', 'portfolio/PortfolioCollector');
|
| 33 | 33 | $piece = PortfolioCollector::getPieceByURI($matches[1]); |
| 34 | 34 | |
| 35 | - if($piece === null) |
|
| 35 | + if ($piece === null) |
|
| 36 | 36 | {
|
| 37 | 37 | Loader::loadNew('controller', '/Error404Controller')
|
| 38 | 38 | ->activate(); |
@@ -19,26 +19,26 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | private static function get_router_name() |
| 21 | 21 | {
|
| 22 | - if(Request::isAJAX()) |
|
| 22 | + if (Request::isAJAX()) |
|
| 23 | 23 | return 'AJAXRouter'; |
| 24 | - if(URLDecode::getURI() == '/robots.txt') |
|
| 24 | + if (URLDecode::getURI() == '/robots.txt') |
|
| 25 | 25 | return 'RobotRouter'; |
| 26 | - if(URLDecode::getURI() == '/sitemap.xml') |
|
| 26 | + if (URLDecode::getURI() == '/sitemap.xml') |
|
| 27 | 27 | return 'SitemapRouter'; |
| 28 | - if(URLDecode::getURI() == '/rss/') |
|
| 28 | + if (URLDecode::getURI() == '/rss/') |
|
| 29 | 29 | return 'RSSRouter'; |
| 30 | - if(URLDecode::getExtension() == 'css') |
|
| 30 | + if (URLDecode::getExtension() == 'css') |
|
| 31 | 31 | return 'StyleRouter'; |
| 32 | - if(URLDecode::getExtension() == 'js') |
|
| 32 | + if (URLDecode::getExtension() == 'js') |
|
| 33 | 33 | return 'ScriptRouter'; |
| 34 | - if(URLDecode::getExtension() == 'ico') |
|
| 34 | + if (URLDecode::getExtension() == 'ico') |
|
| 35 | 35 | return 'ImageRouter'; |
| 36 | - if(URLDecode::getExtension() == 'jpg') |
|
| 36 | + if (URLDecode::getExtension() == 'jpg') |
|
| 37 | 37 | return 'ImageRouter'; |
| 38 | - if(URLDecode::getExtension() == 'png') |
|
| 38 | + if (URLDecode::getExtension() == 'png') |
|
| 39 | 39 | return 'ImageRouter'; |
| 40 | 40 | |
| 41 | - switch(URLDecode::getSite()) |
|
| 41 | + switch (URLDecode::getSite()) |
|
| 42 | 42 | {
|
| 43 | 43 | case 'ajax' : |
| 44 | 44 | return 'AjaxRouter'; |
@@ -86,37 +86,37 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | final protected function check_for_redirect($redirect_uri) |
| 88 | 88 | {
|
| 89 | - foreach($this->get_redirect_array() as $check) |
|
| 89 | + foreach ($this->get_redirect_array() as $check) |
|
| 90 | 90 | {
|
| 91 | 91 | $redirect_uri = preg_replace($check->pattern, $check->replace, $redirect_uri); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | $redirect_uri = $this->check_for_special_redirect($redirect_uri); |
| 95 | 95 | |
| 96 | - if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
| 96 | + if ($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/') |
|
| 97 | 97 | $redirect_uri .= '/'; |
| 98 | 98 | |
| 99 | 99 | if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') {
|
| 100 | 100 | $redirect_uri = 'http://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - if($redirect_uri == URLDecode::getURI()) |
|
| 103 | + if ($redirect_uri == URLDecode::getURI()) |
|
| 104 | 104 | return; |
| 105 | 105 | |
| 106 | 106 | $controller_check = $redirect_uri; |
| 107 | - if(substr($redirect_uri, 0, 4) == 'http') |
|
| 107 | + if (substr($redirect_uri, 0, 4) == 'http') |
|
| 108 | 108 | $controller_check = preg_replace('@^http://([a-z\.]+)@', '', $redirect_uri);
|
| 109 | 109 | |
| 110 | 110 | $controller = $this->get_controller($controller_check); |
| 111 | - if($controller == '/Error404Controller') |
|
| 111 | + if ($controller == '/Error404Controller') |
|
| 112 | 112 | {
|
| 113 | 113 | Loader::loadNew('controller', '/Error404Controller')
|
| 114 | 114 | ->activate(); |
| 115 | 115 | exit; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - if($this->get_primary_folder() == 'images') {
|
|
| 119 | - $file = $controller_check;//URLDecode::getURI(); |
|
| 118 | + if ($this->get_primary_folder() == 'images') {
|
|
| 119 | + $file = $controller_check; //URLDecode::getURI(); |
|
| 120 | 120 | |
| 121 | 121 | if ( |
| 122 | 122 | URLDecode::getSite() == 'images' || |
@@ -129,13 +129,13 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | $image = new ImageOld($file); |
| 132 | - if(!$image->isValid()) {
|
|
| 132 | + if (!$image->isValid()) {
|
|
| 133 | 133 | Loader::loadNew('controller', '/Error404Controller')->activate();
|
| 134 | 134 | exit(); |
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - if(substr($redirect_uri, 0, 4) != 'http') |
|
| 138 | + if (substr($redirect_uri, 0, 4) != 'http') |
|
| 139 | 139 | {
|
| 140 | 140 | $redirect_uri = substr($redirect_uri, 1); |
| 141 | 141 | $redirect_uri = URLDecode::getBase() . $redirect_uri; |
@@ -152,12 +152,12 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | final private function get_controller($uri) |
| 154 | 154 | {
|
| 155 | - foreach($this->get_direct_array() as $check) |
|
| 155 | + foreach ($this->get_direct_array() as $check) |
|
| 156 | 156 | {
|
| 157 | - if($uri == $check->match) |
|
| 157 | + if ($uri == $check->match) |
|
| 158 | 158 | return "{$this->get_primary_folder()}/{$check->controller}";
|
| 159 | 159 | |
| 160 | - if(preg_match("@^{$check->match}$@", $uri))
|
|
| 160 | + if (preg_match("@^{$check->match}$@", $uri))
|
|
| 161 | 161 | return "{$this->get_primary_folder()}/{$check->controller}";
|
| 162 | 162 | } |
| 163 | 163 | |
@@ -166,19 +166,19 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | final private function get_primary_folder() |
| 168 | 168 | {
|
| 169 | - if(Request::isAjax()) |
|
| 169 | + if (Request::isAjax()) |
|
| 170 | 170 | return 'ajax'; |
| 171 | - if(URLDecode::getURI() == '/robots.txt') |
|
| 171 | + if (URLDecode::getURI() == '/robots.txt') |
|
| 172 | 172 | return 'robot'; |
| 173 | - if(URLDecode::getURI() == '/sitemap.xml') |
|
| 173 | + if (URLDecode::getURI() == '/sitemap.xml') |
|
| 174 | 174 | return 'sitemap'; |
| 175 | - if(URLDecode::getURI() == '/rss/') |
|
| 175 | + if (URLDecode::getURI() == '/rss/') |
|
| 176 | 176 | return 'rss'; |
| 177 | - if(URLDecode::getExtension() == 'css') |
|
| 177 | + if (URLDecode::getExtension() == 'css') |
|
| 178 | 178 | return 'styles'; |
| 179 | - if(URLDecode::getExtension() == 'js') |
|
| 179 | + if (URLDecode::getExtension() == 'js') |
|
| 180 | 180 | return 'scripts'; |
| 181 | - if( |
|
| 181 | + if ( |
|
| 182 | 182 | URLDecode::getExtension() == 'jpg' || |
| 183 | 183 | URLDecode::getExtension() == 'ico' || |
| 184 | 184 | URLDecode::getExtension() == 'png') |
@@ -26,6 +26,6 @@ |
||
| 26 | 26 | ) |
| 27 | 27 | ); |
| 28 | 28 | |
| 29 | -Router::route($redirect,$direct); |
|
| 29 | +Router::route($redirect, $direct); |
|
| 30 | 30 | |
| 31 | 31 | ?> |
| 32 | 32 | \ No newline at end of file |
@@ -20,6 +20,6 @@ |
||
| 20 | 20 | ) |
| 21 | 21 | ); |
| 22 | 22 | |
| 23 | -Router::route($redirect,$direct); |
|
| 23 | +Router::route($redirect, $direct); |
|
| 24 | 24 | |
| 25 | 25 | ?> |
| 26 | 26 | \ No newline at end of file |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | {
|
| 20 | 20 | $simple_pieces = array(); |
| 21 | 21 | $complex_pieces = array(); |
| 22 | - foreach($array as $piece) |
|
| 22 | + foreach ($array as $piece) |
|
| 23 | 23 | {
|
| 24 | - switch($piece) |
|
| 24 | + switch ($piece) |
|
| 25 | 25 | {
|
| 26 | 26 | case 'global' : |
| 27 | 27 | $simple_pieces[] = $piece; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - foreach($simple_pieces as $piece) |
|
| 35 | + foreach ($simple_pieces as $piece) |
|
| 36 | 36 | {
|
| 37 | 37 | $final_files[] = self::process_simple_pieces('styles', $piece);
|
| 38 | 38 | } |
@@ -47,9 +47,9 @@ discard block |
||
| 47 | 47 | $complex_pieces = array(); |
| 48 | 48 | $external_pieces = array(); |
| 49 | 49 | |
| 50 | - foreach($array as $piece) |
|
| 50 | + foreach ($array as $piece) |
|
| 51 | 51 | {
|
| 52 | - switch($piece) |
|
| 52 | + switch ($piece) |
|
| 53 | 53 | {
|
| 54 | 54 | case 'jquery-1.4.2' : |
| 55 | 55 | case 'jquery-1.10.2.min' : |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - foreach($external_pieces as $piece) |
|
| 69 | + foreach ($external_pieces as $piece) |
|
| 70 | 70 | {
|
| 71 | 71 | $final_files[] = $piece; |
| 72 | 72 | } |
| 73 | - foreach($simple_pieces as $piece) |
|
| 73 | + foreach ($simple_pieces as $piece) |
|
| 74 | 74 | {
|
| 75 | 75 | $final_files[] = self::process_simple_pieces('scripts', $piece);
|
| 76 | 76 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $piece_path = self::get_piece_path($type, $file); |
| 85 | 85 | $final_path = self::get_final_path($type, $file); |
| 86 | 86 | |
| 87 | - if(!$final_path) |
|
| 87 | + if (!$final_path) |
|
| 88 | 88 | {
|
| 89 | 89 | $contents = file_get_contents($piece_path); |
| 90 | 90 | return self::make_final_file($type, $contents, $file); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | $file_name = substr($final_path, strpos($final_path, $file), strrpos($final_path, '.') - strpos($final_path, $file)); |
| 94 | 94 | |
| 95 | - if(filemtime($final_path) < filemtime($piece_path)) |
|
| 95 | + if (filemtime($final_path) < filemtime($piece_path)) |
|
| 96 | 96 | {
|
| 97 | 97 | $contents = file_get_contents($piece_path); |
| 98 | 98 | return self::make_final_file($type, $contents, $file_name, true); |
@@ -103,19 +103,19 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | private static function process_complex_pieces($type, $array) |
| 105 | 105 | {
|
| 106 | - if(in_array(404, $array)) |
|
| 106 | + if (in_array(404, $array)) |
|
| 107 | 107 | $site = '404'; |
| 108 | - else if(in_array(503, $array)) |
|
| 108 | + else if (in_array(503, $array)) |
|
| 109 | 109 | $site = '503'; |
| 110 | 110 | else |
| 111 | 111 | $site = strtolower(URLDecode::getSite()); |
| 112 | 112 | |
| 113 | 113 | $final_path = self::get_final_path($type, $site); |
| 114 | 114 | |
| 115 | - if(!$final_path) |
|
| 115 | + if (!$final_path) |
|
| 116 | 116 | {
|
| 117 | 117 | $contents = ''; |
| 118 | - foreach($array as $file) |
|
| 118 | + foreach ($array as $file) |
|
| 119 | 119 | {
|
| 120 | 120 | $piece_path = self::get_piece_path($type, $file); |
| 121 | 121 | $contents .= "/*** {$file} ***/\n\n";
|
@@ -129,14 +129,14 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | $create_new = false; |
| 131 | 131 | $contents = ''; |
| 132 | - foreach($array as $file) |
|
| 132 | + foreach ($array as $file) |
|
| 133 | 133 | {
|
| 134 | 134 | $piece_path = self::get_piece_path($type, $file); |
| 135 | 135 | $contents .= file_get_contents($piece_path); |
| 136 | - if(filemtime($final_path) < filemtime($piece_path)) |
|
| 136 | + if (filemtime($final_path) < filemtime($piece_path)) |
|
| 137 | 137 | $create_new = true; |
| 138 | 138 | } |
| 139 | - if($create_new) |
|
| 139 | + if ($create_new) |
|
| 140 | 140 | return self::make_final_file($type, $contents, $file_name, true); |
| 141 | 141 | |
| 142 | 142 | return self::get_final_link($type, $file_name); |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $path = Loader::getRoot() . "/{$type}/final/{$file}*";
|
| 148 | 148 | |
| 149 | 149 | $files = glob($path); |
| 150 | - if(count($files) > 0) |
|
| 150 | + if (count($files) > 0) |
|
| 151 | 151 | return $files[0]; |
| 152 | 152 | return; |
| 153 | 153 | } |
@@ -157,18 +157,18 @@ discard block |
||
| 157 | 157 | $path = Loader::getRoot() . "/{$type}/piece/{$file}*";
|
| 158 | 158 | |
| 159 | 159 | $files = glob($path); |
| 160 | - if(count($files) > 0) |
|
| 160 | + if (count($files) > 0) |
|
| 161 | 161 | return $files[0]; |
| 162 | 162 | return; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | private static function make_final_file($type, $contents, $file_name, $exists = false) |
| 166 | 166 | {
|
| 167 | - if($exists) |
|
| 167 | + if ($exists) |
|
| 168 | 168 | {
|
| 169 | 169 | $old_file = self::get_final_path($type, $file_name); |
| 170 | 170 | $version = substr($old_file, strpos($old_file, $file_name)); |
| 171 | - if(strpos($version, '-v')) |
|
| 171 | + if (strpos($version, '-v')) |
|
| 172 | 172 | {
|
| 173 | 173 | $version = substr($version, strpos($version, '-v')); |
| 174 | 174 | $version = substr($version, 2, strpos($version, '.') - 2); |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | $path = Loader::getRoot() . "/{$type}/final/{$file_name}";
|
| 184 | 184 | |
| 185 | - switch($type) |
|
| 185 | + switch ($type) |
|
| 186 | 186 | {
|
| 187 | 187 | case 'styles' : |
| 188 | 188 | $path .= '.css'; |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | file_put_contents($path, $contents); |
| 196 | - if($exists) |
|
| 196 | + if ($exists) |
|
| 197 | 197 | unlink($old_file); |
| 198 | 198 | Debugger::logMessage("New {$type} file created - {$file_name}.");
|
| 199 | 199 | return self::get_final_link($type, $file_name); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | |
| 202 | 202 | private static function get_final_link($type, $file_name) |
| 203 | 203 | {
|
| 204 | - switch($type) |
|
| 204 | + switch ($type) |
|
| 205 | 205 | {
|
| 206 | 206 | case 'styles' : |
| 207 | 207 | $path = "/style/{$file_name}.css";
|
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | public function setValue($value) |
| 23 | 23 | {
|
| 24 | - if(!$this->is_loaded) |
|
| 24 | + if (!$this->is_loaded) |
|
| 25 | 25 | $this->load(); |
| 26 | 26 | |
| 27 | 27 | $this->value = $value; |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | public function getValue() |
| 32 | 32 | {
|
| 33 | - if(!$this->is_loaded) |
|
| 33 | + if (!$this->is_loaded) |
|
| 34 | 34 | $this->load(); |
| 35 | 35 | return $this->value; |
| 36 | 36 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | public function exists() |
| 44 | 44 | {
|
| 45 | - if(!$this->is_loaded) |
|
| 45 | + if (!$this->is_loaded) |
|
| 46 | 46 | $this->load(); |
| 47 | 47 | return $this->exists; |
| 48 | 48 | } |
@@ -50,10 +50,10 @@ discard block |
||
| 50 | 50 | private final function load() |
| 51 | 51 | {
|
| 52 | 52 | $name = $this->getName(); |
| 53 | - if(isset($_COOKIE[$name])) |
|
| 53 | + if (isset($_COOKIE[$name])) |
|
| 54 | 54 | $value = $_COOKIE[$name]; |
| 55 | 55 | |
| 56 | - if(isset($value)) |
|
| 56 | + if (isset($value)) |
|
| 57 | 57 | {
|
| 58 | 58 | $this->value = $value; |
| 59 | 59 | $this->exists = true; |
@@ -66,13 +66,13 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | public final function save() |
| 68 | 68 | {
|
| 69 | - if(!$this->check_values()) |
|
| 69 | + if (!$this->check_values()) |
|
| 70 | 70 | {
|
| 71 | 71 | Debugger::error('Attempt to create a cookie without all of the values being set!');
|
| 72 | 72 | return false; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - if(!$this->set_cookie()) |
|
| 75 | + if (!$this->set_cookie()) |
|
| 76 | 76 | {
|
| 77 | 77 | Debugger::log('There was a problem saving the cookie.');
|
| 78 | 78 | return false; |
@@ -84,23 +84,23 @@ discard block |
||
| 84 | 84 | private final function check_values() |
| 85 | 85 | {
|
| 86 | 86 | $name = $this->getName(); |
| 87 | - if(empty($name) || strlen($name) < 1) |
|
| 87 | + if (empty($name) || strlen($name) < 1) |
|
| 88 | 88 | return false; |
| 89 | 89 | |
| 90 | 90 | $value = $this->getValue(); |
| 91 | - if(!isset($value) || strlen($value) < 1) |
|
| 91 | + if (!isset($value) || strlen($value) < 1) |
|
| 92 | 92 | return false; |
| 93 | 93 | |
| 94 | 94 | $expiration = $this->getExpiration(); |
| 95 | - if(!isset($expiration) || !is_int($expiration)) |
|
| 95 | + if (!isset($expiration) || !is_int($expiration)) |
|
| 96 | 96 | return false; |
| 97 | 97 | |
| 98 | 98 | $domain = $this->getDomain(); |
| 99 | - if(!isset($domain) || strlen($domain) < 1) |
|
| 99 | + if (!isset($domain) || strlen($domain) < 1) |
|
| 100 | 100 | return false; |
| 101 | 101 | |
| 102 | 102 | $path = $this->getPath(); |
| 103 | - if(!isset($path) || strlen($path) < 1) |
|
| 103 | + if (!isset($path) || strlen($path) < 1) |
|
| 104 | 104 | return false; |
| 105 | 105 | |
| 106 | 106 | return true; |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | public function activate() |
| 24 | 24 | {
|
| 25 | - foreach(self::$CRON_ARRAY as $cron => $frequency) |
|
| 25 | + foreach (self::$CRON_ARRAY as $cron => $frequency) |
|
| 26 | 26 | {
|
| 27 | 27 | //if(!$this->time_to_run($frequency)) |
| 28 | 28 | // continue; |
@@ -49,19 +49,19 @@ discard block |
||
| 49 | 49 | $operator = explode(' ', $frequency);
|
| 50 | 50 | list($time['minute'], $time['hour'], $time['day'], $time['month'], $time['weekday']) = $operator; |
| 51 | 51 | |
| 52 | - foreach($time as $key => $value) |
|
| 52 | + foreach ($time as $key => $value) |
|
| 53 | 53 | {
|
| 54 | - if($value == '*') |
|
| 54 | + if ($value == '*') |
|
| 55 | 55 | continue; |
| 56 | - if(stristr($value, '/')) |
|
| 56 | + if (stristr($value, '/')) |
|
| 57 | 57 | {
|
| 58 | 58 | $value = substr($value, 2); |
| 59 | - if($cur[$key] % $value == 0) |
|
| 59 | + if ($cur[$key] % $value == 0) |
|
| 60 | 60 | continue; |
| 61 | 61 | else |
| 62 | 62 | return; |
| 63 | 63 | } |
| 64 | - if($cur[$key] == $value) |
|
| 64 | + if ($cur[$key] == $value) |
|
| 65 | 65 | continue; |
| 66 | 66 | return; |
| 67 | 67 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $mysqli = new mysqli($host, $username, $password); |
| 37 | 37 | |
| 38 | 38 | $has_connection_error = $mysqli->connect_error; |
| 39 | - if(isset($has_connection_error)) |
|
| 39 | + if (isset($has_connection_error)) |
|
| 40 | 40 | $this->has_connection_error = true; |
| 41 | 41 | |
| 42 | 42 | return $mysqli; |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | public static function instance() |
| 46 | 46 | {
|
| 47 | - if(!isset(self::$instance)) {
|
|
| 47 | + if (!isset(self::$instance)) {
|
|
| 48 | 48 | global $config; |
| 49 | 49 | self::$instance = new Database( |
| 50 | 50 | $config->database->master, |
@@ -63,11 +63,11 @@ discard block |
||
| 63 | 63 | public static function select($query) |
| 64 | 64 | {
|
| 65 | 65 | $start = microtime(true); |
| 66 | - if($result = self::instance()->read_connection->query($query)) |
|
| 66 | + if ($result = self::instance()->read_connection->query($query)) |
|
| 67 | 67 | {
|
| 68 | 68 | self::instance()->log_query($query, $start); |
| 69 | 69 | $array = array(); |
| 70 | - while($row = $result->fetch_object()) |
|
| 70 | + while ($row = $result->fetch_object()) |
|
| 71 | 71 | $array[] = $row; |
| 72 | 72 | $result->close(); |
| 73 | 73 | return $array; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | public static function selectRow($query) |
| 80 | 80 | {
|
| 81 | 81 | $result = self::select($query); |
| 82 | - if(is_array($result)) |
|
| 82 | + if (is_array($result)) |
|
| 83 | 83 | return array_pop($result); |
| 84 | 84 | return false; |
| 85 | 85 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | public static function execute($query) |
| 88 | 88 | {
|
| 89 | 89 | $start = microtime(true); |
| 90 | - if(self::instance()->write_connection->query($query)) |
|
| 90 | + if (self::instance()->write_connection->query($query)) |
|
| 91 | 91 | {
|
| 92 | 92 | self::instance()->log_query($query, $start); |
| 93 | 93 | return true; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | public static function lastInsertID() |
| 100 | 100 | {
|
| 101 | 101 | $id = self::instance()->write_connection->insert_id; |
| 102 | - if($id == 0) |
|
| 102 | + if ($id == 0) |
|
| 103 | 103 | return false; |
| 104 | 104 | return $id; |
| 105 | 105 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | private function gather_query_data() |
| 120 | 120 | {
|
| 121 | 121 | $query_data = array(); |
| 122 | - foreach($this->query_log as $query) |
|
| 122 | + foreach ($this->query_log as $query) |
|
| 123 | 123 | {
|
| 124 | 124 | $query = self::explain($query); |
| 125 | 125 | $query_data[] = $query; |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | {
|
| 132 | 132 | $sql = 'EXPLAIN ' . $query['sql']; |
| 133 | 133 | |
| 134 | - if($result = self::instance()->read_connection->query($sql)) |
|
| 134 | + if ($result = self::instance()->read_connection->query($sql)) |
|
| 135 | 135 | {
|
| 136 | 136 | $row = $result->fetch_assoc(); |
| 137 | 137 | $query['explain'] = $row; |