Remove trailing whitespaces.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 28 May 2011 21:30:15 +0000 (23:30 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 28 May 2011 21:30:15 +0000 (23:30 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
banana/message.func.inc.php
banana/message.inc.php
banana/mimepart.inc.php
banana/nntpcore.inc.php
banana/protocoleinterface.inc.php
banana/text.func.inc.php

index 8df5cd4..3714015 100644 (file)
@@ -354,7 +354,7 @@ function banana_filterCss($css)
     }
     return $css;
 }
-    
+
 /**
  * @return string
  * @param string
@@ -366,7 +366,7 @@ function banana_cleanHtml($source, $to_xhtml = false)
         $tidy_config = array('drop-empty-paras' => true,
                              'drop-proprietary-attributes' => true,
                              'hide-comments' => true,
-                             'logical-emphasis' => true, 
+                             'logical-emphasis' => true,
                              'output-xhtml' => true,
                              'replace-color' => true,
                              'join-classes'  => false,
@@ -414,7 +414,7 @@ function banana_cleanHtml($source, $to_xhtml = false)
     // Use inlined style instead of old html attributes
     if ($to_xhtml) {
         $source = preg_replace('/<(\/?\w+)(.*?)(\/?>)/muise', "'<\\1' . banana_cleanStyles('\\1', '\\2') . '\\3'", $source);
-    }    
+    }
     return preg_replace('/<(.*?)>/ie', "'<'.banana_removeEvilAttributes('\\1').'>'", $source);
 }
 
@@ -489,7 +489,7 @@ function banana_htmlToPlainText($res)
     $res = trim(strip_tags($res, '<div><br><p><blockquote>'));
     $res = preg_replace("@</?(br|p|div).*?>@si", "\n", $res);
     $res = banana__convertQuotes($res);
-    return banana_html_entity_decode($res);    
+    return banana_html_entity_decode($res);
 }
 
 function banana_formatHtml(BananaMimePart $part)
@@ -498,7 +498,7 @@ function banana_formatHtml(BananaMimePart $part)
     $text = banana_catchHtmlSignature($text);
     if (!Banana::$msgshow_externalimages) {
         $text = banana_hideExternalImages($text);
-    }    
+    }
     $text = banana_catchPartLinks($text);
     return banana_cleanHtml($text, true);
 }
index 8eba97a..da5b05c 100644 (file)
@@ -219,7 +219,7 @@ final class BananaMessage extends BananaMimePart
 
     public function hasXFace()
     {
-        return Banana::$msgshow_xface && 
+        return Banana::$msgshow_xface &&
                ((function_exists('hook_hasxface') && hook_hasXFace($this->headers))
                || isset($this->headers['x-face']));
     }
index d086dbf..28281e9 100644 (file)
@@ -107,7 +107,7 @@ class BananaMimePart
             $this->body         = null;
             $this->format       = null;
             $this->id           = null;
-        } 
+        }
     }
 
     public function addAttachment(array $file, $content_type = null, $disposition = 'attachment')
@@ -136,7 +136,7 @@ class BananaMimePart
             return trim($matches[1]);
         }
         return null;
-    } 
+    }
 
     protected function fromRaw($data)
     {
@@ -229,11 +229,11 @@ class BananaMimePart
         foreach ($parts as &$part) {
             $newpart = new BananaMimePart($part);
             if (!is_null($newpart->content_type)) {
-                if ($signed && $newpart->content_type == $this->signature['protocole']) { 
+                if ($signed && $newpart->content_type == $this->signature['protocole']) {
                     $signature = $newpart->body;
-                } elseif ($signed) { 
-                    $signed_message = $part; 
-                } 
+                } elseif ($signed) {
+                    $signed_message = $part;
+                }
                 $this->multipart[] = $newpart;
             }
         }
@@ -260,7 +260,7 @@ class BananaMimePart
     private function findUUEncoded()
     {
         $this->decodeContent();
-        $parts = array(); 
+        $parts = array();
         if (preg_match_all("/\n(begin \d+ ([^\r\n]+)\r?(?:\n(?!end)[^\n]*)*\nend)/",
             $this->body, $matches, PREG_SET_ORDER)) {
             foreach ($matches as &$match) {
@@ -418,15 +418,15 @@ class BananaMimePart
         $content = "";
         if ($with_headers) {
             foreach ($this->getHeaders() as $key => $value) {
-                $line = "$key: $value"; 
+                $line = "$key: $value";
                 $line = explode("\n", wordwrap($line, Banana::$msgshow_wrap));
                 for ($i = 1 ; $i < count($line) ; $i++) {
                     $line[$i] = "\t" . $line[$i];
                 }
                 $content .= implode("\n", $line) . "\n";
-            } 
+            }
             $content .= "\n";
-        } 
+        }
         if ($this->isType('multipart')) {
             $this->setBoundary();
             foreach ($this->multipart as &$part) {
@@ -443,9 +443,9 @@ class BananaMimePart
 
     public function getText()
     {
-        $signed =& $this->getSignedPart(); 
-        if ($signed !== $this) { 
-            return $signed->getText(); 
+        $signed =& $this->getSignedPart();
+        if ($signed !== $this) {
+            return $signed->getText();
         }
         $this->decodeContent();
         return $this->body;
index 80322ad..a1cc90f 100644 (file)
@@ -98,7 +98,7 @@ class BananaNNTPCore
 # Socket functions
 
     /** get a line from server
-     * @return STRING 
+     * @return STRING
      */
     private function &getLine()
     {
@@ -129,7 +129,7 @@ class BananaNNTPCore
     private function putLine($line, $format = false)
     {
         if ($format) {
-            $line = str_replace(array("\r", "\n"), '', $line);  
+            $line = str_replace(array("\r", "\n"), '', $line);
             $line .= "\r\n";
         }
         if ($this->debug) {
@@ -208,9 +208,9 @@ class BananaNNTPCore
 
     /** retrieves an article
      * MSGID is a numeric ID a shown in article's headers. MSGNUM is a
-     * server-dependent ID (see X-Ref on many servers) and retriving 
+     * server-dependent ID (see X-Ref on many servers) and retriving
      * an article by this way will change the current article pointer.
-     * If an error occur, false is returned. 
+     * If an error occur, false is returned.
      * @param $_msgid STRING MSGID or MSGNUM of article
      * @return ARRAY lines of the article
      * @see body
@@ -227,7 +227,7 @@ class BananaNNTPCore
     /** post a message
      * if an error occur, false is returned
      * @param $_message STRING message to post
-     * @return STRING MSGID of article 
+     * @return STRING MSGID of article
      */
     public function post($message)
     {
@@ -275,7 +275,7 @@ class BananaNNTPCore
     }
 
     /** set current group
-     * @param $_group STRING 
+     * @param $_group STRING
      * @return ARRAY array : nb of articles in group, MSGNUM of first article, MSGNUM of last article, and group name
      */
     public function group($group)
@@ -374,10 +374,10 @@ class BananaNNTPCore
         return gmdate("ymd His", $since) . ' GMT';
     }
 
-    /** get information about recent newsgroups 
+    /** get information about recent newsgroups
      * same as list, but information are limited to newgroups created after $_since
      * @param $_since INTEGER unix timestamp
-     * @param $_distributions STRING distributions 
+     * @param $_distributions STRING distributions
      * @return ARRAY same format as liste
      * @see liste
      */
@@ -394,7 +394,7 @@ class BananaNNTPCore
 
     /** gets a list of new articles
      * @param $_since INTEGER unix timestamp
-     * @parma $_groups STRING pattern of intersting groups 
+     * @parma $_groups STRING pattern of intersting groups
      * @return ARRAY MSGID of new articles
      */
     public function newnews($groups = '*', $since = 0, $distributions = '')
@@ -419,7 +419,7 @@ class BananaNNTPCore
     /** implements IHAVE method
      * @param $_msgid STRING MSGID of article
      * @param $_message STRING article
-     * @return BOOLEAN 
+     * @return BOOLEAN
      */
     public function ihave($msgid, $message = false)
     {
@@ -442,7 +442,7 @@ class BananaNNTPCore
 # NNTP Extensions [RFC 2980]
 
     /** Returns the date on the remote server
-     * @return INTEGER timestamp 
+     * @return INTEGER timestamp
      */
 
     public function date()
@@ -477,7 +477,7 @@ class BananaNNTPCore
 
     /** obtain the header field $hdr for all the messages specified
      * @param $_hdr STRING name of the header (eg: 'From')
-     * @param $_range STRING range of articles 
+     * @param $_range STRING range of articles
      * @return ARRAY MSGNUM => header value
      */
     public function xhdr($hdr, $first = null, $last = null)
@@ -501,7 +501,7 @@ class BananaNNTPCore
 
     /** obtain the header field $_hdr matching $_pat for all the messages specified
      * @param $_hdr STRING name of the header (eg: 'From')
-     * @param $_range STRING range of articles 
+     * @param $_range STRING range of articles
      * @param $_pat STRING pattern
      * @return ARRAY MSGNUM => header value
      */
@@ -520,5 +520,5 @@ class BananaNNTPCore
     }
 }
 
-// vim:set et sw=4 sts=4 ts=4 enc=utf-8: 
+// vim:set et sw=4 sts=4 ts=4 enc=utf-8:
 ?>
index e059ec5..4f4b496 100644 (file)
@@ -18,11 +18,11 @@ interface BananaProtocoleInterface
     /** Indicate if the Protocole handler has been succesfully built
      */
     public function isValid();
-    
+
     /** Indicate last error n°
      */
     public function lastErrNo();
-    
+
     /** Indicate last error text
      */
     public function lastError();
@@ -49,7 +49,7 @@ interface BananaProtocoleInterface
      * @param id Id of the emssage (can be either an Message-id or a message index)
      * @return The sources of the message (or null)
      */
-    public function getMessageSource($id); 
+    public function getMessageSource($id);
 
     /** Return the indexes of the messages presents in the Box
      * @return Array(number of messages, MSGNUM of the first message, MSGNUM of the last message)
index 822fd1f..483d281 100644 (file)
-<?php\r
-/********************************************************************************\r
-* banana/text.php : text tools\r
-* ---------------\r
-*\r
-* This file is part of the banana distribution\r
-* Copyright: See COPYING files that comes with this distribution\r
-********************************************************************************/\r
-\r
-if (function_exists('dgettext')) {\r
-    function _b_($str)\r
-    {\r
-        return dgettext('banana', $str);\r
-    }\r
-} else {\r
-    function _b_($str)\r
-    {\r
-        return $str;\r
-    }\r
-}\r
-\r
-if (!function_exists('is_utf8')) {\r
-    function is_utf8($s)\r
-    {\r
-        return @iconv('utf-8', 'utf-8', $s) == $s;\r
-    }\r
-}\r
-\r
-function banana_entities($source)\r
-{\r
-    if (is_string($source)) {\r
-        return banana_htmlentities($source);\r
-    } else {\r
-        return $source;\r
-    }\r
-}\r
-\r
-function banana_utf8entities($source)\r
-{\r
-   // array used to figure what number to decrement from character order value \r
-   // according to number of characters used to map unicode to ascii by utf-8\r
-   $decrement[4] = 240;\r
-   $decrement[3] = 224;\r
-   $decrement[2] = 192;\r
-   $decrement[1] = 0;\r
-   \r
-   // the number of bits to shift each charNum by\r
-   $shift[1][0] = 0;\r
-   $shift[2][0] = 6;\r
-   $shift[2][1] = 0;\r
-   $shift[3][0] = 12;\r
-   $shift[3][1] = 6;\r
-   $shift[3][2] = 0;\r
-   $shift[4][0] = 18;\r
-   $shift[4][1] = 12;\r
-   $shift[4][2] = 6;\r
-   $shift[4][3] = 0;\r
-   \r
-   $pos = 0;\r
-   $len = strlen($source);\r
-   $encodedString = '';\r
-   while ($pos < $len)\r
-   {\r
-      $charPos = $source{$pos};\r
-      $asciiPos = ord($charPos);\r
-      if ($asciiPos < 128)\r
-      {\r
-         $encodedString .= $charPos;\r
-         $pos++;\r
-         continue;\r
-      }\r
-      \r
-      $i=1;\r
-      if (($asciiPos >= 240) && ($asciiPos <= 255)) // 4 chars representing one unicode character\r
-         $i=4;\r
-      else if (($asciiPos >= 224) && ($asciiPos <= 239)) // 3 chars representing one unicode character\r
-         $i=3;\r
-      else if (($asciiPos >= 192) && ($asciiPos <= 223)) // 2 chars representing one unicode character\r
-         $i=2;\r
-      else // 1 char (lower ascii)\r
-         $i=1;\r
-      $thisLetter = substr($source, $pos, $i);\r
-      $pos += $i;\r
-      \r
-      // process the string representing the letter to a unicode entity\r
-      $thisLen = strlen($thisLetter);\r
-      $thisPos = 0;\r
-      $decimalCode = 0;\r
-      while ($thisPos < $thisLen)\r
-      {\r
-         $thisCharOrd = ord(substr($thisLetter, $thisPos, 1));\r
-         if ($thisPos == 0)\r
-         {\r
-            $charNum = intval($thisCharOrd - $decrement[$thisLen]);\r
-            $decimalCode += ($charNum << $shift[$thisLen][$thisPos]);\r
-         }\r
-         else\r
-         {\r
-            $charNum = intval($thisCharOrd - 128);\r
-            $decimalCode += ($charNum << $shift[$thisLen][$thisPos]);\r
-         }\r
-         \r
-         $thisPos++;\r
-      }\r
-      \r
-      $encodedLetter = '&#'. str_pad($decimalCode, ($thisLen==1)?3:5, '0', STR_PAD_LEFT).';';\r
-      $encodedString .= $encodedLetter;\r
-   }\r
-   \r
-   return $encodedString;\r
-}\r
-\r
-// vim:set et sw=4 sts=4 ts=4 enc=utf-8:\r
-?>\r
+<?php
+/********************************************************************************
+* banana/text.php : text tools
+* ---------------
+*
+* This file is part of the banana distribution
+* Copyright: See COPYING files that comes with this distribution
+********************************************************************************/
+
+if (function_exists('dgettext')) {
+    function _b_($str)
+    {
+        return dgettext('banana', $str);
+    }
+} else {
+    function _b_($str)
+    {
+        return $str;
+    }
+}
+
+if (!function_exists('is_utf8')) {
+    function is_utf8($s)
+    {
+        return @iconv('utf-8', 'utf-8', $s) == $s;
+    }
+}
+
+function banana_entities($source)
+{
+    if (is_string($source)) {
+        return banana_htmlentities($source);
+    } else {
+        return $source;
+    }
+}
+
+function banana_utf8entities($source)
+{
+   // array used to figure what number to decrement from character order value
+   // according to number of characters used to map unicode to ascii by utf-8
+   $decrement[4] = 240;
+   $decrement[3] = 224;
+   $decrement[2] = 192;
+   $decrement[1] = 0;
+
+   // the number of bits to shift each charNum by
+   $shift[1][0] = 0;
+   $shift[2][0] = 6;
+   $shift[2][1] = 0;
+   $shift[3][0] = 12;
+   $shift[3][1] = 6;
+   $shift[3][2] = 0;
+   $shift[4][0] = 18;
+   $shift[4][1] = 12;
+   $shift[4][2] = 6;
+   $shift[4][3] = 0;
+
+   $pos = 0;
+   $len = strlen($source);
+   $encodedString = '';
+   while ($pos < $len)
+   {
+      $charPos = $source{$pos};
+      $asciiPos = ord($charPos);
+      if ($asciiPos < 128)
+      {
+         $encodedString .= $charPos;
+         $pos++;
+         continue;
+      }
+
+      $i=1;
+      if (($asciiPos >= 240) && ($asciiPos <= 255)) // 4 chars representing one unicode character
+         $i=4;
+      else if (($asciiPos >= 224) && ($asciiPos <= 239)) // 3 chars representing one unicode character
+         $i=3;
+      else if (($asciiPos >= 192) && ($asciiPos <= 223)) // 2 chars representing one unicode character
+         $i=2;
+      else // 1 char (lower ascii)
+         $i=1;
+      $thisLetter = substr($source, $pos, $i);
+      $pos += $i;
+
+      // process the string representing the letter to a unicode entity
+      $thisLen = strlen($thisLetter);
+      $thisPos = 0;
+      $decimalCode = 0;
+      while ($thisPos < $thisLen)
+      {
+         $thisCharOrd = ord(substr($thisLetter, $thisPos, 1));
+         if ($thisPos == 0)
+         {
+            $charNum = intval($thisCharOrd - $decrement[$thisLen]);
+            $decimalCode += ($charNum << $shift[$thisLen][$thisPos]);
+         }
+         else
+         {
+            $charNum = intval($thisCharOrd - 128);
+            $decimalCode += ($charNum << $shift[$thisLen][$thisPos]);
+         }
+
+         $thisPos++;
+      }
+
+      $encodedLetter = '&#'. str_pad($decimalCode, ($thisLen==1)?3:5, '0', STR_PAD_LEFT).';';
+      $encodedString .= $encodedLetter;
+   }
+
+   return $encodedString;
+}
+
+// vim:set et sw=4 sts=4 ts=4 enc=utf-8:
+?>