本文整理汇总了PHP中XML::element方法的典型用法代码示例。如果您正苦于以下问题:PHP XML::element方法的具体用法?PHP XML::element怎么用?PHP XML::element使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XML
的用法示例。
在下文中一共展示了XML::element方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute($par)
{
global $wgOut, $wgUser;
$this->setHeaders();
if (!$wgUser->isAllowed('stafflog')) {
throw new PermissionsError('stafflog');
}
$pager = new StaffLoggerPager("");
$sTypesDropDown = XML::openElement('select', array('name' => 'type', 'id' => 'StaffLogFilterType'));
foreach ($this->aTypes as $k => $v) {
$sTypesDropDown .= XML::option($v, $k, $k == $this->request->getText('type', ''));
}
$sTypesDropDown .= XML::closeElement('select');
$wgOut->addHTML(XML::openElement('form', array('method' => 'get', 'action' => $this->getTitle()->getLocalURL())) . XML::openElement('fieldset') . XML::element('legend', null, wfMsg('stafflog-filter-label'), false) . XML::inputLabel(wfMsg('stafflog-filter-user'), 'user', 'StaffLogFilterUser', false, htmlspecialchars($this->request->getText('user', ''), ENT_QUOTES, 'UTF-8')) . XML::label(wfMsg('stafflog-filter-type'), 'StaffLogFilterType') . ' ' . $sTypesDropDown . ' ' . XML::submitButton(wfMsg('stafflog-filter-apply')) . XML::closeElement('fieldset') . XML::closeElement('form') . XML::openElement('div', array('class' => 'mw-spcontent')) . $pager->getNavigationBar() . '<ul>' . $pager->getBody() . '</ul>' . $pager->getNavigationBar() . XML::closeElement('div'));
}
示例2: dumpError
static function dumpError($error, $backtrace_depth = 1)
{
if (Kennel::$ROOT_URL) {
$backtrace = debug_backtrace();
$file = $backtrace[$backtrace_depth + 1]['file'];
$line = $backtrace[$backtrace_depth + 1]['line'];
$message = "{$error} in <strong>{$file}</strong> at line <strong>{$line}</strong>";
$p = XML::element('p', null, array('class' => 'msg_error'), $message);
echo $p;
if (Kennel::getSetting('application', 'debug_mode')) {
self::backtrace($backtrace_depth + 1);
}
} else {
// Ajax or Cli
$backtrace = debug_backtrace();
$file = $backtrace[$backtrace_depth + 1]['file'];
$line = $backtrace[$backtrace_depth + 1]['line'];
$message = "Kennel error: {$error} in {$file} at line {$line}\n";
echo $message;
}
}
示例3: _getOutput
private function _getOutput()
{
// Make $template and $title accessible in the descendant views
$this->__set('template', $this);
$this->__set('title', $this->title);
// Template View (must run first since ancestor views might call functions from $template)
$templateView = XML::text($this->_template->__toString());
// <html>
$this->_html = XML::element('html');
$this->_html->dir = $this->dir;
if (Kennel::getSetting('i18n', 'enabled')) {
$this->_html->lang = i18n::getLang();
}
// <head>
$this->_head = XML::element('head', $this->_html);
// <title>
$title = XML::element('title', $this->_head);
$title->setValue($this->getTitle());
// favicon
if ($this->favicon) {
$this->_head->adopt(html::favicon($this->favicon));
}
// Content Type
$this->_head->adopt(html::meta(array('charset' => 'utf-8')));
// <meta>
foreach ($this->_meta as $meta) {
$this->_head->adopt(html::meta($meta));
}
// <link>
foreach ($this->_links as $link) {
$this->_head->adopt(html::link($link['rel'], $link['href'], $link['type'], $link['title']));
}
// <style>
$this->_head->adopt(html::css($this->_stylesheets));
// <script>
$this->_head->adopt(html::js($this->_scripts));
// <body>
$this->_body = XML::element('body', $this->_html);
$this->_body->class = browser::css();
if (Kennel::getSetting('i18n', 'enabled')) {
$this->_body->class .= ' ' . i18n::getLang();
}
if ($this->bodyClass) {
$this->_body->class .= ' ' . $this->bodyClass;
}
// Inject the Template View
$this->_body->adopt($templateView);
// Return the whole shebang
return self::$DOCTYPE_DECLARATIONS[$this->doctype] . $this->_html->output(true);
}
示例4: onBeforeToolbarMenu
/**
* @brief add history to wall toolbar
**/
function onBeforeToolbarMenu(&$items)
{
$app = F::app();
if (empty($app->wg->EnableWallExt)) {
return true;
}
$title = $app->wg->Title;
$action = $app->wg->Request->getText('action');
if ($title instanceof Title && $title->isTalkPage() && WallHelper::isWallNamespace($title->getNamespace())) {
if (is_array($items)) {
foreach ($items as $k => $value) {
if ($value['type'] == 'follow') {
unset($items[$k]);
break;
}
}
}
}
if ($title instanceof Title && WallHelper::isWallNamespace($title->getNamespace()) && !$title->isSubpage() && empty($action)) {
$item = array('type' => 'html', 'html' => XML::element('a', array('href' => $title->getFullUrl('action=history')), wfMsg('wall-toolbar-history')));
if (is_array($items)) {
$inserted = false;
$itemsout = array();
foreach ($items as $value) {
$itemsout[] = $value;
if ($value['type'] == 'follow') {
$itemsout[] = $item;
$inserted = true;
}
}
if (!$inserted) {
array_unshift($items, $item);
} else {
$items = $itemsout;
}
} else {
$items = array($item);
}
}
return true;
}
示例5: createPostContent
public function createPostContent($title, $body)
{
return XML::element("title", array(), $title) . "\n" . XML::element("body", array(), $body);
}
示例6: exportSite
/**
* Writes a <site> tag representing the given Site object.
*
* @param Site $site
*/
private function exportSite(Site $site)
{
if ($site->getType() !== Site::TYPE_UNKNOWN) {
$siteAttr = array('type' => $site->getType());
} else {
$siteAttr = null;
}
fwrite($this->sink, "\t" . XML::openElement('site', $siteAttr) . "\n");
fwrite($this->sink, "\t\t" . XML::element('globalid', null, $site->getGlobalId()) . "\n");
if ($site->getGroup() !== Site::GROUP_NONE) {
fwrite($this->sink, "\t\t" . XML::element('group', null, $site->getGroup()) . "\n");
}
if ($site->getSource() !== Site::SOURCE_LOCAL) {
fwrite($this->sink, "\t\t" . XML::element('source', null, $site->getSource()) . "\n");
}
if ($site->shouldForward()) {
fwrite($this->sink, "\t\t" . XML::element('forward', null, '') . "\n");
}
foreach ($site->getAllPaths() as $type => $path) {
fwrite($this->sink, "\t\t" . XML::element('path', array('type' => $type), $path) . "\n");
}
foreach ($site->getLocalIds() as $type => $ids) {
foreach ($ids as $id) {
fwrite($this->sink, "\t\t" . XML::element('localid', array('type' => $type), $id) . "\n");
}
}
//@todo: export <data>
//@todo: export <config>
fwrite($this->sink, "\t" . XML::closeElement('site') . "\n");
}
示例7: textarea
function textarea($field_schema, $field_id, $attributes = null, $field_value = null, $field_error = null)
{
$textarea = XML::element('textarea');
$textarea->set('name', $field_id);
$textarea->set('id', $field_id);
// Custom attributes
if (is_array($attributes)) {
foreach ($attributes as $att => $value) {
$textarea->set($att, $value);
}
}
// Value
if ($field_value) {
$textarea->set('text', $field_value);
} else {
$textarea->set('text', '');
}
// Invalid
if ($field_error) {
$textarea->set('class', 'invalid');
}
return $textarea;
}
示例8: render_list
function render_list()
{
if (!isset($this->page)) {
$this->getPage();
}
$table = XML::element('table');
$tr = XML::element('tr', $table);
//Columns
foreach ($this->fields as $name => $caption) {
$th = XML::element('th', $tr, null, $caption);
}
//Actions
if (count($this->actions) > 0 && count($this->page) > 0) {
$th = XML::element('th', $tr, null, 'Actions');
}
if (count($this->page) == 0) {
$tr = XML::element('tr', $table, array('class' => 'error'));
$td = XML::element('td', $tr, array('colspan' => count($this->fields)));
$td->setText($this->empty_message);
} else {
$n = 0;
foreach ($this->page as $row) {
$class = $n++ % 2 ? 'even' : 'odd';
$tr = XML::element('tr', $table, array('class' => $class));
//Columns
foreach ($this->fields as $name => $caption) {
$td = XML::element('td', $tr);
$td->setText($row->{$name});
}
//Actions
if (count($this->actions) && count($this->page) > 0) {
$td = XML::element('td', $tr);
foreach ($this->actions as $action) {
foreach ($action['vars'] as $key => $var) {
$key++;
$action['link'] = str_replace("%{$key}", $row->{$var}, $action['link']);
$action['html'] = str_replace("%{$key}", $row->{$var}, $action['html']);
}
$a = XML::element('a', $td, array('href' => $action['link'], 'class' => 'list_action'));
$a->setText(" {$action['html']} ");
}
}
}
}
print $table;
}
示例9: execute
/**
* execute
*
* main entry point
* @author eloy@wikia.com
*
* @param string $subpage: subpage of Title
*
* @return nothing
*/
public function execute($subpage)
{
global $wgUser, $wgOut, $wgRequest, $wgWikiaBatchTasks;
if ($wgUser->isBlocked()) {
throw new UserBlockedError($this->getUser()->mBlock);
}
if (wfReadOnly()) {
$wgOut->readOnlyPage();
return;
}
if (!$wgUser->isAllowed('taskmanager')) {
$this->displayRestrictionError();
return;
}
$wgOut->setPageTitle(wfMsg('taskmanager_title'));
$wgOut->setRobotpolicy('noindex,nofollow');
$wgOut->setArticleRelated(false);
$this->mTitle = Title::makeTitle(NS_SPECIAL, "TaskManager");
$this->mAction = $wgRequest->getVal("action");
if ($this->mAction) {
switch ($this->mAction) {
case "task":
#--- get task type and class
$sClass = $wgRequest->getText("wpType", null);
if (is_subclass_of($sClass, "BatchTask")) {
$oObject = new $sClass();
#--- get form for this class
$wgOut->addHTML($oObject->getForm($this->mTitle));
}
$wgOut->addHTML(XML::element("a", array("href" => $this->mTitle->getLocalUrl(), wfMsg("taskmanager_tasklist"))));
break;
case "save":
#--- get task type and class
$sType = $wgRequest->getText("wpType", null);
$sClass = $wgWikiaBatchTasks[$sType];
if (is_subclass_of($sClass, "BatchTask")) {
$oObject = new $sClass();
$aFormData = $oObject->submitForm();
if ($aFormData === true) {
#--- all correct, show new task form
$this->loadTaskForm();
} else {
#--- errors, show again form for choosen task
$wgOut->addHTML($oObject->getForm($this->mTitle, $aFormData));
}
}
$wgOut->addHTML(Wikia::linkTag($this->mTitle->getLocalUrl(), wfMsg("taskmanager_tasklist")));
break;
/**
* get task form for given id, NOTE - it should check if
* task is editable or not
*/
/**
* get task form for given id, NOTE - it should check if
* task is editable or not
*/
case "edit":
$oTask = $this->loadTaskData($wgRequest->getVal("id"));
#--- nothing so far
break;
/**
* remove task from database, carefull - without confirmation
* so far
*/
/**
* remove task from database, carefull - without confirmation
* so far
*/
case "remove":
#--- check if task exists
$oTask = $this->loadTaskData($wgRequest->getVal("id"));
if (!empty($oTask->task_id)) {
$this->removeTask($oTask->task_id);
$wgOut->addHTML(Wikia::successbox("Task nr {$oTask->task_id} removed"));
} else {
$wgOut->addHTML(Wikia::errorbox("Task doesn't exists"));
}
$this->loadTaskForm();
$this->loadPager();
break;
/**
* start task, possible only when task in TASK_WAITING state
*/
/**
* start task, possible only when task in TASK_WAITING state
*/
case "start":
#--- check if task exists
$oTask = $this->loadTaskData($wgRequest->getVal("id"));
if (!empty($oTask->task_id) && $oTask->task_status == TASK_WAITING) {
//.........这里部分代码省略.........
示例10: getEditButtons
function getEditButtons($tabindex)
{
global $wgLivePreview, $wgUser;
$buttons = array();
$temp = array('id' => 'wpSave', 'name' => 'wpSave', 'type' => 'submit', 'tabindex' => ++$tabindex, 'value' => wfMsg('savearticle'), 'accesskey' => wfMsg('accesskey-save'), 'title' => wfMsg('tooltip-save') . ' [' . wfMsg('accesskey-save') . ']', 'onclick' => 'needToConfirm = false', 'class' => 'button primary submit_button wpSave');
$buttons['save'] = XML::element('input', $temp, '');
$temp = array('id' => 'wpPreview', 'name' => 'wpPreview', 'type' => 'submit', 'tabindex' => ++$tabindex, 'value' => wfMsg('showpreview'), 'accesskey' => wfMsg('accesskey-preview'), 'title' => wfMsg('tooltip-preview') . ' [' . wfMsg('accesskey-preview') . ']', 'onclick' => 'needToConfirm = false; checkMinLength = false; checkSummary();', 'class' => 'button secondary submit_button');
$buttons['preview'] = XML::element('input', $temp, '');
$buttons['live'] = '';
$temp = array('id' => 'wpDiff', 'name' => 'wpDiff', 'type' => 'submit', 'tabindex' => ++$tabindex, 'value' => wfMsg('showdiff'), 'accesskey' => wfMsg('accesskey-diff'), 'title' => wfMsg('tooltip-diff') . ' [' . wfMsg('accesskey-diff') . ']', 'onclick' => 'needToConfirm = false; checkMinLength = false; checkSummary();', 'class' => 'button secondary submit_button');
$buttons['diff'] = XML::element('input', $temp, '');
wfRunHooks('EditPageBeforeEditButtons', array(&$this, &$buttons, &$tabindex));
return $buttons;
}
示例11: substr
if (!empty($post['readmore'])) {
if (substr($post['text'], -4) == '</p>') {
$post['text'] = substr($post['text'], 0, -4) . '<br>' . $readMoreLink . '</p>';
} else {
$post['text'] .= '' .$readMoreLink;
}
} else {
$post['text'] .= '';
}
echo $post['text'];
?>
</blockquote>
</li>
<?php
}
?>
</ul>
<?php // only display more link for the bloglistingbox
if (strpos($blogListingClass, 'WikiaBlogListingBox') !== false && !empty($seeMoreUrl)) {
echo XML::element('a', array( 'href'=> $seeMoreUrl, 'class' => 'more'), wfMsg('oasis-more'));
}
if (isset($pager)) {
echo "<div id='wk_blogs_loader2' style='float:right;'></div>";
echo "<div class='wk_blogs_pager'>";
echo $pager;
echo "</div>";
}
?>
</section>
示例12: execute
public function execute($subpage)
{
wfProfileIn(__METHOD__);
$this->games = WF::build('ScavengerHuntGames');
$this->setHeaders();
$this->mTitle = SpecialPage::getTitleFor('scavengerhunt');
if ($this->isRestricted() && !$this->userCanExecute($this->user)) {
$this->displayRestrictionError();
return;
}
@(list($action, $id) = explode('/', $subpage));
$action = !empty($action) ? $action : 'list';
$id = (int) $id;
$game = $this->games->findById($id);
if (empty($game)) {
$game = $this->games->newGame();
}
// check edit tokens
if ($this->request->wasPosted() && !$this->user->matchEditToken($this->request->getVal('wpEditToken'))) {
NotificationsController::addConfirmation(wfMsg('scavengerhunt-edit-token-mismatch'), NotificationsController::CONFIRMATION_ERROR);
$this->out->redirect($this->mTitle->getFullUrl());
return;
}
$this->out->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/ScavengerHunt/css/scavenger-special.scss'));
$this->out->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/ScavengerHunt/css/scavenger-game.scss'));
$this->out->addScriptFile($this->app->getGlobal('wgExtensionsPath') . '/wikia/ScavengerHunt/js/scavenger-special.js');
$template = WF::build('EasyTemplate', array(dirname(__FILE__) . '/templates/'));
$errors = array();
switch ($action) {
case 'list':
$button = '<a class="wikia-button scavengerhunt-add-button" href="' . $this->mTitle->getFullUrl() . '/add">' . XML::element('img', array('class' => 'sprite new', 'src' => $this->app->getGlobal('wgBlankImgUrl'))) . wfMsg('scavengerhunt-button-add') . '</a>';
$this->out->mPagetitle .= $button;
$this->out->mPageLinkTitle = true;
// Games list
$pager = WF::build('ScavengerHuntGamesPager', array($this->games, $this->mTitle->getFullUrl(), $template));
$this->out->addHTML($pager->getBody() . $pager->getNavigationBar());
break;
case 'toggle':
$enable = !$game->isEnabled();
$game->setEnabled($enable);
$errors = $this->validateGame($game);
if (empty($errors['errors'])) {
$game->save();
NotificationsController::addConfirmation($enable ? wfMsg('scavengerhunt-game-has-been-enabled') : wfMsg('scavengerhunt-game-has-been-disabled'));
//success! go to the list
$this->out->redirect($this->mTitle->getFullUrl());
return;
} else {
//failure - display errors
$game->setEnabled(false);
}
// no "break" on purpose - wasPosted() will return false but we'll display proper template
// no "break" on purpose - wasPosted() will return false but we'll display proper template
case 'edit':
if ($this->request->wasPosted()) {
if ($this->request->getVal('enable')) {
$enabled = !$this->request->getVal('prevEnabled');
$game->setEnabled($enabled);
$errors = $this->validateGame($game);
if (empty($errors['errors'])) {
$game->save();
NotificationsController::addConfirmation($enabled ? wfMsg('scavengerhunt-game-has-been-enabled') : wfMsg('scavengerhunt-game-has-been-disabled'));
$this->out->redirect($this->mTitle->getFullUrl() . "/edit/{$id}");
return;
} else {
$game->setEnabled(false);
}
} else {
if ($this->request->getVal('delete')) {
$game->delete();
NotificationsController::addConfirmation(wfMsg('scavengerhunt-game-has-been-deleted'));
$this->out->redirect($this->mTitle->getFullUrl());
return;
}
}
}
// no "break" on purpose
// no "break" on purpose
case 'add':
if ($this->request->wasPosted()) {
if ($this->request->getVal('save')) {
$game = $this->updatePostedGame($game);
// move the validation process to the moment of enabling the game
$errors = $this->validateGame($game);
// save changes
if (empty($errors['errors']) && $game->save()) {
NotificationsController::addConfirmation($action == 'add' ? wfMsg('scavengerhunt-game-has-been-created') : wfMsg('scavengerhunt-game-has-been-saved'));
$this->out->redirect($this->mTitle->getFullUrl());
return;
} else {
NotificationsController::addConfirmation(wfMsg('scavengerhunt-game-has-not-been-saved'), NotificationsController::CONFIRMATION_NOTIFY);
}
}
}
$template->set('errors', isset($errors['errors']) ? $errors['errors'] : array());
$template->set('highlight', isset($errors['highlight']) ? $errors['highlight'] : array());
$template->set('editToken', $this->user->getEditToken());
$template->set_vars($this->getTemplateVarsFromGame($game));
$this->out->addHTML($template->render('form'));
break;
//.........这里部分代码省略.........
示例13: dumpError
function dumpError($sql)
{
if (Kennel::$ROOT_URL && !Request::isAjax()) {
// Non-ajax HTTP Request
$table = XML::element('table', null, array('border' => '1'));
$tr = XML::element('tr', $table);
$th = XML::element('th', $tr, array('colspan' => '2'), "SQL query returned an error");
$tr = XML::element('tr', $table);
$th = XML::element('th', $tr, null, 'query');
$td = XML::element('td', $tr, null, syntax::mysql($sql));
$tr = XML::element('tr', $table);
$th = XML::element('th', $tr, null, 'error');
$td = XML::element('td', $tr, null, mysql_error(self::$CONN));
$full_backtrace = debug_backtrace();
$backtrace = $full_backtrace[2];
if (isset($backtrace['file'])) {
$tr = XML::element('tr', $table);
$th = XML::element('th', $tr, null, 'file');
$td = XML::element('td', $tr, null, $backtrace['file']);
}
if (isset($backtrace['line'])) {
$tr = XML::element('tr', $table);
$th = XML::element('th', $tr, null, 'line');
$td = XML::element('td', $tr, null, $backtrace['line']);
}
if ($backtrace['class']) {
$tr = XML::element('tr', $table);
$th = XML::element('th', $tr, null, 'class');
$td = XML::element('td', $tr, null, $backtrace['class']);
}
if ($backtrace['function']) {
$tr = XML::element('tr', $table);
$th = XML::element('th', $tr, null, 'function');
$td = XML::element('td', $tr, null, $backtrace['function']);
}
echo $table;
} else {
// Ajax or cli
$default = "[0m";
echo "\n[1;30;41m";
// red background, bold
echo "SQL query returned an error:{$default}\n";
$lines = explode("\n", $sql);
foreach ($lines as $line) {
echo " {$line}\n";
}
$error = mysql_error(self::$CONN);
echo "[31m";
// red
echo "{$error}{$default}\n\n";
}
die;
}
示例14: dump
static function dump($return = false)
{
$table = XML::element('table', null, array('border' => '1', 'style' => 'background-color: #FFF; color: #000;'));
$tr = XML::element('tr', $table);
$td = XML::element('td', $tr, array('style' => 'font-weight: bold;'), 'Method');
$td = XML::element('td', $tr, null, self::$METHOD);
$tr = XML::element('tr', $table);
$td = XML::element('td', $tr, array('style' => 'font-weight: bold;'), 'Resource');
$td = XML::element('td', $tr, null, self::$RESOURCE);
$tr = XML::element('tr', $table);
$td = XML::element('td', $tr, array('style' => 'font-weight: bold;'), 'Controller');
$td = XML::element('td', $tr, null, self::$CONTROLLER);
$tr = XML::element('tr', $table);
$td = XML::element('td', $tr, array('style' => 'font-weight: bold;'), 'Action');
$td = XML::element('td', $tr, null, self::$ACTION);
$tr = XML::element('tr', $table);
$td = XML::element('td', $tr, array('style' => 'font-weight: bold;'), 'Arguments');
$td = XML::element('td', $tr, null, debug::getDump(self::$ARGS, true));
if ($return) {
return $table;
} else {
print $table;
}
}
示例15: toXML
public function toXML($isSimplified)
{
global $wgDataTransferViewXMLParseFields;
global $wgDataTransferViewXMLParseFreeText;
global $wgParser, $wgTitle;
if ($this->mIsTemplate) {
global $wgContLang;
$namespace_labels = $wgContLang->getNamespaces();
$template_label = $namespace_labels[NS_TEMPLATE];
$field_str = str_replace(' ', '_', wfMessage('dt_xml_field')->inContentLanguage()->text());
$name_str = str_replace(' ', '_', wfMessage('dt_xml_name')->inContentLanguage()->text());
$bodyXML = '';
foreach ($this->mFields as $fieldName => $fieldValue) {
// If this field itself holds template calls,
// get the XML for those calls.
if (is_array($fieldValue)) {
$fieldValueXML = '';
foreach ($fieldValue as $subComponent) {
$fieldValueXML .= $subComponent->toXML($isSimplified);
}
} elseif ($wgDataTransferViewXMLParseFields) {
// Avoid table of contents and "edit" links
$fieldValue = $wgParser->parse("__NOTOC__ __NOEDITSECTION__\n" . $fieldValue, $wgTitle, new ParserOptions())->getText();
}
if ($isSimplified) {
if (is_numeric($fieldName)) {
// add "Field" to the beginning of the file name, since
// XML tags that are simply numbers aren't allowed
$fieldTag = $field_str . '_' . $fieldName;
} else {
$fieldTag = str_replace(' ', '_', trim($fieldName));
}
$attrs = null;
} else {
$fieldTag = $field_str;
$attrs = array($name_str => $fieldName);
}
if (is_array($fieldValue)) {
$bodyXML .= Xml::tags($fieldTag, $attrs, $fieldValueXML);
} else {
$bodyXML .= Xml::element($fieldTag, $attrs, $fieldValue);
}
}
if ($isSimplified) {
$templateName = str_replace(' ', '_', $this->mTemplateName);
return Xml::tags($templateName, null, $bodyXML);
} else {
return Xml::tags($template_label, array($name_str => $this->mTemplateName), $bodyXML);
}
} else {
$free_text_str = str_replace(' ', '_', wfMessage('dt_xml_freetext')->inContentLanguage()->text());
if ($wgDataTransferViewXMLParseFreeText) {
$freeText = $this->mFreeText;
// Undo the escaping that happened before.
$freeText = str_replace(array('{', '}'), array('{', '}'), $freeText);
// Get rid of table of contents.
$mw = MagicWord::get('toc');
if ($mw->match($freeText)) {
$freeText = $mw->replace('', $freeText);
}
// Avoid "edit" links.
$freeText = $wgParser->parse("__NOEDITSECTION__\n" . $freeText, $wgTitle, new ParserOptions())->getText();
} else {
$freeText = $this->mFreeText;
}
return XML::element($free_text_str, array('id' => $this->mFreeTextID), $freeText);
}
}