Пример #1
0
 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;
 }
Пример #2
0
</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&eacute;mon)</small>' : '';
        ?>

						</h5>
						<div class="box-background bg-<?php 
        echo Helper::safeName($box->scenery);
        ?>
">
							<?php 
        if (empty($box->pokemon)) {
            ?>

							<em>No Pok&eacute;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>';
                }
            }