function openStream() {
global $wgContLanguageCode;
$ver = $this->schemaVersion();
- return wfElement( 'mediawiki', array(
+ return Xml::element( 'mediawiki', array(
'xmlns' => "http://www.mediawiki.org/xml/export-$ver/",
'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance",
'xsi:schemaLocation' => "http://www.mediawiki.org/xml/export-$ver/ " .
function sitename() {
global $wgSitename;
- return wfElement( 'sitename', array(), $wgSitename );
+ return Xml::element( 'sitename', array(), $wgSitename );
}
function generator() {
global $wgVersion;
- return wfElement( 'generator', array(), "MediaWiki $wgVersion" );
+ return Xml::element( 'generator', array(), "MediaWiki $wgVersion" );
}
function homelink() {
- return wfElement( 'base', array(), Title::newMainPage()->getFullUrl() );
+ return Xml::element( 'base', array(), Title::newMainPage()->getFullUrl() );
}
function caseSetting() {
global $wgCapitalLinks;
// "case-insensitive" option is reserved for future
$sensitivity = $wgCapitalLinks ? 'first-letter' : 'case-sensitive';
- return wfElement( 'case', array(), $sensitivity );
+ return Xml::element( 'case', array(), $sensitivity );
}
function namespaces() {
global $wgContLang;
$spaces = " <namespaces>\n";
foreach( $wgContLang->getFormattedNamespaces() as $ns => $title ) {
- $spaces .= ' ' . wfElement( 'namespace', array( 'key' => $ns ), $title ) . "\n";
+ $spaces .= ' ' . Xml::element( 'namespace', array( 'key' => $ns ), $title ) . "\n";
}
$spaces .= " </namespaces>";
return $spaces;
function openPage( $row ) {
$out = " <page>\n";
$title = Title::makeTitle( $row->page_namespace, $row->page_title );
- $out .= ' ' . wfElementClean( 'title', array(), $title->getPrefixedText() ) . "\n";
- $out .= ' ' . wfElement( 'id', array(), strval( $row->page_id ) ) . "\n";
+ $out .= ' ' . Xml::elementClean( 'title', array(), $title->getPrefixedText() ) . "\n";
+ $out .= ' ' . Xml::element( 'id', array(), strval( $row->page_id ) ) . "\n";
if( '' != $row->page_restrictions ) {
- $out .= ' ' . wfElement( 'restrictions', array(),
+ $out .= ' ' . Xml::element( 'restrictions', array(),
strval( $row->page_restrictions ) ) . "\n";
}
return $out;
wfProfileIn( $fname );
$out = " <revision>\n";
- $out .= " " . wfElement( 'id', null, strval( $row->rev_id ) ) . "\n";
+ $out .= " " . Xml::element( 'id', null, strval( $row->rev_id ) ) . "\n";
$out .= $this->writeTimestamp( $row->rev_timestamp );
if( $row->rev_deleted & Revision::DELETED_USER ) {
- $out .= " " . wfElement( 'contributor', array( 'deleted' => 'deleted' ) ) . "\n";
+ $out .= " " . Xml::element( 'contributor', array( 'deleted' => 'deleted' ) ) . "\n";
} else {
$out .= $this->writeContributor( $row->rev_user, $row->rev_user_text );
}
$out .= " <minor/>\n";
}
if( $row->rev_deleted & Revision::DELETED_COMMENT ) {
- $out .= " " . wfElement( 'comment', array( 'deleted' => 'deleted' ) ) . "\n";
+ $out .= " " . Xml::element( 'comment', array( 'deleted' => 'deleted' ) ) . "\n";
} elseif( $row->rev_comment != '' ) {
- $out .= " " . wfElementClean( 'comment', null, strval( $row->rev_comment ) ) . "\n";
+ $out .= " " . Xml::elementClean( 'comment', null, strval( $row->rev_comment ) ) . "\n";
}
if( $row->rev_deleted & Revision::DELETED_TEXT ) {
- $out .= " " . wfElement( 'text', array( 'deleted' => 'deleted' ) ) . "\n";
+ $out .= " " . Xml::element( 'text', array( 'deleted' => 'deleted' ) ) . "\n";
} elseif( isset( $row->old_text ) ) {
// Raw text from the database may have invalid chars
$text = strval( Revision::getRevisionText( $row ) );
- $out .= " " . wfElementClean( 'text',
+ $out .= " " . Xml::elementClean( 'text',
array( 'xml:space' => 'preserve' ),
strval( $text ) ) . "\n";
} else {
// Stub output
- $out .= " " . wfElement( 'text',
+ $out .= " " . Xml::element( 'text',
array( 'id' => $row->rev_text_id ),
"" ) . "\n";
}
wfProfileIn( $fname );
$out = " <logitem>\n";
- $out .= " " . wfElement( 'id', null, strval( $row->log_id ) ) . "\n";
+ $out .= " " . Xml::element( 'id', null, strval( $row->log_id ) ) . "\n";
$out .= $this->writeTimestamp( $row->log_timestamp );
if( $row->log_deleted & LogPage::DELETED_USER ) {
- $out .= " " . wfElement( 'contributor', array( 'deleted' => 'deleted' ) ) . "\n";
+ $out .= " " . Xml::element( 'contributor', array( 'deleted' => 'deleted' ) ) . "\n";
} else {
$out .= $this->writeContributor( $row->log_user, $row->user_name );
}
if( $row->log_deleted & LogPage::DELETED_COMMENT ) {
- $out .= " " . wfElement( 'comment', array( 'deleted' => 'deleted' ) ) . "\n";
+ $out .= " " . Xml::element( 'comment', array( 'deleted' => 'deleted' ) ) . "\n";
} elseif( $row->log_comment != '' ) {
- $out .= " " . wfElementClean( 'comment', null, strval( $row->log_comment ) ) . "\n";
+ $out .= " " . Xml::elementClean( 'comment', null, strval( $row->log_comment ) ) . "\n";
}
- $out .= " " . wfElement( 'type', null, strval( $row->log_type ) ) . "\n";
- $out .= " " . wfElement( 'action', null, strval( $row->log_action ) ) . "\n";
+ $out .= " " . Xml::element( 'type', null, strval( $row->log_type ) ) . "\n";
+ $out .= " " . Xml::element( 'action', null, strval( $row->log_action ) ) . "\n";
if( $row->log_deleted & LogPage::DELETED_ACTION ) {
- $out .= " " . wfElement( 'text', array( 'deleted' => 'deleted' ) ) . "\n";
+ $out .= " " . Xml::element( 'text', array( 'deleted' => 'deleted' ) ) . "\n";
} else {
$title = Title::makeTitle( $row->log_namespace, $row->log_title );
- $out .= " " . wfElementClean( 'logtitle', null, $title->getPrefixedText() ) . "\n";
- $out .= " " . wfElementClean( 'params',
+ $out .= " " . Xml::elementClean( 'logtitle', null, $title->getPrefixedText() ) . "\n";
+ $out .= " " . Xml::elementClean( 'params',
array( 'xml:space' => 'preserve' ),
strval( $row->log_params ) ) . "\n";
}
function writeTimestamp( $timestamp ) {
$ts = wfTimestamp( TS_ISO_8601, $timestamp );
- return " " . wfElement( 'timestamp', null, $ts ) . "\n";
+ return " " . Xml::element( 'timestamp', null, $ts ) . "\n";
}
function writeContributor( $id, $text ) {
$out = " <contributor>\n";
if( $id ) {
- $out .= " " . wfElementClean( 'username', null, strval( $text ) ) . "\n";
- $out .= " " . wfElement( 'id', null, strval( $id ) ) . "\n";
+ $out .= " " . Xml::elementClean( 'username', null, strval( $text ) ) . "\n";
+ $out .= " " . Xml::element( 'id', null, strval( $id ) ) . "\n";
} else {
- $out .= " " . wfElementClean( 'ip', null, strval( $text ) ) . "\n";
+ $out .= " " . Xml::elementClean( 'ip', null, strval( $text ) ) . "\n";
}
$out .= " </contributor>\n";
return $out;
return " <upload>\n" .
$this->writeTimestamp( $file->getTimestamp() ) .
$this->writeContributor( $file->getUser( 'id' ), $file->getUser( 'text' ) ) .
- " " . wfElementClean( 'comment', null, $file->getDescription() ) . "\n" .
- " " . wfElement( 'filename', null, $file->getName() ) . "\n" .
- " " . wfElement( 'src', null, $file->getFullUrl() ) . "\n" .
- " " . wfElement( 'size', null, $file->getSize() ) . "\n" .
+ " " . Xml::elementClean( 'comment', null, $file->getDescription() ) . "\n" .
+ " " . Xml::element( 'filename', null, $file->getName() ) . "\n" .
+ " " . Xml::element( 'src', null, $file->getFullUrl() ) . "\n" .
+ " " . Xml::element( 'size', null, $file->getSize() ) . "\n" .
" </upload>\n";
}
if( $showmeta ) {
global $wgStylePath, $wgStyleVersion;
- $expand = htmlspecialchars( wfEscapeJsString( wfMsg( 'metadata-expand' ) ) );
- $collapse = htmlspecialchars( wfEscapeJsString( wfMsg( 'metadata-collapse' ) ) );
+ $expand = htmlspecialchars( Xml::escapeJsString( wfMsg( 'metadata-expand' ) ) );
+ $collapse = htmlspecialchars( Xml::escapeJsString( wfMsg( 'metadata-collapse' ) ) );
$wgOut->addHTML( Xml::element( 'h2', array( 'id' => 'metadata' ), wfMsg( 'metadata' ) ). "\n" );
$wgOut->addWikiText( $this->makeMetadataTable( $formattedMetadata ) );
$wgOut->addScriptFile( 'metadata.js' );
function outputOption( $val, $attribs = null, $depth ) {
$val = str_repeat( /*   */ "\xc2\xa0", $depth * 2 ) . $val;
- return str_repeat( "\t", $depth ) . wfElement( 'option', $attribs, $val ) . "\n";
+ return str_repeat( "\t", $depth ) . Xml::element( 'option', $attribs, $val ) . "\n";
}
function msg( $str ) {
. "</ul>\n</td></tr></table>"
. '<script type="' . $wgJsMimeType . '">'
. ' if (window.showTocToggle) {'
- . ' var tocShowText = "' . wfEscapeJsString( wfMsg('showtoc') ) . '";'
- . ' var tocHideText = "' . wfEscapeJsString( wfMsg('hidetoc') ) . '";'
+ . ' var tocShowText = "' . Xml::escapeJsString( wfMsg('showtoc') ) . '";'
+ . ' var tocHideText = "' . Xml::escapeJsString( wfMsg('hidetoc') ) . '";'
. ' showTocToggle();'
. ' } '
. "</script>\n";
if($wgOut->isArticle() && $wgUser->getOption('editondblclick') &&
$wgTitle->quickUserCan( 'edit' ) ) {
$s = $wgTitle->getFullURL( $this->editUrlOptions() );
- $s = 'document.location = "' .wfEscapeJSString( $s ) .'";';
+ $s = 'document.location = "' .Xml::escapeJsString( $s ) .'";';
$a += array ('ondblclick' => $s);
}
$sep = str_replace("_", " ", wfMsgHtml("newtalkseparator"));
$msgs = array();
foreach ($newtalks as $newtalk) {
- $msgs[] = wfElement("a",
+ $msgs[] = Xml::element("a",
array('href' => $newtalk["link"]), $newtalk["wiki"]);
}
$parts = implode($sep, $msgs);
// XXX: attach this from javascript, same with section editing
if($this->iseditable && $wgUser->getOption("editondblclick") )
{
- $encEditUrl = wfEscapeJsString( $this->mTitle->getLocalUrl( $this->editUrlOptions() ) );
+ $encEditUrl = Xml::escapeJsString( $this->mTitle->getLocalUrl( $this->editUrlOptions() ) );
$tpl->set('body_ondblclick', 'document.location = "' . $encEditUrl . '";');
} else {
$tpl->set('body_ondblclick', false);
$cnt = count($elemValue);
if($cnt == 0 || array_keys($elemValue) === range(0, $cnt - 1)) {
// Regular array
- $this->printText($indstr . wfElement('array', array(
+ $this->printText($indstr . Xml::element('array', array(
'length' => $cnt
), null) . $nl);
foreach($elemValue as $subElemValue)
// Associative array (<struct>)
$this->printText("$indstr<struct>$nl");
foreach($elemValue as $subElemName => $subElemValue) {
- $this->printText($indstr2 . wfElement('var', array(
+ $this->printText($indstr2 . Xml::element('var', array(
'name' => $subElemName
), null) . $nl);
$this->slowWddxPrinter($subElemValue, $indent + 4);
break;
case 'integer' :
case 'double' :
- $this->printText($indstr . wfElement('number', null, $elemValue) . $nl);
+ $this->printText($indstr . Xml::element('number', null, $elemValue) . $nl);
break;
case 'string' :
- $this->printText($indstr . wfElement('string', null, $elemValue) . $nl);
+ $this->printText($indstr . Xml::element('string', null, $elemValue) . $nl);
break;
default :
ApiBase :: dieDebug(__METHOD__, 'Unknown type ' . gettype($elemValue));
ApiBase :: dieDebug(__METHOD__, "($elemName, ...) has content and subelements");
if (!is_null($subElemContent)) {
- $this->printText($indstr . wfElement($elemName, $elemValue, $subElemContent));
+ $this->printText($indstr . Xml::element($elemName, $elemValue, $subElemContent));
} elseif (!count($indElements) && !count($subElements)) {
- $this->printText($indstr . wfElement($elemName, $elemValue));
+ $this->printText($indstr . Xml::element($elemName, $elemValue));
} else {
- $this->printText($indstr . wfElement($elemName, $elemValue, null));
+ $this->printText($indstr . Xml::element($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));
+ $this->printText($indstr . Xml::closeElement($elemName));
}
break;
case 'object' :
// ignore
break;
default :
- $this->printText($indstr . wfElement($elemName, null, $elemValue));
+ $this->printText($indstr . Xml::element($elemName, null, $elemValue));
break;
}
}
$content = StringUtils::delimiterReplace( '<nowiki>', '</nowiki>', '$1', $text, 'i' );
$attribs = Sanitizer::validateTagAttributes( $attribs, 'pre' );
- return wfOpenElement( 'pre', $attribs ) .
+ return Xml::openElement( 'pre', $attribs ) .
Xml::escapeTagsOnly( $content ) .
'</pre>';
}
}
$wgOut->addWikiMsg( 'confirmemail_text' );
$self = SpecialPage::getTitleFor( 'Confirmemail' );
- $form = wfOpenElement( 'form', array( 'method' => 'post', 'action' => $self->getLocalUrl() ) );
- $form .= wfHidden( 'token', $wgUser->editToken() );
- $form .= wfSubmitButton( wfMsgHtml( 'confirmemail_send' ) );
- $form .= wfCloseElement( 'form' );
+ $form = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $self->getLocalUrl() ) );
+ $form .= Xml::hidden( 'token', $wgUser->editToken() );
+ $form .= Xml::submitButton( wfMsgHtml( 'confirmemail_send' ) );
+ $form .= Xml::closeElement( 'form' );
$wgOut->addHTML( $form );
}
}
$last = $this->message['last'];
$ts = wfTimestamp( TS_MW, $row->rev_timestamp );
- $checkBox = wfRadio( "mergepoint", $ts, false );
+ $checkBox = Xml::radio( "mergepoint", $ts, false );
$pageLink = $this->sk->makeKnownLinkObj( $rev->getTitle(),
htmlspecialchars( $wgLang->timeanddate( $ts ) ), 'oldid=' . $rev->getId() );
global $wgLivePreview;
$wgOut->addHTML( '<fieldset><legend>' . wfMsg( 'textboxsize' ) . '</legend>
<div>' .
- wfInputLabel( wfMsg( 'rows' ), 'wpRows', 'wpRows', 3, $this->mRows ) .
+ Xml::inputLabel( wfMsg( 'rows' ), 'wpRows', 'wpRows', 3, $this->mRows ) .
' ' .
- wfInputLabel( wfMsg( 'columns' ), 'wpCols', 'wpCols', 3, $this->mCols ) .
+ Xml::inputLabel( wfMsg( 'columns' ), 'wpCols', 'wpCols', 3, $this->mCols ) .
"</div>" .
$this->getToggles( array(
'editsection',
* @return string
*/
protected function namespaceFilterForm( FormOptions $opts ) {
- $nsSelect = HTMLnamespaceselector( $opts['namespace'], '' );
+ $nsSelect = Xml::namespaceSelector( $opts['namespace'], '' );
$nsLabel = Xml::label( wfMsg('namespace'), 'namespace' );
$invert = Xml::checkLabel( wfMsg('invert'), 'invert', 'nsinvert', $opts['invert'] );
return array( $nsLabel, "$nsSelect $invert" );
}
$wgOut->addHTML(
- wfElement( 'textarea', array(
+ Xml::element( 'textarea', array(
'readonly' => 'readonly',
'cols' => intval( $wgUser->getOption( 'cols' ) ),
'rows' => intval( $wgUser->getOption( 'rows' ) ) ),
$rev->getText( Revision::FOR_THIS_USER ) . "\n" ) .
- wfOpenElement( 'div' ) .
- wfOpenElement( 'form', array(
+ Xml::openElement( 'div' ) .
+ Xml::openElement( 'form', array(
'method' => 'post',
'action' => $self->getLocalURL( "action=submit" ) ) ) .
- wfElement( 'input', array(
+ Xml::element( 'input', array(
'type' => 'hidden',
'name' => 'target',
'value' => $this->mTargetObj->getPrefixedDbKey() ) ) .
- wfElement( 'input', array(
+ Xml::element( 'input', array(
'type' => 'hidden',
'name' => 'timestamp',
'value' => $timestamp ) ) .
- wfElement( 'input', array(
+ Xml::element( 'input', array(
'type' => 'hidden',
'name' => 'wpEditToken',
'value' => $wgUser->editToken() ) ) .
- wfElement( 'input', array(
+ Xml::element( 'input', array(
'type' => 'submit',
'name' => 'preview',
'value' => wfMsg( 'showpreview' ) ) ) .
- wfElement( 'input', array(
+ Xml::element( 'input', array(
'name' => 'diff',
'type' => 'submit',
'value' => wfMsg( 'showdiff' ) ) ) .
- wfCloseElement( 'form' ) .
- wfCloseElement( 'div' ) );
+ Xml::closeElement( 'form' ) .
+ Xml::closeElement( 'div' ) );
}
/**
function clearOpenElement( $style ) {
if( $this->openElement ) {
- $this->buffer .= wfElement( $this->openElement[0], $this->openElement[1], $style );
+ $this->buffer .= Xml::element( $this->openElement[0], $this->openElement[1], $style );
$this->openElement = false;
}
}