本文整理汇总了PHP中HTMLForm::addHiddenField方法的典型用法代码示例。如果您正苦于以下问题:PHP HTMLForm::addHiddenField方法的具体用法?PHP HTMLForm::addHiddenField怎么用?PHP HTMLForm::addHiddenField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLForm
的用法示例。
在下文中一共展示了HTMLForm::addHiddenField方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: 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()]);
}
示例3: 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();
}
示例4: 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;
}
示例5: alterForm
protected function alterForm(HTMLForm $form)
{
$form->setSubmitTextMsg('confirm-rollback-button');
$form->setTokenSalt('rollback');
// Copy parameters from GET to confirmation form
$from = $this->getRequest()->getVal('from');
if ($from === null) {
throw new BadRequestError('rollbackfailed', 'rollback-missingparam');
}
foreach (['from', 'bot', 'hidediff', 'summary'] as $param) {
$val = $this->getRequest()->getVal($param);
if ($val !== null) {
$form->addHiddenField($param, $val);
}
}
}
示例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;
}
示例7: 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();
}
示例8: alterForm
protected function alterForm(HTMLForm $form)
{
$form->setWrapperLegend(wfMsgHtml('filerevert-legend'));
$form->setSubmitText(wfMsg('filerevert-submit'));
$form->addHiddenField('oldimage', $this->getRequest()->getText('oldimage'));
}
示例9: 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;
}
示例10: 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;
}
示例11: showHideForm
/**
* @param $id
* @return mixed
*/
function showHideForm($id)
{
if (!$this->getUser()->isAllowed('abusefilter-hide-log')) {
$this->getOutput()->addWikiMsg('abusefilter-log-hide-forbidden');
return;
}
$dbr = wfGetDB(DB_SLAVE);
$row = $dbr->selectRow(array('abuse_filter_log', 'abuse_filter'), '*', array('afl_id' => $id), __METHOD__, array(), array('abuse_filter' => array('LEFT JOIN', 'af_id=afl_filter')));
if (!$row) {
return;
}
$formInfo = array('logid' => array('type' => 'info', 'default' => $id, 'label-message' => 'abusefilter-log-hide-id'), 'reason' => array('type' => 'text', 'label-message' => 'abusefilter-log-hide-reason'), 'hidden' => array('type' => 'toggle', 'default' => $row->afl_deleted, 'label-message' => 'abusefilter-log-hide-hidden'));
$form = new HTMLForm($formInfo, $this->getContext());
$form->setTitle($this->getPageTitle());
$form->setWrapperLegend($this->msg('abusefilter-log-hide-legend')->text());
$form->addHiddenField('hide', $id);
$form->setSubmitCallback(array($this, 'saveHideForm'));
$form->show();
}
示例12: showForm2
/**
* Constructs and show form 2
*/
public function showForm2(array $collection_data, array $collection_name_data, RequestContext $context, $error_message = '')
{
global $wgArticleUrl;
$article_url = $wgArticleUrl;
$max_int_formfield_length = $this->max_int_formfield_length;
$out = $this->out;
$collection_data = $this->HTMLSpecialCharachtersArray($collection_data);
$collection_name_data = $this->HTMLSpecialCharachtersArray($collection_name_data);
$collections_message = implode(', ', $collection_name_data) . ".";
$out->setPageTitle($out->msg('stylometricanalysis-options'));
$html = "";
$html .= $this->getHTMLJavascriptLoader();
$html .= "<div class='javascripthide'>";
$html .= "<a href='" . $article_url . "Special:StylometricAnalysis' class='link-transparent' title='Go Back'>Go Back</a>";
$html .= "<br><br>";
$html .= $out->msg('stylometricanalysis-chosencollections') . $collections_message . "<br>";
$html .= $out->msg('stylometricanalysis-chosencollection2');
$html .= "<br><br>";
//display the error
if (!empty($error_message)) {
$html .= "<div class = 'error'>" . $error_message . "</div>";
}
$html .= "</div>";
$out->addHTML($html);
$descriptor = array();
$descriptor['removenonalpha'] = array('label' => 'Remove non-alpha', 'class' => 'HTMLCheckField', 'section' => 'stylometricanalysis-section-import');
$descriptor['lowercase'] = array('label' => 'Lowercase', 'class' => 'HTMLCheckField', 'section' => 'stylometricanalysis-section-import');
$descriptor['tokenizer'] = array('label' => 'Tokenizer', 'class' => 'HTMLSelectField', 'options' => array('Whitespace' => 'whitespace', 'Words' => 'words'), 'default' => 'whitespace', 'section' => 'stylometricanalysis-section-preprocess');
$descriptor['minimumsize'] = array('label' => 'Minimum Size', 'class' => 'HTMLTextField', 'default' => 0, 'size' => $max_int_formfield_length, 'maxlength' => $max_int_formfield_length, 'section' => 'stylometricanalysis-section-preprocess');
$descriptor['maximumsize'] = array('label' => 'Maximum Size', 'class' => 'HTMLTextField', 'default' => 10000, 'size' => $max_int_formfield_length, 'maxlength' => $max_int_formfield_length, 'section' => 'stylometricanalysis-section-preprocess');
$descriptor['segmentsize'] = array('label' => 'Segment Size', 'class' => 'HTMLTextField', 'default' => 0, 'size' => $max_int_formfield_length, 'maxlength' => $max_int_formfield_length, 'section' => 'stylometricanalysis-section-preprocess');
$descriptor['stepsize'] = array('label' => 'Step Size', 'class' => 'HTMLTextField', 'default' => 0, 'size' => $max_int_formfield_length, 'maxlength' => $max_int_formfield_length, 'section' => 'stylometricanalysis-section-preprocess');
$descriptor['removepronouns'] = array('label' => 'Remove Pronouns', 'class' => 'HTMLCheckField', 'section' => 'stylometricanalysis-section-preprocess');
$descriptor['vectorspace'] = array('label' => 'Vector Space', 'class' => 'HTMLSelectField', 'options' => array('tf' => 'tf', 'tf_scaled' => 'tf_scaled', 'tf_std' => 'tf_std', 'tf_idf' => 'tf_idf', 'bin' => 'bin'), 'default' => 'tf', 'section' => 'stylometricanalysis-section-feature');
$descriptor['featuretype'] = array('label' => 'Feature Type', 'class' => 'HTMLSelectField', 'options' => array('word' => 'word', 'char' => 'char', 'char_wb' => 'char_wb'), 'default' => 'word', 'section' => 'stylometricanalysis-section-feature');
$descriptor['ngramsize'] = array('label' => 'Ngram Size', 'class' => 'HTMLTextField', 'default' => 1, 'size' => $max_int_formfield_length, 'maxlength' => $max_int_formfield_length, 'section' => 'stylometricanalysis-section-feature');
$descriptor['mfi'] = array('label' => 'MFI', 'class' => 'HTMLTextField', 'default' => 100, 'size' => $max_int_formfield_length, 'maxlength' => $max_int_formfield_length, 'section' => 'stylometricanalysis-section-feature');
$descriptor['minimumdf'] = array('class' => 'HTMLTextField', 'label' => 'Minimum DF', 'default' => 0.0, 'size' => $max_int_formfield_length, 'maxlength' => $max_int_formfield_length, 'section' => 'stylometricanalysis-section-feature');
$descriptor['maximumdf'] = array('class' => 'HTMLTextField', 'label' => 'Maximum DF', 'default' => 0.9, 'size' => $max_int_formfield_length, 'maxlength' => $max_int_formfield_length, 'section' => 'stylometricanalysis-section-feature');
$descriptor['visualization1'] = array('label' => 'Visualization1', 'class' => 'HTMLSelectField', 'options' => array('PCA Scatterplot' => 'pcascatterplot', 'TNSE Scatterplot' => 'tnsescatterplot', 'Distance Matrix Clustering' => 'distancematrix', 'Variability Based Neighbour Clustering' => 'neighbourclustering'), 'default' => 'pcascatterplot', 'section' => 'stylometricanalysis-section-visualization');
$descriptor['visualization2'] = array('label' => 'Visualization2', 'class' => 'HTMLSelectField', 'options' => array('PCA Scatterplot' => 'pcascatterplot', 'TNSE Scatterplot' => 'tnsescatterplot', 'Distance Matrix Clustering' => 'distancematrix', 'Variability Based Neighbour Clustering' => 'neighbourclustering'), 'default' => 'pcascatterplot', 'section' => 'stylometricanalysis-section-visualization');
$html_form = new HTMLForm($descriptor, $context);
$html_form->setSubmitText($out->msg('stylometricanalysis-submit'));
$html_form->addHiddenField('collection_data', json_encode($collection_data));
$html_form->addHiddenField('form_2_posted', 'form_2_posted');
$html_form->setSubmitCallback(array('SpecialStylometricAnalysis', 'callbackForm2'));
$html_form->show();
return true;
}
示例13: 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->addHiddenField('clear', true, array('type' => 'boolean'));
$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) {
$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;
}
示例14: alterForm
protected function alterForm(HTMLForm $form)
{
$form->setDisplayFormat('vform');
$form->setId('mw-changeemail-form');
$form->setTableId('mw-changeemail-table');
$form->setWrapperLegend(false);
$form->setSubmitTextMsg('changeemail-submit');
$form->addHiddenField('returnto', $this->getRequest()->getVal('returnto'));
}
示例15: 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'));
}