當前位置: 首頁>>代碼示例>>PHP>>正文


PHP HTMLForm::getMethod方法代碼示例

本文整理匯總了PHP中HTMLForm::getMethod方法的典型用法代碼示例。如果您正苦於以下問題:PHP HTMLForm::getMethod方法的具體用法?PHP HTMLForm::getMethod怎麽用?PHP HTMLForm::getMethod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在HTMLForm的用法示例。


在下文中一共展示了HTMLForm::getMethod方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getErrorsAndErrorClass

 /**
  * Determine form errors to display and their classes
  * @since 1.20
  *
  * @param string $value The value of the input
  * @return array
  */
 public function getErrorsAndErrorClass($value)
 {
     $errors = $this->validate($value, $this->mParent->mFieldData);
     if ($errors === true || !$this->mParent->getRequest()->wasPosted() && $this->mParent->getMethod() === 'post') {
         $errors = '';
         $errorClass = '';
     } else {
         $errors = self::formatErrors($errors);
         $errorClass = 'mw-htmlform-invalid-input';
     }
     return array($errors, $errorClass);
 }
開發者ID:biribogos,項目名稱:wikihow-src,代碼行數:19,代碼來源:HTMLFormField.php

示例2: getTableRow

 /**
  * Get the complete table row for the input, including help text,
  * labels, and whatever.
  * @param $value String the value to set the input to.
  * @return String complete HTML table row.
  */
 function getTableRow($value)
 {
     # Check for invalid data.
     $errors = $this->validate($value, $this->mParent->mFieldData);
     $cellAttributes = array();
     $verticalLabel = false;
     if (!empty($this->mParams['vertical-label'])) {
         $cellAttributes['colspan'] = 2;
         $verticalLabel = true;
     }
     if ($errors === true || !$this->mParent->getRequest()->wasPosted() && $this->mParent->getMethod() == 'post') {
         $errors = '';
         $errorClass = '';
     } else {
         $errors = self::formatErrors($errors);
         $errorClass = 'mw-htmlform-invalid-input';
     }
     $label = $this->getLabelHtml($cellAttributes);
     $field = Html::rawElement('td', array('class' => 'mw-input') + $cellAttributes, $this->getInputHTML($value) . "\n{$errors}");
     $fieldType = get_class($this);
     if ($verticalLabel) {
         $html = Html::rawElement('tr', array('class' => 'mw-htmlform-vertical-label'), $label);
         $html .= Html::rawElement('tr', array('class' => "mw-htmlform-field-{$fieldType} {$this->mClass} {$errorClass}"), $field);
     } else {
         $html = Html::rawElement('tr', array('class' => "mw-htmlform-field-{$fieldType} {$this->mClass} {$errorClass}"), $label . $field);
     }
     $helptext = null;
     if (isset($this->mParams['help-message'])) {
         $msg = wfMessage($this->mParams['help-message']);
         if ($msg->exists()) {
             $helptext = $msg->parse();
         }
     } elseif (isset($this->mParams['help-messages'])) {
         # help-message can be passed a message key (string) or an array containing
         # a message key and additional parameters. This makes it impossible to pass
         # an array of message key
         foreach ($this->mParams['help-messages'] as $name) {
             $msg = wfMessage($name);
             if ($msg->exists()) {
                 if (is_null($helptext)) {
                     $helptext = '';
                 } else {
                     $helptext .= wfMessage('word-separator')->escaped();
                     // some space
                 }
                 $helptext .= $msg->parse();
                 // append message
             }
         }
     } elseif (isset($this->mParams['help'])) {
         $helptext = $this->mParams['help'];
     }
     if (!is_null($helptext)) {
         $row = Html::rawElement('td', array('colspan' => 2, 'class' => 'htmlform-tip'), $helptext);
         $row = Html::rawElement('tr', array(), $row);
         $html .= "{$row}\n";
     }
     return $html;
 }
開發者ID:schwarer2006,項目名稱:wikia,代碼行數:65,代碼來源:HTMLForm.php

示例3: getTableRow

 /**
  * Get the complete table row for the input, including help text,
  * labels, and whatever.
  * @param $value String the value to set the input to.
  * @return String complete HTML table row.
  */
 function getTableRow($value)
 {
     # Check for invalid data.
     $errors = $this->validate($value, $this->mParent->mFieldData);
     $cellAttributes = array();
     $verticalLabel = false;
     if (!empty($this->mParams['vertical-label'])) {
         $cellAttributes['colspan'] = 2;
         $verticalLabel = true;
     }
     if ($errors === true || $this->mParent->blockSubmit || !$this->mParent->getRequest()->wasPosted() && $this->mParent->getMethod() == 'post') {
         $errors = '';
         $errorClass = '';
     } else {
         $errors = self::formatErrors($errors);
         $errorClass = 'mw-htmlform-invalid-input';
     }
     $helptext = null;
     if (isset($this->mParams['help-message'])) {
         // If msg has parameters (to be parsed by i18n logic, help-message is an array.
         if (is_array($this->mParams['help-message'])) {
             // Then first element is i18n id, the rest are parameters.
             $msg = wfMessage(array_shift($this->mParams['help-message']), $this->mParams['help-message']);
         } else {
             $msg = wfMessage($this->mParams['help-message']);
         }
         if ($msg->exists()) {
             $helptext = $msg->parse();
         }
     } elseif (isset($this->mParams['help-messages'])) {
         # help-message can be passed a message key (string) or an array containing
         # a message key and additional parameters. This makes it impossible to pass
         # an array of message key
         foreach ($this->mParams['help-messages'] as $name) {
             if (is_array($name)) {
                 $msg = wfMessage(array_shift($name), $name);
             } else {
                 $msg = wfMessage($name);
             }
             if ($msg->exists()) {
                 $helptext .= $msg->parse();
                 // append message
             }
         }
     } elseif (isset($this->mParams['help'])) {
         $helptext = $this->mParams['help'];
     }
     if (!is_null($helptext)) {
         $helptext = Html::rawElement('span', array('class' => 'sread help htmlform-tip'), $helptext);
     }
     $label = $this->getLabelHtml($cellAttributes);
     $field = $this->getInputHTML($value) . "\n{$errors}";
     $fieldType = get_class($this);
     if ($verticalLabel) {
         $html = Html::rawElement('p', array('class' => 'mw-htmlform-vertical-label'), $label);
         $html .= Html::rawElement('p', array('class' => "mw-htmlform-field-{$fieldType} {$this->mClass} {$errorClass}"), $field . $helptext);
     } else {
         $html = Html::rawElement('p', array('class' => "mw-htmlform-field-{$fieldType} {$this->mClass} {$errorClass}"), $label . $field . $helptext);
     }
     return $html;
 }
開發者ID:eFFemeer,項目名稱:seizamcore,代碼行數:67,代碼來源:HTMLFormS.php


注:本文中的HTMLForm::getMethod方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。