当前位置: 首页>>代码示例>>PHP>>正文


PHP HTMLForm::addPreText方法代码示例

本文整理汇总了PHP中HTMLForm::addPreText方法的典型用法代码示例。如果您正苦于以下问题:PHP HTMLForm::addPreText方法的具体用法?PHP HTMLForm::addPreText怎么用?PHP HTMLForm::addPreText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTMLForm的用法示例。


在下文中一共展示了HTMLForm::addPreText方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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->setWrapperLegend(wfMsg('unblockip'));
     $form->setSubmitCallback(array(__CLASS__, 'processUIUnblock'));
     $form->setSubmitText(wfMsg('ipusubmit'));
     $form->addPreText(wfMsgExt('unblockiptext', 'parse'));
     if ($form->show()) {
         switch ($this->type) {
             case Block::TYPE_USER:
             case Block::TYPE_IP:
                 $out->addWikiMsg('unblocked', $this->target);
                 break;
             case Block::TYPE_RANGE:
                 $out->addWikiMsg('unblocked-range', $this->target);
                 break;
             case Block::TYPE_ID:
             case Block::TYPE_AUTO:
                 $out->addWikiMsg('unblocked-id', $this->target);
                 break;
         }
     }
 }
开发者ID:laiello,项目名称:media-wiki-law,代码行数:32,代码来源:SpecialUnblock.php

