Skip to content

Commit

Permalink
MDL-34873 fix multiple E_STRICT tag related problems
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Aug 19, 2012
1 parent c92d6f4 commit 7c2cc9c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions blocks/tags/block_tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ function get_content() {
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');
Expand Down
3 changes: 2 additions & 1 deletion tag/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@
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
Expand Down
6 changes: 4 additions & 2 deletions tag/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

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

0 comments on commit 7c2cc9c

Please sign in to comment.