R31859 - in /trunk: infolog/inc/class.infolog_ui.inc.php phpgwapi/inc/class.html.inc.php phpgwapi/inc/class.translation.inc.php

Author: leithoff
New Revision: 31859

URL: http://www.egroupware.org/viewvc/egroupware?rev=31859&view=rev
Log:
improve convertHTMLToText, for toggle editor and mail2infolog process; better control of insert Signature at Top. Only insert the signature, when the compose window is opened the first time (compose/reply/forward), dont do it if sending failes, and the compose window is refreshed (in general when mySigID is set)

Modified:
trunk/infolog/inc/class.infolog_ui.inc.php
trunk/phpgwapi/inc/class.html.inc.php
trunk/phpgwapi/inc/class.translation.inc.php

Modified: trunk/infolog/inc/class.infolog_ui.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/trunk/infolog/inc/class.infolog_ui.inc.php?rev=31859&r1=31858&r2=31859&view=diff

— trunk/infolog/inc/class.infolog_ui.inc.php (original)
+++ trunk/infolog/inc/class.infolog_ui.inc.php Tue Aug 31 16:23:58 2010
@@ -1665,6 +1665,7 @@

		if ($bodyParts[$i]['mimeType'] == 'text/html') {
			// convert HTML to text, as we dont want HTML in infologs
  •   		$newBody = html::purify($newBody);
      		$newBody = $bofelamimail->convertHTMLToText($newBody,true);
      		$bofelamimail->getCleanHTML($newBody); // new Body passed by reference
      		$message .= $newBody;
    

Modified: trunk/phpgwapi/inc/class.html.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/trunk/phpgwapi/inc/class.html.inc.php?rev=31859&r1=31858&r2=31859&view=diff

— trunk/phpgwapi/inc/class.html.inc.php (original)
+++ trunk/phpgwapi/inc/class.html.inc.php Tue Aug 31 16:23:58 2010
@@ -1443,5 +1443,30 @@
}
}
}
+

  • /**
    • split html by PRE tag, return array with all content pre-sections isolated in array elements
    • @author Leithoff, Klaus
    • @param string html
    • @return mixed array of parts or unaffected html
  • */
  • static function splithtmlByPRE($html)
  • {
  •   if (($pos = stripos($html,'<pre>')) === false)
    
  •   {
    
  •   	return $html;
    
  •   }
    
  •   $html2ret[] = substr($html,0,$pos);
    
  •   while ($pos!==false)
    
  •   {
    
  •   	$endofpre = stripos($html,'</pre>',$pos);
    
  •   	$length = $endofpre-$pos+6;
    
  •   	$html2ret[] = substr($html,$pos,$length);
    
  •   	$pos =  stripos($html,'<pre>', $endofpre+6);
    
  •   	$html2ret[] = ($pos ? substr($html,$endofpre+6,$pos-($endofpre+6)): substr($html,$endofpre+6));
    
  •   	//$pos=false;
    
  •   }
    
  •   return $html2ret;
    
  • }
    }
    html::_init_static();

Modified: trunk/phpgwapi/inc/class.translation.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/trunk/phpgwapi/inc/class.translation.inc.php?rev=31859&r1=31858&r2=31859&view=diff

