public static function toImage($path, $name, $htmlOptions = []) { $image = IMG_PATH . $path . '/' . Helper::safeName($name) . '.png'; if (TPP_DEBUG) { if (!file_exists($_SERVER['DOCUMENT_ROOT'] . $image)) { // $image = 'http://twitchplayspokemon.org/img/' . $path . '/' . Helper::safeName($name) . '.png'; } } $return = '<img src="' . $image . '"'; if (!empty($htmlOptions)) { foreach ($htmlOptions as $key => $value) { $return .= ' ' . $key . '="' . $value . '"'; } } if (!isset($htmlOptions['title'])) { $return .= ' title="' . $name . '"'; } if (!isset($htmlOptions['alt'])) { $return .= ' alt="' . $name . '"'; } $return .= '>'; return $return; }
</strong> <?php echo $box->active ? '<small class="box-active">active</small>' : ''; ?> <?php echo isset($box->name) ? '<small>(' . $box->name . ')</small>' : ''; ?> <?php echo !empty($box->content) ? '<small>(' . count($box->pokemon) . ' Pokémon)</small>' : ''; ?> </h5> <div class="box-background bg-<?php echo Helper::safeName($box->scenery); ?> "> <?php if (empty($box->pokemon)) { ?> <em>No Pokémon in this box</em><?php } else { foreach ($box->content as $key_row => $row) { foreach ($row as $pokemon) { /** @var $pokemon Pokemon */ $title = isset($pokemon->name) ? $pokemon->name . ' (' . $pokemon->pokemon . ')' : $pokemon->pokemon; echo '<a href="#pokemon-' . $pokemon->id . '">' . $pokemon->showImageMenu(['title' => $title, 'alt' => $title]) . '</a>'; } }