本文整理汇总了PHP中HTMLForm::setSubmitText方法的典型用法代码示例。如果您正苦于以下问题:PHP HTMLForm::setSubmitText方法的具体用法?PHP HTMLForm::setSubmitText怎么用?PHP HTMLForm::setSubmitText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLForm
的用法示例。
在下文中一共展示了HTMLForm::setSubmitText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Show the special page
*
* @param $par Mixed: parameter passed to the page or null
* @return bool|null
*/
public function execute($par)
{
global $wgExtensionAssetsPath;
$out = $this->getOutput();
// Add CSS
if (defined('MW_SUPPORTS_RESOURCE_MODULES')) {
$out->addModuleStyles('ext.video');
} else {
$out->addExtensionStyle($wgExtensionAssetsPath . '/Video/Video.css');
}
// If the user doesn't have the required 'addvideo' permission, display an error
if (!$this->userCanExecute($this->getUser())) {
$this->displayRestrictionError();
return;
}
// Show a message if the database is in read-only mode
if (wfReadOnly()) {
throw new ReadOnlyError();
}
// If user is blocked, s/he doesn't need to access this page
if ($this->getUser()->isBlocked()) {
throw new UserBlockedError($this->getUser()->mBlock);
}
$this->setHeaders();
$form = new HTMLForm($this->getFormFields(), $this->getContext());
$form->setIntro(wfMsgExt('video-addvideo-instructions', 'parse'));
$form->setWrapperLegend(wfMsg('video-addvideo-title'));
$form->setSubmitText(wfMsg('video-addvideo-button'));
$form->setSubmitCallback(array($this, 'submit'));
if ($this->getRequest()->getCheck('forReUpload')) {
$form->addHiddenField('forReUpload', true);
}
$form->show();
}
示例2: execute
/**
* Main execution point
*
* @param $par String title fragment
*/
public function execute($par)
{
global $wgOut, $wgRequest, $wgLang;
$this->setHeaders();
$this->outputHeader();
$wgOut->setPageTitle(wfMsg('ipblocklist'));
$wgOut->addModuleStyles('mediawiki.special');
$par = $wgRequest->getVal('ip', $par);
$this->target = trim($wgRequest->getVal('wpTarget', $par));
$this->options = $wgRequest->getArray('wpOptions', array());
$action = $wgRequest->getText('action');
if ($action == 'unblock' || $action == 'submit' && $wgRequest->wasPosted()) {
# B/C @since 1.18: Unblock interface is now at Special:Unblock
$title = SpecialPage::getTitleFor('Unblock', $this->target);
$wgOut->redirect($title->getFullUrl());
return;
}
# Just show the block list
$fields = array('Target' => array('type' => 'text', 'label-message' => 'ipadressorusername', 'tabindex' => '1', 'size' => '45'), 'Options' => array('type' => 'multiselect', 'options' => array(wfMsg('blocklist-userblocks') => 'userblocks', wfMsg('blocklist-tempblocks') => 'tempblocks', wfMsg('blocklist-addressblocks') => 'addressblocks'), 'flatlist' => true), 'Limit' => array('class' => 'HTMLBlockedUsersItemSelect', 'label-message' => 'table_pager_limit_label', 'options' => array($wgLang->formatNum(20) => 20, $wgLang->formatNum(50) => 50, $wgLang->formatNum(100) => 100, $wgLang->formatNum(250) => 250, $wgLang->formatNum(500) => 500), 'name' => 'limit', 'default' => 50));
$form = new HTMLForm($fields, $this->getContext());
$form->setMethod('get');
$form->setWrapperLegend(wfMsg('ipblocklist-legend'));
$form->setSubmitText(wfMsg('ipblocklist-submit'));
$form->prepareForm();
$form->displayForm('');
$this->showList();
}
示例3: spellCheckingForm
/**
* Display form for testing spell checking feature
*/
function spellCheckingForm($languages)
{
$fields = array('text' => array('class' => 'HTMLTextField', 'label-message' => 'spellchecker-info-spellcheck-text'), 'lang' => array('class' => 'HTMLSelectField', 'label-message' => 'spellchecker-info-spellcheck-languages', 'options' => array_combine($languages, $languages)));
$form = new HTMLForm($fields);
$form->setTitle($this->title);
$form->setSubmitText($this->app->runFunction('wfMsg', 'spellchecker-info-spellcheck-submit'));
$form->loadData();
$form->displayForm('');
// page was POSTed, perform spell cheking
if ($this->request->wasPosted()) {
$text = $this->request->getText('wptext');
$langCode = $this->request->getText('wplang');
// create spell checking service
$service = new SpellCheckerService($langCode);
$info = $service->getInfo();
// check the spelling (returns true or array of spelling suggestions)
$data = $service->checkWord($text);
// print out results
if ($data === true) {
$result = $this->app->runFunction('wfMsg', 'spellchecker-info-spellcheck-is-correct', $text);
} else {
$result = $this->app->runFunction('wfMsg', 'spellchecker-info-spellcheck-suggestions', $text, implode(', ', $data));
}
$this->out->addHtml("<p>{$result}</p>");
$this->out->addHtml("<p><small>{$info['desc']} / {$info['lang']}</small></p>");
}
}
示例4: 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;
}
}
}
示例5: buildForm
function buildForm()
{
$form = new HTMLForm($this->getFormFields(), $this->getContext(), 'lqt-' . $this->getPageName());
$par = $this->mThread->title()->getPrefixedText();
$form->setSubmitText($this->getSubmitText());
$form->setSubmitCallback(array($this, 'trySubmit'));
return $form;
}
示例6: 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());
}
}
示例7: execute
function execute($par)
{
global $wgRequest;
$this->setHeaders();
$form = new HTMLForm(array('TitleText' => array('type' => 'text', 'label-message' => 'luafoo-convert-title')));
$form->setSubmitText(wfMsg('luafoo-convert-submit'));
$form->setSubmitCallback(array($this, 'showTranslation'));
$form->setTitle($this->getTitle());
$form->show();
}
示例8: showResetForm
private function showResetForm()
{
$this->getOutput()->addWikiMsg('prefs-reset-intro');
$htmlForm = new HTMLForm(array(), $this->getContext(), 'prefs-restore');
$htmlForm->setSubmitText(wfMsg('restoreprefs'));
$htmlForm->setTitle($this->getTitle('reset'));
$htmlForm->setSubmitCallback(array($this, 'submitReset'));
$htmlForm->suppressReset();
$htmlForm->show();
}
示例9: 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());
}
}
示例10: showResetForm
function showResetForm()
{
$this->getOutput()->addWikiMsg('prefs-reset-intro');
$htmlForm = new HTMLForm(array(), $this->getContext(), 'prefs-restore');
$htmlForm->setSubmitText(wfMsg('restoreprefs'));
$htmlForm->addHiddenField('username', $this->target);
$htmlForm->addHiddenField('reset', '1');
$htmlForm->setSubmitCallback(array($this, 'submitReset'));
$htmlForm->suppressReset();
$htmlForm->show();
}
示例11: showResetForm
function showResetForm()
{
global $wgOut;
$wgOut->addWikiMsg('prefs-reset-intro');
$htmlForm = new HTMLForm(array(), 'prefs-restore');
$htmlForm->setSubmitText(wfMsg('restoreprefs'));
$htmlForm->setTitle($this->getTitle('reset'));
$htmlForm->setSubmitCallback(array(__CLASS__, 'submitReset'));
$htmlForm->suppressReset();
$htmlForm->show();
}
示例12: execute
/**
* Show a form for filtering namespace and username
*
* @param $par String
* @return String
*/
public function execute($par)
{
$this->setHeaders();
$this->outputHeader();
$form = new HTMLForm(array('Page1' => array('type' => 'text', 'name' => 'page1', 'label-message' => 'compare-page1', 'size' => '40', 'section' => 'page1'), 'Revision1' => array('type' => 'int', 'name' => 'rev1', 'label-message' => 'compare-rev1', 'size' => '8', 'section' => 'page1'), 'Page2' => array('type' => 'text', 'name' => 'page2', 'label-message' => 'compare-page2', 'size' => '40', 'section' => 'page2'), 'Revision2' => array('type' => 'int', 'name' => 'rev2', 'label-message' => 'compare-rev2', 'size' => '8', 'section' => 'page2'), 'Action' => array('type' => 'hidden', 'name' => 'action'), 'Diffonly' => array('type' => 'hidden', 'name' => 'diffonly')), 'compare');
$form->setSubmitText(wfMsg('compare-submit'));
$form->suppressReset();
$form->setMethod('get');
$form->setTitle($this->getTitle());
$form->loadData();
$form->displayForm('');
self::showDiff($form->mFieldData);
}
示例13: 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;
}
}
}
示例14: showDeletionForm
/**
* Show form if user wants to delete all data
*/
public function showDeletionForm()
{
$out = $this->out;
$max_length = $this->max_string_formfield_length;
$out->setPageTitle($out->msg('helperscripts'));
$html = '';
$html .= $this->getHTMLJavascriptLoader();
$html .= "<div class='javascripthide'>";
if (!empty($error_message)) {
$html .= "<br>";
$html .= "<div class = 'error'>{$error_message}</div>";
}
$html .= "</div>";
$out->addHTML($html);
$descriptor = array();
$descriptor['phrase'] = array('label-message' => 'phrase-message', 'class' => 'HTMLTextField', 'type' => 'password', 'maxlength' => $max_length * 20);
$html_form = new HTMLForm($descriptor, $out->getContext());
$html_form->setSubmitText($out->msg('delete-submit'));
$html_form->addHiddenField('phrase_posted', 'phrase_posted');
$html_form->setSubmitCallback(array('SpecialHelperScripts', 'processInput'));
return $html_form->show();
}
示例15: showSurvey
/**
* Show the survey.
*
* @since 0.1
*
* @param Survey $survey
*/
protected function showSurvey(Survey $survey)
{
$fields = array();
$fields[] = array('type' => 'hidden', 'default' => $survey->getId(), 'name' => 'survey-id', 'id' => 'survey-id');
$fields[] = array('type' => 'hidden', 'default' => $survey->getField('name'), 'name' => 'survey-name', 'id' => 'survey-name');
$fields[] = array('type' => 'hidden', 'default' => $survey->getField('expiry'), 'name' => 'survey-expiry', 'id' => 'survey-expiry');
$fields[] = array('class' => 'SurveyNameField', 'default' => $survey->getField('name'), 'label-message' => 'survey-special-label-name', 'style' => 'font-weight: bold;');
$fields[] = array('type' => 'text', 'default' => $survey->getField('title'), 'label-message' => 'survey-special-label-title', 'id' => 'survey-title', 'name' => 'survey-title');
$fields[] = array('type' => 'check', 'default' => $survey->getField('enabled') ? '1' : '0', 'label-message' => 'survey-special-label-enabled', 'id' => 'survey-enabled', 'name' => 'survey-enabled');
$fields[] = array('type' => 'radio', 'default' => $survey->getField('user_type'), 'label-message' => 'survey-special-label-usertype', 'id' => 'survey-user_type', 'name' => 'survey-user_type', 'options' => array(wfMsg('survey-user-type-all') => Survey::$USER_ALL, wfMsg('survey-user-type-loggedin') => Survey::$USER_LOGGEDIN, wfMsg('survey-user-type-confirmed') => Survey::$USER_CONFIRMED, wfMsg('survey-user-type-editor') => Survey::$USER_EDITOR, wfMsg('survey-user-type-anon') => Survey::$USER_ANON));
$fields[] = array('type' => 'select', 'default' => $survey->getField('ratio'), 'label-message' => 'survey-special-label-ratio', 'id' => 'survey-ratio', 'name' => 'survey-ratio', 'options' => $this->getNumericalOptions(array_merge(array(0.01, 0.1), range(1, 100))));
$fields[] = array('type' => 'select', 'default' => $survey->getField('min_pages'), 'label-message' => 'survey-special-label-minpages', 'id' => 'survey-min_pages', 'name' => 'survey-min_pages', 'options' => $this->getNumericalOptions(range(0, 250)));
$fields[] = array('type' => 'text', 'default' => $survey->getField('header'), 'label-message' => 'survey-special-label-header', 'id' => 'survey-header', 'name' => 'survey-header');
$fields[] = array('type' => 'text', 'default' => $survey->getField('footer'), 'label-message' => 'survey-special-label-footer', 'id' => 'survey-footer', 'name' => 'survey-footer');
$fields[] = array('type' => 'text', 'default' => $survey->getField('thanks'), 'label-message' => 'survey-special-label-thanks', 'id' => 'survey-thanks', 'name' => 'survey-thanks');
foreach ($survey->getQuestions() as $question) {
$fields[] = array('class' => 'SurveyQuestionField', 'options' => $question->toArray());
}
// getContext was added in 1.18 and since that version is
// the second argument for the HTMLForm constructor.
if (version_compare($GLOBALS['wgVersion'], '1.18', '>=')) {
$form = new HTMLForm($fields, $this->getContext());
} else {
$form = new HTMLForm($fields);
$form->setTitle($this->getTitle());
}
$form->setSubmitText(wfMsg('surveys-special-save'));
$form->addButton('cancelEdit', wfMsg('cancel'), 'cancelEdit', array('onclick' => 'window.location="' . SpecialPage::getTitleFor('Surveys')->getFullURL() . '";return false;'));
$form->show();
}