From 52d7843e9f91ee0350fbab92a924b365ea32d9cf Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Sat, 28 May 2011 23:30:15 +0200 Subject: [PATCH] Remove trailing whitespaces. Signed-off-by: Florent Bruneau --- banana/message.func.inc.php | 10 +- banana/message.inc.php | 2 +- banana/mimepart.inc.php | 26 ++--- banana/nntpcore.inc.php | 28 ++--- banana/protocoleinterface.inc.php | 6 +- banana/text.func.inc.php | 228 +++++++++++++++++++------------------- 6 files changed, 150 insertions(+), 150 deletions(-) diff --git a/banana/message.func.inc.php b/banana/message.func.inc.php index 8df5cd4..3714015 100644 --- a/banana/message.func.inc.php +++ b/banana/message.func.inc.php @@ -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, '

')); $res = preg_replace("@@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); } diff --git a/banana/message.inc.php b/banana/message.inc.php index 8eba97a..da5b05c 100644 --- a/banana/message.inc.php +++ b/banana/message.inc.php @@ -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'])); } diff --git a/banana/mimepart.inc.php b/banana/mimepart.inc.php index d086dbf..28281e9 100644 --- a/banana/mimepart.inc.php +++ b/banana/mimepart.inc.php @@ -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; diff --git a/banana/nntpcore.inc.php b/banana/nntpcore.inc.php index 80322ad..a1cc90f 100644 --- a/banana/nntpcore.inc.php +++ b/banana/nntpcore.inc.php @@ -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: ?> diff --git a/banana/protocoleinterface.inc.php b/banana/protocoleinterface.inc.php index e059ec5..4f4b496 100644 --- a/banana/protocoleinterface.inc.php +++ b/banana/protocoleinterface.inc.php @@ -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) diff --git a/banana/text.func.inc.php b/banana/text.func.inc.php index 822fd1f..483d281 100644 --- a/banana/text.func.inc.php +++ b/banana/text.func.inc.php @@ -1,114 +1,114 @@ -= 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: -?> += 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: +?> -- 2.1.4