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);
}
}
+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
global $CFG;
- if (empty($courseid)) {
- return $text;
- }
-
for ($i=1; $i<=10; $i++) {
$variable = "textfilter$i";
if (empty($CFG->$variable)) { /// No more filters