本文整理汇总了PHP中HTMLForm::setTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP HTMLForm::setTitle方法的具体用法?PHP HTMLForm::setTitle怎么用?PHP HTMLForm::setTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLForm
的用法示例。
在下文中一共展示了HTMLForm::setTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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>");
}
}
示例2: 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->setTitle($this->getTitle());
// Remove subpage
$form->setMethod('get');
$form->setWrapperLegendMsg('ipblocklist-legend');
$form->setSubmitTextMsg('ipblocklist-submit');
$form->prepareForm();
$form->displayForm('');
$this->showList();
}
示例3: show
public function show($par)
{
$formFields = array('account' => array('type' => 'text', 'validation-callback' => array(__CLASS__, 'validateUser'), 'label-message' => 'disableaccount-user'), 'confirm' => array('type' => 'toggle', 'validation-callback' => array(__CLASS__, 'checkConfirmation'), 'label-message' => 'disableaccount-confirm'));
$htmlForm = new HTMLForm($formFields, 'disableaccount');
$htmlForm->setSubmitCallback(array(__CLASS__, 'submit'));
$htmlForm->setTitle($this->getTitle());
$htmlForm->show();
}
示例4: execute
function execute($par)
{
global $wgOut, $wgUser, $wgEmailAuthentication;
$this->setHeaders();
if (!$this->userCanExecute($wgUser)) {
$this->displayRestrictionError();
return;
}
$error = SpecialEmailUser::getPermissionsError($wgUser, $wgUser->editToken());
if ($error) {
switch ($error) {
case 'blockedemailuser':
$wgOut->blockedPage();
return;
case 'actionthrottledtext':
$wgOut->rateLimited();
return;
case 'mailnologin':
$wgOut->showErrorPage('mailnologin', 'mailnologintext');
return;
default:
list($title, $msg, $params) = $error;
$wgOut->showErrorPage($title, $msg, $params);
return;
}
}
$dbr = wfGetDB(DB_SLAVE);
# $conds can be not that strict but cannot be too strict.
$conds = array("user_email <> ''");
if ($wgEmailAuthentication) {
$conds[] = 'user_email_authenticated IS NOT NULL';
}
$res = $dbr->select('user', '*', $conds);
$users = UserArray::newFromResult($res);
$usernames = array();
foreach ($users as $user) {
if ($user->canReceiveEmail() && $user->getId() != $wgUser->getId()) {
$usernames[$user->getName()] = $user->getId();
}
}
$this->userIds = array_values($usernames);
if (empty($usernames)) {
# No one to send mail to
$wgOut->addWikiMsg('emailusers-norecipient');
$wgOut->returnToMain();
return;
}
$form = array('target' => array('type' => 'multiselect', 'label-message' => 'emailto', 'options' => $usernames, 'validation-callback' => array($this, 'validateTarget')), 'target-reverse' => array('type' => 'check', 'default' => true, 'label-message' => 'emailusers-target-reverse'), 'subject' => array('type' => 'text', 'default' => wfMsg('defemailsubject'), 'label-message' => 'emailsubject'), 'text' => array('type' => 'textarea', 'label-message' => 'emailmessage'), 'ccme' => array('type' => 'check', 'default' => $wgUser->getOption('ccmeonemails'), 'label-message' => 'emailccme'));
$htmlForm = new HTMLForm($form);
$htmlForm->setTitle($this->getTitle($par));
$htmlForm->setSubmitCallback(array($this, 'submit'));
$this->outputHeader();
if ($htmlForm->show()) {
$wgOut->addWikiMsg('emailsenttext');
$htmlForm->displayForm(false);
}
}
示例5: buildForm
function buildForm()
{
$form = new HTMLForm($this->getFormFields(), 'lqt-' . $this->getPageName());
$par = $this->mThread->title()->getPrefixedText();
$form->setSubmitText($this->getSubmitText());
$form->setTitle(SpecialPage::getTitleFor($this->getPageName(), $par));
$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: 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();
}
示例8: 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();
}
示例9: execute
public function execute($par)
{
$this->checkPermissions();
$this->setHeaders();
$form = new HTMLForm(array('dbname' => array('default' => $par, 'filter-callback' => array('SpecialCreateWiki', 'filter'), 'label-message' => 'createwiki-label-dbname', 'maxlength' => 30, 'required' => true, 'size' => 30, 'type' => 'text', 'validation-callback' => array('SpecialCreateWiki', 'validateDBname')), 'founder' => array('filter-callback' => array('SpecialCreateWiki', 'filter'), 'label-message' => 'createwiki-label-founder', 'required' => true, 'size' => 30, 'type' => 'text', 'validation-callback' => array('SpecialCreateWiki', 'validateFounder')), 'comment' => array('label-message' => 'createwiki-label-comment', 'maxlength' => 79, 'size' => 79, 'type' => 'text')));
$form->setSubmitTextMsg('createwiki-label-create');
$form->setTitle($this->getPageTitle());
$form->setSubmitCallback(array('SpecialCreateWiki', 'processInput'));
$form->show();
}
示例10: 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());
}
}
示例11: execute
function execute($par)
{
global $wgOut;
$wgOut->setPageTitle(wfMsg('communityhiring-header'));
$formDescriptor = array('about-intro' => array('type' => 'info', 'default' => wfMsgExt('communityhiring-about-intro', 'parse'), 'raw' => 1, 'section' => 'aboutyou'), 'given-name' => array('type' => 'text', 'label-message' => 'communityhiring-given', 'section' => 'aboutyou', 'validation-callback' => array($this, 'validateRequired')), 'family-name' => array('type' => 'text', 'label-message' => 'communityhiring-family', 'section' => 'aboutyou', 'validation-callback' => array($this, 'validateRequired')), 'address-line1' => array('type' => 'textarea', 'label-message' => 'communityhiring-address', 'section' => 'aboutyou', 'rows' => '3', 'cols' => '20'), 'address-city' => array('type' => 'text', 'label-message' => 'communityhiring-address-city', 'section' => 'aboutyou', 'validation-callback' => array($this, 'validateRequired')), 'address-postal' => array('type' => 'text', 'label-message' => 'communityhiring-address-postal', 'section' => 'aboutyou'), 'address-country' => array('type' => 'text', 'label-message' => 'communityhiring-address-country', 'section' => 'aboutyou', 'validation-callback' => array($this, 'validateRequired')), 'phone' => array('type' => 'text', 'label-message' => 'communityhiring-phone', 'section' => 'aboutyou'), 'email' => array('type' => 'text', 'label-message' => 'communityhiring-email', 'section' => 'aboutyou', 'validation-callback' => array($this, 'validateRequired')), 'paragraph-intro' => array('type' => 'info', 'default' => wfMsgExt('communityhiring-paragraphs-intro', 'parse'), 'raw' => 1, 'section' => 'paragraphs', 'vertical-label' => 1, 'validation-callback' => array($this, 'validateRequired')), 'significance' => array('type' => 'textarea', 'label-message' => 'communityhiring-significance', 'section' => 'paragraphs', 'rows' => 10, 'vertical-label' => 1, 'validation-callback' => array($this, 'validateRequired')), 'excitement' => array('type' => 'textarea', 'label-message' => 'communityhiring-excitement', 'section' => 'paragraphs', 'rows' => 10, 'vertical-label' => 1, 'validation-callback' => array($this, 'validateRequired')), 'experiences' => array('type' => 'textarea', 'label-message' => 'communityhiring-experiences', 'section' => 'paragraphs', 'rows' => 10, 'vertical-label' => 1, 'validation-callback' => array($this, 'validateRequired')), 'other' => array('type' => 'textarea', 'label-message' => 'communityhiring-other', 'section' => 'paragraphs', 'rows' => 10, 'vertical-label' => 1), 'languages' => array('type' => 'textarea', 'options' => array_flip(Language::getLanguageNames()), 'section' => 'demonstrative/languages', 'rows' => '3', 'label-message' => 'communityhiring-languages-label', 'vertical-label' => 1, 'validation-callback' => array($this, 'validateRequired')), 'contributor' => array('type' => 'radio', 'label-message' => 'communityhiring-contributor', 'section' => 'demonstrative/involvement', 'options' => array('Yes' => 'yes', 'No' => 'no')), 'usernames' => array('type' => 'textarea', 'rows' => '3', 'cols' => '20', 'label-message' => 'communityhiring-usernames', 'section' => 'demonstrative/involvement', 'vertical-label' => 1), 'wikimedia-links' => array('type' => 'textarea', 'label-message' => 'communityhiring-links', 'section' => 'demonstrative/involvement', 'rows' => '3', 'cols' => '20', 'vertical-label' => 1), 'other-links' => array('type' => 'textarea', 'label-message' => 'communityhiring-links-other', 'section' => 'demonstrative', 'rows' => '3', 'cols' => '20', 'vertical-label' => 1), 'availability-time' => array('type' => 'text', 'label-message' => 'communityhiring-availability-intro', 'section' => 'availability', 'vertical-label' => 1, 'validation-callback' => array($this, 'validateRequired')), 'availability-info' => array('type' => 'textarea', 'label-message' => 'communityhiring-availability-info', 'section' => 'availability', 'rows' => '5', 'cols' => '20', 'vertical-label' => 1), 'relocation' => array('type' => 'radio', 'label-message' => 'communityhiring-relocation-ok', 'section' => 'availability', 'vertical-label' => 1, 'options' => array('Yes' => 'yes', 'No' => 'no', 'It would be hard, but maybe I would' => 'maybe')), 'research' => array('type' => 'textarea', 'rows' => '5', 'label-message' => 'communityhiring-research', 'vertical-label' => 1, 'validation-callback' => array($this, 'validateRequired')));
$form = new HTMLForm($formDescriptor, 'communityhiring');
$form->setIntro(wfMsgExt('communityhiring-intro', 'parse'));
$form->setSubmitCallback(array($this, 'submit'));
$form->setTitle($this->getTitle());
$form->show();
}
示例12: 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();
}
示例13: 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);
}
示例14: getRawForm
/**
* Get a form for editing the watchlist in "raw" mode
*
* @return HTMLForm
*/
protected function getRawForm()
{
$titles = implode($this->getWatchlist(), "\n");
$fields = array('Titles' => array('type' => 'textarea', 'label-message' => 'watchlistedit-raw-titles', 'default' => $titles));
$form = new HTMLForm($fields, $this->getContext());
$form->setTitle($this->getTitle('raw'));
$form->setSubmitTextMsg('watchlistedit-raw-submit');
# Used message keys: 'accesskey-watchlistedit-raw-submit', 'tooltip-watchlistedit-raw-submit'
$form->setSubmitTooltip('watchlistedit-raw-submit');
$form->setWrapperLegendMsg('watchlistedit-raw-legend');
$form->addHeaderText($this->msg('watchlistedit-raw-explain')->parse());
$form->setSubmitCallback(array($this, 'submitRaw'));
return $form;
}
示例15: showUploads
/**
* Default action when we don't have a subpage -- just show links to the uploads we have,
* Also show a button to clear stashed files
* @param Status : $status - the result of processRequest
*/
private function showUploads($status = null)
{
global $wgOut;
if ($status === null) {
$status = Status::newGood();
}
// sets the title, etc.
$this->setHeaders();
$this->outputHeader();
// create the form, which will also be used to execute a callback to process incoming form data
// this design is extremely dubious, but supposedly HTMLForm is our standard now?
$form = new HTMLForm(array('Clear' => array('type' => 'hidden', 'default' => true, 'name' => 'clear')), 'clearStashedUploads');
$form->setSubmitCallback(array(__CLASS__, 'tryClearStashedUploads'));
$form->setTitle($this->getTitle());
$form->setSubmitText(wfMsg('uploadstash-clear'));
$form->prepareForm();
$formResult = $form->tryAuthorizedSubmit();
// show the files + form, if there are any, or just say there are none
$refreshHtml = Html::element('a', array('href' => $this->getTitle()->getLocalURL()), wfMsg('uploadstash-refresh'));
$files = $this->stash->listFiles();
if (count($files)) {
sort($files);
$fileListItemsHtml = '';
foreach ($files as $file) {
// TODO: Use Linker::link or even construct the list in plain wikitext
$fileListItemsHtml .= Html::rawElement('li', array(), Html::element('a', array('href' => $this->getTitle("file/{$file}")->getLocalURL()), $file));
}
$wgOut->addHtml(Html::rawElement('ul', array(), $fileListItemsHtml));
$form->displayForm($formResult);
$wgOut->addHtml(Html::rawElement('p', array(), $refreshHtml));
} else {
$wgOut->addHtml(Html::rawElement('p', array(), Html::element('span', array(), wfMsg('uploadstash-nofiles')) . ' ' . $refreshHtml));
}
return true;
}