public function setAttributes($attributes) { foreach ($attributes as $key => $value) { if ($value != '') { $key = gettype($key) === 'string' ? FuncHelp::utf8ify($key) : $key; $this->{$key} = gettype($value) === 'string' ? FuncHelp::utf8ify($value) : $value; } } }
public static function getMilestones() { $getMilestones = TPP::db()->query("SELECT `id`, `name`, `time` FROM `milestone` WHERE `visible` = 1 ORDER BY `time`") or die(TPP::db()->error); while ($mile = $getMilestones->fetch_assoc()) { $newMilestone = new self(); $newMilestone->setAttributes($mile); $newMilestone->time = FuncHelp::getDateTime($newMilestone->time); $return[] = $newMilestone; } return $return; }
public static function toImage($path, $name, $htmlOptions = array()) { $image = IMG_PATH . $path . '/' . FuncHelp::safeName($name) . '.png'; if (TPP_DEBUG) { if (!file_exists($_SERVER['DOCUMENT_ROOT'] . $image)) { $image = 'http://twitchplayspokemon.org/img/' . $path . '/' . FuncHelp::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; }
public function showImage() { return '<i class="sprite-trainer sprite-trainer-' . FuncHelp::safeName($this->name) . '" title="' . $this->name . '" alt="' . $this->name . '"></i>'; }
<div class="tpp-app tpp-app-header"> <div class="page-header"> <h1> <a href="http://www.twitch.tv/twitchplayspokemon"><!-- --><strong><i class="fa fa-external-link"></i>Twitch Plays Pokémon</strong><!-- --></a><!-- --><a href="" class="pop-out btn btn-danger btn-xs"><i class="fa fa-expand"></i>Pop out</a> <span class="pull-right last-update">Last update: <?php echo FuncHelp::getDateTime($general->last_update); ?> </span> </h1><?php if (!empty($messages)) { $this->render('general/_messages', array('messages' => $messages)); } ?> <div class="pull-left current-status"> <p>Current Goal: <strong><?php echo utf8_decode($general->current_goal); ?> </strong></p> <p>Optional Goal: <strong><?php echo !empty($general->optional_goal) ? utf8_decode($general->optional_goal) : '-'; ?> </strong></p> <p>Current Location: <strong><?php echo utf8_decode($general->current_location); ?>
public function getMoves() { $return = array(); if (isset($this->moves)) { $hms = FuncHelp::getHmMoves(); foreach ($this->moves as $move) { if (in_array($move->name, $hms)) { $return[] = '<strong>' . $move->name . '</strong>'; } else { $return[] = $move->name; } } } return $return; }
<tr><?php foreach ($badges as $b) { ?> <td><?php echo isset($b->time) ? FuncHelp::getDateTime($b->time) : '<em>Not yet</em>'; ?> </td><?php } ?> </tr>