Latest speed improvement for link filters (more noticeable under PHP4). Bug 3138.

(http://moodle.org/bugs/bug.php?op=show&bugid=3138)
This commit is contained in:
stronk7
2005-05-21 00:22:14 +00:00
parent cf416cc429
commit dc3b522580
+4 -3
View File
@@ -44,7 +44,7 @@ class filterobject {
* param ignoretagsopen an array of opening tags that we should ignore while filtering
* param ignoretagsclose an array of corresponding closing tags
**/
function filter_phrases ($text, $link_array, $ignoretagsopen=NULL, $ignoretagsclose=NULL) {
function filter_phrases ($text, &$link_array, $ignoretagsopen=NULL, $ignoretagsclose=NULL) {
global $CFG;
@@ -84,9 +84,10 @@ function filter_phrases ($text, $link_array, $ignoretagsopen=NULL, $ignoretagscl
/// Remove tags from $text
filter_save_tags($text,$tags);
/// Time to cycle through each phrase to be linked
foreach ($link_array as $linkobject) {
$size = sizeof($link_array);
for ($n=0; $n < $size; $n++) {
$linkobject =& $link_array[$n];
/// Set some defaults if certain properties are missing
/// Properties may be missing if the filterobject class has not been used to construct the object