@@ -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 { |
@@ -199,11 +199,14 @@ discard block |
||
| 199 | 199 | //####################################################################### |
| 200 | 200 | function get_tree_at_depth($trees, $depth, $max_pokemon, $currentDepth = 0) |
| 201 | 201 | { |
| 202 | - if ($depth == $currentDepth) { // Found depth |
|
| 202 | + if ($depth == $currentDepth) { |
|
| 203 | +// Found depth |
|
| 203 | 204 | return tree_remove_bellow($trees, $max_pokemon); |
| 204 | - } else { // Go deeper |
|
| 205 | + } else { |
|
| 206 | +// Go deeper |
|
| 205 | 207 | $arr = array(); |
| 206 | - foreach ($trees as $temp) { // Go into all trees |
|
| 208 | + foreach ($trees as $temp) { |
|
| 209 | +// Go into all trees |
|
| 207 | 210 | $tree = $temp->evolutions; |
| 208 | 211 | $results = tree_remove_bellow(get_tree_at_depth($tree, $depth, $max_pokemon, $currentDepth + 1), $max_pokemon); |
| 209 | 212 | $arr = tree_check_array($results, $arr, 1 == $depth - $currentDepth); |
@@ -220,9 +223,12 @@ discard block |
||
| 220 | 223 | { |
| 221 | 224 | $count = count($array_check); |
| 222 | 225 | $i = 0; |
| 223 | - if (!is_null($array_check)) { // check if exists |
|
| 224 | - foreach ($array_check as $res) { // Check if above, equal or bellow center |
|
| 225 | - if (1 != $count && $correct_arrow) { // only add arrow once |
|
| 226 | + if (!is_null($array_check)) { |
|
| 227 | +// check if exists |
|
| 228 | + foreach ($array_check as $res) { |
|
| 229 | +// Check if above, equal or bellow center |
|
| 230 | + if (1 != $count && $correct_arrow) { |
|
| 231 | +// only add arrow once |
|
| 226 | 232 | $num = $i / ($count - 1); |
| 227 | 233 | if ($num < 0.5) { |
| 228 | 234 | $res->array_sufix = '_up'; |
@@ -251,7 +257,8 @@ discard block |
||
| 251 | 257 | return null; |
| 252 | 258 | } |
| 253 | 259 | $arr = array(); |
| 254 | - foreach ($tree as $item) { // Check if above, equal or bellow center |
|
| 260 | + foreach ($tree as $item) { |
|
| 261 | +// Check if above, equal or bellow center |
|
| 255 | 262 | if ($item->id <= $max_pokemon) { |
| 256 | 263 | $arr[] = $item; |
| 257 | 264 | } |
@@ -295,15 +302,18 @@ discard block |
||
| 295 | 302 | for ($i = 1; $i < $geos_count; ++$i) { |
| 296 | 303 | $geo1 = $geos[$i - 1]; |
| 297 | 304 | $geo2 = $geos[$i]; |
| 298 | - if ($geo1['lng'] == $lng && $geo1['lat'] == $lat) { // On one of the coords |
|
| 305 | + if ($geo1['lng'] == $lng && $geo1['lat'] == $lat) { |
|
| 306 | +// On one of the coords |
|
| 299 | 307 | return true; |
| 300 | 308 | } |
| 301 | - 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 |
|
| 309 | + if ($geo1['lng'] == $geo2['lng'] and $geo1['lng'] == $lng and $lat > min($geo1['lat'], $geo2['lat']) and $lat < max($geo1['lat'], $geo2['lat'])) { |
|
| 310 | +// Check if point is on an horizontal polygon boundary |
|
| 302 | 311 | return true; |
| 303 | 312 | } |
| 304 | 313 | 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']) { |
| 305 | 314 | $xinters = ($lng - $geo1['lng']) * ($geo2['lat'] - $geo1['lat']) / ($geo2['lng'] - $geo1['lng']) + $geo1['lat']; |
| 306 | - if ($xinters == $lat) { // Check if point is on the polygon boundary (other than horizontal) |
|
| 315 | + if ($xinters == $lat) { |
|
| 316 | +// Check if point is on the polygon boundary (other than horizontal) |
|
| 307 | 317 | return true; |
| 308 | 318 | } |
| 309 | 319 | if ($geo1['lat'] == $geo2['lat'] || $lat <= $xinters) { |