本文整理汇总了PHP中Xml::languageSelector方法的典型用法代码示例。如果您正苦于以下问题:PHP Xml::languageSelector方法的具体用法?PHP Xml::languageSelector怎么用?PHP Xml::languageSelector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xml
的用法示例。
在下文中一共展示了Xml::languageSelector方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showToolbar
protected function showToolbar() {
$langSelector = Xml::languageSelector( $this->lang );
$fontSelector = new XmlSelect();
$fontSelector->setAttribute( 'id', 'webfonts-font-chooser' );
$sizeSelector = new XmlSelect();
$sizeSelector->setAttribute( 'id', 'webfonts-size-chooser' );
for ( $size = 8; $size <= 28; $size += 2 ) {
$sizeSelector->addOption( $size , $size );
}
$sizeSelector->setDefault( 16 );
$bold = Html::Element( 'button', array( 'id' => 'webfonts-preview-bold' ) , 'B' );
$italic = Html::Element( 'button', array( 'id' => 'webfonts-preview-italic' ) , 'I' );
$underline = Html::Element( 'button', array( 'id' => 'webfonts-preview-underline' ) , 'U' );
$download = Html::Element( 'a', array( 'id' => 'webfonts-preview-download', 'href' => '#' ) ,
wfMsg( 'webfonts-preview-download' ) );
return Html::openElement( 'div', array( 'id' => 'webfonts-preview-toolbar' ) )
. $langSelector[1]
. $fontSelector->getHtml()
. $sizeSelector->getHtml()
. $bold
. $italic
. $underline
. $download
. Html::closeElement( 'div' );
}
示例2: addRequestWikiForm
function addRequestWikiForm()
{
$localpage = $this->getPageTitle()->getLocalUrl();
$form = Xml::openElement('form', array('action' => $localpage, 'method' => 'post'));
$form .= '<fieldset><legend>' . $this->msg('requestwiki')->escaped() . '</legend>';
$form .= Xml::openElement('table');
$form .= '<tr><td>' . $this->msg('requestwiki-label-siteurl')->escaped() . '</td>';
$form .= '<td>' . Xml::input('subdomain', 20, '') . '.miraheze.org' . '</td></tr>';
$form .= '<tr><td>' . $this->msg('requestwiki-label-sitename')->escaped() . '</td>';
$form .= '<td>' . Xml::input('sitename', 20, '', array('required' => '')) . '</td></tr>';
$form .= '<tr><td>' . $this->msg('requestwiki-label-customdomain')->escaped() . '</td>';
$form .= '<td>' . Xml::input('customdomain', 20, '') . '</td></tr>';
$form .= '<tr><td>' . $this->msg('requestwiki-label-language')->escaped() . '</td>';
$form .= '<td>' . Xml::languageSelector('en', true, null, array('name' => 'language'))[1] . '</td></tr>';
$form .= '<tr><td>' . $this->msg('requestwiki-label-private')->escaped() . '</td>';
$form .= '<td>' . Xml::check('private', false, array('value' => 0)) . '</td></tr>';
$form .= '<tr><td>' . $this->msg('requestwiki-label-comments')->escaped() . '</td>';
$form .= '<td>' . Xml::textarea('comments', '', 40, 5, array('required' => '')) . '</td></tr>';
$form .= '<tr><td>' . Xml::submitButton($this->msg('requestwiki-submit')->plain()) . '</td></tr>';
$form .= Xml::closeElement('table');
$form .= '</fieldset>';
$form .= Html::hidden('token', $this->getUser()->getEditToken());
$form .= Xml::closeElement('form');
$this->getOutput()->addHTML($form);
}
示例3: buildForm
function buildForm()
{
$attrs = ['id' => 'mw-allmessages-form-lang', 'name' => 'lang'];
$msg = wfMessage('allmessages-language');
$langSelect = Xml::languageSelector($this->langcode, false, null, $attrs, $msg);
$out = Xml::openElement('form', ['method' => 'get', 'action' => $this->getConfig()->get('Script'), 'id' => 'mw-allmessages-form']) . Xml::fieldset($this->msg('allmessages-filter-legend')->text()) . Html::hidden('title', $this->getTitle()->getPrefixedText()) . Xml::openElement('table', ['class' => 'mw-allmessages-table']) . "\n" . '<tr>
<td class="mw-label">' . Xml::label($this->msg('allmessages-prefix')->text(), 'mw-allmessages-form-prefix') . "</td>\n\n\t\t\t<td class=\"mw-input\">" . Xml::input('prefix', 20, str_replace('_', ' ', $this->displayPrefix), ['id' => 'mw-allmessages-form-prefix']) . "</td>\n\n\t\t\t</tr>\n\t\t\t<tr>\n\n\t\t\t<td class='mw-label'>" . $this->msg('allmessages-filter')->escaped() . "</td>\n\n\t\t\t\t<td class='mw-input'>" . Xml::radioLabel($this->msg('allmessages-filter-unmodified')->text(), 'filter', 'unmodified', 'mw-allmessages-form-filter-unmodified', $this->filter === 'unmodified') . Xml::radioLabel($this->msg('allmessages-filter-all')->text(), 'filter', 'all', 'mw-allmessages-form-filter-all', $this->filter === 'all') . Xml::radioLabel($this->msg('allmessages-filter-modified')->text(), 'filter', 'modified', 'mw-allmessages-form-filter-modified', $this->filter === 'modified') . "</td>\n\n\t\t\t</tr>\n\t\t\t<tr>\n\n\t\t\t\t<td class=\"mw-label\">" . $langSelect[0] . "</td>\n\n\t\t\t\t<td class=\"mw-input\">" . $langSelect[1] . "</td>\n\n\t\t\t</tr>" . '<tr>
<td class="mw-label">' . Xml::label($this->msg('table_pager_limit_label')->text(), 'mw-table_pager_limit_label') . '</td>
<td class="mw-input">' . $this->getLimitSelect(['id' => 'mw-table_pager_limit_label']) . '</td>
<tr>
<td></td>
<td>' . Xml::submitButton($this->msg('allmessages-filter-submit')->text()) . "</td>\n\n\t\t\t</tr>" . Xml::closeElement('table') . $this->getHiddenFields(['title', 'prefix', 'filter', 'lang', 'limit']) . Xml::closeElement('fieldset') . Xml::closeElement('form');
return $out;
}
示例4: testLanguageSelector
/**
* @covers Xml::languageSelector
*/
public function testLanguageSelector()
{
$select = Xml::languageSelector('en', true, null, array('id' => 'testlang'), wfMessage('yourlanguage'));
$this->assertEquals('<label for="testlang">Language:</label>', $select[0]);
}
示例5: mainPrefsForm
//.........这里部分代码省略.........
foreach ($userEffectiveGroups as $ueg) {
if ($ueg == '*') {
// Skip the default * group, seems useless here
continue;
}
$userEffectiveGroupsArray[] = User::makeGroupLinkHTML($ueg);
}
asort($userEffectiveGroupsArray);
$sk = $wgUser->getSkin();
$toolLinks = array();
$toolLinks[] = $sk->makeKnownLinkObj(SpecialPage::getTitleFor('ListGroupRights'), wfMsg('listgrouprights'));
# At the moment one tool link only but be prepared for the future...
# FIXME: Add a link to Special:Userrights for users who are allowed to use it.
# $wgUser->isAllowed( 'userrights' ) seems to strict in some cases
$userInformationHtml = $this->tableRow(wfMsgHtml('username'), htmlspecialchars($wgUser->getName())) . $this->tableRow(wfMsgHtml('uid'), $wgLang->formatNum(htmlspecialchars($wgUser->getId()))) . $this->tableRow(wfMsgExt('prefs-memberingroups', array('parseinline'), count($userEffectiveGroupsArray)), $wgLang->commaList($userEffectiveGroupsArray) . '<br />(' . implode(' | ', $toolLinks) . ')') . $this->tableRow(wfMsgHtml('prefs-edits'), $wgLang->formatNum($wgUser->getEditCount()));
if (wfRunHooks('PreferencesUserInformationPanel', array($this, &$userInformationHtml))) {
$wgOut->addHTML($userInformationHtml);
}
if ($wgAllowRealName) {
$wgOut->addHTML($this->tableRow(Xml::label(wfMsg('yourrealname'), 'wpRealName'), Xml::input('wpRealName', 25, $this->mRealName, array('id' => 'wpRealName')), Xml::tags('div', array('class' => 'prefsectiontip'), wfMsgExt('prefs-help-realname', 'parseinline'))));
}
if ($wgEnableEmail) {
$wgOut->addHTML($this->tableRow(Xml::label(wfMsg('youremail'), 'wpUserEmail'), Xml::input('wpUserEmail', 25, $this->mUserEmail, array('id' => 'wpUserEmail')), Xml::tags('div', array('class' => 'prefsectiontip'), wfMsgExt($wgEmailConfirmToEdit ? 'prefs-help-email-required' : 'prefs-help-email', 'parseinline'))));
}
global $wgParser, $wgMaxSigChars;
if (mb_strlen($this->mNick) > $wgMaxSigChars) {
$invalidSig = $this->tableRow(' ', Xml::element('span', array('class' => 'error'), wfMsgExt('badsiglength', 'parsemag', $wgLang->formatNum($wgMaxSigChars))));
} elseif (!empty($this->mToggles['fancysig']) && false === $wgParser->validateSig($this->mNick)) {
$invalidSig = $this->tableRow(' ', Xml::element('span', array('class' => 'error'), wfMsg('badsig')));
} else {
$invalidSig = '';
}
$wgOut->addHTML($this->tableRow(Xml::label(wfMsg('yournick'), 'wpNick'), Xml::input('wpNick', 25, $this->mNick, array('id' => 'wpNick', 'maxlength' => $wgMaxSigChars))) . $invalidSig . $this->tableRow(' ', $this->getToggle('fancysig')));
list($lsLabel, $lsSelect) = Xml::languageSelector($this->mUserLanguage);
$wgOut->addHTML($this->tableRow($lsLabel, $lsSelect));
/* see if there are multiple language variants to choose from*/
if (!$wgDisableLangConversion) {
$variants = $wgContLang->getVariants();
$variantArray = array();
$languages = Language::getLanguageNames(true);
foreach ($variants as $v) {
$v = str_replace('_', '-', strtolower($v));
if (array_key_exists($v, $languages)) {
// If it doesn't have a name, we'll pretend it doesn't exist
$variantArray[$v] = $languages[$v];
}
}
$options = "\n";
foreach ($variantArray as $code => $name) {
$selected = $code == $this->mUserVariant;
$options .= Xml::option("{$code} - {$name}", $code, $selected) . "\n";
}
if (count($variantArray) > 1) {
$wgOut->addHTML($this->tableRow(Xml::label(wfMsg('yourvariant'), 'wpUserVariant'), Xml::tags('select', array('name' => 'wpUserVariant', 'id' => 'wpUserVariant'), $options)));
}
if (count($variantArray) > 1 && !$wgDisableLangConversion && !$wgDisableTitleConversion) {
$wgOut->addHTML(Xml::tags('tr', null, Xml::tags('td', array('colspan' => '2'), $this->getToggle("noconvertlink"))));
}
}
# Password
if ($wgAuth->allowPasswordChange()) {
$link = $wgUser->getSkin()->link(SpecialPage::getTitleFor('ResetPass'), wfMsgHtml('prefs-resetpass'), array(), array('returnto' => SpecialPage::getTitleFor('Preferences')));
$wgOut->addHTML($this->tableRow(Xml::element('h2', null, wfMsg('changepassword'))) . $this->tableRow('<ul><li>' . $link . '</li></ul>'));
}
# <FIXME>
# Enotif
示例6: mainPrefsForm
/**
* @access private
*/
function mainPrefsForm($status, $message = '')
{
global $wgUser, $wgOut, $wgLang, $wgContLang;
global $wgAllowRealName, $wgImageLimits, $wgThumbLimits;
global $wgDisableLangConversion;
global $wgEnotifWatchlist, $wgEnotifUserTalk, $wgEnotifMinorEdits;
global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress;
global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication;
global $wgContLanguageCode, $wgDefaultSkin, $wgSkipSkins, $wgAuth;
$wgOut->setPageTitle(wfMsg('preferences'));
$wgOut->setArticleRelated(false);
$wgOut->setRobotpolicy('noindex,nofollow');
$wgOut->disallowUserJs();
# Prevent hijacked user scripts from sniffing passwords etc.
if ($this->mSuccess || 'success' == $status) {
$wgOut->addWikitext('<div class="successbox"><strong>' . wfMsg('savedprefs') . '</strong></div>');
} else {
if ('error' == $status) {
$wgOut->addWikitext('<div class="errorbox"><strong>' . $message . '</strong></div>');
} else {
if ('' != $status) {
$wgOut->addWikitext($message . "\n----");
}
}
}
$qbs = $wgLang->getQuickbarSettings();
$skinNames = $wgLang->getSkinNames();
$mathopts = $wgLang->getMathNames();
$dateopts = $wgLang->getDatePreferences();
$togs = User::getToggles();
$titleObj = SpecialPage::getTitleFor('Preferences');
$action = $titleObj->escapeLocalURL();
# Pre-expire some toggles so they won't show if disabled
$this->mUsedToggles['shownumberswatching'] = true;
$this->mUsedToggles['showupdated'] = true;
$this->mUsedToggles['enotifwatchlistpages'] = true;
$this->mUsedToggles['enotifusertalkpages'] = true;
$this->mUsedToggles['enotifminoredits'] = true;
$this->mUsedToggles['enotifrevealaddr'] = true;
$this->mUsedToggles['ccmeonemails'] = true;
$this->mUsedToggles['uselivepreview'] = true;
if (!$this->mEmailFlag) {
$emfc = 'checked="checked"';
} else {
$emfc = '';
}
if ($wgEmailAuthentication && $this->mUserEmail != '') {
if ($wgUser->getEmailAuthenticationTimestamp()) {
$emailauthenticated = wfMsg('emailauthenticated', $wgLang->timeanddate($wgUser->getEmailAuthenticationTimestamp(), true)) . '<br />';
$disableEmailPrefs = false;
} else {
$disableEmailPrefs = true;
$skin = $wgUser->getSkin();
$emailauthenticated = wfMsg('emailnotauthenticated') . '<br />' . $skin->makeKnownLinkObj(SpecialPage::getTitleFor('Confirmemail'), wfMsg('emailconfirmlink')) . '<br />';
}
} else {
$emailauthenticated = '';
$disableEmailPrefs = false;
}
if ($this->mUserEmail == '') {
$emailauthenticated = wfMsg('noemailprefs') . '<br />';
}
$ps = $this->namespacesCheckboxes();
$enotifwatchlistpages = $wgEnotifWatchlist ? $this->getToggle('enotifwatchlistpages', false, $disableEmailPrefs) : '';
$enotifusertalkpages = $wgEnotifUserTalk ? $this->getToggle('enotifusertalkpages', false, $disableEmailPrefs) : '';
$enotifminoredits = $wgEnotifWatchlist && $wgEnotifMinorEdits ? $this->getToggle('enotifminoredits', false, $disableEmailPrefs) : '';
$enotifrevealaddr = ($wgEnotifWatchlist || $wgEnotifUserTalk) && $wgEnotifRevealEditorAddress ? $this->getToggle('enotifrevealaddr', false, $disableEmailPrefs) : '';
# </FIXME>
$wgOut->addHTML("<form action=\"{$action}\" method='post'>");
$wgOut->addHTML("<div id='preferences'>");
# User data
$wgOut->addHTML(Xml::openElement('fieldset ') . Xml::element('legend', null, wfMsg('prefs-personal')) . Xml::openElement('table') . $this->tableRow(Xml::element('h2', null, wfMsg('prefs-personal'))));
$userInformationHtml = $this->tableRow(wfMsgHtml('username'), htmlspecialchars($wgUser->getName())) . $this->tableRow(wfMsgHtml('uid'), htmlspecialchars($wgUser->getID())) . $this->tableRow(wfMsgHtml('prefs-edits'), $wgLang->formatNum(User::edits($wgUser->getId())));
if (wfRunHooks('PreferencesUserInformationPanel', array($this, &$userInformationHtml))) {
$wgOut->addHtml($userInformationHtml);
}
if ($wgAllowRealName) {
$wgOut->addHTML($this->tableRow(Xml::label(wfMsg('yourrealname'), 'wpRealName'), Xml::input('wpRealName', 25, $this->mRealName, array('id' => 'wpRealName')), Xml::tags('div', array('class' => 'prefsectiontip'), wfMsgExt('prefs-help-realname', 'parseinline'))));
}
if ($wgEnableEmail) {
$wgOut->addHTML($this->tableRow(Xml::label(wfMsg('youremail'), 'wpUserEmail'), Xml::input('wpUserEmail', 25, $this->mUserEmail, array('id' => 'wpUserEmail')), Xml::tags('div', array('class' => 'prefsectiontip'), wfMsgExt('prefs-help-email', 'parseinline'))));
}
global $wgParser, $wgMaxSigChars;
if (mb_strlen($this->mNick) > $wgMaxSigChars) {
$invalidSig = $this->tableRow(' ', Xml::element('span', array('class' => 'error'), wfMsg('badsiglength', $wgLang->formatNum($wgMaxSigChars))));
} elseif (!empty($this->mToggles['fancysig']) && false === $wgParser->validateSig($this->mNick)) {
$invalidSig = $this->tableRow(' ', Xml::element('span', array('class' => 'error'), wfMsg('badsig')));
} else {
$invalidSig = '';
}
$wgOut->addHTML($this->tableRow(Xml::label(wfMsg('yournick'), 'wpNick'), Xml::input('wpNick', 25, $this->mNick, array('id' => 'wpNick', 'maxlength' => $wgMaxSigChars))) . $invalidSig . $this->tableRow(' ', $this->getToggle('fancysig')));
list($lsLabel, $lsSelect) = Xml::languageSelector($this->mUserLanguage);
$wgOut->addHTML($this->tableRow($lsLabel, $lsSelect));
/* see if there are multiple language variants to choose from*/
if (!$wgDisableLangConversion) {
$variants = $wgContLang->getVariants();
$variantArray = array();
//.........这里部分代码省略.........
示例7: mainPrefsForm
//.........这里部分代码省略.........
$disableEmailPrefs = false;
}
if ($this->mUserEmail == '') {
$emailauthenticated = wfMsg('noemailprefs') . '<br />';
}
$enotifwatchlistpages = $wgEnotifWatchlist ? $this->getToggle('enotifwatchlistpages', false, $disableEmailPrefs) : '';
$enotifusertalkpages = $wgEnotifUserTalk ? $this->getToggle('enotifusertalkpages', false, $disableEmailPrefs) : '';
$enotifminoredits = $wgEnotifWatchlist && $wgEnotifMinorEdits ? $this->getToggle('enotifminoredits', false, $disableEmailPrefs) : '';
$enotifrevealaddr = ($wgEnotifWatchlist || $wgEnotifUserTalk) && $wgEnotifRevealEditorAddress ? $this->getToggle('enotifrevealaddr', false, $disableEmailPrefs) : '';
# </FIXME>
$wgOut->addHTML("<form action=\"{$action}\" method='post'>");
$wgOut->addHTML("<div id='preferences'>");
# User data
$wgOut->addHTML(Xml::openElement('fieldset ', array('id' => 'prefsection-0', 'class' => 'prefsection')) . "<legend class='mainLegend'> </legend>" . Xml::openElement('table') . $this->tableRow(Xml::element('legend', null, wfMsg('prefs-personal'))));
$userInformationHtml = $this->tableRow(wfMsgHtml('username'), htmlspecialchars($wgUser->getName())) . $this->tableRow(wfMsgHtml('uid'), htmlspecialchars($wgUser->getID())) . $this->tableRow(wfMsgHtml('prefs-edits'), $wgLang->formatNum(User::edits($wgUser->getId())));
if (wfRunHooks('PreferencesUserInformationPanel', array($this, &$userInformationHtml))) {
$wgOut->addHtml($userInformationHtml);
}
if ($wgAllowRealName) {
$wgOut->addHTML($this->tableRow(Xml::label(wfMsg('yourrealname'), 'wpRealName'), Xml::input('wpRealName', 25, $this->mRealName, array('class' => 'input_med', 'id' => 'wpRealName')), Xml::tags('div', array('class' => 'prefsectiontip'), wfMsgExt('prefs-help-realname', 'parseinline'))));
}
if ($wgEnableEmail) {
$wgOut->addHTML($this->tableRow(Xml::label(wfMsg('youremail'), 'wpUserEmail'), Xml::input('wpUserEmail', 25, $this->mUserEmail, array('class' => 'input_med', 'id' => 'wpUserEmail'))));
}
global $wgParser, $wgMaxSigChars;
if (mb_strlen($this->mNick) > $wgMaxSigChars) {
$invalidSig = $this->tableRow(' ', Xml::element('span', array('class' => 'error'), wfMsg('badsiglength', $wgLang->formatNum($wgMaxSigChars))));
} elseif (!empty($this->mToggles['fancysig']) && false === $wgParser->validateSig($this->mNick)) {
$invalidSig = $this->tableRow(' ', Xml::element('span', array('class' => 'error'), wfMsg('badsig')));
} else {
$invalidSig = '';
}
$wgOut->addHTML($this->tableRow(Xml::label(wfMsg('yournick'), 'wpNick'), Xml::input('wpNick', 25, $this->mNick, array('id' => 'wpNick', 'class' => 'input_med', 'maxlength' => $wgMaxSigChars))) . $invalidSig . $this->tableRow(' ', $this->getToggle('fancysig')));
list($lsLabel, $lsSelect) = Xml::languageSelector($this->mUserLanguage);
$wgOut->addHTML($this->tableRow($lsLabel, $lsSelect));
/* see if there are multiple language variants to choose from*/
if (!$wgDisableLangConversion) {
$variants = $wgContLang->getVariants();
$variantArray = array();
$languages = Language::getLanguageNames(true);
foreach ($variants as $v) {
$v = str_replace('_', '-', strtolower($v));
if (array_key_exists($v, $languages)) {
// If it doesn't have a name, we'll pretend it doesn't exist
$variantArray[$v] = $languages[$v];
}
}
$options = "\n";
foreach ($variantArray as $code => $name) {
$selected = $code == $this->mUserVariant;
$options .= Xml::option("{$code} - {$name}", $code, $selected) . "\n";
}
if (count($variantArray) > 1) {
$wgOut->addHtml($this->tableRow(Xml::label(wfMsg('yourvariant'), 'wpUserVariant'), Xml::tags('select', array('name' => 'wpUserVariant', 'id' => 'wpUserVariant'), $options)));
}
}
// TEEN FILTER
$options = Xml::radioLabel(wfMsg('pref_content_preferences_all'), 'wpContentFilter', 0, 'wpContentFilter_0', $this->mContentFilter == 0, array('class' => 'normal_font')) . "<br/><br/>" . Xml::radioLabel(wfMsg('pref_content_preferences_young'), 'wpContentFilter', 1, 'wpContentFilter_1', $this->mContentFilter == 1, array('class' => 'normal_font')) . "<br/><br/>" . Xml::radioLabel(wfMsg('pref_content_preferences_adult'), 'wpContentFilter', 2, 'wpContentFilter_2', $this->mContentFilter == 2, array('class' => 'normal_font')) . "<br/><br/>";
$wgOut->addHtml($this->tableRow(wfMsg('pref_content_preferences_info'), $options));
# Password
if ($wgAuth->allowPasswordChange()) {
$wgOut->addHTML($this->tableRow(Xml::element('legend', null, wfMsg('changepassword'))) . $this->tableRow(Xml::label(wfMsg('oldpassword'), 'wpOldpass'), Xml::password('wpOldpass', 25, $this->mOldpass, array('id' => 'wpOldpass', 'class' => 'input_med'))) . $this->tableRow(Xml::label(wfMsg('newpassword'), 'wpNewpass'), Xml::password('wpNewpass', 25, $this->mNewpass, array('id' => 'wpNewpass', 'class' => 'input_med'))) . $this->tableRow(Xml::label(wfMsg('retypenew'), 'wpRetypePass'), Xml::password('wpRetypePass', 25, $this->mRetypePass, array('id' => 'wpRetypePass', 'class' => 'input_med'))) . Xml::tags('tr', null, Xml::tags('td', array('colspan' => '2'), $this->getToggle("rememberpassword"))) . Xml::tags('tr', null, Xml::tags('td', array('colspan' => '2'), "")));
}
# <FIXME>
# Enotif
if ($wgEnableEmail) {
示例8: showView
//.........这里部分代码省略.........
if (Title::newFromText("Centralnotice-{$currentTemplate}-{$field}", NS_MEDIAWIKI)->exists()) {
$englishText = wfMsgExt("Centralnotice-{$currentTemplate}-{$field}", array('language' => 'en'));
$englishTextExists = true;
}
$htmlOut .= Xml::tags('td', null, Html::element('span', array('style' => 'font-style:italic;' . (!$englishTextExists ? 'color:silver' : '')), $englishText));
// Foreign text input
$foreignText = '';
$foreignTextExists = false;
if (Title::newFromText($message, NS_MEDIAWIKI)->exists()) {
$foreignText = wfMsgExt("Centralnotice-{$currentTemplate}-{$field}", array('language' => $wpUserLang));
$foreignTextExists = true;
}
$htmlOut .= Xml::tags('td', null, Xml::input("updateText[{$wpUserLang}][{$currentTemplate}-{$field}]", '', $foreignText, wfArrayMerge($readonly, array('style' => 'width:100%;' . (!$foreignTextExists ? 'color:red' : '')))));
$htmlOut .= Html::closeElement('tr');
}
$htmlOut .= Html::closeElement('table');
if ($this->editable) {
$htmlOut .= Html::hidden('wpUserLanguage', $wpUserLang);
$htmlOut .= Html::hidden('authtoken', $wgUser->editToken());
$htmlOut .= Xml::tags('div', array('class' => 'cn-buttons'), Xml::submitButton(wfMsg('centralnotice-modify'), array('name' => 'update')));
}
$htmlOut .= Html::closeElement('fieldset');
if ($this->editable) {
$htmlOut .= Html::closeElement('form');
}
// Show language selection form
$actionTitle = $this->getTitleFor('NoticeTemplate', 'view');
$actionUrl = $actionTitle->getLocalURL();
$htmlOut .= Html::openElement('form', array('method' => 'get', 'action' => $actionUrl));
$htmlOut .= Xml::fieldset(wfMsg('centralnotice-change-lang'));
$htmlOut .= Html::hidden('template', $currentTemplate);
$htmlOut .= Html::openElement('table', array('cellpadding' => 9));
// Retrieve the language list
list($lsLabel, $lsSelect) = Xml::languageSelector($wpUserLang, true, $wgLang->getCode());
$newPage = $this->getTitle('view');
$htmlOut .= Xml::tags('tr', null, Xml::tags('td', null, $lsLabel) . Xml::tags('td', null, $lsSelect) . Xml::tags('td', array('colspan' => 2), Xml::submitButton(wfMsg('centralnotice-modify'))));
$htmlOut .= Xml::tags('tr', null, Xml::tags('td', null, '') . Xml::tags('td', null, $sk->makeLinkObj($newPage, wfMsgHtml('centralnotice-preview-all-template-translations'), "template={$currentTemplate}&wpUserLanguage=all")));
$htmlOut .= Html::closeElement('table');
$htmlOut .= Html::closeElement('fieldset');
$htmlOut .= Html::closeElement('form');
}
// Show edit form
if ($this->editable) {
$htmlOut .= Html::openElement('form', array('method' => 'post', 'onsubmit' => 'return validateBannerForm(this)'));
$htmlOut .= Html::hidden('wpMethod', 'editTemplate');
}
// If there was an error, we'll need to restore the state of the form
if ($wgRequest->wasPosted() && $wgRequest->getVal('mainform')) {
$displayAnon = $wgRequest->getCheck('displayAnon');
$displayAccount = $wgRequest->getCheck('displayAccount');
$fundraising = $wgRequest->getCheck('fundraising');
$autolink = $wgRequest->getCheck('autolink');
$landingPages = $wgRequest->getVal('landingPages');
$body = $wgRequest->getVal('templateBody', $body);
} else {
// Use previously stored values
$displayAnon = $bannerSettings['anon'] == 1;
$displayAccount = $bannerSettings['account'] == 1;
$fundraising = $bannerSettings['fundraising'] == 1;
$autolink = $bannerSettings['autolink'] == 1;
$landingPages = $bannerSettings['landingpages'];
// $body default is defined prior to message interface code
}
// Show banner settings
$htmlOut .= Xml::fieldset(wfMsg('centralnotice-settings'));
$htmlOut .= Html::openElement('p', null);
示例9: priorityLanguagesForm
/**
* @param TranslatablePage $page
*/
protected function priorityLanguagesForm(TranslatablePage $page)
{
global $wgContLang;
$groupId = $page->getMessageGroupId();
$this->getOutput()->wrapWikiMsg('==$1==', 'tpt-sections-prioritylangs');
$langSelector = Xml::languageSelector($wgContLang->getCode(), false, $this->getLanguage()->getCode());
$hLangs = Xml::inputLabelSep($this->msg('tpt-select-prioritylangs')->text(), 'prioritylangs', 'tpt-prioritylangs', 50, TranslateMetadata::get($groupId, 'prioritylangs'));
$hForce = Xml::checkLabel($this->msg('tpt-select-prioritylangs-force')->text(), 'forcelimit', 'tpt-priority-forcelimit', TranslateMetadata::get($groupId, 'priorityforce') === 'on');
$hReason = Xml::inputLabelSep($this->msg('tpt-select-prioritylangs-reason')->text(), 'priorityreason', 'tpt-priority-reason', 50, TranslateMetadata::get($groupId, 'priorityreason'));
$this->getOutput()->addHTML("<table>" . "<tr>" . "<td class='mw-label'>{$hLangs['0']}</td>" . "<td class='mw-input'>{$hLangs['1']}{$langSelector['1']}</td>" . "</tr>" . "<tr><td></td><td class='mw-inout'>{$hForce}</td></tr>" . "<tr>" . "<td class='mw-label'>{$hReason['0']}</td>" . "<td class='mw-input'>{$hReason['1']}</td>" . "</tr>" . "</table>");
}