Failed Conditions
Pull Request — master (#326)
by
unknown
02:34
created

pages/pokemon.page.php (7 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<!-- Header -->
2
<header id="single-header">
3
4
	<!-- Breadcrumb -->
5
	<div class="row">
6
		<div class="col-md-12">
7
			<ol class="breadcrumb">
8
				<li><a href="<?= HOST_URL ?>"><?= $locales->HOME ?></a></li>
9
				<li><a href="pokemon"><?= $locales->NAV_POKEDEX ?></a></li>
10
				<li class="active"><?= $pokemon->name ?></li>
11
			</ol>
12
		</div>
13
	</div>
14
	<!-- /Breadcrumb -->
15
16
	<div class="row">
17
18
		<div class="col-sm-1 hidden-xs">
19
20
				<?php if ($pokemon->id - 1 > 0) { ?>
21
22
				<p class="nav-links"><a href="pokemon/<?= $pokemon->id - 1 ?>"><i class="fa fa-chevron-left"></i></a></p>
23
24
				<?php }?>
25
26
		</div>
27
28
		<div class="col-sm-10 text-center">
29
30
			<h1>#<?= sprintf('%03d <strong>%s</strong>', $pokemon->id, $pokemon->name) ?><br>
31
			<small>[<?= $pokemon->rarity ?>]</small></h1>
32
33
			<p id="share">
34
				<a href="https://www.facebook.com/sharer/sharer.php?u=<?= HOST_URL ?>pokemon/<?= $pokemon->id ?>" target="_blank" class="btn btn-primary" title="<?php printf($locales->SHARE, "Facebook") ?>" ><?php printf($locales->SHARE, "") ?> <i class="fa fa-facebook" aria-hidden="true"></i></a>
35
36
				<a href="https://twitter.com/intent/tweet?source=<?= HOST_URL ?>pokemon/<?= $pokemon_id ?>&text=Find%20<?= $pokemon->name ?>%20in:%20<?= $config->infos->city ?>%20<?= HOST_URL ?>pokemon/<?= $pokemon->id ?>" target="_blank" title="<?php printf($locales->SHARE, "Twitter") ?>" class="btn btn-info"><?php printf($locales->SHARE, "") ?> <i class="fa fa-twitter" aria-hidden="true"></i></a>
37
			</p>
38
39
		</div>
40
41
42
		<div class="col-sm-1 hidden-xs">
43
44
			<?php if ($pokemon->id + 1 < $config->system->max_pokemon) { ?>
45
46
			<p class="nav-links"><a href="pokemon/<?= $pokemon->id + 1 ?>"><i class="fa fa-chevron-right"></i></a></p>
47
48
			<?php } ?>
49
		</div>
50
51
	</div>
52
<?php
53
	$form_array = array("Unset", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "W", "X", "Y", "Z");
54
	$form_array = array_values($form_array);
55
	?>
56
57
</header>
58
<!-- /Header -->
59
60
61
<div class="row">
62
	<div class="col-md-2 col-xs-4">
63
		<div id="poke-img" style="padding-top:15px;margin-bottom:1em;">
64
			<img class="media-object img-responsive" src="<?= $pokemon->img ?>" alt="<?= $pokemon->name ?> model" >
65
		</div>
66
	</div>
67
68
	<div class="col-md-4 col-xs-8" style="margin-bottom:1em;">
69
70
		<div class="media">
71
			<div class="media-body" style="padding-top:25px;">
72
73
				<p><?= $pokemon->description ?></p>
74
75
				<p>
76
				<?php foreach ($pokemon->types as $type) { ?>
77
					<span class="label label-default" style="background-color:<?= $pokemons->typecolors->$type ?>"><?= $type ?></span>
78
				<?php }?>
79
				</p>
80
81
			</div>
82
		</div>
83
84
	</div>
85
86
	<div class="col-md-6" style="padding-top:10px;">
87
		<canvas id="spawn_chart" width="100%" height="40"></canvas>
88
	</div>
89
90
</div>
91
92
93
94
<div class="row">
95
	<div class="col-md-6" style="padding-top:10px;">
96
97
		<table class="table">
98
			<tr>
99
				<td class="col-md-8 col-xs-8"><strong><?= $locales->POKEMON_SEEN ?> :</strong></td>
100
				<td class="col-md-4 col-xs-4">
101
102 View Code Duplication
				<?php if (isset($pokemon->last_position)) { ?>
103
104
					<a href="https://maps.google.com/?q=<?= $pokemon->last_position->latitude ?>,<?= $pokemon->last_position->longitude ?>&ll=<?= $pokemon->last_position->latitude ?>,<?= $pokemon->last_position->longitude ?>&z=16" target="_blank"><?= time_ago($pokemon->last_seen, $locales) ?></a>
105
106
				<?php } else {
107
					echo $locales->NEVER;
108
				}?>
0 ignored issues
show
Closing brace indented incorrectly; expected 0 spaces, found 16
Loading history...
109
110
				</td>
111
			</tr>
112
			<tr>
113
				<td class="col-md-8 col-xs-8"><strong><?= $locales->POKEMON_AMOUNT ?> :</strong></td>
114
				<td class="col-md-4 col-xs-4"><?= $pokemon->spawn_count ?> <?= $locales->SEEN ?></td>
115
			</tr>
116
			<tr>
117
				<td class="col-md-8 col-xs-8"><strong><?= $locales->POKEMON_RATE ?> :</strong></td>
118
				<td class="col-md-4 col-xs-4"><?= $pokemon->spawns_per_day ?> / <?= $locales->DAY ?></td>
119
			</tr>
120
			<tr>
121
				<td class="col-md-8 col-xs-8"><?php if (isset($pokemon->protected_gyms)) {
122
					echo "<strong>".$locales->POKEMON_GYM.$pokemon->name."</strong> :";
123
				} ?></td>
0 ignored issues
show
Closing brace indented incorrectly; expected 0 spaces, found 16
Loading history...
124
				<td class="col-md-4 col-xs-4"><?php if (isset($pokemon->protected_gyms)) {
125
					echo $pokemon->protected_gyms;
126
				}?></td>
0 ignored issues
show
Closing brace indented incorrectly; expected 0 spaces, found 16
Loading history...
127
			</tr>
128
		</table>
129
		</div>
130
131
		<div class="col-md-6" style="padding-top:10px;">
132
		<table class="table">
133
			<tr>
134
				<td class="col-md-8 col-xs-8"><strong><?= $locales->POKEMON_RAID_SEEN ?> :</strong></td>
135
				<td class="col-md-4 col-xs-4">
136
137 View Code Duplication
					<?php if (isset($pokemon->last_raid_position)) { ?>
138
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
141
					<?php } else {
142
						echo $locales->NEVER;
143
					}?>
0 ignored issues
show
Closing brace indented incorrectly; expected 0 spaces, found 20
Loading history...
144
145
				</td>
146
			</tr>
147
			<tr>
148
				<td class="col-md-8 col-xs-8"><strong><?= $locales->POKEMON_RAID_AMOUNT ?> :</strong></td>
149
				<td class="col-md-4 col-xs-4"><?= $pokemon->raid_count ?> <?= $locales->SEEN ?></td>
150
			</tr>
151
			<tr>
152
				<td class="col-md-8 col-xs-8"><strong><?= $locales->POKEMON_QUICK ?> :</strong></td>
153
				<td class="col-md-4 col-xs-4"><?= $pokemon->quick_move ?></td>
154
			</tr>
155
			<tr>
156
				<td class="col-md-8 col-xs-8"><strong><?= $locales->POKEMON_SPECIAL ?> :</strong> </td>
157
				<td class="col-md-4 col-xs-4"><?= $pokemon->charge_move ?></td>
158
			</tr>
159
160
		</table>
161
162
	</div>
163
</div>
164
165
166
167
<div class="row area text-center subnav">
168
	<div class="btn-group" role="group">
169
		<a class="btn btn-default page-scroll" href="pokemon/<?= $pokemon->id ?>#where"><i class="fa fa-map-marker"></i> <?= $locales->POKEMON_MAP ?></a>
170
		<a class="btn btn-default page-scroll" href="pokemon/<?= $pokemon->id ?>#stats"><i class="fa fa-pie-chart"></i> <?= $locales->POKEMON_STATS ?></a>
171
		<a class="btn btn-default page-scroll" href="pokemon/<?= $pokemon->id ?>#family"><i class="fa fa-share-alt"></i> <?= $locales->POKEMON_FAMILY ?></a>
172
		<a class="btn btn-default page-scroll" href="pokemon/<?= $pokemon->id ?>#top50"><i class="fa fa-list"></i> Top50</a>
173
		<a class="btn btn-default page-scroll" href="pokemon/<?= $pokemon->id ?>#trainer"><i class="fa fa-users"></i> <?= $locales->TRAINERS ?></a>
174
	</div>
175
</div>
176
177
178
179
180
<div class="row" id="where">
181
182
	<div class="col-md-12">
183
184
		<h2 class="text-center sub-title"><?= $locales->POKEMON_WHERE ?> <?= $pokemon->name ?>?</h2>
185
186
	</div>
187
</div>
188
<div class="row text-center subnav">
189
	<div class="btn-group" role="group">
190
		<a class="btn btn-default active" id="heatmapSelector"><i class="fa fa-thermometer-three-quarters"></i> <?= $locales->POKEMON_HEATMAP_BUTTON ?></a>
191
		<a class="btn btn-default " id="liveSelector"><i class="fa fa-eye"></i> <?= $locales->POKEMON_LIVE_BUTTON ?></a>
192
	</div>
193
</div>
194
<div class="row" style="margin-bottom:20px">
195
	<div class="col-md-12" id="timeFilterContainer">
196
		<div id="timeSelector">
197
		</div>
198
	</div>
199
	<div class="col-md-12" id="liveFilterContainer">
200
		<div id="liveFilterSelector">
201
		</div>
202
	</div>
203
	<div class="col-md-12 text-center" id="loaderContainer">
204
		<h3><?= $locales->LOADING ?></h3>
205
	</div>
206
</div>
207
<div class="row area">
208
	<div class="col-md-12">
209
		<div id="map">
210
		</div>
211
	</div>
212
</div>
213
214
215
216
217
<div class="row area" id="stats">
218
219
	<h2 class="text-center sub-title"><strong><?= $pokemon->name ?> </strong><?= $locales->POKEMON_BREAKDOWN ?></h2>
220
221
	<!-- Rating -->
222
	<p class="text-center stats-data"><big><?= $pokemon->rating ?> / 10</big><br><?= $locales->POKEMON_RATING ?></p>
223
224
	<!-- CP Datas -->
225
	<div class="col-md-3 stats-data">
226
227
		<p><big><?= $pokemon->max_cp ?></big><br/><?= $locales->POKEMON_CP ?></p>
228
229
		<div class="progress" style="margin-bottom:0;">
230
			<div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="<?= $pokemon->max_cp_percent ?>" aria-valuemin="0" aria-valuemax="100" style="width: <?= $pokemon->max_cp_percent ?>%;min-width:30%;">
231
				<?= $pokemon->max_cp_percent ?> %
232
			</div>
233
		</div>
234
235
		<?= $locales->POKEMON_COMPGAME ?>
236
237
	</div>
238
239
	<!-- Chart -->
240
	<div class="col-md-6">
241
242
		<canvas id="polar_chart" width="100%" height="60"></canvas>
243
244
	</div>
245
	<!-- /Chart -->
246
247
	<!-- PV Datas -->
248
	<div class="col-md-3 stats-data">
249
250
		<p><big><?= $pokemon->max_hp ?></big><br/><?= $locales->POKEMON_HP ?></p>
251
252
		<div class="progress" style="margin-bottom:0;">
253
			<div class="progress-bar progress-bar-success progress-bar-striped active" role="progressbar" aria-valuenow="<?= $pokemon->max_hp_percent ?>" aria-valuemin="0" aria-valuemax="100" style="width: <?= $pokemon->max_hp_percent ?>%;min-width:30%;">
254
				<?= $pokemon->max_hp_percent ?> %
255
			</div>
256
		</div>
257
258
		<?= $locales->POKEMON_COMPGAME ?>
259
260
	</div>
261
262
	<!-- Tree -->
263
	
264
	<?php
265
	$tree = array($pokemon->tree);
266
    $depth = get_depth($tree);
267
    ?>
268
269
	<h3 class="col-md-12 text-center sub-title"><strong><?= $locales->POKEMON_EVOLUTIONS ?></strong></h3>
270
	<div class="col-md-12 flex-container results">
271
272
		<?php
273
        $skip = false;
274
		for ($i = 0; $i < $depth; $i++) {
275
			$i_id = intval(($i+1)/2);
276
			$data = get_tree_at_depth($tree, $i_id, $config->system->max_pokemon);
277
			?>
278
279
			<?php
280
			if (!is_null($data) && sizeof($data) != 0 && !$skip) { ?>
281
				<div class="col-md-12 flex-item">
282
					<?php foreach ($data as $obj) {
283
						$obj_id = $obj->id;
284
						$tree_pokemon = $pokemons->pokemon->$obj_id;
285
						$link = "/pokemon/" . $obj_id;
286
287
						if ($i%2 == 0) { ?>
288
289
							<div>
290
								<a href="<?= $link ?>"><img src="<?= $tree_pokemon->img ?>" alt="<?= $tree_pokemon->name ?>" class="img"></a>
291
								<p class="pkmn-name"><a href="<?= $link ?>">#<?= sprintf('%03d<br>%s', $tree_pokemon->id, $tree_pokemon->name) ?></a></p>
292
							</div>
293
294
						<?php } else { ?>
0 ignored issues
show
Closing brace indented incorrectly; expected 24 spaces, found 0
Loading history...
295
296
							<div id="tree_cell">
297
								<img src="core/img/arrow<?=$obj->array_sufix?>.png" alt="Arrow" class="img">
298
								<p class="pkmn-name">
299
									<?php
300
									echo $obj->candies . ' ' . $locales->POKEMON_CANDIES;
301
									if (!is_null($obj->item)) {
302
										$itemName = 'ITEM_' . $obj->item;
303
										echo '<br>+ ' . $locales->$itemName;
304
									} elseif (!is_null($obj->info)) {
305
                                        $infoName = 'INFO_' . $obj->info;
306
                                        echo '<br>(' . $locales->$infoName . ')';
307
                                    }
308
									else {
309
										echo '<br> </br>';
310
									}
311
									?>
312
								</p>
313
							</div>
314
						<?php
315
						}
0 ignored issues
show
Closing brace indented incorrectly; expected 0 spaces, found 24
Loading history...
316
					}
0 ignored issues
show
Closing brace indented incorrectly; expected 0 spaces, found 20
Loading history...
317
					?>
318
                </div>
319
            <?php
320
            } elseif ($skip) {
321
                $skip = false;
322
            } else {
323
                $skip = true;
324
            }
325
		}
326
		?>
327
	</div>
328
</div>
329
330
331
<div class="row area" id="family">
332
333
	<div class="col-md-12">
334
335
		<h2 class="text-center sub-title"><strong><?= $pokemon->name ?></strong><?= $locales->POKEMON_FAMILYTITLE ?></h2>
336
337
		<div class="row">
338
339
		<?php
340
341
		foreach ($related as $related_mon) {
342
			?>
343
344
			<div class="col-md-1 col-sm-2 col-xs-3 pokemon-single">
345
346
				<a href="pokemon/<?= $related_mon ?>">
347
					<img src="<?= $pokemons->pokemon->$related_mon->img ?>" alt="<?= $pokemons->pokemon->$related_mon->name ?>" class="img-responsive">
348
				</a>
349
350
			</div>
351
352
353
			<?php
354
		}
355
356
		?>
357
358
		</div>
359
360
	</div>
361
362
</div>
363
364
365
<?php if (!empty($top)) { ?>
366
	<div class="row area" id="top50">
367
		<div class="col-md-12">
368
			<h2 class="text-center sub-title">Top 50 <strong><?= $pokemon->name ?></strong></h2>
369
			<table class="table">
370
				<thead>
371
					<tr>
372
						<th>#</th>
373
						<th><a href="pokemon/<?= $pokemon->id ?>?order=cp<?php echo $best_order == 'cp' && !isset($_GET['direction']) ? '&direction=desc' : ''; ?>#top50">CP <i class="fa fa-sort" aria-hidden="true"></i></a></th>
374
						<th><a href="pokemon/<?= $pokemon->id ?>?order=IV<?php echo $top_order == 'IV' && !isset($_GET['direction']) ? '&direction=desc' : ''; ?>#top50">IV <i class="fa fa-sort" aria-hidden="true"></i></a></th>
375
						<th><a href="pokemon/<?= $pokemon->id ?>?order=individual_attack<?php echo $top_order == 'individual_attack' && !isset($_GET['direction']) ? '&direction=desc' : ''; ?>#top50"><?= $locales->POKEMON_TABLE_ATTACK ?> <i class="fa fa-sort" aria-hidden="true"></i></a></th>
376
						<th><a href="pokemon/<?= $pokemon->id ?>?order=individual_defense<?php echo $top_order == 'individual_defense' && !isset($_GET['direction']) ? '&direction=desc' : ''; ?>#top50"><?= $locales->POKEMON_TABLE_DEFENSE ?> <i class="fa fa-sort" aria-hidden="true"></i></a></th>
377
						<th><a href="pokemon/<?= $pokemon->id ?>?order=individual_stamina<?php echo $top_order == 'individual_stamina' && !isset($_GET['direction']) ? '&direction=desc' : ''; ?>#top50"><?= $locales->POKEMON_TABLE_STAMINA ?> <i class="fa fa-sort" aria-hidden="true"></i></a></th>
378
						<th><a href="pokemon/<?= $pokemon->id ?>?order=move_1<?php echo $top_order == 'move_1' && !isset($_GET['direction']) ? '&direction=desc' : ''; ?>#top50">1. <?= $locales->MOVE ?> <i class="fa fa-sort" aria-hidden="true"></i></a></th>
379
						<th><a href="pokemon/<?= $pokemon->id ?>?order=move_2<?php echo $top_order == 'move_2' && !isset($_GET['direction']) ? '&direction=desc' : ''; ?>#top50">2. <?= $locales->MOVE ?> <i class="fa fa-sort" aria-hidden="true"></i></a></th>
380
						<th><a href="pokemon/<?= $pokemon->id ?>?order=disappear_time<?php echo $top_order == 'disappear_time' && !isset($_GET['direction']) ? '&direction=desc' : ''; ?>#top50"><?= $locales->DATE ?> <i class="fa fa-sort" aria-hidden="true"></i></a></th>
381
						<?php if ($pokemon->id == 201) { ?>
382
							<th>Form</th>
383
						<?php } ?>
384
					</tr>
385
				</thead>
386
			
387
				<tbody>
388
					<?php
389
					$i = 0;
390
					foreach ($top as $top50) {
391
						$i++;
392
						$move1 = $top50->move_1;
393
						$move2 = $top50->move_2;
394
						?>
395
396
						<tr>
397
							<td><?= $i ?></td>
398
							<td><?= isset($top50->cp) ? $top50->cp : "???" ?></td>
399
							<td><?= $top50->IV ?> %</td>
400
							<td><?= $top50->individual_attack ?></td>
401
							<td><?= $top50->individual_defense ?></td>
402
							<td><?= $top50->individual_stamina ?></td>
403
							<td><?php echo $move->$move1->name; ?></td>
404
							<td><?php echo $move->$move2->name; ?></td>
405
							<td><a href="https://maps.google.com/?q=<?= $top50->latitude ?>,<?= $top50->longitude ?>&ll=<?= $top50->latitude ?>,<?= $top50->longitude ?>&z=16"
406
								target="_blank"><?=$top50->distime ?></a></td>
407
							<?php if ($pokemon->id == 201 && $top50->form) { ?>
408
								<td><?php echo $form_array[$top50->form]; ?></td>
409
							<?php } else { ?>
410
								<td></td>
411
							<?php } ?>
412
						</tr>
413
						<?php
414
					} ?>
415
			</tbody>
416
		</table>
417
	</div>
418
</div>
419
420
<?php } if ($toptrainer) { ?>
421
	<div class="row" id="trainer">
422
		<div class="col-md-12">
423
			<h2 class="text-center sub-title"><?= $locales->POKEMON_TOPTRAINER ?> <strong><?= $pokemon->name ?></strong></h2>
424
			<table class="table">
425
				<thead>
426
					<tr>
427
						<th>#</th>
428
						<th><a href="pokemon/<?= $pokemon->id ?>?order=trainer_name<?php echo $best_order == 'trainer_name' && !isset($_GET['direction']) ? '&direction=desc' : ''; ?>#trainer"><?= $locales->NAME ?> <i class="fa fa-sort" aria-hidden="true"></i></a></th>
429
						<th><a href="pokemon/<?= $pokemon->id ?>?order=cp<?php echo $best_order == 'cp' && !isset($_GET['direction']) ? '&direction=desc' : ''; ?>#trainer">CP <i class="fa fa-sort" aria-hidden="true"></i></a></th>
430
						<th><a href="pokemon/<?= $pokemon->id ?>?order=IV<?php echo $best_order == 'IV' && !isset($_GET['direction']) ? '&direction=desc' : ''; ?>#trainer">IV <i class="fa fa-sort" aria-hidden="true"></i></a></th>
431
						<th><a href="pokemon/<?= $pokemon->id ?>?order=move_1<?php echo $best_order == 'move_1' && !isset($_GET['direction']) ? '&direction=desc' : ''; ?>#trainer">1. <?= $locales->MOVE ?> <i class="fa fa-sort" aria-hidden="true"></i></a></th>
432
						<th><a href="pokemon/<?= $pokemon->id ?>?order=move_2<?php echo $best_order == 'move_2' && !isset($_GET['direction']) ? '&direction=desc' : ''; ?>#trainer">2. <?= $locales->MOVE ?> <i class="fa fa-sort" aria-hidden="true"></i></a></th>
433
						<th><a href="pokemon/<?= $pokemon->id ?>?order=last_seen<?php echo $best_order == 'last_seen' && !isset($_GET['direction']) ? '&direction=desc' : ''; ?>#trainer"><?= $locales->POKEMON_TABLE_SEEN ?> <i class="fa fa-sort" aria-hidden="true"></i></a></th>
434
					</tr>
435
				</thead>
436
				<tbody>
437
					<?php
438
					$i = 0;
439
					foreach ($toptrainer as $besttrainer) {
440
						$i++;
441
						$move1 = $besttrainer->move_1;
442
						$move2 = $besttrainer->move_2;
443
						?>
444
445
						<tr>
446
							<td><?= $i ?></td>
447
							<td><a href="trainer?name=<?=$besttrainer->trainer_name ?>"><?=$besttrainer->trainer_name ?> </a></td>
448
							<td><?= $besttrainer->cp ?></td>
449
							<td><?= $besttrainer->IV ?> %</td>
450
							<td><?php echo $move->$move1->name; ?></td>
451
							<td><?php echo $move->$move2->name; ?></td>
452
							<td><?=$besttrainer->lasttime ?></td>
453
						</tr>
454
						<?php
455
					} ?>
456
			</tbody>
457
		</table>
458
	</div>
459
</div>
460
<?php } ?>
461