public static function generate(array $params) { $page = array_shift($params); $page = $page ?: 'about'; $path = VIEW_PATH . '/' . $page . '.md'; $out = 'Uh oh... that doesn\'t seem to exist...'; if (is_readable($path)) { $file = file_get_contents($path); $out = Lib\Michelf\Markdown::defaultTransform($file); } Lib\Display::addKey('page', 'static'); Lib\Display::renderAndAddKey('content', 'static', $out); }
public static function generate(array $params) { self::_checkLogin(); $bracket = Api\Bracket::getBracketByPerma(array_shift($params)); self::_enableAd(); if ($bracket) { $bracket->nameLabel = $bracket->nameLabel ?: 'Character name'; $bracket->sourceLabel = $bracket->sourceLabel ?: 'Source'; $bracket->sourceLabel = $bracket->sourceLabel === 'NO_SOURCE' ? false : $bracket->sourceLabel; $out = (object) ['rules' => Lib\Michelf\Markdown::defaultTransform($bracket->rules), 'bracket' => $bracket]; Lib\Display::addKey('page', 'nominate'); Lib\Display::renderAndAddKey('content', 'nominate', $out); } }