本文整理汇总了PHP中HTMLForm::setWrapperLegendMsg方法的典型用法代码示例。如果您正苦于以下问题:PHP HTMLForm::setWrapperLegendMsg方法的具体用法?PHP HTMLForm::setWrapperLegendMsg怎么用?PHP HTMLForm::setWrapperLegendMsg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLForm
的用法示例。
在下文中一共展示了HTMLForm::setWrapperLegendMsg方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: alterForm
protected function alterForm(HTMLForm $form)
{
$form->setWrapperLegendMsg('filerevert-legend');
$form->setSubmitTextMsg('filerevert-submit');
$form->addHiddenField('oldimage', $this->getRequest()->getText('oldimage'));
$form->setTokenSalt(['revert', $this->getTitle()->getPrefixedDBkey()]);
}
示例2: execute
public function execute($par)
{
$this->checkPermissions();
$this->checkReadOnly();
list($this->target, $this->type) = SpecialBlock::getTargetAndType($par, $this->getRequest());
$this->block = Block::newFromTarget($this->target);
$this->setHeaders();
$this->outputHeader();
$out = $this->getOutput();
$out->setPageTitle($this->msg('unblockip'));
$out->addModules('mediawiki.special');
$form = new HTMLForm($this->getFields(), $this->getContext());
$form->setWrapperLegendMsg('unblockip');
$form->setSubmitCallback(array(__CLASS__, 'processUIUnblock'));
$form->setSubmitTextMsg('ipusubmit');
$form->addPreText($this->msg('unblockiptext')->parseAsBlock());
if ($form->show()) {
switch ($this->type) {
case Block::TYPE_USER:
case Block::TYPE_IP:
$out->addWikiMsg('unblocked', wfEscapeWikiText($this->target));
break;
case Block::TYPE_RANGE:
$out->addWikiMsg('unblocked-range', wfEscapeWikiText($this->target));
break;
case Block::TYPE_ID:
case Block::TYPE_AUTO:
$out->addWikiMsg('unblocked-id', wfEscapeWikiText($this->target));
break;
}
}
}
示例3: execute
/**
* Main execution point
*
* @param string $par title fragment
*/
public function execute($par)
{
$this->setHeaders();
$this->outputHeader();
$out = $this->getOutput();
$lang = $this->getLanguage();
$out->setPageTitle($this->msg('ipblocklist'));
$out->addModuleStyles('mediawiki.special');
$request = $this->getRequest();
$par = $request->getVal('ip', $par);
$this->target = trim($request->getVal('wpTarget', $par));
$this->options = $request->getArray('wpOptions', array());
$action = $request->getText('action');
if ($action == 'unblock' || $action == 'submit' && $request->wasPosted()) {
# B/C @since 1.18: Unblock interface is now at Special:Unblock
$title = SpecialPage::getTitleFor('Unblock', $this->target);
$out->redirect($title->getFullUrl());
return;
}
# Just show the block list
$fields = array('Target' => array('type' => 'text', 'label-message' => 'ipadressorusername', 'tabindex' => '1', 'size' => '45', 'default' => $this->target), 'Options' => array('type' => 'multiselect', 'options' => array($this->msg('blocklist-userblocks')->text() => 'userblocks', $this->msg('blocklist-tempblocks')->text() => 'tempblocks', $this->msg('blocklist-addressblocks')->text() => 'addressblocks', $this->msg('blocklist-rangeblocks')->text() => 'rangeblocks'), 'flatlist' => true), 'Limit' => array('class' => 'HTMLBlockedUsersItemSelect', 'label-message' => 'table_pager_limit_label', 'options' => array($lang->formatNum(20) => 20, $lang->formatNum(50) => 50, $lang->formatNum(100) => 100, $lang->formatNum(250) => 250, $lang->formatNum(500) => 500), 'name' => 'limit', 'default' => 50));
$form = new HTMLForm($fields, $this->getContext());
$form->setMethod('get');
$form->setWrapperLegendMsg('ipblocklist-legend');
$form->setSubmitTextMsg('ipblocklist-submit');
$form->prepareForm();
$form->displayForm('');
$this->showList();
}
示例4: execute
function execute($par)
{
$this->setHeaders();
$this->outputHeader();
$this->getOutput()->addModuleStyles('mediawiki.special.pagesWithProp');
$request = $this->getRequest();
$propname = $request->getVal('propname', $par);
$dbr = wfGetDB(DB_SLAVE);
$res = $dbr->select('page_props', 'pp_propname', '', __METHOD__, array('DISTINCT', 'ORDER BY' => 'pp_propname'));
$propnames = array();
foreach ($res as $row) {
$propnames[$row->pp_propname] = $row->pp_propname;
}
$form = new HTMLForm(array('propname' => array('type' => 'selectorother', 'name' => 'propname', 'options' => $propnames, 'default' => $propname, 'label-message' => 'pageswithprop-prop', 'required' => true)), $this->getContext());
$form->setMethod('get');
$form->setSubmitCallback(array($this, 'onSubmit'));
$form->setWrapperLegendMsg('pageswithprop-legend');
$form->addHeaderText($this->msg('pageswithprop-text')->parseAsBlock());
$form->setSubmitTextMsg('pageswithprop-submit');
$form->prepareForm();
$form->displayForm(false);
if ($propname !== '' && $propname !== null) {
$form->trySubmit();
}
}
示例5: alterForm
protected function alterForm(HTMLForm $form)
{
$form->setId('mw-changeemail-form');
$form->setTableId('mw-changeemail-table');
$form->setWrapperLegendMsg('changeemail-header');
$form->setSubmitTextMsg('changeemail-submit');
$form->addButton('wpCancel', $this->msg('changeemail-cancel')->text());
$form->addHiddenField('returnto', $this->getRequest()->getVal('returnto'));
}
示例6: alterForm
protected function alterForm(HTMLForm $form)
{
$form->setId('mw-resetpass-form');
$form->setTableId('mw-resetpass-table');
$form->setWrapperLegendMsg('resetpass_header');
$form->setSubmitTextMsg($this->getUser()->isLoggedIn() ? 'resetpass-submit-loggedin' : 'resetpass_submit');
$form->addButton('wpCancel', $this->msg('resetpass-submit-cancel')->text());
$form->setHeaderText($this->msg('resetpass_text')->parseAsBlock());
$form->addHiddenFields($this->getRequest()->getValues('wpName', 'wpDomain', 'returnto', 'returntoquery'));
}
示例7: execute
public function execute($par)
{
$this->setHeaders();
$this->outputHeader();
$this->getOutput()->addModuleStyles('mediawiki.special.pagesWithProp');
$request = $this->getRequest();
$propname = $request->getVal('propname', $par);
$propnames = $this->getExistingPropNames();
$form = new HTMLForm(array('propname' => array('type' => 'selectorother', 'name' => 'propname', 'options' => $propnames, 'default' => $propname, 'label-message' => 'pageswithprop-prop', 'required' => true)), $this->getContext());
$form->setMethod('get');
$form->setSubmitCallback(array($this, 'onSubmit'));
$form->setWrapperLegendMsg('pageswithprop-legend');
$form->addHeaderText($this->msg('pageswithprop-text')->parseAsBlock());
$form->setSubmitTextMsg('pageswithprop-submit');
$form->prepareForm();
$form->displayForm(false);
if ($propname !== '' && $propname !== null) {
$form->trySubmit();
}
}
示例8: execute
public function execute($par)
{
$this->checkPermissions();
$this->checkReadOnly();
list($this->target, $this->type) = SpecialBlock::getTargetAndType($par, $this->getRequest());
$this->block = Block::newFromTarget($this->target);
if ($this->target instanceof User) {
# Set the 'relevant user' in the skin, so it displays links like Contributions,
# User logs, UserRights, etc.
$this->getSkin()->setRelevantUser($this->target);
}
$this->setHeaders();
$this->outputHeader();
$out = $this->getOutput();
$out->setPageTitle($this->msg('unblockip'));
$out->addModules(['mediawiki.special', 'mediawiki.userSuggest']);
$form = new HTMLForm($this->getFields(), $this->getContext());
$form->setWrapperLegendMsg('unblockip');
$form->setSubmitCallback([__CLASS__, 'processUIUnblock']);
$form->setSubmitTextMsg('ipusubmit');
$form->addPreText($this->msg('unblockiptext')->parseAsBlock());
if ($form->show()) {
switch ($this->type) {
case Block::TYPE_IP:
$out->addWikiMsg('unblocked-ip', wfEscapeWikiText($this->target));
break;
case Block::TYPE_USER:
$out->addWikiMsg('unblocked', wfEscapeWikiText($this->target));
break;
case Block::TYPE_RANGE:
$out->addWikiMsg('unblocked-range', wfEscapeWikiText($this->target));
break;
case Block::TYPE_ID:
case Block::TYPE_AUTO:
$out->addWikiMsg('unblocked-id', wfEscapeWikiText($this->target));
break;
}
}
}
示例9: processCreateTagForm
public function processCreateTagForm(array $data, HTMLForm $form)
{
$context = $form->getContext();
$out = $context->getOutput();
$tag = trim(strval($data['Tag']));
$ignoreWarnings = isset($data['IgnoreWarnings']) && $data['IgnoreWarnings'] === '1';
$status = ChangeTags::createTagWithChecks($tag, $data['Reason'], $context->getUser(), $ignoreWarnings);
if ($status->isGood()) {
$out->redirect($this->getPageTitle()->getLocalURL());
return true;
} elseif ($status->isOK()) {
// we have some warnings, so we show a confirmation form
$fields = ['Tag' => ['type' => 'hidden', 'default' => $data['Tag']], 'Reason' => ['type' => 'hidden', 'default' => $data['Reason']], 'IgnoreWarnings' => ['type' => 'hidden', 'default' => '1']];
// fool HTMLForm into thinking the form hasn't been submitted yet. Otherwise
// we get into an infinite loop!
$context->getRequest()->unsetVal('wpEditToken');
$headerText = $this->msg('tags-create-warnings-above', $tag, count($status->getWarningsArray()))->parseAsBlock() . $out->parse($status->getWikiText()) . $this->msg('tags-create-warnings-below')->parseAsBlock();
$subform = new HTMLForm($fields, $this->getContext());
$subform->setAction($this->getPageTitle('create')->getLocalURL());
$subform->setWrapperLegendMsg('tags-create-heading');
$subform->setHeaderText($headerText);
$subform->setSubmitCallback([$this, 'processCreateTagForm']);
$subform->setSubmitTextMsg('htmlform-yes');
$subform->show();
$out->addBacklinkSubtitle($this->getPageTitle());
return true;
} else {
$out->addWikiText("<div class=\"error\">\n" . $status->getWikiText() . "\n</div>");
return false;
}
}
示例10: execute
public function execute($par)
{
$out = $this->getOutput();
$out->addModuleStyles('mediawiki.special');
$this->mTarget = is_null($par) ? $this->getRequest()->getVal('wpTarget', $this->getRequest()->getVal('target', '')) : $par;
// This needs to be below assignment of $this->mTarget because
// getDescription() needs it to determine the correct page title.
$this->setHeaders();
$this->outputHeader();
// error out if sending user cannot do this
$error = self::getPermissionsError($this->getUser(), $this->getRequest()->getVal('wpEditToken'), $this->getConfig());
switch ($error) {
case null:
# Wahey!
break;
case 'badaccess':
throw new PermissionsError('sendemail');
case 'blockedemailuser':
throw new UserBlockedError($this->getUser()->mBlock);
case 'actionthrottledtext':
throw new ThrottledError();
case 'mailnologin':
case 'usermaildisabled':
throw new ErrorPageError($error, "{$error}text");
default:
# It's a hook error
list($title, $msg, $params) = $error;
throw new ErrorPageError($title, $msg, $params);
}
// Got a valid target user name? Else ask for one.
$ret = self::getTarget($this->mTarget);
if (!$ret instanceof User) {
if ($this->mTarget != '') {
// Messages used here: notargettext, noemailtext, nowikiemailtext
$ret = $ret == 'notarget' ? 'emailnotarget' : $ret . 'text';
$out->wrapWikiMsg("<p class='error'>\$1</p>", $ret);
}
$out->addHTML($this->userForm($this->mTarget));
return;
}
$this->mTargetObj = $ret;
$context = new DerivativeContext($this->getContext());
$context->setTitle($this->getPageTitle());
// Remove subpage
$form = new HTMLForm($this->getFormFields(), $context);
// By now we are supposed to be sure that $this->mTarget is a user name
$form->addPreText($this->msg('emailpagetext', $this->mTarget)->parse());
$form->setSubmitTextMsg('emailsend');
$form->setSubmitCallback(array(__CLASS__, 'uiSubmit'));
$form->setWrapperLegendMsg('email-legend');
$form->loadData();
if (!Hooks::run('EmailUserForm', array(&$form))) {
return;
}
$result = $form->show();
if ($result === true || $result instanceof Status && $result->isGood()) {
$out->setPageTitle($this->msg('emailsent'));
$out->addWikiMsg('emailsenttext', $this->mTarget);
$out->returnToMain(false, $this->mTargetObj->getUserPage());
}
}
示例11: getClearForm
/**
* Get a form for clearing the watchlist
*
* @return HTMLForm
*/
protected function getClearForm()
{
$context = new DerivativeContext($this->getContext());
$context->setTitle($this->getPageTitle('clear'));
// Reset subpage
$form = new HTMLForm(array(), $context);
$form->setSubmitTextMsg('watchlistedit-clear-submit');
# Used message keys: 'accesskey-watchlistedit-clear-submit', 'tooltip-watchlistedit-clear-submit'
$form->setSubmitTooltip('watchlistedit-clear-submit');
$form->setWrapperLegendMsg('watchlistedit-clear-legend');
$form->addHeaderText($this->msg('watchlistedit-clear-explain')->parse());
$form->setSubmitCallback(array($this, 'submitClear'));
$form->setSubmitDestructive();
return $form;
}
示例12: alterForm
/**
* Customizes the HTMLForm a bit
*
* @param $form HTMLForm
*/
protected function alterForm(HTMLForm $form)
{
$form->setWrapperLegendMsg('blockip-legend');
$form->setHeaderText('');
$form->setSubmitCallback(array(__CLASS__, 'processUIForm'));
$msg = $this->alreadyBlocked ? 'ipb-change-block' : 'ipbsubmit';
$form->setSubmitTextMsg($msg);
# Don't need to do anything if the form has been posted
if (!$this->getRequest()->wasPosted() && $this->preErrors) {
$s = HTMLForm::formatErrors($this->preErrors);
if ($s) {
$form->addHeaderText(Html::rawElement('div', array('class' => 'error'), $s));
}
}
}
示例13: alterForm
protected function alterForm(HTMLForm $form)
{
$form->setId('mw-botpasswords-form');
$form->setTableId('mw-botpasswords-table');
$form->addPreText($this->msg('botpasswords-summary')->parseAsBlock());
$form->suppressDefaultSubmit();
if ($this->par !== null) {
if ($this->botPassword->isSaved()) {
$form->setWrapperLegendMsg('botpasswords-editexisting');
$form->addButton(['name' => 'op', 'value' => 'update', 'label-message' => 'botpasswords-label-update', 'flags' => ['primary', 'progressive']]);
$form->addButton(['name' => 'op', 'value' => 'delete', 'label-message' => 'botpasswords-label-delete', 'flags' => ['destructive']]);
} else {
$form->setWrapperLegendMsg('botpasswords-createnew');
$form->addButton(['name' => 'op', 'value' => 'create', 'label-message' => 'botpasswords-label-create', 'flags' => ['primary', 'constructive']]);
}
$form->addButton(['name' => 'op', 'value' => 'cancel', 'label-message' => 'botpasswords-label-cancel']);
}
}
示例14: getForm
function getForm()
{
$fields = array();
$fields['limit'] = array('type' => 'select', 'name' => 'limit', 'label-message' => 'table_pager_limit_label', 'options' => $this->getLimitSelectList(), 'default' => $this->mLimit);
if (!$this->getConfig()->get('MiserMode')) {
$fields['ilsearch'] = array('type' => 'text', 'name' => 'ilsearch', 'id' => 'mw-ilsearch', 'label-message' => 'listfiles_search_for', 'default' => $this->mSearch, 'size' => '40', 'maxlength' => '255');
}
$this->getOutput()->addModules('mediawiki.userSuggest');
$fields['user'] = array('type' => 'text', 'name' => 'user', 'id' => 'mw-listfiles-user', 'label-message' => 'username', 'default' => $this->mUserName, 'size' => '40', 'maxlength' => '255', 'cssclass' => 'mw-autocomplete-user');
$fields['ilshowall'] = array('type' => 'check', 'name' => 'ilshowall', 'id' => 'mw-listfiles-show-all', 'label-message' => 'listfiles-show-all', 'default' => $this->mShowAll);
$query = $this->getRequest()->getQueryValues();
unset($query['title']);
unset($query['limit']);
unset($query['ilsearch']);
unset($query['ilshowall']);
unset($query['user']);
$form = new HTMLForm($fields, $this->getContext());
$form->setMethod('get');
$form->setTitle($this->getTitle());
$form->setId('mw-listfiles-form');
$form->setWrapperLegendMsg('listfiles');
$form->setSubmitTextMsg('table_pager_limit_submit');
$form->addHiddenFields($query);
$form->prepareForm();
$form->displayForm('');
}
示例15: getForm
/**
* Get the HTMLForm to control behavior
* @return HTMLForm|null
*/
protected function getForm()
{
$this->fields = $this->getFormFields();
$form = new HTMLForm($this->fields, $this->getContext(), $this->getMessagePrefix());
$form->setSubmitCallback(array($this, 'onSubmit'));
// If the form is a compact vertical form, then don't output this ugly
// fieldset surrounding it.
// XXX Special pages can setDisplayFormat to 'vform' in alterForm(), but that
// is called after this.
if (!$form->isVForm()) {
$form->setWrapperLegendMsg($this->getMessagePrefix() . '-legend');
}
$headerMsg = $this->msg($this->getMessagePrefix() . '-text');
if (!$headerMsg->isDisabled()) {
$form->addHeaderText($headerMsg->parseAsBlock());
}
// Retain query parameters (uselang etc)
$params = array_diff_key($this->getRequest()->getQueryValues(), array('title' => null));
$form->addHiddenField('redirectparams', wfArrayToCgi($params));
$form->addPreText($this->preText());
$form->addPostText($this->postText());
$this->alterForm($form);
// Give hooks a chance to alter the form, adding extra fields or text etc
wfRunHooks('SpecialPageBeforeFormDisplay', array($this->getName(), &$form));
return $form;
}