— trunk/phpgwapi/inc/class.translation.inc.php (original)
+++ trunk/phpgwapi/inc/class.translation.inc.php Tue Aug 31 16:23:58 2010
@@ -1139,6 +1139,7 @@
’@&(pound|#163);@i’, // Pound
’@&(copy|#169);@i’, // Copyright
’@&(reg|#174);@i’, // Registered

  •   	'@&#39;@i',                       //   singleQuote
      );
      $Replace = array ('',
      	'"',
    

@@ -1151,11 +1152,26 @@
chr(163),
chr(169),
chr(174),

  •   	"'",
      );
      $_html = preg_replace($Rules, $Replace, $_html);
    
  •   //   removing carriage return linefeeds
    
  •   if ($stripcrl === true ) $_html = preg_replace('@(\r\n)@i',' ',$_html);
    
  •   //   removing carriage return linefeeds, preserve those enclosed in <pre> </pre> tags
    
  •   if ($stripcrl === true ) 
    
  •   {
    
  •   	if (stripos($_html,'<pre>')!==false)
    
  •   	{
    
  •   		$contentArr = html::splithtmlByPRE($_html);
    
  •   		foreach ($contentArr as $k =>&$elem)
    
  •   		{
    
  •   			if (stripos($elem,'<pre>')===false) 
    
  •   			{
    
  •   				$elem = preg_replace('@(\r\n)@i',' ',$elem);
    
  •   			}
    
  •   		}
    
  •   		$_html = implode('',$contentArr);
    
  •   	}
    
  •   }
      $tags = array (
      	0 => '~<h[123][^>]*>\r*\n*~si',
      	1 => '~<h[456][^>]*>\r*\n*~si',
    

@@ -1168,6 +1184,9 @@
8 => ‘~<div[^>]>\r\n*~si’,
9 => ‘~<hr[^>]>\r\n*~si’,
10 => ‘/

/’,
  •   	11 => '/<blockquote>/',
    
  •   	12 => '~</blockquote>~si',
    
  •   	13 => '~<blockquote[^>]*>~si',
      );
      $Replace = array (
      	0 => "\r\n",
    

@@ -1181,6 +1200,9 @@
8 => “\r\n”,
9 => “\r\n__________________________________________________\r\n”,
10 => ‘#blockquote#type#cite#’,

  •   	11 => '#blockquote#type#cite#',
    
  •   	12 => '#blockquote#end#cite#',
    
  •   	13 => '#blockquote#type#cite#',
      );
      $_html = preg_replace($tags,$Replace,$_html);
      $_html = preg_replace('~</t(d|h)>\s*<t(d|h)[^>]*>~si',' - ',$_html);
    

@@ -1200,7 +1222,7 @@
#$_html = preg_replace(’~^\s+~m’,’’,$_html);
#$_html = preg_replace(’~\s+$~m’,’’,$_html);
// restoring the preserved blockquote

  •   $_html = preg_replace('~#blockquote#type#cite#~s','<blockquote type="cite">',$_html);
    
  •   //$_html = str_replace('#blockquote#type#cite#','<blockquote type="cite">',$_html);
    
    
      $_html = html_entity_decode($_html, ENT_COMPAT, $displayCharset);
    

@@ -1214,14 +1236,15 @@
$indent = 0;
$indentString = ‘’;

  •   	$quoteParts = preg_split('/<blockquote type="cite">/', $_html, -1, PREG_SPLIT_OFFSET_CAPTURE);
    
  •   	//$quoteParts = preg_split('/<blockquote type="cite">/', $_html, -1, PREG_SPLIT_OFFSET_CAPTURE);
    
  •   	$quoteParts = preg_split('/#blockquote#type#cite#/', $_html, -1, PREG_SPLIT_OFFSET_CAPTURE);
      	foreach($quoteParts as $quotePart) {
      		if($quotePart[1] > 0) {
      			$indent++;
      			$indentString .= '>';
      		}
    
  •   		$quoteParts2 = preg_split('/<\/blockquote>/', $quotePart[0], -1, PREG_SPLIT_OFFSET_CAPTURE);
    
  •   		//$quoteParts2 = preg_split('/<\/blockquote>/', $quotePart[0], -1, PREG_SPLIT_OFFSET_CAPTURE);
    
  •   		$quoteParts2 = preg_split('/#blockquote#end#cite#/', $quotePart[0], -1, PREG_SPLIT_OFFSET_CAPTURE);
    
      		foreach($quoteParts2 as $quotePart2) {
      			if($quotePart2[1] > 0) {
    

This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel® Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd


eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs