cvs: smarty / NEWS /libs/plugins modifier.escape.php

"Messju Mohr" <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <cvsmessju1061818647@cvsserver>
messju		Mon Aug 25 09:37:27 2003 EDT

  Modified files:              
    /smarty	NEWS 
    /smarty/libs/plugins	modifier.escape.php 
  Log:
  fixed proper escaping of " and ' with escape:javascript
  
  
Index: smarty/NEWS
diff -u smarty/NEWS:1.391 smarty/NEWS:1.392
--- smarty/NEWS:1.391	Fri Aug 22 12:15:46 2003
+++ smarty/NEWS	Mon Aug 25 09:37:27 2003
@@ -1,3 +1,4 @@
+  - fixed proper escaping of " and ' with escape:javascript (messju)
   - fixed bug in traversal of $smarty->plugins_dir-array. now the
     first matching plugin is taken (messju)
   - moved {strip} back into the compiler (messju)
Index: smarty/libs/plugins/modifier.escape.php
diff -u smarty/libs/plugins/modifier.escape.php:1.9 smarty/libs/plugins/modifier.escape.php:1.10
--- smarty/libs/plugins/modifier.escape.php:1.9	Wed May  7 09:24:43 2003
+++ smarty/libs/plugins/modifier.escape.php	Mon Aug 25 09:37:27 2003
@@ -51,7 +51,7 @@
 
         case 'javascript':
             // escape quotes and backslashes and newlines
-            return str_replace(array('\\','\'',"\r","\n"), array("\\\\", "\\'",'\r','\n'), $string);
+            return strtr($string, array('\\'=>'\\\\',"'"=>"\\'",'"'=>'\\"',"\r"=>'\\r',"\n"=>'\\n'));
 
         default:
             return $string;

-- 
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.