svn: /web/doc-editor/trunk/php/ File.php

[email protected] (Yannick Torres)
Newsgroups php.doc.web
Message-ID <[email protected]>
yannick                                  Mon, 15 Mar 2010 15:44:53 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=296248

Log:
By default htmlentities assume data is encoded to iso-8859-1. Explicitly tells him that this data is UTF8 ; Minimize the return data (suppress new line)

Changed paths:
    U   web/doc-editor/trunk/php/File.php

Modified: web/doc-editor/trunk/php/File.php
===================================================================
--- web/doc-editor/trunk/php/File.php	2010-03-15 15:38:45 UTC (rev 296247)
+++ web/doc-editor/trunk/php/File.php	2010-03-15 15:44:53 UTC (rev 296248)
@@ -363,7 +363,7 @@

             $ext = ( $options['type'] == 'patch' ) ? '.' . $options['uniqID'] . '.patch' : '.new';
             $cmd = 'cd '.$appConf[$project]['vcs.path'].$this->lang.$this->path.'; '
-                  .'diff -uN '.$this->name.' '.$this->name.$ext;
+                  .'diff -u '.$this->name.' '.$this->name.$ext;

             $output = array();
             $trial_threshold = 3;
@@ -375,7 +375,7 @@

         }

-        $output = htmlentities(join("\n", $output));
+        $output = htmlentities(join("\n", $output), ENT_QUOTES, 'UTF-8');
         $match = array();
         preg_match_all('/@@([^@]+)@@(.*?)(?=@@|\z)/si', $output, $match);

@@ -390,11 +390,7 @@
         for ($i = 0; $i < count($diff); $i++) {

             // Line
-            $return .= '
-             <tr>
-              <td class="line">'.$diff[$i]['line'].'</td>
-             </tr>
-            ';
+            $return .= '<tr><td class="line">'.$diff[$i]['line'].'</td></tr>';

             // Content
             $tmp = explode("\n", trim($diff[$i]['content']));
@@ -414,19 +410,11 @@
                         break;
                 }

-                $return .= '
-                 <tr>
-                  <td class="'.$class.'">'.$tmp[$j].'</td>
-                 </tr>
-                ';
+                $return .= '<tr><td class="'.$class.'">'.$tmp[$j].'</td></tr>';
             }

             // Separator
-            $return .= '
-             <tr>
-              <td class="truncated">&nbsp;</td>
-             </tr>
-            ';
+            $return .= '<tr><td class="truncated">&nbsp;</td></tr>';
         }
         $return .= '<table>';
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.