本文整理汇总了PHP中Html::input方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::input方法的具体用法?PHP Html::input怎么用?PHP Html::input使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Html
的用法示例。
在下文中一共展示了Html::input方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute($par)
{
global $wgOut, $wgRequest;
$this->setHeaders();
$code = $wgRequest->getVal('verify');
if ($code !== null) {
$dbw = wfGetDB(DB_MASTER);
$row = $dbw->selectRow('email_capture', array('ec_verified'), array('ec_code' => $code), __METHOD__);
if ($row && !$row->ec_verified) {
$dbw->update('email_capture', array('ec_verified' => 1), array('ec_code' => $code), __METHOD__);
if ($dbw->affectedRows()) {
$wgOut->addWikiMsg('emailcapture-success');
} else {
$wgOut->addWikiMsg('emailcapture-failure');
}
} elseif ($row && $row->ec_verified) {
$wgOut->addWikiMsg('emailcapture-already-confirmed');
} else {
$wgOut->addWikiMsg('emailcapture-invalid-code');
}
} else {
// Show simple form for submitting verification code
$o = Html::openElement('form', array('action' => $this->getTitle()->getFullUrl(), 'method' => 'post'));
$o .= Html::element('p', array(), wfMsg('emailcapture-instructions'));
$o .= Html::openElement('blockquote');
$o .= Html::element('label', array('for' => 'emailcapture-verify'), wfMsg('emailcapture-verify')) . ' ';
$o .= Html::input('verify', '', 'text', array('id' => 'emailcapture-verify', 'size' => 32)) . ' ';
$o .= Html::input('submit', wfMsg('emailcapture-submit'), 'submit');
$o .= Html::closeElement('blockquote');
$o .= Html::closeElement('form');
$wgOut->addHtml($o);
}
}
示例2: execute
function execute($category)
{
global $wgUser, $wgRequest, $wgOut, $wgPageSchemasHandlerClasses;
if (!$wgUser->isAllowed('generatepages')) {
$wgOut->permissionRequired('generatepages');
return;
}
$this->setHeaders();
$param = $wgRequest->getText('param');
if (!empty($param) && !empty($category)) {
// Generate the pages!
$this->generatePages($param, $wgRequest->getArray('page'));
$text = Html::element('p', null, wfMessage('ps-generatepages-success')->parse());
$wgOut->addHTML($text);
return true;
}
if ($category == "") {
// No category listed.
// TODO - show an error message.
return true;
}
// Standard "generate pages" form, with category name set.
// Check for a valid category, with a page schema defined.
$pageSchemaObj = new PSSchema($category);
if (!$pageSchemaObj->isPSDefined()) {
$text = Html::element('p', null, wfMessage('ps-generatepages-noschema')->parse());
$wgOut->addHTML($text);
return true;
}
$text = Html::element('p', null, wfMessage('ps-generatepages-desc')->parse()) . "\n";
$text .= '<form method="post">';
$text .= Html::input('param', $category, 'hidden') . "\n";
$text .= '<div id="ps_check_all_check_none">
<input type="button" id="ps_check_all" value="' . wfMessage('powersearch-toggleall')->parse() . '" />
<input type="button" id="ps_check_none" value="' . wfMessage('powersearch-togglenone')->parse() . '" />
</div><br/>';
$wgOut->addModules('ext.pageschemas.generatepages');
// This hook will set an array of strings, with each value
// as a title of a page to be created.
$pageList = array();
foreach ($wgPageSchemasHandlerClasses as $psHandlerClass) {
$pagesFromHandler = call_user_func(array($psHandlerClass, "getPagesToGenerate"), $pageSchemaObj);
foreach ($pagesFromHandler as $page) {
$pageList[] = $page;
}
}
foreach ($pageList as $page) {
if (!$page instanceof Title) {
continue;
}
$pageName = PageSchemas::titleString($page);
$text .= Html::input('page[]', $pageName, 'checkbox', array('checked' => true));
$text .= "\n" . Linker::link($page) . "<br />\n";
}
$text .= "<br />\n";
$text .= Html::input(null, wfMessage('generatepages')->parse(), 'submit');
$text .= "\n</form>";
$wgOut->addHTML($text);
return true;
}
示例3: getInputHTML
function getInputHTML($value)
{
$attribs = array('id' => $this->mID, 'name' => $this->mName, 'size' => $this->getSize(), 'value' => $value) + $this->getTooltipAndAccessKey();
if ($this->mClass !== '') {
$attribs['class'] = $this->mClass;
}
# @todo Enforce pattern, step, required, readonly on the server side as
# well
$allowedParams = array('min', 'max', 'pattern', 'title', 'step', 'placeholder', 'list', 'maxlength', 'tabindex', 'disabled', 'required', 'autofocus', 'multiple', 'readonly');
$attribs += $this->getAttributes($allowedParams);
# Implement tiny differences between some field variants
# here, rather than creating a new class for each one which
# is essentially just a clone of this one.
$type = 'text';
if (isset($this->mParams['type'])) {
switch ($this->mParams['type']) {
case 'int':
$type = 'number';
break;
case 'float':
$type = 'number';
$attribs['step'] = 'any';
break;
# Pass through
# Pass through
case 'email':
case 'password':
case 'file':
case 'url':
$type = $this->mParams['type'];
break;
}
}
return Html::input($this->mName, $value, $type, $attribs);
}
示例4: getHTML
public static function getHTML($cur_value, $input_name, $is_mandatory, $is_disabled, $other_args)
{
global $sfgTabIndex, $sfgFieldNum, $sfgShowOnSelect;
$checkbox_class = $is_mandatory ? 'mandatoryField' : 'createboxInput';
$span_class = 'checkboxSpan';
if (array_key_exists('class', $other_args)) {
$span_class .= ' ' . $other_args['class'];
}
$input_id = "input_{$sfgFieldNum}";
// get list delimiter - default is comma
if (array_key_exists('delimiter', $other_args)) {
$delimiter = $other_args['delimiter'];
} else {
$delimiter = ',';
}
$cur_values = SFUtils::getValuesArray($cur_value, $delimiter);
if (($possible_values = $other_args['possible_values']) == null) {
$possible_values = array();
}
$text = '';
foreach ($possible_values as $key => $possible_value) {
$cur_input_name = $input_name . '[' . $key . ']';
if (array_key_exists('value_labels', $other_args) && is_array($other_args['value_labels']) && array_key_exists($possible_value, $other_args['value_labels'])) {
$label = $other_args['value_labels'][$possible_value];
} else {
$label = $possible_value;
}
$checkbox_attrs = array('id' => $input_id, 'tabindex' => $sfgTabIndex, 'class' => $checkbox_class);
if (in_array($possible_value, $cur_values)) {
$checkbox_attrs['checked'] = 'checked';
}
if ($is_disabled) {
$checkbox_attrs['disabled'] = 'disabled';
}
$checkbox_input = Html::input($cur_input_name, $possible_value, 'checkbox', $checkbox_attrs);
// Make a span around each checkbox, for CSS purposes.
$text .= "\t" . Html::rawElement('span', array('class' => $span_class), $checkbox_input . ' ' . $label) . "\n";
$sfgTabIndex++;
$sfgFieldNum++;
}
$outerSpanID = "span_{$sfgFieldNum}";
$outerSpanClass = 'checkboxesSpan';
if ($is_mandatory) {
$outerSpanClass .= ' mandatoryFieldSpan';
}
if (array_key_exists('show on select', $other_args)) {
$outerSpanClass .= ' sfShowIfChecked';
foreach ($other_args['show on select'] as $div_id => $options) {
if (array_key_exists($outerSpanID, $sfgShowOnSelect)) {
$sfgShowOnSelect[$outerSpanID][] = array($options, $div_id);
} else {
$sfgShowOnSelect[$outerSpanID] = array(array($options, $div_id));
}
}
}
$text .= Html::hidden($input_name . '[is_list]', 1);
$outerSpanAttrs = array('id' => $outerSpanID, 'class' => $outerSpanClass);
$text = "\t" . Html::rawElement('span', $outerSpanAttrs, $text) . "\n";
return $text;
}
示例5: getInputHTML
function getInputHTML($value)
{
$valInSelect = false;
if ($value !== false) {
$value = strval($value);
$valInSelect = in_array($value, HTMLFormField::flattenOptions($this->getOptions()), true);
}
$selected = $valInSelect ? $value : 'other';
$select = new XmlSelect($this->mName, $this->mID, $selected);
$select->addOptions($this->getOptions());
$select->setAttribute('class', 'mw-htmlform-select-or-other');
$tbAttribs = array('id' => $this->mID . '-other', 'size' => $this->getSize());
if (!empty($this->mParams['disabled'])) {
$select->setAttribute('disabled', 'disabled');
$tbAttribs['disabled'] = 'disabled';
}
if (isset($this->mParams['tabindex'])) {
$select->setAttribute('tabindex', $this->mParams['tabindex']);
$tbAttribs['tabindex'] = $this->mParams['tabindex'];
}
$select = $select->getHTML();
if (isset($this->mParams['maxlength'])) {
$tbAttribs['maxlength'] = $this->mParams['maxlength'];
}
if ($this->mClass !== '') {
$tbAttribs['class'] = $this->mClass;
}
$textbox = Html::input($this->mName . '-other', $valInSelect ? '' : $value, 'text', $tbAttribs);
return "{$select}<br />\n{$textbox}";
}
示例6: makeSearchForm
function makeSearchForm()
{
global $wgScript;
$fields = array();
$fields['edituser-username'] = Html::input('username', $this->target);
$thisTitle = $this->getTitle();
$form = Html::rawElement('form', array('method' => 'get', 'action' => $wgScript), Html::hidden('title', $this->getTitle()->getPrefixedDBkey()) . Xml::buildForm($fields, 'edituser-dosearch'));
return $form;
}
示例7: getForm
/**
* Produce a nice little form
* @param OutputPage $out
*/
function getForm(OutputPage $out)
{
list($sum, $answer) = $this->pickSum();
$index = $this->storeCaptcha(array('answer' => $answer));
$form = '<table><tr><td>' . $this->fetchMath($sum) . '</td>';
$form .= '<td>' . Html::input('wpCaptchaWord', false, false, array('tabindex' => '1', 'autocomplete' => 'off', 'required')) . '</td></tr></table>';
$form .= Html::hidden('wpCaptchaId', $index);
return $form;
}
示例8: showForm
private function showForm($err = '')
{
global $wgOut, $wgUser;
$wgOut->addWikiMsg('lockdbtext');
if ($err != '') {
$wgOut->setSubtitle(wfMsg('formerror'));
$wgOut->addHTML('<p class="error">' . htmlspecialchars($err) . "</p>\n");
}
$wgOut->addHTML(Html::openElement('form', array('id' => 'lockdb', 'method' => 'POST', 'action' => $this->getTitle()->getLocalURL('action=submit'))) . "\n" . wfMsgHtml('enterlockreason') . ":\n" . Html::textarea('wpLockReason', $this->reason, array('rows' => 4)) . "\n<table>\n\t<tr>\n\t\t" . Html::openElement('td', array('style' => 'text-align:right')) . "\n\t\t\t" . Html::input('wpLockConfirm', null, 'checkbox') . "\n\t\t</td>\n\t\t" . Html::openElement('td', array('style' => 'text-align:left')) . wfMsgHtml('lockconfirm') . "</td>\n\t</tr>\n\t<tr>\n\t\t<td> </td>\n\t\t" . Html::openElement('td', array('style' => 'text-align:left')) . "\n\t\t\t" . Html::input('wpLock', wfMsg('lockbtn'), 'submit') . "\n\t\t</td>\n\t</tr>\n</table>\n" . Html::hidden('wpEditToken', $wgUser->editToken()) . "\n" . Html::closeElement('form'));
}
示例9: execute
/**
* Executed when the user opens the DSMW administration special page
* Calculates the PushFeed list and the pullfeed list (and everything that
* is displayed on the psecial page
*
* @global <Object> $wgOut Output page instance
* @global <String> $wgServerName
* @global <String> $wgScriptPath
* @return <bool>
*/
public function execute()
{
global $wgOut, $wgRequest, $wgServerName, $wgScriptPath, $wgDSMWIP, $wgServerName, $wgScriptPath, $wgUser;
if (!$this->userCanExecute($wgUser)) {
// If the user is not authorized, show an error.
$this->displayRestrictionError();
return;
}
/**** Get status of refresh job, if any ****/
$dbr =& wfGetDB(DB_SLAVE);
$row = $dbr->selectRow('job', '*', array('job_cmd' => 'DSMWUpdateJob'), __METHOD__);
if ($row !== false) {
// similar to Job::pop_type, but without deleting the job
$title = Title::makeTitleSafe($row->job_namespace, $row->job_title);
$updatejob = Job::factory($row->job_cmd, $title, Job::extractBlob($row->job_params), $row->job_id);
} else {
$updatejob = NULL;
}
$row1 = $dbr->selectRow('job', '*', array('job_cmd' => 'DSMWPropertyTypeJob'), __METHOD__);
if ($row1 !== false) {
// similar to Job::pop_type, but without deleting the job
$title = Title::makeTitleSafe($row1->job_namespace, $row1->job_title);
$propertiesjob = Job::factory($row1->job_cmd, $title, Job::extractBlob($row1->job_params), $row1->job_id);
} else {
$propertiesjob = NULL;
}
/**** Execute actions if any ****/
$action = $wgRequest->getText('action');
if ($action == 'logootize') {
if ($updatejob === NULL) {
// careful, there might be race conditions here
$title = Title::makeTitle(NS_SPECIAL, 'DSMWAdmin');
$newjob = new DSMWUpdateJob($title);
$newjob->insert();
$wgOut->addHTML('<p><font color="red"><b>' . wfMsg('dsmw-special-admin-articleupstarted') . '</b></font></p>');
} else {
$wgOut->addHTML('<p><font color="red"><b>' . wfMsg('dsmw-special-admin-articleuprunning') . '</b></font></p>');
}
} elseif ($action == 'addProperties') {
if ($propertiesjob === NULL) {
$title1 = Title::makeTitle(NS_SPECIAL, 'DSMWAdmin');
$newjob1 = new DSMWPropertyTypeJob($title1);
$newjob1->insert();
$wgOut->addHTML('<p><font color="red"><b>' . wfMsg('dsmw-special-admin-typeupstarted') . '</b></font></p>');
} else {
$wgOut->addHTML('<p><font color="red"><b>' . wfMsg('dsmw-special-admin-typeuprunning') . '</b></font></p>');
}
}
$wgOut->setPagetitle('DSMW Settings');
$wgOut->addHTML(Html::element('p', array(), wfMsg('dsmw-special-admin-intro')));
$wgOut->addHTML(Html::rawElement('form', array('name' => 'properties', 'action' => '', 'method' => 'POST'), Html::hidden('action', 'addProperties') . '<br />' . Html::element('h2', array(), wfMsg('dsmw-special-admin-propheader')) . Html::element('p', array(), wfMsg('dsmw-special-admin-proptext')) . Html::input('updateProperties', wfMsg('dsmw-special-admin-propheader'), 'submit')));
$wgOut->addHTML(Html::rawElement('form', array('name' => 'logoot', 'action' => '', 'method' => 'POST'), Html::hidden('action', 'logootize') . '<br />' . Html::element('h2', array(), wfMsg('dsmw-special-admin-upheader')) . Html::element('p', array(), wfMsg('dsmw-special-admin-uptext')) . Html::input('updateArticles', wfMsg('dsmw-special-admin-upbutton'), 'submit')));
return false;
}
示例10: getInputHTML
function getInputHTML($value)
{
$select = parent::getInputHTML($value[1]);
$textAttribs = ['id' => $this->mID . '-other', 'size' => $this->getSize(), 'class' => ['mw-htmlform-select-and-other-field'], 'data-id-select' => $this->mID];
if ($this->mClass !== '') {
$textAttribs['class'][] = $this->mClass;
}
$allowedParams = ['required', 'autofocus', 'multiple', 'disabled', 'tabindex', 'maxlength'];
$textAttribs += $this->getAttributes($allowedParams);
$textbox = Html::input($this->mName . '-other', $value[2], 'text', $textAttribs);
return "{$select}<br />\n{$textbox}";
}
示例11: testRetornaClasseAnyComConfiguracaoPadrao
public function testRetornaClasseAnyComConfiguracaoPadrao()
{
Html::config(['input' => ['class' => 'form-input'], 'form' => ['class' => "form-horizontal"]]);
$username = Html::input(['attributes' => ['type' => 'text', 'name' => 'username']]);
$password = Html::input(['attributes' => ['type' => 'password', 'name' => 'password']]);
$form = Html::form(['attributes' => ['action' => 'save.php'], 'content' => $username . PHP_EOL . $password]);
$expected = '<form action="save.php" class="form-horizontal">';
$expected .= '<input type="text" name="username" class="form-input"/>' . PHP_EOL;
$expected .= '<input type="password" name="password" class="form-input"/>';
$expected .= '</form>';
$this->assertEquals($expected, (string) $form);
}
示例12: Html
function _before_edit()
{
$html = new Html();
$advertising_list = $this->get_advertising();
$input_data = join(',', $advertising_list);
$selected = $this->_mod->where(array('id' => $this->_get('id')))->getField('advertising');
$advertising = $html->input('select', 'advertising', $input_data, 'advertising', '', $selected);
$this->assign('advertising', $advertising);
//广告位
$this->assign('iframe_tools', true);
//iFrame弹窗
}
示例13: getInputHTML
function getInputHTML($value)
{
$select = parent::getInputHTML($value[1]);
$textAttribs = array('id' => $this->mID . '-other', 'size' => $this->getSize());
if ($this->mClass !== '') {
$textAttribs['class'] = $this->mClass;
}
$allowedParams = array('required', 'autofocus', 'multiple', 'disabled', 'tabindex');
$textAttribs += $this->getAttributes($allowedParams);
$textbox = Html::input($this->mName . '-other', $value[2], 'text', $textAttribs);
return "{$select}<br />\n{$textbox}";
}
示例14: displayAddNewControl
/**
* Displays a small form to add a new campaign.
*
* @since 0.1
*/
protected function displayAddNewControl()
{
$out = $this->getOutput();
$out->addHTML(Html::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLocalURL())));
$out->addHTML('<fieldset>');
$out->addHTML('<legend>' . htmlspecialchars(wfMsg('surveys-special-addnew')) . '</legend>');
$out->addHTML(Html::element('p', array(), wfMsg('surveys-special-namedoc')));
$out->addHTML(Html::element('label', array('for' => 'newcampaign'), wfMsg('surveys-special-newname')));
$out->addHTML(' ' . Html::input('newsurvey') . ' ');
$out->addHTML(Html::input('addnewsurvey', wfMsg('surveys-special-add'), 'submit'));
global $wgUser;
$out->addHTML(Html::hidden('wpEditToken', $wgUser->editToken()));
$out->addHTML('</fieldset></form>');
}
示例15: getInputHTML
function getInputHTML($value)
{
$attribs = array('id' => $this->mID, 'name' => $this->mName, 'size' => $this->getSize(), 'value' => $value, 'dir' => $this->mDir, 'spellcheck' => $this->getSpellCheck()) + $this->getTooltipAndAccessKey();
if ($this->mClass !== '') {
$attribs['class'] = $this->mClass;
}
# @todo Enforce pattern, step, required, readonly on the server side as
# well
$allowedParams = array('type', 'min', 'max', 'pattern', 'title', 'step', 'placeholder', 'list', 'maxlength', 'tabindex', 'disabled', 'required', 'autofocus', 'multiple', 'readonly');
$attribs += $this->getAttributes($allowedParams);
# Extract 'type'
$type = $this->getType($attribs);
return Html::input($this->mName, $value, $type, $attribs);
}