本文整理汇总了PHP中wfElement函数的典型用法代码示例。如果您正苦于以下问题:PHP wfElement函数的具体用法?PHP wfElement怎么用?PHP wfElement使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfElement函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: showDiffPage
//.........这里部分代码省略.........
$fromrc = "";
if ($wgRequest->getVal('fromrc', null) != null) {
$fromrc = "&fromrc=1";
}
if ($this->mRcidMarkPatrolledCount > 1) {
$msg = wfMsg('markaspatrolleddiff_multiple', $this->mRcidMarkPatrolledCount);
$patrol = '[' . $sk->makeKnownLinkObj($this->mTitle, $msg, "action=markpatrolled&rcid={$this->mRcidMarkPatrolled}&show_namespace={$show_namespace}" . "&invert={$invert}&reverse={$reverse}&featured={$featured}" . "&rchi={$this->mRcidMarkPatrolledMax}&rclow={$this->mRcidMarkPatrolledMin}{$fromrc}", '', '', "accesskey='p'") . ']';
$patrol .= '[' . $sk->makeKnownLinkObj($this->mTitle, wfMsg('skip'), "action=markpatrolled&rcid={$this->mRcidMarkPatrolled}&show_namespace={$show_namespace}" . "&invert={$invert}&reverse={$reverse}&featured={$featured}" . "&rchi={$this->mRcidMarkPatrolledMax}&rclow={$this->mRcidMarkPatrolledMin}{$fromrc}&skip=1", '', '', "") . ']';
} else {
$patrol = '[' . $sk->makeKnownLinkObj($this->mTitle, wfMsg('markaspatrolleddiff'), "action=markpatrolled&rcid={$rcid}&show_namespace={$show_namespace}&invert={$invert}&reverse={$reverse}&featured={$featured}{$fromrc}", '', '', "accesskey='p'") . ']';
$patrol .= ' [' . $sk->makeKnownLinkObj($this->mTitle, wfMsg('skip'), "action=markpatrolled&rcid={$this->mRcidMarkPatrolled}&show_namespace={$show_namespace}&invert={$invert}&reverse={$reverse}&featured={$featured}&skip=1{$fromrc}") . ']';
}
$patrol = "<span id='markaspatrolledlinks'>{$patrol}</span>";
//XXADDED
} else {
$patrol = '';
}
} else {
$patrol = '';
}
//XXADDED
if ($wgUser->isAllowed('rollback') && $this->mTitle->userCanEdit()) {
//$rollback .= '<br/> <strong>' . SpamDiffTool::getDiffLink($this->mTitle) . '</strong>';
}
$prevlink = $sk->makeKnownLinkObj($this->mTitle, wfMsgHtml('previousdiff'), 'diff=prev&oldid=' . $this->mOldid, '', '', 'id="differences-prevlink"');
if ($this->mNewRev->isCurrent()) {
$nextlink = '';
} else {
$nextlink = $sk->makeKnownLinkObj($this->mTitle, wfMsgHtml('nextdiff'), 'diff=next&oldid=' . $this->mNewid, '', '', 'id="differences-nextlink"');
}
$oldminor = '';
$newminor = '';
if ($this->mOldRev->mMinorEdit == 1) {
$oldminor = wfElement('span', array('class' => 'minor'), wfMsg('minoreditletter')) . ' ';
}
if ($this->mNewRev->mMinorEdit == 1) {
$newminor = wfElement('span', array('class' => 'minor'), wfMsg('minoreditletter')) . ' ';
}
$rdel = '';
$ldel = '';
if ($wgUser->isAllowed('deleterevision')) {
$revdel = SpecialPage::getTitleFor('Revisiondelete');
if (!$this->mOldRev->userCan(Revision::DELETED_RESTRICTED)) {
// If revision was hidden from sysops
$ldel = wfMsgHtml('rev-delundel');
} else {
$ldel = $sk->makeKnownLinkObj($revdel, wfMsgHtml('rev-delundel'), 'target=' . urlencode($this->mOldRev->mTitle->getPrefixedDbkey()) . '&oldid=' . urlencode($this->mOldRev->getId()));
// Bolden oversighted content
if ($this->mOldRev->isDeleted(Revision::DELETED_RESTRICTED)) {
$ldel = "<strong>{$ldel}</strong>";
}
}
$ldel = " <tt>(<small>{$ldel}</small>)</tt> ";
// We don't currently handle well changing the top revision's settings
if ($this->mNewRev->isCurrent()) {
// If revision was hidden from sysops
$rdel = wfMsgHtml('rev-delundel');
} else {
if (!$this->mNewRev->userCan(Revision::DELETED_RESTRICTED)) {
// If revision was hidden from sysops
$rdel = wfMsgHtml('rev-delundel');
} else {
$rdel = $sk->makeKnownLinkObj($revdel, wfMsgHtml('rev-delundel'), 'target=' . urlencode($this->mNewRev->mTitle->getPrefixedDbkey()) . '&oldid=' . urlencode($this->mNewRev->getId()));
// Bolden oversighted content
if ($this->mNewRev->isDeleted(Revision::DELETED_RESTRICTED)) {
$rdel = "<strong>{$rdel}</strong>";
开发者ID:ErdemA,项目名称:wikihow,代码行数:67,代码来源:DifferenceEngine.php
示例2: getPageHeader
/**
* Show a drop down list to select a group as well as a user name
* search box.
* @todo localize
*/
function getPageHeader()
{
global $wgScript;
// Various variables used for the form
$action = htmlspecialchars($wgScript);
$title = Title::makeTitle(NS_SPECIAL, 'Listusers');
$special = htmlspecialchars($title->getPrefixedDBkey());
// form header
$out = '<form method="get" action="' . $action . '">' . '<input type="hidden" name="title" value="' . $special . '" />' . wfMsgHtml('groups-editgroup-name') . '<select name="group">';
// get all group names and IDs
$groups = User::getAllGroups();
// we want a default empty group
$out .= '<option value=""></option>';
// build the dropdown list menu using datas from the database
foreach ($groups as $group) {
$selected = $group == $this->requestedGroup;
$out .= wfElement('option', array_merge(array('value' => $group), $selected ? array('selected' => 'selected') : array()), User::getGroupName($group));
}
$out .= '</select> ';
$out .= wfMsgHtml('specialloguserlabel') . '<input type="text" name="username" /> ';
// OK button, end of form.
$out .= '<input type="submit" /></form>';
// congratulations the form is now build
return $out;
}
开发者ID:BackupTheBerlios,项目名称:openzaurus-svn,代码行数:30,代码来源:SpecialListusers.php
示例3: show
/**
* @param WebRequest $request
*/
function show($request)
{
global $wgOut, $wgUser;
$first = $this->revisions[0];
$wgOut->addWikiText(wfMsg('revdelete-selected', $this->page->getPrefixedText()));
$wgOut->addHtml("<ul>");
foreach ($this->revisions as $revid) {
$rev = Revision::newFromTitle($this->page, $revid);
$wgOut->addHtml($this->historyLine($rev));
$bitfields[] = $rev->mDeleted;
// FIXME
}
$wgOut->addHtml("</ul>");
$wgOut->addWikiText(wfMsg('revdelete-text'));
$items = array(wfInputLabel(wfMsg('revdelete-log'), 'wpReason', 'wpReason', 60), wfSubmitButton(wfMsg('revdelete-submit')));
$hidden = array(wfHidden('wpEditToken', $wgUser->editToken()), wfHidden('target', $this->page->getPrefixedText()));
foreach ($this->revisions as $revid) {
$hidden[] = wfHidden('oldid[]', $revid);
}
$special = Title::makeTitle(NS_SPECIAL, 'Revisiondelete');
$wgOut->addHtml(wfElement('form', array('method' => 'post', 'action' => $special->getLocalUrl('action=submit'))));
$wgOut->addHtml('<fieldset><legend>' . wfMsgHtml('revdelete-legend') . '</legend>');
foreach ($this->checks as $item) {
list($message, $name, $field) = $item;
$wgOut->addHtml('<div>' . wfCheckLabel(wfMsg($message), $name, $name, $rev->isDeleted($field)) . '</div>');
}
$wgOut->addHtml('</fieldset>');
foreach ($items as $item) {
$wgOut->addHtml('<p>' . $item . '</p>');
}
foreach ($hidden as $item) {
$wgOut->addHtml($item);
}
$wgOut->addHtml('</form>');
}
开发者ID:k-hasan-19,项目名称:wiki,代码行数:38,代码来源:SpecialRevisiondelete.php
示例4: wfSpecialMIMEsearch
/**
* constructor
*/
function wfSpecialMIMEsearch($par = null)
{
global $wgRequest, $wgTitle, $wgOut;
$mime = isset($par) ? $par : $wgRequest->getText('mime');
$wgOut->addHTML(wfElement('form', array('id' => 'specialmimesearch', 'method' => 'get', 'action' => $wgTitle->escapeLocalUrl()), null) . wfOpenElement('label') . wfMsgHtml('mimetype') . wfElement('input', array('type' => 'text', 'size' => 20, 'name' => 'mime', 'value' => $mime), '') . ' ' . wfElement('input', array('type' => 'submit', 'value' => wfMsg('ilsubmit')), '') . wfCloseElement('label') . wfCloseElement('form'));
list($major, $minor) = wfSpecialMIMEsearchParse($mime);
if ($major == '' or $minor == '' or !wfSpecialMIMEsearchValidType($major)) {
return;
}
$wpp = new MIMEsearchPage($major, $minor);
list($limit, $offset) = wfCheckLimits();
$wpp->doQuery($offset, $limit);
}
开发者ID:negabaro,项目名称:alfresco,代码行数:16,代码来源:SpecialMIMEsearch.php
示例5: getForm
/**
* Insert the captcha prompt into the edit form.
*/
function getForm()
{
$info = $this->pickImage();
if (!$info) {
die("out of captcha images; this shouldn't happen");
}
// Generate a random key for use of this captcha image in this session.
// This is needed so multiple edits in separate tabs or windows can
// go through without extra pain.
$index = $this->storeCaptcha($info);
wfDebug("Captcha id {$index} using hash {$info['hash']}, salt {$info['salt']}.\n");
$title = Title::makeTitle(NS_SPECIAL, 'Captcha/image');
return "<p>" . wfElement('img', array('src' => $title->getLocalUrl('wpCaptchaId=' . urlencode($index)), 'width' => $info['width'], 'height' => $info['height'], 'alt' => '')) . "</p>\n" . wfElement('input', array('type' => 'hidden', 'name' => 'wpCaptchaId', 'id' => 'wpCaptchaId', 'value' => $index)) . "<p>" . wfElement('input', array('name' => 'wpCaptchaWord', 'id' => 'wpCaptchaWord', 'tabindex' => 1)) . "</p>\n";
}
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:17,代码来源:FancyCaptcha.class.php
示例6: charInsertChar
function charInsertChar($start, $end = '', $title = null)
{
$estart = charInsertJsString($start);
$eend = charInsertJsString($end);
if ($eend == '') {
$inline = charInsertDisplay($start);
} else {
$inline = charInsertDisplay($start . $end);
}
if ($title) {
$extra = ' title="' . htmlspecialchars($title) . '"';
} else {
$extra = '';
}
return wfElement('a', array('onclick' => "insertTags('{$estart}','{$eend}','');return false", 'href' => '#'), $inline);
}
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:16,代码来源:CharInsert.php
示例7: listForm
function listForm($username, $reason)
{
global $wgUser, $wgOut, $wgLang;
$pages = $this->getNewPages($username);
$escapedName = wfEscapeWikiText($username);
if (count($pages) == 0) {
$wgOut->addWikiText(wfMsg('nuke-nopages', $escapedName));
return $this->promptForm();
}
$wgOut->addWikiText(wfMsg('nuke-list', $escapedName));
$nuke = Title::makeTitle(NS_SPECIAL, 'Nuke');
$submit = wfElement('input', array('type' => 'submit', 'value' => wfMsgHtml('nuke-submit-delete')));
$wgOut->addHTML(wfElement('form', array('action' => $nuke->getLocalURL('action=delete'), 'method' => 'post'), null) . "\n<div>" . wfMsgHtml('deletecomment') . ': ' . wfElement('input', array('name' => 'wpReason', 'value' => $reason, 'size' => 60)) . "</div><br />" . $submit . wfElement('input', array('type' => 'hidden', 'name' => 'wpEditToken', 'value' => $wgUser->editToken())) . "\n<ul>\n");
$sk =& $wgUser->getSkin();
foreach ($pages as $info) {
list($title, $edits) = $info;
$wgOut->addHTML('<li>' . wfElement('input', array('type' => 'checkbox', 'name' => "pages[]", 'value' => $title->getPrefixedDbKey(), 'checked' => 'checked')) . ' ' . $sk->makeKnownLinkObj($title) . ' (' . $sk->makeKnownLinkObj($title, wfMsgExt('nchanges', array('parsemag'), $wgLang->formatNum($edits)), 'action=history') . ")</li>\n");
}
$wgOut->addHTML("</ul>\n{$submit}</form>");
}
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:20,代码来源:SpecialNuke.php
示例8: slowWddxPrinter
/**
* Recursivelly go through the object and output its data in WDDX format.
*/
function slowWddxPrinter($elemValue)
{
switch (gettype($elemValue)) {
case 'array':
$this->printText('<struct>');
foreach ($elemValue as $subElemName => $subElemValue) {
$this->printText(wfElement('var', array('name' => $subElemName), null));
$this->slowWddxPrinter($subElemValue);
$this->printText('</var>');
}
$this->printText('</struct>');
break;
case 'integer':
case 'double':
$this->printText(wfElement('number', null, $elemValue));
break;
case 'string':
$this->printText(wfElement('string', null, $elemValue));
break;
default:
ApiBase::dieDebug(__METHOD__, 'Unknown type ' . gettype($elemValue));
}
}
开发者ID:ErdemA,项目名称:wikihow,代码行数:26,代码来源:ApiFormatWddx.php
示例9: getForm
/**
* Insert a captcha prompt into the edit form.
* This sample implementation generates a simple arithmetic operation;
* it would be easy to defeat by machine.
*
* Override this!
*
* @return string HTML
*/
function getForm()
{
$a = mt_rand(0, 100);
$b = mt_rand(0, 10);
$op = mt_rand(0, 1) ? '+' : '-';
$test = "{$a} {$op} {$b}";
$answer = $op == '+' ? $a + $b : $a - $b;
$index = $this->storeCaptcha(array('answer' => $answer));
return "<p><label for=\"wpCaptchaWord\">{$test}</label> = " . wfElement('input', array('name' => 'wpCaptchaWord', 'id' => 'wpCaptchaWord', 'tabindex' => 1)) . "</p>\n" . wfElement('input', array('type' => 'hidden', 'name' => 'wpCaptchaId', 'id' => 'wpCaptchaId', 'value' => $index));
}
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:19,代码来源:ConfirmEdit_body.php
示例10: makeInputForm
/**
* Input form for entering a category
*/
function makeInputForm()
{
global $wgScript;
$thisTitle = Title::makeTitle(NS_SPECIAL, $this->getName());
$form = '';
$form .= wfOpenElement('form', array('name' => 'categorytree', 'method' => 'get', 'action' => $wgScript));
$form .= wfElement('input', array('type' => 'hidden', 'name' => 'title', 'value' => $thisTitle->getPrefixedDbKey()));
$form .= wfElement('label', array('for' => 'target'), wfMsg('categorytree-category')) . ' ';
$form .= wfElement('input', array('type' => 'text', 'name' => 'target', 'id' => 'target', 'value' => $this->target)) . ' ';
$form .= wfOpenElement('select', array('name' => 'mode'));
$form .= wfElement('option', array('value' => 'categories') + ($this->mode == CT_MODE_CATEGORIES ? array('selected' => 'selected') : array()), wfMsg('categorytree-mode-categories'));
$form .= wfElement('option', array('value' => 'pages') + ($this->mode == CT_MODE_PAGES ? array('selected' => 'selected') : array()), wfMsg('categorytree-mode-pages'));
$form .= wfElement('option', array('value' => 'all') + ($this->mode == CT_MODE_ALL ? array('selected' => 'selected') : array()), wfMsg('categorytree-mode-all'));
$form .= wfCloseElement('select');
$form .= wfElement('input', array('type' => 'submit', 'name' => 'dotree', 'value' => wfMsg('categorytree-go')));
$form .= wfCloseElement('form');
return $form;
}
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:21,代码来源:CategoryTreePage.php
示例11: showHistory
function showHistory()
{
global $wgLang, $wgUser, $wgOut;
$sk = $wgUser->getSkin();
if ($this->mAllowed) {
$wgOut->setPagetitle(wfMsg("undeletepage"));
} else {
$wgOut->setPagetitle(wfMsg('viewdeletedpage'));
}
$archive = new PageArchive($this->mTargetObj);
$text = $archive->getLastRevisionText();
/*
if( is_null( $text ) ) {
$wgOut->addWikiText( wfMsg( "nohistory" ) );
return;
}
*/
if ($this->mAllowed) {
$wgOut->addWikiText(wfMsg("undeletehistory"));
} else {
$wgOut->addWikiText(wfMsg("undeletehistorynoadmin"));
}
# List all stored revisions
$revisions = $archive->listRevisions();
$files = $archive->listFiles();
$haveRevisions = $revisions && $revisions->numRows() > 0;
$haveFiles = $files && $files->numRows() > 0;
# Batch existence check on user and talk pages
if ($haveRevisions) {
$batch = new LinkBatch();
while ($row = $revisions->fetchObject()) {
$batch->addObj(Title::makeTitleSafe(NS_USER, $row->ar_user_text));
$batch->addObj(Title::makeTitleSafe(NS_USER_TALK, $row->ar_user_text));
}
$batch->execute();
$revisions->seek(0);
}
if ($haveFiles) {
$batch = new LinkBatch();
while ($row = $files->fetchObject()) {
$batch->addObj(Title::makeTitleSafe(NS_USER, $row->fa_user_text));
$batch->addObj(Title::makeTitleSafe(NS_USER_TALK, $row->fa_user_text));
}
$batch->execute();
$files->seek(0);
}
if ($this->mAllowed) {
$titleObj = Title::makeTitle(NS_SPECIAL, "Undelete");
$action = $titleObj->getLocalURL("action=submit");
# Start the form here
$top = wfOpenElement('form', array('method' => 'post', 'action' => $action, 'id' => 'undelete'));
$wgOut->addHtml($top);
}
# Show relevant lines from the deletion log:
$wgOut->addHTML("<h2>" . htmlspecialchars(LogPage::logName('delete')) . "</h2>\n");
$logViewer = new LogViewer(new LogReader(new FauxRequest(array('page' => $this->mTargetObj->getPrefixedText(), 'type' => 'delete'))));
$logViewer->showList($wgOut);
if ($this->mAllowed && ($haveRevisions || $haveFiles)) {
# Format the user-visible controls (comment field, submission button)
# in a nice little table
$table = '<fieldset><table><tr>';
$table .= '<td colspan="2">' . wfMsgWikiHtml('undeleteextrahelp') . '</td></tr><tr>';
$table .= '<td align="right"><strong>' . wfMsgHtml('undeletecomment') . '</strong></td>';
$table .= '<td>' . wfInput('wpComment', 50, $this->mComment) . '</td>';
$table .= '</tr><tr><td> </td><td>';
$table .= wfSubmitButton(wfMsg('undeletebtn'), array('name' => 'restore'));
$table .= wfElement('input', array('type' => 'reset', 'value' => wfMsg('undeletereset')));
$table .= '</td></tr></table></fieldset>';
$wgOut->addHtml($table);
}
$wgOut->addHTML("<h2>" . htmlspecialchars(wfMsg("history")) . "</h2>\n");
if ($haveRevisions) {
# The page's stored (deleted) history:
$wgOut->addHTML("<ul>");
$target = urlencode($this->mTarget);
while ($row = $revisions->fetchObject()) {
$ts = wfTimestamp(TS_MW, $row->ar_timestamp);
if ($this->mAllowed) {
$checkBox = wfCheck("ts{$ts}");
$pageLink = $sk->makeKnownLinkObj($titleObj, $wgLang->timeanddate($ts, true), "target={$target}×tamp={$ts}");
} else {
$checkBox = '';
$pageLink = $wgLang->timeanddate($ts, true);
}
$userLink = $sk->userLink($row->ar_user, $row->ar_user_text) . $sk->userToolLinks($row->ar_user, $row->ar_user_text);
$comment = $sk->commentBlock($row->ar_comment);
$wgOut->addHTML("<li>{$checkBox} {$pageLink} . . {$userLink} {$comment}</li>\n");
}
$revisions->free();
$wgOut->addHTML("</ul>");
} else {
$wgOut->addWikiText(wfMsg("nohistory"));
}
if ($haveFiles) {
$wgOut->addHtml("<h2>" . wfMsgHtml('imghistory') . "</h2>\n");
$wgOut->addHtml("<ul>");
while ($row = $files->fetchObject()) {
$ts = wfTimestamp(TS_MW, $row->fa_timestamp);
if ($this->mAllowed && $row->fa_storage_key) {
$checkBox = wfCheck("fileid" . $row->fa_id);
//.........这里部分代码省略.........
开发者ID:puring0815,项目名称:OpenKore,代码行数:101,代码来源:SpecialUndelete.php
示例12: recXmlPrint
/**
* This method takes an array and converts it into an xml.
* There are several noteworthy cases:
*
* If array contains a key '_element', then the code assumes that ALL other keys are not important and replaces them with the value['_element'].
* Example: name='root', value = array( '_element'=>'page', 'x', 'y', 'z') creates <root> <page>x</page> <page>y</page> <page>z</page> </root>
*
* If any of the array's element key is '*', then the code treats all other key->value pairs as attributes, and the value['*'] as the element's content.
* Example: name='root', value = array( '*'=>'text', 'lang'=>'en', 'id'=>10) creates <root lang='en' id='10'>text</root>
*
* If neither key is found, all keys become element names, and values become element content.
* The method is recursive, so the same rules apply to any sub-arrays.
*/
function recXmlPrint($elemName, $elemValue, $indent)
{
if (!is_null($indent)) {
$indent += 2;
$indstr = "\n" . str_repeat(" ", $indent);
} else {
$indstr = '';
}
switch (gettype($elemValue)) {
case 'array':
if (isset($elemValue['*'])) {
$subElemContent = $elemValue['*'];
unset($elemValue['*']);
} else {
$subElemContent = null;
}
if (isset($elemValue['_element'])) {
$subElemIndName = $elemValue['_element'];
unset($elemValue['_element']);
} else {
$subElemIndName = null;
}
$indElements = array();
$subElements = array();
foreach ($elemValue as $subElemId => &$subElemValue) {
if (gettype($subElemId) === 'integer') {
$indElements[] = $subElemValue;
unset($elemValue[$subElemId]);
} elseif (is_array($subElemValue)) {
$subElements[$subElemId] = $subElemValue;
unset($elemValue[$subElemId]);
}
}
if (is_null($subElemIndName) && !empty($indElements)) {
ApiBase::dieDebug(__METHOD__, "({$elemName}, ...) has integer keys without _element value. Use ApiResult::setIndexedTagName().");
}
if (!empty($subElements) && !empty($indElements) && !is_null($subElemContent)) {
ApiBase::dieDebug(__METHOD__, "({$elemName}, ...) has content and subelements");
}
if (!is_null($subElemContent)) {
$this->printText($indstr . wfElement($elemName, $elemValue, $subElemContent));
} elseif (empty($indElements) && empty($subElements)) {
$this->printText($indstr . wfElement($elemName, $elemValue));
} else {
$this->printText($indstr . wfElement($elemName, $elemValue, null));
foreach ($subElements as $subElemId => &$subElemValue) {
$this->recXmlPrint($subElemId, $subElemValue, $indent);
}
foreach ($indElements as $subElemId => &$subElemValue) {
$this->recXmlPrint($subElemIndName, $subElemValue, $indent);
}
$this->printText($indstr . wfCloseElement($elemName));
}
break;
case 'object':
// ignore
break;
default:
$this->printText($indstr . wfElement($elemName, null, $elemValue));
break;
}
}
开发者ID:mediawiki-extensions,项目名称:bizzwiki,代码行数:75,代码来源:ApiFormatXml.php
示例13: diffButtons
/** @todo document */
function diffButtons($rev, $firstInList, $counter)
{
if ($this->linesonpage > 1) {
$radio = array('type' => 'radio', 'value' => $rev->getId());
if (!$rev->userCan(Revision::DELETED_TEXT)) {
$radio['disabled'] = 'disabled';
}
/** @todo: move title texts to javascript */
if ($firstInList) {
$first = wfElement('input', array_merge($radio, array('style' => 'visibility:hidden', 'name' => 'oldid')));
$checkmark = array('checked' => 'checked');
} else {
if ($counter == 2) {
$checkmark = array('checked' => 'checked');
} else {
$checkmark = array();
}
$first = wfElement('input', array_merge($radio, $checkmark, array('name' => 'oldid')));
$checkmark = array();
}
$second = wfElement('input', array_merge($radio, $checkmark, array('name' => 'diff')));
return $first . $second;
} else {
return '';
}
}
开发者ID:clrh,项目名称:mediawiki,代码行数:27,代码来源:PageHistory.php
示例14: makeHTMLText
/**
* Create a list of messages, formatted in HTML as a list of messages and values and showing differences between the default language file message and the message in MediaWiki: namespace.
* @param $messages Messages array.
* @return The HTML list of messages.
*/
function makeHTMLText($messages)
{
global $wgLang, $wgContLang, $wgUser;
wfProfileIn(__METHOD__);
$sk = $wgUser->getSkin();
$talk = wfMsg('talkpagelinktext');
$input = wfElement('input', array('type' => 'text', 'id' => 'allmessagesinput', 'onkeyup' => 'allmessagesfilter()'), '');
$checkbox = wfElement('input', array('type' => 'button', 'value' => wfMsgHtml('allmessagesmodified'), 'id' => 'allmessagescheckbox', 'onclick' => 'allmessagesmodified()'), '');
$txt = '<span id="allmessagesfilter" style="display: none;">' . wfMsgHtml('allmessagesfilter') . " {$input}{$checkbox} " . '</span>';
$txt .= '
<table border="1" cellspacing="0" width="100%" id="allmessagestable">
<tr>
<th rowspan="2">' . wfMsgHtml('allmessagesname') . '</th>
<th>' . wfMsgHtml('allmessagesdefault') . '</th>
</tr>
<tr>
<th>' . wfMsgHtml('allmessagescurrent') . '</th>
</tr>';
wfProfileIn(__METHOD__ . "-check");
# This is a nasty hack to avoid doing independent existence checks
# without sending the links and table through the slow wiki parser.
$pageExists = array(NS_MEDIAWIKI => array(), NS_MEDIAWIKI_TALK => array());
$dbr = wfGetDB(DB_SLAVE);
$page = $dbr->tableName('page');
$sql = "SELECT page_namespace,page_title FROM {$page} WHERE page_namespace IN (" . NS_MEDIAWIKI . ", " . NS_MEDIAWIKI_TALK . ")";
$res = $dbr->query($sql);
while ($s = $dbr->fetchObject($res)) {
$pageExists[$s->page_namespace][$s->page_title] = true;
}
$dbr->freeResult($res);
wfProfileOut(__METHOD__ . "-check");
wfProfileIn(__METHOD__ . "-output");
$i = 0;
foreach ($messages as $key => $m) {
$title = $wgLang->ucfirst($key);
if ($wgLang->getCode() != $wgContLang->getCode()) {
$title .= '/' . $wgLang->getCode();
}
$titleObj =& Title::makeTitle(NS_MEDIAWIKI, $title);
$talkPage =& Title::makeTitle(NS_MEDIAWIKI_TALK, $title);
$changed = $m['statmsg'] != $m['msg'];
$message = htmlspecialchars($m['statmsg']);
$mw = htmlspecialchars($m['msg']);
if (isset($pageExists[NS_MEDIAWIKI][$title])) {
$pageLink = $sk->makeKnownLinkObj($titleObj, "<span id=\"sp-allmessages-i-{$i}\">" . htmlspecialchars($key) . '</span>');
} else {
$pageLink = $sk->makeBrokenLinkObj($titleObj, "<span id=\"sp-allmessages-i-{$i}\">" . htmlspecialchars($key) . '</span>');
}
if (isset($pageExists[NS_MEDIAWIKI_TALK][$title])) {
$talkLink = $sk->makeKnownLinkObj($talkPage, htmlspecialchars($talk));
} else {
$talkLink = $sk->makeBrokenLinkObj($talkPage, htmlspecialchars($talk));
}
$anchor = 'msg_' . htmlspecialchars(strtolower($title));
$anchor = "<a id=\"{$anchor}\" name=\"{$anchor}\"></a>";
if ($changed) {
$txt .= "\r\n\t<tr class=\"orig\" id=\"sp-allmessages-r1-{$i}\">\r\n\t\t<td rowspan=\"2\">\r\n\t\t\t{$anchor}{$pageLink}<br />{$talkLink}\r\n\t\t</td><td>\r\n{$message}\r\n\t\t</td>\r\n\t</tr><tr class=\"new\" id=\"sp-allmessages-r2-{$i}\">\r\n\t\t<td>\r\n{$mw}\r\n\t\t</td>\r\n\t</tr>";
} else {
$txt .= "\r\n\t<tr class=\"def\" id=\"sp-allmessages-r1-{$i}\">\r\n\t\t<td>\r\n\t\t\t{$anchor}{$pageLink}<br />{$talkLink}\r\n\t\t</td><td>\r\n{$mw}\r\n\t\t</td>\r\n\t</tr>";
}
$i++;
}
$txt .= '</table>';
wfProfileOut(__METHOD__ . '-output');
wfProfileOut(__METHOD__);
return $txt;
}
开发者ID:Jobava,项目名称:diacritice-meta-repo,代码行数:72,代码来源:SpecialAllmessages.php
示例15: showEditForm
//.........这里部分代码省略.........
} else {
$commentsubject = '';
$editsummary = "<span id='wpSummaryLabel'><label for='wpSummary'>{$summary}:</label></span>\n<div class='editOptions'>\n<input tabindex='2' type='text' value=\"{$summarytext}\" name='wpSummary' id='wpSummary' maxlength='200' size='60' /><br />";
}
# Set focus to the edit box on load, except on preview or diff, where it would interfere with the display
if (!$this->preview && !$this->diff) {
$wgOut->setOnloadHandler('document.editform.wpTextbox1.focus()');
}
$templates = $this->formatTemplates();
global $wgUseMetadataEdit;
if ($wgUseMetadataEdit) {
$metadata = $this->mMetaData;
$metadata = htmlspecialchars($wgContLang->recodeForEdit($metadata));
$top = wfMsgWikiHtml('metadata_help');
$metadata = $top . "<textarea name='metadata' rows='3' cols='{$cols}'{$ew}>{$metadata}</textarea>";
} else {
$metadata = "";
}
$hidden = '';
$recreate = '';
if ($this->deletedSinceEdit) {
if ('save' != $this->formtype) {
$wgOut->addWikiText(wfMsg('deletedwhileediting'));
} else {
// Hide the toolbar and edit area, use can click preview to get it back
// Add an confirmation checkbox and explanation.
$toolbar = '';
$hidden = 'type="hidden" style="display:none;"';
$recreate = $wgOut->parse(wfMsg('confirmrecreate', $this->lastDelete->user_name, $this->lastDelete->log_comment));
$recreate .= "<br /><input tabindex='1' type='checkbox' value='1' name='wpRecreate' id='wpRecreate' />" . "<label for='wpRecreate' title='" . wfMsg('tooltip-recreate') . "'>" . wfMsg('recreate') . "</label>";
}
}
$temp = array('id' => 'wpSave', 'name' => 'wpSave', 'type' => 'submit', 'tabindex' => '5', 'value' => wfMsg('savearticle'), 'accesskey' => wfMsg('accesskey-save'), 'title' => wfMsg('tooltip-save'));
$buttons['save'] = wfElement('input', $temp, '');
$temp = array('id' => 'wpDiff', 'name' => 'wpDiff', 'type' => 'submit', 'tabindex' => '7', 'value' => wfMsg('showdiff'), 'accesskey' => wfMsg('accesskey-diff'), 'title' => wfMsg('tooltip-diff'));
$buttons['diff'] = wfElement('input', $temp, '');
global $wgLivePreview;
if ($wgLivePreview && $wgUser->getOption('uselivepreview')) {
$temp = array('id' => 'wpPreview', 'name' => 'wpPreview', 'type' => 'submit', 'tabindex' => '6', 'value' => wfMsg('showpreview'), 'accesskey' => '', 'title' => wfMsg('tooltip-preview'), 'style' => 'display: none;');
$buttons['preview'] = wfElement('input', $temp, '');
$temp = array('id' => 'wpLivePreview', 'name' => 'wpLivePreview', 'type' => 'submit', 'tabindex' => '6', 'value' => wfMsg('showlivepreview'), 'accesskey' => wfMsg('accesskey-preview'), 'title' => '', 'onclick' => $this->doLivePreviewScript());
$buttons['live'] = wfElement('input', $temp, '');
} else {
$temp = array('id' => 'wpPreview', 'name' => 'wpPreview', 'type' => 'submit', 'tabindex' => '6', 'value' => wfMsg('showpreview'), 'accesskey' => wfMsg('accesskey-preview'), 'title' => wfMsg('tooltip-preview'));
$buttons['preview'] = wfElement('input', $temp, '');
$buttons['live'] = '';
}
$safemodehtml = $this->checkUnicodeCompliantBrowser() ? "" : "<input type='hidden' name=\"safemode\" value='1' />\n";
$wgOut->addHTML(<<<END
{$toolbar}
<form id="editform" name="editform" method="post" action="{$action}" enctype="multipart/form-data">
END
);
if (is_callable($formCallback)) {
call_user_func_array($formCallback, array(&$wgOut));
}
// Put these up at the top to ensure they aren't lost on early form submission
$wgOut->addHTML("\n<input type='hidden' value=\"" . htmlspecialchars($this->section) . "\" name=\"wpSection\" />\n<input type='hidden' value=\"{$this->starttime}\" name=\"wpStarttime\" />\n\n<input type='hidden' value=\"{$this->edittime}\" name=\"wpEdittime\" />\n\n<input type='hidden' value=\"{$this->scrolltop}\" name=\"wpScrolltop\" id=\"wpScrolltop\" />\n");
$wgOut->addHTML(<<<END
{$recreate}
{$commentsubject}
<textarea tabindex='1' accesskey="," name="wpTextbox1" id="wpTextbox1" rows='{$rows}'
cols='{$cols}'{$ew} {$hidden}>
END
. htmlspecialchars($this->safeUnicodeOutput($this->textbox1)) . "\n</textarea>\n\t\t");
$wgOut->addWikiText($copywarn);
开发者ID:puring0815,项目名称:OpenKore,代码行数:67,代码来源:EditPage.php
示例16: searchForm
function searchForm()
{
global $wgTitle;
return wfElement('form', array('action' => $wgTitle->getLocalUrl()), null) . wfElement('input', array('type' => 'hidden', 'name' => 'action', 'value' => 'search')) . wfElement('input', array('type' => 'hidden', 'name' => 'limit', 'value' => $this->limit)) . wfElement('input', array('name' => 'ip', 'value' => $this->ip)) . wfElement('input', array('type' => 'submit', 'value' => wfMsg('search'))) . '</form>';
}
开发者ID:k-hasan-19,项目名称:wiki,代码行数:5,代码来源:SpecialIpblocklist.php
示例17: renderNode
/**
* Returns a string with a HTML represenation of the given page.
* $title must be a Title object
*/
function renderNode(&$title, $mode = NULL, $children = false, $loadchildren = false, $depth = 1)
{
global $wgCategoryTreeOmitNamespace, $wgCategoryTreeDefaultMode;
static $uniq = 0;
if ($mode === NULL) {
$wgCategoryTreeDefaultMode;
}
$load = false;
if ($children && $loadchildren) {
$uniq += 1;
$load = 'ct-' . $uniq . '-' . mt_rand(1, 100000);
$children = false;
}
$ns = $title->getNamespace();
$key = $title->getDBkey();
#$trans = $title->getLocalizedText();
$trans = '';
#place holder for when translated titles are available
#when showing only categories, omit namespace in label unless we explicitely defined the configuration setting
#patch contributed by Manuel Schneider <[email protected]>, Bug 8011
if ($wgCategoryTreeOmitNamespace || $mode == CT_MODE_CATEGORIES) {
$label = htmlspecialchars($title->getText());
} else {
$label = htmlspecialchars($title->getPrefixedText());
}
if ($trans && $trans != $label) {
$label .= ' ' . wfElement('i', array('class' => 'translation'), $trans);
}
$wikiLink = $title->getLocalURL();
$labelClass = 'CategoryTreeLabel ' . ' CategoryTreeLabelNs' . $ns;
if ($ns == NS_CATEGORY) {
$labelClass .= ' CategoryTreeLabelCategory';
} else {
$labelClass .= ' CategoryTreeLabelPage';
}
if ($ns % 2 > 0) {
$labelClass .= ' CategoryTreeLabelTalk';
}
$linkattr = array('href' => '#');
if ($load) {
$linkattr['id'] = $load;
}
if (!$children) {
$txt = '+';
$linkattr['onclick'] = "this.href='javascript:void(0)'; categoryTreeExpandNode('" . Xml::escapeJsString($key) . "','" . $mode . "',this);";
# Don't load this message for ajax requests, so that we don't have to initialise $wgLang
$linkattr['title'] = $this->mIsAjaxRequest ? '##LOAD##' : self::msg('expand');
} else {
$txt = '–';
#NOTE: that's not a minus but a unicode ndash!
$linkattr['onclick'] = "this.href='javascript:void(0)'; categoryTreeCollapseNode('" . Xml::escapeJsString($key) . "','" . $mode . "',this);";
$linkattr['title'] = self::msg('collapse');
$linkattr['class'] = 'CategoryTreeLoaded';
}
$s = '';
#NOTE: things in CategoryTree.js rely on the exact order of tags!
# Specifically, the CategoryTreeChildren div must be the first
# sibling with nodeName = DIV of the grandparent of the expland link.
$s .= wfOpenElement('div', array('class' => 'CategoryTreeSection'));
$s .= wfOpenElement('div', array('class' => 'CategoryTreeItem'));
if ($ns == NS_CATEGORY) {
$s .= wfOpenElement('span', array('class' => 'CategoryTreeBullet'));
$s .= '[' . wfElement('a', $linkattr, $txt) . '] ';
$s .= wfCloseElement('span');
} else {
$s .= ' ';
}
$s .= wfOpenElement('a', array('class' => $labelClass, 'href' => $wikiLink)) . $label . wfCloseElement('a');
$s .= wfCloseElement('div');
$s .= "\n\t\t";
$s .= wfOpenElement('div', array('class' => 'CategoryTreeChildren', 'style' => $children ? "display:block" : "display:none"));
//HACK here?
if ($children) {
$s .= $this->renderChildren($title, $mode, $depth);
}
$s .= wfCloseElement('div');
$s .= wfCloseElement('div');
if ($load) {
$s .= "\n\t\t";
$s .= wfOpenElement('script', array('type' => 'text/javascript'));
$s .= 'categoryTreeExpandNode("' . Xml::escapeJsString($key) . '", "' . $mode . '", document.getElementById("' . $load . '") );';
$s .= wfCloseElement('script');
}
$s .= "\n\t\t";
return $s;
}
开发者ID:BackupTheBerlios,项目名称:shoutwik |
请发表评论