pokemon-showdown-client/website/lib/panels.lib.php
Guangcong Luo 2105dc8e57 Add website to client repository
Closes #1567

The main reason I'm not simply merging Annika's PR is because this
way makes it clearer that I'm taking responsibility for all this
code, that it's mostly code I wrote, and also because it makes it
easier to ensure that none of the files have been changed.

(Not that I don't personally trust Annika, but I have something
resembling an obligation to users not to expose them to risks based
on personal trust.)
2020-07-27 19:37:04 -04:00

75 lines
1.3 KiB
PHP

<?php
include_once dirname(__FILE__).'/../theme/wrapper.inc.php';
class Panels {
var $output = 'normal';
var $tab = false;
var $root;
var $name;
function Panels() {
global $psconfig;
if (@$psconfig['root']) $this->root = $psconfig['root'];
if (@$psconfig['name']) $this->name = $psconfig['name'];
switch (@$_REQUEST['output']) {
case 'html':
case 'json':
$this->output = $_REQUEST['output'];
break;
}
}
var $pagetitle = false;
function setPageTitle($title) {
if ($this->pagetitle === false) {
$this->pagetitle = $title;
}
}
var $pagedescription = false;
function setPageDescription($description) {
if ($this->pagedescription === false) {
$this->pagedescription = $description;
}
}
function setTab($tab) {
if ($this->tab === false) {
$this->tab = $tab;
}
}
var $depth = 0;
var $scriptsIncluded = false;
function start() {
$this->depth++;
if ($this->depth != 1) {
return;
}
if ($this->output === 'normal') {
ThemeHeaderTemplate();
}
}
function scripts() {
if ($this->output !== 'normal') return;
if ($this->scriptsIncluded) return;
$this->scriptsIncluded = true;
ThemeScriptsTemplate();
}
function end() {
$this->depth--;
if ($this->depth != 0) {
return;
}
if ($this->output === 'normal') {
ThemeFooterTemplate();
}
}
}
$panels = new Panels();