本文整理汇总了PHP中wfMsgHTML函数的典型用法代码示例。如果您正苦于以下问题:PHP wfMsgHTML函数的具体用法?PHP wfMsgHTML怎么用?PHP wfMsgHTML使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfMsgHTML函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: qpuserchoice
function qpuserchoice(Parser &$parser, PPFrame $frame, array $args)
{
$this->frame = $frame;
$this->args =& $args;
if (isset($args[0])) {
# args[0] is a poll address
$this->pollAddr = trim($this->frame->expand($this->args[0]));
$this->pollStore = qp_PollStore::newFromAddr($this->pollAddr);
if ($this->pollStore instanceof qp_PollStore && $this->pollStore->pid !== null) {
$this->error_message = 'missing_question_id';
if (isset($args[1])) {
# args[1] is question_id
$qdata = $this->getQuestionData(trim($frame->expand($args[1])));
if ($qdata instanceof qp_QuestionData) {
$this->error_message = 'missing_proposal_id';
if (isset($args[2])) {
# get poll's proposal choice
$this->proposal_id = trim($frame->expand($args[2]));
$this->error_message = 'invalid_proposal_id';
if (preg_match(qp_Setup::PREG_NON_NEGATIVE_INT4_MATCH, $this->proposal_id)) {
$this->defaultProposalText = isset($args[3]) ? trim($frame->expand($args[3])) : '';
$this->proposal_id = intval($this->proposal_id);
$this->error_message = 'missing_proposal_id';
if (array_key_exists($this->proposal_id, $qdata->ProposalText)) {
return $this->qpuserchoiceValidResult($qdata);
}
}
}
}
}
}
}
return '<strong class="error">qpuserchoice: ' . wfMsgHTML('qp_func_' . $this->error_message, qp_Setup::specialchars($this->pollAddr), qp_Setup::specialchars($this->question_id), qp_Setup::specialchars($this->proposal_id)) . '</strong>';
}
示例2: execute
/**
* Main execution function
* @param $par Parameters passed to the page
*/
function execute($par)
{
global $wgOut, $wgUser;
wfLoadExtensionMessages('Gadgets');
$skin = $wgUser->getSkin();
$this->setHeaders();
$wgOut->setPagetitle(wfMsg("gadgets-title"));
$wgOut->addWikiText(wfMsg("gadgets-pagetext"));
$gadgets = wfLoadGadgetsStructured();
if (!$gadgets) {
return;
}
$listOpen = false;
$msgOpt = array('parseinline', 'parsemag');
foreach ($gadgets as $section => $entries) {
if ($section !== false && $section !== '') {
$t = Title::makeTitleSafe(NS_MEDIAWIKI, "Gadget-section-{$section}");
$lnk = $t ? $skin->makeLinkObj($t, wfMsgHTML("edit")) : htmlspecialchars($section);
$ttext = wfMsgExt("gadget-section-{$section}", $msgOpt);
if ($listOpen) {
$wgOut->addHTML('</ul>');
$listOpen = false;
}
$wgOut->addHTML("\n<h2>{$ttext} [{$lnk}]</h2>\n");
}
foreach ($entries as $gname => $code) {
$t = Title::makeTitleSafe(NS_MEDIAWIKI, "Gadget-{$gname}");
if (!$t) {
continue;
}
$lnk = $skin->makeLinkObj($t, wfMsgHTML("edit"));
$ttext = wfMsgExt("gadget-{$gname}", $msgOpt);
if (!$listOpen) {
$listOpen = true;
$wgOut->addHTML('<ul>');
}
$wgOut->addHTML("<li>");
$wgOut->addHTML("{$ttext} [{$lnk}]<br/>");
$wgOut->addHTML(wfMsgHTML("gadgets-uses") . ": ");
$first = true;
foreach ($code as $codePage) {
$t = Title::makeTitleSafe(NS_MEDIAWIKI, "Gadget-{$codePage}");
if (!$t) {
continue;
}
if ($first) {
$first = false;
} else {
$wgOut->addHTML(", ");
}
$lnk = $skin->makeLinkObj($t, htmlspecialchars($t->getText()));
$wgOut->addHTML($lnk);
}
$wgOut->addHtml("</li>");
}
}
if ($listOpen) {
$wgOut->addHTML('</ul>');
}
}
示例3: insertTab
function insertTab($skin, &$content_actions)
{
if (!$skin->getTitle()->exists()) {
return true;
}
$linkParam = "page=" . $skin->getTitle()->getPrefixedURL();
$special = SpecialPage::getTitleFor('FlagPage');
$content_actions['flagpage'] = array('class' => false, 'text' => wfMsgHTML('flagpage-tab'), 'href' => $special->getLocalUrl($linkParam));
return true;
}
示例4: showSiteSelectForm
function showSiteSelectForm($invalid = false)
{
global $wgOut, $wgScript;
$legend = wfMsgHtml('configurewmf-selectsite');
$wgOut->addHTML("<fieldset><legend>{$legend}</legend>");
if ($invalid) {
$wgOut->addHTML('<p><strong class="error">' . htmlspecialchars(wfMsg('configurewmf-invalidwiki', $invalid)) . '</strong></p>');
}
$wgOut->addHTML('<strong id="cfgwmf-attention" style="color: red; font-size: 12pt">' . wfMsgHTML('configurewmf-attentionnotice') . '</strong>');
$wgOut->addWikiMsg('configurewmf-selectsite-help');
$wgOut->addHTML("<form action='{$wgScript}' method='get'>");
$wgOut->addHTML('<p>' . Html::Hidden('title', $this->getTitle()->getFullText()) . '</p><table><tr>');
$wgOut->addHTML('<td class="mw-label">' . Xml::label(wfMsg('configurewmf-site'), 'cfg-site') . '</td>');
$wgOut->addHTML('<td class="mw-input">' . Xml::input('wiki', false, false, array('id' => 'cfg-site')) . '</td>');
$wgOut->addHTML('</tr><tr><td></td><td class="mw-input">' . Xml::submitButton(wfMsg('configurewmf-select')) . '</td>');
$wgOut->addHTML("</tr></table></form></fieldset>");
}
示例5: doQuery
/**
* This is the actual workhorse. It does everything needed to make a
* real, honest-to-gosh query page.
* Alas, we need to overwrite the whole beast since we do not assume
* an SQL-based storage backend.
*
* @param $offset database query offset
* @param $limit database query limit
*/
function doQuery($offset = false, $limit = false)
{
global $wgOut, $wgContLang;
$options = new SMWRequestOptions();
$options->limit = $limit;
$options->offset = $offset;
$options->sort = true;
$res = $this->getResults($options);
$num = count($res);
$sk = $this->getSkin();
$sname = $this->getName();
$wgOut->addHTML($this->getPageHeader());
// if list is empty, show it
if ($num == 0) {
$wgOut->addHTML('<p>' . wfMsgHTML('specialpage-empty') . '</p>');
return;
}
$top = wfShowingResults($offset, $num);
$wgOut->addHTML("<p>{$top}\n");
// often disable 'next' link when we reach the end
$atend = $num < $limit;
$sl = wfViewPrevNext($offset, $limit, $wgContLang->specialPage($sname), wfArrayToCGI($this->linkParameters()), $atend);
$wgOut->addHTML("<br />{$sl}</p>\n");
if ($num > 0) {
$s = array();
if (!$this->listoutput) {
$s[] = $this->openList($offset);
}
foreach ($res as $r) {
$format = $this->formatResult($sk, $r);
if ($format) {
$s[] = $this->listoutput ? $format : "<li>{$format}</li>\n";
}
}
if (!$this->listoutput) {
$s[] = $this->closeList();
}
$str = $this->listoutput ? $wgContLang->listToText($s) : implode('', $s);
$wgOut->addHTML($str);
}
$wgOut->addHTML("<p>{$sl}</p>\n");
return $num;
}
示例6: doQuery
function doQuery($offset, $limit, $shownavigation = true)
{
global $wgOut, $wgContLang;
$res = $this->getIntervalResults($offset, $limit);
$num = count($res);
if ($shownavigation) {
$wgOut->addHTML($this->getPageHeader());
// if list is empty, display a warning
if ($num == 0) {
$wgOut->addHTML('<p>' . wfMsgHTML('specialpage-empty') . '</p>');
return;
}
$top = wfShowingResults($offset, $num);
$wgOut->addHTML("<p>{$top}\n");
// often disable 'next' link when we reach the end
$atend = $num < $limit;
$sl = wfViewPrevNext($offset, $limit, $wgContLang->specialPage($this->queryPageName()), wfArrayToCGI($this->linkParameters()), $atend);
$wgOut->addHTML("<br />{$sl}</p>\n");
}
if ($num > 0) {
$s = array();
if (!$this->listoutput) {
$s[] = $this->openList($offset);
}
foreach ($res as $r) {
$format = $this->formatResult($r);
if ($format) {
$s[] = $this->listoutput ? $format : "<li>{$format}</li>\n";
}
}
if (!$this->listoutput) {
$s[] = $this->closeList();
}
$str = $this->listoutput ? $wgContLang->listToText($s) : implode('', $s);
$wgOut->addHTML($str);
}
if ($shownavigation) {
$wgOut->addHTML("<p>{$sl}</p>\n");
}
return $num;
}
示例7: execute
/**
* Executes special page rendering and data processing
*
* @param $sub Mixed: MediaWiki supplied sub-page path
*/
public function execute($sub)
{
global $wgRequest, $wgOut, $wgUser;
// Begin output
$this->setHeaders();
// Make sure the user is logged in
if (!$wgUser->isLoggedIn()) {
// If not, let them know they need to
$wgOut->loginToUse();
// Continue
return true;
}
// Handle discarding
$draft = Draft::newFromID($wgRequest->getIntOrNull('discard'));
if ($draft->exists()) {
// Discard draft
$draft->discard();
// Redirect to the article editor or view if returnto was set
$section = $wgRequest->getIntOrNull('section');
$urlSection = $section !== null ? "§ion={$section}" : '';
switch ($wgRequest->getText('returnto')) {
case 'edit':
$title = Title::newFromDBKey($draft->getTitle());
$wgOut->redirect(wfExpandURL($title->getEditURL() . $urlSection));
break;
case 'view':
$title = Title::newFromDBKey($draft->getTitle());
$wgOut->redirect(wfExpandURL($title->getFullURL() . $urlSection));
break;
}
}
// Show list of drafts, or a message that there are none
if (Drafts::display() == 0) {
$wgOut->addHTML(wfMsgHTML('drafts-view-nonesaved'));
}
}
示例8: execute
function execute($par)
{
global $wgOut, $wgRequest;
$format = $wgRequest->getVal("format", false);
if ($format === "xml" || $format === "csv") {
$this->generateList($format);
} else {
$wgOut->setPageTitle(wfMsg('newwikis'));
$up = new NewWikisPage($par);
# getBody() first to check, if empty
$usersbody = $up->getBody();
$s = Xml::openElement('div', array('class' => 'mw-spcontent'));
$s .= $up->getPageHeader();
if ($usersbody) {
$s .= $up->getNavigationBar();
$s .= '<ul>' . $usersbody . '</ul>';
$s .= $up->getNavigationBar();
} else {
$s .= '<p>' . wfMsgHTML('listusers-noresult') . '</p>';
}
$s .= Xml::closeElement('div');
$wgOut->addHTML($s);
}
}
示例9: loadRevisionData
/**
* Load revision metadata for the specified articles. If newid is 0, then compare
* the old article in oldid to the current article; if oldid is 0, then
* compare the current article to the immediately previous one (ignoring the
* value of newid).
*
* If oldid is false, leave the corresponding revision object set
* to false. This is impossible via ordinary user input, and is provided for
* API convenience.
*/
function loadRevisionData()
{
global $wgLang, $wgTitle, $wgLanguageCode, $wgRequest;
if ($this->mRevisionsLoaded) {
return true;
} else {
// Whether it succeeds or fails, we don't want to try again
$this->mRevisionsLoaded = true;
}
// Load the new revision object
$this->mNewRev = $this->mNewid ? Revision::newFromId($this->mNewid) : Revision::newFromTitle($this->mTitle);
if (!$this->mNewRev instanceof Revision) {
return false;
}
// Update the new revision ID in case it was 0 (makes life easier doing UI stuff)
$this->mNewid = $this->mNewRev->getId();
// Set assorted variables
$timestamp = wfTimeAgo($this->mNewRev->getTimestamp());
$this->mNewDate = $timestamp;
$this->mNewPage = $this->mNewRev->getTitle();
if ($this->mNewRev->isCurrent()) {
$newLink = $this->mNewPage->escapeLocalUrl();
$this->mPagetitle = htmlspecialchars(wfMsg('currentrev'));
$newEdit = $this->mNewPage->escapeLocalUrl('action=edit');
//XXADDED for quick edit
if ($wgTitle->getNamespace() != NS_SPECIAL && $wgLanguageCode == 'en') {
$editURL = $wgServer . '/Special:Newarticleboost?type=editform&target=' . urlencode($wgTitle->getFullText());
//$this->mNewtitle .= " <a href=\"#\" onclick=\"initPopupEdit('".$editURL."') ;\">" . htmlspecialchars( wfMsg( 'editold-quick' ) ) . "</a> | ";
}
$this->mNewtitle = "<a href='{$newLink}'>{$this->mPagetitle}</a>" . " (<a href='{$newEdit}'>" . wfMsg('diff_edit') . "</a>)";
} else {
$newLink = $this->mNewPage->escapeLocalUrl('oldid=' . $this->mNewid);
$newEdit = $this->mNewPage->escapeLocalUrl('action=edit&oldid=' . $this->mNewid);
$this->mPagetitle = wfMsgHTML('revisionasof', $timestamp);
//XXADDED for quick edit
if ($wgTitle->getNamespace() != NS_SPECIAL && $wgLanguageCode == 'en' && $wgRequest->getVal("rcid", "") != "") {
$editURL = $wgServer . '/Special:Newarticleboost?type=editform&target=' . urlencode($wgTitle->getFullText());
$this->mNewtitle .= " <a href=\"#\" onclick=\"initPopupEdit('" . $editURL . "') ;\">" . htmlspecialchars(wfMsg('editold-quick')) . "</a> | ";
}
$this->mNewtitle = "<a href='{$newLink}'>{$this->mPagetitle}</a>" . " (<a href='{$newEdit}'>" . wfMsg('diff_edit') . "</a>) ";
}
if (!$this->mNewRev->userCan(Revision::DELETED_TEXT)) {
$this->mNewtitle = "<span class='history-deleted'>{$this->mPagetitle}</span>";
} else {
if ($this->mNewRev->isDeleted(Revision::DELETED_TEXT)) {
$this->mNewtitle = '<span class="history-deleted">' . $this->mNewtitle . '</span>';
}
}
// Load the old revision object
$this->mOldRev = false;
if ($this->mOldid) {
$this->mOldRev = Revision::newFromId($this->mOldid);
} elseif ($this->mOldid === 0) {
$rev = $this->mNewRev->getPrevious();
if ($rev) {
$this->mOldid = $rev->getId();
$this->mOldRev = $rev;
} else {
// No previous revision; mark to show as first-version only.
$this->mOldid = false;
$this->mOldRev = false;
}
}
/* elseif ( $this->mOldid === false ) leave mOldRev false; */
if (is_null($this->mOldRev)) {
return false;
}
if ($this->mOldRev) {
$this->mOldPage = $this->mOldRev->getTitle();
$t = wfTimeAgo($this->mOldRev->getTimestamp());
$oldLink = $this->mOldPage->escapeLocalUrl('oldid=' . $this->mOldid);
$oldEdit = $this->mOldPage->escapeLocalUrl('action=edit&oldid=' . $this->mOldid);
//$this->mOldPagetitle = htmlspecialchars( wfMsg( 'revisionasof', $t ) );
$oldTitle = "<a href='{$oldLink}'>" . wfMsg('diff_oldrev') . "</a> ";
$this->mOldtitle = $oldTitle . " (<a href='{$oldEdit}'>" . wfMsg('diff_edit') . "</a>)";
$this->mOldDate = $t;
// Add an "undo" link
$newUndo = $this->mNewPage->escapeLocalUrl('action=edit&undoafter=' . $this->mOldid . '&undo=' . $this->mNewid);
if ($this->mNewRev->userCan(Revision::DELETED_TEXT)) {
//$this->mNewtitle .= "<span id='undolink'>(<a href='$newUndo'>" . htmlspecialchars( wfMsg( 'editundo' ) ) . "</a>)</span>";
if (!$this->mOldRev->userCan(Revision::DELETED_TEXT)) {
$this->mOldtitle = "<span class='history-deleted'>{$this->mOldPagetitle}</span>";
} else {
if ($this->mOldRev->isDeleted(Revision::DELETED_TEXT)) {
$this->mOldtitle = '<span class="history-deleted">' . $this->mOldtitle . '</span>';
}
}
}
}
return true;
//.........这里部分代码省略.........
示例10: getNavigationBar
/**
* Shamelessly stolen bits from ReverseChronologicalPager,
* didn't want to do class magic as may be still revamped
*/
function getNavigationBar()
{
global $wgLang;
if (isset($this->mNavigationBar)) {
return $this->mNavigationBar;
}
$opts = array('parsemag', 'escapenoentities');
$linkTexts = array('prev' => wfMsgExt('prevn', $opts, $wgLang->formatNum($this->mLimit)), 'next' => wfMsgExt('nextn', $opts, $wgLang->formatNum($this->mLimit)), 'first' => wfMsgExt('page_first', $opts), 'last' => wfMsgExt('page_last', $opts));
$pagingLinks = $this->getPagingLinks($linkTexts);
$limitLinks = $this->getLimitLinks();
$limits = $wgLang->pipeList($limitLinks);
$this->mNavigationBar = "(" . $wgLang->pipeList(array($pagingLinks['first'], $pagingLinks['last'])) . ") " . wfMsgHtml('viewprevnext', $pagingLinks['prev'], $pagingLinks['next'], $limits);
if (!is_array($this->getIndexField())) {
# Early return to avoid undue nesting
return $this->mNavigationBar;
}
$extra = '';
$first = true;
$msgs = $this->getOrderTypeMessages();
foreach (array_keys($msgs) as $order) {
if ($first) {
$first = false;
} else {
$extra .= wfMsgExt('pipe-separator', 'escapenoentities');
}
if ($order == $this->mOrderType) {
$extra .= wfMsgHTML($msgs[$order]);
} else {
$extra .= $this->makeLink(wfMsgHTML($msgs[$order]), array('order' => $order));
}
}
if ($extra !== '') {
$this->mNavigationBar .= " ({$extra})";
}
return $this->mNavigationBar;
}
示例11: showDiff
function showDiff($revision)
{
global $wgOut;
$dbr = wfGetDB(DB_SLAVE);
$result = $this->getRevisions($dbr, array('hidden_rev_id' => $revision));
while ($row = $dbr->fetchObject($result)) {
$info = $this->listRow($row);
$list = $this->revisionInfo($row);
$rev = new Revision($row);
$rev->mTitle = Title::makeTitle($row->page_namespace, $row->page_title);
$prevId = $rev->mTitle->getPreviousRevisionID($row->rev_id);
if ($prevId) {
$prev = Revision::newFromTitle($rev->mTitle, $prevId);
$otext = strval($prev->getText());
} else {
$wgOut->addHtml("<ul>" . $info . "</ul>\n" . $list);
$wgOut->addWikiText(wfMsgNoTrans('oversight-nodiff'));
return;
}
$ntext = strval($rev->getText());
$diffEngine = new DifferenceEngine();
$diffEngine->showDiffStyle();
$wgOut->addHtml("<ul>" . $info . "</ul>\n" . $list . "<p><strong>" . wfMsgHTML('oversight-difference') . "</strong>" . "</p>" . "<div>" . "<table border='0' width='98%' cellpadding='0' cellspacing='4' class='diff'>" . "<col class='diff-marker' />" . "<col class='diff-content' />" . "<col class='diff-marker' />" . "<col class='diff-content' />" . "<tr>" . "<td colspan='2' width='50%' align='center' class='diff-otitle'>" . wfMsgHTML('oversight-prev') . " (#{$prevId})" . "</td>" . "<td colspan='2' width='50%' align='center' class='diff-ntitle'>" . wfMsgHTML('oversight-hidden') . "</td>" . "</tr>" . $diffEngine->generateDiffBody($otext, $ntext) . "</table>" . "</div>\n");
}
$dbr->freeResult($result);
}
示例12: display
/**
* Outputs a table of existing drafts
*
* @param $title Object: [optional] Title of article, defaults to all articles
* @param $userID Integer: [optional] ID of user, defaults to current user
* @return Number of drafts in the table
*/
public static function display($title = null, $userID = null)
{
global $wgOut, $wgRequest, $wgUser, $wgLang;
// Gets draftID
$currentDraft = Draft::newFromID($wgRequest->getIntOrNull('draft'));
// Output HTML for list of drafts
$drafts = Drafts::get($title, $userID);
if (count($drafts) > 0) {
global $egDraftsLifeSpan;
// Internationalization
// Add a summary, on Special:Drafts only
if (!$title || $title->getNamespace() == NS_SPECIAL) {
$wgOut->wrapWikiMsg('<div class="mw-drafts-summary">$1</div>', array('drafts-view-summary', $wgLang->formatNum($egDraftsLifeSpan)));
}
// Build XML
$wgOut->addHTML(Xml::openElement('table', array('cellpadding' => 5, 'cellspacing' => 0, 'width' => '100%', 'border' => 0, 'id' => 'drafts-list-table')));
$wgOut->addHTML(Xml::openElement('tr'));
$wgOut->addHTML(Xml::element('th', array('width' => '75%', 'nowrap' => 'nowrap'), wfMsg('drafts-view-article')));
$wgOut->addHTML(Xml::element('th', null, wfMsg('drafts-view-saved')));
$wgOut->addHTML(Xml::element('th'));
$wgOut->addHTML(Xml::closeElement('tr'));
// Add existing drafts for this page and user
foreach ($drafts as $draft) {
// Get article title text
$htmlTitle = $draft->getTitle()->getEscapedText();
// Build Article Load link
$urlLoad = $draft->getTitle()->getFullURL('action=edit&draft=' . urlencode($draft->getID()));
// Build discard link
$urlDiscard = SpecialPage::getTitleFor('Drafts')->getFullURL(sprintf('discard=%s&token=%s', urlencode($draft->getID()), urlencode($wgUser->editToken())));
// If in edit mode, return to editor
if ($wgRequest->getText('action') == 'edit' || $wgRequest->getText('action') == 'submit') {
$urlDiscard .= '&returnto=' . urlencode('edit');
}
// Append section to titles and links
if ($draft->getSection() !== null) {
// Detect section name
$lines = explode("\n", $draft->getText());
// If there is any content in the section
if (count($lines) > 0) {
$htmlTitle .= '#' . htmlspecialchars(trim(trim(substr($lines[0], 0, 255), '=')));
}
// Modify article link and title
$urlLoad .= '§ion=' . urlencode($draft->getSection());
$urlDiscard .= '§ion=' . urlencode($draft->getSection());
}
// Build XML
$wgOut->addHTML(Xml::openElement('tr'));
$wgOut->addHTML(Xml::openElement('td'));
$wgOut->addHTML(Xml::element('a', array('href' => $urlLoad, 'style' => 'font-weight:' . ($currentDraft->getID() == $draft->getID() ? 'bold' : 'normal')), $htmlTitle));
$wgOut->addHTML(Xml::closeElement('td'));
$wgOut->addHTML(Xml::element('td', null, $wgLang->timeanddate($draft->getSaveTime(), true)));
$wgOut->addHTML(Xml::openElement('td'));
$jsClick = "if( wgDraft.getState() !== 'unchanged' )" . "return confirm('" . Xml::escapeJsString(wfMsgHTML('drafts-view-warn')) . "')";
$wgOut->addHTML(Xml::element('a', array('href' => $urlDiscard, 'onclick' => $jsClick), wfMsg('drafts-view-discard')));
$wgOut->addHTML(Xml::closeElement('td'));
$wgOut->addHTML(Xml::closeElement('tr'));
}
$wgOut->addHTML(Xml::closeElement('table'));
// Return number of drafts
return count($drafts);
}
return 0;
}
示例13: wfReviewExtensionAfterToolbox
/**
* Display in sidebar
* @param $tpl The used template
*/
function wfReviewExtensionAfterToolbox(&$tpl)
{
global $wgTitle, $wgUser, $wgReviewExtensionTopics, $wgArticle, $action, $wgRequest;
# Do we care?
if (!wfReviewExtensionDoesNamespaceApply($wgTitle->getNamespace()) or $wgUser->isBlocked() or $action != "view") {
return true;
}
# Initialize
$do_merge = $wgRequest->getBool('do_merge', false);
$skin =& $wgUser->getSkin();
$revision = $wgArticle->getRevIdFetched();
wfReviewExtensionInitMessages();
$ratings = wfReviewExtensionGetUserRatingsForPage($wgTitle, $wgUser);
$did_update_review = wfReviewExtensionReadLastForm($ratings, $wgTitle, $do_merge);
if (!isset($ratings[$revision])) {
# Construct blank dummy, if necessary
$ratings[$revision] = array();
}
wfReviewExtensionPresetForm($wgReviewExtensionTopics, $ratings[$revision]);
?>
</ul>
</div>
</div>
<div class="portlet" id="p-tasks">
<h5>
<?php
$tpl->msg('review_sidebar_title');
?>
</h5>
<div class="pBody">
<form method='post' id="review_sidebar">
<?php
if ($did_update_review) {
print '<span id="review_has_been_stored">' . wfMsgForContent('review_has_been_stored') . '</span><br />';
}
print wfMsgForContent('review_your_review') . "<br />";
foreach ($wgReviewExtensionTopics as $topic) {
?>
<a id="review_sidebar_link" href="
<?php
$topic_title = Title::makeTitleSafe(NS_MEDIAWIKI, wfMsgForContent('review_topic_page') . '#' . $topic['name']);
print $topic_title->escapeLocalURL();
?>
">
<?php
echo $topic['name'];
?>
</a>
<?php
if ($topic['range'] > 2) {
print "<small> (" . $topic['left'] . "→" . $topic['right'] . ")</small><br />";
}
echo "<div id='review_sidebar_range'>" . wfReviewExtensionGetTopicForm($topic) . "</div>";
}
print "<input type='hidden' name='review_oldid' value='{$revision}'/>\n";
if (count($ratings) > 1) {
# "Merge" CHECKBOX
print "<div id='review_sidebar_range'><input type='checkbox' checked name='do_merge' value='1'/>" . wfMsgForContent('review_do_merge') . "</div>\n";
} else {
# Hidden field "don't merge"
print "<input type='hidden' name='do_merge' value='0'/>\n";
}
print "<input style='width:100%' type='submit' name='save_review' value='" . wfMsgForContent('review_save') . "'/>";
print "<div id='review_sidebar_note'>";
print wfMsgForContent('review_sidebar_explanation');
if (count($ratings) > 1) {
print " " . wfMsgForContent('review_sidebar_you_have_other_reviews_for_this_article');
}
print "<br />";
$stat_title = Title::makeTitleSafe(NS_SPECIAL, "Review");
$link = $skin->makeLinkObj($stat_title, wfMsgHTML('review_page_link'), "mode=view_page_statistics&page_id=" . $wgTitle->getArticleID());
$out = str_replace("\$1", $link, wfMsg('review_sidebar_final'));
print $out;
?>
</div></form>
<ul>
<?php
return true;
}
示例14: insertTab
/**
* @param $skin
* @param $content_actions
* @return bool
*/
function insertTab($skin, &$content_actions)
{
$special = SpecialPage::getTitleFor('HideRevision');
$content_actions['hiderevision'] = array('class' => false, 'text' => wfMsgHTML('hiderevision-tab'), 'href' => $special->getLocalUrl($this->mLinkParam));
return true;
}
示例15: loadRevisionData
/**
* Load revision metadata for the specified articles. If newid is 0, then compare
* the old article in oldid to the current article; if oldid is 0, then
* compare the current article to the immediately previous one (ignoring the
* value of newid).
*
* If oldid is false, leave the corresponding revision object set
* to false. This is impossible via ordinary user input, and is provided for
* API convenience.
*/
function loadRevisionData()
{
global $wgLang, $wgUser;
if ($this->mRevisionsLoaded) {
return true;
} else {
// Whether it succeeds or fails, we don't want to try again
$this->mRevisionsLoaded = true;
}
// Load the new revision object
$this->mNewRev = $this->mNewid ? Revision::newFromId($this->mNewid) : Revision::newFromTitle($this->mTitle);
if (!$this->mNewRev instanceof Revision) {
return false;
}
// Update the new revision ID in case it was 0 (makes life easier doing UI stuff)
$this->mNewid = $this->mNewRev->getId();
// Check if page is editable
$editable = $this->mNewRev->getTitle()->userCan('edit');
// Set assorted variables
$timestamp = $wgLang->timeanddate($this->mNewRev->getTimestamp(), true);
$this->mNewPage = $this->mNewRev->getTitle();
if ($this->mNewRev->isCurrent()) {
$newLink = $this->mNewPage->escapeLocalUrl('oldid=' . $this->mNewid);
$this->mPagetitle = wfMsgHTML('currentrev-asof', $timestamp);
$newEdit = $this->mNewPage->escapeLocalUrl('action=edit');
$this->mNewtitle = "<a href='{$newLink}'>{$this->mPagetitle}</a>";
$this->mNewtitle .= " (<a href='{$newEdit}'>" . wfMsgHtml($editable ? 'editold' : 'viewsourceold') . "</a>)";
} else {
$newLink = $this->mNewPage->escapeLocalUrl('oldid=' . $this->mNewid);
$newEdit = $this->mNewPage->escapeLocalUrl('action=edit&oldid=' . $this->mNewid);
$this->mPagetitle = wfMsgHTML('revisionasof', $timestamp);
$this->mNewtitle = "<a href='{$newLink}'>{$this->mPagetitle}</a>";
$this->mNewtitle .= " (<a href='{$newEdit}'>" . wfMsgHtml($editable ? 'editold' : 'viewsourceold') . "</a>)";
}
if (!$this->mNewRev->userCan(Revision::DELETED_TEXT)) {
$this->mNewtitle = "<span class='history-deleted'>{$this->mPagetitle}</span>";
} else {
if ($this->mNewRev->isDeleted(Revision::DELETED_TEXT)) {
$this->mNewtitle = '<span class="history-deleted">' . $this->mNewtitle . '</span>';
}
}
// Load the old revision object
$this->mOldRev = false;
if ($this->mOldid) {
$this->mOldRev = Revision::newFromId($this->mOldid);
} elseif ($this->mOldid === 0) {
$rev = $this->mNewRev->getPrevious();
if ($rev) {
$this->mOldid = $rev->getId();
$this->mOldRev = $rev;
} else {
// No previous revision; mark to show as first-version only.
$this->mOldid = false;
$this->mOldRev = false;
}
}
/* elseif ( $this->mOldid === false ) leave mOldRev false; */
if (is_null($this->mOldRev)) {
return false;
}
if ($this->mOldRev) {
$this->mOldPage = $this->mOldRev->getTitle();
$t = $wgLang->timeanddate($this->mOldRev->getTimestamp(), true);
$oldLink = $this->mOldPage->escapeLocalUrl('oldid=' . $this->mOldid);
$oldEdit = $this->mOldPage->escapeLocalUrl('action=edit&oldid=' . $this->mOldid);
$this->mOldPagetitle = htmlspecialchars(wfMsg('revisionasof', $t));
$this->mOldtitle = "<a href='{$oldLink}'>{$this->mOldPagetitle}</a>" . " (<a href='{$oldEdit}'>" . wfMsgHtml($editable ? 'editold' : 'viewsourceold') . "</a>)";
// Add an "undo" link
$newUndo = $this->mNewPage->escapeLocalUrl('action=edit&undoafter=' . $this->mOldid . '&undo=' . $this->mNewid);
$htmlLink = htmlspecialchars(wfMsg('editundo'));
$htmlTitle = $wgUser->getSkin()->tooltip('undo');
if ($editable && !$this->mOldRev->isDeleted(Revision::DELETED_TEXT) && !$this->mNewRev->isDeleted(Revision::DELETED_TEXT)) {
$this->mNewtitle .= " (<a href='{$newUndo}' {$htmlTitle}>" . $htmlLink . "</a>)";
}
if (!$this->mOldRev->userCan(Revision::DELETED_TEXT)) {
$this->mOldtitle = '<span class="history-deleted">' . $this->mOldPagetitle . '</span>';
} else {
if ($this->mOldRev->isDeleted(Revision::DELETED_TEXT)) {
$this->mOldtitle = '<span class="history-deleted">' . $this->mOldtitle . '</span>';
}
}
}
return true;
}