From eb6eb58ec5a8e16db47cb6278e33a59579c9942f Mon Sep 17 00:00:00 2001 From: stronk7 Date: Mon, 25 Apr 2005 21:55:36 +0000 Subject: [PATCH] Cache array of filterobjects per request. --- filter/activitynames/filter.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/filter/activitynames/filter.php b/filter/activitynames/filter.php index d7565339c47..1076ff51ca9 100644 --- a/filter/activitynames/filter.php +++ b/filter/activitynames/filter.php @@ -8,6 +8,8 @@ global $CFG; + static $activitylist; + if (empty($courseid)) { $courseid = SITEID; } @@ -17,12 +19,11 @@ if (!empty($modinfo)) { - $linkarray = array(); + $activitylist = array(); /// We will store all the activities here //Sort modinfo by name length usort($modinfo,'comparemodulenamesbylength'); - $cm = ''; foreach ($modinfo as $activity) { //Exclude labels and hidden items if ($activity->mod != "label" && $activity->visible) { @@ -31,11 +32,11 @@ $href_tag_begin = "wwwroot/mod/$activity->mod/view.php?id=$activity->cm\">"; $currentname = urldecode($activity->name); if ($currentname = trim($currentname)) { - $linkarray[] = new filterobject($currentname, $href_tag_begin, '', false, true); + $activitylist[] = new filterobject($currentname, $href_tag_begin, '', false, true); } } } - $text = filter_phrases ($text, $linkarray); + $text = filter_phrases ($text, $activitylist); } return $text; }