本文整理汇总了PHP中Xml::tags方法的典型用法代码示例。如果您正苦于以下问题:PHP Xml::tags方法的具体用法?PHP Xml::tags怎么用?PHP Xml::tags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xml
的用法示例。
在下文中一共展示了Xml::tags方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doTagRow
function doTagRow($tag, $hitcount)
{
static $sk = null, $doneTags = array();
if (!$sk) {
$sk = $this->getSkin();
}
if (in_array($tag, $doneTags)) {
return '';
}
global $wgLang;
$newRow = '';
$newRow .= Xml::tags('td', null, Xml::element('tt', null, $tag));
$disp = ChangeTags::tagDescription($tag);
$disp .= ' (' . $sk->link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}"), wfMsgHtml('tags-edit')) . ')';
$newRow .= Xml::tags('td', null, $disp);
$msg = wfMessage("tag-{$tag}-description");
$desc = !$msg->exists() ? '' : $msg->parse();
$desc .= ' (' . $sk->link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}-description"), wfMsgHtml('tags-edit')) . ')';
$newRow .= Xml::tags('td', null, $desc);
$hitcount = wfMsgExt('tags-hitcount', array('parsemag'), $wgLang->formatNum($hitcount));
$hitcount = $sk->link(SpecialPage::getTitleFor('Recentchanges'), $hitcount, array(), array('tagfilter' => $tag));
$newRow .= Xml::tags('td', null, $hitcount);
$doneTags[] = $tag;
return Xml::tags('tr', null, $newRow) . "\n";
}
示例2: getPreferences
/**
* GetPreferences hook handler.
* @param $user User
* @param $preferences Array: Preference descriptions
*/
public static function getPreferences($user, &$preferences)
{
$gadgets = Gadget::loadStructuredList();
if (!$gadgets) {
return true;
}
$options = array();
$default = array();
foreach ($gadgets as $section => $thisSection) {
$available = array();
foreach ($thisSection as $gadget) {
if ($gadget->isAllowed($user)) {
$gname = $gadget->getName();
# bug 30182: dir="auto" because it's often not translated
$desc = '<span dir="auto">' . $gadget->getDescription() . '</span>';
$available[$desc] = $gname;
if ($gadget->isEnabled($user)) {
$default[] = $gname;
}
}
}
if ($section !== '') {
$section = wfMsgExt("gadget-section-{$section}", 'parseinline');
if (count($available)) {
$options[$section] = $available;
}
} else {
$options = array_merge($options, $available);
}
}
$preferences['gadgets-intro'] = array('type' => 'info', 'label' => ' ', 'default' => Xml::tags('tr', array(), Xml::tags('td', array('colspan' => 2), wfMsgExt('gadgets-prefstext', 'parse'))), 'section' => 'gadgets', 'raw' => 1, 'rawrow' => 1);
$preferences['gadgets'] = array('type' => 'multiselect', 'options' => $options, 'section' => 'gadgets', 'label' => ' ', 'prefix' => 'gadget-', 'default' => $default);
return true;
}
示例3: addResources
/**
* AjaxAddScript hook
* Adds scripts
*/
public static function addResources($out)
{
global $wgExtensionAssetsPath, $wgJsMimeType;
global $wgUsabilityInitiativeResourceMode;
global $wgEnableJS2system, $wgEditToolbarRunTests;
global $wgStyleVersion;
wfRunHooks('UsabilityInitiativeLoadModules');
if (!self::$doOutput) {
return true;
}
// Default to raw
$mode = $wgUsabilityInitiativeResourceMode;
// Just an alias
if (!isset(self::$scriptFiles['base_sets'][$mode])) {
$mode = 'raw';
}
// Include base-set of scripts
self::$scripts = array_merge(self::$scriptFiles['base_sets'][$mode], self::$scriptFiles['modules'][$mode], self::$scripts);
// Provide enough support to make things work, even when js2 is not
// in use (eventually it will be standard, but right now it's not)
if (!$wgEnableJS2system) {
$out->includeJQuery();
}
// Include base-set of styles
self::$styles = array_merge(self::$styleFiles['base_sets'][$mode], self::$styles);
if ($wgEditToolbarRunTests) {
// Include client side tests
self::$scripts = array_merge(self::$scripts, self::$scriptFiles['tests']);
}
// Loops over each script
foreach (self::$scripts as $script) {
// Add javascript to document
if ($script['src'][0] == '/') {
// Path is relative to $wgScriptPath
global $wgScriptPath;
$src = "{$wgScriptPath}{$script['src']}";
} else {
// Path is relative to $wgExtensionAssetsPath
$src = "{$wgExtensionAssetsPath}/UsabilityInitiative/{$script['src']}";
}
$version = isset($script['version']) ? $script['version'] : $wgStyleVersion;
$out->addScriptFile($src, $version);
}
// Transforms messages into javascript object members
foreach (self::$messages as $i => $message) {
$escapedMessageValue = Xml::escapeJsString(wfMsg($message));
$escapedMessageKey = Xml::escapeJsString($message);
self::$messages[$i] = "'{$escapedMessageKey}':'{$escapedMessageValue}'";
}
// Add javascript to document
if (count(self::$messages) > 0) {
$out->addScript(Xml::tags('script', array('type' => $wgJsMimeType), 'mw.usability.addMessages({' . implode(',', self::$messages) . '});'));
}
// Loops over each style
foreach (self::$styles as $style) {
// Add css for various styles
$out->addLink(array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => $wgExtensionAssetsPath . "/UsabilityInitiative/" . "{$style['src']}?{$style['version']}"));
}
return true;
}
示例4: generateFormStart
public function generateFormStart()
{
$form = $this->generateBannerHeader();
$form .= Xml::openElement('div', array('id' => 'mw-creditcard'));
// provide a place at the top of the form for displaying general messages
if ($this->form_errors['general']) {
$form .= Xml::openElement('div', array('id' => 'mw-payflow-general-error'));
if (is_array($this->form_errors['general'])) {
foreach ($this->form_errors['general'] as $this->form_errors_msg) {
$form .= Xml::tags('p', array('class' => 'creditcard-error-msg'), $this->form_errors_msg);
}
} else {
$form .= Xml::tags('p', array('class' => 'creditcard-error-msg'), $this->form_errors_msg);
}
$form .= Xml::closeElement('div');
}
// add noscript tags for javascript disabled browsers
$form .= $this->getNoScript();
// open form
$form .= Xml::openElement('div', array('id' => 'mw-creditcard-form'));
// Xml::element seems to convert html to htmlentities
$form .= "<p class='creditcard-error-msg'>" . $this->form_errors['retryMsg'] . "</p>";
$form .= Xml::openElement('form', array('name' => 'payment', 'method' => 'post', 'action' => $this->getNoCacheAction(), 'onsubmit' => 'return formCheck(this)', 'autocomplete' => 'off'));
$form .= Xml::openElement('div', array('id' => 'left-column', 'class' => 'payflow-cc-form-section'));
$form .= $this->generatePersonalContainer();
$form .= Xml::closeElement('div');
// close div#left-column
$form .= Xml::openElement('div', array('id' => 'right-column', 'class' => 'payflow-cc-form-section'));
$form .= $this->generatePaymentContainer();
return $form;
}
示例5: redircite_render
function redircite_render($input, $args, &$parser) {
// Generate HTML code and add it to the $redirciteMarkerList array
// Add "xx-redircite-marker-NUMBER-redircite-xx" to the output,
// which will be translated to the HTML stored in $redirciteMarkerList by
// redircite_afterTidy()
global $redirciteMarkerList;
# Verify that $input is a valid title
$inputTitle = Title::newFromText($input);
if(!$inputTitle)
return $input;
$link1 = $parser->recursiveTagParse("[[$input]]");
$title1 = Title::newFromText($input);
if(!$title1->exists()) // Page doesn't exist
// Just output a normal (red) link
return $link1;
$articleObj = new Article($title1);
$title2 = Title::newFromRedirect($articleObj->fetchContent());
if(!$title2) // Page is not a redirect
// Just output a normal link
return $link1;
$link2 = $parser->recursiveTagParse("[[{$title2->getPrefixedText()}|$input]]");
$marker = "xx-redircite-marker-" . count($redirciteMarkerList) . "-redircite-xx";
$onmouseout = 'this.firstChild.innerHTML = "'. Xml::escapeJsString($input) . '";';
$onmouseover = 'this.firstChild.innerHTML = "' . Xml::escapeJsString($title2->getPrefixedText()) . '";';
return Xml::tags('span', array(
'onmouseout' => $onmouseout,
'onmouseover' => $onmouseover),
$link2);
}
示例6: getDiv
public function getDiv($value)
{
global $wgOut, $wgPromoterAdPreview;
if (array_key_exists('language', $this->mParams)) {
$language = $this->mParams['language'];
} else {
$language = $wgOut->getContext()->getLanguage()->getCode();
}
$html = Xml::openElement('div', array('id' => Sanitizer::escapeId("pr-ad-list-element-{$this->mParams['ad']}"), 'class' => "pr-ad-list-element"));
// Make the label; this consists of a text link to the ad editor, and a series of status icons
if (array_key_exists('withlabel', $this->mParams)) {
$adName = $this->mParams['ad'];
$html .= Xml::openElement('div', array('class' => 'pr-ad-list-element-label'));
$html .= Linker::link(SpecialPage::getTitleFor('PromoterAds', "edit/{$adName}"), htmlspecialchars($adName), array('class' => 'pr-ad-list-element-label-text'));
$html .= ' (' . Linker::link(SpecialPage::getTitleFor('Randompage'), $this->msg('promoter-live-preview'), array('class' => 'pr-ad-list-element-label-text'), array('ad' => $adName, 'uselang' => $language, 'force' => '1')) . ')';
// TODO: Output status icons
$html .= Xml::tags('div', array('class' => 'pr-ad-list-element-label-icons'), '');
$html .= Xml::closeElement('div');
}
// Add the ad preview
if ($wgPromoterAdPreview) {
$html .= $this->getInputHTML(null);
}
$html .= Xml::closeElement('div');
return $html;
}
示例7: render
public static function render($input, $args, $parser, $frame)
{
// Disable cache so that CSS will get loaded.
$parser->disableCache();
// If this call is contained in a transcluded page or template,
// or if the input is empty, display nothing.
if (!$frame->title->equals($parser->getTitle()) || $input == '') {
return;
}
// TODO: Do processing here, like parse to an array
$error_msg = null;
// Recreate the top-level <PageSchema> tag, with whatever
// attributes it contained, because that was actually a tag-
// function call, as opposed to a real XML tag.
$input = Xml::tags('PageSchema', $args, $input);
if ($xml_object = PageSchemas::validateXML($input, $error_msg)) {
// Store the XML in the page_props table
$parser->getOutput()->setProperty('PageSchema', $input);
// Display the schema on the screen
global $wgOut, $wgScriptPath;
$wgOut->addStyle($wgScriptPath . '/extensions/PageSchemas/PageSchemas.css');
$text = PageSchemas::displaySchema($xml_object);
} else {
// Store error message in the page_props table
$parser->getOutput()->setProperty('PageSchema', $error_msg);
$text = Html::element('p', null, "The (incorrect) XML definition for this template is:") . "\n";
$text .= Html::element('pre', null, $input);
}
return $text;
}
示例8: execute
function execute($query)
{
global $wgUser, $wgOut, $wgRequest;
$this->setHeaders();
if (!$wgUser->isAllowed('datatransferimport')) {
global $wgOut;
$wgOut->permissionRequired('datatransferimport');
return;
}
if ($wgRequest->getCheck('import_file')) {
$text = DTUtils::printImportingMessage();
$uploadResult = ImportStreamSource::newFromUpload("file_name");
// handling changed in MW 1.17
if ($uploadResult instanceof Status) {
$source = $uploadResult->value;
} else {
$source = $uploadResult;
}
$importSummary = $wgRequest->getVal('import_summary');
$forPagesThatExist = $wgRequest->getVal('pagesThatExist');
$text .= self::modifyPages($source, $importSummary, $forPagesThatExist);
} else {
$formText = DTUtils::printFileSelector('XML');
$formText .= DTUtils::printExistingPagesHandling();
$formText .= DTUtils::printImportSummaryInput('XML');
$formText .= DTUtils::printSubmitButton();
$text = "\t" . Xml::tags('form', array('enctype' => 'multipart/form-data', 'action' => '', 'method' => 'post'), $formText) . "\n";
}
$wgOut->addHTML($text);
}
示例9: tooltip
static function tooltip( $parser, $tooltip = null, $text = null ) {
if ( !$text ) {
return;
}
$tooltip = Xml::tags( 'span',
array( 'style' => 'display: none', 'class' => 'mw-tooltip' ),
$tooltip );
$text .= "\n$tooltip";
$text = Xml::tags( 'span',
array( 'class' => 'mw-tooltip-text' ), $text );
// Script for hover behaviour hacked in by Andrew Garrett, 2010-08-09
static $scriptDone = false;
if ( ! $scriptDone ) {
$scriptDone = true;
global $wgOut, $IP, $wgScriptPath;
$output = $parser->getOutput();
// Figure out the web-accessible path to the extension.
$dir = dirname( __FILE__ );
if ( strpos( $dir, $IP ) === 0 ) {
$dir = substr( $dir, strlen($IP) );
$dir = $wgScriptPath . $dir;
$output->addHeadItem( "<link rel=\"stylesheet\" type=\"text/css\" href=\"$dir/jquery-tooltip/jquery.tooltip.css\"/>" );
$output->addHeadItem( Html::linkedScript( "$dir/jquery-tooltip/jquery.tooltip.pack.js" ) );
$output->addHeadItem( Html::linkedScript( "$dir/hover.js" ) );
}
}
return $text;
}
示例10: getForm
/**
* Returns HTML5 output of the form
* GLOBALS: $wgLang, $wgScript
* @return string
*/
protected function getForm() {
global $wgLang, $wgScript;
$form = Xml::tags( 'form',
array(
'action' => $wgScript,
'method' => 'get'
),
'<table><tr><td>' .
wfMsgHtml( 'translate-page-language' ) .
'</td><td>' .
TranslateUtils::languageSelector( $wgLang->getCode(), $this->options['language'] ) .
'</td></tr><tr><td>' .
wfMsgHtml( 'translate-magic-module' ) .
'</td><td>' .
$this->moduleSelector( $this->options['module'] ) .
'</td></tr><tr><td colspan="2">' .
Xml::submitButton( wfMsg( 'translate-magic-submit' ) ) . ' ' .
Xml::submitButton( wfMsg( 'translate-magic-cm-export' ), array( 'name' => 'export' ) ) .
'</td></tr></table>' .
Html::hidden( 'title', $this->getTitle()->getPrefixedText() )
);
return $form;
}
示例11: formatSummaryRow
/**
* Creates HTML for the given tags
*
* @param string $tags Comma-separated list of tags
* @param string $page A label for the type of action which is being displayed,
* for example: 'history', 'contributions' or 'newpages'
* @param IContextSource|null $context
* @note Even though it takes null as a valid argument, an IContextSource is preferred
* in a new code, as the null value is subject to change in the future
* @return array Array with two items: (html, classes)
* - html: String: HTML for displaying the tags (empty string when param $tags is empty)
* - classes: Array of strings: CSS classes used in the generated html, one class for each tag
*/
public static function formatSummaryRow($tags, $page, IContextSource $context = null)
{
if (!$tags) {
return ['', []];
}
if (!$context) {
$context = RequestContext::getMain();
}
$classes = [];
$tags = explode(',', $tags);
$displayTags = [];
foreach ($tags as $tag) {
if (!$tag) {
continue;
}
$description = self::tagDescription($tag, $context);
if ($description === false) {
continue;
}
$displayTags[] = Xml::tags('span', ['class' => 'mw-tag-marker ' . Sanitizer::escapeClass("mw-tag-marker-{$tag}")], $description);
$classes[] = Sanitizer::escapeClass("mw-tag-{$tag}");
}
if (!$displayTags) {
return ['', []];
}
$markers = $context->msg('tag-list-wrapper')->numParams(count($displayTags))->rawParams($context->getLanguage()->commaList($displayTags))->parse();
$markers = Xml::tags('span', ['class' => 'mw-tag-markers'], $markers);
return [$markers, $classes];
}
示例12: show
function show()
{
global $wgOut, $wgUser;
// Header
$wgOut->setSubTitle(wfMsg('abusefilter-tools-subtitle'));
$wgOut->addWikiMsg('abusefilter-tools-text');
// Expression evaluator
$eval = '';
$eval .= AbuseFilter::buildEditBox('', 'wpTestExpr');
// Only let users with permission actually test it
if ($wgUser->isAllowed('abusefilter-modify')) {
$eval .= Xml::tags('p', null, Xml::element('input', array('type' => 'button', 'id' => 'mw-abusefilter-submitexpr', 'onclick' => 'doExprSubmit();', 'value' => wfMsg('abusefilter-tools-submitexpr'))));
$eval .= Xml::element('p', array('id' => 'mw-abusefilter-expr-result'), ' ');
}
$eval = Xml::fieldset(wfMsg('abusefilter-tools-expr'), $eval);
$wgOut->addHTML($eval);
// Associated script
$exprScript = file_get_contents(dirname(__FILE__) . '/tools.js');
$wgOut->addInlineScript($exprScript);
global $wgUser;
if ($wgUser->isAllowed('abusefilter-modify')) {
// Hacky little box to re-enable autoconfirmed if it got disabled
$rac = '';
$rac .= Xml::inputLabel(wfMsg('abusefilter-tools-reautoconfirm-user'), 'wpReAutoconfirmUser', 'reautoconfirm-user', 45);
$rac .= ' ';
$rac .= Xml::element('input', array('type' => 'button', 'id' => 'mw-abusefilter-reautoconfirmsubmit', 'onclick' => 'doReautoSubmit();', 'value' => wfMsg('abusefilter-tools-reautoconfirm-submit')));
$rac = Xml::fieldset(wfMsg('abusefilter-tools-reautoconfirm'), $rac);
$wgOut->addHTML($rac);
}
}
示例13: getPageHeader
function getPageHeader()
{
// show the names of the three lists of pages, with the one
// corresponding to the current "mode" not being linked
$approvedPagesTitle = SpecialPage::getTitleFor('ApprovedRevs');
$navLine = wfMessage('approvedrevs-view')->parse() . ' ';
if ($this->mMode == '') {
$navLine .= Xml::element('strong', null, wfMessage('approvedrevs-approvedpages')->text());
} else {
$navLine .= Xml::element('a', array('href' => $approvedPagesTitle->getLocalURL()), wfMessage('approvedrevs-approvedpages')->text());
}
$navLine .= ' | ';
if ($this->mMode == 'notlatest') {
$navLine .= Xml::element('strong', null, wfMessage('approvedrevs-notlatestpages')->text());
} else {
$navLine .= Xml::element('a', array('href' => $approvedPagesTitle->getLocalURL(array('show' => 'notlatest'))), wfMessage('approvedrevs-notlatestpages')->text());
}
$navLine .= ' | ';
if ($this->mMode == 'unapproved') {
$navLine .= Xml::element('strong', null, wfMessage('approvedrevs-unapprovedpages')->text());
} else {
$navLine .= Xml::element('a', array('href' => $approvedPagesTitle->getLocalURL(array('show' => 'unapproved'))), wfMessage('approvedrevs-unapprovedpages')->text());
}
return Xml::tags('p', null, $navLine) . "\n";
}
示例14: show
function show()
{
$out = $this->getOutput();
$user = $this->getUser();
// Header
$out->addWikiMsg('abusefilter-tools-text');
// Expression evaluator
$eval = '';
$eval .= AbuseFilter::buildEditBox('', 'wpTestExpr');
// Only let users with permission actually test it
if ($user->isAllowed('abusefilter-modify')) {
$eval .= Xml::tags('p', null, Xml::element('input', array('type' => 'button', 'id' => 'mw-abusefilter-submitexpr', 'value' => $this->msg('abusefilter-tools-submitexpr')->text())));
$eval .= Xml::element('p', array('id' => 'mw-abusefilter-expr-result'), ' ');
}
$eval = Xml::fieldset($this->msg('abusefilter-tools-expr')->text(), $eval);
$out->addHTML($eval);
$out->addModules('ext.abuseFilter.tools');
if ($user->isAllowed('abusefilter-modify')) {
// Hacky little box to re-enable autoconfirmed if it got disabled
$rac = '';
$rac .= Xml::inputLabel($this->msg('abusefilter-tools-reautoconfirm-user')->text(), 'wpReAutoconfirmUser', 'reautoconfirm-user', 45);
$rac .= ' ';
$rac .= Xml::element('input', array('type' => 'button', 'id' => 'mw-abusefilter-reautoconfirmsubmit', 'value' => $this->msg('abusefilter-tools-reautoconfirm-submit')->text()));
$rac = Xml::fieldset($this->msg('abusefilter-tools-reautoconfirm')->text(), $rac);
$out->addHTML($rac);
}
}
示例15: doTagRow
function doTagRow($tag, $hitcount)
{
static $sk = null, $doneTags = array();
if (!$sk) {
global $wgUser;
$sk = $wgUser->getSkin();
}
if (in_array($tag, $doneTags)) {
return '';
}
$newRow = '';
$newRow .= Xml::tags('td', null, Xml::element('tt', null, $tag));
$disp = ChangeTags::tagDescription($tag);
$disp .= ' (' . $sk->link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}"), wfMsg('tags-edit')) . ')';
$newRow .= Xml::tags('td', null, $disp);
$desc = wfMsgExt("tag-{$tag}-description", 'parseinline');
$desc = wfEmptyMsg("tag-{$tag}-description", $desc) ? '' : $desc;
$desc .= ' (' . $sk->link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}-description"), wfMsg('tags-edit')) . ')';
$newRow .= Xml::tags('td', null, $desc);
$hitcount = wfMsg('tags-hitcount', $hitcount);
$hitcount = $sk->link(SpecialPage::getTitleFor('RecentChanges'), $hitcount, array(), array('tagfilter' => $tag));
$newRow .= Xml::tags('td', null, $hitcount);
$doneTags[] = $tag;
return Xml::tags('tr', null, $newRow) . "\n";
}