本文整理汇总了PHP中Xml::span方法的典型用法代码示例。如果您正苦于以下问题:PHP Xml::span方法的具体用法?PHP Xml::span怎么用?PHP Xml::span使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xml
的用法示例。
在下文中一共展示了Xml::span方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showInfo
/**
* Retrieves and shows the user language and test wiki
* @param $target Mixed: user whose language and test wiki we're looking up
*/
function showInfo( $target ) {
global $wgOut, $wmincPref, $wmincProjectSite;
if( User::isIP( $target ) ) {
# show error if it is an IP address
$wgOut->addHTML( Xml::span( wfMsg( 'wminc-ip', $target ), 'error' ) );
return;
}
$user = User::newFromName( $target );
$name = $user->getName();
$id = $user->getId();
$langNames = Language::getLanguageNames();
$linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
if ( $user == null || $id == 0 ) {
# show error if a user with that name does not exist
$wgOut->addHTML( Xml::span( wfMsg( 'wminc-userdoesnotexist', $target ), 'error' ) );
return;
}
$userproject = $user->getOption( $wmincPref . '-project' );
$userproject = ( $userproject ? $userproject : 'none' );
$usercode = $user->getOption( $wmincPref . '-code' );
$prefix = IncubatorTest::displayPrefix( $userproject, $usercode ? $usercode : 'none' );
if ( IncubatorTest::isContentProject( $userproject ) ) {
$testwiki = $linker->link( Title::newFromText( $prefix ) );
} elseif ( $prefix == $wmincProjectSite['short'] ) {
$testwiki = htmlspecialchars( $wmincProjectSite['name'] );
} else {
$testwiki = wfMsgHtml( 'wminc-testwiki-none' );
}
$wgOut->addHtml(
Xml::openElement( 'ul' ) .
'<li>' . wfMsgHtml( 'username' ) . ' ' .
$linker->userLink( $id, $name ) . $linker->userToolLinks( $id, $name, true ) . '</li>' .
'<li>' . wfMsgHtml( 'loginlanguagelabel', $langNames[$user->getOption( 'language' )] .
' (' . $user->getOption( 'language' ) . ')' ) . '</li>' .
'<li>' . wfMsgHtml( 'wminc-testwiki' ) . ' ' . $testwiki . '</li>' .
Xml::closeElement( 'ul' )
);
}
示例2: showDiffPage
//.........这里部分代码省略.........
wfProfileOut(__METHOD__);
return;
}
$sk = $wgUser->getSkin();
// Check if page is editable
$editable = $this->mNewRev->getTitle()->userCan('edit');
if ($editable && $this->mNewRev->isCurrent() && $wgUser->isAllowed('rollback')) {
$rollback = ' ' . $sk->generateRollback($this->mNewRev);
} else {
$rollback = '';
}
// Prepare a change patrol link, if applicable
if ($wgUseRCPatrol && $this->mTitle->userCan('patrol')) {
// If we've been given an explicit change identifier, use it; saves time
if ($this->mRcidMarkPatrolled) {
$rcid = $this->mRcidMarkPatrolled;
$rc = RecentChange::newFromId($rcid);
// Already patrolled?
$rcid = is_object($rc) && !$rc->getAttribute('rc_patrolled') ? $rcid : 0;
} else {
// Look for an unpatrolled change corresponding to this diff
$db = wfGetDB(DB_SLAVE);
$change = RecentChange::newFromConds(array('rc_user_text' => $this->mNewRev->getRawUserText(), 'rc_timestamp' => $db->timestamp($this->mNewRev->getTimestamp()), 'rc_this_oldid' => $this->mNewid, 'rc_last_oldid' => $this->mOldid, 'rc_patrolled' => 0), __METHOD__);
if ($change instanceof RecentChange) {
$rcid = $change->mAttribs['rc_id'];
$this->mRcidMarkPatrolled = $rcid;
} else {
// None found
$rcid = 0;
}
}
// Build the link
if ($rcid) {
$patrol = ' <span class="patrollink">[' . $sk->makeKnownLinkObj($this->mTitle, wfMsgHtml('markaspatrolleddiff'), "action=markpatrolled&rcid={$rcid}") . ']</span>';
} else {
$patrol = '';
}
} else {
$patrol = '';
}
$diffOnlyArg = '';
# Carry over 'diffonly' param via navigation links
if ($diffOnly != $wgUser->getBoolOption('diffonly')) {
$diffOnlyArg = '&diffonly=' . $diffOnly;
}
$htmldiffarg = $this->htmlDiffArgument();
# Make "previous revision link"
$prevlink = $sk->makeKnownLinkObj($this->mTitle, wfMsgHtml('previousdiff'), "diff=prev&oldid={$this->mOldid}{$htmldiffarg}{$diffOnlyArg}", '', '', 'id="differences-prevlink"');
# Make "next revision link"
if ($this->mNewRev->isCurrent()) {
$nextlink = ' ';
} else {
$nextlink = $sk->makeKnownLinkObj($this->mTitle, wfMsgHtml('nextdiff'), "diff=next&oldid={$this->mNewid}{$htmldiffarg}{$diffOnlyArg}", '', '', 'id="differences-nextlink"');
}
$oldminor = '';
$newminor = '';
if ($this->mOldRev->isMinor()) {
$oldminor = Xml::span(wfMsg('minoreditletter'), 'minor') . ' ';
}
if ($this->mNewRev->isMinor()) {
$newminor = Xml::span(wfMsg('minoreditletter'), 'minor') . ' ';
}
$rdel = '';
$ldel = '';
if ($wgUser->isAllowed('deleterevision')) {
if (!$this->mOldRev->userCan(Revision::DELETED_RESTRICTED)) {
示例3: wfSpan
function wfSpan($text, $class, $attribs = array())
{
return Xml::span($text, $class, $attribs);
}
示例4: wfSpan
function wfSpan($text, $class, $attribs = array())
{
wfDeprecated(__FUNCTION__);
return Xml::span($text, $class, $attribs);
}
示例5: formatResult
function formatResult($skin, $result)
{
$title = Title::newFromRow($result);
$ret = Linker::link($title, null, array(), array(), array('known'));
if ($result->pp_value !== '') {
$value = $this->msg('parentheses')->rawParams(Xml::span($result->pp_value, 'prop-value'))->escaped();
$ret .= " {$value}";
}
return $ret;
}
示例6: showDiffPage
function showDiffPage($diffOnly = false)
{
global $wgUser, $wgOut, $wgUseExternalEditor, $wgUseRCPatrol;
wfProfileIn(__METHOD__);
# If external diffs are enabled both globally and for the user,
# we'll use the application/x-external-editor interface to call
# an external diff tool like kompare, kdiff3, etc.
if ($wgUseExternalEditor && $wgUser->getOption('externaldiff')) {
global $wgInputEncoding, $wgServer, $wgScript, $wgLang;
$wgOut->disable();
header("Content-type: application/x-external-editor; charset=" . $wgInputEncoding);
$url1 = $this->mTitle->getFullURL("action=raw&oldid=" . $this->mOldid);
$url2 = $this->mTitle->getFullURL("action=raw&oldid=" . $this->mNewid);
$special = $wgLang->getNsText(NS_SPECIAL);
$control = <<<CONTROL
[Process]
Type=Diff text
Engine=MediaWiki
Script={$wgServer}{$wgScript}
Special namespace={$special}
[File]
Extension=wiki
URL={$url1}
[File 2]
Extension=wiki
URL={$url2}
CONTROL;
echo $control;
return;
}
$wgOut->setArticleFlag(false);
if (!$this->loadRevisionData()) {
$t = $this->mTitle->getPrefixedText();
$d = wfMsgExt('missingarticle-diff', array('escape'), $this->mOldid, $this->mNewid);
$wgOut->setPagetitle(wfMsg('errorpagetitle'));
$wgOut->addWikiMsg('missing-article', "<nowiki>{$t}</nowiki>", $d);
wfProfileOut(__METHOD__);
return;
}
wfRunHooks('DiffViewHeader', array($this, $this->mOldRev, $this->mNewRev));
if ($this->mNewRev->isCurrent()) {
$wgOut->setArticleFlag(true);
}
# mOldid is false if the difference engine is called with a "vague" query for
# a diff between a version V and its previous version V' AND the version V
# is the first version of that article. In that case, V' does not exist.
if ($this->mOldid === false) {
$this->showFirstRevision();
$this->renderNewRevision();
// should we respect $diffOnly here or not?
wfProfileOut(__METHOD__);
return;
}
$wgOut->suppressQuickbar();
$oldTitle = $this->mOldPage->getPrefixedText();
$newTitle = $this->mNewPage->getPrefixedText();
if ($oldTitle == $newTitle) {
$wgOut->setPageTitle($newTitle);
} else {
$wgOut->setPageTitle($oldTitle . ', ' . $newTitle);
}
$wgOut->setSubtitle(wfMsg('difference'));
$wgOut->setRobotpolicy('noindex,nofollow');
if (!($this->mOldPage->userCanRead() && $this->mNewPage->userCanRead())) {
$wgOut->loginToUse();
$wgOut->output();
wfProfileOut(__METHOD__);
exit;
}
$sk = $wgUser->getSkin();
// Check if page is editable
$editable = $this->mNewRev->getTitle()->userCan('edit');
if ($editable && $this->mNewRev->isCurrent() && $wgUser->isAllowed('rollback')) {
$rollback = ' ' . $sk->generateRollback($this->mNewRev);
} else {
$rollback = '';
}
// Prepare a change patrol link, if applicable
if ($wgUseRCPatrol && $wgUser->isAllowed('patrol')) {
// If we've been given an explicit change identifier, use it; saves time
if ($this->mRcidMarkPatrolled) {
$rcid = $this->mRcidMarkPatrolled;
} else {
// Look for an unpatrolled change corresponding to this diff
$db = wfGetDB(DB_SLAVE);
$change = RecentChange::newFromConds(array('rc_user_text' => $this->mNewRev->getRawUserText(), 'rc_timestamp' => $db->timestamp($this->mNewRev->getTimestamp()), 'rc_this_oldid' => $this->mNewid, 'rc_last_oldid' => $this->mOldid, 'rc_patrolled' => 0), __METHOD__);
if ($change instanceof RecentChange) {
$rcid = $change->mAttribs['rc_id'];
} else {
// None found
$rcid = 0;
}
}
// Build the link
if ($rcid) {
$patrol = ' <span class="patrollink">[' . $sk->makeKnownLinkObj($this->mTitle, wfMsgHtml('markaspatrolleddiff'), "action=markpatrolled&rcid={$rcid}") . ']</span>';
} else {
$patrol = '';
//.........这里部分代码省略.........