mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-27 02:14:45 +01:00
rework of bofelamimail::_strtotime, to make propper use of egw_time; performance issue: limit the number of links and email to be parsed (and adapted) to 100 each, as it should be sufficient for most standard emails; try to further improve the display of textmails; backport of bofelamimails version of wordwrap from trunk (allow to skip lines that start with )
This commit is contained in:
parent
b08373cde5
commit
f7652eeb07
1146
felamimail/inc/class.bocompose.inc.php
Normal file
1146
felamimail/inc/class.bocompose.inc.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -2706,7 +2706,7 @@
|
|||||||
return $userACL;
|
return $userACL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function wordwrap($str, $cols, $cut)
|
static function wordwrap($str, $cols, $cut, $dontbreaklinesstartingwith=false)
|
||||||
{
|
{
|
||||||
$lines = explode("\n", $str);
|
$lines = explode("\n", $str);
|
||||||
$newStr = '';
|
$newStr = '';
|
||||||
@ -2716,7 +2716,14 @@
|
|||||||
//$line = str_replace("\t"," ",$line);
|
//$line = str_replace("\t"," ",$line);
|
||||||
//$newStr .= wordwrap($line, $cols, $cut);
|
//$newStr .= wordwrap($line, $cols, $cut);
|
||||||
$allowedLength = $cols-strlen($cut);
|
$allowedLength = $cols-strlen($cut);
|
||||||
if (strlen($line) > $allowedLength) {
|
if (strlen($line) > $allowedLength &&
|
||||||
|
($dontbreaklinesstartingwith==false ||
|
||||||
|
($dontbreaklinesstartingwith &&
|
||||||
|
strlen($dontbreaklinesstartingwith)>=1 &&
|
||||||
|
substr($line,0,strlen($dontbreaklinesstartingwith)) != $dontbreaklinesstartingwith
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) {
|
||||||
$s=explode(" ", $line);
|
$s=explode(" ", $line);
|
||||||
$line = "";
|
$line = "";
|
||||||
$linecnt = 0;
|
$linecnt = 0;
|
||||||
@ -2932,21 +2939,26 @@
|
|||||||
/**
|
/**
|
||||||
* Helper function to handle wrong or unrecognized timezones
|
* Helper function to handle wrong or unrecognized timezones
|
||||||
* returns the date as it is parseable by strtotime, or current timestamp if everything failes
|
* returns the date as it is parseable by strtotime, or current timestamp if everything failes
|
||||||
|
* @param string date to be parsed/formatted
|
||||||
|
* @param string format string, if none is passed, use the users common dateformat supplemented by the time hour:minute:second
|
||||||
|
* @return string returns the date as it is parseable by strtotime, or current timestamp if everything failes
|
||||||
*/
|
*/
|
||||||
static function _strtotime($date='')
|
static function _strtotime($date='',$format=NULL)
|
||||||
{
|
{
|
||||||
if (strtotime($date)===false)
|
if ($format==NULL) $format = $GLOBALS['egw_info']['user']['preferences']['common']['dateformat'].' '.'H:i:s';
|
||||||
|
$date2return = egw_time::to($date,$format);
|
||||||
|
if ($date2return==null)
|
||||||
{
|
{
|
||||||
$dtarr = explode(' ',$date);
|
$dtarr = explode(' ',$date);
|
||||||
$test = false;
|
$test = null;
|
||||||
while ($test===false && count($dtarr)>=1)
|
while ($test===null && count($dtarr)>=1)
|
||||||
{
|
{
|
||||||
array_pop($dtarr);
|
array_pop($dtarr);
|
||||||
$test=strtotime(implode(' ',$dtarr));
|
$test= egw_time::to(implode(' ',$dtarr),$format);
|
||||||
if ($test) $date = implode(' ',$dtarr);
|
if ($test) $date2return = $test;
|
||||||
}
|
}
|
||||||
if ($test===false) $date = strtotime('now');
|
if ($test===null) $date2return = egw_time::to('now',$format);
|
||||||
}
|
}
|
||||||
return $date;
|
return $date2return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1649
felamimail/inc/class.uidisplay.inc.php
Normal file
1649
felamimail/inc/class.uidisplay.inc.php
Normal file
File diff suppressed because it is too large
Load Diff
1019
felamimail/inc/class.uiwidgets.inc.php
Normal file
1019
felamimail/inc/class.uiwidgets.inc.php
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user