@@ -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 | } ?> |
@@ -172,47 +172,47 @@ |
||
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | function get_depth($arr) { |
| 175 | - $it = new RecursiveIteratorIterator(new RecursiveArrayIterator($arr)); |
|
| 176 | - $depth = 0; |
|
| 177 | - foreach ( $it as $v ) { |
|
| 178 | - $it->getDepth() > $depth and $depth = $it->getDepth(); |
|
| 179 | - } |
|
| 180 | - return $depth; |
|
| 175 | + $it = new RecursiveIteratorIterator(new RecursiveArrayIterator($arr)); |
|
| 176 | + $depth = 0; |
|
| 177 | + foreach ( $it as $v ) { |
|
| 178 | + $it->getDepth() > $depth and $depth = $it->getDepth(); |
|
| 179 | + } |
|
| 180 | + return $depth; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | function get_tree_at_depth($trees, $depth, $max_pokemon, $currentDepth = 0) { |
| 184 | 184 | |
| 185 | - if ($depth == $currentDepth) { |
|
| 186 | - return $trees; |
|
| 187 | - } else { |
|
| 188 | - foreach ($trees as $temp) { |
|
| 189 | - $tree = $temp->evolutions; |
|
| 190 | - $resultsTemp = get_tree_at_depth($tree, $depth, $max_pokemon, $currentDepth + 1); |
|
| 191 | - $results; |
|
| 192 | - foreach ($resultsTemp as $res) { |
|
| 193 | - if ($res->id <= $max_pokemon) { |
|
| 194 | - $results[] = $res; |
|
| 195 | - } |
|
| 196 | - } |
|
| 197 | - if (is_null($results)) { |
|
| 198 | - return null; |
|
| 199 | - } |
|
| 200 | - $count = count($results); |
|
| 201 | - $i = 0; |
|
| 202 | - foreach ($results as $res) { |
|
| 203 | - if ($count != 1) { |
|
| 204 | - $num = $i / ($count-1); |
|
| 205 | - if ($num < 0.5) { |
|
| 206 | - $res->array_sufix = "_up"; |
|
| 207 | - } elseif ($num > 0.5) { |
|
| 208 | - $res->array_sufix = "_down"; |
|
| 209 | - } |
|
| 210 | - } |
|
| 211 | - $arr[] = $res; |
|
| 212 | - $i++; |
|
| 213 | - } |
|
| 214 | - } |
|
| 215 | - return $arr; |
|
| 216 | - } |
|
| 185 | + if ($depth == $currentDepth) { |
|
| 186 | + return $trees; |
|
| 187 | + } else { |
|
| 188 | + foreach ($trees as $temp) { |
|
| 189 | + $tree = $temp->evolutions; |
|
| 190 | + $resultsTemp = get_tree_at_depth($tree, $depth, $max_pokemon, $currentDepth + 1); |
|
| 191 | + $results; |
|
| 192 | + foreach ($resultsTemp as $res) { |
|
| 193 | + if ($res->id <= $max_pokemon) { |
|
| 194 | + $results[] = $res; |
|
| 195 | + } |
|
| 196 | + } |
|
| 197 | + if (is_null($results)) { |
|
| 198 | + return null; |
|
| 199 | + } |
|
| 200 | + $count = count($results); |
|
| 201 | + $i = 0; |
|
| 202 | + foreach ($results as $res) { |
|
| 203 | + if ($count != 1) { |
|
| 204 | + $num = $i / ($count-1); |
|
| 205 | + if ($num < 0.5) { |
|
| 206 | + $res->array_sufix = "_up"; |
|
| 207 | + } elseif ($num > 0.5) { |
|
| 208 | + $res->array_sufix = "_down"; |
|
| 209 | + } |
|
| 210 | + } |
|
| 211 | + $arr[] = $res; |
|
| 212 | + $i++; |
|
| 213 | + } |
|
| 214 | + } |
|
| 215 | + return $arr; |
|
| 216 | + } |
|
| 217 | 217 | |
| 218 | 218 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | function get_depth($arr) { |
| 175 | 175 | $it = new RecursiveIteratorIterator(new RecursiveArrayIterator($arr)); |
| 176 | 176 | $depth = 0; |
| 177 | - foreach ( $it as $v ) { |
|
| 177 | + foreach ($it as $v) { |
|
| 178 | 178 | $it->getDepth() > $depth and $depth = $it->getDepth(); |
| 179 | 179 | } |
| 180 | 180 | return $depth; |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | $i = 0; |
| 202 | 202 | foreach ($results as $res) { |
| 203 | 203 | if ($count != 1) { |
| 204 | - $num = $i / ($count-1); |
|
| 204 | + $num = $i / ($count - 1); |
|
| 205 | 205 | if ($num < 0.5) { |
| 206 | 206 | $res->array_sufix = "_up"; |
| 207 | 207 | } 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,7 +181,8 @@ discard block |
||
| 180 | 181 | return $depth; |
| 181 | 182 | } |
| 182 | 183 | |
| 183 | -function get_tree_at_depth($trees, $depth, $max_pokemon, $currentDepth = 0) { |
|
| 184 | +function get_tree_at_depth($trees, $depth, $max_pokemon, $currentDepth = 0) |
|
| 185 | +{ |
|
| 184 | 186 | |
| 185 | 187 | if ($depth == $currentDepth) { |
| 186 | 188 | return $trees; |