public static function Output(Templates $skin) { $format = Util::getvalue('format'); switch ($format) { case "xml": $output = Skin::Load('output-xml.xsl'); $output->setcontent($skin->returnXML(), '/xml/*', null); header("Content-Type: text/xml; charset=UTF-8"); $output->display(); break; case "json": $response = Skin::Load('output-xml.xsl'); $response->setcontent($skin->returnXML(), '/xml/*', null); $output = Skin::Load('output-json.xsl'); $output->setcontent($response->returnDisplay(), '/xml/*', null); header("Content-Type: application/json; charset=UTF-8"); $output->display(); break; default: $skin->display(); break; } die; if ($format == 'json') { } else { header("Content-Type: text/xml; charset=UTF-8"); $skin->display(); die; } }
public function __toString() { global $user, $db, $config, $phpdate, $page_title_all, $page_title, $token; if ($this->displayTPL) { Templates::display('header'); } $complete = ' <div class="info ' . $this->type . '"' . (!empty($this->customCSS) ? 'style="' . $this->customCSS . '"' : '') . '> ' . $this->message . ' </div> '; if (count($this->links) > 0) { $complete .= ' <br /> '; $i = 0; foreach ($this->links as $title => $link) { $complete .= ' ' . ($i > 0 ? ' ' : '') . ' <a href="' . $link . '"' . ($i == 0 ? ' class="button darkB"' : '') . '">' . $title . '</a> '; $i++; } $complete .= ' <br /><br /><br /> '; } if (!$this->displayTPL) { return $complete; } else { echo $token->auto_append($complete); Templates::display('footer'); die; } }
public function display($app = null, $view = null) { //add by pantingwen@hotmail.com 2014-08-05 begin //如果没有指定模板的话,可以默认获取 if (empty($app)) { $app = $_GET['app']; } if (empty($view)) { $view = $_GET['action']; } //add by pantingwen@hotmail.com 2014-08-05 end //判断当前是不是开启了模板模式 if (!defined('TEMPLATE_OPEN') || !TEMPLATE_OPEN) { $view_file = APP . '/' . $app . '/View/' . $view . '.view.php'; if (defined("LANG_VIEW") && LANG_VIEW == true) { //如果语言没定义,就使用英文的语言 if (!defined("LANG")) { $view_file = APP . '/' . $app . '/View/' . $view . '_EN_US.view.php'; } else { $view_file = APP . '/' . $app . '/View/' . $view . '_' . LANG . '.view.php'; } } if (file_exists($view_file)) { include_once $view_file; } else { echo get_langage_message('system.lang.php', 'VIEW_NOT_FOUND', array('VIEW_FILE' => $view_file)); } } else { if (!is_file(CONFIG_TEMPLATE)) { echo get_langage_message('template.lang.php', 'TEMPLATE_NEED_CONFIG_FILE'); } else { include_once CONFIG_TEMPLATE; $tpl = new Templates(); $tpl->set_vars($this->view_data); $tpl->display($app . '/' . $view); } } }
<?php require 'base.php'; $categories = ForumCategory::getAllCategories(); Templates::assign('categories', $categories); PluginHelper::delegate('__onPageDisplay', array($page)); Templates::display('forums');
$pageCreators = PluginHelper::delegate('__onCreatePage', array(substr($pageName, 0, strlen($pageName) - 4), $_GET)); if (count($pageCreators) == 1) { // Get single page creator foreach ($pageCreators as $p) { $pageCreator = $p; } // Does it implement PageCreator? if (!$pageCreator instanceof PageCreator) { Functions::log(Functions::LOG_ERROR, get_class($pageCreator) . ' does not implement interface PageCreator'); } else { Templates::assign('pageTitle', $pageCreator->getTitle()); Templates::assign('customContent', $pageCreator->getContent()); Templates::display('custom'); } exit; } else { if (count($pageCreators) > 1) { // CLASH OF PLUGINS!! $errorMessage = 'Page Creator conflict for page ' . $pageName . ':<br /><br /><ul>'; foreach ($pageCreators as $package => $pageCreator) { $errorMessage .= '<b>' . $package . '</b>: ' . get_class($pageCreator); } $errorMessage .= '</ul>'; Functions::log(Functions::LOG_ERROR, $errorMessage); exit; } } } // Else, show 404 page Templates::display('404');
<?php require 'base.php'; PluginHelper::delegate('__onPageDisplay', array($page)); Templates::display('index');
<?php Templates::display('header'); ?> <h1>Welcome.</h1> <br /> <a href="#" class="button">Button Standard</a> <a href="#" class="button darkB">Button Dark</a> <a href="#" class="button greyB">Button Grey</a> <?php Templates::display('footer');
<?php require 'base.php'; if ($userManager->loggedIn()) { if ($_GET['logout'] == 1) { $userManager->logout(); header("Location: ./login.php"); exit; } else { header("Location: ./"); exit; } } $errorMessage = false; if (isset($_POST['submit'])) { $username = $_POST['username']; $password = $_POST['password']; if ($userManager->login($username, $password, false, '/')) { header("Location: ./"); exit; } else { $errorMessage = 'Wrong username or password.'; } } PluginHelper::delegate('__onPageDisplay', array($page)); Templates::display('login');
<?php require 'base.php'; require LANGS . 'ForumT.php'; ForumT::init(); $topic = ForumTopic::fromID((int) $_GET['id']); if (!$topic instanceof ForumTopic) { echo ErrorMessage::setText(ForumT::get('topic_doesnt_exist'), true); } $forum = $topic->getForum(); $posts = $topic->getPosts(Config::get('max_posts_perpage'), max((int) $_GET['page'], 1)); Templates::assignVars(array('forum' => $forum, 'topic' => $topic, 'posts' => $posts['posts'], 'pages' => $posts['pages'])); PluginHelper::delegate('__onPageDisplay', array($page)); Templates::display('viewtopic');
<?php require 'base.php'; require LANGS . 'ForumT.php'; ForumT::init(); $forum = Forum::fromID((int) $_GET['id']); if (!$forum instanceof Forum) { echo ErrorMessage::setText(ForumT::get('forum_doesnt_exist'), true); } $topics = $forum->getTopics(); Templates::assignVars(array('forum' => $forum, 'topics' => $topics['topics'], 'topics_pages' => $topics['pages'])); PluginHelper::delegate('__onPageDisplay', array($page)); Templates::display('viewforum');
<?php include 'base.php'; $profileUser = UserReadOnly::fromID((int) $_GET['id']); if (!$profileUser instanceof UserReadOnly) { $errorMessage = 'User does not exist.'; echo ErrorMessage::setText($errorMessage, true); } else { Templates::assign('profileUser', $profileUser); } Templates::display('user');