diff --git a/admin/blocks.php b/admin/blocks.php index ca9633d58ec..b1c53df11f4 100644 --- a/admin/blocks.php +++ b/admin/blocks.php @@ -100,6 +100,7 @@ } else { uninstall_plugin('block', $block->name); + $a = new stdClass(); $a->block = $strblockname; $a->directory = $CFG->dirroot.'/blocks/'.$block->name; notice(get_string('blockdeletefiles', '', $a), 'blocks.php'); diff --git a/admin/enrol.php b/admin/enrol.php index 2d53db9ca71..ab14a23440a 100644 --- a/admin/enrol.php +++ b/admin/enrol.php @@ -31,6 +31,7 @@ $enrol = required_param('enrol', PARAM_PLUGIN); $confirm = optional_param('confirm', 0, PARAM_BOOL); $PAGE->set_url('/admin/enrol.php'); +$PAGE->set_context(context_system::instance()); require_login(); require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)); @@ -112,6 +113,7 @@ switch ($action) { uninstall_plugin('enrol', $enrol); $syscontext->mark_dirty(); // resets all enrol caches + $a = new stdClass(); $a->plugin = $strplugin; $a->directory = "$CFG->dirroot/enrol/$enrol"; echo $OUTPUT->notification(get_string('uninstalldeletefiles', 'enrol', $a), 'notifysuccess'); diff --git a/admin/modules.php b/admin/modules.php index 45f7a57bff1..2290612b813 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -92,6 +92,7 @@ } uninstall_plugin('mod', $delete); + $a = new stdClass(); $a->module = $strmodulename; $a->directory = "$CFG->dirroot/mod/$delete"; echo $OUTPUT->notification(get_string("moduledeletefiles", "", $a), 'notifysuccess'); diff --git a/admin/qbehaviours.php b/admin/qbehaviours.php index 2ae5f083e2c..ce81b1369d2 100644 --- a/admin/qbehaviours.php +++ b/admin/qbehaviours.php @@ -191,6 +191,7 @@ if (($delete = optional_param('delete', '', PARAM_PLUGIN)) && confirm_sesskey()) // Remove event handlers and dequeue pending events events_uninstall('qbehaviour_' . $delete); + $a = new stdClass(); $a->behaviour = $behaviourname; $a->directory = get_plugin_directory('qbehaviour', $delete); echo $OUTPUT->box(get_string('qbehaviourdeletefiles', 'question', $a), 'generalbox', 'notice'); diff --git a/admin/qtypes.php b/admin/qtypes.php index 79bcf683afc..cbe828fdf10 100644 --- a/admin/qtypes.php +++ b/admin/qtypes.php @@ -171,6 +171,7 @@ if (($delete = optional_param('delete', '', PARAM_PLUGIN)) && confirm_sesskey()) // Remove event handlers and dequeue pending events events_uninstall('qtype_' . $delete); + $a = new stdClass(); $a->qtype = $qtypename; $a->directory = $qtypes[$delete]->plugin_dir(); echo $OUTPUT->box(get_string('qtypedeletefiles', 'question', $a), 'generalbox', 'notice'); diff --git a/admin/tool/timezoneimport/index.php b/admin/tool/timezoneimport/index.php index 8319f837e51..478ca4cb3f3 100644 --- a/admin/tool/timezoneimport/index.php +++ b/admin/tool/timezoneimport/index.php @@ -110,7 +110,7 @@ /// That's it! if ($importdone) { - $a = null; + $a = new stdClass(); $a->count = count($timezones); $a->source = $importdone; echo $OUTPUT->heading(get_string('importtimezonescount', 'tool_timezoneimport', $a), 3); diff --git a/blocks/admin_bookmarks/block_admin_bookmarks.php b/blocks/admin_bookmarks/block_admin_bookmarks.php index 856b9b83442..331f353b86f 100644 --- a/blocks/admin_bookmarks/block_admin_bookmarks.php +++ b/blocks/admin_bookmarks/block_admin_bookmarks.php @@ -79,6 +79,7 @@ class block_admin_bookmarks extends block_base { if ($this->contentgenerated === true) { return $this->content; } + $this->content = new stdClass(); if (get_user_preferences('admin_bookmarks')) { require_once($CFG->libdir.'/adminlib.php'); diff --git a/blocks/comments/block_comments.php b/blocks/comments/block_comments.php index a00cd09edfc..527d02037c3 100644 --- a/blocks/comments/block_comments.php +++ b/blocks/comments/block_comments.php @@ -48,21 +48,23 @@ class block_comments extends block_base { function get_content() { global $CFG, $PAGE; + if ($this->content !== NULL) { + return $this->content; + } if (!$CFG->usecomments) { + $this->content = new stdClass(); $this->content->text = ''; if ($this->page->user_is_editing()) { $this->content->text = get_string('disabledcomments'); } return $this->content; } - if ($this->content !== NULL) { - return $this->content; - } - if (empty($this->instance)) { - return null; - } + $this->content = new stdClass(); $this->content->footer = ''; $this->content->text = ''; + if (empty($this->instance)) { + return $this->content; + } list($context, $course, $cm) = get_context_info_array($PAGE->context->id); $args = new stdClass; diff --git a/blocks/glossary_random/block_glossary_random.php b/blocks/glossary_random/block_glossary_random.php index 72fc75bcffe..649cd77a9a8 100644 --- a/blocks/glossary_random/block_glossary_random.php +++ b/blocks/glossary_random/block_glossary_random.php @@ -119,6 +119,7 @@ class block_glossary_random extends block_base { global $USER, $CFG, $DB; if (empty($this->config->glossary)) { + $this->content = new stdClass(); $this->content->text = get_string('notyetconfigured','block_glossary_random'); $this->content->footer = ''; return $this->content; @@ -153,7 +154,7 @@ class block_glossary_random extends block_base { return $this->content; } - $this->content = new stdClass; + $this->content = new stdClass(); $this->content->text = $this->config->cache; // place link to glossary in the footer if the glossary is visible diff --git a/blocks/html/edit_form.php b/blocks/html/edit_form.php index 30c005dcaec..aa7b4661de8 100644 --- a/blocks/html/edit_form.php +++ b/blocks/html/edit_form.php @@ -72,6 +72,9 @@ class block_html_edit_form extends block_edit_form { unset($this->block->config->text); parent::set_data($defaults); // restore $text + if (!isset($this->block->config)) { + $this->block->config = new stdClass(); + } $this->block->config->text = $text; if (isset($title)) { // Reset the preserved title diff --git a/blocks/login/block_login.php b/blocks/login/block_login.php index 516a5faaeb6..2d92009e486 100644 --- a/blocks/login/block_login.php +++ b/blocks/login/block_login.php @@ -43,6 +43,7 @@ class block_login extends block_base { $username = get_moodle_cookie(); + $this->content = new stdClass(); $this->content->footer = ''; $this->content->text = ''; diff --git a/blocks/mentees/block_mentees.php b/blocks/mentees/block_mentees.php index 45d9463cf7b..aa340af7e41 100644 --- a/blocks/mentees/block_mentees.php +++ b/blocks/mentees/block_mentees.php @@ -25,6 +25,8 @@ class block_mentees extends block_base { return $this->content; } + $this->content = new stdClass(); + // get all the mentees, i.e. users you have a direct assignment to if ($usercontexts = $DB->get_records_sql("SELECT c.instanceid, c.instanceid, u.firstname, u.lastname FROM {role_assignments} ra, {context} c, {user} u diff --git a/blocks/navigation/block_navigation.php b/blocks/navigation/block_navigation.php index 79b8086b814..00f06cf3807 100644 --- a/blocks/navigation/block_navigation.php +++ b/blocks/navigation/block_navigation.php @@ -195,6 +195,7 @@ class block_navigation extends block_base { // Grab the items to display $renderer = $this->page->get_renderer('block_navigation'); + $this->content = new stdClass(); $this->content->text = $renderer->navigation_tree($navigation, $expansionlimit, $options); // Set content generated to true so that we know it has been done diff --git a/blocks/private_files/block_private_files.php b/blocks/private_files/block_private_files.php index a552dd91423..32e1282e5b3 100644 --- a/blocks/private_files/block_private_files.php +++ b/blocks/private_files/block_private_files.php @@ -51,6 +51,7 @@ class block_private_files extends block_base { return null; } + $this->content = new stdClass(); $this->content->text = ''; $this->content->footer = ''; if (isloggedin() && !isguestuser()) { // Show the block diff --git a/blocks/settings/block_settings.php b/blocks/settings/block_settings.php index 89706f670dd..3e2aea838e3 100644 --- a/blocks/settings/block_settings.php +++ b/blocks/settings/block_settings.php @@ -129,6 +129,7 @@ class block_settings extends block_base { } $renderer = $this->page->get_renderer('block_settings'); + $this->content = new stdClass(); $this->content->text = $renderer->settings_tree($this->page->settingsnav); // only do search if you have moodle/site:config diff --git a/blocks/tags/block_tags.php b/blocks/tags/block_tags.php index 0a35df176e4..b7a35fd9bab 100644 --- a/blocks/tags/block_tags.php +++ b/blocks/tags/block_tags.php @@ -47,6 +47,10 @@ class block_tags extends block_base { return $this->content; } + if (!isset($this->config)) { + $this->config = new stdClass(); + } + if (empty($this->config->numberoftags)) { $this->config->numberoftags = 80; } diff --git a/calendar/lib.php b/calendar/lib.php index c60e6b63e35..8b9e480f9b0 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -1540,6 +1540,7 @@ function calendar_set_event_type_display($type, $display = null, $user = null) { function calendar_get_allowed_types(&$allowed, $course = null) { global $USER, $CFG, $DB; + $allowed = new stdClass(); $allowed->user = has_capability('moodle/calendar:manageownentries', get_system_context()); $allowed->groups = false; // This may change just below $allowed->courses = false; // This may change just below diff --git a/course/format/weeks/format.php b/course/format/weeks/format.php index 74fb96427f6..c5c78faf139 100644 --- a/course/format/weeks/format.php +++ b/course/format/weeks/format.php @@ -141,7 +141,7 @@ defined('MOODLE_INTERNAL') || die(); $thissection = $sections[$section]; } else { - unset($thissection); + $thissection = new stdClass(); $thissection->course = $course->id; // Create a new week structure $thissection->section = $section; $thissection->name = null; diff --git a/course/index.php b/course/index.php index f0a0c104893..e87312848e2 100644 --- a/course/index.php +++ b/course/index.php @@ -373,6 +373,7 @@ function print_category_edit($category, $displaylist, $parentslist, $depth=-1, $ echo ''; echo ''; } else { + $category = new stdClass(); $category->id = '0'; } diff --git a/course/lib.php b/course/lib.php index e5dc9913871..eae0beefbe1 100644 --- a/course/lib.php +++ b/course/lib.php @@ -1074,6 +1074,7 @@ function get_array_of_activities($courseid) { if (empty($rawmods[$seq])) { continue; } + $mod[$seq] = new stdClass(); $mod[$seq]->id = $rawmods[$seq]->instance; $mod[$seq]->cm = $rawmods[$seq]->id; $mod[$seq]->mod = $rawmods[$seq]->modname; @@ -2127,6 +2128,7 @@ function print_whole_category_list($category=NULL, $displaylist=NULL, $parentsli } } else { + $category = new stdClass(); $category->id = "0"; } @@ -2500,7 +2502,7 @@ function print_course($course, $highlightterms = '') { echo html_writer::end_tag('div'); // End of info div echo html_writer::start_tag('div', array('class'=>'summary')); - $options = NULL; + $options = new stdClass(); $options->noclean = true; $options->para = false; $options->overflowdiv = true; @@ -2647,7 +2649,7 @@ function print_remote_course($course, $width="100%") { . format_string($course->cat_name) . ' : ' . format_string($course->shortname). ''; echo '