2
0
forked from Wavyzz/dolibarr

FIX Fix and move dolGetFirstLine function into main

FIX Hang on ->client not defined
This commit is contained in:
Laurent Destailleur
2016-04-22 19:07:32 +02:00
parent 467662143f
commit bfc5be1aad
8 changed files with 36 additions and 31 deletions

View File

@@ -30,26 +30,6 @@
// Enable this line to trace path when function is called.
//print xdebug_print_function_stack('Functions2.lib was called');exit;
/**
* Return first line of text. Cut will depends if content is HTML or not.
*
* @param string $text Input text
* @return string Output text
* @see dol_nboflines_bis
*/
function dolGetFirstLineOfText($text)
{
if (dol_textishtml($text))
{
$firstline=preg_replace('/<br[^>]*>.*$/s','',$text); // The s pattern modifier means the . can match newline characters
}
else
{
$firstline=preg_replace('/[\n\r].*/','',$text);
}
return $firstline.((strlen($firstline) != strlen($text))?'...':'');
}
/**
* Same function than javascript unescape() function but in PHP.
*