@@ -20,8 +20,9 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | public function activate() |
| 22 | 22 | { |
| 23 | - if(!$this->json) |
|
| 24 | - return $this->error('Could not connect to feed.'); |
|
| 23 | + if(!$this->json) {
|
|
| 24 | + return $this->error('Could not connect to feed.');
|
|
| 25 | + } |
|
| 25 | 26 | |
| 26 | 27 | $count = 0; |
| 27 | 28 | foreach($this->json->entries as $entry) |
@@ -41,8 +42,9 @@ discard block |
||
| 41 | 42 | $date = date('Y-m-d H:i:s', strtotime($entry->at)); |
| 42 | 43 | |
| 43 | 44 | $distance_result = DistanceCollector::getDistanceByFields($date, $type, $distance); |
| 44 | - if($distance_result !== null) |
|
| 45 | - continue; |
|
| 45 | + if($distance_result !== null) {
|
|
| 46 | + continue; |
|
| 47 | + } |
|
| 46 | 48 | |
| 47 | 49 | $query = sprintf(self::$QUERY, $type, $distance, $url, $felt, $title, $message, $date); |
| 48 | 50 | Database::execute($query); |
@@ -11,40 +11,47 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | public static function isBoolean($value, $strict = false) |
| 13 | 13 | { |
| 14 | - if($strict && ($value === true || $value === false)) |
|
| 15 | - return true; |
|
| 16 | - if(!$strict && ((bool) $value === true || (bool) $value === false)) |
|
| 17 | - return true; |
|
| 14 | + if($strict && ($value === true || $value === false)) {
|
|
| 15 | + return true; |
|
| 16 | + } |
|
| 17 | + if(!$strict && ((bool) $value === true || (bool) $value === false)) {
|
|
| 18 | + return true; |
|
| 19 | + } |
|
| 18 | 20 | return false; |
| 19 | 21 | } |
| 20 | 22 | |
| 21 | 23 | public static function isDate($value) |
| 22 | 24 | { |
| 23 | - if(strtotime($value) !== -1) |
|
| 24 | - return true; |
|
| 25 | - if(date('y', $value) !== false) |
|
| 26 | - return true; |
|
| 25 | + if(strtotime($value) !== -1) {
|
|
| 26 | + return true; |
|
| 27 | + } |
|
| 28 | + if(date('y', $value) !== false) {
|
|
| 29 | + return true; |
|
| 30 | + } |
|
| 27 | 31 | return false; |
| 28 | 32 | } |
| 29 | 33 | |
| 30 | 34 | public static function isInteger($value, $strict = false) |
| 31 | 35 | { |
| 32 | - if($strict) |
|
| 33 | - return is_int($value); |
|
| 36 | + if($strict) {
|
|
| 37 | + return is_int($value); |
|
| 38 | + } |
|
| 34 | 39 | return (int) $value == $value; |
| 35 | 40 | } |
| 36 | 41 | |
| 37 | 42 | public static function isIP($value) |
| 38 | 43 | { |
| 39 | - if(self::isInteger(ip2long($value))) |
|
| 40 | - return true; |
|
| 44 | + if(self::isInteger(ip2long($value))) {
|
|
| 45 | + return true; |
|
| 46 | + } |
|
| 41 | 47 | return false; |
| 42 | 48 | } |
| 43 | 49 | |
| 44 | 50 | public static function isString($value, $strict = false) |
| 45 | 51 | { |
| 46 | - if($strict) |
|
| 47 | - return is_string($value); |
|
| 52 | + if($strict) {
|
|
| 53 | + return is_string($value); |
|
| 54 | + } |
|
| 48 | 55 | return (string) $value == $value; |
| 49 | 56 | } |
| 50 | 57 | |
@@ -67,8 +74,9 @@ discard block |
||
| 67 | 74 | private static function check_value($pattern, $string) |
| 68 | 75 | { |
| 69 | 76 | preg_match($pattern, $string, $matches); |
| 70 | - if(empty($matches)) |
|
| 71 | - return false; |
|
| 77 | + if(empty($matches)) {
|
|
| 78 | + return false; |
|
| 79 | + } |
|
| 72 | 80 | return $matches[0] == $string; |
| 73 | 81 | } |
| 74 | 82 | |
@@ -84,8 +92,9 @@ discard block |
||
| 84 | 92 | break; |
| 85 | 93 | } |
| 86 | 94 | |
| 87 | - if($value == false) |
|
| 88 | - return false; |
|
| 95 | + if($value == false) {
|
|
| 96 | + return false; |
|
| 97 | + } |
|
| 89 | 98 | |
| 90 | 99 | switch($validation) |
| 91 | 100 | { |
@@ -186,8 +186,9 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | private static function send($array, $gzip = true) |
| 188 | 188 | { |
| 189 | - if($gzip) |
|
| 190 | - self::start_gzipping(); |
|
| 189 | + if($gzip) {
|
|
| 190 | + self::start_gzipping(); |
|
| 191 | + } |
|
| 191 | 192 | |
| 192 | 193 | foreach($array as $row) |
| 193 | 194 | { |
@@ -197,15 +198,17 @@ discard block |
||
| 197 | 198 | |
| 198 | 199 | private static function get_date($timestamp = false) |
| 199 | 200 | { |
| 200 | - if($timestamp == 0) |
|
| 201 | - $timestamp = time(); |
|
| 201 | + if($timestamp == 0) {
|
|
| 202 | + $timestamp = time(); |
|
| 203 | + } |
|
| 202 | 204 | return gmdate('D, d M Y H:i:s \G\M\T', $timestamp); |
| 203 | 205 | } |
| 204 | 206 | |
| 205 | 207 | private static function start_gzipping() |
| 206 | 208 | { |
| 207 | - if(!ob_start('ob_gzhandler')) |
|
| 208 | - ob_start(); |
|
| 209 | + if(!ob_start('ob_gzhandler')) {
|
|
| 210 | + ob_start(); |
|
| 211 | + } |
|
| 209 | 212 | } |
| 210 | 213 | |
| 211 | 214 | } |
| 212 | 215 | \ No newline at end of file |
@@ -35,16 +35,18 @@ discard block |
||
| 35 | 35 | private $name; |
| 36 | 36 | public function getName() |
| 37 | 37 | { |
| 38 | - if(!isset($this->name)) |
|
| 39 | - $this->process(); |
|
| 38 | + if(!isset($this->name)) {
|
|
| 39 | + $this->process(); |
|
| 40 | + } |
|
| 40 | 41 | return $this->name; |
| 41 | 42 | } |
| 42 | 43 | |
| 43 | 44 | private $version; |
| 44 | 45 | public function getVersion() |
| 45 | 46 | { |
| 46 | - if(!isset($this->name)) |
|
| 47 | - $this->process(); |
|
| 47 | + if(!isset($this->name)) {
|
|
| 48 | + $this->process(); |
|
| 49 | + } |
|
| 48 | 50 | return $this->version; |
| 49 | 51 | } |
| 50 | 52 | |
@@ -55,47 +57,41 @@ discard block |
||
| 55 | 57 | { |
| 56 | 58 | $this->name = self::$NAME_INTERNET_EXPLORER; |
| 57 | 59 | $this->version = $version[1]; |
| 58 | - } |
|
| 59 | - else if(stristr($this->user_agent, self::$MATCH_FIREFOX)) |
|
| 60 | + } else if(stristr($this->user_agent, self::$MATCH_FIREFOX)) |
|
| 60 | 61 | { |
| 61 | 62 | $this->name = self::$NAME_FIREFOX; |
| 62 | - if(preg_match(self::$MATCH_FIREFOX_VERSION, $this->user_agent, $version)) |
|
| 63 | - $this->version = $version[1]; |
|
| 64 | - } |
|
| 65 | - else if(stristr($this->user_agent, self::$MATCH_GECKO)) |
|
| 63 | + if(preg_match(self::$MATCH_FIREFOX_VERSION, $this->user_agent, $version)) {
|
|
| 64 | + $this->version = $version[1]; |
|
| 65 | + } |
|
| 66 | + } else if(stristr($this->user_agent, self::$MATCH_GECKO)) |
|
| 66 | 67 | { |
| 67 | 68 | $this->name = self::$NAME_GECKO; |
| 68 | - } |
|
| 69 | - else if(preg_match(self::$MATCH_OPERA, $this->user_agent, $version)) |
|
| 69 | + } else if(preg_match(self::$MATCH_OPERA, $this->user_agent, $version)) |
|
| 70 | 70 | { |
| 71 | 71 | $this->name = self::$NAME_OPERA; |
| 72 | 72 | $this->version = $version[2]; |
| 73 | - } |
|
| 74 | - else if(stristr($this->user_agent, self::$MATCH_KONQUEROR)) |
|
| 73 | + } else if(stristr($this->user_agent, self::$MATCH_KONQUEROR)) |
|
| 75 | 74 | { |
| 76 | 75 | $this->name = self::$NAME_KONQUEROR; |
| 77 | - } |
|
| 78 | - else if(stristr($this->user_agent, self::$MATCH_CHROME)) |
|
| 76 | + } else if(stristr($this->user_agent, self::$MATCH_CHROME)) |
|
| 79 | 77 | { |
| 80 | 78 | $this->name = self::$NAME_CHROME; |
| 81 | - if(preg_match(self::$MATCH_CHROME_VERSION, $this->user_agent, $version)) |
|
| 82 | - $this->version = $version[1]; |
|
| 83 | - } |
|
| 84 | - else if(stristr($this->user_agent, self::$MATCH_IRON)) |
|
| 79 | + if(preg_match(self::$MATCH_CHROME_VERSION, $this->user_agent, $version)) {
|
|
| 80 | + $this->version = $version[1]; |
|
| 81 | + } |
|
| 82 | + } else if(stristr($this->user_agent, self::$MATCH_IRON)) |
|
| 85 | 83 | { |
| 86 | 84 | $this->name = self::$NAME_IRON; |
| 87 | - } |
|
| 88 | - else if(stristr($this->user_agent, self::$MATCH_SAFARI)) |
|
| 85 | + } else if(stristr($this->user_agent, self::$MATCH_SAFARI)) |
|
| 89 | 86 | { |
| 90 | 87 | $this->name = self::$NAME_SAFARI; |
| 91 | - if(preg_match(self::$MATCH_SAFARI_VERSION, $this->user_agent, $version)) |
|
| 92 | - $this->version = $version[1]; |
|
| 93 | - } |
|
| 94 | - else if(stristr($this->user_agent, self::$MATCH_MOZILLA)) |
|
| 88 | + if(preg_match(self::$MATCH_SAFARI_VERSION, $this->user_agent, $version)) {
|
|
| 89 | + $this->version = $version[1]; |
|
| 90 | + } |
|
| 91 | + } else if(stristr($this->user_agent, self::$MATCH_MOZILLA)) |
|
| 95 | 92 | { |
| 96 | 93 | $this->name = self::$NAME_MOZILLA; |
| 97 | - } |
|
| 98 | - else |
|
| 94 | + } else |
|
| 99 | 95 | { |
| 100 | 96 | $this->name = self::$NAME_UNKNOWN; |
| 101 | 97 | } |
@@ -153,215 +153,277 @@ |
||
| 153 | 153 | |
| 154 | 154 | public function getName() |
| 155 | 155 | { |
| 156 | - if(stristr($this->user_agent, self::$MATCH_MOBILE)) |
|
| 157 | - return self::$NAME_MOBILE; |
|
| 156 | + if(stristr($this->user_agent, self::$MATCH_MOBILE)) {
|
|
| 157 | + return self::$NAME_MOBILE; |
|
| 158 | + } |
|
| 158 | 159 | |
| 159 | - if(stristr($this->user_agent, self::$MATCH_IPHONE)) |
|
| 160 | - return self::$NAME_IPHONE; |
|
| 160 | + if(stristr($this->user_agent, self::$MATCH_IPHONE)) {
|
|
| 161 | + return self::$NAME_IPHONE; |
|
| 162 | + } |
|
| 161 | 163 | |
| 162 | - if(stristr($this->user_agent, self::$MATCH_WINDOWS_PHONE)) |
|
| 163 | - return self::$NAME_WINDOWS_PHONE; |
|
| 164 | + if(stristr($this->user_agent, self::$MATCH_WINDOWS_PHONE)) {
|
|
| 165 | + return self::$NAME_WINDOWS_PHONE; |
|
| 166 | + } |
|
| 164 | 167 | |
| 165 | - if(stristr($this->user_agent, self::$MATCH_NOKIA)) |
|
| 166 | - return self::$NAME_NOKIA; |
|
| 168 | + if(stristr($this->user_agent, self::$MATCH_NOKIA)) {
|
|
| 169 | + return self::$NAME_NOKIA; |
|
| 170 | + } |
|
| 167 | 171 | |
| 168 | - if(stristr($this->user_agent, self::$MATCH_IPOD)) |
|
| 169 | - return self::$NAME_IPOD; |
|
| 172 | + if(stristr($this->user_agent, self::$MATCH_IPOD)) {
|
|
| 173 | + return self::$NAME_IPOD; |
|
| 174 | + } |
|
| 170 | 175 | |
| 171 | - if(stristr($this->user_agent, self::$MATCH_MAC)) |
|
| 172 | - return self::$NAME_MAC; |
|
| 176 | + if(stristr($this->user_agent, self::$MATCH_MAC)) {
|
|
| 177 | + return self::$NAME_MAC; |
|
| 178 | + } |
|
| 173 | 179 | |
| 174 | - if(stristr($this->user_agent, self::$MATCH_DARWIN)) |
|
| 175 | - return self::$NAME_MAC; |
|
| 180 | + if(stristr($this->user_agent, self::$MATCH_DARWIN)) {
|
|
| 181 | + return self::$NAME_MAC; |
|
| 182 | + } |
|
| 176 | 183 | |
| 177 | - if(stristr($this->user_agent, self::$MATCH_WEBTV)) |
|
| 178 | - return self::$NAME_WEBTV; |
|
| 184 | + if(stristr($this->user_agent, self::$MATCH_WEBTV)) {
|
|
| 185 | + return self::$NAME_WEBTV; |
|
| 186 | + } |
|
| 179 | 187 | |
| 180 | - if(stristr($this->user_agent, self::$MATCH_WII)) |
|
| 181 | - return self::$NAME_WII; |
|
| 188 | + if(stristr($this->user_agent, self::$MATCH_WII)) {
|
|
| 189 | + return self::$NAME_WII; |
|
| 190 | + } |
|
| 182 | 191 | |
| 183 | - if(stristr($this->user_agent, self::$MATCH_WINDOWS_3)) |
|
| 184 | - return self::$NAME_WINDOWS_3; |
|
| 192 | + if(stristr($this->user_agent, self::$MATCH_WINDOWS_3)) {
|
|
| 193 | + return self::$NAME_WINDOWS_3; |
|
| 194 | + } |
|
| 185 | 195 | |
| 186 | 196 | foreach(self::$MATCH_WINDOWS_4 as $match) |
| 187 | 197 | { |
| 188 | - if(stristr($this->user_agent, $match)) |
|
| 189 | - return self::$NAME_WINDOWS_4; |
|
| 198 | + if(stristr($this->user_agent, $match)) {
|
|
| 199 | + return self::$NAME_WINDOWS_4; |
|
| 200 | + } |
|
| 190 | 201 | } |
| 191 | 202 | |
| 192 | 203 | foreach(self::$MATCH_WINDOWS_95 as $match) |
| 193 | 204 | { |
| 194 | - if(stristr($this->user_agent, $match)) |
|
| 195 | - return self::$NAME_WINDOWS_95; |
|
| 205 | + if(stristr($this->user_agent, $match)) {
|
|
| 206 | + return self::$NAME_WINDOWS_95; |
|
| 207 | + } |
|
| 196 | 208 | } |
| 197 | 209 | |
| 198 | 210 | foreach(self::$MATCH_WINDOWS_98 as $match) |
| 199 | 211 | { |
| 200 | - if(stristr($this->user_agent, $match)) |
|
| 201 | - return self::$NAME_WINDOWS_98; |
|
| 212 | + if(stristr($this->user_agent, $match)) {
|
|
| 213 | + return self::$NAME_WINDOWS_98; |
|
| 214 | + } |
|
| 202 | 215 | } |
| 203 | 216 | |
| 204 | 217 | foreach(self::$MATCH_WINDOWS_2000 as $match) |
| 205 | 218 | { |
| 206 | - if(stristr($this->user_agent, $match)) |
|
| 207 | - return self::$NAME_WINDOWS_2000; |
|
| 219 | + if(stristr($this->user_agent, $match)) {
|
|
| 220 | + return self::$NAME_WINDOWS_2000; |
|
| 221 | + } |
|
| 208 | 222 | } |
| 209 | 223 | |
| 210 | - if(stristr($this->user_agent, self::$MATCH_WINDOWS_ME)) |
|
| 211 | - return self::$NAME_WINDOWS_ME; |
|
| 224 | + if(stristr($this->user_agent, self::$MATCH_WINDOWS_ME)) {
|
|
| 225 | + return self::$NAME_WINDOWS_ME; |
|
| 226 | + } |
|
| 212 | 227 | |
| 213 | - if(stristr($this->user_agent, self::$MATCH_WINDOWS_S_03)) |
|
| 214 | - return self::$NAME_WINDOWS_S_03; |
|
| 228 | + if(stristr($this->user_agent, self::$MATCH_WINDOWS_S_03)) {
|
|
| 229 | + return self::$NAME_WINDOWS_S_03; |
|
| 230 | + } |
|
| 215 | 231 | |
| 216 | 232 | foreach(self::$MATCH_WINDOWS_XP as $match) |
| 217 | 233 | { |
| 218 | - if(stristr($this->user_agent, $match)) |
|
| 219 | - return self::$NAME_WINDOWS_XP; |
|
| 234 | + if(stristr($this->user_agent, $match)) {
|
|
| 235 | + return self::$NAME_WINDOWS_XP; |
|
| 236 | + } |
|
| 220 | 237 | } |
| 221 | 238 | |
| 222 | - if(stristr($this->user_agent, self::$MATCH_WINDOWS_VISTA)) |
|
| 223 | - return self::$NAME_WINDOWS_VISTA; |
|
| 239 | + if(stristr($this->user_agent, self::$MATCH_WINDOWS_VISTA)) {
|
|
| 240 | + return self::$NAME_WINDOWS_VISTA; |
|
| 241 | + } |
|
| 224 | 242 | |
| 225 | 243 | foreach(self::$MATCH_WINDOWS_7 as $match) |
| 226 | 244 | { |
| 227 | - if(stristr($this->user_agent, $match)) |
|
| 228 | - return self::$NAME_WINDOWS_7; |
|
| 245 | + if(stristr($this->user_agent, $match)) {
|
|
| 246 | + return self::$NAME_WINDOWS_7; |
|
| 247 | + } |
|
| 229 | 248 | } |
| 230 | 249 | |
| 231 | - if(stristr($this->user_agent, self::$MATCH_OPENBSD)) |
|
| 232 | - return self::$NAME_OPENBSD; |
|
| 250 | + if(stristr($this->user_agent, self::$MATCH_OPENBSD)) {
|
|
| 251 | + return self::$NAME_OPENBSD; |
|
| 252 | + } |
|
| 233 | 253 | |
| 234 | - if(stristr($this->user_agent, self::$MATCH_FREEBSD)) |
|
| 235 | - return self::$NAME_FREEBSD; |
|
| 254 | + if(stristr($this->user_agent, self::$MATCH_FREEBSD)) {
|
|
| 255 | + return self::$NAME_FREEBSD; |
|
| 256 | + } |
|
| 236 | 257 | |
| 237 | - if(stristr($this->user_agent, self::$MATCH_SUNOS)) |
|
| 238 | - return self::$NAME_SUNOS; |
|
| 258 | + if(stristr($this->user_agent, self::$MATCH_SUNOS)) {
|
|
| 259 | + return self::$NAME_SUNOS; |
|
| 260 | + } |
|
| 239 | 261 | |
| 240 | 262 | foreach(self::$MATCH_LINUX as $match) |
| 241 | 263 | { |
| 242 | - if(stristr($this->user_agent, $match)) |
|
| 243 | - return self::$NAME_LINUX; |
|
| 264 | + if(stristr($this->user_agent, $match)) {
|
|
| 265 | + return self::$NAME_LINUX; |
|
| 266 | + } |
|
| 244 | 267 | } |
| 245 | 268 | |
| 246 | - if(stristr($this->user_agent, self::$MATCH_GOOGLEBOT)) |
|
| 247 | - return self::$NAME_GOOGLEBOT; |
|
| 269 | + if(stristr($this->user_agent, self::$MATCH_GOOGLEBOT)) {
|
|
| 270 | + return self::$NAME_GOOGLEBOT; |
|
| 271 | + } |
|
| 248 | 272 | |
| 249 | - if(stristr($this->user_agent, self::$MATCH_GOOGLE_READER)) |
|
| 250 | - return self::$NAME_GOOGLE_READER; |
|
| 273 | + if(stristr($this->user_agent, self::$MATCH_GOOGLE_READER)) {
|
|
| 274 | + return self::$NAME_GOOGLE_READER; |
|
| 275 | + } |
|
| 251 | 276 | |
| 252 | - if(stristr($this->user_agent, self::$MATCH_GOOGLE_VIEW)) |
|
| 253 | - return self::$NAME_GOOGLE_VIEW; |
|
| 277 | + if(stristr($this->user_agent, self::$MATCH_GOOGLE_VIEW)) {
|
|
| 278 | + return self::$NAME_GOOGLE_VIEW; |
|
| 279 | + } |
|
| 254 | 280 | |
| 255 | - if(stristr($this->user_agent, self::$MATCH_GOOGLE_DESK)) |
|
| 256 | - return self::$NAME_GOOGLE_DESKTOP; |
|
| 281 | + if(stristr($this->user_agent, self::$MATCH_GOOGLE_DESK)) {
|
|
| 282 | + return self::$NAME_GOOGLE_DESKTOP; |
|
| 283 | + } |
|
| 257 | 284 | |
| 258 | 285 | foreach(self::$MATCH_BING as $match) |
| 259 | 286 | { |
| 260 | - if(stristr($this->user_agent, $match)) |
|
| 261 | - return self::$NAME_BING; |
|
| 287 | + if(stristr($this->user_agent, $match)) {
|
|
| 288 | + return self::$NAME_BING; |
|
| 289 | + } |
|
| 262 | 290 | } |
| 263 | 291 | |
| 264 | - if(stristr($this->user_agent, self::$MATCH_ASK)) |
|
| 265 | - return self::$NAME_ASK; |
|
| 292 | + if(stristr($this->user_agent, self::$MATCH_ASK)) {
|
|
| 293 | + return self::$NAME_ASK; |
|
| 294 | + } |
|
| 266 | 295 | |
| 267 | - if(stristr($this->user_agent, self::$MATCH_EXABOT)) |
|
| 268 | - return self::$NAME_EXABOT; |
|
| 296 | + if(stristr($this->user_agent, self::$MATCH_EXABOT)) {
|
|
| 297 | + return self::$NAME_EXABOT; |
|
| 298 | + } |
|
| 269 | 299 | |
| 270 | - if(stristr($this->user_agent, self::$MATCH_GEOHASH)) |
|
| 271 | - return self::$NAME_GEOHASH; |
|
| 300 | + if(stristr($this->user_agent, self::$MATCH_GEOHASH)) {
|
|
| 301 | + return self::$NAME_GEOHASH; |
|
| 302 | + } |
|
| 272 | 303 | |
| 273 | - if(stristr($this->user_agent, self::$MATCH_POST_RANK)) |
|
| 274 | - return self::$NAME_POST_RANK; |
|
| 304 | + if(stristr($this->user_agent, self::$MATCH_POST_RANK)) {
|
|
| 305 | + return self::$NAME_POST_RANK; |
|
| 306 | + } |
|
| 275 | 307 | |
| 276 | - if(stristr($this->user_agent, self::$MATCH_BAIDU_SPIDER)) |
|
| 277 | - return self::$NAME_BAIDU_SPIDER; |
|
| 308 | + if(stristr($this->user_agent, self::$MATCH_BAIDU_SPIDER)) {
|
|
| 309 | + return self::$NAME_BAIDU_SPIDER; |
|
| 310 | + } |
|
| 278 | 311 | |
| 279 | - if(stristr($this->user_agent, self::$MATCH_RADIAN)) |
|
| 280 | - return self::$NAME_RADIAN; |
|
| 312 | + if(stristr($this->user_agent, self::$MATCH_RADIAN)) {
|
|
| 313 | + return self::$NAME_RADIAN; |
|
| 314 | + } |
|
| 281 | 315 | |
| 282 | - if(stristr($this->user_agent, self::$MATCH_BLEKKO_SPIDER)) |
|
| 283 | - return self::$NAME_BLEKKO_SPIDER; |
|
| 316 | + if(stristr($this->user_agent, self::$MATCH_BLEKKO_SPIDER)) {
|
|
| 317 | + return self::$NAME_BLEKKO_SPIDER; |
|
| 318 | + } |
|
| 284 | 319 | |
| 285 | - if(stristr($this->user_agent, self::$MATCH_WLA)) |
|
| 286 | - return self::$NAME_WLA; |
|
| 320 | + if(stristr($this->user_agent, self::$MATCH_WLA)) {
|
|
| 321 | + return self::$NAME_WLA; |
|
| 322 | + } |
|
| 287 | 323 | |
| 288 | - if(stristr($this->user_agent, self::$MATCH_FACEBOOK)) |
|
| 289 | - return self::$NAME_FACEBOOK; |
|
| 324 | + if(stristr($this->user_agent, self::$MATCH_FACEBOOK)) {
|
|
| 325 | + return self::$NAME_FACEBOOK; |
|
| 326 | + } |
|
| 290 | 327 | |
| 291 | - if(stristr($this->user_agent, self::$MATCH_BLOGLINES)) |
|
| 292 | - return self::$NAME_BLOGLINES; |
|
| 328 | + if(stristr($this->user_agent, self::$MATCH_BLOGLINES)) {
|
|
| 329 | + return self::$NAME_BLOGLINES; |
|
| 330 | + } |
|
| 293 | 331 | |
| 294 | - if(stristr($this->user_agent, self::$MATCH_R6)) |
|
| 295 | - return self::$NAME_R6; |
|
| 332 | + if(stristr($this->user_agent, self::$MATCH_R6)) {
|
|
| 333 | + return self::$NAME_R6; |
|
| 334 | + } |
|
| 296 | 335 | |
| 297 | - if(stristr($this->user_agent, self::$MATCH_AOL_FAVICON)) |
|
| 298 | - return self::$NAME_AOL_FAVICON; |
|
| 336 | + if(stristr($this->user_agent, self::$MATCH_AOL_FAVICON)) {
|
|
| 337 | + return self::$NAME_AOL_FAVICON; |
|
| 338 | + } |
|
| 299 | 339 | |
| 300 | - if(stristr($this->user_agent, self::$MATCH_YAHOO)) |
|
| 301 | - return self::$NAME_YAHOO; |
|
| 340 | + if(stristr($this->user_agent, self::$MATCH_YAHOO)) {
|
|
| 341 | + return self::$NAME_YAHOO; |
|
| 342 | + } |
|
| 302 | 343 | |
| 303 | - if(stristr($this->user_agent, self::$MATCH_YAHOO_FEED)) |
|
| 304 | - return self::$NAME_YAHOO_FEED; |
|
| 344 | + if(stristr($this->user_agent, self::$MATCH_YAHOO_FEED)) {
|
|
| 345 | + return self::$NAME_YAHOO_FEED; |
|
| 346 | + } |
|
| 305 | 347 | |
| 306 | - if(stristr($this->user_agent, self::$MATCH_YANDEX)) |
|
| 307 | - return self::$NAME_YANDEX; |
|
| 348 | + if(stristr($this->user_agent, self::$MATCH_YANDEX)) {
|
|
| 349 | + return self::$NAME_YANDEX; |
|
| 350 | + } |
|
| 308 | 351 | |
| 309 | - if(stristr($this->user_agent, self::$MATCH_HUAWEI)) |
|
| 310 | - return self::$NAME_HUAWEI; |
|
| 352 | + if(stristr($this->user_agent, self::$MATCH_HUAWEI)) {
|
|
| 353 | + return self::$NAME_HUAWEI; |
|
| 354 | + } |
|
| 311 | 355 | |
| 312 | - if(stristr($this->user_agent, self::$MATCH_SOGOU)) |
|
| 313 | - return self::$NAME_SOGOU; |
|
| 356 | + if(stristr($this->user_agent, self::$MATCH_SOGOU)) {
|
|
| 357 | + return self::$NAME_SOGOU; |
|
| 358 | + } |
|
| 314 | 359 | |
| 315 | - if(stristr($this->user_agent, self::$MATCH_MLBOT)) |
|
| 316 | - return self::$NAME_MLBOT; |
|
| 360 | + if(stristr($this->user_agent, self::$MATCH_MLBOT)) {
|
|
| 361 | + return self::$NAME_MLBOT; |
|
| 362 | + } |
|
| 317 | 363 | |
| 318 | - if(stristr($this->user_agent, self::$MATCH_NETCRAFT)) |
|
| 319 | - return self::$NAME_NETCRAFT; |
|
| 364 | + if(stristr($this->user_agent, self::$MATCH_NETCRAFT)) {
|
|
| 365 | + return self::$NAME_NETCRAFT; |
|
| 366 | + } |
|
| 320 | 367 | |
| 321 | - if(stristr($this->user_agent, self::$MATCH_TURNITIN)) |
|
| 322 | - return self::$NAME_TURNITIN; |
|
| 368 | + if(stristr($this->user_agent, self::$MATCH_TURNITIN)) {
|
|
| 369 | + return self::$NAME_TURNITIN; |
|
| 370 | + } |
|
| 323 | 371 | |
| 324 | - if(stristr($this->user_agent, self::$MATCH_LINKEDINBOT)) |
|
| 325 | - return self::$NAME_LINKEDINBOT; |
|
| 372 | + if(stristr($this->user_agent, self::$MATCH_LINKEDINBOT)) {
|
|
| 373 | + return self::$NAME_LINKEDINBOT; |
|
| 374 | + } |
|
| 326 | 375 | |
| 327 | - if(stristr($this->user_agent, self::$MATCH_ABOUT_US)) |
|
| 328 | - return self::$NAME_ABOUT_US; |
|
| 376 | + if(stristr($this->user_agent, self::$MATCH_ABOUT_US)) {
|
|
| 377 | + return self::$NAME_ABOUT_US; |
|
| 378 | + } |
|
| 329 | 379 | |
| 330 | - if(stristr($this->user_agent, self::$MATCH_COSMIX)) |
|
| 331 | - return self::$NAME_COSMIX; |
|
| 380 | + if(stristr($this->user_agent, self::$MATCH_COSMIX)) {
|
|
| 381 | + return self::$NAME_COSMIX; |
|
| 382 | + } |
|
| 332 | 383 | |
| 333 | - if(stristr($this->user_agent, self::$MATCH_PYCURL)) |
|
| 334 | - return self::$NAME_PYCURL; |
|
| 384 | + if(stristr($this->user_agent, self::$MATCH_PYCURL)) {
|
|
| 385 | + return self::$NAME_PYCURL; |
|
| 386 | + } |
|
| 335 | 387 | |
| 336 | - if(stristr($this->user_agent, self::$MATCH_MAJESTIC)) |
|
| 337 | - return self::$NAME_MAJESTIC; |
|
| 388 | + if(stristr($this->user_agent, self::$MATCH_MAJESTIC)) {
|
|
| 389 | + return self::$NAME_MAJESTIC; |
|
| 390 | + } |
|
| 338 | 391 | |
| 339 | - if(stristr($this->user_agent, self::$MATCH_GIGABOT)) |
|
| 340 | - return self::$NAME_GIGABOT; |
|
| 392 | + if(stristr($this->user_agent, self::$MATCH_GIGABOT)) {
|
|
| 393 | + return self::$NAME_GIGABOT; |
|
| 394 | + } |
|
| 341 | 395 | |
| 342 | - if(stristr($this->user_agent, self::$MATCH_ZOOKA)) |
|
| 343 | - return self::$NAME_ZOOKA; |
|
| 396 | + if(stristr($this->user_agent, self::$MATCH_ZOOKA)) {
|
|
| 397 | + return self::$NAME_ZOOKA; |
|
| 398 | + } |
|
| 344 | 399 | |
| 345 | - if(stristr($this->user_agent, self::$MATCH_PANSCIENT)) |
|
| 346 | - return self::$NAME_PANSCIENT; |
|
| 400 | + if(stristr($this->user_agent, self::$MATCH_PANSCIENT)) {
|
|
| 401 | + return self::$NAME_PANSCIENT; |
|
| 402 | + } |
|
| 347 | 403 | |
| 348 | - if(stristr($this->user_agent, self::$MATCH_LIBWWW)) |
|
| 349 | - return self::$NAME_LIBWWW; |
|
| 404 | + if(stristr($this->user_agent, self::$MATCH_LIBWWW)) {
|
|
| 405 | + return self::$NAME_LIBWWW; |
|
| 406 | + } |
|
| 350 | 407 | |
| 351 | - if(stristr($this->user_agent, self::$MATCH_DOTBOT)) |
|
| 352 | - return self::$NAME_DOTBOT; |
|
| 408 | + if(stristr($this->user_agent, self::$MATCH_DOTBOT)) {
|
|
| 409 | + return self::$NAME_DOTBOT; |
|
| 410 | + } |
|
| 353 | 411 | |
| 354 | - if(stristr($this->user_agent, self::$MATCH_ARCHIVER)) |
|
| 355 | - return self::$NAME_ARCHIVER; |
|
| 412 | + if(stristr($this->user_agent, self::$MATCH_ARCHIVER)) {
|
|
| 413 | + return self::$NAME_ARCHIVER; |
|
| 414 | + } |
|
| 356 | 415 | |
| 357 | - if(stristr($this->user_agent, self::$MATCH_ZEND)) |
|
| 358 | - return self::$NAME_ZEND; |
|
| 416 | + if(stristr($this->user_agent, self::$MATCH_ZEND)) {
|
|
| 417 | + return self::$NAME_ZEND; |
|
| 418 | + } |
|
| 359 | 419 | |
| 360 | - if(stristr($this->user_agent, self::$MATCH_PYTHON)) |
|
| 361 | - return self::$NAME_PYTHON; |
|
| 420 | + if(stristr($this->user_agent, self::$MATCH_PYTHON)) {
|
|
| 421 | + return self::$NAME_PYTHON; |
|
| 422 | + } |
|
| 362 | 423 | |
| 363 | - if(stristr($this->user_agent, self::$MATCH_JAKARATA)) |
|
| 364 | - return self::$NAME_JAKARATA; |
|
| 424 | + if(stristr($this->user_agent, self::$MATCH_JAKARATA)) {
|
|
| 425 | + return self::$NAME_JAKARATA; |
|
| 426 | + } |
|
| 365 | 427 | |
| 366 | 428 | return self::$NAME_UNKNOWN; |
| 367 | 429 | } |
@@ -20,8 +20,9 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | if($key) |
| 22 | 22 | { |
| 23 | - if(isset(self::$server[$key])) |
|
| 24 | - return self::$server[$key]; |
|
| 23 | + if(isset(self::$server[$key])) {
|
|
| 24 | + return self::$server[$key]; |
|
| 25 | + } |
|
| 25 | 26 | return false; |
| 26 | 27 | } |
| 27 | 28 | return self::$server; |
@@ -29,8 +30,9 @@ discard block |
||
| 29 | 30 | |
| 30 | 31 | static function isAjax() |
| 31 | 32 | { |
| 32 | - if(self::getServer(self::$AJAX_REQUEST)) |
|
| 33 | - return true; |
|
| 33 | + if(self::getServer(self::$AJAX_REQUEST)) {
|
|
| 34 | + return true; |
|
| 35 | + } |
|
| 34 | 36 | return false; |
| 35 | 37 | } |
| 36 | 38 | |
@@ -38,8 +40,9 @@ discard block |
||
| 38 | 40 | { |
| 39 | 41 | if($key) |
| 40 | 42 | { |
| 41 | - if(isset(self::$get[$key])) |
|
| 42 | - return self::$get[$key]; |
|
| 43 | + if(isset(self::$get[$key])) {
|
|
| 44 | + return self::$get[$key]; |
|
| 45 | + } |
|
| 43 | 46 | return false; |
| 44 | 47 | } |
| 45 | 48 | return self::$get; |
@@ -49,8 +52,9 @@ discard block |
||
| 49 | 52 | { |
| 50 | 53 | if($key) |
| 51 | 54 | { |
| 52 | - if(isset(self::$post[$key])) |
|
| 53 | - return self::$post[$key]; |
|
| 55 | + if(isset(self::$post[$key])) {
|
|
| 56 | + return self::$post[$key]; |
|
| 57 | + } |
|
| 54 | 58 | return false; |
| 55 | 59 | } |
| 56 | 60 | return self::$post; |
@@ -103,12 +103,13 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | private static function process_complex_pieces($type, $array) |
| 105 | 105 | { |
| 106 | - if(in_array(404, $array)) |
|
| 107 | - $site = '404'; |
|
| 108 | - else if(in_array(503, $array)) |
|
| 109 | - $site = '503'; |
|
| 110 | - else |
|
| 111 | - $site = strtolower(URLDecode::getSite()); |
|
| 106 | + if(in_array(404, $array)) {
|
|
| 107 | + $site = '404'; |
|
| 108 | + } else if(in_array(503, $array)) {
|
|
| 109 | + $site = '503'; |
|
| 110 | + } else {
|
|
| 111 | + $site = strtolower(URLDecode::getSite()); |
|
| 112 | + } |
|
| 112 | 113 | |
| 113 | 114 | $final_path = self::get_final_path($type, $site); |
| 114 | 115 | |
@@ -133,11 +134,13 @@ discard block |
||
| 133 | 134 | { |
| 134 | 135 | $piece_path = self::get_piece_path($type, $file); |
| 135 | 136 | $contents .= file_get_contents($piece_path); |
| 136 | - if(filemtime($final_path) < filemtime($piece_path)) |
|
| 137 | - $create_new = true; |
|
| 137 | + if(filemtime($final_path) < filemtime($piece_path)) {
|
|
| 138 | + $create_new = true; |
|
| 139 | + } |
|
| 138 | 140 | } |
| 139 | - if($create_new) |
|
| 140 | - return self::make_final_file($type, $contents, $file_name, true); |
|
| 141 | + if($create_new) {
|
|
| 142 | + return self::make_final_file($type, $contents, $file_name, true); |
|
| 143 | + } |
|
| 141 | 144 | |
| 142 | 145 | return self::get_final_link($type, $file_name); |
| 143 | 146 | } |
@@ -147,8 +150,9 @@ discard block |
||
| 147 | 150 | $path = Loader::getRoot() . "/{$type}/final/{$file}*"; |
| 148 | 151 | |
| 149 | 152 | $files = glob($path); |
| 150 | - if(count($files) > 0) |
|
| 151 | - return $files[0]; |
|
| 153 | + if(count($files) > 0) {
|
|
| 154 | + return $files[0]; |
|
| 155 | + } |
|
| 152 | 156 | return; |
| 153 | 157 | } |
| 154 | 158 | |
@@ -157,8 +161,9 @@ discard block |
||
| 157 | 161 | $path = Loader::getRoot() . "/{$type}/piece/{$file}*"; |
| 158 | 162 | |
| 159 | 163 | $files = glob($path); |
| 160 | - if(count($files) > 0) |
|
| 161 | - return $files[0]; |
|
| 164 | + if(count($files) > 0) {
|
|
| 165 | + return $files[0]; |
|
| 166 | + } |
|
| 162 | 167 | return; |
| 163 | 168 | } |
| 164 | 169 | |
@@ -174,9 +179,9 @@ discard block |
||
| 174 | 179 | $version = substr($version, 2, strpos($version, '.') - 2); |
| 175 | 180 | $version++; |
| 176 | 181 | $file_name = substr($file_name, 0, strpos($file_name, '-v')); |
| 177 | - } |
|
| 178 | - else |
|
| 179 | - $version = 2; |
|
| 182 | + } else {
|
|
| 183 | + $version = 2; |
|
| 184 | + } |
|
| 180 | 185 | $file_name .= "-v{$version}"; |
| 181 | 186 | } |
| 182 | 187 | |
@@ -193,8 +198,9 @@ discard block |
||
| 193 | 198 | } |
| 194 | 199 | |
| 195 | 200 | file_put_contents($path, $contents); |
| 196 | - if($exists) |
|
| 197 | - unlink($old_file); |
|
| 201 | + if($exists) {
|
|
| 202 | + unlink($old_file); |
|
| 203 | + } |
|
| 198 | 204 | Debugger::logMessage("New {$type} file created - {$file_name}."); |
| 199 | 205 | return self::get_final_link($type, $file_name); |
| 200 | 206 | } |
@@ -42,8 +42,9 @@ discard block |
||
| 42 | 42 | foreach($this->result as $row) |
| 43 | 43 | { |
| 44 | 44 | $weight = $this->get_search_weight($row); |
| 45 | - if($weight > 0) |
|
| 46 | - $weighted_array[$row->id] = $weight; |
|
| 45 | + if($weight > 0) {
|
|
| 46 | + $weighted_array[$row->id] = $weight; |
|
| 47 | + } |
|
| 47 | 48 | } |
| 48 | 49 | arsort($weighted_array); |
| 49 | 50 | |
@@ -52,8 +53,9 @@ discard block |
||
| 52 | 53 | { |
| 53 | 54 | foreach($this->result as $row) |
| 54 | 55 | { |
| 55 | - if($row->id == $id) |
|
| 56 | - $final_array[] = $row; |
|
| 56 | + if($row->id == $id) {
|
|
| 57 | + $final_array[] = $row; |
|
| 58 | + } |
|
| 57 | 59 | } |
| 58 | 60 | } |
| 59 | 61 | return $final_array; |
@@ -26,7 +26,9 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | //if(!$this->time_to_run($frequency)) |
| 28 | 28 | // continue; |
| 29 | - if ($cron != 'TwitterCron') continue; |
|
| 29 | + if ($cron != 'TwitterCron') {
|
|
| 30 | + continue; |
|
| 31 | + } |
|
| 30 | 32 | |
| 31 | 33 | Loader::load('utility', "cron/{$cron}"); |
| 32 | 34 | $reflection = new ReflectionClass($cron); |
@@ -51,18 +53,21 @@ discard block |
||
| 51 | 53 | |
| 52 | 54 | foreach($time as $key => $value) |
| 53 | 55 | { |
| 54 | - if($value == '*') |
|
| 55 | - continue; |
|
| 56 | + if($value == '*') {
|
|
| 57 | + continue; |
|
| 58 | + } |
|
| 56 | 59 | if(stristr($value, '/')) |
| 57 | 60 | { |
| 58 | 61 | $value = substr($value, 2); |
| 59 | - if($cur[$key] % $value == 0) |
|
| 60 | - continue; |
|
| 61 | - else |
|
| 62 | - return; |
|
| 62 | + if($cur[$key] % $value == 0) {
|
|
| 63 | + continue; |
|
| 64 | + } else {
|
|
| 65 | + return; |
|
| 66 | + } |
|
| 63 | 67 | } |
| 64 | - if($cur[$key] == $value) |
|
| 65 | - continue; |
|
| 68 | + if($cur[$key] == $value) {
|
|
| 69 | + continue; |
|
| 70 | + } |
|
| 66 | 71 | return; |
| 67 | 72 | } |
| 68 | 73 | return true; |