From 123f7f534eec52327813cf2166c408b09d692eb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20S=CC=8Ckoda?= Date: Sun, 19 Aug 2012 10:17:12 +0200 Subject: [PATCH] MDL-34873 fix multiple E_STRICT tag related problems --- blocks/tags/block_tags.php | 1 + tag/edit.php | 3 ++- tag/lib.php | 6 ++++-- tag/locallib.php | 3 ++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/blocks/tags/block_tags.php b/blocks/tags/block_tags.php index 7ce4a4a9ae7..6183a9b9d64 100644 --- a/blocks/tags/block_tags.php +++ b/blocks/tags/block_tags.php @@ -40,6 +40,7 @@ class block_tags extends block_base { global $CFG, $COURSE, $SITE, $USER, $SCRIPT, $OUTPUT; if (empty($CFG->usetags)) { + $this->content = new stdClass(); $this->content->text = ''; if ($this->page->user_is_editing()) { $this->content->text = get_string('disabledtags', 'block_tags'); diff --git a/tag/edit.php b/tag/edit.php index b71c72f2be0..ee17bc0c690 100644 --- a/tag/edit.php +++ b/tag/edit.php @@ -111,7 +111,8 @@ if ($tagnew = $tagform->get_data()) { unset($tagnew->rawname); } else { // They might be trying to change the rawname, make sure it's a change that doesn't affect name - $tagnew->name = array_shift(tag_normalize($tagnew->rawname, TAG_CASE_LOWER)); + $norm = tag_normalize($tagnew->rawname, TAG_CASE_LOWER); + $tagnew->name = array_shift($norm); if ($tag->name != $tagnew->name) { // The name has changed, let's make sure it's not another existing tag if (tag_get_id($tagnew->name)) { // Something exists already, so flag an error diff --git a/tag/lib.php b/tag/lib.php index cdbe37fb904..8e6b3977ae9 100644 --- a/tag/lib.php +++ b/tag/lib.php @@ -558,7 +558,8 @@ function tag_get_related_tags_csv($related_tags, $html=TAG_RETURN_HTML) { function tag_rename($tagid, $newrawname) { global $DB; - if (! $newrawname_clean = array_shift(tag_normalize($newrawname, TAG_CASE_ORIGINAL)) ) { + $norm = tag_normalize($newrawname, TAG_CASE_ORIGINAL); + if (! $newrawname_clean = array_shift($norm) ) { return false; } @@ -1020,7 +1021,8 @@ function tag_cron() { function tag_find_tags($text, $ordered=true, $limitfrom='', $limitnum='') { global $DB; - $text = array_shift(tag_normalize($text, TAG_CASE_LOWER)); + $norm = tag_normalize($text, TAG_CASE_LOWER); + $text = array_shift($norm); if ($ordered) { $query = "SELECT tg.id, tg.name, tg.rawname, COUNT(ti.id) AS count diff --git a/tag/locallib.php b/tag/locallib.php index fb7f9a9f730..589b6dcca14 100644 --- a/tag/locallib.php +++ b/tag/locallib.php @@ -261,7 +261,8 @@ function tag_print_search_results($query, $page, $perpage, $return=false) { global $CFG, $USER, $OUTPUT; - $query = array_shift(tag_normalize($query, TAG_CASE_ORIGINAL)); + $norm = tag_normalize($query, TAG_CASE_ORIGINAL); + $query = array_shift($norm); $count = sizeof(tag_find_tags($query, false)); $tags = array();