本文整理汇总了PHP中Xml::radioLabel方法的典型用法代码示例。如果您正苦于以下问题:PHP Xml::radioLabel方法的具体用法?PHP Xml::radioLabel怎么用?PHP Xml::radioLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xml
的用法示例。
在下文中一共展示了Xml::radioLabel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showList
function showList($conds = array('af_deleted' => 0), $optarray = array())
{
global $wgAbuseFilterCentralDB, $wgAbuseFilterIsCentral;
$output = '';
$output .= Xml::element('h2', null, $this->msg('abusefilter-list')->parse());
$pager = new AbuseFilterPager($this, $conds);
$deleted = $optarray['deleted'];
$hidedisabled = $optarray['hidedisabled'];
$scope = $optarray['scope'];
# Options form
$fields = array();
$fields['abusefilter-list-options-deleted'] = Xml::radioLabel($this->msg('abusefilter-list-options-deleted-show')->text(), 'deletedfilters', 'show', 'mw-abusefilter-deletedfilters-show', $deleted == 'show') . Xml::radioLabel($this->msg('abusefilter-list-options-deleted-hide')->text(), 'deletedfilters', 'hide', 'mw-abusefilter-deletedfilters-hide', $deleted == 'hide') . Xml::radioLabel($this->msg('abusefilter-list-options-deleted-only')->text(), 'deletedfilters', 'only', 'mw-abusefilter-deletedfilters-only', $deleted == 'only');
if (isset($wgAbuseFilterCentralDB) && !$wgAbuseFilterIsCentral) {
$fields['abusefilter-list-options-scope'] = Xml::radioLabel($this->msg('abusefilter-list-options-scope-local')->text(), 'rulescope', 'local', 'mw-abusefilter-rulescope-local', $scope == 'local') . Xml::radioLabel($this->msg('abusefilter-list-options-scope-global')->text(), 'rulescope', 'global', 'mw-abusefilter-rulescope-global', $scope == 'global');
}
$fields['abusefilter-list-options-disabled'] = Xml::checkLabel($this->msg('abusefilter-list-options-hidedisabled')->text(), 'hidedisabled', 'mw-abusefilter-disabledfilters-hide', $hidedisabled);
$fields['abusefilter-list-limit'] = $pager->getLimitSelect();
$options = Xml::buildForm($fields, 'abusefilter-list-options-submit');
$options .= Html::hidden('title', $this->getTitle()->getPrefixedText());
$options = Xml::tags('form', array('method' => 'get', 'action' => $this->getTitle()->getFullURL()), $options);
$options = Xml::fieldset($this->msg('abusefilter-list-options')->text(), $options);
$output .= $options;
if (isset($wgAbuseFilterCentralDB) && !$wgAbuseFilterIsCentral && $scope == 'global') {
$globalPager = new GlobalAbuseFilterPager($this, $conds);
$output .= $globalPager->getNavigationBar() . $globalPager->getBody() . $globalPager->getNavigationBar();
} else {
$output .= $pager->getNavigationBar() . $pager->getBody() . $pager->getNavigationBar();
}
$this->getOutput()->addHTML($output);
}
示例2: getInputHTML
function getInputHTML($value)
{
$attribs = [];
if (!empty($this->mParams['disabled'])) {
$attribs['disabled'] = 'disabled';
}
$html = Xml::radioLabel($this->msg('minimum-size')->text(), $this->mName . '-mode', 'min', $this->mID . '-mode-min', $value >= 0, $attribs);
$html .= ' ' . Xml::radioLabel($this->msg('maximum-size')->text(), $this->mName . '-mode', 'max', $this->mID . '-mode-max', $value < 0, $attribs);
$html .= ' ' . parent::getInputHTML($value ? abs($value) : '');
$html .= ' ' . $this->msg('pagesize')->parse();
return $html;
}
示例3: buildForm
function buildForm()
{
global $wgScript;
$languages = Language::getLanguageNames(false);
ksort($languages);
$out = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript, 'id' => 'mw-allmessages-form')) . Xml::fieldset(wfMsg('allmessages-filter-legend')) . Xml::hidden('title', $this->getTitle()) . Xml::openElement('table', array('class' => 'mw-allmessages-table')) . "\n" . '<tr>
<td class="mw-label">' . Xml::label(wfMsg('allmessages-prefix'), 'mw-allmessages-form-prefix') . "</td>\n\n\t\t\t\t<td class=\"mw-input\">" . Xml::input('prefix', 20, str_replace('_', ' ', $this->prefix), array('id' => 'mw-allmessages-form-prefix')) . "</td>\n\n\t\t\t</tr>\n\t\t\t<tr>\n\n\t\t\t\t<td class='mw-label'>" . wfMsg('allmessages-filter') . "</td>\n\n\t\t\t\t<td class='mw-input'>" . Xml::radioLabel(wfMsg('allmessages-filter-unmodified'), 'filter', 'unmodified', 'mw-allmessages-form-filter-unmodified', $this->filter == 'unmodified' ? true : false) . Xml::radioLabel(wfMsg('allmessages-filter-all'), 'filter', 'all', 'mw-allmessages-form-filter-all', $this->filter == 'all' ? true : false) . Xml::radioLabel(wfMsg('allmessages-filter-modified'), 'filter', 'modified', 'mw-allmessages-form-filter-modified', $this->filter == 'modified' ? true : false) . "</td>\n\n\t\t\t</tr>\n\t\t\t<tr>\n\n\t\t\t\t<td class=\"mw-label\">" . Xml::label(wfMsg('allmessages-language'), 'mw-allmessages-form-lang') . "</td>\n\n\t\t\t\t<td class=\"mw-input\">" . Xml::openElement('select', array('id' => 'mw-allmessages-form-lang', 'name' => 'lang'));
foreach ($languages as $lang => $name) {
$selected = $lang == $this->langCode ? true : false;
$out .= Xml::option($lang . ' - ' . $name, $lang, $selected) . "\n";
}
$out .= Xml::closeElement('select') . "</td>\n\n\t\t\t</tr>\n\t\t\t<tr>\n\n\t\t\t\t<td></td>\n\t\t\t\t<td>" . Xml::submitButton(wfMsg('allmessages-filter-submit')) . "</td>\n\n\t\t\t</tr>" . Xml::closeElement('table') . $this->table->getHiddenFields(array('title', 'prefix', 'filter', 'lang')) . Xml::closeElement('fieldset') . Xml::closeElement('form');
return $out;
}
示例4: 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;
}
示例5: execute
/**
* @return string|null When string, "skip" or "continue"
*/
public function execute()
{
if ($this->getVar('_ExistingDBSettings')) {
return 'skip';
}
$r = $this->parent->request;
if ($r->wasPosted()) {
$status = $this->submit();
if ($status->isGood()) {
$this->setVar('_UpgradeDone', false);
return 'continue';
} else {
$this->parent->showStatusBox($status);
}
}
$this->startForm();
$types = "<ul class=\"config-settings-block\">\n";
$settings = '';
$defaultType = $this->getVar('wgDBtype');
// Messages: config-dbsupport-mysql, config-dbsupport-postgres, config-dbsupport-oracle,
// config-dbsupport-sqlite, config-dbsupport-mssql
$dbSupport = '';
foreach (Installer::getDBTypes() as $type) {
$dbSupport .= wfMessage("config-dbsupport-{$type}")->plain() . "\n";
}
$this->addHTML($this->parent->getInfoBox(wfMessage('config-support-info', trim($dbSupport))->text()));
// It's possible that the library for the default DB type is not compiled in.
// In that case, instead select the first supported DB type in the list.
$compiledDBs = $this->parent->getCompiledDBs();
if (!in_array($defaultType, $compiledDBs)) {
$defaultType = $compiledDBs[0];
}
foreach ($compiledDBs as $type) {
$installer = $this->parent->getDBInstaller($type);
$types .= '<li>' . Xml::radioLabel($installer->getReadableName(), 'DBType', $type, "DBType_{$type}", $type == $defaultType, array('class' => 'dbRadio', 'rel' => "DB_wrapper_{$type}")) . "</li>\n";
// Messages: config-header-mysql, config-header-postgres, config-header-oracle,
// config-header-sqlite
$settings .= Html::openElement('div', array('id' => 'DB_wrapper_' . $type, 'class' => 'dbWrapper')) . Html::element('h3', array(), wfMessage('config-header-' . $type)->text()) . $installer->getConnectForm() . "</div>\n";
}
$types .= "</ul><br style=\"clear: left\"/>\n";
$this->addHTML($this->parent->label('config-db-type', false, $types) . $settings);
$this->endForm();
return null;
}
示例6: process
/**
* Process the 'delvote' action.
* @param Article $article The article to endorse/object to deletion of.
*/
public function process($article)
{
global $wgRequest, $wgOut, $wgUser;
$errs = $article->mTitle->getUserPermissionsErrors('deletequeue-vote', $wgUser);
if (count($errs) > 0) {
$wgOut->showPermissionsErrorPage($errs);
return;
}
$dqi = DeleteQueueItem::newFromArticle($article);
$wgOut->setPageTitle(wfMsg('deletequeue-vote-title', $article->mTitle->getPrefixedText()));
// Load form data
$token = $wgRequest->getVal('wpEditToken');
$action = $wgRequest->getVal('wpVote');
$comments = $wgRequest->getText('wpComments');
if ($wgUser->matchEditToken($token) && in_array($action, array('endorse', 'object'))) {
$dqi->addVote($action, $comments);
if ($action == 'object' && $dqi->getQueue() == 'prod') {
$dbw = wfGetDB(DB_MASTER);
$dbw->begin();
$dqi->setQueue('deletediscuss', $dqi->getReason());
$lp = new LogPage('delete');
$lp->addEntry('requeue', $article->mTitle, $comments, array(wfMsgForContent('deletequeue-queue-prod'), wfMsgForContent("deletequeue-queue-deletediscuss")));
$dbw->commit();
$wgOut->addWikiMsg('deletequeue-vote-requeued', wfMsgNoTrans('deletequeue-queue-deletediscuss'));
} else {
$wgOut->addWikiMsg("deletequeue-vote-success-{$action}");
}
return;
}
$wgOut->addWikiMsg('deletequeue-vote-text', $article->mTitle->getPrefixedText(), $dqi->getReason());
// Add main form.
$fields = array();
$options = Xml::tags('p', null, Xml::radioLabel(wfMsg('deletequeue-vote-endorse'), 'wpVote', 'endorse', 'mw-deletequeue-vote-endorse'));
$options .= Xml::tags('p', null, Xml::radioLabel(wfMsg('deletequeue-vote-object'), 'wpVote', 'object', 'mw-deletequeue-vote-object'));
$fields['deletequeue-vote-action'] = $options;
$fields['deletequeue-vote-reason'] = Xml::input('wpComments', 45, $comments);
$article_id = $article->getId();
$title = $this->getTitle("vote/{$article_id}");
$form = Xml::buildForm($fields, 'deletequeue-vote-submit') . Html::Hidden('wpEditToken', $wgUser->editToken()) . Html::Hidden('title', $title->getPrefixedText());
$form = Xml::tags('form', array('action' => $title->getLocalURL(), 'method' => 'POST'), $form);
$form = Xml::fieldset(wfMsg('deletequeue-vote-legend'), $form);
$wgOut->addHTML($form);
}
示例7: showList
function showList($conds = array('af_deleted' => 0), $optarray = array())
{
$output = '';
$output .= Xml::element('h2', null, wfMsgExt('abusefilter-list', array('parseinline')));
$pager = new AbuseFilterPager($this, $conds);
$deleted = $optarray['deleted'];
$hidedisabled = $optarray['hidedisabled'];
# Options form
$fields = array();
$fields['abusefilter-list-options-deleted'] = Xml::radioLabel(wfMsg('abusefilter-list-options-deleted-show'), 'deletedfilters', 'show', 'mw-abusefilter-deletedfilters-show', $deleted == 'show') . Xml::radioLabel(wfMsg('abusefilter-list-options-deleted-hide'), 'deletedfilters', 'hide', 'mw-abusefilter-deletedfilters-hide', $deleted == 'hide') . Xml::radioLabel(wfMsg('abusefilter-list-options-deleted-only'), 'deletedfilters', 'only', 'mw-abusefilter-deletedfilters-only', $deleted == 'only');
$fields['abusefilter-list-options-disabled'] = Xml::checkLabel(wfMsg('abusefilter-list-options-hidedisabled'), 'hidedisabled', 'mw-abusefilter-disabledfilters-hide', $hidedisabled);
$fields['abusefilter-list-limit'] = $pager->getLimitSelect();
$options = Xml::buildForm($fields, 'abusefilter-list-options-submit');
$options .= Html::hidden('title', $this->getTitle()->getPrefixedText());
$options = Xml::tags('form', array('method' => 'get', 'action' => $this->getTitle()->getFullURL()), $options);
$options = Xml::fieldset(wfMsg('abusefilter-list-options'), $options);
$output .= $options;
$output .= $pager->getNavigationBar() . $pager->getBody() . $pager->getNavigationBar();
$this->getOutput()->addHTML($output);
}
示例8: showSurvey
private function showSurvey($survey, $submitMsg, $opt, $loadFromDB = false)
{
global $wgUser, $wgOut, $wgOptInStyleVersion;
UsabilityInitiativeHooks::initialize();
UsabilityInitiativeHooks::addScript('OptIn/OptIn.js', $wgOptInStyleVersion);
UsabilityInitiativeHooks::addStyle('OptIn/OptIn.css', $wgOptInStyleVersion);
$loaded = array();
if ($loadFromDB) {
$dbr = wfGetDb(DB_SLAVE);
$res = $dbr->select('optin_survey', array('ois_question', 'ois_answer', 'ois_answer_data'), array('ois_user' => $wgUser->getID(), 'ois_type' => $opt), __METHOD__);
foreach ($res as $row) {
$loaded[$row->ois_question] = array($row->ois_answer, $row->ois_answer_data);
}
}
$query = array('from' => $this->mOrigin, 'fromquery' => $this->mOriginQuery);
$retval = Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLinkURL($query), 'id' => 'optin-survey'));
$retval .= Xml::hidden('opt', $opt);
$retval .= Xml::hidden('token', $wgUser->editToken());
$retval .= Xml::openElement('dl');
foreach ($survey as $id => $question) {
$answer = isset($loaded[$id]) ? $loaded[$id][0] : null;
$answerdata = isset($loaded[$id]) ? $loaded[$id][1] : null;
switch ($question['type']) {
case 'dropdown':
$retval .= Xml::tags('dt', null, wfMsgWikiHtml($question['question']));
$retval .= Xml::openElement('dd');
$attrs = array('id' => "survey-{$id}", 'name' => "survey-{$id}");
if (isset($question['other'])) {
$attrs['class'] = 'optin-need-other';
}
$retval .= Xml::openElement('select', $attrs);
foreach ($question['answers'] as $aid => $answer) {
$retval .= Xml::option(wfMsg($answer), $aid, $answer === $aid);
}
if (isset($question['other'])) {
$retval .= Xml::option(wfMsg($question['other']), 'other', $answer === 'other');
}
$retval .= Xml::closeElement('select');
if (isset($question['other'])) {
$retval .= Xml::tags('div', array(), Xml::input("survey-{$id}-other", false, $answer === 'other' ? $answerdata : false, array('class' => 'optin-other-select', 'id' => "survey-{$id}-other")));
}
$retval .= Xml::closeElement('dd');
break;
case 'radios':
$retval .= Xml::tags('dt', null, wfMsgWikiHtml($question['question']));
$retval .= Xml::openElement('dd');
$radios = array();
foreach ($question['answers'] as $aid => $answer) {
$radios[] = Xml::radioLabel(wfMsg($answer), "survey-{$id}", $aid, "survey-{$id}-{$aid}", $answer === $aid);
}
if (isset($question['other'])) {
$radios[] = Xml::radioLabel(wfMsg($question['other']), "survey-{$id}", 'other', "survey-{$id}-other-radio", $answer === 'other') . ' ' . Xml::input("survey-{$id}-other", false, $answer === 'other' ? $answerdata : false, array('class' => 'optin-other-radios'));
}
$retval .= implode(Xml::element('br'), $radios);
$retval .= Xml::closeElement('dd');
break;
case 'checkboxes':
$answers = explode(',', $answer);
$retval .= Xml::tags('dt', null, wfMsgWikiHtml($question['question']));
$retval .= Xml::openElement('dd');
$checkboxes = array();
foreach ($question['answers'] as $aid => $answer) {
$checkboxes[] = Xml::checkLabel(wfMsg($answer), "survey-{$id}[]", "survey-{$id}-{$aid}", in_array($aid, $answers, true), array('value' => $aid));
}
if (isset($question['other'])) {
$checkboxes[] = Xml::checkLabel(wfMsg($question['other']), "survey-{$id}[]", "survey-{$id}-other-check", in_array('other', $answers, true), array('value' => 'other')) . ' ' . Xml::input("survey-{$id}-other", false, in_array('other', $answers, true) ? $answerdata : false, array('class' => 'optin-other-checks'));
}
$retval .= implode(Xml::element('br'), $checkboxes);
$retval .= Xml::closeElement('dd');
break;
case 'yesno':
$retval .= Xml::tags('dt', null, wfMsgWikiHtml($question['question']));
$retval .= Xml::openElement('dd');
$retval .= Xml::radioLabel(wfMsg('optin-survey-yes'), "survey-{$id}", 'yes', "survey-{$id}-yes", $answer === 'yes', array('class' => 'survey-yes'));
$retval .= Xml::element('br');
$retval .= Xml::radioLabel(wfMsg('optin-survey-no'), "survey-{$id}", 'no', "survey-{$id}-no", $answer === 'no', array('class' => 'survey-no'));
$retval .= Xml::closeElement('dd');
if (isset($question['ifyes'])) {
$retval .= Xml::openElement('blockquote', array('id' => "survey-{$id}-ifyes-row", 'class' => 'survey-ifyes'));
$retval .= Xml::tags('dt', null, wfMsgWikiHtml($question['ifyes']));
$retval .= Xml::tags('dd', null, Xml::textarea("survey-{$id}-ifyes", $answerdata ? $answerdata : ''));
$retval .= Xml::closeElement('blockquote');
}
if (isset($question['ifno'])) {
$retval .= Xml::openElement('blockquote', array('id' => "survey-{$id}-ifno-row", 'class' => 'survey-ifno'));
$retval .= Xml::tags('dt', null, wfMsgWikiHtml($question['ifno']));
$retval .= Xml::tags('dd', null, Xml::textarea("survey-{$id}-ifno", $answerdata ? $answerdata : ''));
$retval .= Xml::closeElement('blockquote');
}
break;
case 'resolution':
if ($answerdata) {
list($x, $y) = explode('x', $answerdata);
} else {
$x = $y = false;
}
$retval .= Xml::tags('dt', null, wfMsgWikiHtml($question['question']));
$retval .= Xml::openElement('dd');
$retval .= Xml::input("survey-{$id}-x", 5, $x, array('class' => 'optin-resolution-x', 'id' => "survey-{$id}-x"));
$retval .= ' x ';
//.........这里部分代码省略.........
示例9: getMappingFormPart
private function getMappingFormPart($sourceName)
{
$isSameSourceAsBefore = $this->sourceName === $sourceName;
$defaultNamespace = $this->getConfig()->get('ImportTargetNamespace');
return "<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::radioLabel($this->msg('import-mapping-default')->text(), 'mapping', 'default', "mw-import-mapping-{$sourceName}-default", $isSameSourceAsBefore ? $this->mapping === 'default' : is_null($defaultNamespace)) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::radioLabel($this->msg('import-mapping-namespace')->text(), 'mapping', 'namespace', "mw-import-mapping-{$sourceName}-namespace", $isSameSourceAsBefore ? $this->mapping === 'namespace' : !is_null($defaultNamespace)) . ' ' . Html::namespaceSelector(['selected' => $isSameSourceAsBefore ? $this->namespace : $defaultNamespace || ''], ['name' => "namespace", 'id' => "mw-import-namespace-{$sourceName}", 'class' => 'namespaceselector']) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::radioLabel($this->msg('import-mapping-subpage')->text(), 'mapping', 'subpage', "mw-import-mapping-{$sourceName}-subpage", $isSameSourceAsBefore ? $this->mapping === 'subpage' : '') . ' ' . Xml::input('rootpage', 50, $isSameSourceAsBefore ? $this->rootpage : '', ['id' => "mw-interwiki-rootpage-{$sourceName}", 'type' => 'text']) . ' ' . "</td>\n\t\t\t\t</tr>";
}
示例10: execute
//.........这里部分代码省略.........
} else {
// Check processing time
if ( !isset( $this->time ) ) {
$this->time = wfTimestamp();
}
$message = self::doAction(
$action,
$group,
$key,
$code,
$value
);
$key = array_shift( $message );
$params = $message;
$message = wfMsgExt( $key, 'parseinline', $params );
$changed[] = "<li>$message</li>";
if ( $this->checkProcessTime() ) {
$process = false;
$duration = $wgLang->formatNum( $this->processingTime );
$message = wfMsgExt( 'translate-manage-toolong', 'parseinline', $duration );
$changed[] = "<li>$message</li></ul>";
}
continue;
}
}
$alldone = false;
$actions = $this->getActions();
$defaction = $this->getDefaultAction( $fuzzy, $action );
$act = array();
foreach ( $actions as $action ) {
$label = wfMsg( "translate-manage-action-$action" );
$name = self::escapeNameForPHP( "action-$type-$key" );
$id = Sanitizer::escapeId( "action-$key-$action" );
$act[] = Xml::radioLabel( $label, $name, $action, $id, $action === $defaction );
}
$name = wfMsg( 'translate-manage-import-diff',
'<code style="font-weight:normal;">' . htmlspecialchars( $key ) . '</code>',
implode( ' ', $act )
);
$changed[] = self::makeSectionElement( $name, $type, $text );
}
}
if ( !$process ) {
$collection->filter( 'hastranslation', false );
$keys = $collection->getMessageKeys();
$diff = array_diff( $keys, array_keys( $messages ) );
foreach ( $diff as $s ) {
// @todo FIXME: Use CSS file.
$name = wfMsgHtml( 'translate-manage-import-deleted',
'<code style="font-weight:normal;">' . htmlspecialchars( $s ) . '</code>'
);
$text = TranslateUtils::convertWhiteSpaceToHTML( $collection[$s]->translation() );
$changed[] = self::makeSectionElement( $name, 'deleted', $text );
}
}
if ( $process || ( !count( $changed ) && $code !== 'en' ) ) {
if ( !count( $changed ) ) {
$this->out->addWikiMsg( 'translate-manage-nochanges-other' );
}
if ( !count( $changed ) || strpos( $changed[count( $changed ) - 1], '<li>' ) !== 0 ) {
$changed[] = '<ul>';
}
$message = wfMsgExt( 'translate-manage-import-done', 'parseinline' );
$changed[] = "<li>$message</li></ul>";
$this->out->addHTML( implode( "\n", $changed ) );
} else {
// END
if ( count( $changed ) ) {
if ( $code === 'en' ) {
$this->out->addWikiMsg( 'translate-manage-intro-en' );
} else {
$lang = TranslateUtils::getLanguageName( $code, false, $wgLang->getCode() );
$this->out->addWikiMsg( 'translate-manage-intro-other', $lang );
}
$this->out->addHTML( Html::hidden( 'language', $code ) );
$this->out->addHTML( implode( "\n", $changed ) );
$this->out->addHTML( Xml::submitButton( wfMsg( 'translate-manage-submit' ) ) );
} else {
$this->out->addWikiMsg( 'translate-manage-nochanges' );
}
}
$this->out->addHTML( $this->doFooter() );
return $alldone;
}
示例11: contributionsForm
/**
* Generates the namespace selector form with hidden attributes.
* @param $options Array: the options to be included.
*/
function contributionsForm($options)
{
global $wgScript, $wgTitle, $wgRequest;
$options['title'] = $wgTitle->getPrefixedText();
if (!isset($options['target'])) {
$options['target'] = '';
} else {
//XXCHANGED
$options['target'] = str_replace('-', ' ', $options['target']);
}
if (!isset($options['namespace'])) {
$options['namespace'] = '';
}
if (!isset($options['contribs'])) {
$options['contribs'] = 'user';
}
if (!isset($options['year'])) {
$options['year'] = '';
}
if (!isset($options['month'])) {
$options['month'] = '';
}
if ($options['contribs'] == 'newbie') {
$options['target'] = '';
}
$f = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript));
foreach ($options as $name => $value) {
if (in_array($name, array('namespace', 'target', 'contribs', 'year', 'month'))) {
continue;
}
$f .= "\t" . Xml::hidden($name, $value) . "\n";
}
$f .= '<fieldset>' . Xml::element('legend', array(), wfMsg('sp-contributions-search')) . Xml::radioLabel(wfMsgExt('sp-contributions-newbies', array('parseinline')), 'contribs', 'newbie', 'newbie', $options['contribs'] == 'newbie' ? true : false) . '<br />' . Xml::radioLabel(wfMsgExt('sp-contributions-username', array('parseinline')), 'contribs', 'user', 'user', $options['contribs'] == 'user' ? true : false) . ' ' . Xml::input('target', 20, $options['target']) . ' ' . '<span style="white-space: nowrap">' . Xml::label(wfMsg('namespace'), 'namespace') . ' ' . Xml::namespaceSelector($options['namespace'], '') . '</span>' . Xml::openElement('p') . '<span style="white-space: nowrap">' . Xml::label(wfMsg('year'), 'year') . ' ' . Xml::input('year', 4, $options['year'], array('id' => 'year', 'maxlength' => 4)) . ' </span>' . ' ' . '<span style="white-space: nowrap">' . Xml::label(wfMsg('month'), 'month') . ' ' . Xml::monthSelector($options['month'], -1) . ' ' . ' </span><br />' . Xml::submitButton(wfMsg('sp-contributions-submit'), array("class" => "button primary", "style" => "float:right; margin-top:5px; margin-right:0;")) . Xml::closeElement('p');
$explain = wfMsgExt('sp-contributions-explain', 'parseinline');
if (!wfEmptyMsg('sp-contributions-explain', $explain)) {
$f .= "<p>{$explain}</p>";
}
$f .= '</fieldset>' . Xml::closeElement('form');
return $f;
}
示例12: outputForm
/**
* Constructs and outputs file input form with supported methods.
*/
protected function outputForm()
{
global $wgOut;
$wgOut->addModules('ext.translate.special.importtranslations');
TranslateUtils::addSpecialHelpLink($wgOut, 'Help:Extension:Translate/Off-line_translation');
/**
* Ugly but necessary form building ahead, ohoy
*/
$this->out->addHTML(Xml::openElement('form', array('action' => $this->getTitle()->getLocalUrl(), 'method' => 'post', 'enctype' => 'multipart/form-data', 'id' => 'mw-translate-import')) . Html::hidden('token', $this->user->editToken()) . Html::hidden('title', $this->getTitle()->getPrefixedText()) . Xml::openElement('table') . Xml::openElement('tr') . Xml::openElement('td'));
$class = array('class' => 'mw-translate-import-inputs');
$this->out->addHTML(Xml::radioLabel(wfMsg('translate-import-from-url'), 'upload-type', 'url', 'mw-translate-up-url', $this->request->getText('upload-type') === 'url') . "\n" . Xml::closeElement('td') . Xml::openElement('td') . "\n" . Xml::input('upload-url', 50, $this->request->getText('upload-url'), array('id' => 'mw-translate-up-url-input') + $class) . "\n" . Xml::closeElement('td') . Xml::closeElement('tr') . Xml::openElement('tr') . Xml::openElement('td') . "\n");
$this->out->addHTML(Xml::radioLabel(wfMsg('translate-import-from-wiki'), 'upload-type', 'wiki', 'mw-translate-up-wiki', $this->request->getText('upload-type') === 'wiki') . "\n" . Xml::closeElement('td') . Xml::openElement('td') . "\n" . Xml::input('upload-wiki', 50, $this->request->getText('upload-wiki', 'File:'), array('id' => 'mw-translate-up-wiki-input') + $class) . "\n" . Xml::closeElement('td') . Xml::closeElement('tr') . Xml::openElement('tr') . Xml::openElement('td') . "\n" . Xml::radioLabel(wfMsg('translate-import-from-local'), 'upload-type', 'local', 'mw-translate-up-local', $this->request->getText('upload-type') === 'local') . "\n" . Xml::closeElement('td') . Xml::openElement('td') . "\n" . Xml::input('upload-local', 50, $this->request->getText('upload-local'), array('type' => 'file', 'id' => 'mw-translate-up-local-input') + $class) . "\n" . Xml::closeElement('td') . Xml::closeElement('tr') . Xml::closeElement('table') . Xml::submitButton(wfMsg('translate-import-load')) . Xml::closeElement('form'));
}
示例13: mainPrefsForm
//.........这里部分代码省略.........
$mptitle = Title::newMainPage();
$previewtext = wfMsg('skinpreview');
# Only show members of Skin::getSkinNames() rather than
# $skinNames (skins is all skin names from Language.php)
$validSkinNames = Skin::getSkinNames();
# Sort by UI skin name. First though need to update validSkinNames as sometimes
# the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI).
foreach ($validSkinNames as $skinkey => &$skinname) {
if (isset($skinNames[$skinkey])) {
$skinname = $skinNames[$skinkey];
}
}
asort($validSkinNames);
foreach ($validSkinNames as $skinkey => $sn) {
if (in_array($skinkey, $wgSkipSkins)) {
continue;
}
$checked = $skinkey == $this->mSkin ? ' checked="checked"' : '';
$mplink = htmlspecialchars($mptitle->getLocalURL("useskin={$skinkey}"));
$previewlink = "<a target='_blank' href=\"{$mplink}\">{$previewtext}</a>";
if ($skinkey == $wgDefaultSkin) {
$sn .= ' (' . wfMsg('default') . ')';
}
$wgOut->addHTML("<input type='radio' name='wpSkin' id=\"wpSkin{$skinkey}\" value=\"{$skinkey}\"{$checked} /> <label for=\"wpSkin{$skinkey}\">{$sn}</label> {$previewlink}<br />\n");
}
$wgOut->addHTML("</fieldset>\n\n");
# Math
#
global $wgUseTeX;
if ($wgUseTeX) {
$wgOut->addHTML("<fieldset>\n<legend>" . wfMsg('math') . '</legend>');
foreach ($mathopts as $k => $v) {
$checked = $k == $this->mMath;
$wgOut->addHTML(Xml::openElement('div') . Xml::radioLabel(wfMsg($v), 'wpMath', $k, "mw-sp-math-{$k}", $checked) . Xml::closeElement('div') . "\n");
}
$wgOut->addHTML("</fieldset>\n\n");
}
# Files
#
$wgOut->addHTML("<fieldset>\n" . Xml::element('legend', null, wfMsg('files')) . "\n");
$imageLimitOptions = null;
foreach ($wgImageLimits as $index => $limits) {
$selected = $index == $this->mImageSize;
$imageLimitOptions .= Xml::option("{$limits[0]}×{$limits[1]}" . wfMsg('unit-pixel'), $index, $selected);
}
$imageSizeId = 'wpImageSize';
$wgOut->addHTML("<div>" . Xml::label(wfMsg('imagemaxsize'), $imageSizeId) . " " . Xml::openElement('select', array('name' => $imageSizeId, 'id' => $imageSizeId)) . $imageLimitOptions . Xml::closeElement('select') . "</div>\n");
$imageThumbOptions = null;
foreach ($wgThumbLimits as $index => $size) {
$selected = $index == $this->mThumbSize;
$imageThumbOptions .= Xml::option($size . wfMsg('unit-pixel'), $index, $selected);
}
$thumbSizeId = 'wpThumbSize';
$wgOut->addHTML("<div>" . Xml::label(wfMsg('thumbsize'), $thumbSizeId) . " " . Xml::openElement('select', array('name' => $thumbSizeId, 'id' => $thumbSizeId)) . $imageThumbOptions . Xml::closeElement('select') . "</div>\n");
$wgOut->addHTML("</fieldset>\n\n");
# Date format
#
# Date/Time
#
$wgOut->addHTML("<fieldset>\n<legend>" . wfMsg('datetime') . "</legend>\n");
if ($dateopts) {
$wgOut->addHTML("<fieldset>\n<legend>" . wfMsg('dateformat') . "</legend>\n");
$idCnt = 0;
$epoch = '20010115161234';
# Wikipedia day
foreach ($dateopts as $key) {
示例14: execute
public function execute()
{
if ($this->getVar('_ExistingDBSettings')) {
return 'skip';
}
$r = $this->parent->request;
if ($r->wasPosted()) {
$status = $this->submit();
if ($status->isGood()) {
$this->setVar('_UpgradeDone', false);
return 'continue';
} else {
$this->parent->showStatusBox($status);
}
}
$this->startForm();
$types = "<ul class=\"config-settings-block\">\n";
$settings = '';
$defaultType = $this->getVar('wgDBtype');
$dbSupport = '';
foreach ($this->parent->getDBTypes() as $type) {
$link = DatabaseBase::newFromType($type)->getSoftwareLink();
$dbSupport .= wfMsgNoTrans("config-support-{$type}", $link) . "\n";
}
$this->addHTML($this->parent->getInfoBox(wfMsg('config-support-info', $dbSupport)));
foreach ($this->parent->getVar('_CompiledDBs') as $type) {
$installer = $this->parent->getDBInstaller($type);
$types .= '<li>' . Xml::radioLabel($installer->getReadableName(), 'DBType', $type, "DBType_{$type}", $type == $defaultType, array('class' => 'dbRadio', 'rel' => "DB_wrapper_{$type}")) . "</li>\n";
$settings .= Html::openElement('div', array('id' => 'DB_wrapper_' . $type, 'class' => 'dbWrapper')) . Html::element('h3', array(), wfMsg('config-header-' . $type)) . $installer->getConnectForm() . "</div>\n";
}
$types .= "</ul><br clear=\"left\"/>\n";
$this->addHTML($this->parent->label('config-db-type', false, $types) . $settings);
$this->endForm();
}
示例15: showStatusForm
private function showStatusForm()
{
// Allows locking, hiding, locking and hiding.
$form = '';
$form .= Xml::fieldset($this->msg('centralauth-admin-status')->text());
$form .= Html::hidden('wpMethod', 'set-status');
$form .= Html::hidden('wpEditToken', $this->getUser()->getEditToken());
$form .= Html::hidden('wpUserState', $this->mGlobalUser->getStateHash(false));
$form .= $this->msg('centralauth-admin-status-intro')->parseAsBlock();
// Radio buttons
$radioLocked = Xml::radioLabel($this->msg('centralauth-admin-status-locked-no')->parse(), 'wpStatusLocked', '0', 'mw-centralauth-status-locked-no', !$this->mGlobalUser->isLocked()) . '<br />' . Xml::radioLabel($this->msg('centralauth-admin-status-locked-yes')->parse(), 'wpStatusLocked', '1', 'mw-centralauth-status-locked-yes', $this->mGlobalUser->isLocked());
$radioHidden = Xml::radioLabel($this->msg('centralauth-admin-status-hidden-no')->parse(), 'wpStatusHidden', CentralAuthUser::HIDDEN_NONE, 'mw-centralauth-status-hidden-no', $this->mGlobalUser->getHiddenLevel() == CentralAuthUser::HIDDEN_NONE);
if ($this->mCanOversight) {
$radioHidden .= '<br />' . Xml::radioLabel($this->msg('centralauth-admin-status-hidden-list')->parse(), 'wpStatusHidden', CentralAuthUser::HIDDEN_LISTS, 'mw-centralauth-status-hidden-list', $this->mGlobalUser->getHiddenLevel() == CentralAuthUser::HIDDEN_LISTS) . '<br />' . Xml::radioLabel($this->msg('centralauth-admin-status-hidden-oversight')->parse(), 'wpStatusHidden', CentralAuthUser::HIDDEN_OVERSIGHT, 'mw-centralauth-status-hidden-oversight', $this->mGlobalUser->getHiddenLevel() == CentralAuthUser::HIDDEN_OVERSIGHT);
}
// Reason
$reasonList = Xml::listDropDown('wpReasonList', $this->msg('centralauth-admin-status-reasons')->inContentLanguage()->text(), $this->msg('centralauth-admin-reason-other-select')->inContentLanguage()->text());
$reasonField = Xml::input('wpReason', 45, false);
$form .= Xml::buildForm(array('centralauth-admin-status-locked' => $radioLocked, 'centralauth-admin-status-hidden' => $radioHidden, 'centralauth-admin-reason' => $reasonList, 'centralauth-admin-reason-other' => $reasonField), 'centralauth-admin-status-submit');
$form .= Xml::closeElement('fieldset');
$form = Xml::tags('form', array('method' => 'POST', 'action' => $this->getPageTitle()->getFullURL(array('target' => $this->mUserName))), $form);
$this->getOutput()->addHTML($form);
}