diff --git a/calendar/lib.php b/calendar/lib.php index 40eb7397b1c..7c575d41a78 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -766,8 +766,8 @@ function calendar_top_controls($type, $data) { $text = get_string('strftimedaydate'); /* // Regexp hackery to make a link out of the month/year part - $text = preg_replace('/(%B.+%Y|%Y.+%B|%Y.+%m[^ ]+)/', '\\1', $text); - $text = preg_replace('/(F.+Y|Y.+F|Y.+m[^ ]+)/', '\\1', $text); + $text = ereg_replace('(%B.+%Y|%Y.+%B|%Y.+%m[^ ]+)', '\\1', $text); + $text = ereg_replace('(F.+Y|Y.+F|Y.+m[^ ]+)', '\\1', $text); */ // Replace with actual values and lose any day leading zero $text = userdate($time, $text); diff --git a/lib/excel/Worksheet.php b/lib/excel/Worksheet.php index d3faf06db14..f512fb88fce 100644 --- a/lib/excel/Worksheet.php +++ b/lib/excel/Worksheet.php @@ -1264,10 +1264,10 @@ class Worksheet extends BIFFwriter } // Strip the '=' or '@' sign at the beginning of the formula string - if (preg_match("/^=/",$formula)) { + if (ereg("^=",$formula)) { $formula = preg_replace("/(^=)/","",$formula); } - elseif(preg_match("/^@/",$formula)) { + elseif(ereg("^@",$formula)) { $formula = preg_replace("/(^@)/","",$formula); } else { diff --git a/lib/weblib.php b/lib/weblib.php index 0ba4c4f6bc0..b849be30685 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -1355,11 +1355,11 @@ function formerr($error) { */ function validate_email($address) { - return (preg_match('#^[-!\#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+'. - '(\.[-!\#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+)*'. + return (ereg('^[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+'. + '(\.[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+)*'. '@'. - '[-!\#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'. - '[-!\#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$#', + '[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'. + '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $address)); } @@ -1791,7 +1791,7 @@ function format_text_email($text, $format) { $text = wiki_to_html($text); /// This expression turns links into something nice in a text format. (Russell Jungwirth) /// From: http://php.net/manual/en/function.eregi-replace.php and simplified - $text = preg_replace('/(]*>([^<]*))/i','\\3 [ \\2 ]', $text); + $text = eregi_replace('(]*>([^<]*))','\\3 [ \\2 ]', $text); return strtr(strip_tags($text), array_flip(get_html_translation_table(HTML_ENTITIES))); break; @@ -1802,7 +1802,7 @@ function format_text_email($text, $format) { case FORMAT_MOODLE: case FORMAT_MARKDOWN: default: - $text = preg_replace('/(]*>([^<]*))/i','\\3 [ \\2 ]', $text); + $text = eregi_replace('(]*>([^<]*))','\\3 [ \\2 ]', $text); return strtr(strip_tags($text), array_flip(get_html_translation_table(HTML_ENTITIES))); break; } @@ -2038,8 +2038,8 @@ function clean_text($text, $format=FORMAT_MOODLE) { } /// Remove potential script events - some extra protection for undiscovered bugs in our code - $text = preg_replace("/([^a-z])language([[:space:]]*)=/i", "\\1Xlanguage=", $text); - $text = preg_replace("/([^a-z])on([a-z]+)([[:space:]]*)=/i", "\\1Xon\\2=", $text); + $text = eregi_replace("([^a-z])language([[:space:]]*)=", "\\1Xlanguage=", $text); + $text = eregi_replace("([^a-z])on([a-z]+)([[:space:]]*)=", "\\1Xon\\2=", $text); return $text; } @@ -2238,11 +2238,11 @@ function text_to_html($text, $smiley=true, $para=true, $newlines=true) { global $CFG; /// Remove any whitespace that may be between HTML tags - $text = preg_replace("/>([[:space:]]+)<", $text); + $text = eregi_replace(">([[:space:]]+)<", "><", $text); /// Remove any returns that precede or follow HTML tags - $text = preg_replace("/([\n\r])([\n\r])/i", "> ", $text); + $text = eregi_replace("([\n\r])<", " <", $text); + $text = eregi_replace(">([\n\r])", "> ", $text); convert_urls_into_links($text); @@ -2305,11 +2305,11 @@ function html_to_text($html) { */ function convert_urls_into_links(&$text) { /// Make lone URLs into links. eg http://moodle.com/ - $text = preg_replace("#([[:space:]]|^|\(|\[)([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]\#?/&=])#i", + $text = eregi_replace("([[:space:]]|^|\(|\[)([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", "\\1\\2://\\3\\4", $text); /// eg www.moodle.com - $text = preg_replace("#([[:space:]]|^|\(|\[)www\.([^[:space:]]*)([[:alnum:]\#?/&=])#i", + $text = eregi_replace("([[:space:]]|^|\(|\[)www\.([^[:space:]]*)([[:alnum:]#?/&=])", "\\1www.\\2\\3", $text); } diff --git a/question/format/blackboard_6/format.php b/question/format/blackboard_6/format.php index ca3181a9e15..69d0c19d9f7 100644 --- a/question/format/blackboard_6/format.php +++ b/question/format/blackboard_6/format.php @@ -180,7 +180,7 @@ class qformat_blackboard_6 extends qformat_default { if (is_readable($q_file)) { $filearray = file($q_file); /// Check for Macintosh OS line returns (ie file on one line), and fix - if (preg_match("/\r/", $filearray[0]) AND !preg_match("/\n/", $filearray[0])) { + if (ereg("\r", $filearray[0]) AND !ereg("\n", $filearray[0])) { return explode("\r", $filearray[0]); } else { return $filearray; diff --git a/question/type/multianswer/questiontype.php b/question/type/multianswer/questiontype.php index 90ac1c578f3..eb97766feb5 100644 --- a/question/type/multianswer/questiontype.php +++ b/question/type/multianswer/questiontype.php @@ -266,7 +266,7 @@ class embedded_cloze_qtype extends default_questiontype { // The regex will recognize text snippets of type {#X} // where the X can be any text not containg } or white-space characters. - while (preg_match('/\{#([^[:space:]}]*)}/', $qtextremaining, $regs)) { + while (ereg('\{#([^[:space:]}]*)}', $qtextremaining, $regs)) { $qtextsplits = explode($regs[0], $qtextremaining, 2); echo $qtextsplits[0]; echo "