From 56a6ee0f755d7ab7368eac30db2d5c55fdf4b155 Mon Sep 17 00:00:00 2001 From: thepurpleblob Date: Wed, 10 Aug 2005 10:58:21 +0000 Subject: [PATCH] Newlines in question text now supported by inserting \n. Works with export and import. --- mod/quiz/format/gift/format.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mod/quiz/format/gift/format.php b/mod/quiz/format/gift/format.php index 8a25d35b921..6f29713ef30 100755 --- a/mod/quiz/format/gift/format.php +++ b/mod/quiz/format/gift/format.php @@ -82,8 +82,8 @@ class quiz_format_gift extends quiz_default_format { function escapedchar_pre($string) { //Replaces escaped control characters with a placeholder BEFORE processing - $escapedcharacters = array("\\#", "\\=", "\\{", "\\}", "\\~" ); - $placeholders = array("&&035;", "&&061;", "&&123;", "&&125;", "&&126;"); + $escapedcharacters = array("\\#", "\\=", "\\{", "\\}", "\\~", "\\n" ); //dlnsk + $placeholders = array("&&035;", "&&061;", "&&123;", "&&125;", "&&126;", "&&010" ); //dlnsk $string = str_replace("\\\\", "&&092;", $string); $string = str_replace($escapedcharacters, $placeholders, $string); @@ -93,8 +93,8 @@ class quiz_format_gift extends quiz_default_format { function escapedchar_post($string) { //Replaces placeholders with corresponding character AFTER processing is done - $placeholders = array("&&035;", "&&061;", "&&123;", "&&125;", "&&126;"); - $characters = array("#", "=", "{", "}", "~" ); + $placeholders = array("&&035;", "&&061;", "&&123;", "&&125;", "&&126;", "&&010"); //dlnsk + $characters = array("#", "=", "{", "}", "~", "\n" ); //dlnsk $string = str_replace($placeholders, $characters, $string); return $string; } @@ -482,8 +482,8 @@ class quiz_format_gift extends quiz_default_format { function repchar( $text, $format=0 ) { // escapes 'reserved' characters # = ~ { ) and removes new lines // also pushes text through format routine - $reserved = array( '#','=','~','{','}',"\n","\r" ); - $escaped = array( '\#','\=','\~','\{','\}',' ','' ); + $reserved = array( '#', '=', '~', '{', '}', "\n","\r"); + $escaped = array( '\#','\=','\~','\{','\}','\n','' ); //dlnsk $newtext = str_replace( $reserved, $escaped, $text ); $format = 0; // turn this off for now