mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-09 06:51:14 +01:00
handling of multibyte chars in attribute values of tags in mbstring.func_overload enviroments,
as substr_replace does not have a multibyte func overload function associated. Thus substr_replace(, '', 0, strlen()) will fall short in the above mentioned enviroments; we use our own bytes-function now introduced into htmLawed
This commit is contained in:
parent
2427a60c90
commit
b6638adc24
@ -99,6 +99,7 @@ class egw_htmLawed
|
|||||||
*/
|
*/
|
||||||
function egw_htmLawed($html2check, $Config=null, $Spec=array())
|
function egw_htmLawed($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);
|
if (is_array($Config) && is_array($this->Configuration)) $Config = array_merge($this->Configuration, $Config);
|
||||||
if (empty($Config)) $Config = $this->Configuration;
|
if (empty($Config)) $Config = $this->Configuration;
|
||||||
if (empty($Spec)) $Spec = $this->Spec;
|
if (empty($Spec)) $Spec = $this->Spec;
|
||||||
@ -116,7 +117,7 @@ class egw_htmLawed
|
|||||||
*/
|
*/
|
||||||
function hl_my_tag_transform($element, $attribute_array)
|
function hl_my_tag_transform($element, $attribute_array)
|
||||||
{
|
{
|
||||||
//if ($element=='a') error_log(__METHOD__.__LINE__." ".$element.'->'.array2string($attribute_array));
|
//if ($element=='img') error_log(__METHOD__.__LINE__." ".$element.'->'.array2string($attribute_array));
|
||||||
// Elements other than 'img' or 'img' without a 'img' attribute are returned unchanged
|
// Elements other than 'img' or 'img' without a 'img' attribute are returned unchanged
|
||||||
if($element == 'img')
|
if($element == 'img')
|
||||||
{
|
{
|
||||||
|
@ -471,7 +471,7 @@ while(strlen($a)){
|
|||||||
}
|
}
|
||||||
break; case 2: // Val
|
break; case 2: // Val
|
||||||
if(preg_match('`^"[^"]*"`', $a, $m) or preg_match("`^'[^']*'`", $a, $m) or preg_match("`^\s*[^\s\"']+`", $a, $m)){
|
if(preg_match('`^"[^"]*"`', $a, $m) or preg_match("`^'[^']*'`", $a, $m) or preg_match("`^\s*[^\s\"']+`", $a, $m)){
|
||||||
$m = $m[0]; $w = 1; $mode = 0; $a = ltrim(substr_replace($a, '', 0, strlen($m)));
|
$m = $m[0]; $w = 1; $mode = 0; $a = ltrim(substr_replace($a, '', 0, hl_bytes($m)));
|
||||||
$aA[$nm] = trim(($m[0] == '"' or $m[0] == '\'') ? substr($m, 1, -1) : $m);
|
$aA[$nm] = trim(($m[0] == '"' or $m[0] == '\'') ? substr($m, 1, -1) : $m);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -684,6 +684,20 @@ return str_replace(array("\x01", "\x02", "\x03", "\x04", "\x05", "\x07"), array(
|
|||||||
// eof
|
// eof
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the number of bytes of a string, independent of mbstring.func_overload
|
||||||
|
* AND the availability of mbstring
|
||||||
|
*
|
||||||
|
* @param string $str
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
function hl_bytes($str)
|
||||||
|
{
|
||||||
|
static $func_overload;
|
||||||
|
if (is_null($func_overload)) $func_overload = extension_loaded('mbstring') ? ini_get('mbstring.func_overload') : 0;
|
||||||
|
return $func_overload & 2 ? mb_strlen($str,'8bit') : strlen($str);
|
||||||
|
}
|
||||||
|
|
||||||
function hl_version(){
|
function hl_version(){
|
||||||
// rel
|
// rel
|
||||||
return '1.1.10';
|
return '1.1.10';
|
||||||
|
Loading…
Reference in New Issue
Block a user