From ce57cc79eb21546ef3e9fd4177ac0fba6dc35cd4 Mon Sep 17 00:00:00 2001 From: moodler Date: Tue, 20 Jan 2004 08:51:43 +0000 Subject: [PATCH] Added stripos function and allow filters to work even when courseid isn't set. --- lib/weblib.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index 380a693386..0419be88c4 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -192,12 +192,12 @@ function stripslashes_safe($string) { return $string; } -if (!function_exists('str_ireplace')) { +if (!function_exists('str_ireplace')) { /// Only exists in PHP 5 function str_ireplace($find, $replace, $string) { /// This does a search and replace, ignoring case - /// This function is only here versions of PHP older than version 5 - /// may not have a native version of this function. - /// Taken from the PHP manual, by bradhuizenga@softhome.net + /// This function is only used for versions of PHP older than version 5 + /// which do not have a native version of this function. + /// Taken from the PHP manual, by bradhuizenga @ softhome.net if (!is_array($find)) { $find = array($find); @@ -230,6 +230,15 @@ if (!function_exists('str_ireplace')) { } } +if (!function_exists('stripos')) { /// Only exists in PHP 5 + function stripos($haystack, $needle, $offset=0) { + /// This function is only used for versions of PHP older than version 5 + /// which do not have a native version of this function. + /// Taken from the PHP manual, by dmarsh @ spscc.ctc.edu + return strpos(strtoupper($haystack), strtoupper($needle), $offset); + } +} + function read_template($filename, &$var) { /// return a (big) string containing the contents of a template file with all /// the variables interpolated. all the variables must be in the $var[] array or @@ -564,10 +573,6 @@ function filter_text($text, $courseid=NULL) { global $CFG; - if (empty($courseid)) { - return $text; - } - for ($i=1; $i<=10; $i++) { $variable = "textfilter$i"; if (empty($CFG->$variable)) { /// No more filters -- 2.39.5