MDL-52081 forms: Use __construct() for constructors
This commit is contained in:
@@ -253,9 +253,9 @@ class HTML_QuickForm extends HTML_Common {
|
||||
* @param bool $trackSubmit (optional)Whether to track if the form was submitted by adding a special hidden field
|
||||
* @access public
|
||||
*/
|
||||
function HTML_QuickForm($formName='', $method='post', $action='', $target='', $attributes=null, $trackSubmit = false)
|
||||
public function __construct($formName='', $method='post', $action='', $target='', $attributes=null, $trackSubmit = false)
|
||||
{
|
||||
HTML_Common::HTML_Common($attributes);
|
||||
parent::__construct($attributes);
|
||||
$method = (strtoupper($method) == 'GET') ? 'get' : 'post';
|
||||
$action = ($action == '') ? $_SERVER['PHP_SELF'] : $action;
|
||||
$target = empty($target) ? array() : array('target' => $target);
|
||||
@@ -301,6 +301,16 @@ class HTML_QuickForm extends HTML_Common {
|
||||
}
|
||||
} // end constructor
|
||||
|
||||
/**
|
||||
* Old syntax of class constructor. Deprecated in PHP7.
|
||||
*
|
||||
* @deprecated since Moodle 3.1
|
||||
*/
|
||||
public function HTML_QuickForm($formName='', $method='post', $action='', $target='', $attributes=null, $trackSubmit = false) {
|
||||
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
|
||||
self::__construct($formName, $method, $action, $target, $attributes, $trackSubmit);
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ apiVersion()
|
||||
|
||||
@@ -1983,16 +1993,27 @@ class HTML_QuickForm_Error extends PEAR_Error {
|
||||
* @param int $level intensity of the error (PHP error code)
|
||||
* @param mixed $debuginfo any information that can inform user as to nature of the error
|
||||
*/
|
||||
function HTML_QuickForm_Error($code = QUICKFORM_ERROR, $mode = PEAR_ERROR_RETURN,
|
||||
public function __construct($code = QUICKFORM_ERROR, $mode = PEAR_ERROR_RETURN,
|
||||
$level = E_USER_NOTICE, $debuginfo = null)
|
||||
{
|
||||
if (is_int($code)) {
|
||||
$this->PEAR_Error(HTML_QuickForm::errorMessage($code), $code, $mode, $level, $debuginfo);
|
||||
parent::__construct(HTML_QuickForm::errorMessage($code), $code, $mode, $level, $debuginfo);
|
||||
} else {
|
||||
$this->PEAR_Error("Invalid error code: $code", QUICKFORM_ERROR, $mode, $level, $debuginfo);
|
||||
parent::__construct("Invalid error code: $code", QUICKFORM_ERROR, $mode, $level, $debuginfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Old syntax of class constructor. Deprecated in PHP7.
|
||||
*
|
||||
* @deprecated since Moodle 3.1
|
||||
*/
|
||||
public function HTML_QuickForm_Error($code = QUICKFORM_ERROR, $mode = PEAR_ERROR_RETURN,
|
||||
$level = E_USER_NOTICE, $debuginfo = null) {
|
||||
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
|
||||
self::__construct($code, $mode, $level, $debuginfo);
|
||||
}
|
||||
|
||||
// }}}
|
||||
} // end class HTML_QuickForm_Error
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user