Permalink
Browse files

MDL-32094 fix various E_STRICT compatibility problems

  • Loading branch information...
1 parent 0ed6f71 commit f20edd5208f17f10f7ecaab82c442d990aa5fd0a @skodak skodak committed Mar 18, 2012
View
@@ -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
@@ -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');
@@ -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();
}
View
@@ -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) {
View
@@ -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();
View
@@ -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)) {
View
@@ -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;
}
@@ -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');
}
@@ -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');
}
View
@@ -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();
}
View
@@ -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);
View
@@ -1733,19 +1733,21 @@ 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;
}
/**
* 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();
}
}
@@ -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
@@ -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));
}
View
@@ -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 {
View
@@ -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(),
View
@@ -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)) {
View
@@ -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];
View
@@ -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();
View
@@ -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);
}
View
@@ -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));
View
@@ -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();
View
@@ -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];
@@ -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;
View
@@ -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();
@@ -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, '');
@@ -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

0 comments on commit f20edd5

Please sign in to comment.