Author: ralfbecker
New Revision: 55366
URL: http://svn.stylite.de/viewvc/egroupware?rev=55366&view=rev
Log:
move egw_htmLawed to api/src/Html/HtmLawed, @Klaus: does mail really need to call that class, cant it use Html::purify?
Added:
trunk/egroupware/api/src/Html/
trunk/egroupware/api/src/Html/HtmLawed.php
- copied, changed from r55365, trunk/phpgwapi/inc/class.egw_htmLawed.inc.php
trunk/egroupware/api/src/Html/htmLawed/
- copied from r55357, trunk/phpgwapi/inc/htmLawed/
Removed:
trunk/phpgwapi/inc/class.egw_htmLawed.inc.php
trunk/phpgwapi/inc/htmLawed/
Modified:
trunk/egroupware/api/src/Html.php
trunk/mail/inc/class.mail_ui.inc.php
— trunk/egroupware/api/src/Html.php (original)
+++ trunk/egroupware/api/src/Html.php Sun Mar 13 12:56:00 2016
@@ -18,7 +18,6 @@
use egw_framework; // validate_file, includeCSS
use egw_ckeditor_config;
use egw; // link
-use egw_htmLawed;
/**
- Generates html with methods representing html-tags or higher widgets
@@ -1281,30 +1280,6 @@
*/
static function purify($html,$config=null,$spec=array(),$_force=false)
{
-
$defaultConfig = array('valid_xhtml'=>1,'safe'=>1);
-
-
if (empty($html)) return $html; // no need to process further
-
if (!empty($config) && is_string($config))
-
{
-
//error_log(__METHOD__.__LINE__.$config);
-
$config = json_decode($config,true);
-
if (is_null($config)) error_log(__METHOD__.__LINE__." decoding of config failed; standard will be applied");
-
}
-
-
// User preferences
-
$font = $GLOBALS['egw_info']['user']['preferences']['common']['rte_font'];
-
$font_size = $GLOBALS['egw_info']['user']['preferences']['common']['rte_font_size'];
-
-
// Check for "blank" = just user preference span - for some reason we can't match on the entity, so approximate
-
$regex = '#^<span style="font-family:'.$font.';font-size:'.$font_size.';">.?</span>$#us';
-
if(preg_match($regex,$html))
-
{
-
return '';
-
}
-
$htmLawed = new egw_htmLawed();
-
if (is_array($config) && $_force===false) $config = array_merge($defaultConfig, $config);
-
if (empty($config)) $config = $defaultConfig;
-
//error_log(__METHOD__.__LINE__.array2string($config));
-
return $htmLawed->egw_htmLawed($html,$config,$spec);
— trunk/phpgwapi/inc/class.egw_htmLawed.inc.php (original)
+++ trunk/egroupware/api/src/Html/HtmLawed.php Sun Mar 13 12:56:00 2016
@@ -5,19 +5,21 @@
-require_once(EGW_API_INC.’/htmLawed/htmLawed.php’);
+namespace EGroupware\Api\Html;
+
+require_once(DIR.’/htmLawed/htmLawed.php’);
/**
-
This class does NOT use anything EGroupware specific, it just calls htmLawed and supports autoloading
-
while matching egw namespace requirements. It also provides (as a non class function ) a hook_tag function
-
to do further tag / attribute validation
/
-class egw_htmLawed
+class HtmLawed
{
/*
- config options see constructor
@@ -95,14 +97,14 @@
}
/**
-
- Run htmLawed
-
-
@param varchar $html2check =text input Text to check
-
@param mixed $Config = text or array
-
@param mixed $Spec =text or array; The ‘$spec’ argument can be used to disallow an otherwise legal attribute for an element
-
@return varchar cleaned/fixed html
*/
- function egw_htmLawed($html2check, $Config=null, $Spec=array())
- function run($html2check, $Config=null, $Spec=array())
{
//error_log(METHOD.LINE.’ Input:’.$html2check);
if (is_array($Config) && is_array($this->Configuration)) $Config = array_merge($this->Configuration, $Config);
@@ -207,11 +209,11 @@
{
return ‘’;
}
— trunk/mail/inc/class.mail_ui.inc.php (original)
+++ trunk/mail/inc/class.mail_ui.inc.php Sun Mar 13 12:56:00 2016
@@ -9,6 +9,8 @@
+use EGroupware\Api;
/**
- Mail User Interface
@@ -2948,11 +2950,11 @@
$hasOther = true;
$newBody = $matches[2];
}
-
$htmLawed = new Api\Html\HtmLawed();
// the next line should not be needed, but produces better results on HTML 2 Text conversion,
// as we switched off HTMLaweds tidy functionality
$newBody = str_replace(array('&amp;','<DIV><BR></DIV>',"<DIV> </DIV>",'<div> </div>'),array('&','<BR>','<BR>','<BR>'),$newBody);
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs