Skip to content

Commit

Permalink
MDL-32094 fix various E_STRICT compatibility problems
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Mar 18, 2012
1 parent 0ed6f71 commit f20edd5
Show file tree
Hide file tree
Showing 27 changed files with 53 additions and 42 deletions.
3 changes: 2 additions & 1 deletion admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions admin/mnet/peer_forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion blocks/quiz_results/block_quiz_results.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion calendar/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
2 changes: 1 addition & 1 deletion course/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion course/recent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions course/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions grade/export/grade_export_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
4 changes: 2 additions & 2 deletions grade/import/grade_import_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
13 changes: 10 additions & 3 deletions lib/blocklib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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();
}
Expand Down
4 changes: 2 additions & 2 deletions lib/csvlib.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions lib/enrollib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
2 changes: 1 addition & 1 deletion lib/grade/grade_grade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/grade/grade_scale.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
4 changes: 2 additions & 2 deletions lib/portfolio/forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion lib/upgradelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion mod/chat/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion mod/feedback/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down
2 changes: 1 addition & 1 deletion mod/forum/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
10 changes: 5 additions & 5 deletions mod/forum/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion mod/quiz/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion mod/wiki/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
4 changes: 2 additions & 2 deletions mod/workshop/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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];

Expand Down
2 changes: 1 addition & 1 deletion repository/coursefiles/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion rss/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion user/filters/checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -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, '');
Expand Down
2 changes: 1 addition & 1 deletion webservice/xmlrpc/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f20edd5

Please sign in to comment.