diff --git a/admin/index.php b/admin/index.php index 70dcafa08054c..5baad8c73ce9d 100644 --- a/admin/index.php +++ b/admin/index.php @@ -307,7 +307,8 @@ } // at this stage there can be only one admin unless more were added by install - users may change username, so do not rely on that - $adminuser = get_complete_user_data('id', reset(explode(',', $CFG->siteadmins))); + $adminids = explode(',', $CFG->siteadmins); + $adminuser = get_complete_user_data('id', reset($adminids)); if ($adminuser->password === 'adminsetuppending') { // prevent installation hijacking diff --git a/admin/mnet/peer_forms.php b/admin/mnet/peer_forms.php index 4c5243bf8a51f..4725e1fe3c736 100644 --- a/admin/mnet/peer_forms.php +++ b/admin/mnet/peer_forms.php @@ -141,10 +141,10 @@ function definition() { if ($mnet_peer && !empty($mnet_peer->deleted)) { $radioarray = array(); - $radioarray[] = MoodleQuickForm::createElement('static', 'deletedinfo', '', + $radioarray[] = $mform->createElement('static', 'deletedinfo', '', $OUTPUT->container(get_string('deletedhostinfo', 'mnet'), 'deletedhostinfo')); - $radioarray[] = MoodleQuickForm::createElement('radio', 'deleted', '', get_string('yes'), 1); - $radioarray[] = MoodleQuickForm::createElement('radio', 'deleted', '', get_string('no'), 0); + $radioarray[] = $mform->createElement('radio', 'deleted', '', get_string('yes'), 1); + $radioarray[] = $mform->createElement('radio', 'deleted', '', get_string('no'), 0); $mform->addGroup($radioarray, 'radioar', get_string('deleted'), array(' ', ' '), false); } else { $mform->addElement('hidden', 'deleted'); diff --git a/blocks/quiz_results/block_quiz_results.php b/blocks/quiz_results/block_quiz_results.php index a8d24e51edd0c..7ea73f0cf5430 100644 --- a/blocks/quiz_results/block_quiz_results.php +++ b/blocks/quiz_results/block_quiz_results.php @@ -76,7 +76,7 @@ public function get_owning_quiz() { return $cm->instance; } - function instance_config_save($data) { + function instance_config_save($data, $nolongerused = false) { if (empty($data->quizid)) { $data->quizid = $this->get_owning_quiz(); } diff --git a/calendar/lib.php b/calendar/lib.php index 645ae189470e8..7280f14c7a85d 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -497,7 +497,7 @@ function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxeve if ($events !== false) { - $modinfo =& get_fast_modinfo($COURSE); + $modinfo = get_fast_modinfo($COURSE); foreach($events as $event) { diff --git a/course/lib.php b/course/lib.php index 6282112f86a86..3145d540536f3 100644 --- a/course/lib.php +++ b/course/lib.php @@ -932,7 +932,7 @@ function print_recent_activity($course) { /// Next, have there been any modifications to the course structure? - $modinfo =& get_fast_modinfo($course); + $modinfo = get_fast_modinfo($course); $changelist = array(); diff --git a/course/recent.php b/course/recent.php index fcf09fd9f40f6..f33ef54c6179d 100644 --- a/course/recent.php +++ b/course/recent.php @@ -82,7 +82,7 @@ $mform->display(); -$modinfo =& get_fast_modinfo($course); +$modinfo = get_fast_modinfo($course); get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused); if (has_capability('moodle/course:viewhiddensections', $context)) { diff --git a/course/view.php b/course/view.php index 8b2621f38a0ca..49bbbe87c9258 100644 --- a/course/view.php +++ b/course/view.php @@ -226,12 +226,12 @@ // Course wrapper start. echo html_writer::start_tag('div', array('class'=>'course-content')); - $modinfo =& get_fast_modinfo($COURSE); + $modinfo = get_fast_modinfo($COURSE); get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused); foreach($mods as $modid=>$unused) { if (!isset($modinfo->cms[$modid])) { rebuild_course_cache($course->id); - $modinfo =& get_fast_modinfo($COURSE); + $modinfo = get_fast_modinfo($COURSE); debugging('Rebuilding course cache', DEBUG_DEVELOPER); break; } diff --git a/grade/export/grade_export_form.php b/grade/export/grade_export_form.php index bd6e39601ab21..a5c02c6ce81f4 100644 --- a/grade/export/grade_export_form.php +++ b/grade/export/grade_export_form.php @@ -73,8 +73,8 @@ function definition() { if (!empty($features['includeseparator'])) { $radio = array(); - $radio[] = &MoodleQuickForm::createElement('radio', 'separator', null, get_string('septab', 'grades'), 'tab'); - $radio[] = &MoodleQuickForm::createElement('radio', 'separator', null, get_string('sepcomma', 'grades'), 'comma'); + $radio[] = $mform->createElement('radio', 'separator', null, get_string('septab', 'grades'), 'tab'); + $radio[] = $mform->createElement('radio', 'separator', null, get_string('sepcomma', 'grades'), 'comma'); $mform->addGroup($radio, 'separator', get_string('separator', 'grades'), ' ', false); $mform->setDefault('separator', 'comma'); } diff --git a/grade/import/grade_import_form.php b/grade/import/grade_import_form.php index 6021f60a29713..76514b3ac9f28 100644 --- a/grade/import/grade_import_form.php +++ b/grade/import/grade_import_form.php @@ -46,8 +46,8 @@ function definition (){ if (!empty($features['includeseparator'])) { $radio = array(); - $radio[] = &MoodleQuickForm::createElement('radio', 'separator', null, get_string('septab', 'grades'), 'tab'); - $radio[] = &MoodleQuickForm::createElement('radio', 'separator', null, get_string('sepcomma', 'grades'), 'comma'); + $radio[] = $mform->createElement('radio', 'separator', null, get_string('septab', 'grades'), 'tab'); + $radio[] = $mform->createElement('radio', 'separator', null, get_string('sepcomma', 'grades'), 'comma'); $mform->addGroup($radio, 'separator', get_string('separator', 'grades'), ' ', false); $mform->setDefault('separator', 'comma'); } diff --git a/lib/blocklib.php b/lib/blocklib.php index 90d990cd70861..69b93da2b300b 100644 --- a/lib/blocklib.php +++ b/lib/blocklib.php @@ -226,10 +226,13 @@ public function get_addable_blocks() { $pageformat = $this->page->pagetype; foreach($allblocks as $block) { + if (!$bi = block_instance($block->name)) { + continue; + } if ($block->visible && - (block_method_result($block->name, 'instance_allow_multiple') || !$this->is_block_present($block->name)) && + ($bi->instance_allow_multiple() || !$this->is_block_present($block->name)) && blocks_name_allowed_in_format($block->name, $pageformat) && - block_method_result($block->name, 'user_can_addto', $this->page)) { + $bi->user_can_addto($this->page)) { $this->addableblocks[$block->name] = $block; } } @@ -1850,7 +1853,11 @@ function blocks_remove_inappropriate($course) { function blocks_name_allowed_in_format($name, $pageformat) { $accept = NULL; $maxdepth = -1; - $formats = block_method_result($name, 'applicable_formats'); + if (!$bi = block_instance($name)) { + return false; + } + + $formats = $bi->applicable_formats(); if (!$formats) { $formats = array(); } diff --git a/lib/csvlib.class.php b/lib/csvlib.class.php index d88716e39530f..92296fd481a50 100644 --- a/lib/csvlib.class.php +++ b/lib/csvlib.class.php @@ -289,7 +289,7 @@ static function get_delimiter($delimiter_name) { * @param string separator name * @return string encoded delimiter char */ - function get_encoded_delimiter($delimiter_name) { + static function get_encoded_delimiter($delimiter_name) { global $CFG; if ($delimiter_name == 'cfg' and isset($CFG->CSV_ENCODE)) { return $CFG->CSV_ENCODE; @@ -305,7 +305,7 @@ function get_encoded_delimiter($delimiter_name) { * @param string who imports? * @return int iid */ - function get_new_iid($type) { + static function get_new_iid($type) { global $USER; $filename = make_temp_directory('csvimport/'.$type.'/'.$USER->id); diff --git a/lib/enrollib.php b/lib/enrollib.php index 7fd29e68f08d0..befe5d2a72830 100644 --- a/lib/enrollib.php +++ b/lib/enrollib.php @@ -1733,9 +1733,10 @@ public function get_user_enrolment_actions(course_enrolment_manager $manager, $u * Returns true if the plugin has one or more bulk operations that can be performed on * user enrolments. * + * @param course_enrolment_manager $manager * @return bool */ - public function has_bulk_operations() { + public function has_bulk_operations(course_enrolment_manager $manager) { return false; } @@ -1743,9 +1744,10 @@ public function has_bulk_operations() { * Return an array of enrol_bulk_enrolment_operation objects that define * the bulk actions that can be performed on user enrolments by the plugin. * + * @param course_enrolment_manager $manager * @return array */ - public function get_bulk_operations() { + public function get_bulk_operations(course_enrolment_manager $manager) { return array(); } } diff --git a/lib/grade/grade_grade.php b/lib/grade/grade_grade.php index e3568a39316ae..a51586be56b38 100644 --- a/lib/grade/grade_grade.php +++ b/lib/grade/grade_grade.php @@ -400,7 +400,7 @@ public function set_locked($lockedstate, $cascade=false, $refresh=true) { * @param array $items array of all grade item ids * @return void */ - public function check_locktime_all($items) { + public static function check_locktime_all($items) { global $CFG, $DB; $now = time(); // no rounding needed, this is not supposed to be called every 10 seconds diff --git a/lib/grade/grade_scale.php b/lib/grade/grade_scale.php index 5483ce04860c8..d26f10a0ce0c2 100644 --- a/lib/grade/grade_scale.php +++ b/lib/grade/grade_scale.php @@ -244,7 +244,7 @@ public function get_nearest_item($grade) { * * @return object */ - public function fetch_all_global() { + public static function fetch_all_global() { return grade_scale::fetch_all(array('courseid'=>0)); } diff --git a/lib/portfolio/forms.php b/lib/portfolio/forms.php index 7a779fab51205..ba408f78486ce 100644 --- a/lib/portfolio/forms.php +++ b/lib/portfolio/forms.php @@ -77,8 +77,8 @@ public function definition() { && $this->_customdata['expectedtime'] != PORTFOLIO_TIME_LOW && $this->_customdata['expectedtime'] != PORTFOLIO_TIME_FORCEQUEUE) { $radioarray = array(); - $radioarray[] = &MoodleQuickForm::createElement('radio', 'wait', '', get_string('wait', 'portfolio'), 1); - $radioarray[] = &MoodleQuickForm::createElement('radio', 'wait', '', get_string('dontwait', 'portfolio'), 0); + $radioarray[] = $mform->createElement('radio', 'wait', '', get_string('wait', 'portfolio'), 1); + $radioarray[] = $mform->createElement('radio', 'wait', '', get_string('dontwait', 'portfolio'), 0); $mform->addGroup($radioarray, 'radioar', get_string('wanttowait_' . $this->_customdata['expectedtime'], 'portfolio') , array(' '), false); $mform->setDefault('wait', 0); } else { diff --git a/lib/upgradelib.php b/lib/upgradelib.php index 6fed9b10e160f..7fbba831cd8ee 100644 --- a/lib/upgradelib.php +++ b/lib/upgradelib.php @@ -1705,7 +1705,8 @@ function upgrade_plugin_mnet_functions($component) { * @return array */ function admin_mnet_method_profile(Zend_Server_Reflection_Function_Abstract $function) { - $proto = array_pop($function->getPrototypes()); + $protos = $function->getPrototypes(); + $proto = array_pop($protos); $ret = $proto->getReturnValue(); $profile = array( 'parameters' => array(), diff --git a/mod/chat/lib.php b/mod/chat/lib.php index 283c99abc0076..ba6b622404ca1 100644 --- a/mod/chat/lib.php +++ b/mod/chat/lib.php @@ -267,7 +267,7 @@ function chat_print_recent_activity($course, $viewfullnames, $timestart) { $past = array(); $current = array(); - $modinfo =& get_fast_modinfo($course); // reference needed because we might load the groups + $modinfo = get_fast_modinfo($course); // reference needed because we might load the groups foreach ($mcms as $cmid=>$mcm) { if (!array_key_exists($cmid, $modinfo->cms)) { diff --git a/mod/feedback/lib.php b/mod/feedback/lib.php index ae6cd7fe8030f..45a9a3d2301f1 100644 --- a/mod/feedback/lib.php +++ b/mod/feedback/lib.php @@ -344,7 +344,7 @@ function feedback_get_recent_mod_activity(&$activities, &$index, $course = $DB->get_record('course', array('id'=>$courseid)); } - $modinfo =& get_fast_modinfo($course); + $modinfo = get_fast_modinfo($course); $cm = $modinfo->cms[$cmid]; diff --git a/mod/forum/index.php b/mod/forum/index.php index c15b40b900057..5899c412bccb8 100644 --- a/mod/forum/index.php +++ b/mod/forum/index.php @@ -116,7 +116,7 @@ $generalforums = array(); $learningforums = array(); -$modinfo =& get_fast_modinfo($course); +$modinfo = get_fast_modinfo($course); if (!isset($modinfo->instances['forum'])) { $modinfo->instances['forum'] = array(); diff --git a/mod/forum/lib.php b/mod/forum/lib.php index a3677dd15d975..eb78a1474bf32 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -1373,7 +1373,7 @@ function forum_print_recent_activity($course, $viewfullnames, $timestart) { return false; } - $modinfo =& get_fast_modinfo($course); + $modinfo = get_fast_modinfo($course); $groupmodes = array(); $cms = array(); @@ -1858,7 +1858,7 @@ function forum_get_readable_forums($userid, $courseid=0) { foreach ($courses as $course) { - $modinfo =& get_fast_modinfo($course); + $modinfo = get_fast_modinfo($course); if (is_null($modinfo->groups)) { $modinfo->groups = groups_get_user_groups($course->id, $userid); } @@ -2442,7 +2442,7 @@ function forum_count_discussions($forum, $cm, $course) { require_once($CFG->dirroot.'/course/lib.php'); - $modinfo =& get_fast_modinfo($course); + $modinfo = get_fast_modinfo($course); if (is_null($modinfo->groups)) { $modinfo->groups = groups_get_user_groups($course->id, $USER->id); } @@ -5750,7 +5750,7 @@ function forum_get_recent_mod_activity(&$activities, &$index, $timestart, $cours $course = $DB->get_record('course', array('id' => $courseid)); } - $modinfo =& get_fast_modinfo($course); + $modinfo = get_fast_modinfo($course); $cm = $modinfo->cms[$cmid]; $params = array($timestart, $cm->instance); @@ -6451,7 +6451,7 @@ function forum_tp_count_forum_unread_posts($cm, $course) { require_once($CFG->dirroot.'/course/lib.php'); - $modinfo =& get_fast_modinfo($course); + $modinfo = get_fast_modinfo($course); if (is_null($modinfo->groups)) { $modinfo->groups = groups_get_user_groups($course->id, $USER->id); } diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index a48e3de4e740c..3bfdf678ed981 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -756,7 +756,7 @@ function quiz_get_recent_mod_activity(&$activities, &$index, $timestart, $course = $DB->get_record('course', array('id' => $courseid)); } - $modinfo =& get_fast_modinfo($course); + $modinfo = get_fast_modinfo($course); $cm = $modinfo->cms[$cmid]; $quiz = $DB->get_record('quiz', array('id' => $cm->instance)); diff --git a/mod/wiki/lib.php b/mod/wiki/lib.php index d1e78cb7fee9c..9dbd3f110e8ad 100644 --- a/mod/wiki/lib.php +++ b/mod/wiki/lib.php @@ -288,7 +288,7 @@ function wiki_print_recent_activity($course, $viewfullnames, $timestart) { if (!$pages = $DB->get_records_sql($sql, array($timestart, $course->id))) { return false; } - $modinfo =& get_fast_modinfo($course); + $modinfo = get_fast_modinfo($course); $wikis = array(); diff --git a/mod/workshop/lib.php b/mod/workshop/lib.php index c3adb19fa0d4d..5c44c50456909 100644 --- a/mod/workshop/lib.php +++ b/mod/workshop/lib.php @@ -343,7 +343,7 @@ function workshop_print_recent_activity($course, $viewfullnames, $timestart) { $rs = $DB->get_recordset_sql($sql, array($course->id, $timestart, $timestart)); - $modinfo =& get_fast_modinfo($course); // reference needed because we might load the groups + $modinfo = get_fast_modinfo($course); // reference needed because we might load the groups $submissions = array(); // recent submissions indexed by submission id $assessments = array(); // recent assessments indexed by assessment id @@ -552,7 +552,7 @@ function workshop_get_recent_mod_activity(&$activities, &$index, $timestart, $co $course = $DB->get_record('course', array('id'=>$courseid)); } - $modinfo =& get_fast_modinfo($course); + $modinfo = get_fast_modinfo($course); $cm = $modinfo->cms[$cmid]; diff --git a/repository/coursefiles/lib.php b/repository/coursefiles/lib.php index 8b0fa15773e5f..9a12e85ae1119 100644 --- a/repository/coursefiles/lib.php +++ b/repository/coursefiles/lib.php @@ -41,7 +41,7 @@ public function print_login() { * @param string $encodedpath * @return mixed */ - public function get_listing($encodedpath = '') { + public function get_listing($encodedpath = '', $page = '') { global $CFG, $USER, $OUTPUT; $ret = array(); $ret['dynload'] = true; diff --git a/rss/file.php b/rss/file.php index 16976c0b2e9dc..fdc4958e6756c 100644 --- a/rss/file.php +++ b/rss/file.php @@ -77,7 +77,7 @@ //find the context id if ($course = $DB->get_record('course', array('id' => $courseid))) { - $modinfo =& get_fast_modinfo($course); + $modinfo = get_fast_modinfo($course); if (!isset($modinfo->instances[$componentname])) { $modinfo->instances[$componentname] = array(); diff --git a/user/filters/checkbox.php b/user/filters/checkbox.php index 61f5097a5cd0d..34ad74754a858 100644 --- a/user/filters/checkbox.php +++ b/user/filters/checkbox.php @@ -72,7 +72,7 @@ public function __construct($name, $label, $advanced, $field, $disableelements=n * * @param moodleform $mform a MoodleQuickForm object in which element will be added */ - public function setupForm(MoodleQuickForm &$mform) { + public function setupForm(&$mform) { $objs = array(); $objs[] = $mform->createElement('checkbox', $this->_name, null, ''); diff --git a/webservice/xmlrpc/lib.php b/webservice/xmlrpc/lib.php index 06a5016839e16..5b68fe253dfbb 100644 --- a/webservice/xmlrpc/lib.php +++ b/webservice/xmlrpc/lib.php @@ -67,7 +67,7 @@ public function set_token($token) { * @param array $params the parameters of the function * @return mixed */ - public function call($functionname, $params) { + public function call($functionname, $params=array()) { global $DB, $CFG; //zend expects 0 based array with numeric indexes