diff --git a/blocks/edit_form.php b/blocks/edit_form.php index ad32113fe0f..57c9de8d5b9 100644 --- a/blocks/edit_form.php +++ b/blocks/edit_form.php @@ -54,7 +54,7 @@ class block_edit_form extends moodleform { global $CFG; $this->block = $block; $this->page = $page; - parent::moodleform($actionurl); + parent::__construct($actionurl); } function definition() { diff --git a/blocks/rss_client/editfeed.php b/blocks/rss_client/editfeed.php index 77e3097c30e..2b6d92a8a12 100644 --- a/blocks/rss_client/editfeed.php +++ b/blocks/rss_client/editfeed.php @@ -36,7 +36,7 @@ class feed_edit_form extends moodleform { function __construct($actionurl, $isadding, $caneditshared) { $this->isadding = $isadding; $this->caneditshared = $caneditshared; - parent::moodleform($actionurl); + parent::__construct($actionurl); } function definition() { diff --git a/course/moodleform_mod.php b/course/moodleform_mod.php index 4c8c25feab7..690dda8a834 100644 --- a/course/moodleform_mod.php +++ b/course/moodleform_mod.php @@ -58,7 +58,7 @@ abstract class moodleform_mod extends moodleform { /** @var object The course format of the current course. */ protected $courseformat; - function moodleform_mod($current, $section, $cm, $course) { + public function __construct($current, $section, $cm, $course) { global $CFG; $this->current = $current; @@ -83,7 +83,17 @@ abstract class moodleform_mod extends moodleform { } $this->_modname = $matches[1]; $this->init_features(); - parent::moodleform('modedit.php'); + parent::__construct('modedit.php'); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function moodleform_mod($current, $section, $cm, $course) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($current, $section, $cm, $course); } protected function init_features() { diff --git a/filter/local_settings_form.php b/filter/local_settings_form.php index 1721ffa74bc..fce01a19bb2 100644 --- a/filter/local_settings_form.php +++ b/filter/local_settings_form.php @@ -33,7 +33,7 @@ abstract class filter_local_settings_form extends moodleform { public function __construct($submiturl, $filter, $context) { $this->filter = $filter; $this->context = $context; - parent::moodleform($submiturl); + parent::__construct($submiturl); } /** diff --git a/grade/grading/form/guide/guideeditor.php b/grade/grading/form/guide/guideeditor.php index 902834c5166..a6e43a1973c 100644 --- a/grade/grading/form/guide/guideeditor.php +++ b/grade/grading/form/guide/guideeditor.php @@ -53,8 +53,18 @@ class moodlequickform_guideeditor extends HTML_QuickForm_input { * @param string $elementlabel * @param array $attributes */ + public function __construct($elementname=null, $elementlabel=null, $attributes=null) { + parent::__construct($elementname, $elementlabel, $attributes); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ public function moodlequickform_guideeditor($elementname=null, $elementlabel=null, $attributes=null) { - parent::HTML_QuickForm_input($elementname, $elementlabel, $attributes); + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementname, $elementlabel, $attributes); } /** diff --git a/grade/grading/form/rubric/rubriceditor.php b/grade/grading/form/rubric/rubriceditor.php index b3cc5bfb40e..d9901267257 100644 --- a/grade/grading/form/rubric/rubriceditor.php +++ b/grade/grading/form/rubric/rubriceditor.php @@ -60,8 +60,18 @@ class MoodleQuickForm_rubriceditor extends HTML_QuickForm_input { * @param string $elementLabel * @param array $attributes */ - function MoodleQuickForm_rubriceditor($elementName=null, $elementLabel=null, $attributes=null) { - parent::HTML_QuickForm_input($elementName, $elementLabel, $attributes); + public function __construct($elementName=null, $elementLabel=null, $attributes=null) { + parent::__construct($elementName, $elementLabel, $attributes); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_rubriceditor($elementName=null, $elementLabel=null, $attributes=null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementLabel, $attributes); } /** diff --git a/lib/form/advcheckbox.php b/lib/form/advcheckbox.php index 26ae788005f..ff679d44d27 100644 --- a/lib/form/advcheckbox.php +++ b/lib/form/advcheckbox.php @@ -55,7 +55,7 @@ class MoodleQuickForm_advcheckbox extends HTML_QuickForm_advcheckbox{ * or an associative array * @param mixed $values (optional) Values to pass if checked or not checked */ - function MoodleQuickForm_advcheckbox($elementName=null, $elementLabel=null, $text=null, $attributes=null, $values=null) + public function __construct($elementName=null, $elementLabel=null, $text=null, $attributes=null, $values=null) { if ($values === null){ $values = array(0, 1); @@ -81,7 +81,17 @@ class MoodleQuickForm_advcheckbox extends HTML_QuickForm_advcheckbox{ } } - parent::HTML_QuickForm_advcheckbox($elementName, $elementLabel, $text, $attributes, $values); + parent::__construct($elementName, $elementLabel, $text, $attributes, $values); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_advcheckbox($elementName=null, $elementLabel=null, $text=null, $attributes=null, $values=null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementLabel, $text, $attributes, $values); } /** diff --git a/lib/form/autocomplete.php b/lib/form/autocomplete.php index 206bc67b689..5cf63c25535 100644 --- a/lib/form/autocomplete.php +++ b/lib/form/autocomplete.php @@ -60,7 +60,7 @@ class MoodleQuickForm_autocomplete extends MoodleQuickForm_select { * @param mixed $attributes Either a typical HTML attribute string or an associative array. Special options * "tags", "placeholder", "ajax", "multiple", "casesensitive" are supported. */ - function MoodleQuickForm_autocomplete($elementName=null, $elementLabel=null, $options=null, $attributes=null) { + public function __construct($elementName=null, $elementLabel=null, $options=null, $attributes=null) { // Even if the constructor gets called twice we do not really want 2x options (crazy forms!). $this->_options = array(); if ($attributes === null) { @@ -87,11 +87,21 @@ class MoodleQuickForm_autocomplete extends MoodleQuickForm_select { $this->casesensitive = $attributes['casesensitive'] ? true : false; unset($attributes['casesensitive']); } - parent::HTML_QuickForm_select($elementName, $elementLabel, $options, $attributes); + parent::__construct($elementName, $elementLabel, $options, $attributes); $this->_type = 'autocomplete'; } + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_autocomplete($elementName=null, $elementLabel=null, $options=null, $attributes=null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementLabel, $options, $attributes); + } + /** * Returns HTML for select form element. * diff --git a/lib/form/button.php b/lib/form/button.php index bfa9615c142..a69e2171053 100644 --- a/lib/form/button.php +++ b/lib/form/button.php @@ -50,8 +50,18 @@ class MoodleQuickForm_button extends HTML_QuickForm_button * @param mixed $attributes (optional) Either a typical HTML attribute string * or an associative array */ - function MoodleQuickForm_button($elementName=null, $value=null, $attributes=null) { - parent::HTML_QuickForm_button($elementName, $value, $attributes); + public function __construct($elementName=null, $value=null, $attributes=null) { + parent::__construct($elementName, $value, $attributes); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_button($elementName=null, $value=null, $attributes=null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $value, $attributes); } /** diff --git a/lib/form/cancel.php b/lib/form/cancel.php index 6674377e911..2a5764f009b 100644 --- a/lib/form/cancel.php +++ b/lib/form/cancel.php @@ -52,7 +52,7 @@ class MoodleQuickForm_cancel extends MoodleQuickForm_submit * @param mixed $attributes (optional) Either a typical HTML attribute string * or an associative array */ - function MoodleQuickForm_cancel($elementName=null, $value=null, $attributes=null) + public function __construct($elementName=null, $value=null, $attributes=null) { if ($elementName==null){ $elementName='cancel'; @@ -60,7 +60,7 @@ class MoodleQuickForm_cancel extends MoodleQuickForm_submit if ($value==null){ $value=get_string('cancel'); } - MoodleQuickForm_submit::MoodleQuickForm_submit($elementName, $value, $attributes); + parent::__construct($elementName, $value, $attributes); $this->updateAttributes(array('onclick'=>'skipClientValidation = true; return true;')); // Add the class btn-cancel. @@ -71,6 +71,16 @@ class MoodleQuickForm_cancel extends MoodleQuickForm_submit $this->updateAttributes(array('class' => $class . ' btn-cancel')); } + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_cancel($elementName=null, $value=null, $attributes=null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $value, $attributes); + } + /** * Called by HTML_QuickForm whenever form event is made on this element * @@ -83,8 +93,7 @@ class MoodleQuickForm_cancel extends MoodleQuickForm_submit { switch ($event) { case 'createElement': - $className = get_class($this); - $this->$className($arg[0], $arg[1], $arg[2]); + static::__construct($arg[0], $arg[1], $arg[2]); $caller->_registerCancelButton($this->getName()); return true; break; diff --git a/lib/form/checkbox.php b/lib/form/checkbox.php index 37397da5189..8aaecdde1ab 100644 --- a/lib/form/checkbox.php +++ b/lib/form/checkbox.php @@ -52,8 +52,18 @@ class MoodleQuickForm_checkbox extends HTML_QuickForm_checkbox{ * @param mixed $attributes (optional) Either a typical HTML attribute string * or an associative array */ - function MoodleQuickForm_checkbox($elementName=null, $elementLabel=null, $text='', $attributes=null) { - parent::HTML_QuickForm_checkbox($elementName, $elementLabel, $text, $attributes); + public function __construct($elementName=null, $elementLabel=null, $text='', $attributes=null) { + parent::__construct($elementName, $elementLabel, $text, $attributes); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_checkbox($elementName=null, $elementLabel=null, $text='', $attributes=null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementLabel, $text, $attributes); } /** diff --git a/lib/form/dateselector.php b/lib/form/dateselector.php index 2332e990e41..29957e3d904 100644 --- a/lib/form/dateselector.php +++ b/lib/form/dateselector.php @@ -75,12 +75,13 @@ class MoodleQuickForm_date_selector extends MoodleQuickForm_group { * @param array $options Options to control the element's display * @param mixed $attributes Either a typical HTML attribute string or an associative array */ - function MoodleQuickForm_date_selector($elementName = null, $elementLabel = null, $options = array(), $attributes = null) { + public function __construct($elementName = null, $elementLabel = null, $options = array(), $attributes = null) { // Get the calendar type used - see MDL-18375. $calendartype = \core_calendar\type_factory::get_calendar_instance(); $this->_options = array('startyear' => $calendartype->get_min_year(), 'stopyear' => $calendartype->get_max_year(), 'defaulttime' => 0, 'timezone' => 99, 'step' => 5, 'optional' => false); - $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes); + // TODO MDL-52313 Replace with the call to parent::__construct(). + HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes); $this->_persistantFreeze = true; $this->_appendName = true; $this->_type = 'date_selector'; @@ -103,6 +104,16 @@ class MoodleQuickForm_date_selector extends MoodleQuickForm_group { } } + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_date_selector($elementName = null, $elementLabel = null, $options = array(), $attributes = null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementLabel, $options, $attributes); + } + /** * This will create date group element constisting of day, month and year. * diff --git a/lib/form/datetimeselector.php b/lib/form/datetimeselector.php index 3153f34c100..8055f026e6f 100644 --- a/lib/form/datetimeselector.php +++ b/lib/form/datetimeselector.php @@ -77,13 +77,14 @@ class MoodleQuickForm_date_time_selector extends MoodleQuickForm_group { * @param array $options Options to control the element's display * @param mixed $attributes Either a typical HTML attribute string or an associative array */ - function MoodleQuickForm_date_time_selector($elementName = null, $elementLabel = null, $options = array(), $attributes = null) { + public function __construct($elementName = null, $elementLabel = null, $options = array(), $attributes = null) { // Get the calendar type used - see MDL-18375. $calendartype = \core_calendar\type_factory::get_calendar_instance(); $this->_options = array('startyear' => $calendartype->get_min_year(), 'stopyear' => $calendartype->get_max_year(), 'defaulttime' => 0, 'timezone' => 99, 'step' => 5, 'optional' => false); - $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes); + // TODO MDL-52313 Replace with the call to parent::__construct(). + HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes); $this->_persistantFreeze = true; $this->_appendName = true; $this->_type = 'date_time_selector'; @@ -106,6 +107,16 @@ class MoodleQuickForm_date_time_selector extends MoodleQuickForm_group { } } + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_date_time_selector($elementName = null, $elementLabel = null, $options = array(), $attributes = null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementLabel, $options, $attributes); + } + /** * This will create date group element constisting of day, month and year. * diff --git a/lib/form/duration.php b/lib/form/duration.php index 4298f002150..ab2d43462ac 100644 --- a/lib/form/duration.php +++ b/lib/form/duration.php @@ -63,8 +63,9 @@ class MoodleQuickForm_duration extends MoodleQuickForm_group { * If not specified, minutes is used. * @param mixed $attributes Either a typical HTML attribute string or an associative array */ - function MoodleQuickForm_duration($elementName = null, $elementLabel = null, $options = array(), $attributes = null) { - $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes); + public function __construct($elementName = null, $elementLabel = null, $options = array(), $attributes = null) { + // TODO MDL-52313 Replace with the call to parent::__construct(). + HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes); $this->_persistantFreeze = true; $this->_appendName = true; $this->_type = 'duration'; @@ -83,6 +84,16 @@ class MoodleQuickForm_duration extends MoodleQuickForm_group { } } + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_duration($elementName = null, $elementLabel = null, $options = array(), $attributes = null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementLabel, $options, $attributes); + } + /** * Returns time associative array of unit length. * diff --git a/lib/form/editor.php b/lib/form/editor.php index 0c18b2122d0..4e06505dfb2 100644 --- a/lib/form/editor.php +++ b/lib/form/editor.php @@ -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 * diff --git a/lib/form/filemanager.php b/lib/form/filemanager.php index 8140fec153d..d5252531297 100644 --- a/lib/form/filemanager.php +++ b/lib/form/filemanager.php @@ -60,7 +60,7 @@ class MoodleQuickForm_filemanager extends HTML_QuickForm_element { * or an associative array * @param array $options set of options to initalize filemanager */ - function MoodleQuickForm_filemanager($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; @@ -76,7 +76,17 @@ class MoodleQuickForm_filemanager extends HTML_QuickForm_element { $this->_options['return_types'] = (FILE_INTERNAL | FILE_REFERENCE); } $this->_type = 'filemanager'; - parent::HTML_QuickForm_element($elementName, $elementLabel, $attributes); + parent::__construct($elementName, $elementLabel, $attributes); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_filemanager($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); } /** diff --git a/lib/form/filepicker.php b/lib/form/filepicker.php index da5aff8a3e1..16340963f20 100644 --- a/lib/form/filepicker.php +++ b/lib/form/filepicker.php @@ -59,7 +59,7 @@ class MoodleQuickForm_filepicker extends HTML_QuickForm_input { * or an associative array * @param array $options set of options to initalize filepicker */ - function MoodleQuickForm_filepicker($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; @@ -81,7 +81,17 @@ class MoodleQuickForm_filepicker extends HTML_QuickForm_input { } $this->_options['maxbytes'] = get_user_max_upload_file_size($PAGE->context, $CFG->maxbytes, $coursemaxbytes, $fpmaxbytes); $this->_type = 'filepicker'; - parent::HTML_QuickForm_input($elementName, $elementLabel, $attributes); + parent::__construct($elementName, $elementLabel, $attributes); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_filepicker($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); } /** diff --git a/lib/form/grading.php b/lib/form/grading.php index 18191dd6d40..c47de8a0ed3 100644 --- a/lib/form/grading.php +++ b/lib/form/grading.php @@ -61,11 +61,21 @@ class MoodleQuickForm_grading extends HTML_QuickForm_input{ * @param mixed $elementLabel Label(s) for the input field * @param mixed $attributes Either a typical HTML attribute string or an associative array */ - public function MoodleQuickForm_grading($elementName=null, $elementLabel=null, $attributes=null) { - parent::HTML_QuickForm_input($elementName, $elementLabel, $attributes); + public function __construct($elementName=null, $elementLabel=null, $attributes=null) { + parent::__construct($elementName, $elementLabel, $attributes); $this->gradingattributes = $attributes; } + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_grading($elementName=null, $elementLabel=null, $attributes=null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementLabel, $attributes); + } + /** * Helper function to retrieve gradingform_instance passed in element attributes * diff --git a/lib/form/group.php b/lib/form/group.php index 3d95d9f53db..753977f1087 100644 --- a/lib/form/group.php +++ b/lib/form/group.php @@ -50,8 +50,18 @@ class MoodleQuickForm_group extends HTML_QuickForm_group{ * @param string $separator (optional) string to seperate elements. * @param string $appendName (optional) string to appened to grouped elements. */ - function MoodleQuickForm_group($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true) { - parent::HTML_QuickForm_group($elementName, $elementLabel, $elements, $separator, $appendName); + public function __construct($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true) { + parent::__construct($elementName, $elementLabel, $elements, $separator, $appendName); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_group($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementLabel, $elements, $separator, $appendName); } /** @var string template type, would cause problems with client side validation so will leave for now */ diff --git a/lib/form/header.php b/lib/form/header.php index 36c5a08e6f3..f5f1ed57722 100644 --- a/lib/form/header.php +++ b/lib/form/header.php @@ -48,8 +48,18 @@ class MoodleQuickForm_header extends HTML_QuickForm_header * @param string $elementName name of the header element * @param string $text text displayed in header element */ - function MoodleQuickForm_header($elementName = null, $text = null) { - parent::HTML_QuickForm_header($elementName, $text); + public function __construct($elementName = null, $text = null) { + parent::__construct($elementName, $text); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_header($elementName = null, $text = null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $text); } /** diff --git a/lib/form/hidden.php b/lib/form/hidden.php index 6c2f239264b..d21c029a510 100644 --- a/lib/form/hidden.php +++ b/lib/form/hidden.php @@ -49,8 +49,18 @@ class MoodleQuickForm_hidden extends HTML_QuickForm_hidden{ * @param mixed $attributes (optional) Either a typical HTML attribute string * or an associative array */ - function MoodleQuickForm_hidden($elementName=null, $value='', $attributes=null) { - parent::HTML_QuickForm_hidden($elementName, $value, $attributes); + public function __construct($elementName=null, $value='', $attributes=null) { + parent::__construct($elementName, $value, $attributes); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_hidden($elementName=null, $value='', $attributes=null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + return self::__construct($elementName, $value, $attributes); } /** diff --git a/lib/form/htmleditor.php b/lib/form/htmleditor.php index adddc3fcf3e..32353d67376 100644 --- a/lib/form/htmleditor.php +++ b/lib/form/htmleditor.php @@ -54,8 +54,8 @@ class MoodleQuickForm_htmleditor extends MoodleQuickForm_textarea{ * @param array $attributes (optional) Either a typical HTML attribute string * or an associative array */ - function MoodleQuickForm_htmleditor($elementName=null, $elementLabel=null, $options=array(), $attributes=null){ - parent::MoodleQuickForm_textarea($elementName, $elementLabel, $attributes); + public function __construct($elementName=null, $elementLabel=null, $options=array(), $attributes=null){ + parent::__construct($elementName, $elementLabel, $attributes); // set the options, do not bother setting bogus ones if (is_array($options)) { foreach ($options as $name => $value) { @@ -73,6 +73,16 @@ class MoodleQuickForm_htmleditor extends MoodleQuickForm_textarea{ editors_head_setup(); } + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_htmleditor($elementName=null, $elementLabel=null, $options=array(), $attributes=null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementLabel, $options, $attributes); + } + /** * Returns the input field in HTML * diff --git a/lib/form/listing.php b/lib/form/listing.php index 102b4925715..cd9477cb33a 100644 --- a/lib/form/listing.php +++ b/lib/form/listing.php @@ -73,7 +73,7 @@ class MoodleQuickForm_listing extends HTML_QuickForm_input { * @param array $attributes (optional) Either a typical HTML attribute string or an associative array. * @param array $options set of options to initalize listing. */ - function MoodleQuickForm_listing($elementName=null, $elementLabel=null, $attributes=null, $options=array()) { + public function __construct($elementName=null, $elementLabel=null, $attributes=null, $options=array()) { $this->_type = 'listing'; if (!empty($options['items'])) { @@ -89,7 +89,17 @@ class MoodleQuickForm_listing extends HTML_QuickForm_input { } else { $this->hideall = get_string('hide'); } - parent::HTML_QuickForm_input($elementName, $elementLabel, $attributes); + parent::__construct($elementName, $elementLabel, $attributes); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_listing($elementName=null, $elementLabel=null, $attributes=null, $options=array()) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementLabel, $attributes, $options); } /** diff --git a/lib/form/modgrade.php b/lib/form/modgrade.php index d76122b7039..dd8ccce6fe1 100644 --- a/lib/form/modgrade.php +++ b/lib/form/modgrade.php @@ -53,13 +53,24 @@ class MoodleQuickForm_modgrade extends MoodleQuickForm_group{ * @param array $options Options to control the element's display. Not used. * @param mixed $attributes Either a typical HTML attribute string or an associative array */ - public function MoodleQuickForm_modgrade($elementname = null, $elementlabel = null, $options = array(), $attributes = null) { - $this->HTML_QuickForm_element($elementname, $elementlabel, $attributes); + public function __construct($elementname = null, $elementlabel = null, $options = array(), $attributes = null) { + // TODO MDL-52313 Replace with the call to parent::__construct(). + HTML_QuickForm_element::__construct($elementname, $elementlabel, $attributes); $this->_persistantFreeze = true; $this->_appendName = true; $this->_type = 'modgrade'; } + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_modgrade($elementname = null, $elementlabel = null, $options = array(), $attributes = null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementname, $elementlabel, $options, $attributes); + } + /** * Create elements for this group. */ diff --git a/lib/form/modvisible.php b/lib/form/modvisible.php index 2a6acd9437f..ddc4a6fba94 100644 --- a/lib/form/modvisible.php +++ b/lib/form/modvisible.php @@ -48,12 +48,20 @@ class MoodleQuickForm_modvisible extends MoodleQuickForm_select{ * @param mixed $attributes Either a typical HTML attribute string or an associative array * @param array $options ignored */ - function MoodleQuickForm_modvisible($elementName=null, $elementLabel=null, $attributes=null, $options=null) - { - HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes, null); + public function __construct($elementName=null, $elementLabel=null, $attributes=null, $options=null) { + // TODO MDL-52313 Replace with the call to parent::__construct(). + HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes, null); $this->_type = 'modvisible'; + } - + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_modvisible($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); } /** diff --git a/lib/form/password.php b/lib/form/password.php index 4265ec6fa1b..82153bca919 100644 --- a/lib/form/password.php +++ b/lib/form/password.php @@ -49,7 +49,7 @@ class MoodleQuickForm_password extends HTML_QuickForm_password{ * @param mixed $attributes (optional) Either a typical HTML attribute string * or an associative array */ - function MoodleQuickForm_password($elementName=null, $elementLabel=null, $attributes=null) { + public function __construct($elementName=null, $elementLabel=null, $attributes=null) { global $CFG; // no standard mform in moodle should allow autocomplete of passwords if (empty($attributes)) { @@ -62,7 +62,17 @@ class MoodleQuickForm_password extends HTML_QuickForm_password{ } } - parent::HTML_QuickForm_password($elementName, $elementLabel, $attributes); + parent::__construct($elementName, $elementLabel, $attributes); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_password($elementName=null, $elementLabel=null, $attributes=null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementLabel, $attributes); } /** diff --git a/lib/form/passwordunmask.php b/lib/form/passwordunmask.php index 15bd4bc35d2..b8d4102ea81 100644 --- a/lib/form/passwordunmask.php +++ b/lib/form/passwordunmask.php @@ -51,7 +51,7 @@ class MoodleQuickForm_passwordunmask extends MoodleQuickForm_password { * @param mixed $attributes (optional) Either a typical HTML attribute string * or an associative array */ - function MoodleQuickForm_passwordunmask($elementName=null, $elementLabel=null, $attributes=null) { + public function __construct($elementName=null, $elementLabel=null, $attributes=null) { global $CFG; // no standard mform in moodle should allow autocomplete of passwords if (empty($attributes)) { @@ -64,7 +64,17 @@ class MoodleQuickForm_passwordunmask extends MoodleQuickForm_password { } } - parent::MoodleQuickForm_password($elementName, $elementLabel, $attributes); + parent::__construct($elementName, $elementLabel, $attributes); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_passwordunmask($elementName=null, $elementLabel=null, $attributes=null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementLabel, $attributes); } /** diff --git a/lib/form/questioncategory.php b/lib/form/questioncategory.php index 4f7d9998ffd..8ebe1d0fd7f 100644 --- a/lib/form/questioncategory.php +++ b/lib/form/questioncategory.php @@ -53,8 +53,8 @@ class MoodleQuickForm_questioncategory extends MoodleQuickForm_selectgroups { * from moodlelib.php. * @param mixed $attributes Either a typical HTML attribute string or an associative array */ - function MoodleQuickForm_questioncategory($elementName = null, $elementLabel = null, $options = null, $attributes = null) { - MoodleQuickForm_selectgroups::MoodleQuickForm_selectgroups($elementName, $elementLabel, array(), $attributes); + public function __construct($elementName = null, $elementLabel = null, $options = null, $attributes = null) { + parent::__construct($elementName, $elementLabel, array(), $attributes); $this->_type = 'questioncategory'; if (is_array($options)) { $this->_options = $options + $this->_options; @@ -64,4 +64,13 @@ class MoodleQuickForm_questioncategory extends MoodleQuickForm_selectgroups { } } + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_questioncategory($elementName = null, $elementLabel = null, $options = null, $attributes = null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementLabel, $options, $attributes); + } } diff --git a/lib/form/radio.php b/lib/form/radio.php index 6aaa7809a0b..3f6a731872d 100644 --- a/lib/form/radio.php +++ b/lib/form/radio.php @@ -51,8 +51,18 @@ class MoodleQuickForm_radio extends HTML_QuickForm_radio{ * @param mixed $attributes (optional) Either a typical HTML attribute string * or an associative array */ - function MoodleQuickForm_radio($elementName=null, $elementLabel=null, $text=null, $value=null, $attributes=null) { - parent::HTML_QuickForm_radio($elementName, $elementLabel, $text, $value, $attributes); + public function __construct($elementName=null, $elementLabel=null, $text=null, $value=null, $attributes=null) { + parent::__construct($elementName, $elementLabel, $text, $value, $attributes); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_radio($elementName=null, $elementLabel=null, $text=null, $value=null, $attributes=null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementLabel, $text, $value, $attributes); } /** diff --git a/lib/form/recaptcha.php b/lib/form/recaptcha.php index 20800885627..f043353c3b2 100644 --- a/lib/form/recaptcha.php +++ b/lib/form/recaptcha.php @@ -53,9 +53,9 @@ class MoodleQuickForm_recaptcha extends HTML_QuickForm_input { * @param mixed $attributes (optional) Either a typical HTML attribute string * or an associative array */ - function MoodleQuickForm_recaptcha($elementName = null, $elementLabel = null, $attributes = null) { + public function __construct($elementName = null, $elementLabel = null, $attributes = null) { global $CFG; - parent::HTML_QuickForm_input($elementName, $elementLabel, $attributes); + parent::__construct($elementName, $elementLabel, $attributes); $this->_type = 'recaptcha'; if (is_https()) { $this->_https = true; @@ -64,6 +64,16 @@ class MoodleQuickForm_recaptcha extends HTML_QuickForm_input { } } + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_recaptcha($elementName = null, $elementLabel = null, $attributes = null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementLabel, $attributes); + } + /** * Returns the recaptcha element in HTML * diff --git a/lib/form/searchableselector.php b/lib/form/searchableselector.php index 681549bd72f..458a23c2d83 100644 --- a/lib/form/searchableselector.php +++ b/lib/form/searchableselector.php @@ -49,12 +49,22 @@ class MoodleQuickForm_searchableselector extends MoodleQuickForm_select{ * @param array $options additional options. * @param mixed $attributes Either a typical HTML attribute string or an associative array */ - function MoodleQuickForm_searchableselector($elementName=null, $elementLabel=null, $options=null, $attributes=null) { + public function __construct($elementName=null, $elementLabel=null, $options=null, $attributes=null) { //set size default to 12 if (empty($attributes) || empty($attributes['size'])) { $attributes['size'] = 12; } - parent::MoodleQuickForm_select($elementName, $elementLabel, $options, $attributes); + parent::__construct($elementName, $elementLabel, $options, $attributes); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_searchableselector($elementName=null, $elementLabel=null, $options=null, $attributes=null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementLabel, $options, $attributes); } /** diff --git a/lib/form/select.php b/lib/form/select.php index 8b0beba3920..aa888cb5627 100644 --- a/lib/form/select.php +++ b/lib/form/select.php @@ -52,8 +52,18 @@ class MoodleQuickForm_select extends HTML_QuickForm_select{ * @param mixed $options Data to be used to populate options * @param mixed $attributes Either a typical HTML attribute string or an associative array */ - function MoodleQuickForm_select($elementName=null, $elementLabel=null, $options=null, $attributes=null) { - parent::HTML_QuickForm_select($elementName, $elementLabel, $options, $attributes); + public function __construct($elementName=null, $elementLabel=null, $options=null, $attributes=null) { + parent::__construct($elementName, $elementLabel, $options, $attributes); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_select($elementName=null, $elementLabel=null, $options=null, $attributes=null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementLabel, $options, $attributes); } /** diff --git a/lib/form/selectgroups.php b/lib/form/selectgroups.php index 2d5dd635d31..c942acbdf5e 100644 --- a/lib/form/selectgroups.php +++ b/lib/form/selectgroups.php @@ -63,10 +63,10 @@ class MoodleQuickForm_selectgroups extends HTML_QuickForm_element { * @param mixed $attributes Either a typical HTML attribute string or an associative array * @param bool $showchoose add standard moodle "Choose..." option as first item */ - function MoodleQuickForm_selectgroups($elementName=null, $elementLabel=null, $optgrps=null, $attributes=null, $showchoose=false) + public function __construct($elementName=null, $elementLabel=null, $optgrps=null, $attributes=null, $showchoose=false) { $this->showchoose = $showchoose; - HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes); + parent::__construct($elementName, $elementLabel, $attributes); $this->_persistantFreeze = true; $this->_type = 'selectgroups'; if (isset($optgrps)) { @@ -74,6 +74,16 @@ class MoodleQuickForm_selectgroups extends HTML_QuickForm_element { } } + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_selectgroups($elementName=null, $elementLabel=null, $optgrps=null, $attributes=null, $showchoose=false) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementLabel, $optgrps, $attributes, $showchoose); + } + /** * Sets the default values of the select box * diff --git a/lib/form/selectwithlink.php b/lib/form/selectwithlink.php index 4377b316464..78832d9376b 100644 --- a/lib/form/selectwithlink.php +++ b/lib/form/selectwithlink.php @@ -62,8 +62,7 @@ class MoodleQuickForm_selectwithlink extends HTML_QuickForm_select{ * @param mixed $attributes Either a typical HTML attribute string or an associative array * @param bool $linkdata data to be posted */ - function MoodleQuickForm_selectwithlink($elementName=null, $elementLabel=null, $options=null, $attributes=null, $linkdata=null) - { + public function __construct($elementName=null, $elementLabel=null, $options=null, $attributes=null, $linkdata=null) { if (!empty($linkdata['link']) && !empty($linkdata['label'])) { $this->_link = $linkdata['link']; $this->_linklabel = $linkdata['label']; @@ -73,7 +72,17 @@ class MoodleQuickForm_selectwithlink extends HTML_QuickForm_select{ $this->_linkreturn = $linkdata['return']; } - parent::HTML_QuickForm_select($elementName, $elementLabel, $options, $attributes); + parent::__construct($elementName, $elementLabel, $options, $attributes); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_selectwithlink($elementName=null, $elementLabel=null, $options=null, $attributes=null, $linkdata=null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementLabel, $options, $attributes, $linkdata); } /** diff --git a/lib/form/selectyesno.php b/lib/form/selectyesno.php index d88a276c08c..7764fbb94e8 100644 --- a/lib/form/selectyesno.php +++ b/lib/form/selectyesno.php @@ -47,13 +47,23 @@ class MoodleQuickForm_selectyesno extends MoodleQuickForm_select{ * @param mixed $attributes Either a typical HTML attribute string or an associative array * @param mixed $options ignored, not used. */ - function MoodleQuickForm_selectyesno($elementName=null, $elementLabel=null, $attributes=null, $options=null) - { - HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes, null); + public function __construct($elementName=null, $elementLabel=null, $attributes=null, $options=null) { + // TODO MDL-52313 Replace with the call to parent::__construct(). + HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes, null); $this->_type = 'selectyesno'; $this->_persistantFreeze = true; } + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_selectyesno($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 * diff --git a/lib/form/static.php b/lib/form/static.php index 716b0268849..391be8e0cc7 100644 --- a/lib/form/static.php +++ b/lib/form/static.php @@ -51,8 +51,18 @@ class MoodleQuickForm_static extends HTML_QuickForm_static{ * @param string $elementLabel (optional) text field label * @param string $text (optional) Text to put in text field */ - function MoodleQuickForm_static($elementName=null, $elementLabel=null, $text=null) { - parent::HTML_QuickForm_static($elementName, $elementLabel, $text); + public function __construct($elementName=null, $elementLabel=null, $text=null) { + parent::__construct($elementName, $elementLabel, $text); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_static($elementName=null, $elementLabel=null, $text=null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementLabel, $text); } /** diff --git a/lib/form/submit.php b/lib/form/submit.php index af94e4f6872..c0e2d963803 100644 --- a/lib/form/submit.php +++ b/lib/form/submit.php @@ -45,8 +45,18 @@ class MoodleQuickForm_submit extends HTML_QuickForm_submit { * @param string $value (optional) field label * @param string $attributes (optional) Either a typical HTML attribute string or an associative array */ - function MoodleQuickForm_submit($elementName=null, $value=null, $attributes=null) { - parent::HTML_QuickForm_submit($elementName, $value, $attributes); + public function __construct($elementName=null, $value=null, $attributes=null) { + parent::__construct($elementName, $value, $attributes); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_submit($elementName=null, $value=null, $attributes=null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $value, $attributes); } /** diff --git a/lib/form/submitlink.php b/lib/form/submitlink.php index 9b7b5e0aa5e..bf238a51e31 100644 --- a/lib/form/submitlink.php +++ b/lib/form/submitlink.php @@ -51,8 +51,18 @@ class MoodleQuickForm_submitlink extends MoodleQuickForm_submit { * @param string $value (optional) field label * @param string $attributes (optional) Either a typical HTML attribute string or an associative array */ - function MoodleQuickForm_submitlink($elementName=null, $value=null, $attributes=null) { - parent::MoodleQuickForm_submit($elementName, $value, $attributes); + public function __construct($elementName=null, $value=null, $attributes=null) { + parent::__construct($elementName, $value, $attributes); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_submitlink($elementName=null, $value=null, $attributes=null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $value, $attributes); } /** diff --git a/lib/form/tags.php b/lib/form/tags.php index 961a2629921..a4727672634 100644 --- a/lib/form/tags.php +++ b/lib/form/tags.php @@ -71,7 +71,7 @@ class MoodleQuickForm_tags extends MoodleQuickForm_autocomplete { * @param array $options Options to control the element's display * @param mixed $attributes Either a typical HTML attribute string or an associative array. */ - function MoodleQuickForm_tags($elementName = null, $elementLabel = null, $options = array(), $attributes = null) { + public function __construct($elementName = null, $elementLabel = null, $options = array(), $attributes = null) { if (!isset($options['display'])) { $options['display'] = self::DEFAULTUI; } @@ -92,7 +92,17 @@ class MoodleQuickForm_tags extends MoodleQuickForm_autocomplete { $attributes['placeholder'] = get_string('entertags', 'tag'); $attributes['showsuggestions'] = $this->showingofficial; - parent::MoodleQuickForm_autocomplete($elementName, $elementLabel, $validoptions, $attributes); + parent::__construct($elementName, $elementLabel, $validoptions, $attributes); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_tags($elementName = null, $elementLabel = null, $options = array(), $attributes = null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementLabel, $options, $attributes); } /** diff --git a/lib/form/text.php b/lib/form/text.php index 97a0219eb71..a1af03b747e 100644 --- a/lib/form/text.php +++ b/lib/form/text.php @@ -51,8 +51,18 @@ class MoodleQuickForm_text extends HTML_QuickForm_text{ * @param string $elementLabel (optional) text field label * @param string $attributes (optional) Either a typical HTML attribute string or an associative array */ - function MoodleQuickForm_text($elementName=null, $elementLabel=null, $attributes=null) { - parent::HTML_QuickForm_text($elementName, $elementLabel, $attributes); + public function __construct($elementName=null, $elementLabel=null, $attributes=null) { + parent::__construct($elementName, $elementLabel, $attributes); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_text($elementName=null, $elementLabel=null, $attributes=null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementLabel, $attributes); } /** diff --git a/lib/form/textarea.php b/lib/form/textarea.php index f03b610726e..273fff5cb01 100644 --- a/lib/form/textarea.php +++ b/lib/form/textarea.php @@ -54,8 +54,18 @@ class MoodleQuickForm_textarea extends HTML_QuickForm_textarea{ * @param string $elementLabel (optional) text field label * @param string $attributes (optional) Either a typical HTML attribute string or an associative array */ - function MoodleQuickForm_textarea($elementName=null, $elementLabel=null, $attributes=null) { - parent::HTML_QuickForm_textarea($elementName, $elementLabel, $attributes); + public function __construct($elementName=null, $elementLabel=null, $attributes=null) { + parent::__construct($elementName, $elementLabel, $attributes); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_textarea($elementName=null, $elementLabel=null, $attributes=null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementLabel, $attributes); } /** diff --git a/lib/form/url.php b/lib/form/url.php index 2e624633281..4a22571136c 100644 --- a/lib/form/url.php +++ b/lib/form/url.php @@ -51,7 +51,7 @@ class MoodleQuickForm_url extends HTML_QuickForm_text{ * @param mixed $attributes Either a typical HTML attribute string or an associative array. * @param array $options data which need to be posted. */ - function MoodleQuickForm_url($elementName=null, $elementLabel=null, $attributes=null, $options=null) { + public function __construct($elementName=null, $elementLabel=null, $attributes=null, $options=null) { global $CFG; require_once("$CFG->dirroot/repository/lib.php"); $options = (array)$options; @@ -61,7 +61,17 @@ class MoodleQuickForm_url extends HTML_QuickForm_text{ if (!isset($this->_options['usefilepicker'])) { $this->_options['usefilepicker'] = true; } - parent::HTML_QuickForm_text($elementName, $elementLabel, $attributes); + parent::__construct($elementName, $elementLabel, $attributes); + } + + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_url($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); } /** diff --git a/lib/form/warning.php b/lib/form/warning.php index 90865ea1cc2..38c21a3d18e 100644 --- a/lib/form/warning.php +++ b/lib/form/warning.php @@ -53,8 +53,8 @@ class MoodleQuickForm_warning extends HTML_QuickForm_static{ * @param string $elementClass (optional) show as warning or notification => 'notifyproblem' * @param string $text (optional) Text to put in warning field */ - function MoodleQuickForm_warning($elementName=null, $elementClass='notifyproblem', $text=null) { - parent::HTML_QuickForm_static($elementName, null, $text); + public function __construct($elementName=null, $elementClass='notifyproblem', $text=null) { + parent::__construct($elementName, null, $text); $this->_type = 'warning'; if (is_null($elementClass)) { $elementClass = 'notifyproblem'; @@ -62,6 +62,16 @@ class MoodleQuickForm_warning extends HTML_QuickForm_static{ $this->_class = $elementClass; } + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function MoodleQuickForm_warning($elementName=null, $elementClass='notifyproblem', $text=null) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($elementName, $elementClass, $text); + } + /** * Returns HTML for this form element. * diff --git a/lib/formslib.php b/lib/formslib.php index e65979c7696..6192514b917 100644 --- a/lib/formslib.php +++ b/lib/formslib.php @@ -157,7 +157,7 @@ abstract class moodleform { * @param mixed $attributes you can pass a string of html attributes here or an array. * @param bool $editable */ - function moodleform($action=null, $customdata=null, $method='post', $target='', $attributes=null, $editable=true) { + public function __construct($action=null, $customdata=null, $method='post', $target='', $attributes=null, $editable=true) { global $CFG, $FULLME; // no standard mform in moodle should allow autocomplete with the exception of user signup if (empty($attributes)) { @@ -207,6 +207,16 @@ abstract class moodleform { $this->_process_submission($method); } + /** + * Old syntax of class constructor. Deprecated in PHP7. + * + * @deprecated since Moodle 3.1 + */ + public function moodleform($action=null, $customdata=null, $method='post', $target='', $attributes=null, $editable=true) { + debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); + self::__construct($action, $customdata, $method, $target, $attributes, $editable); + } + /** * It should returns unique identifier for the form. * Currently it will return class name, but in case two same forms have to be @@ -1426,12 +1436,13 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless { * @param string $target (optional)Form's target defaults to none * @param mixed $attributes (optional)Extra attributes for