本文整理汇总了PHP中wfGetSiteNotice函数的典型用法代码示例。如果您正苦于以下问题:PHP wfGetSiteNotice函数的具体用法?PHP wfGetSiteNotice怎么用?PHP wfGetSiteNotice使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfGetSiteNotice函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doBeforeContent
function doBeforeContent()
{
global $wgOut, $wgTitle;
$s = "";
$qb = $this->qbSetting();
$mainPageObj = Title::newMainPage();
$s .= "\n<div id='content'>\n<div id='topbar'>" . "<table width='100%' border='0' cellspacing='0' cellpadding='8'><tr>";
$s .= "<td class='top' align='left' valign='middle' nowrap='nowrap'>";
$s .= "<a href=\"" . $mainPageObj->escapeLocalURL() . "\">";
$s .= "<span id='sitetitle'>" . wfMsg("sitetitle") . "</span></a>";
$s .= "</td><td class='top' align='right' valign='bottom' width='100%'>";
$s .= $this->sysLinks();
$s .= "</td></tr><tr><td valign='top'>";
$s .= "<font size='-1'><span id='sitesub'>";
$s .= htmlspecialchars(wfMsg("sitesubtitle")) . "</span></font>";
$s .= "</td><td align='right'>";
$s .= "<font size='-1'><span id='langlinks'>";
$s .= str_replace("<br />", "", $this->otherLanguages());
$cat = $this->getCategoryLinks();
if ($cat) {
$s .= "<br />{$cat}\n";
}
$s .= "<br />" . $this->pageTitleLinks();
$s .= "</span></font>";
$s .= "</td></tr></table>\n";
$s .= "\n</div>\n<div id='article'>";
$notice = wfGetSiteNotice();
if ($notice) {
$s .= "\n<div id='siteNotice'>{$notice}</div>\n";
}
$s .= $this->pageTitle();
$s .= $this->pageSubtitle() . "\n";
return $s;
}
示例2: doBeforeContent
function doBeforeContent()
{
$s = "\n<div id='content'>\n<div id='top'>\n";
$s .= '<div id="logo">' . $this->logoText('right') . '</div>';
$s .= $this->pageTitle();
$s .= $this->pageSubtitle() . "\n";
$s .= '<div id="topbar">';
$s .= $this->topLinks() . "\n<br />";
$notice = wfGetSiteNotice();
if ($notice) {
$s .= "\n<div id='siteNotice'>{$notice}</div>\n";
}
$s .= $this->pageTitleLinks();
$ol = $this->otherLanguages();
if ($ol) {
$s .= '<br />' . $ol;
}
$cat = $this->getCategoryLinks();
if ($cat) {
$s .= '<br />' . $cat;
}
$s .= "<br clear='all' /></div><hr />\n</div>\n";
$s .= "\n<div id='article'>";
return $s;
}
示例3: doBeforeContent
function doBeforeContent()
{
$qb = $this->qbSetting();
$mainPageObj = Title::newMainPage();
$s = "\n<div id='content'>\n<div id='topbar'>" . '<table width="100%" border="0" cellspacing="0" cellpadding="8"><tr>';
$s .= '<td class="top" align="left" valign="middle" nowrap="nowrap">';
$s .= '<a href="' . $mainPageObj->escapeLocalURL() . '">';
$s .= '<span id="sitetitle">' . wfMsg('sitetitle') . '</span></a>';
$s .= '</td><td class="top" align="right" valign="bottom" width="100%">';
$s .= $this->sysLinks();
$s .= '</td></tr><tr><td valign="top">';
$s .= '<font size="-1"><span id="sitesub">';
$s .= htmlspecialchars(wfMsg('sitesubtitle')) . '</span></font>';
$s .= '</td><td align="right">';
$s .= '<font size="-1"><span id="langlinks">';
$s .= str_replace('<br />', '', $this->otherLanguages());
$cat = $this->getCategoryLinks();
if ($cat) {
$s .= "<br />{$cat}\n";
}
$s .= '<br />' . $this->pageTitleLinks();
$s .= '</span></font>';
$s .= "</td></tr></table>\n";
$s .= "\n</div>\n<div id='article'>";
$notice = wfGetSiteNotice();
if ($notice) {
$s .= "\n<div id='siteNotice'>{$notice}</div>\n";
}
$s .= $this->pageTitle();
$s .= $this->pageSubtitle() . "\n";
return $s;
}
示例4: doBeforeContent
function doBeforeContent() {
global $wgOut;
$s = "";
$qb = $this->qbSetting();
$mainPageObj = Title::newMainPage();
$s .= file_get_contents('../wwwroot/templates/header.html');
$title = htmlspecialchars($wgOut->getPageTitle());
$s = str_replace('{PAGE_TITLE}', $title, $s);
$s .= '<tr><td>';
$s .= '<table border="0" cellpadding="0" cellspacing="0" width="760">';
$s .= '<tr>';
$s .= '<td bgcolor="#20292E" width="1"><img src="/images/pixel.gif" height="10" width="1" /><br /></td>';
$s .= '<td bgcolor="#4C626F" width="758">';
$s .= "\n<div id='content'>\n";
//$s .= '<table border="0" cellpadding="0" cellspacing="0" width="758"><tr>';
//$s .= '<td width="10"><img src="/images/pixel.gif" height="10" width="10" /><br /></td>';
//$s .= '<td width="738">';
$s .= "<div id='article'>";
$notice = wfGetSiteNotice();
if( $notice ) {
$s .= "\n<div id='siteNotice'>$notice</div>\n";
}
//$s .= $this->pageTitle();
// $s .= $this->pageSubtitle() . "\n";
return $s;
}
示例5: doBeforeContent
function doBeforeContent()
{
global $wgUser, $wgOut, $wgTitle;
$s = "\n<div id='content'>\n<div id='topbar'>";
$s .= $this->logoText("right");
$s .= $this->pageTitle();
$s .= $this->pageSubtitle() . "\n";
$s .= $this->topLinks() . "\n<br />";
$notice = wfGetSiteNotice();
if ($notice) {
$s .= "\n<div id='siteNotice'>{$notice}</div>\n";
}
$s .= $this->pageTitleLinks();
$ol = $this->otherLanguages();
if ($ol) {
$s .= "<br />" . $ol;
}
$cat = $this->getCategoryLinks();
if ($cat) {
$s .= "<br />" . $cat;
}
$s .= "<br clear='all' /><hr />\n</div>\n";
$s .= "\n<div id='article'>";
return $s;
}
示例6: doBeforeContent
function doBeforeContent()
{
global $wgContLang;
$fname = 'Skin::doBeforeContent';
wfProfileIn($fname);
$s = '';
$qb = $this->qbSetting();
if ($langlinks = $this->otherLanguages()) {
$rows = 2;
$borderhack = '';
} else {
$rows = 1;
$langlinks = false;
$borderhack = 'class="top"';
}
$s .= "\n<div id='content'>\n<div id='topbar'>\n" . "<table border='0' cellspacing='0' width='98%'>\n<tr>\n";
$shove = $qb != 0;
$left = $qb == 1 || $qb == 3;
if ($wgContLang->isRTL()) {
$left = !$left;
}
if (!$shove) {
$s .= "<td class='top' align='left' valign='top' rowspan='{$rows}'>\n" . $this->logoText() . '</td>';
} elseif ($left) {
$s .= $this->getQuickbarCompensator($rows);
}
$l = $wgContLang->isRTL() ? 'right' : 'left';
$s .= "<td {$borderhack} align='{$l}' valign='top'>\n";
$s .= $this->topLinks();
$s .= "<p class='subtitle'>" . $this->pageTitleLinks() . "</p>\n";
$r = $wgContLang->isRTL() ? "left" : "right";
$s .= "</td>\n<td {$borderhack} valign='top' align='{$r}' nowrap='nowrap'>";
$s .= $this->nameAndLogin();
$s .= "\n<br />" . $this->searchForm() . "</td>";
if ($langlinks) {
$s .= "</tr>\n<tr>\n<td class='top' colspan=\"2\">{$langlinks}</td>\n";
}
if ($shove && !$left) {
# Right
$s .= $this->getQuickbarCompensator($rows);
}
$s .= "</tr>\n</table>\n</div>\n";
$s .= "\n<div id='article'>\n";
$notice = wfGetSiteNotice();
if ($notice) {
$s .= "\n<div id='siteNotice'>{$notice}</div>\n";
}
$s .= $this->pageTitle();
$s .= $this->pageSubtitle();
$s .= $this->getCategories();
wfProfileOut($fname);
return $s;
}
示例7: getHTML
function getHTML()
{
global $wgTitle, $wgUseFileCache, $title, $wgInputEncoding, $wgOutputEncoding;
global $wgSitename, $wgServer, $wgMessageCache, $wgLogo;
# I give up, Brion is right. Getting the message cache to work when there is no DB is tricky.
# Hard coding strings instead.
$noconnect = "<p><strong>Sorry! This site is experiencing technical difficulties.</strong></p><p>Try waiting a few minutes and reloading.</p><p><small>(Can't contact the database server: \$1)</small></p>";
$mainpage = 'Main Page';
$searchdisabled = <<<EOT
<p style="margin: 1.5em 2em 1em">{$wgSitename} search is disabled for performance reasons. You can search via Google in the meantime.
<span style="font-size: 89%; display: block; margin-left: .2em">Note that their indexes of {$wgSitename} content may be out of date.</span></p>',
EOT;
$googlesearch = "\n<!-- SiteSearch Google -->\n<FORM method=GET action=\"http://www.google.com/search\">\n<TABLE bgcolor=\"#FFFFFF\"><tr><td>\n<A HREF=\"http://www.google.com/\">\n<IMG SRC=\"http://www.google.com/logos/Logo_40wht.gif\"\nborder=\"0\" ALT=\"Google\"></A>\n</td>\n<td>\n<INPUT TYPE=text name=q size=31 maxlength=255 value=\"\$1\">\n<INPUT type=submit name=btnG VALUE=\"Google Search\">\n<font size=-1>\n<input type=hidden name=domains value=\"{$wgServer}\"><br /><input type=radio name=sitesearch value=\"\"> WWW <input type=radio name=sitesearch value=\"{$wgServer}\" checked> {$wgServer} <br />\n<input type='hidden' name='ie' value='\$2'>\n<input type='hidden' name='oe' value='\$2'>\n</font>\n</td></tr></TABLE>\n</FORM>\n<!-- SiteSearch Google -->";
$cachederror = "The following is a cached copy of the requested page, and may not be up to date. ";
# No database access
if (is_object($wgMessageCache)) {
$wgMessageCache->disable();
}
if (trim($this->error) == '') {
$this->error = $this->db->getProperty('mServer');
}
$text = str_replace('$1', $this->error, $noconnect);
$text .= wfGetSiteNotice();
if ($wgUseFileCache) {
if ($wgTitle) {
$t =& $wgTitle;
} else {
if ($title) {
$t = Title::newFromURL($title);
} elseif (@$_REQUEST['search']) {
$search = $_REQUEST['search'];
return $searchdisabled . str_replace(array('$1', '$2'), array(htmlspecialchars($search), $wgInputEncoding), $googlesearch);
} else {
$t = Title::newFromText($mainpage);
}
}
$cache = new CacheManager($t);
if ($cache->isFileCached()) {
$msg = '<p style="color: red"><b>' . $msg . "<br />\n" . $cachederror . "</b></p>\n";
$tag = '<div id="article">';
$text = str_replace($tag, $tag . $msg, $cache->fetchPageText());
}
}
return $text;
}
示例8: outputPage
//.........这里部分代码省略.........
$viewcount = $wgLang->formatNum($wgArticle->getCount());
if ($viewcount) {
$tpl->set('viewcount', wfMsg("viewcount", $viewcount));
} else {
$tpl->set('viewcount', false);
}
} else {
$tpl->set('viewcount', false);
}
if ($wgPageShowWatchingUsers) {
$dbr =& wfGetDB(DB_SLAVE);
extract($dbr->tableNames('watchlist'));
$sql = "SELECT COUNT(*) AS n FROM {$watchlist}\n\t\t\t\t\tWHERE wl_title='" . $dbr->strencode($this->mTitle->getDBKey()) . "' AND wl_namespace=" . $this->mTitle->getNamespace();
$res = $dbr->query($sql, 'SkinPHPTal::outputPage');
$x = $dbr->fetchObject($res);
$numberofwatchingusers = $x->n;
if ($numberofwatchingusers > 0) {
$tpl->set('numberofwatchingusers', ' ' . wfMsg('number_of_watching_users_pageview', $numberofwatchingusers));
} else {
$tpl->set('numberofwatchingusers', false);
}
} else {
$tpl->set('numberofwatchingusers', false);
}
$tpl->set('copyright', $this->getCopyright());
$this->credits = false;
if (isset($wgMaxCredits) && $wgMaxCredits != 0) {
require_once "Credits.php";
$this->credits = getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax);
} else {
$tpl->set('lastmod', $this->lastModified());
}
$tpl->setRef('credits', $this->credits);
} elseif (isset($oldid) && !isset($diff)) {
$tpl->set('copyright', $this->getCopyright());
$tpl->set('viewcount', false);
$tpl->set('lastmod', false);
$tpl->set('credits', false);
$tpl->set('numberofwatchingusers', false);
} else {
$tpl->set('copyright', false);
$tpl->set('viewcount', false);
$tpl->set('lastmod', false);
$tpl->set('credits', false);
$tpl->set('numberofwatchingusers', false);
}
wfProfileOut("{$fname}-stuff3");
wfProfileIn("{$fname}-stuff4");
$tpl->set('copyrightico', $this->getCopyrightIcon());
$tpl->set('poweredbyico', $this->getPoweredBy());
$tpl->set('disclaimer', $this->disclaimerLink());
$tpl->set('about', $this->aboutLink());
$tpl->setRef('debug', $out->mDebugtext);
$tpl->set('reporttime', $out->reportTime());
$tpl->set('sitenotice', wfGetSiteNotice());
$printfooter = "<div class=\"printfooter\">\n" . $this->printSource() . "</div>\n";
$out->mBodytext .= $printfooter;
$tpl->setRef('bodytext', $out->mBodytext);
# Language links
$language_urls = array();
if (!$wgHideInterlanguageLinks) {
foreach ($wgOut->getLanguageLinks() as $l) {
$tmp = explode(':', $l, 2);
$class = 'interwiki-' . $tmp[0];
unset($tmp);
$nt = Title::newFromText($l);
$language_urls[] = array('href' => $nt->getFullURL(), 'text' => $wgContLang->getLanguageName($nt->getInterwiki()) != '' ? $wgContLang->getLanguageName($nt->getInterwiki()) : $l, 'class' => $class);
}
}
if (count($language_urls)) {
$tpl->setRef('language_urls', $language_urls);
} else {
$tpl->set('language_urls', false);
}
wfProfileOut("{$fname}-stuff4");
# Personal toolbar
$tpl->set('personal_urls', $this->buildPersonalUrls());
$content_actions = $this->buildContentActionUrls();
$tpl->setRef('content_actions', $content_actions);
// XXX: attach this from javascript, same with section editing
if ($this->iseditable && $wgUser->getOption("editondblclick")) {
$tpl->set('body_ondblclick', 'document.location = "' . $content_actions['edit']['href'] . '";');
} else {
$tpl->set('body_ondblclick', false);
}
if ($this->iseditable && $wgUser->getOption('editsectiononrightclick')) {
$tpl->set('body_onload', 'setupRightClickEdit()');
} else {
$tpl->set('body_onload', false);
}
$tpl->set('sidebar', $this->buildSidebar());
$tpl->set('nav_urls', $this->buildNavUrls());
// execute template
wfProfileIn("{$fname}-execute");
$res = $tpl->execute();
wfProfileOut("{$fname}-execute");
// result may be an error
$this->printOrError($res);
wfProfileOut($fname);
}
示例9: sitenotice
function sitenotice()
{
// Perhaps this could be given special dependencies using our knowledge of what
// wfGetSiteNotice() depends on.
return cbt_value(wfGetSiteNotice(), 'dynamic');
}
示例10: outputPage
//.........这里部分代码省略.........
} else {
$tpl->set('viewcount', false);
}
} else {
$tpl->set('viewcount', false);
}
if ($wgPageShowWatchingUsers) {
$dbr =& wfGetDB(DB_SLAVE);
extract($dbr->tableNames('watchlist'));
$sql = "SELECT COUNT(*) AS n FROM {$watchlist}\n\t\t\t\t\tWHERE wl_title='" . $dbr->strencode($this->mTitle->getDBKey()) . "' AND wl_namespace=" . $this->mTitle->getNamespace();
$res = $dbr->query($sql, 'SkinTemplate::outputPage');
$x = $dbr->fetchObject($res);
$numberofwatchingusers = $x->n;
if ($numberofwatchingusers > 0) {
$tpl->set('numberofwatchingusers', wfMsg('number_of_watching_users_pageview', $numberofwatchingusers));
} else {
$tpl->set('numberofwatchingusers', false);
}
} else {
$tpl->set('numberofwatchingusers', false);
}
$tpl->set('copyright', $this->getCopyright());
$this->credits = false;
if (isset($wgMaxCredits) && $wgMaxCredits != 0) {
require_once "Credits.php";
$this->credits = getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax);
} else {
$tpl->set('lastmod', $this->lastModified());
}
$tpl->setRef('credits', $this->credits);
} elseif (isset($oldid) && !isset($diff)) {
$tpl->set('copyright', $this->getCopyright());
$tpl->set('viewcount', false);
$tpl->set('lastmod', false);
$tpl->set('credits', false);
$tpl->set('numberofwatchingusers', false);
} else {
$tpl->set('copyright', false);
$tpl->set('viewcount', false);
$tpl->set('lastmod', false);
$tpl->set('credits', false);
$tpl->set('numberofwatchingusers', false);
}
wfProfileOut("{$fname}-stuff3");
wfProfileIn("{$fname}-stuff4");
$tpl->set('copyrightico', $this->getCopyrightIcon());
$tpl->set('poweredbyico', $this->getPoweredBy());
$tpl->set('disclaimer', $this->disclaimerLink());
$tpl->set('privacy', $this->privacyLink());
$tpl->set('about', $this->aboutLink());
$tpl->setRef('debug', $out->mDebugtext);
$tpl->set('reporttime', $out->reportTime());
$tpl->set('sitenotice', wfGetSiteNotice());
$printfooter = "<div class=\"printfooter\">\n" . $this->printSource() . "</div>\n";
$out->mBodytext .= $printfooter;
$tpl->setRef('bodytext', $out->mBodytext);
# Language links
$language_urls = array();
if (!$wgHideInterlanguageLinks) {
foreach ($wgOut->getLanguageLinks() as $l) {
$tmp = explode(':', $l, 2);
$class = 'interwiki-' . $tmp[0];
unset($tmp);
$nt = Title::newFromText($l);
$language_urls[] = array('href' => $nt->getFullURL(), 'text' => $wgContLang->getLanguageName($nt->getInterwiki()) != '' ? $wgContLang->getLanguageName($nt->getInterwiki()) : $l, 'class' => $class);
}
}
if (count($language_urls)) {
$tpl->setRef('language_urls', $language_urls);
} else {
$tpl->set('language_urls', false);
}
wfProfileOut("{$fname}-stuff4");
// WERELATE - added trees
$tpl->setRef('trees', $this->getTrees());
# Personal toolbar
$tpl->set('personal_urls', $this->buildPersonalUrls());
$content_actions = $this->buildContentActionUrls();
$tpl->setRef('content_actions', $content_actions);
// XXX: attach this from javascript, same with section editing
if ($this->iseditable && $wgUser->getOption("editondblclick")) {
$tpl->set('body_ondblclick', 'document.location = "' . $content_actions['edit']['href'] . '";');
} else {
$tpl->set('body_ondblclick', false);
}
if ($this->iseditable && $wgUser->getOption('editsectiononrightclick')) {
$tpl->set('body_onload', 'setupRightClickEdit()');
} else {
$tpl->set('body_onload', false);
}
$tpl->set('sidebar', $this->buildSidebar());
$tpl->set('nav_urls', $this->buildNavUrls());
// execute template
wfProfileIn("{$fname}-execute");
$res = $tpl->execute();
wfProfileOut("{$fname}-execute");
// result may be an error
$this->printOrError($res);
wfProfileOut($fname);
}
示例11: outputPage
//.........这里部分代码省略.........
if ($wgPageShowWatchingUsers) {
$dbr = wfGetDB(DB_SLAVE);
$watchlist = $dbr->tableName('watchlist');
$sql = "SELECT COUNT(*) AS n FROM {$watchlist}\n\t\t\t\t\tWHERE wl_title='" . $dbr->strencode($this->mTitle->getDBkey()) . "' AND wl_namespace=" . $this->mTitle->getNamespace();
$res = $dbr->query($sql, 'SkinTemplate::outputPage');
$x = $dbr->fetchObject($res);
$numberofwatchingusers = $x->n;
if ($numberofwatchingusers > 0) {
$tpl->set('numberofwatchingusers', wfMsgExt('number_of_watching_users_pageview', array('parseinline'), $wgLang->formatNum($numberofwatchingusers)));
} else {
$tpl->set('numberofwatchingusers', false);
}
} else {
$tpl->set('numberofwatchingusers', false);
}
$tpl->set('copyright', $this->getCopyright());
$this->credits = false;
if ($wgMaxCredits != 0) {
$this->credits = Credits::getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax);
} else {
$tpl->set('lastmod', $this->lastModified());
}
$tpl->setRef('credits', $this->credits);
} elseif (isset($oldid) && !isset($diff)) {
$tpl->set('copyright', $this->getCopyright());
$tpl->set('viewcount', false);
$tpl->set('lastmod', false);
$tpl->set('credits', false);
$tpl->set('numberofwatchingusers', false);
} else {
$tpl->set('copyright', false);
$tpl->set('viewcount', false);
$tpl->set('lastmod', false);
$tpl->set('credits', false);
$tpl->set('numberofwatchingusers', false);
}
wfProfileOut(__METHOD__ . "-stuff3");
wfProfileIn(__METHOD__ . "-stuff4");
$tpl->set('copyrightico', $this->getCopyrightIcon());
$tpl->set('poweredbyico', $this->getPoweredBy());
$tpl->set('disclaimer', $this->disclaimerLink());
$tpl->set('privacy', $this->privacyLink());
$tpl->set('about', $this->aboutLink());
$tpl->setRef('debug', $out->mDebugtext);
$tpl->set('reporttime', wfReportTime());
$tpl->set('sitenotice', wfGetSiteNotice());
$tpl->set('bottomscripts', $this->bottomScripts());
$printfooter = "<div class=\"printfooter\">\n" . $this->printSource() . "</div>\n";
$out->mBodytext .= $printfooter;
$tpl->setRef('bodytext', $out->mBodytext);
# Language links
$language_urls = array();
if (!$wgHideInterlanguageLinks) {
foreach ($out->getLanguageLinks() as $l) {
$tmp = explode(':', $l, 2);
$class = 'interwiki-' . $tmp[0];
unset($tmp);
$nt = Title::newFromText($l);
if ($nt) {
$language_urls[] = array('href' => $nt->getFullURL(), 'text' => $wgContLang->getLanguageName($nt->getInterwiki()) != '' ? $wgContLang->getLanguageName($nt->getInterwiki()) : $l, 'class' => $class);
}
}
}
if (count($language_urls)) {
$tpl->setRef('language_urls', $language_urls);
} else {
$tpl->set('language_urls', false);
}
wfProfileOut(__METHOD__ . "-stuff4");
wfProfileIn(__METHOD__ . "-stuff5");
# Personal toolbar
$tpl->set('personal_urls', $this->buildPersonalUrls());
$content_actions = $this->buildContentActionUrls();
$tpl->setRef('content_actions', $content_actions);
// XXX: attach this from javascript, same with section editing
if ($this->iseditable && $wgUser->getOption("editondblclick")) {
$encEditUrl = Xml::escapeJsString($this->mTitle->getLocalUrl($this->editUrlOptions()));
$tpl->set('body_ondblclick', 'document.location = "' . $encEditUrl . '";');
} else {
$tpl->set('body_ondblclick', false);
}
$tpl->set('body_onload', false);
$tpl->set('sidebar', $this->buildSidebar());
$tpl->set('nav_urls', $this->buildNavUrls());
// original version by hansm
if (!wfRunHooks('SkinTemplateOutputPageBeforeExec', array(&$this, &$tpl))) {
wfDebug(__METHOD__ . ': Hook SkinTemplateOutputPageBeforeExec broke outputPage execution!');
}
// allow extensions adding stuff after the page content.
// See Skin::afterContentHook() for further documentation.
$tpl->set('dataAfterContent', $this->afterContentHook());
wfProfileOut(__METHOD__ . "-stuff5");
// execute template
wfProfileIn(__METHOD__ . "-execute");
$res = $tpl->execute();
wfProfileOut(__METHOD__ . "-execute");
// result may be an error
$this->printOrError($res);
wfProfileOut(__METHOD__);
}
示例12: wfEmergencyAbort
/**
* Standard fail function, called by default when a connection cannot be
* established.
* Displays the file cache if possible
*/
function wfEmergencyAbort(&$conn, $error)
{
global $wgTitle, $wgUseFileCache, $title, $wgInputEncoding, $wgOutputEncoding;
global $wgSitename, $wgServer, $wgMessageCache, $wgLogo;
# I give up, Brion is right. Getting the message cache to work when there is no DB is tricky.
# Hard coding strings instead.
$noconnect = "<h1><img src='{$wgLogo}' style='float:left;margin-right:1em' alt=''>{$wgSitename} has a problem</h1><p><strong>Sorry! This site is experiencing technical difficulties.</strong></p><p>Try waiting a few minutes and reloading.</p><p><small>(Can't contact the database server: \$1)</small></p>";
$mainpage = 'Main Page';
$searchdisabled = <<<EOT
<p style="margin: 1.5em 2em 1em">{$wgSitename} search is disabled for performance reasons. You can search via Google in the meantime.
<span style="font-size: 89%; display: block; margin-left: .2em">Note that their indexes of {$wgSitename} content may be out of date.</span></p>',
EOT;
$googlesearch = "\n<!-- SiteSearch Google -->\n<FORM method=GET action=\"http://www.google.com/search\">\n<TABLE bgcolor=\"#FFFFFF\"><tr><td>\n<A HREF=\"http://www.google.com/\">\n<IMG SRC=\"http://www.google.com/logos/Logo_40wht.gif\"\nborder=\"0\" ALT=\"Google\"></A>\n</td>\n<td>\n<INPUT TYPE=text name=q size=31 maxlength=255 value=\"\$1\">\n<INPUT type=submit name=btnG VALUE=\"Google Search\">\n<font size=-1>\n<input type=hidden name=domains value=\"{$wgServer}\"><br /><input type=radio name=sitesearch value=\"\"> WWW <input type=radio name=sitesearch value=\"{$wgServer}\" checked> {$wgServer} <br />\n<input type='hidden' name='ie' value='\$2'>\n<input type='hidden' name='oe' value='\$2'>\n</font>\n</td></tr></TABLE>\n</FORM>\n<!-- SiteSearch Google -->";
$cachederror = "The following is a cached copy of the requested page, and may not be up to date. ";
if (!headers_sent()) {
header('HTTP/1.0 500 Internal Server Error');
header('Content-type: text/html; charset=' . $wgOutputEncoding);
/* Don't cache error pages! They cause no end of trouble... */
header('Cache-control: none');
header('Pragma: nocache');
}
# No database access
if (is_object($wgMessageCache)) {
$wgMessageCache->disable();
}
$msg = wfGetSiteNotice();
if ($msg == '') {
$msg = str_replace('$1', htmlspecialchars($error), $noconnect);
}
$text = $msg;
if ($wgUseFileCache) {
if ($wgTitle) {
$t =& $wgTitle;
} else {
if ($title) {
$t = Title::newFromURL($title);
} elseif (@$_REQUEST['search']) {
$search = $_REQUEST['search'];
echo $searchdisabled;
echo str_replace(array('$1', '$2'), array(htmlspecialchars($search), $wgInputEncoding), $googlesearch);
wfErrorExit();
} else {
$t = Title::newFromText($mainpage);
}
}
$cache = new CacheManager($t);
if ($cache->isFileCached()) {
$msg = '<p style="color: red"><b>' . $msg . "<br />\n" . $cachederror . "</b></p>\n";
$tag = '<div id="article">';
$text = str_replace($tag, $tag . $msg, $cache->fetchPageText());
}
}
echo $text;
wfErrorExit();
}
示例13: outputPage
//.........这里部分代码省略.........
$dbr = wfGetDB(DB_SLAVE);
$watchlist = $dbr->tableName('watchlist');
$res = $dbr->select('watchlist', array('COUNT(*) AS n'), array('wl_title' => $dbr->strencode($this->mTitle->getDBkey()), 'wl_namespace' => $this->mTitle->getNamespace()), __METHOD__);
$x = $dbr->fetchObject($res);
$numberofwatchingusers = $x->n;
if ($numberofwatchingusers > 0) {
$tpl->set('numberofwatchingusers', wfMsgExt('number_of_watching_users_pageview', array('parseinline'), $wgLang->formatNum($numberofwatchingusers)));
} else {
$tpl->set('numberofwatchingusers', false);
}
} else {
$tpl->set('numberofwatchingusers', false);
}
$tpl->set('copyright', $this->getCopyright());
$this->credits = false;
if ($wgMaxCredits != 0) {
$this->credits = Credits::getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax);
} else {
$tpl->set('lastmod', $this->lastModified());
}
$tpl->setRef('credits', $this->credits);
} elseif (isset($oldid) && !isset($diff)) {
$tpl->set('copyright', $this->getCopyright());
$tpl->set('viewcount', false);
$tpl->set('lastmod', false);
$tpl->set('credits', false);
$tpl->set('numberofwatchingusers', false);
} else {
$tpl->set('copyright', false);
$tpl->set('viewcount', false);
$tpl->set('lastmod', false);
$tpl->set('credits', false);
$tpl->set('numberofwatchingusers', false);
}
wfProfileOut(__METHOD__ . '-stuff3');
wfProfileIn(__METHOD__ . '-stuff4');
$tpl->set('copyrightico', $this->getCopyrightIcon());
$tpl->set('poweredbyico', $this->getPoweredBy());
$tpl->set('disclaimer', $this->disclaimerLink());
$tpl->set('privacy', $this->privacyLink());
$tpl->set('about', $this->aboutLink());
if ($wgDebugComments) {
$tpl->setRef('debug', $out->mDebugtext);
} else {
$tpl->set('debug', '');
}
$tpl->set('reporttime', wfReportTime());
$tpl->set('sitenotice', wfGetSiteNotice());
$tpl->set('bottomscripts', $this->bottomScripts());
$printfooter = "<div class=\"printfooter\">\n" . $this->printSource() . "</div>\n";
$out->mBodytext .= $printfooter . $this->generateDebugHTML();
$tpl->setRef('bodytext', $out->mBodytext);
# Language links
$language_urls = array();
if (!$wgHideInterlanguageLinks) {
foreach ($out->getLanguageLinks() as $l) {
$tmp = explode(':', $l, 2);
$class = 'interwiki-' . $tmp[0];
unset($tmp);
$nt = Title::newFromText($l);
if ($nt) {
$language_urls[] = array('href' => $nt->getFullURL(), 'text' => $wgContLang->getLanguageName($nt->getInterwiki()) != '' ? $wgContLang->getLanguageName($nt->getInterwiki()) : $l, 'class' => $class);
}
}
}
if (count($language_urls)) {
$tpl->setRef('language_urls', $language_urls);
} else {
$tpl->set('language_urls', false);
}
wfProfileOut(__METHOD__ . '-stuff4');
wfProfileIn(__METHOD__ . '-stuff5');
# Personal toolbar
$tpl->set('personal_urls', $this->buildPersonalUrls());
$content_actions = $this->buildContentActionUrls();
$tpl->setRef('content_actions', $content_actions);
$tpl->set('sidebar', $this->buildSidebar());
$tpl->set('nav_urls', $this->buildNavUrls());
// Set the head scripts near the end, in case the above actions resulted in added scripts
if ($this->useHeadElement) {
$tpl->set('headelement', $out->headElement($this));
} else {
$tpl->set('headscripts', $out->getScript());
}
// original version by hansm
if (!wfRunHooks('SkinTemplateOutputPageBeforeExec', array(&$this, &$tpl))) {
wfDebug(__METHOD__ . ": Hook SkinTemplateOutputPageBeforeExec broke outputPage execution!\n");
}
// allow extensions adding stuff after the page content.
// See Skin::afterContentHook() for further documentation.
$tpl->set('dataAfterContent', $this->afterContentHook());
wfProfileOut(__METHOD__ . '-stuff5');
// execute template
wfProfileIn(__METHOD__ . '-execute');
$res = $tpl->execute();
wfProfileOut(__METHOD__ . '-execute');
// result may be an error
$this->printOrError($res);
wfProfileOut(__METHOD__);
}