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..805e4df1eec 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,14 @@ 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 for backward compatibility. + */ + public function moodleform_mod($current, $section, $cm, $course) { + 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..8580adba712 100644 --- a/grade/grading/form/guide/guideeditor.php +++ b/grade/grading/form/guide/guideeditor.php @@ -53,8 +53,15 @@ 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 for backward compatibility. + */ public function moodlequickform_guideeditor($elementname=null, $elementlabel=null, $attributes=null) { - parent::HTML_QuickForm_input($elementname, $elementlabel, $attributes); + self::__construct($elementname, $elementlabel, $attributes); } /** diff --git a/grade/grading/form/rubric/rubriceditor.php b/grade/grading/form/rubric/rubriceditor.php index b3cc5bfb40e..19b1839f53f 100644 --- a/grade/grading/form/rubric/rubriceditor.php +++ b/grade/grading/form/rubric/rubriceditor.php @@ -60,8 +60,15 @@ 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 for backward compatibility. + */ + public function MoodleQuickForm_rubriceditor($elementName=null, $elementLabel=null, $attributes=null) { + self::__construct($elementName, $elementLabel, $attributes); } /** diff --git a/lib/form/advcheckbox.php b/lib/form/advcheckbox.php index 26ae788005f..79cd5a47123 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,14 @@ 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 for backward compatibility. + */ + public function MoodleQuickForm_advcheckbox($elementName=null, $elementLabel=null, $text=null, $attributes=null, $values=null) { + self::__construct($elementName, $elementLabel, $text, $attributes, $values); } /** diff --git a/lib/form/autocomplete.php b/lib/form/autocomplete.php index 206bc67b689..7cbc349ed8b 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,18 @@ 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 for backward compatibility. + */ + public function MoodleQuickForm_autocomplete($elementName=null, $elementLabel=null, $options=null, $attributes=null) { + 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..3ed61e0b6d0 100644 --- a/lib/form/button.php +++ b/lib/form/button.php @@ -50,8 +50,15 @@ 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 for backward compatibility. + */ + public function MoodleQuickForm_button($elementName=null, $value=null, $attributes=null) { + self::__construct($elementName, $value, $attributes); } /** diff --git a/lib/form/cancel.php b/lib/form/cancel.php index 6674377e911..a6b0719f5fd 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,13 @@ class MoodleQuickForm_cancel extends MoodleQuickForm_submit $this->updateAttributes(array('class' => $class . ' btn-cancel')); } + /** + * Old syntax of class constructor for backward compatibility. + */ + public function MoodleQuickForm_cancel($elementName=null, $value=null, $attributes=null) { + self::__construct($elementName, $value, $attributes); + } + /** * Called by HTML_QuickForm whenever form event is made on this element * @@ -83,8 +90,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..330c6bb58f1 100644 --- a/lib/form/checkbox.php +++ b/lib/form/checkbox.php @@ -52,8 +52,15 @@ 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 for backward compatibility. + */ + public function MoodleQuickForm_checkbox($elementName=null, $elementLabel=null, $text='', $attributes=null) { + self::__construct($elementName, $elementLabel, $text, $attributes); } /** diff --git a/lib/form/dateselector.php b/lib/form/dateselector.php index 2332e990e41..b2b8448c9d4 100644 --- a/lib/form/dateselector.php +++ b/lib/form/dateselector.php @@ -75,12 +75,12 @@ 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); + HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes); $this->_persistantFreeze = true; $this->_appendName = true; $this->_type = 'date_selector'; @@ -103,6 +103,13 @@ class MoodleQuickForm_date_selector extends MoodleQuickForm_group { } } + /** + * Old syntax of class constructor for backward compatibility. + */ + public function MoodleQuickForm_date_selector($elementName = null, $elementLabel = null, $options = array(), $attributes = null) { + 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..7f7f3933195 100644 --- a/lib/form/datetimeselector.php +++ b/lib/form/datetimeselector.php @@ -77,13 +77,13 @@ 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); + HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes); $this->_persistantFreeze = true; $this->_appendName = true; $this->_type = 'date_time_selector'; @@ -106,6 +106,13 @@ class MoodleQuickForm_date_time_selector extends MoodleQuickForm_group { } } + /** + * Old syntax of class constructor for backward compatibility. + */ + public function MoodleQuickForm_date_time_selector($elementName = null, $elementLabel = null, $options = array(), $attributes = null) { + 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..7403105a936 100644 --- a/lib/form/duration.php +++ b/lib/form/duration.php @@ -63,8 +63,8 @@ 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) { + HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes); $this->_persistantFreeze = true; $this->_appendName = true; $this->_type = 'duration'; @@ -83,6 +83,13 @@ class MoodleQuickForm_duration extends MoodleQuickForm_group { } } + /** + * Old syntax of class constructor for backward compatibility. + */ + public function MoodleQuickForm_duration($elementName = null, $elementLabel = null, $options = array(), $attributes = null) { + 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..89d351e89a2 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,13 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element { editors_head_setup(); } + /** + * Old syntax of class constructor for backward compatibility. + */ + public function MoodleQuickForm_editor($elementName=null, $elementLabel=null, $attributes=null, $options=null) { + 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..7d08be2fbdc 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,14 @@ 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 for backward compatibility. + */ + public function MoodleQuickForm_filemanager($elementName=null, $elementLabel=null, $attributes=null, $options=null) { + self::__construct($elementName, $elementLabel, $attributes, $options); } /** diff --git a/lib/form/filepicker.php b/lib/form/filepicker.php index da5aff8a3e1..e927bd60b1b 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,14 @@ 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 for backward compatibility. + */ + public function MoodleQuickForm_filepicker($elementName=null, $elementLabel=null, $attributes=null, $options=null) { + self::__construct($elementName, $elementLabel, $attributes, $options); } /** diff --git a/lib/form/grading.php b/lib/form/grading.php index 18191dd6d40..3a5874d9d8a 100644 --- a/lib/form/grading.php +++ b/lib/form/grading.php @@ -61,11 +61,18 @@ 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 for backward compatibility. + */ + public function MoodleQuickForm_grading($elementName=null, $elementLabel=null, $attributes=null) { + 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..1abe520fe8f 100644 --- a/lib/form/group.php +++ b/lib/form/group.php @@ -50,8 +50,15 @@ 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 for backward compatibility. + */ + public function MoodleQuickForm_group($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true) { + 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..799796523d3 100644 --- a/lib/form/header.php +++ b/lib/form/header.php @@ -48,8 +48,15 @@ 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 for backward compatibility. + */ + public function MoodleQuickForm_header($elementName = null, $text = null) { + self::__construct($elementName, $text); } /** diff --git a/lib/form/hidden.php b/lib/form/hidden.php index 6c2f239264b..38754ca76a8 100644 --- a/lib/form/hidden.php +++ b/lib/form/hidden.php @@ -49,8 +49,15 @@ 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 for backward compatibility. + */ + public function MoodleQuickForm_hidden($elementName=null, $value='', $attributes=null) { + return self::__construct($elementName, $value, $attributes); } /** diff --git a/lib/form/htmleditor.php b/lib/form/htmleditor.php index adddc3fcf3e..e2f4d588364 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,13 @@ class MoodleQuickForm_htmleditor extends MoodleQuickForm_textarea{ editors_head_setup(); } + /** + * Old syntax of class constructor for backward compatibility. + */ + public function MoodleQuickForm_htmleditor($elementName=null, $elementLabel=null, $options=array(), $attributes=null) { + 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..9a3110e885d 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,14 @@ 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 for backward compatibility. + */ + public function MoodleQuickForm_listing($elementName=null, $elementLabel=null, $attributes=null, $options=array()) { + self::__construct($elementName, $elementLabel, $attributes, $options); } /** diff --git a/lib/form/modgrade.php b/lib/form/modgrade.php index d76122b7039..394eee676b4 100644 --- a/lib/form/modgrade.php +++ b/lib/form/modgrade.php @@ -53,13 +53,20 @@ 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) { + HTML_QuickForm_element::__construct($elementname, $elementlabel, $attributes); $this->_persistantFreeze = true; $this->_appendName = true; $this->_type = 'modgrade'; } + /** + * Old syntax of class constructor for backward compatibility. + */ + public function MoodleQuickForm_modgrade($elementname = null, $elementlabel = null, $options = array(), $attributes = null) { + 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..fdfe4a61712 100644 --- a/lib/form/modvisible.php +++ b/lib/form/modvisible.php @@ -48,12 +48,16 @@ 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) { + HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes, null); $this->_type = 'modvisible'; + } - + /** + * Old syntax of class constructor for backward compatibility. + */ + public function MoodleQuickForm_modvisible($elementName=null, $elementLabel=null, $attributes=null, $options=null) { + self::__construct($elementName, $elementLabel, $attributes, $options); } /** diff --git a/lib/form/password.php b/lib/form/password.php index 4265ec6fa1b..ddb156f2532 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,14 @@ class MoodleQuickForm_password extends HTML_QuickForm_password{ } } - parent::HTML_QuickForm_password($elementName, $elementLabel, $attributes); + parent::__construct($elementName, $elementLabel, $attributes); + } + + /** + * Old syntax of class constructor for backward compatibility. + */ + public function MoodleQuickForm_password($elementName=null, $elementLabel=null, $attributes=null) { + self::__construct($elementName, $elementLabel, $attributes); } /** diff --git a/lib/form/passwordunmask.php b/lib/form/passwordunmask.php index 15bd4bc35d2..e6cfe6972c5 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,14 @@ class MoodleQuickForm_passwordunmask extends MoodleQuickForm_password { } } - parent::MoodleQuickForm_password($elementName, $elementLabel, $attributes); + parent::__construct($elementName, $elementLabel, $attributes); + } + + /** + * Old syntax of class constructor for backward compatibility. + */ + public function MoodleQuickForm_passwordunmask($elementName=null, $elementLabel=null, $attributes=null) { + self::__construct($elementName, $elementLabel, $attributes); } /** diff --git a/lib/form/questioncategory.php b/lib/form/questioncategory.php index 4f7d9998ffd..f428f51eb13 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,10 @@ class MoodleQuickForm_questioncategory extends MoodleQuickForm_selectgroups { } } + /** + * Old syntax of class constructor for backward compatibility. + */ + public function MoodleQuickForm_questioncategory($elementName = null, $elementLabel = null, $options = null, $attributes = null) { + self::__construct($elementName, $elementLabel, $options, $attributes); + } } diff --git a/lib/form/radio.php b/lib/form/radio.php index 6aaa7809a0b..6d14918718e 100644 --- a/lib/form/radio.php +++ b/lib/form/radio.php @@ -51,8 +51,15 @@ 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 for backward compatibility. + */ + public function MoodleQuickForm_radio($elementName=null, $elementLabel=null, $text=null, $value=null, $attributes=null) { + self::__construct($elementName, $elementLabel, $text, $value, $attributes); } /** diff --git a/lib/form/recaptcha.php b/lib/form/recaptcha.php index 20800885627..8bd29fbb1d5 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,13 @@ class MoodleQuickForm_recaptcha extends HTML_QuickForm_input { } } + /** + * Old syntax of class constructor for backward compatibility. + */ + public function MoodleQuickForm_recaptcha($elementName = null, $elementLabel = null, $attributes = null) { + 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..e0af54da07d 100644 --- a/lib/form/searchableselector.php +++ b/lib/form/searchableselector.php @@ -49,12 +49,19 @@ 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 for backward compatibility. + */ + public function MoodleQuickForm_searchableselector($elementName=null, $elementLabel=null, $options=null, $attributes=null) { + self::__construct($elementName, $elementLabel, $options, $attributes); } /** diff --git a/lib/form/select.php b/lib/form/select.php index 8b0beba3920..1391fbec5e8 100644 --- a/lib/form/select.php +++ b/lib/form/select.php @@ -52,8 +52,15 @@ 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 for backward compatibility. + */ + public function MoodleQuickForm_select($elementName=null, $elementLabel=null, $options=null, $attributes=null) { + self::__construct($elementName, $elementLabel, $options, $attributes); } /** diff --git a/lib/form/selectgroups.php b/lib/form/selectgroups.php index 2d5dd635d31..b4f134a1ff2 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,13 @@ class MoodleQuickForm_selectgroups extends HTML_QuickForm_element { } } + /** + * Old syntax of class constructor for backward compatibility. + */ + public function MoodleQuickForm_selectgroups($elementName=null, $elementLabel=null, $optgrps=null, $attributes=null, $showchoose=false) { + 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..fedd321b69e 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,14 @@ 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 for backward compatibility. + */ + public function MoodleQuickForm_selectwithlink($elementName=null, $elementLabel=null, $options=null, $attributes=null, $linkdata=null) { + self::__construct($elementName, $elementLabel, $options, $attributes, $linkdata); } /** diff --git a/lib/form/selectyesno.php b/lib/form/selectyesno.php index d88a276c08c..333e573157b 100644 --- a/lib/form/selectyesno.php +++ b/lib/form/selectyesno.php @@ -47,13 +47,19 @@ 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) { + HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes, null); $this->_type = 'selectyesno'; $this->_persistantFreeze = true; } + /** + * Old syntax of class constructor for backward compatibility. + */ + public function MoodleQuickForm_selectyesno($elementName=null, $elementLabel=null, $attributes=null, $options=null) { + 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..b1d9c61e950 100644 --- a/lib/form/static.php +++ b/lib/form/static.php @@ -51,8 +51,15 @@ 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 for backward compatibility. + */ + public function MoodleQuickForm_static($elementName=null, $elementLabel=null, $text=null) { + self::__construct($elementName, $elementLabel, $text); } /** diff --git a/lib/form/submit.php b/lib/form/submit.php index af94e4f6872..986eab5d701 100644 --- a/lib/form/submit.php +++ b/lib/form/submit.php @@ -45,8 +45,15 @@ 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 for backward compatibility. + */ + public function MoodleQuickForm_submit($elementName=null, $value=null, $attributes=null) { + self::__construct($elementName, $value, $attributes); } /** diff --git a/lib/form/submitlink.php b/lib/form/submitlink.php index 9b7b5e0aa5e..0923a79827d 100644 --- a/lib/form/submitlink.php +++ b/lib/form/submitlink.php @@ -51,8 +51,15 @@ 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 for backward compatibility. + */ + public function MoodleQuickForm_submitlink($elementName=null, $value=null, $attributes=null) { + self::__construct($elementName, $value, $attributes); } /** diff --git a/lib/form/tags.php b/lib/form/tags.php index 961a2629921..5855723a155 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,14 @@ 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 for backward compatibility. + */ + public function MoodleQuickForm_tags($elementName = null, $elementLabel = null, $options = array(), $attributes = null) { + self::__construct($elementName, $elementLabel, $options, $attributes); } /** diff --git a/lib/form/text.php b/lib/form/text.php index 97a0219eb71..a071565eaf9 100644 --- a/lib/form/text.php +++ b/lib/form/text.php @@ -51,8 +51,15 @@ 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 for backward compatibility. + */ + public function MoodleQuickForm_text($elementName=null, $elementLabel=null, $attributes=null) { + self::__construct($elementName, $elementLabel, $attributes); } /** diff --git a/lib/form/textarea.php b/lib/form/textarea.php index f03b610726e..e051a2e5a1a 100644 --- a/lib/form/textarea.php +++ b/lib/form/textarea.php @@ -54,8 +54,15 @@ 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 for backward compatibility. + */ + public function MoodleQuickForm_textarea($elementName=null, $elementLabel=null, $attributes=null) { + self::__construct($elementName, $elementLabel, $attributes); } /** diff --git a/lib/form/url.php b/lib/form/url.php index 2e624633281..b3060f5c257 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,14 @@ 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 for backward compatibility. + */ + public function MoodleQuickForm_url($elementName=null, $elementLabel=null, $attributes=null, $options=null) { + self::__construct($elementName, $elementLabel, $attributes, $options); } /** diff --git a/lib/form/warning.php b/lib/form/warning.php index 90865ea1cc2..18ea771e8a1 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,13 @@ class MoodleQuickForm_warning extends HTML_QuickForm_static{ $this->_class = $elementClass; } + /** + * Old syntax of class constructor for backward compatibility. + */ + public function MoodleQuickForm_warning($elementName=null, $elementClass='notifyproblem', $text=null) { + self::__construct($elementName, $elementClass, $text); + } + /** * Returns HTML for this form element. * diff --git a/lib/formslib.php b/lib/formslib.php index e65979c7696..b35794803b1 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,13 @@ abstract class moodleform { $this->_process_submission($method); } + /** + * Old syntax of class constructor for backward compatibility. + */ + public function moodleform($action=null, $customdata=null, $method='post', $target='', $attributes=null, $editable=true) { + 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 +1433,12 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless { * @param string $target (optional)Form's target defaults to none * @param mixed $attributes (optional)Extra attributes for
tag */ - function MoodleQuickForm($formName, $method, $action, $target='', $attributes=null){ + public function __construct($formName, $method, $action, $target='', $attributes=null) { global $CFG, $OUTPUT; static $formcounter = 1; - HTML_Common::HTML_Common($attributes); + HTML_Common::__construct($attributes); $target = empty($target) ? array() : array('target' => $target); $this->_formName = $formName; if (is_a($action, 'moodle_url')){ @@ -1460,6 +1467,13 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless { $this->setRequiredNote(get_string('somefieldsrequired', 'form', ''.get_string('requiredelement', 'form').'')); } + /** + * Old syntax of class constructor for backward compatibility. + */ + public function MoodleQuickForm($formName, $method, $action, $target='', $attributes=null) { + self::__construct($formName, $method, $action, $target, $attributes); + } + /** * Use this method to indicate an element in a form is an advanced field. If items in a form * are marked as advanced then 'Hide/Show Advanced' buttons will automatically be displayed in the @@ -2594,7 +2608,7 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{ /** * Constructor */ - function MoodleQuickForm_Renderer(){ + public function __construct() { // switch next two lines for ol li containers for form items. // $this->_elementTemplates=array('default'=>"\n\t\t".'
  • {error}
    {element}
  • '); $this->_elementTemplates = array( @@ -2610,7 +2624,14 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{ 'nodisplay'=>''); - parent::HTML_QuickForm_Renderer_Tableless(); + parent::__construct(); + } + + /** + * Old syntax of class constructor for backward compatibility. + */ + public function MoodleQuickForm_Renderer() { + self::__construct(); } /** diff --git a/lib/pear/HTML/Common.php b/lib/pear/HTML/Common.php index 2c510109d0c..2f3ee3ddc7a 100644 --- a/lib/pear/HTML/Common.php +++ b/lib/pear/HTML/Common.php @@ -83,12 +83,19 @@ class HTML_Common { * @param int $tabOffset Indent offset in tabs * @access public */ - function HTML_Common($attributes = null, $tabOffset = 0) + public function __construct($attributes = null, $tabOffset = 0) { $this->setAttributes($attributes); $this->setTabOffset($tabOffset); } // end constructor + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_Common($attributes = null, $tabOffset = 0) { + self::__construct($attributes, $tabOffset); + } + public static function raiseError($message = null, $code = null, $mode = null, diff --git a/lib/pear/HTML/QuickForm.php b/lib/pear/HTML/QuickForm.php index 6da6ff4b1ad..dae5a80af7d 100644 --- a/lib/pear/HTML/QuickForm.php +++ b/lib/pear/HTML/QuickForm.php @@ -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,13 @@ class HTML_QuickForm extends HTML_Common { } } // end constructor + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm($formName='', $method='post', $action='', $target='', $attributes=null, $trackSubmit = false) { + self::__construct($formName, $method, $action, $target, $attributes, $trackSubmit); + } + // }}} // {{{ apiVersion() @@ -1983,16 +1990,24 @@ 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 for backward compatibility. + */ + public function HTML_QuickForm_Error($code = QUICKFORM_ERROR, $mode = PEAR_ERROR_RETURN, + $level = E_USER_NOTICE, $debuginfo = null) { + self::__construct($code, $mode, $level, $debuginfo); + } + // }}} } // end class HTML_QuickForm_Error ?> diff --git a/lib/pear/HTML/QuickForm/Renderer.php b/lib/pear/HTML/QuickForm/Renderer.php index 7162c641bb9..467534575ea 100644 --- a/lib/pear/HTML/QuickForm/Renderer.php +++ b/lib/pear/HTML/QuickForm/Renderer.php @@ -33,10 +33,16 @@ class HTML_QuickForm_Renderer * * @access public */ - function HTML_QuickForm_Renderer() - { + public function __construct() { } // end constructor + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_Renderer() { + self::__construct(); + } + /** * Called when visiting a form, before processing any form elements * diff --git a/lib/pear/HTML/QuickForm/Renderer/Array.php b/lib/pear/HTML/QuickForm/Renderer/Array.php index ee0c4ced7cf..47e49ef3c16 100644 --- a/lib/pear/HTML/QuickForm/Renderer/Array.php +++ b/lib/pear/HTML/QuickForm/Renderer/Array.php @@ -147,13 +147,18 @@ class HTML_QuickForm_Renderer_Array extends HTML_QuickForm_Renderer * @param bool true: render an array of labels to many labels, $key 0 to 'label' and the oterh to "label_$key" * @access public */ - function HTML_QuickForm_Renderer_Array($collectHidden = false, $staticLabels = false) - { - $this->HTML_QuickForm_Renderer(); + public function __construct($collectHidden = false, $staticLabels = false) { + parent::__construct(); $this->_collectHidden = $collectHidden; $this->_staticLabels = $staticLabels; } // end constructor + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_Renderer_Array($collectHidden = false, $staticLabels = false) { + self::__construct($collectHidden, $staticLabels); + } /** * Returns the resultant array diff --git a/lib/pear/HTML/QuickForm/Renderer/Default.php b/lib/pear/HTML/QuickForm/Renderer/Default.php index 5eeee14a141..b1444dc55c6 100644 --- a/lib/pear/HTML/QuickForm/Renderer/Default.php +++ b/lib/pear/HTML/QuickForm/Renderer/Default.php @@ -141,9 +141,15 @@ class HTML_QuickForm_Renderer_Default extends HTML_QuickForm_Renderer * * @access public */ - function HTML_QuickForm_Renderer_Default() - { - $this->HTML_QuickForm_Renderer(); + public function __construct() { + parent::__construct(); + } // end constructor + + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_Renderer_Default() { + self::__construct(); } // end constructor /** diff --git a/lib/pear/HTML/QuickForm/Renderer/Object.php b/lib/pear/HTML/QuickForm/Renderer/Object.php index 9ed495c7c64..8d00caecd5c 100644 --- a/lib/pear/HTML/QuickForm/Renderer/Object.php +++ b/lib/pear/HTML/QuickForm/Renderer/Object.php @@ -78,13 +78,19 @@ class HTML_QuickForm_Renderer_Object extends HTML_QuickForm_Renderer * @param collecthidden bool true: collect all hidden elements * @access public */ - function HTML_QuickForm_Renderer_Object($collecthidden = false) - { - $this->HTML_QuickForm_Renderer(); + public function __construct($collecthidden = false) { + parent::__construct(); $this->_collectHidden = $collecthidden; $this->_obj = new QuickformForm; } + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_Renderer_Object($collecthidden = false) { + self::__construct($collecthidden); + } + /** * Return the rendered Object * @access public diff --git a/lib/pear/HTML/QuickForm/Renderer/Tableless.php b/lib/pear/HTML/QuickForm/Renderer/Tableless.php index 7326ede66af..db8c48170f0 100644 --- a/lib/pear/HTML/QuickForm/Renderer/Tableless.php +++ b/lib/pear/HTML/QuickForm/Renderer/Tableless.php @@ -118,11 +118,17 @@ class HTML_QuickForm_Renderer_Tableless extends HTML_QuickForm_Renderer_Default * * @access public */ - function HTML_QuickForm_Renderer_Tableless() - { - $this->HTML_QuickForm_Renderer_Default(); + public function __construct() { + parent::__construct(); } // end constructor + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_Renderer_Tableless() { + self::__construct(); + } + /** * Called when visiting a header element * diff --git a/lib/pear/HTML/QuickForm/advcheckbox.php b/lib/pear/HTML/QuickForm/advcheckbox.php index cc14b715dbf..b01992bad39 100644 --- a/lib/pear/HTML/QuickForm/advcheckbox.php +++ b/lib/pear/HTML/QuickForm/advcheckbox.php @@ -77,12 +77,18 @@ class HTML_QuickForm_advcheckbox extends HTML_QuickForm_checkbox * @access public * @return void */ - function HTML_QuickForm_advcheckbox($elementName=null, $elementLabel=null, $text=null, $attributes=null, $values=null) - { - $this->HTML_QuickForm_checkbox($elementName, $elementLabel, $text, $attributes); + public function __construct($elementName=null, $elementLabel=null, $text=null, $attributes=null, $values=null) { + parent::__construct($elementName, $elementLabel, $text, $attributes); $this->setValues($values); } //end constructor + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_advcheckbox($elementName=null, $elementLabel=null, $text=null, $attributes=null, $values=null) { + self::__construct($elementName, $elementLabel, $text, $attributes, $values); + } + // }}} // {{{ getPrivateName() diff --git a/lib/pear/HTML/QuickForm/autocomplete.php b/lib/pear/HTML/QuickForm/autocomplete.php index c39bd8dec4c..635e98087e5 100644 --- a/lib/pear/HTML/QuickForm/autocomplete.php +++ b/lib/pear/HTML/QuickForm/autocomplete.php @@ -75,9 +75,8 @@ class HTML_QuickForm_autocomplete extends HTML_QuickForm_text * @access public * @return void */ - function HTML_QuickForm_autocomplete($elementName = null, $elementLabel = null, $options = null, $attributes = null) - { - $this->HTML_QuickForm_text($elementName, $elementLabel, $attributes); + public function __construct($elementName = null, $elementLabel = null, $options = null, $attributes = null) { + parent::__construct($elementName, $elementLabel, $attributes); $this->_persistantFreeze = true; $this->_type = 'autocomplete'; if (isset($options)) { @@ -85,6 +84,13 @@ class HTML_QuickForm_autocomplete extends HTML_QuickForm_text } } //end constructor + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_autocomplete($elementName = null, $elementLabel = null, $options = null, $attributes = null) { + self::__construct($elementName, $elementLabel, $options, $attributes); + } + // }}} // {{{ setOptions() diff --git a/lib/pear/HTML/QuickForm/button.php b/lib/pear/HTML/QuickForm/button.php index bf6f10e8738..43c8855515f 100644 --- a/lib/pear/HTML/QuickForm/button.php +++ b/lib/pear/HTML/QuickForm/button.php @@ -45,13 +45,19 @@ class HTML_QuickForm_button extends HTML_QuickForm_input * @access public * @return void */ - function HTML_QuickForm_button($elementName=null, $value=null, $attributes=null) - { - HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes); + public function __construct($elementName=null, $value=null, $attributes=null) { + parent::__construct($elementName, null, $attributes); $this->_persistantFreeze = false; $this->setValue($value); $this->setType('button'); } //end constructor + + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_button($elementName=null, $value=null, $attributes=null) { + self::__construct($elementName, $value, $attributes); + } // }}} // {{{ freeze() diff --git a/lib/pear/HTML/QuickForm/checkbox.php b/lib/pear/HTML/QuickForm/checkbox.php index 100f8e73417..9daf3da325f 100644 --- a/lib/pear/HTML/QuickForm/checkbox.php +++ b/lib/pear/HTML/QuickForm/checkbox.php @@ -57,15 +57,21 @@ class HTML_QuickForm_checkbox extends HTML_QuickForm_input * @access public * @return void */ - function HTML_QuickForm_checkbox($elementName=null, $elementLabel=null, $text='', $attributes=null) - { - HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes); + public function __construct($elementName=null, $elementLabel=null, $text='', $attributes=null) { + parent::__construct($elementName, $elementLabel, $attributes); $this->_persistantFreeze = true; $this->_text = $text; $this->setType('checkbox'); $this->updateAttributes(array('value'=>1)); } //end constructor - + + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_checkbox($elementName=null, $elementLabel=null, $text='', $attributes=null) { + self::__construct($elementName, $elementLabel, $text, $attributes); + } + // }}} // {{{ setChecked() diff --git a/lib/pear/HTML/QuickForm/date.php b/lib/pear/HTML/QuickForm/date.php index 495e76ebcff..0604adfdc22 100644 --- a/lib/pear/HTML/QuickForm/date.php +++ b/lib/pear/HTML/QuickForm/date.php @@ -266,9 +266,8 @@ class HTML_QuickForm_date extends HTML_QuickForm_group * @param array Options to control the element's display * @param mixed Either a typical HTML attribute string or an associative array */ - function HTML_QuickForm_date($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) { + HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes); $this->_persistantFreeze = true; $this->_appendName = true; $this->_type = 'date'; @@ -288,6 +287,13 @@ class HTML_QuickForm_date extends HTML_QuickForm_group } } + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_date($elementName = null, $elementLabel = null, $options = array(), $attributes = null) { + self::__construct($elementName, $elementLabel, $options, $attributes); + } + // }}} // {{{ _createElements() diff --git a/lib/pear/HTML/QuickForm/element.php b/lib/pear/HTML/QuickForm/element.php index a0a600c45f5..19e64ddcae8 100644 --- a/lib/pear/HTML/QuickForm/element.php +++ b/lib/pear/HTML/QuickForm/element.php @@ -80,9 +80,8 @@ class HTML_QuickForm_element extends HTML_Common * @access public * @return void */ - function HTML_QuickForm_element($elementName=null, $elementLabel=null, $attributes=null) - { - HTML_Common::HTML_Common($attributes); + public function __construct($elementName=null, $elementLabel=null, $attributes=null) { + parent::__construct($attributes); if (isset($elementName)) { $this->setName($elementName); } @@ -90,6 +89,13 @@ class HTML_QuickForm_element extends HTML_Common $this->setLabel($elementLabel); } } //end constructor + + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_element($elementName=null, $elementLabel=null, $attributes=null) { + self::__construct($elementName, $elementLabel, $attributes); + } // }}} // {{{ apiVersion() @@ -359,8 +365,7 @@ class HTML_QuickForm_element extends HTML_Common { switch ($event) { case 'createElement': - $className = get_class($this); - $this->$className($arg[0], $arg[1], $arg[2], $arg[3], $arg[4]); + static::__construct($arg[0], $arg[1], $arg[2], $arg[3], $arg[4]); break; case 'addElement': $this->onQuickFormEvent('createElement', $arg, $caller); diff --git a/lib/pear/HTML/QuickForm/file.php b/lib/pear/HTML/QuickForm/file.php index a8906f55c93..7f3b1dde983 100644 --- a/lib/pear/HTML/QuickForm/file.php +++ b/lib/pear/HTML/QuickForm/file.php @@ -61,12 +61,18 @@ class HTML_QuickForm_file extends HTML_QuickForm_input * @since 1.0 * @access public */ - function HTML_QuickForm_file($elementName=null, $elementLabel=null, $attributes=null) - { - HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes); + public function __construct($elementName=null, $elementLabel=null, $attributes=null) { + parent::__construct($elementName, $elementLabel, $attributes); $this->setType('file'); } //end constructor - + + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_file($elementName=null, $elementLabel=null, $attributes=null) { + self::__construct($elementName, $elementLabel, $attributes); + } + // }}} // {{{ setSize() @@ -176,8 +182,7 @@ class HTML_QuickForm_file extends HTML_QuickForm_input return $this->onQuickFormEvent('updateValue', null, $caller); break; case 'createElement': - $className = get_class($this); - $this->$className($arg[0], $arg[1], $arg[2]); + static::__construct($arg[0], $arg[1], $arg[2], $arg[3], $arg[4]); break; } return true; diff --git a/lib/pear/HTML/QuickForm/group.php b/lib/pear/HTML/QuickForm/group.php index 229d6979e84..47aa7e37403 100644 --- a/lib/pear/HTML/QuickForm/group.php +++ b/lib/pear/HTML/QuickForm/group.php @@ -92,9 +92,8 @@ class HTML_QuickForm_group extends HTML_QuickForm_element * @access public * @return void */ - function HTML_QuickForm_group($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true) - { - $this->HTML_QuickForm_element($elementName, $elementLabel); + public function __construct($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true) { + parent::__construct($elementName, $elementLabel); $this->_type = 'group'; if (isset($elements) && is_array($elements)) { $this->setElements($elements); @@ -107,6 +106,13 @@ class HTML_QuickForm_group extends HTML_QuickForm_element } } //end constructor + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_group($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true) { + self::__construct($elementName, $elementLabel, $elements, $separator, $appendName); + } + // }}} // {{{ setName() diff --git a/lib/pear/HTML/QuickForm/header.php b/lib/pear/HTML/QuickForm/header.php index b13eb2df4db..64c1eb23349 100644 --- a/lib/pear/HTML/QuickForm/header.php +++ b/lib/pear/HTML/QuickForm/header.php @@ -38,12 +38,18 @@ class HTML_QuickForm_header extends HTML_QuickForm_static * @access public * @return void */ - function HTML_QuickForm_header($elementName = null, $text = null) - { - $this->HTML_QuickForm_static($elementName, null, $text); + public function __construct($elementName = null, $text = null) { + parent::__construct($elementName, null, $text); $this->_type = 'header'; } + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_header($elementName = null, $text = null) { + self::__construct($elementName, $text); + } + // }}} // {{{ accept() diff --git a/lib/pear/HTML/QuickForm/hidden.php b/lib/pear/HTML/QuickForm/hidden.php index e758aeef81d..6143bd6408d 100644 --- a/lib/pear/HTML/QuickForm/hidden.php +++ b/lib/pear/HTML/QuickForm/hidden.php @@ -45,13 +45,19 @@ class HTML_QuickForm_hidden extends HTML_QuickForm_input * @access public * @return void */ - function HTML_QuickForm_hidden($elementName=null, $value='', $attributes=null) - { - HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes); + public function __construct($elementName=null, $value='', $attributes=null) { + parent::__construct($elementName, null, $attributes); $this->setType('hidden'); $this->setValue($value); } //end constructor + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_hidden($elementName=null, $value='', $attributes=null) { + return self::__construct($elementName, $value, $attributes); + } + // }}} // {{{ freeze() diff --git a/lib/pear/HTML/QuickForm/hiddenselect.php b/lib/pear/HTML/QuickForm/hiddenselect.php index 458aa5c3ddc..c63e706e8d8 100644 --- a/lib/pear/HTML/QuickForm/hiddenselect.php +++ b/lib/pear/HTML/QuickForm/hiddenselect.php @@ -49,9 +49,8 @@ class HTML_QuickForm_hiddenselect extends HTML_QuickForm_select * @access public * @return void */ - function HTML_QuickForm_hiddenselect($elementName=null, $elementLabel=null, $options=null, $attributes=null) - { - HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes); + public function __construct($elementName=null, $elementLabel=null, $options=null, $attributes=null) { + HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes); $this->_persistantFreeze = true; $this->_type = 'hiddenselect'; if (isset($options)) { @@ -59,6 +58,13 @@ class HTML_QuickForm_hiddenselect extends HTML_QuickForm_select } } //end constructor + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_hiddenselect($elementName=null, $elementLabel=null, $options=null, $attributes=null) { + self::__construct($elementName, $elementLabel, $options, $attributes); + } + // }}} // {{{ toHtml() diff --git a/lib/pear/HTML/QuickForm/hierselect.php b/lib/pear/HTML/QuickForm/hierselect.php index 25de46686df..dc3826ff1d7 100644 --- a/lib/pear/HTML/QuickForm/hierselect.php +++ b/lib/pear/HTML/QuickForm/hierselect.php @@ -114,9 +114,8 @@ class HTML_QuickForm_hierselect extends HTML_QuickForm_group * @access public * @return void */ - function HTML_QuickForm_hierselect($elementName=null, $elementLabel=null, $attributes=null, $separator=null) - { - $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes); + public function __construct($elementName=null, $elementLabel=null, $attributes=null, $separator=null) { + HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes); $this->_persistantFreeze = true; if (isset($separator)) { $this->_separator = $separator; @@ -125,6 +124,13 @@ class HTML_QuickForm_hierselect extends HTML_QuickForm_group $this->_appendName = true; } //end constructor + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_hierselect($elementName=null, $elementLabel=null, $attributes=null, $separator=null) { + self::__construct($elementName, $elementLabel, $attributes, $separator); + } + // }}} // {{{ setOptions() diff --git a/lib/pear/HTML/QuickForm/html.php b/lib/pear/HTML/QuickForm/html.php index 10b773e1372..a2842f4aa2a 100644 --- a/lib/pear/HTML/QuickForm/html.php +++ b/lib/pear/HTML/QuickForm/html.php @@ -40,12 +40,18 @@ class HTML_QuickForm_html extends HTML_QuickForm_static * @access public * @return void */ - function HTML_QuickForm_html($text = null) - { - $this->HTML_QuickForm_static(null, null, $text); + public function __construct($text = null) { + parent::__construct(null, null, $text); $this->_type = 'html'; } + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_html($text = null) { + self::__construct($text); + } + // }}} // {{{ accept() diff --git a/lib/pear/HTML/QuickForm/image.php b/lib/pear/HTML/QuickForm/image.php index a3cc2e37c2c..0e28b47762e 100644 --- a/lib/pear/HTML/QuickForm/image.php +++ b/lib/pear/HTML/QuickForm/image.php @@ -44,13 +44,19 @@ class HTML_QuickForm_image extends HTML_QuickForm_input * @access public * @return void */ - function HTML_QuickForm_image($elementName=null, $src='', $attributes=null) - { - HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes); + public function __construct($elementName=null, $src='', $attributes=null) { + parent::__construct($elementName, null, $attributes); $this->setType('image'); $this->setSource($src); } // end class constructor + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_image($elementName=null, $src='', $attributes=null) { + self::__construct($elementName, $src, $attributes); + } + // }}} // {{{ setSource() diff --git a/lib/pear/HTML/QuickForm/input.php b/lib/pear/HTML/QuickForm/input.php index f182e7e4dd1..d753fe6d5ac 100644 --- a/lib/pear/HTML/QuickForm/input.php +++ b/lib/pear/HTML/QuickForm/input.php @@ -45,11 +45,17 @@ class HTML_QuickForm_input extends HTML_QuickForm_element * @access public * @return void */ - function HTML_QuickForm_input($elementName=null, $elementLabel=null, $attributes=null) - { - $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes); + public function __construct($elementName=null, $elementLabel=null, $attributes=null) { + parent::__construct($elementName, $elementLabel, $attributes); } //end constructor + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_input($elementName=null, $elementLabel=null, $attributes=null) { + self::__construct($elementName, $elementLabel, $attributes); + } + // }}} // {{{ setType() diff --git a/lib/pear/HTML/QuickForm/link.php b/lib/pear/HTML/QuickForm/link.php index 947f76c32bd..52ea0b8a3e2 100644 --- a/lib/pear/HTML/QuickForm/link.php +++ b/lib/pear/HTML/QuickForm/link.php @@ -57,15 +57,21 @@ class HTML_QuickForm_link extends HTML_QuickForm_static * @return void * @throws */ - function HTML_QuickForm_link($elementName=null, $elementLabel=null, $href=null, $text=null, $attributes=null) - { - HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes); + public function __construct($elementName=null, $elementLabel=null, $href=null, $text=null, $attributes=null) { + HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes); $this->_persistantFreeze = false; $this->_type = 'link'; $this->setHref($href); $this->_text = $text; } //end constructor - + + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_link($elementName=null, $elementLabel=null, $href=null, $text=null, $attributes=null) { + self::__construct($elementName, $elementLabel, $href, $text, $attributes); + } + // }}} // {{{ setName() diff --git a/lib/pear/HTML/QuickForm/password.php b/lib/pear/HTML/QuickForm/password.php index a83d5053e38..6d46099afa3 100644 --- a/lib/pear/HTML/QuickForm/password.php +++ b/lib/pear/HTML/QuickForm/password.php @@ -46,11 +46,17 @@ class HTML_QuickForm_password extends HTML_QuickForm_input * @return void * @throws */ - function HTML_QuickForm_password($elementName=null, $elementLabel=null, $attributes=null) - { - HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes); + public function __construct($elementName=null, $elementLabel=null, $attributes=null) { + parent::__construct($elementName, $elementLabel, $attributes); $this->setType('password'); } //end constructor + + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_password($elementName=null, $elementLabel=null, $attributes=null) { + self::__construct($elementName, $elementLabel, $attributes); + } // }}} // {{{ setSize() diff --git a/lib/pear/HTML/QuickForm/radio.php b/lib/pear/HTML/QuickForm/radio.php index 26320267668..3eec2e4d054 100644 --- a/lib/pear/HTML/QuickForm/radio.php +++ b/lib/pear/HTML/QuickForm/radio.php @@ -57,9 +57,8 @@ class HTML_QuickForm_radio extends HTML_QuickForm_input * @access public * @return void */ - function HTML_QuickForm_radio($elementName=null, $elementLabel=null, $text=null, $value=null, $attributes=null) - { - $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes); + public function __construct($elementName=null, $elementLabel=null, $text=null, $value=null, $attributes=null) { + HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes); if (isset($value)) { $this->setValue($value); } @@ -68,6 +67,13 @@ class HTML_QuickForm_radio extends HTML_QuickForm_input $this->_text = $text; } //end constructor + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_radio($elementName=null, $elementLabel=null, $text=null, $value=null, $attributes=null) { + self::__construct($elementName, $elementLabel, $text, $value, $attributes); + } + // }}} function _generateId() { diff --git a/lib/pear/HTML/QuickForm/reset.php b/lib/pear/HTML/QuickForm/reset.php index 35336530866..99c2ad95b66 100644 --- a/lib/pear/HTML/QuickForm/reset.php +++ b/lib/pear/HTML/QuickForm/reset.php @@ -45,13 +45,19 @@ class HTML_QuickForm_reset extends HTML_QuickForm_input * @access public * @return void */ - function HTML_QuickForm_reset($elementName=null, $value=null, $attributes=null) - { - HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes); + public function __construct($elementName=null, $value=null, $attributes=null) { + parent::__construct($elementName, null, $attributes); $this->setValue($value); $this->setType('reset'); } //end constructor + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_reset($elementName=null, $value=null, $attributes=null) { + self::__construct($elementName, $value, $attributes); + } + // }}} // {{{ freeze() diff --git a/lib/pear/HTML/QuickForm/select.php b/lib/pear/HTML/QuickForm/select.php index f15ad8bcb29..192086a9bc7 100644 --- a/lib/pear/HTML/QuickForm/select.php +++ b/lib/pear/HTML/QuickForm/select.php @@ -66,15 +66,21 @@ class HTML_QuickForm_select extends HTML_QuickForm_element { * @access public * @return void */ - function HTML_QuickForm_select($elementName=null, $elementLabel=null, $options=null, $attributes=null) - { - HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes); + public function __construct($elementName=null, $elementLabel=null, $options=null, $attributes=null) { + parent::__construct($elementName, $elementLabel, $attributes); $this->_persistantFreeze = true; $this->_type = 'select'; if (isset($options)) { $this->load($options); } } //end constructor + + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_select($elementName=null, $elementLabel=null, $options=null, $attributes=null) { + self::__construct($elementName, $elementLabel, $attributes); + } // }}} // {{{ apiVersion() diff --git a/lib/pear/HTML/QuickForm/static.php b/lib/pear/HTML/QuickForm/static.php index 69879312afa..d466d30e21e 100644 --- a/lib/pear/HTML/QuickForm/static.php +++ b/lib/pear/HTML/QuickForm/static.php @@ -49,14 +49,20 @@ class HTML_QuickForm_static extends HTML_QuickForm_element { * @access public * @return void */ - function HTML_QuickForm_static($elementName=null, $elementLabel=null, $text=null) - { - HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel); + public function __construct($elementName=null, $elementLabel=null, $text=null) { + parent::__construct($elementName, $elementLabel); $this->_persistantFreeze = false; $this->_type = 'static'; $this->_text = $text; } //end constructor - + + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_static($elementName=null, $elementLabel=null, $text=null) { + self::__construct($elementName, $elementLabel, $text); + } + // }}} // {{{ setName() diff --git a/lib/pear/HTML/QuickForm/submit.php b/lib/pear/HTML/QuickForm/submit.php index e1d3e7d26e5..c149fb81e93 100644 --- a/lib/pear/HTML/QuickForm/submit.php +++ b/lib/pear/HTML/QuickForm/submit.php @@ -44,13 +44,19 @@ class HTML_QuickForm_submit extends HTML_QuickForm_input * @access public * @return void */ - function HTML_QuickForm_submit($elementName=null, $value=null, $attributes=null) - { - HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes); + public function __construct($elementName=null, $value=null, $attributes=null) { + parent::__construct($elementName, null, $attributes); $this->setValue($value); $this->setType('submit'); } //end constructor - + + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_submit($elementName=null, $value=null, $attributes=null) { + self::__construct($elementName, $value, $attributes); + } + // }}} // {{{ freeze() diff --git a/lib/pear/HTML/QuickForm/text.php b/lib/pear/HTML/QuickForm/text.php index 9d6d9dea4ff..dfc2d8d794c 100644 --- a/lib/pear/HTML/QuickForm/text.php +++ b/lib/pear/HTML/QuickForm/text.php @@ -46,12 +46,18 @@ class HTML_QuickForm_text extends HTML_QuickForm_input * @access public * @return void */ - function HTML_QuickForm_text($elementName=null, $elementLabel=null, $attributes=null) - { - HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes); + public function __construct($elementName=null, $elementLabel=null, $attributes=null) { + parent::__construct($elementName, $elementLabel, $attributes); $this->_persistantFreeze = true; $this->setType('text'); } //end constructor + + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_text($elementName=null, $elementLabel=null, $attributes=null) { + self::__construct($elementName, $elementLabel, $attributes); + } // }}} // {{{ setSize() diff --git a/lib/pear/HTML/QuickForm/textarea.php b/lib/pear/HTML/QuickForm/textarea.php index 7aa0af2ad6c..1fbdc6a8e22 100644 --- a/lib/pear/HTML/QuickForm/textarea.php +++ b/lib/pear/HTML/QuickForm/textarea.php @@ -55,13 +55,19 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element * @access public * @return void */ - function HTML_QuickForm_textarea($elementName=null, $elementLabel=null, $attributes=null) - { - HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes); + public function __construct($elementName=null, $elementLabel=null, $attributes=null) { + parent::__construct($elementName, $elementLabel, $attributes); $this->_persistantFreeze = true; $this->_type = 'textarea'; } //end constructor - + + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_textarea($elementName=null, $elementLabel=null, $attributes=null) { + self::__construct($elementName, $elementLabel, $attributes); + } + // }}} // {{{ setName() diff --git a/lib/pear/HTML/QuickForm/xbutton.php b/lib/pear/HTML/QuickForm/xbutton.php index dd01995b212..96880bb2f35 100644 --- a/lib/pear/HTML/QuickForm/xbutton.php +++ b/lib/pear/HTML/QuickForm/xbutton.php @@ -44,14 +44,19 @@ class HTML_QuickForm_xbutton extends HTML_QuickForm_element * @param mixed Either a typical HTML attribute string or an associative array * @access public */ - function HTML_QuickForm_xbutton($elementName = null, $elementContent = null, $attributes = null) - { - $this->HTML_QuickForm_element($elementName, null, $attributes); + public function __construct($elementName = null, $elementContent = null, $attributes = null) { + parent::__construct($elementName, null, $attributes); $this->setContent($elementContent); $this->setPersistantFreeze(false); $this->_type = 'xbutton'; } + /** + * Old syntax of class constructor for backward compatibility. + */ + public function HTML_QuickForm_xbutton($elementName = null, $elementContent = null, $attributes = null) { + self::__construct($elementName, $elementContent, $attributes); + } function toHtml() { diff --git a/lib/pear/PEAR.php b/lib/pear/PEAR.php index 69b2655366f..785315067ae 100644 --- a/lib/pear/PEAR.php +++ b/lib/pear/PEAR.php @@ -146,7 +146,7 @@ class PEAR * @access public * @return void */ - function PEAR($error_class = null) + function __construct($error_class = null) { $classname = strtolower(get_class($this)); if ($this->_debug) { @@ -173,6 +173,18 @@ class PEAR } } + /** + * Only here for backwards compatibility. + * E.g. Archive_Tar calls $this->PEAR() in its constructor. + * + * @param string $error_class Which class to use for error objects, + * defaults to PEAR_Error. + */ + public function PEAR($error_class = null) + { + $this->__construct($error_class); + } + /** * Destructor (the emulated type of...). Does nothing right now, * but is included for forward compatibility, so subclass @@ -823,7 +835,7 @@ class PEAR_Error * @access public * */ - function PEAR_Error($message = 'unknown error', $code = null, + public function __construct($message = 'unknown error', $code = null, $mode = null, $options = null, $userinfo = null) { if ($mode === null) { @@ -896,6 +908,14 @@ class PEAR_Error } } + /** + * Old syntax of class constructor for backward compatibility. + */ + public function PEAR_Error($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) { + self::__construct($message, $code, $mode, $options, $userinfo); + } + /** * Get the error mode from an error object. * diff --git a/lib/pear/README_MOODLE.txt b/lib/pear/README_MOODLE.txt index 5b70ba45620..8a9dcaa4c66 100644 --- a/lib/pear/README_MOODLE.txt +++ b/lib/pear/README_MOODLE.txt @@ -27,3 +27,9 @@ Most probably we will stop using this library in the future. MDL-20876 - replaced split() with explode() or preg_split() where appropriate MDL-40267 - Moodle core_text strlen functions used for range rule rule to be utf8 safe. MDL-46467 - $mform->hardfreeze causes labels to loose their for HTML attribute +MDL-52081 - made all constructors PHP7 compatible + + +Pear +==== +Changed constructors in classes PEAR and PEAR_ERROR to be __construct(). \ No newline at end of file diff --git a/mod/data/export_form.php b/mod/data/export_form.php index 90b4ff77d59..1263f9cc2d7 100644 --- a/mod/data/export_form.php +++ b/mod/data/export_form.php @@ -13,11 +13,18 @@ class mod_data_export_form extends moodleform { // @param string $url: the url to post to // @param array $datafields: objects in this database - function mod_data_export_form($url, $datafields, $cm, $data) { + public function __construct($url, $datafields, $cm, $data) { $this->_datafields = $datafields; $this->_cm = $cm; $this->_data = $data; - parent::moodleform($url); + parent::__construct($url); + } + + /** + * Old syntax of class constructor for backward compatibility. + */ + public function mod_data_export_form($url, $datafields, $cm, $data) { + self::__construct($url, $datafields, $cm, $data); } function definition() { diff --git a/mod/lesson/mod_form.php b/mod/lesson/mod_form.php index 5d3eb3a67fe..21f58f4a07f 100644 --- a/mod/lesson/mod_form.php +++ b/mod/lesson/mod_form.php @@ -33,9 +33,16 @@ class mod_lesson_mod_form extends moodleform_mod { protected $course = null; - public function mod_lesson_mod_form($current, $section, $cm, $course) { + public function __construct($current, $section, $cm, $course) { $this->course = $course; - parent::moodleform_mod($current, $section, $cm, $course); + parent::__construct($current, $section, $cm, $course); + } + + /** + * Old syntax of class constructor for backward compatibility. + */ + public function mod_lesson_mod_form($current, $section, $cm, $course) { + self::__construct($current, $section, $cm, $course); } function definition() { diff --git a/mod/wiki/editors/wikieditor.php b/mod/wiki/editors/wikieditor.php index 11641523fff..a64706b8a6f 100644 --- a/mod/wiki/editors/wikieditor.php +++ b/mod/wiki/editors/wikieditor.php @@ -33,7 +33,14 @@ class MoodleQuickForm_wikieditor extends MoodleQuickForm_textarea { private $files; - function MoodleQuickForm_wikieditor($elementName = null, $elementLabel = null, $attributes = null) { + /** + * Constructor + * + * @param string $elementName (optional) name of the text field + * @param string $elementLabel (optional) text field label + * @param string $attributes (optional) Either a typical HTML attribute string or an associative array + */ + function __construct($elementName = null, $elementLabel = null, $attributes = null) { if (isset($attributes['wiki_format'])) { $this->wikiformat = $attributes['wiki_format']; unset($attributes['wiki_format']); @@ -43,7 +50,14 @@ class MoodleQuickForm_wikieditor extends MoodleQuickForm_textarea { unset($attributes['files']); } - parent::MoodleQuickForm_textarea($elementName, $elementLabel, $attributes); + parent::__construct($elementName, $elementLabel, $attributes); + } + + /** + * Old syntax of class constructor for backward compatibility. + */ + public function MoodleQuickForm_wikieditor($elementName = null, $elementLabel = null, $attributes = null) { + self::__construct($elementName, $elementLabel, $attributes); } function setWikiFormat($wikiformat) { diff --git a/mod/wiki/editors/wikifiletable.php b/mod/wiki/editors/wikifiletable.php index c1b9ed4fb6a..4965ecb06a8 100644 --- a/mod/wiki/editors/wikifiletable.php +++ b/mod/wiki/editors/wikifiletable.php @@ -37,13 +37,20 @@ class MoodleQuickForm_wikifiletable extends HTML_QuickForm_element { private $_fileinfo; private $_value = array(); - function MoodleQuickForm_wikifiletable($elementName = null, $elementLabel = null, $attributes = null, $fileinfo = null, $format = null) { + public function __construct($elementName = null, $elementLabel = null, $attributes = null, $fileinfo = null, $format = null) { - parent::HTML_QuickForm_element($elementName, $elementLabel, $attributes); + parent::__construct($elementName, $elementLabel, $attributes); $this->_fileinfo = $fileinfo; $this->_format = $format; } + /** + * Old syntax of class constructor for backward compatibility. + */ + public function MoodleQuickForm_wikifiletable($elementName = null, $elementLabel = null, $attributes = null, $fileinfo = null, $format = null) { + self::__construct($elementName, $elementLabel, $attributes, $fileinfo, $format); + } + function onQuickFormEvent($event, $arg, &$caller) { global $OUTPUT;