[pLog-svn] Fwd: rev 4591

Jon Daley plogworld at jon.limedaley.com
Sat Jan 27 11:07:21 EST 2007


 	Since the mail wasn't fully setup, you didn't see this revision:

------------------------------------------------------------------------
r4591 | jondaley | 2007-01-27 10:55:28 -0500 (Sat, 27 Jan 2007) | 1 line
Changed paths:
    M /plog/branches/lifetype-1.1.5/class/data/textfilter.class.php

I think this function wasn't doing what people thought it was.  It now 
translates all html entities (most notable  ), instead of just a 
handful.

Index: class/data/textfilter.class.php
===================================================================
--- class/data/textfilter.class.php	(revision 4590)
+++ class/data/textfilter.class.php	(revision 4591)
@@ -233,9 +233,13 @@
  		 */
  		function htmlDecode( $htmlString, $quote_style = ENT_QUOTES )
  		{
-            $trans_table = array_flip(get_html_translation_table( HTML_SPECIALCHARS, $quote_style ));
-            $trans_table['''] = "'";
-            return( strtr( $htmlString, $trans_table ));
+                // replace numeric entities
+            $htmlString = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $htmlString);
+            $htmlString = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $htmlString);
+                // replace literal entities
+            $trans_tbl = get_html_translation_table(HTML_ENTITIES);
+            $trans_tbl = array_flip($trans_tbl);
+            return strtr($htmlString, $trans_tbl);
  		}

  		/**


More information about the pLog-svn mailing list