static function renderFail($reason) { switch ($reason) { case 'already_linked': $reason = 'You need to be the same user as the from link to overwrite a link.'; break; case 'no_such_link': $reason = 'The medium you are trying to link to does not appear to exist'; break; case 'wrong_no_privilege': $reason = 'This account does not have the privilege to upload media.'; break; case 'wrong_no_tags': $reason = 'No tags were provided. Every medium must have at least one tag.'; break; case 'wrong_submime': $reason = 'The type is an image or video, but not the supported format. webm, gif, png, hpg, and jpeg are supported.'; break; case 'wrong_mime': $reason = 'Wrong major type: only image and video are supported.'; break; default: break; } return intermix(self::$warning_box, [$reason]); }
static function maybeWriteError($unused) { if (empty($unused)) { return ''; } $have = 'has'; if (count($unused) >= 2) { $have = 'have'; } $unused = self::oxfordify($unused); return intermix(self::$error_template, [$unused, $have]); }
static function render($tags) { $total = ''; $html = ''; $d = 'description'; $n = 'number'; for ($i = 0; $i < count($tags); ++$i) { $tag = $tags[$i][$d]; $html .= intermix(self::$template, ["<a href=/search/?tags={$tag}>{$tag}</a>", $tags[$i][$n]]); $html .= ', '; if (self::every($i, 5)) { $html .= '<br>'; } if (self::every($i, 10) || $i == count($tags) - 1) { $left = intermix(self::$cell, ['Top ' . ($i + 1)]); $right = intermix(self::$cell, [$html]); $middle = intermix(self::$cell, ['']); $total .= intermix(self::$row, [$left . $middle . $right]); $total .= self::$vertspace; $html = ''; } } return intermix(self::$table, [$total]); }
static function renderControls($id, $user_affiliation, $stats, $from, $to) { if ($to != null) { $next = intermix(self::$setnavigation, [$to, 'next']); } else { $next = null; } if ($from != null) { $prev = intermix(self::$setnavigation, [$from, 'prev']); } else { $prev = null; } $navs = intermix(self::$navvert, [$prev, $next]); if ($stats['ups'] == null) { $stats = array('ups' => 0, 'favs' => 0, 'downs' => 0); } if ($user_affiliation == null) { return intermix(self::$statistics, [$id, '', $id, '', $id, '', $stats['ups'], $stats['favs'], $stats['downs'], $navs]); } else { $ui = $user_affiliation; $up = $ui['upvote'] == 1 ? '⇒ ' : ''; $fav = $ui['favorite'] == 1 ? '⇒ ' : ''; $down = $ui['downvote'] == 1 ? '⇒ ' : ''; return intermix(self::$statistics, [$id, $up, $id, $fav, $id, $down, $stats['ups'], $stats['favs'], $stats['downs'], $navs]); } }
static function generateStats($ups, $favs, $downs, $sfwrating) { $rating = ''; $color = ''; switch ($sfwrating) { case 1: case 'sfw': $rating = 'S'; $color = 'upvote'; break; case 2: case 'qsfw': $rating = 'Q'; $color = 'favorite'; break; case 3: case 'nsfw': $rating = 'N'; $color = 'downvote'; break; } return intermix(self::$thumbcode, [$ups, $favs, $downs, $color, $rating]); }
static function renderPrivileged($username, $email, $privileges, $userprivilege, $viewer_privilege, $viewername) { $privilege_buttons = self::renderPrivilegeButtons($privileges, $userprivilege, $viewer_privilege, $username == $viewername); $oldpassfield = ''; if ($viewername == $username) { $oldpassfield = self::$old_pass_entry; } return intermix(self::$code, [$username, $username, $email, $oldpassfield, $privilege_buttons]); }