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

pages/pokemon.page.php (6 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
}?>
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>
124
				<td class="col-md-4 col-xs-4"><?php if (isset($pokemon->protected_gyms)) {
125
					echo $pokemon->protected_gyms;
126
}?></td>
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)+1)/2;
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
        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
278
279
                <?php
280
                if (!is_null($data)) { ?>
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 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
                                        } ?>
306
                                </p>
307
                            </div>
308
                        <?php
309
                        }
0 ignored issues
show
Closing brace indented incorrectly; expected 0 spaces, found 24
Loading history...
310
                    } ?>
0 ignored issues
show
Closing brace indented incorrectly; expected 0 spaces, found 20
Loading history...
311
                    </div>
312
               <?php } ?>
0 ignored issues
show
Closing brace indented incorrectly; expected 16 spaces, found 0
Loading history...
313
314
        <?php } ?>
0 ignored issues
show
Closing brace indented incorrectly; expected 8 spaces, found 0
Loading history...
315
316
    </div>
317
318
</div>
319
320
321
<div class="row area" id="family">
322
323
	<div class="col-md-12">
324
325
		<h2 class="text-center sub-title"><strong><?= $pokemon->name ?></strong><?= $locales->POKEMON_FAMILYTITLE ?></h2>
326
327
		<div class="row">
328
329
		<?php
330
331
		foreach ($related as $related_mon) {
332
			?>
333
334
			<div class="col-md-1 col-sm-2 col-xs-3 pokemon-single">
335
336
				<a href="pokemon/<?= $related_mon ?>">
337
					<img src="<?= $pokemons->pokemon->$related_mon->img ?>" alt="<?= $pokemons->pokemon->$related_mon->name ?>" class="img-responsive">
338
				</a>
339
340
			</div>
341
342
343
			<?php
344
		}
345
346
		?>
347
348
		</div>
349
350
351
	</div>
352
353
</div>
354
355
356
<?php if (!empty($top)) { ?>
357
	<div class="row area" id="top50">
358
		<div class="col-md-12">
359
			<h2 class="text-center sub-title">Top 50 <strong><?= $pokemon->name ?></strong></h2>
360
			<table class="table">
361
				<thead>
362
					<tr>
363
						<th>#</th>
364
						<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>
365
						<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>
366
						<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>
367
						<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>
368
						<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>
369
						<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>
370
						<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>
371
						<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>
372
						<?php if ($pokemon->id == 201) { ?>
373
							<th>Form</th>
374
						<?php } ?>
375
					</tr>
376
				</thead>
377
			
378
				<tbody>
379
					<?php
380
					$i = 0;
381
					foreach ($top as $top50) {
382
						$i++;
383
						$move1 = $top50->move_1;
384
						$move2 = $top50->move_2;
385
						?>
386
387
						<tr>
388
							<td><?= $i ?></td>
389
							<td><?= isset($top50->cp) ? $top50->cp : "???" ?></td>
390
							<td><?= $top50->IV ?> %</td>
391
							<td><?= $top50->individual_attack ?></td>
392
							<td><?= $top50->individual_defense ?></td>
393
							<td><?= $top50->individual_stamina ?></td>
394
							<td><?php echo $move->$move1->name; ?></td>
395
							<td><?php echo $move->$move2->name; ?></td>
396
							<td><a href="https://maps.google.com/?q=<?= $top50->latitude ?>,<?= $top50->longitude ?>&ll=<?= $top50->latitude ?>,<?= $top50->longitude ?>&z=16"
397
								target="_blank"><?=$top50->distime ?></a></td>
398
							<?php if ($pokemon->id == 201 && $top50->form) { ?>
399
								<td><?php echo $form_array[$top50->form]; ?></td>
400
							<?php } else { ?>
401
								<td></td>
402
							<?php } ?>
403
						</tr>
404
						<?php
405
					} ?>
406
			</tbody>
407
		</table>
408
	</div>
409
</div>
410
411
<?php } if ($toptrainer) { ?>
412
	<div class="row" id="trainer">
413
		<div class="col-md-12">
414
			<h2 class="text-center sub-title"><?= $locales->POKEMON_TOPTRAINER ?> <strong><?= $pokemon->name ?></strong></h2>
415
			<table class="table">
416
				<thead>
417
					<tr>
418
						<th>#</th>
419
						<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>
420
						<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>
421
						<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>
422
						<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>
423
						<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>
424
						<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>
425
					</tr>
426
				</thead>
427
				<tbody>
428
					<?php
429
					$i = 0;
430
					foreach ($toptrainer as $besttrainer) {
431
						$i++;
432
						$move1 = $besttrainer->move_1;
433
						$move2 = $besttrainer->move_2;
434
						?>
435
436
						<tr>
437
							<td><?= $i ?></td>
438
							<td><a href="trainer?name=<?=$besttrainer->trainer_name ?>"><?=$besttrainer->trainer_name ?> </a></td>
439
							<td><?= $besttrainer->cp ?></td>
440
							<td><?= $besttrainer->IV ?> %</td>
441
							<td><?php echo $move->$move1->name; ?></td>
442
							<td><?php echo $move->$move2->name; ?></td>
443
							<td><?=$besttrainer->lasttime ?></td>
444
						</tr>
445
						<?php
446
					} ?>
447
			</tbody>
448
		</table>
449
	</div>
450
</div>
451
<?php } ?>
452