MDL-52081 forms: Use __construct() for constructors

This commit is contained in:
Marina Glancy
2015-12-10 13:38:01 +08:00
parent 0dfcc2541a
commit 1a0df5535e
83 changed files with 1014 additions and 208 deletions
+12 -2
View File
@@ -68,7 +68,7 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element {
* or an associative array
* @param array $options set of options to initalize filepicker
*/
function MoodleQuickForm_editor($elementName=null, $elementLabel=null, $attributes=null, $options=null) {
public function __construct($elementName=null, $elementLabel=null, $attributes=null, $options=null) {
global $CFG, $PAGE;
$options = (array)$options;
@@ -89,7 +89,7 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element {
}
}
$this->_options['trusted'] = trusttext_trusted($this->_options['context']);
parent::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
parent::__construct($elementName, $elementLabel, $attributes);
// Note: for some reason the code using this setting does not like bools.
$this->_options['subdirs'] = (int)($this->_options['subdirs'] == 1);
@@ -97,6 +97,16 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element {
editors_head_setup();
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_editor($elementName=null, $elementLabel=null, $attributes=null, $options=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementLabel, $attributes, $options);
}
/**
* Called by HTML_QuickForm whenever form event is made on this element
*