示例2: execute

 public function execute($par)
 {
     $this->setHeaders();
     $this->outputHeader();
     $out = $this->getOutput();
     $out->addModuleStyles('mediawiki.special');
     $this->mTarget = is_null($par) ? $this->getRequest()->getVal('wpTarget', $this->getRequest()->getVal('target', '')) : $par;
     // error out if sending user cannot do this
     $error = self::getPermissionsError($this->getUser(), $this->getRequest()->getVal('wpEditToken'));
     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 != '') {
             $ret = $ret == 'notarget' ? 'emailnotarget' : $ret . 'text';
             $out->wrapWikiMsg("<p class='error'>\$1</p>", $ret);
         }
         $out->addHTML($this->userForm($this->mTarget));
         return false;
     }
     $this->mTargetObj = $ret;
     $form = new HTMLForm($this->getFormFields(), $this->getContext());
     $form->addPreText(wfMsgExt('emailpagetext', 'parseinline'));
     $form->setSubmitText(wfMsg('emailsend'));
     $form->setTitle($this->getTitle());
     $form->setSubmitCallback(array(__CLASS__, 'submit'));
     $form->setWrapperLegend(wfMsgExt('email-legend', 'parsemag'));
     $form->loadData();
     if (!wfRunHooks('EmailUserForm', array(&$form))) {
         return false;
     }
     $out->setPageTitle($this->msg('emailpage'));
     $result = $form->show();
     if ($result === true || $result instanceof Status && $result->isGood()) {
         $out->setPageTitle($this->msg('emailsent'));
         $out->addWikiMsg('emailsenttext');
         $out->returnToMain(false, $this->mTargetObj->getUserPage());
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:56,代码来源:SpecialEmailuser.php

示例3: execute

 public function execute($par)
 {
     global $wgRequest, $wgOut, $wgUser;
     $this->setHeaders();
     $this->outputHeader();
     $this->mTarget = is_null($par) ? $wgRequest->getVal('wpTarget', $wgRequest->getVal('target', '')) : $par;
     $ret = self::getTarget($this->mTarget);
     if ($ret instanceof User) {
         $this->mTargetObj = $ret;
     } else {
         $wgOut->showErrorPage("{$ret}title", "{$ret}text");
         return false;
     }
     $error = self::getPermissionsError($wgUser, $wgRequest->getVal('wpEditToken'));
     switch ($error) {
         case null:
             # Wahey!
             break;
         case 'badaccess':
             $wgOut->permissionRequired('sendemail');
             return;
         case 'blockedemailuser':
             $wgOut->blockedPage();
             return;
         case 'actionthrottledtext':
             $wgOut->rateLimited();
             return;
         case 'mailnologin':
         case 'usermaildisabled':
             $wgOut->showErrorPage($error, "{$error}text");
             return;
         default:
             # It's a hook error
             list($title, $msg, $params) = $error;
             $wgOut->showErrorPage($title, $msg, $params);
             return;
     }
     $form = new HTMLForm($this->getFormFields());
     $form->addPreText(wfMsgExt('emailpagetext', 'parseinline'));
     $form->setSubmitText(wfMsg('emailsend'));
     $form->setTitle($this->getTitle());
     $form->setSubmitCallback(array(__CLASS__, 'submit'));
     $form->setWrapperLegend(wfMsgExt('email-legend', 'parsemag'));
     $form->loadData();
     if (!wfRunHooks('EmailUserForm', array(&$form))) {
         return false;
     }
     $wgOut->setPagetitle(wfMsg('emailpage'));
     $result = $form->show();
     if ($result === true || $result instanceof Status && $result->isGood()) {
         $wgOut->setPagetitle(wfMsg('emailsent'));
         $wgOut->addWikiMsg('emailsenttext');
         $wgOut->returnToMain(false, $this->mTargetObj->getUserPage());
     }
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:55,代码来源:SpecialEmailuser.php

示例4: execute

 public function execute($par)
 {
     global $wgUser, $wgOut, $wgRequest;
     # Check permissions
     if (!$this->userCanExecute($wgUser)) {
         $this->displayRestrictionError();
         return;
     }
     # Check for database lock
     if (wfReadOnly()) {
         throw new ReadOnlyError();
     }
     list($this->target, $this->type) = SpecialBlock::getTargetAndType($par, $wgRequest);
     $this->block = Block::newFromTarget($this->target);
     # bug 15810: blocked admins should have limited access here.  This won't allow sysops
     # to remove autoblocks on themselves, but they should have ipblock-exempt anyway
     $status = SpecialBlock::checkUnblockSelf($this->target);
     if ($status !== true) {
         throw new ErrorPageError('badaccess', $status);
     }
     $wgOut->setPageTitle(wfMsg('unblockip'));
     $wgOut->addModules('mediawiki.special');
     $form = new HTMLForm($this->getFields(), $this->getContext());
     $form->setWrapperLegend(wfMsg('unblockip'));
     $form->setSubmitCallback(array(__CLASS__, 'processUnblock'));
     $form->setSubmitText(wfMsg('ipusubmit'));
     $form->addPreText(wfMsgExt('unblockiptext', 'parse'));
     if ($form->show()) {
         switch ($this->type) {
             case Block::TYPE_USER:
             case Block::TYPE_IP:
                 $wgOut->addWikiMsg('unblocked', $this->target);
                 break;
             case Block::TYPE_RANGE:
                 $wgOut->addWikiMsg('unblocked-range', $this->target);
                 break;
             case Block::TYPE_ID:
             case Block::TYPE_AUTO:
                 $wgOut->addWikiMsg('unblocked-id', $this->target);
                 break;
         }
     }
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:43,代码来源:SpecialUnblock.php

示例5: getForm

 /**
  * Get the HTMLForm to control behavior
  * @return HTMLForm|null
  */
 protected function getForm()
 {
     $this->fields = $this->getFormFields();
     // Give hooks a chance to alter the form, adding extra fields or text etc
     wfRunHooks('ActionModifyFormFields', array($this->getName(), &$this->fields, $this->page));
     $form = new HTMLForm($this->fields, $this->getContext(), $this->getName());
     $form->setSubmitCallback(array($this, 'onSubmit'));
     // Retain query parameters (uselang etc)
     $form->addHiddenField('action', $this->getName());
     // Might not be the same as the query string
     $params = array_diff_key($this->getRequest()->getQueryValues(), array('action' => null, '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('ActionBeforeFormDisplay', array($this->getName(), &$form, $this->page));
     return $form;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:23,代码来源:FormAction.php

示例6: getForm

 /**
  * Get the HTMLForm to control behavior
  * @return HTMLForm|null
  */
 protected function getForm()
 {
     $this->fields = $this->getFormFields();
     // Give hooks a chance to alter the form, adding extra fields or text etc
     Hooks::run('ActionModifyFormFields', [$this->getName(), &$this->fields, $this->page]);
     $form = new HTMLForm($this->fields, $this->getContext(), $this->getName());
     $form->setSubmitCallback([$this, 'onSubmit']);
     $title = $this->getTitle();
     $form->setAction($title->getLocalURL(['action' => $this->getName()]));
     // Retain query parameters (uselang etc)
     $params = array_diff_key($this->getRequest()->getQueryValues(), ['action' => null, 'title' => null]);
     if ($params) {
         $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
     Hooks::run('ActionBeforeFormDisplay', [$this->getName(), &$form, $this->page]);
     return $form;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:25,代码来源:FormAction.php

示例7: 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;
         }
     }
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:39,代码来源:SpecialUnblock.php

示例8: 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());
     }
 }
开发者ID:paladox,项目名称:2,代码行数:61,代码来源:SpecialEmailuser.php

示例9: 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());
     if ($this->mPreTextMessage instanceof Message) {
         $form->addPreText($this->mPreTextMessage->parseAsBlock());
     }
     $form->addHiddenFields($this->getRequest()->getValues('wpName', 'wpDomain', 'returnto', 'returntoquery'));
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:13,代码来源:SpecialChangePassword.php

示例10: showActivateDeactivateForm

 protected function showActivateDeactivateForm($tag, $activate)
 {
     $actionStr = $activate ? 'activate' : 'deactivate';
     $user = $this->getUser();
     if (!$user->isAllowed('managechangetags')) {
         throw new PermissionsError('managechangetags');
     }
     $out = $this->getOutput();
     // tags-activate-title, tags-deactivate-title
     $out->setPageTitle($this->msg("tags-{$actionStr}-title"));
     $out->addBacklinkSubtitle($this->getPageTitle());
     // is it possible to do this?
     $func = $activate ? 'canActivateTag' : 'canDeactivateTag';
     $result = ChangeTags::$func($tag, $user);
     if (!$result->isGood()) {
         $out->addWikiText("<div class=\"error\">\n" . $result->getWikiText() . "\n</div>");
         if (!$result->isOK()) {
             return;
         }
     }
     // tags-activate-question, tags-deactivate-question
     $preText = $this->msg("tags-{$actionStr}-question", $tag)->parseAsBlock();
     $fields = [];
     // tags-activate-reason, tags-deactivate-reason
     $fields['Reason'] = ['type' => 'text', 'label' => $this->msg("tags-{$actionStr}-reason")->plain(), 'size' => 50];
     $fields['HiddenTag'] = ['type' => 'hidden', 'name' => 'tag', 'default' => $tag, 'required' => true];
     $form = new HTMLForm($fields, $this->getContext());
     $form->setAction($this->getPageTitle($actionStr)->getLocalURL());
     $form->tagAction = $actionStr;
     $form->setSubmitCallback([$this, 'processTagForm']);
     // tags-activate-submit, tags-deactivate-submit
     $form->setSubmitTextMsg("tags-{$actionStr}-submit");
     $form->addPreText($preText);
     $form->show();
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:35,代码来源:SpecialTags.php

示例11: getForm

 /**
  * Get the HTMLForm to control behaviour
  * @return HTMLForm|null
  */
 protected function getForm()
 {
     $this->fields = $this->getFormFields();
     $form = new HTMLForm($this->fields, $this->getContext());
     $form->setSubmitCallback(array($this, 'onSubmit'));
     $form->setWrapperLegend($this->msg(strtolower($this->getName()) . '-legend'));
     $form->addHeaderText($this->msg(strtolower($this->getName()) . '-text')->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("Special{$this->getName()}BeforeFormDisplay", array(&$form));
     return $form;
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:21,代码来源:SpecialPage.php

示例12: 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;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:30,代码来源:FormSpecialPage.php

示例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']);
     }
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:18,代码来源:SpecialBotPasswords.php

示例14: doPreText

 /**
  * Add header elements like block log entries, etc.
  * @param  $form HTMLForm
  * @return void
  */
 protected function doPreText(HTMLForm &$form)
 {
     $form->addPreText(wfMsgExt('blockiptext', 'parse'));
     $otherBlockMessages = array();
     if ($this->target !== null) {
         # Get other blocks, i.e. from GlobalBlocking or TorBlock extension
         wfRunHooks('OtherBlockLogLink', array(&$otherBlockMessages, $this->target));
         if (count($otherBlockMessages)) {
             $s = Html::rawElement('h2', array(), wfMsgExt('ipb-otherblocks-header', 'parseinline', count($otherBlockMessages))) . "\n";
             $list = '';
             foreach ($otherBlockMessages as $link) {
                 $list .= Html::rawElement('li', array(), $link) . "\n";
             }
             $s .= Html::rawElement('ul', array('class' => 'mw-blockip-alreadyblocked'), $list) . "\n";
             $form->addPreText($s);
         }
     }
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:23,代码来源:SpecialBlock.php


注:本文中的HTMLForm::addPreText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。