]> git.mjollnir.org Git - moodle.git/commitdiff
Added stripos function and allow filters to work even when courseid
authormoodler <moodler>
Tue, 20 Jan 2004 08:51:43 +0000 (08:51 +0000)
committermoodler <moodler>
Tue, 20 Jan 2004 08:51:43 +0000 (08:51 +0000)
isn't set.

lib/weblib.php

index 380a69338617358a2b95d6cbdd32d2bcd38ab844..0419be88c4e93a715abc14f4b3d67de262d30481 100644 (file)
@@ -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