@@ -25,7 +25,8 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * @return array Sorted list of "accept" options |
| 27 | 27 | */ |
| 28 | -$sortAccept = function ($header) { |
|
| 28 | +$sortAccept = function ($header) |
|
| 29 | +{ |
|
| 29 | 30 | $matches = array(); |
| 30 | 31 | foreach (explode(',', $header) as $option) { |
| 31 | 32 | $option = array_map('trim', explode(';', $option)); |
@@ -59,7 +60,8 @@ discard block |
||
| 59 | 60 | * |
| 60 | 61 | * @return string|null a matched option, or NULL if no match |
| 61 | 62 | */ |
| 62 | -$matchAccept = function ($header, $supported) use ($sortAccept) { |
|
| 63 | +$matchAccept = function ($header, $supported) use ($sortAccept) |
|
| 64 | +{ |
|
| 63 | 65 | $matches = $sortAccept($header); |
| 64 | 66 | foreach ($matches as $key => $q) { |
| 65 | 67 | if (isset($supported[$key])) { |
@@ -91,7 +93,8 @@ discard block |
||
| 91 | 93 | * |
| 92 | 94 | * @return string the negotiated language result or the supplied default |
| 93 | 95 | */ |
| 94 | -$negotiateLanguage = function ($supported, $default = 'en-US') use ($matchAccept) { |
|
| 96 | +$negotiateLanguage = function ($supported, $default = 'en-US') use ($matchAccept) |
|
| 97 | +{ |
|
| 95 | 98 | $supp = array(); |
| 96 | 99 | foreach ($supported as $lang => $isSupported) { |
| 97 | 100 | if ($isSupported) { |
@@ -24,7 +24,8 @@ |
||
| 24 | 24 | $minLongitude = $totalMinLon + $iLng * 0.5; |
| 25 | 25 | $maxLongitude = min($minLongitude + 0.5, $totalMaxLon); |
| 26 | 26 | |
| 27 | - if (0 == $manager->getSpawnpointCount($minLatitude, $maxLatitude, $minLongitude, $maxLongitude)->total) { //Skip empty areas |
|
| 27 | + if (0 == $manager->getSpawnpointCount($minLatitude, $maxLatitude, $minLongitude, $maxLongitude)->total) { |
|
| 28 | +//Skip empty areas |
|
| 28 | 29 | ++$iLng; |
| 29 | 30 | continue; |
| 30 | 31 | } |
@@ -90,7 +90,8 @@ |
||
| 90 | 90 | touch($pokedex_rarity_file); |
| 91 | 91 | // update pokedex rarity |
| 92 | 92 | include_once SYS_PATH.'/core/cron/pokedex_rarity.cron.php'; |
| 93 | -} elseif ((file_update_ago($nests_parks_file) >= 43200) && (time() - $migration >= 43200) && (time() - $migration < 86400)) { // extra update 12h after migration |
|
| 93 | +} elseif ((file_update_ago($nests_parks_file) >= 43200) && (time() - $migration >= 43200) && (time() - $migration < 86400)) { |
|
| 94 | +// extra update 12h after migration |
|
| 94 | 95 | if (is_file($nests_parks_file)) { |
| 95 | 96 | $prevNestTime = filemtime($nests_parks_file); |
| 96 | 97 | } else { |
@@ -60,7 +60,8 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | -function time_ago_day($timestamp, $locales) { |
|
| 63 | +function time_ago_day($timestamp, $locales) |
|
| 64 | +{ |
|
| 64 | 65 | $spawn = new DateTime($timestamp); |
| 65 | 66 | $now = new DateTime(); |
| 66 | 67 | |
@@ -215,11 +216,14 @@ discard block |
||
| 215 | 216 | //####################################################################### |
| 216 | 217 | function get_tree_at_depth($trees, $depth, $max_pokemon, $currentDepth = 0) |
| 217 | 218 | { |
| 218 | - if ($depth == $currentDepth) { // Found depth |
|
| 219 | + if ($depth == $currentDepth) { |
|
| 220 | +// Found depth |
|
| 219 | 221 | return tree_remove_bellow($trees, $max_pokemon); |
| 220 | - } else { // Go deeper |
|
| 222 | + } else { |
|
| 223 | +// Go deeper |
|
| 221 | 224 | $arr = array(); |
| 222 | - foreach ($trees as $temp) { // Go into all trees |
|
| 225 | + foreach ($trees as $temp) { |
|
| 226 | +// Go into all trees |
|
| 223 | 227 | $tree = $temp->evolutions; |
| 224 | 228 | $results = tree_remove_bellow(get_tree_at_depth($tree, $depth, $max_pokemon, $currentDepth + 1), $max_pokemon); |
| 225 | 229 | $arr = tree_check_array($results, $arr, 1 == $depth - $currentDepth); |
@@ -236,9 +240,12 @@ discard block |
||
| 236 | 240 | { |
| 237 | 241 | $count = count($array_check); |
| 238 | 242 | $i = 0; |
| 239 | - if (!is_null($array_check)) { // check if exists |
|
| 240 | - foreach ($array_check as $res) { // Check if above, equal or bellow center |
|
| 241 | - if (1 != $count && $correct_arrow) { // only add arrow once |
|
| 243 | + if (!is_null($array_check)) { |
|
| 244 | +// check if exists |
|
| 245 | + foreach ($array_check as $res) { |
|
| 246 | +// Check if above, equal or bellow center |
|
| 247 | + if (1 != $count && $correct_arrow) { |
|
| 248 | +// only add arrow once |
|
| 242 | 249 | $num = $i / ($count - 1); |
| 243 | 250 | if ($num < 0.5) { |
| 244 | 251 | $res->array_sufix = '_up'; |
@@ -267,7 +274,8 @@ discard block |
||
| 267 | 274 | return null; |
| 268 | 275 | } |
| 269 | 276 | $arr = array(); |
| 270 | - foreach ($tree as $item) { // Check if above, equal or bellow center |
|
| 277 | + foreach ($tree as $item) { |
|
| 278 | +// Check if above, equal or bellow center |
|
| 271 | 279 | if ($item->id <= $max_pokemon) { |
| 272 | 280 | $arr[] = $item; |
| 273 | 281 | } |
@@ -311,15 +319,18 @@ discard block |
||
| 311 | 319 | for ($i = 1; $i < $geos_count; ++$i) { |
| 312 | 320 | $geo1 = $geos[$i - 1]; |
| 313 | 321 | $geo2 = $geos[$i]; |
| 314 | - if ($geo1['lng'] == $lng && $geo1['lat'] == $lat) { // On one of the coords |
|
| 322 | + if ($geo1['lng'] == $lng && $geo1['lat'] == $lat) { |
|
| 323 | +// On one of the coords |
|
| 315 | 324 | return true; |
| 316 | 325 | } |
| 317 | - if ($geo1['lng'] == $geo2['lng'] and $geo1['lng'] == $lng and $lat > min($geo1['lat'], $geo2['lat']) and $lat < max($geo1['lat'], $geo2['lat'])) { // Check if point is on an horizontal polygon boundary |
|
| 326 | + if ($geo1['lng'] == $geo2['lng'] and $geo1['lng'] == $lng and $lat > min($geo1['lat'], $geo2['lat']) and $lat < max($geo1['lat'], $geo2['lat'])) { |
|
| 327 | +// Check if point is on an horizontal polygon boundary |
|
| 318 | 328 | return true; |
| 319 | 329 | } |
| 320 | 330 | if ($lng > min($geo1['lng'], $geo2['lng']) and $lng <= max($geo1['lng'], $geo2['lng']) and $lat <= max($geo1['lat'], $geo2['lat']) and $geo1['lng'] != $geo2['lng']) { |
| 321 | 331 | $xinters = ($lng - $geo1['lng']) * ($geo2['lat'] - $geo1['lat']) / ($geo2['lng'] - $geo1['lng']) + $geo1['lat']; |
| 322 | - if ($xinters == $lat) { // Check if point is on the polygon boundary (other than horizontal) |
|
| 332 | + if ($xinters == $lat) { |
|
| 333 | +// Check if point is on the polygon boundary (other than horizontal) |
|
| 323 | 334 | return true; |
| 324 | 335 | } |
| 325 | 336 | if ($geo1['lat'] == $geo2['lat'] || $lat <= $xinters) { |