@@ -139,8 +139,8 @@ discard block |
||
| 139 | 139 | <a href="https://maps.google.com/?q=<?= $pokemon->last_raid_position->latitude ?>,<?= $pokemon->last_raid_position->longitude ?>&ll=<?= $pokemon->last_raid_position->latitude ?>,<?= $pokemon->last_raid_position->longitude ?>&z=16" target="_blank"><?= time_ago($pokemon->last_raid_seen, $locales) ?></a> |
| 140 | 140 | |
| 141 | 141 | <?php } else { |
| 142 | - echo $locales->NEVER; |
|
| 143 | - }?> |
|
| 142 | + echo $locales->NEVER; |
|
| 143 | + }?> |
|
| 144 | 144 | |
| 145 | 145 | </td> |
| 146 | 146 | </tr> |
@@ -262,29 +262,29 @@ discard block |
||
| 262 | 262 | <!-- Tree --> |
| 263 | 263 | |
| 264 | 264 | <?php |
| 265 | - $tree = array($pokemon->tree); |
|
| 266 | - $depth = (get_depth($tree)+1)/2; |
|
| 267 | - ?> |
|
| 265 | + $tree = array($pokemon->tree); |
|
| 266 | + $depth = (get_depth($tree)+1)/2; |
|
| 267 | + ?> |
|
| 268 | 268 | |
| 269 | 269 | <h3 class="col-md-12 text-center sub-title"><strong><?= $locales->POKEMON_EVOLUTIONS ?></strong></h3> |
| 270 | 270 | <div class="col-md-12 flex-container results"> |
| 271 | 271 | |
| 272 | 272 | <?php |
| 273 | - for ($i = 0; $i < $depth * 2 - 1; $i++) { |
|
| 274 | - $i_id = intval(($i+1)/2); |
|
| 275 | - $data = get_tree_at_depth($tree, $i_id, $config->system->max_pokemon); |
|
| 276 | - ?> |
|
| 273 | + for ($i = 0; $i < $depth * 2 - 1; $i++) { |
|
| 274 | + $i_id = intval(($i+1)/2); |
|
| 275 | + $data = get_tree_at_depth($tree, $i_id, $config->system->max_pokemon); |
|
| 276 | + ?> |
|
| 277 | 277 | |
| 278 | 278 | |
| 279 | 279 | <?php |
| 280 | - if (!is_null($data)) { ?> |
|
| 280 | + if (!is_null($data)) { ?> |
|
| 281 | 281 | <div class="col-md-12 flex-item"> |
| 282 | 282 | <?php foreach ($data as $obj) { |
| 283 | - $obj_id = $obj->id; |
|
| 284 | - $tree_pokemon = $pokemons->pokemon->$obj_id; |
|
| 285 | - $link = "/pokemon/" . $obj_id; |
|
| 283 | + $obj_id = $obj->id; |
|
| 284 | + $tree_pokemon = $pokemons->pokemon->$obj_id; |
|
| 285 | + $link = "/pokemon/" . $obj_id; |
|
| 286 | 286 | |
| 287 | - if ($i%2 == 0) { ?> |
|
| 287 | + if ($i%2 == 0) { ?> |
|
| 288 | 288 | |
| 289 | 289 | <div> |
| 290 | 290 | <a href="<?= $link ?>"><img src="<?= $tree_pokemon->img ?>" alt="<?= $tree_pokemon->name ?>" class="img"></a> |
@@ -297,17 +297,17 @@ discard block |
||
| 297 | 297 | <img src="core/img/arrow<?=$obj->array_sufix?>.png" alt="Arrow" class="img"> |
| 298 | 298 | <p class="pkmn-name"> |
| 299 | 299 | <?php echo $obj->candies . ' ' . $locales->POKEMON_CANDIES; |
| 300 | - if (!is_null($obj->item)) { |
|
| 301 | - $itemName = 'ITEM_' . $obj->item; |
|
| 302 | - echo '<br>+ ' . $locales->$itemName; |
|
| 303 | - } else { |
|
| 304 | - echo '<br> </br>'; |
|
| 305 | - } ?> |
|
| 300 | + if (!is_null($obj->item)) { |
|
| 301 | + $itemName = 'ITEM_' . $obj->item; |
|
| 302 | + echo '<br>+ ' . $locales->$itemName; |
|
| 303 | + } else { |
|
| 304 | + echo '<br> </br>'; |
|
| 305 | + } ?> |
|
| 306 | 306 | </p> |
| 307 | 307 | </div> |
| 308 | 308 | <?php |
| 309 | - } |
|
| 310 | - } ?> |
|
| 309 | + } |
|
| 310 | + } ?> |
|
| 311 | 311 | </div> |
| 312 | 312 | <?php } ?> |
| 313 | 313 | |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | |
| 264 | 264 | <?php |
| 265 | 265 | $tree = array($pokemon->tree); |
| 266 | - $depth = (get_depth($tree)+1)/2; |
|
| 266 | + $depth = (get_depth($tree) + 1) / 2; |
|
| 267 | 267 | ?> |
| 268 | 268 | |
| 269 | 269 | <h3 class="col-md-12 text-center sub-title"><strong><?= $locales->POKEMON_EVOLUTIONS ?></strong></h3> |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | |
| 272 | 272 | <?php |
| 273 | 273 | for ($i = 0; $i < $depth * 2 - 1; $i++) { |
| 274 | - $i_id = intval(($i+1)/2); |
|
| 274 | + $i_id = intval(($i + 1) / 2); |
|
| 275 | 275 | $data = get_tree_at_depth($tree, $i_id, $config->system->max_pokemon); |
| 276 | 276 | ?> |
| 277 | 277 | |
@@ -282,9 +282,9 @@ discard block |
||
| 282 | 282 | <?php foreach ($data as $obj) { |
| 283 | 283 | $obj_id = $obj->id; |
| 284 | 284 | $tree_pokemon = $pokemons->pokemon->$obj_id; |
| 285 | - $link = "/pokemon/" . $obj_id; |
|
| 285 | + $link = "/pokemon/".$obj_id; |
|
| 286 | 286 | |
| 287 | - if ($i%2 == 0) { ?> |
|
| 287 | + if ($i % 2 == 0) { ?> |
|
| 288 | 288 | |
| 289 | 289 | <div> |
| 290 | 290 | <a href="<?= $link ?>"><img src="<?= $tree_pokemon->img ?>" alt="<?= $tree_pokemon->name ?>" class="img"></a> |
@@ -296,10 +296,10 @@ discard block |
||
| 296 | 296 | <div id="tree_cell"> |
| 297 | 297 | <img src="core/img/arrow<?=$obj->array_sufix?>.png" alt="Arrow" class="img"> |
| 298 | 298 | <p class="pkmn-name"> |
| 299 | - <?php echo $obj->candies . ' ' . $locales->POKEMON_CANDIES; |
|
| 299 | + <?php echo $obj->candies.' '.$locales->POKEMON_CANDIES; |
|
| 300 | 300 | if (!is_null($obj->item)) { |
| 301 | - $itemName = 'ITEM_' . $obj->item; |
|
| 302 | - echo '<br>+ ' . $locales->$itemName; |
|
| 301 | + $itemName = 'ITEM_'.$obj->item; |
|
| 302 | + echo '<br>+ '.$locales->$itemName; |
|
| 303 | 303 | } else { |
| 304 | 304 | echo '<br> </br>'; |
| 305 | 305 | } ?> |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | $tree = $temp->evolutions; |
| 190 | 190 | $resultsTemp = get_tree_at_depth($tree, $depth, $max_pokemon, $currentDepth + 1); |
| 191 | 191 | if (is_null($resultsTemp)) { // Woops |
| 192 | - return null; |
|
| 192 | + return null; |
|
| 193 | 193 | } |
| 194 | 194 | $results = $arr = array(); |
| 195 | 195 | foreach ($resultsTemp as $res) { // Remove all above max_pokemon |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | if (is_null($results)) { // Not in current gen |
| 201 | - return null; |
|
| 201 | + return null; |
|
| 202 | 202 | } |
| 203 | 203 | $count = count($results); |
| 204 | 204 | $i = 0; |
@@ -204,7 +204,7 @@ |
||
| 204 | 204 | $i = 0; |
| 205 | 205 | foreach ($results as $res) { // Check if above, equal or bellow center |
| 206 | 206 | if ($count != 1) { |
| 207 | - $num = $i / ($count-1); |
|
| 207 | + $num = $i / ($count - 1); |
|
| 208 | 208 | if ($num < 0.5) { |
| 209 | 209 | $res->array_sufix = "_up"; |
| 210 | 210 | } elseif ($num > 0.5) { |
@@ -171,7 +171,8 @@ discard block |
||
| 171 | 171 | return $gym_level; |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | -function get_depth($arr) { |
|
| 174 | +function get_depth($arr) |
|
| 175 | +{ |
|
| 175 | 176 | $it = new RecursiveIteratorIterator(new RecursiveArrayIterator($arr)); |
| 176 | 177 | $depth = 0; |
| 177 | 178 | foreach ($it as $v) { |
@@ -180,29 +181,37 @@ discard block |
||
| 180 | 181 | return $depth; |
| 181 | 182 | } |
| 182 | 183 | |
| 183 | -function get_tree_at_depth($trees, $depth, $max_pokemon, $currentDepth = 0) { |
|
| 184 | - if ($depth == $currentDepth) { // Found depth |
|
| 184 | +function get_tree_at_depth($trees, $depth, $max_pokemon, $currentDepth = 0) |
|
| 185 | +{ |
|
| 186 | + if ($depth == $currentDepth) { |
|
| 187 | +// Found depth |
|
| 185 | 188 | return $trees; |
| 186 | - } else { // Go deeper |
|
| 189 | + } else { |
|
| 190 | +// Go deeper |
|
| 187 | 191 | $arr = array(); |
| 188 | - foreach ($trees as $temp) { // Go into all trees |
|
| 192 | + foreach ($trees as $temp) { |
|
| 193 | +// Go into all trees |
|
| 189 | 194 | $tree = $temp->evolutions; |
| 190 | 195 | $resultsTemp = get_tree_at_depth($tree, $depth, $max_pokemon, $currentDepth + 1); |
| 191 | - if (is_null($resultsTemp)) { // Woops |
|
| 196 | + if (is_null($resultsTemp)) { |
|
| 197 | +// Woops |
|
| 192 | 198 | return null; |
| 193 | 199 | } |
| 194 | 200 | $results = $arr = array(); |
| 195 | - foreach ($resultsTemp as $res) { // Remove all above max_pokemon |
|
| 201 | + foreach ($resultsTemp as $res) { |
|
| 202 | +// Remove all above max_pokemon |
|
| 196 | 203 | if ($res->id <= $max_pokemon) { |
| 197 | 204 | $results[] = $res; |
| 198 | 205 | } |
| 199 | 206 | } |
| 200 | - if (is_null($results)) { // Not in current gen |
|
| 207 | + if (is_null($results)) { |
|
| 208 | +// Not in current gen |
|
| 201 | 209 | return null; |
| 202 | 210 | } |
| 203 | 211 | $count = count($results); |
| 204 | 212 | $i = 0; |
| 205 | - foreach ($results as $res) { // Check if above, equal or bellow center |
|
| 213 | + foreach ($results as $res) { |
|
| 214 | +// Check if above, equal or bellow center |
|
| 206 | 215 | if ($count != 1) { |
| 207 | 216 | $num = $i / ($count-1); |
| 208 | 217 | if ($num < 0.5) { |