diff --git a/api/src/Html/HtmLawed.php b/api/src/Html/HtmLawed.php index 1f45698fe7..3fc73a6bb2 100644 --- a/api/src/Html/HtmLawed.php +++ b/api/src/Html/HtmLawed.php @@ -14,9 +14,6 @@ namespace EGroupware\Api\Html; use EGroupware\Api; -// explicitly name old, not yet converted api classes -use translation; // mail specific stuff not in Api\Translation - require_once(__DIR__.'/htmLawed/htmLawed.php'); /** @@ -141,7 +138,7 @@ class HtmLawed { //error_log(__METHOD__.__LINE__.array2string($newStyle[0])); $style2buffer = implode('',$newStyle[0]); - // only replace what we have found, we use it here, as we use the same routine in translation::replaceTagsCompletley + // only replace what we have found, we use it here, as we use the same routine in Api\Mail\Html::replaceTagsCompletley // no need to do the extra routine $html = str_ireplace($newStyle[0],'',$html); } @@ -170,15 +167,15 @@ class HtmLawed // CSS Security // http://code.google.com/p/browsersec/wiki/Part1#Cascading_stylesheets $css = preg_replace('/(javascript|expession|-moz-binding)/i','',$style); - if (stripos($css,'script')!==false) translation::replaceTagsCompletley($css,'script'); // Strip out script that may be included + if (stripos($css,'script')!==false) Api\Mail\Html::replaceTagsCompletley($css,'script'); // Strip out script that may be included // we need this, as styledefinitions are enclosed with curly brackets; and template stuff tries to replace everything between curly brackets that is having no horizontal whitespace // as the comments as in stylesheet are outdated, and ck-editor does not understand it, we remove it $css_no_comment = str_replace(array(':',''),array(': ','',''),$css); //error_log(__METHOD__.__LINE__.$css); - // we already removed what we have found, above, as we used pretty much the same routine as in translation::replaceTagsCompletley + // we already removed what we have found, above, as we used pretty much the same routine as in Api\Mail\Html::replaceTagsCompletley // no need to do the extra routine // TODO: we may have to strip urls and maybe comments and ifs - //if (stripos($html,'style')!==false) translation::replaceTagsCompletley($html,'style'); // clean out empty or pagewide style definitions / left over tags + //if (stripos($html,'style')!==false) Api\Mail\Html::replaceTagsCompletley($html,'style'); // clean out empty or pagewide style definitions / left over tags return $css_no_comment; } diff --git a/api/src/Mail.php b/api/src/Mail.php index 8431e237e9..db9b093e2c 100644 --- a/api/src/Mail.php +++ b/api/src/Mail.php @@ -31,7 +31,6 @@ use Horde_Mime_Mdn; use tidy; // old not yet converted api classes -use translation; // mail stuff not in Api\Translation use addressbook_merge; // should go to Contacts\Merge /** @@ -1529,7 +1528,7 @@ class Mail if (empty($headerObject['BODYPREVIEW'])&&$part->getPrimaryType()== 'text') { $charset = $part->getContentTypeParameter('charset'); - $buffer = translation::convertHTMLToText($part->toString(array( + $buffer = Mail\Html::convertHTMLToText($part->toString(array( 'encode' => Horde_Mime_Part::ENCODE_BINARY, // otherwise we cant recode charset )), $charset, 'utf-8'); $headerObject['BODYPREVIEW']=trim(str_replace(array("\r\n","\r","\n"),' ',mb_substr(Translation::convert_jsonsafe($buffer),0,((int)$_fetchPreviews<300?300:$_fetchPreviews)))); @@ -1562,7 +1561,7 @@ class Mail ($partdisposition !== 'attachment')) { $_structure=$part; $this->fetchPartContents($uid, $_structure, false,true); - $headerObject['BODYPREVIEW']=trim(str_replace(array("\r\n","\r","\n"),' ',mb_substr(translation::convertHTMLToText($_structure->getContents()),0,((int)$_fetchPreviews<300?300:$_fetchPreviews)))); + $headerObject['BODYPREVIEW']=trim(str_replace(array("\r\n","\r","\n"),' ',mb_substr(Mail\Html::convertHTMLToText($_structure->getContents()),0,((int)$_fetchPreviews<300?300:$_fetchPreviews)))); $charSet=Translation::detect_encoding($headerObject['BODYPREVIEW']); // add line breaks to $bodyParts //error_log(__METHOD__.' ('.__LINE__.') '.' Charset:'.$bodyParts[$i]['charSet'].'->'.$bodyParts[$i]['body']); @@ -2212,7 +2211,7 @@ class Mail } else { - $_string = translation::decodeMailHeader($_string,self::$displayCharset); + $_string = Mail\Html::decodeMailHeader($_string,self::$displayCharset); $test = @json_encode($_string); //error_log(__METHOD__.__LINE__.' ->'.strlen($singleBodyPart['body']).' Error:'.json_last_error().'<- BodyPart:#'.$test.'#'); if (($test=="null" || $test === false || is_null($test)) && strlen($_string)>0) @@ -4175,18 +4174,18 @@ class Mail $_html = str_replace(array('&','