mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-18 23:08:46 +02:00
(retrofir from trunk) N° 615: spreadsheet export enhancement to remove unneeded line breaks.
SVN:2.3[4550]
This commit is contained in:
@@ -31,6 +31,7 @@ class SpreadsheetBulkExport extends TabularBulkExport
|
|||||||
$oP->p(" *\tfields: (mandatory) the comma separated list of field codes to export (e.g: name,org_id,service_name...).");
|
$oP->p(" *\tfields: (mandatory) the comma separated list of field codes to export (e.g: name,org_id,service_name...).");
|
||||||
$oP->p(" *\tno_localize: (optional) pass 1 to retrieve the raw (untranslated) values for enumerated fields. Default: 0.");
|
$oP->p(" *\tno_localize: (optional) pass 1 to retrieve the raw (untranslated) values for enumerated fields. Default: 0.");
|
||||||
$oP->p(" *\tdate_format: the format to use when exporting date and time fields (default = the SQL format). e.g. 'Y-m-d H:i:s'");
|
$oP->p(" *\tdate_format: the format to use when exporting date and time fields (default = the SQL format). e.g. 'Y-m-d H:i:s'");
|
||||||
|
$oP->p(" *\tformatted_text: set to 1 to formatted text fields with their HTML markup, 0 to remove formatting. Default is 1 (= formatted text)");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function EnumFormParts()
|
public function EnumFormParts()
|
||||||
@@ -51,12 +52,19 @@ class SpreadsheetBulkExport extends TabularBulkExport
|
|||||||
$oP->add('<fieldset><legend>'.Dict::S('Core:BulkExport:SpreadsheetOptions').'</legend>');
|
$oP->add('<fieldset><legend>'.Dict::S('Core:BulkExport:SpreadsheetOptions').'</legend>');
|
||||||
$oP->add('<table>');
|
$oP->add('<table>');
|
||||||
$oP->add('<tr>');
|
$oP->add('<tr>');
|
||||||
$oP->add('<td><input type="checkbox" id="spreadsheet_no_localize" name="no_localize" value="1"'.$sChecked.'><label for="spreadsheet_no_localize"> '.Dict::S('Core:BulkExport:OptionNoLocalize').'</label></td>');
|
|
||||||
|
$oP->add('<td style="vertical-align:top">');
|
||||||
|
$sChecked = (utils::ReadParam('formatted_text', 1) == 1) ? ' checked ' : '';
|
||||||
|
$oP->add('<h3>'.Dict::S('Core:BulkExport:TextFormat').'</h3>');
|
||||||
|
$oP->add('<input type="hidden" name="formatted_text" value="0">'); // Trick to pass the zero value if the checkbox below is unchecked, since we want the default value to be "1"
|
||||||
|
$oP->add('<input type="checkbox" id="spreadsheet_formatted_text" name="formatted_text" value="1"'.$sChecked.'><label for="spreadsheet_formatted_text"> '.Dict::S('Core:BulkExport:OptionFormattedText').'</label><br/><br/>');
|
||||||
|
$oP->add('<input type="checkbox" id="spreadsheet_no_localize" name="no_localize" value="1"'.$sChecked.'><label for="spreadsheet_no_localize"> '.Dict::S('Core:BulkExport:OptionNoLocalize').'</label>');
|
||||||
|
$oP->add('</td>');
|
||||||
|
|
||||||
$sDateTimeFormat = utils::ReadParam('date_format', (string)AttributeDateTime::GetFormat(), true, 'raw_data');
|
$sDateTimeFormat = utils::ReadParam('date_format', (string)AttributeDateTime::GetFormat(), true, 'raw_data');
|
||||||
$sDefaultChecked = ($sDateTimeFormat == (string)AttributeDateTime::GetFormat()) ? ' checked' : '';
|
$sDefaultChecked = ($sDateTimeFormat == (string)AttributeDateTime::GetFormat()) ? ' checked' : '';
|
||||||
$sCustomChecked = ($sDateTimeFormat !== (string)AttributeDateTime::GetFormat()) ? ' checked' : '';
|
$sCustomChecked = ($sDateTimeFormat !== (string)AttributeDateTime::GetFormat()) ? ' checked' : '';
|
||||||
|
|
||||||
$oP->add('<td>');
|
$oP->add('<td>');
|
||||||
$oP->add('<h3>'.Dict::S('Core:BulkExport:DateTimeFormat').'</h3>');
|
$oP->add('<h3>'.Dict::S('Core:BulkExport:DateTimeFormat').'</h3>');
|
||||||
$sDefaultFormat = htmlentities((string)AttributeDateTime::GetFormat(), ENT_QUOTES, 'UTF-8');
|
$sDefaultFormat = htmlentities((string)AttributeDateTime::GetFormat(), ENT_QUOTES, 'UTF-8');
|
||||||
@@ -65,23 +73,23 @@ class SpreadsheetBulkExport extends TabularBulkExport
|
|||||||
$sFormatInput = '<input type="text" size="15" name="date_format" id="spreadsheet_custom_date_time_format" title="" value="'.htmlentities($sDateTimeFormat, ENT_QUOTES, 'UTF-8').'"/>';
|
$sFormatInput = '<input type="text" size="15" name="date_format" id="spreadsheet_custom_date_time_format" title="" value="'.htmlentities($sDateTimeFormat, ENT_QUOTES, 'UTF-8').'"/>';
|
||||||
$oP->add('<input type="radio" id="spreadsheet_date_time_format_custom" name="spreadsheet_date_format_radio" value="custom"'.$sCustomChecked.'><label for="spreadsheet_date_time_format_custom"> '.Dict::Format('Core:BulkExport:DateTimeFormatCustom_Format', $sFormatInput).'</label>');
|
$oP->add('<input type="radio" id="spreadsheet_date_time_format_custom" name="spreadsheet_date_format_radio" value="custom"'.$sCustomChecked.'><label for="spreadsheet_date_time_format_custom"> '.Dict::Format('Core:BulkExport:DateTimeFormatCustom_Format', $sFormatInput).'</label>');
|
||||||
$oP->add('</td>');
|
$oP->add('</td>');
|
||||||
|
|
||||||
$oP->add('</tr>');
|
$oP->add('</tr>');
|
||||||
$oP->add('</table>');
|
$oP->add('</table>');
|
||||||
$oP->add('</fieldset>');
|
$oP->add('</fieldset>');
|
||||||
$sJSTooltip = json_encode('<div class="date_format_tooltip">'.Dict::S('UI:CSVImport:CustomDateTimeFormatTooltip').'</div>');
|
$sJSTooltip = json_encode('<div class="date_format_tooltip">'.Dict::S('UI:CSVImport:CustomDateTimeFormatTooltip').'</div>');
|
||||||
$oP->add_ready_script(
|
$oP->add_ready_script(
|
||||||
<<<EOF
|
<<<EOF
|
||||||
$('#spreadsheet_custom_date_time_format').tooltip({content: function() { return $sJSTooltip; } });
|
$('#spreadsheet_custom_date_time_format').tooltip({content: function() { return $sJSTooltip; } });
|
||||||
$('#form_part_spreadsheet_options').on('preview_updated', function() { FormatDatesInPreview('spreadsheet', 'spreadsheet'); });
|
$('#form_part_spreadsheet_options').on('preview_updated', function() { FormatDatesInPreview('spreadsheet', 'spreadsheet'); });
|
||||||
$('#spreadsheet_date_time_format_default').on('click', function() { FormatDatesInPreview('spreadsheet', 'spreadsheet'); });
|
$('#spreadsheet_date_time_format_default').on('click', function() { FormatDatesInPreview('spreadsheet', 'spreadsheet'); });
|
||||||
$('#spreadsheet_date_time_format_custom').on('click', function() { FormatDatesInPreview('spreadsheet', 'spreadsheet'); });
|
$('#spreadsheet_date_time_format_custom').on('click', function() { FormatDatesInPreview('spreadsheet', 'spreadsheet'); });
|
||||||
$('#spreadsheet_custom_date_time_format').on('click', function() { $('#spreadsheet_date_time_format_custom').prop('checked', true); });
|
$('#spreadsheet_custom_date_time_format').on('click', function() { $('#spreadsheet_date_time_format_custom').prop('checked', true); });
|
||||||
$('#spreadsheet_custom_date_time_format').on('click', function() { $('#spreadsheet_date_time_format_custom').prop('checked', true); FormatDatesInPreview('spreadsheet', 'spreadsheet'); }).on('keyup', function() { FormatDatesInPreview('spreadsheet', 'spreadsheet'); });
|
$('#spreadsheet_custom_date_time_format').on('click', function() { $('#spreadsheet_date_time_format_custom').prop('checked', true); FormatDatesInPreview('spreadsheet', 'spreadsheet'); }).on('keyup', function() { FormatDatesInPreview('spreadsheet', 'spreadsheet'); });
|
||||||
EOF
|
EOF
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return parent:: DisplayFormPart($oP, $sPartId);
|
return parent:: DisplayFormPart($oP, $sPartId);
|
||||||
}
|
}
|
||||||
@@ -90,26 +98,27 @@ EOF
|
|||||||
public function ReadParameters()
|
public function ReadParameters()
|
||||||
{
|
{
|
||||||
parent::ReadParameters();
|
parent::ReadParameters();
|
||||||
|
$this->aStatusInfo['formatted_text'] = (bool)utils::ReadParam('formatted_text', 1, true);
|
||||||
|
|
||||||
$sDateFormatRadio = utils::ReadParam('spreadsheet_date_format_radio', '');
|
$sDateFormatRadio = utils::ReadParam('spreadsheet_date_format_radio', '');
|
||||||
switch($sDateFormatRadio)
|
switch($sDateFormatRadio)
|
||||||
{
|
{
|
||||||
case 'default':
|
case 'default':
|
||||||
// Export from the UI => format = same as is the UI
|
// Export from the UI => format = same as is the UI
|
||||||
$this->aStatusInfo['date_format'] = (string)AttributeDateTime::GetFormat();
|
$this->aStatusInfo['date_format'] = (string)AttributeDateTime::GetFormat();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'custom':
|
case 'custom':
|
||||||
// Custom format specified from the UI
|
// Custom format specified from the UI
|
||||||
$this->aStatusInfo['date_format'] = utils::ReadParam('date_format', (string)AttributeDateTime::GetFormat(), true, 'raw_data');
|
$this->aStatusInfo['date_format'] = utils::ReadParam('date_format', (string)AttributeDateTime::GetFormat(), true, 'raw_data');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Export from the command line (or scripted) => default format is SQL, as in previous versions of iTop, unless specified otherwise
|
// Export from the command line (or scripted) => default format is SQL, as in previous versions of iTop, unless specified otherwise
|
||||||
$this->aStatusInfo['date_format'] = utils::ReadParam('date_format', (string)AttributeDateTime::GetSQLFormat(), true, 'raw_data');
|
$this->aStatusInfo['date_format'] = utils::ReadParam('date_format', (string)AttributeDateTime::GetSQLFormat(), true, 'raw_data');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function GetSampleData($oObj, $sAttCode)
|
protected function GetSampleData($oObj, $sAttCode)
|
||||||
{
|
{
|
||||||
if ($sAttCode != 'id')
|
if ($sAttCode != 'id')
|
||||||
@@ -126,6 +135,7 @@ EOF
|
|||||||
|
|
||||||
protected function GetValue($oObj, $sAttCode)
|
protected function GetValue($oObj, $sAttCode)
|
||||||
{
|
{
|
||||||
|
$bFormattedText = (array_key_exists('formatted_text', $this->aStatusInfo) ? $this->aStatusInfo['formatted_text'] : false);
|
||||||
switch($sAttCode)
|
switch($sAttCode)
|
||||||
{
|
{
|
||||||
case 'id':
|
case 'id':
|
||||||
@@ -147,6 +157,18 @@ EOF
|
|||||||
{
|
{
|
||||||
$sRet = '';
|
$sRet = '';
|
||||||
}
|
}
|
||||||
|
elseif ($oAttDef instanceof AttributeText)
|
||||||
|
{
|
||||||
|
if ($bFormattedText)
|
||||||
|
{
|
||||||
|
// Replace paragraphs (<p...>...</p>, etc) by line breaks (<br/>) since Excel (pre-2016) splits the cells when there is a paragraph
|
||||||
|
$sRet = static::HtmlToSpreadsheet($oObj->GetAsHTML($sAttCode));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sRet = utils::HtmlToText($oObj->GetAsHTML($sAttCode));
|
||||||
|
}
|
||||||
|
}
|
||||||
elseif ($oAttDef instanceof AttributeString)
|
elseif ($oAttDef instanceof AttributeString)
|
||||||
{
|
{
|
||||||
$sRet = $oObj->GetAsHTML($sAttCode);
|
$sRet = $oObj->GetAsHTML($sAttCode);
|
||||||
@@ -175,7 +197,7 @@ EOF
|
|||||||
{
|
{
|
||||||
// Integration within MS-Excel web queries + HTTPS + IIS:
|
// Integration within MS-Excel web queries + HTTPS + IIS:
|
||||||
// MS-IIS set these header values with no-cache... while Excel fails to do the job if using HTTPS
|
// MS-IIS set these header values with no-cache... while Excel fails to do the job if using HTTPS
|
||||||
// Then the fix is to force the reset of header values Pragma and Cache-control
|
// Then the fix is to force the reset of header values Pragma and Cache-control
|
||||||
$oPage->add_header("Pragma:", true);
|
$oPage->add_header("Pragma:", true);
|
||||||
$oPage->add_header("Cache-control:", true);
|
$oPage->add_header("Cache-control:", true);
|
||||||
}
|
}
|
||||||
@@ -230,13 +252,14 @@ EOF
|
|||||||
$oSet = new DBObjectSet($this->oSearch);
|
$oSet = new DBObjectSet($this->oSearch);
|
||||||
$oSet->SetLimit($this->iChunkSize, $this->aStatusInfo['position']);
|
$oSet->SetLimit($this->iChunkSize, $this->aStatusInfo['position']);
|
||||||
$this->OptimizeColumnLoad($oSet);
|
$this->OptimizeColumnLoad($oSet);
|
||||||
|
|
||||||
$sExportDateTimeFormat = $this->aStatusInfo['date_format'];
|
$sExportDateTimeFormat = $this->aStatusInfo['date_format'];
|
||||||
|
$bFormattedText = (array_key_exists('formatted_text', $this->aStatusInfo) ? $this->aStatusInfo['formatted_text'] : false);
|
||||||
// Date & time formats
|
// Date & time formats
|
||||||
$oDateTimeFormat = new DateTimeFormat($sExportDateTimeFormat);
|
$oDateTimeFormat = new DateTimeFormat($sExportDateTimeFormat);
|
||||||
$oDateFormat = new DateTimeFormat($oDateTimeFormat->ToDateFormat());
|
$oDateFormat = new DateTimeFormat($oDateTimeFormat->ToDateFormat());
|
||||||
$oTimeFormat = new DateTimeFormat($oDateTimeFormat->ToTimeFormat());
|
$oTimeFormat = new DateTimeFormat($oDateTimeFormat->ToTimeFormat());
|
||||||
|
|
||||||
$iCount = 0;
|
$iCount = 0;
|
||||||
$sData = '';
|
$sData = '';
|
||||||
$iPreviousTimeLimit = ini_get('max_execution_time');
|
$iPreviousTimeLimit = ini_get('max_execution_time');
|
||||||
@@ -258,55 +281,69 @@ EOF
|
|||||||
$sData .= "<td x:str></td>";
|
$sData .= "<td x:str></td>";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($sAttCode)
|
switch($sAttCode)
|
||||||
{
|
{
|
||||||
case 'id':
|
case 'id':
|
||||||
$sField = $oObj->GetKey();
|
$sField = $oObj->GetKey();
|
||||||
$sData .= "<td>$sField</td>";
|
$sData .= "<td>$sField</td>";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$oAttDef = MetaModel::GetAttributeDef(get_class($oObj), $sAttCode);
|
$oAttDef = MetaModel::GetAttributeDef(get_class($oObj), $sAttCode);
|
||||||
$oFinalAttDef = $oAttDef->GetFinalAttDef();
|
$oFinalAttDef = $oAttDef->GetFinalAttDef();
|
||||||
if (get_class($oFinalAttDef) == 'AttributeDateTime')
|
if (get_class($oFinalAttDef) == 'AttributeDateTime')
|
||||||
{
|
|
||||||
// Split the date and time in two columns
|
|
||||||
$sDate = $oDateFormat->Format($oObj->Get($sAttCode));
|
|
||||||
$sTime = $oTimeFormat->Format($oObj->Get($sAttCode));
|
|
||||||
$sData .= "<td>$sDate</td>";
|
|
||||||
$sData .= "<td>$sTime</td>";
|
|
||||||
}
|
|
||||||
else if (get_class($oFinalAttDef) == 'AttributeDate')
|
|
||||||
{
|
|
||||||
$sDate = $oDateFormat->Format($oObj->Get($sAttCode));
|
|
||||||
$sData .= "<td>$sDate</td>";
|
|
||||||
}
|
|
||||||
else if($oAttDef instanceof AttributeCaseLog)
|
|
||||||
{
|
|
||||||
$rawValue = $oObj->Get($sAttCode);
|
|
||||||
$sField = str_replace("\n", "<br/>", htmlentities($rawValue->__toString(), ENT_QUOTES, 'UTF-8'));
|
|
||||||
// Trick for Excel: treat the content as text even if it begins with an equal sign
|
|
||||||
$sData .= "<td x:str>$sField</td>";
|
|
||||||
}
|
|
||||||
else if($oAttDef instanceof AttributeString)
|
|
||||||
{
|
|
||||||
$sField = $oObj->GetAsHTML($sAttCode, $this->bLocalizeOutput);
|
|
||||||
$sData .= "<td x:str>$sField</td>";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$rawValue = $oObj->Get($sAttCode);
|
|
||||||
if ($this->bLocalizeOutput)
|
|
||||||
{
|
{
|
||||||
$sField = htmlentities($oFinalAttDef->GetEditValue($rawValue), ENT_QUOTES, 'UTF-8');
|
// Split the date and time in two columns
|
||||||
|
$sDate = $oDateFormat->Format($oObj->Get($sAttCode));
|
||||||
|
$sTime = $oTimeFormat->Format($oObj->Get($sAttCode));
|
||||||
|
$sData .= "<td>$sDate</td>";
|
||||||
|
$sData .= "<td>$sTime</td>";
|
||||||
|
}
|
||||||
|
else if (get_class($oFinalAttDef) == 'AttributeDate')
|
||||||
|
{
|
||||||
|
$sDate = $oDateFormat->Format($oObj->Get($sAttCode));
|
||||||
|
$sData .= "<td>$sDate</td>";
|
||||||
|
}
|
||||||
|
else if($oAttDef instanceof AttributeCaseLog)
|
||||||
|
{
|
||||||
|
$rawValue = $oObj->Get($sAttCode);
|
||||||
|
$sField = str_replace("\n", "<br/>", htmlentities($rawValue->__toString(), ENT_QUOTES, 'UTF-8'));
|
||||||
|
// Trick for Excel: treat the content as text even if it begins with an equal sign
|
||||||
|
$sData .= "<td x:str>$sField</td>";
|
||||||
|
}
|
||||||
|
elseif ($oAttDef instanceof AttributeText)
|
||||||
|
{
|
||||||
|
if ($bFormattedText)
|
||||||
|
{
|
||||||
|
// Replace paragraphs (<p...>...</p>, etc) by line breaks (<br/>) since Excel (pre-2016) splits the cells when there is a paragraph
|
||||||
|
$sField = static::HtmlToSpreadsheet($oObj->GetAsHTML($sAttCode));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Convert to plain text
|
||||||
|
$sField = utils::HtmlToText($oObj->GetAsHTML($sAttCode));
|
||||||
|
}
|
||||||
|
$sData .= "<td x:str>$sField</td>";
|
||||||
|
}
|
||||||
|
else if($oAttDef instanceof AttributeString)
|
||||||
|
{
|
||||||
|
$sField = $oObj->GetAsHTML($sAttCode, $this->bLocalizeOutput);
|
||||||
|
$sData .= "<td x:str>$sField</td>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sField = htmlentities($rawValue, ENT_QUOTES, 'UTF-8');
|
$rawValue = $oObj->Get($sAttCode);
|
||||||
|
if ($this->bLocalizeOutput)
|
||||||
|
{
|
||||||
|
$sField = htmlentities($oFinalAttDef->GetEditValue($rawValue), ENT_QUOTES, 'UTF-8');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sField = htmlentities($rawValue, ENT_QUOTES, 'UTF-8');
|
||||||
|
}
|
||||||
|
$sData .= "<td>$sField</td>";
|
||||||
}
|
}
|
||||||
$sData .= "<td>$sField</td>";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -354,4 +391,51 @@ EOF
|
|||||||
{
|
{
|
||||||
return 'html';
|
return 'html';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cleanup all markup displayed as line breaks (except <br> tags) since this
|
||||||
|
* causes Excel (pre-2016) to generate extra lines in the table, thus breaking
|
||||||
|
* the tabular disposition of the export
|
||||||
|
* Note: Excel 2016 also refuses line breaks, so the only solution for this case is alas plain text
|
||||||
|
* @param string $sHtml The HTML to cleanup
|
||||||
|
* @return string The cleaned HTML
|
||||||
|
*/
|
||||||
|
public static function HtmlToSpreadsheet($sHtml)
|
||||||
|
{
|
||||||
|
if (trim(strip_tags($sHtml)) === '')
|
||||||
|
{
|
||||||
|
// Display this value as an empty cell in the table
|
||||||
|
return ' ';
|
||||||
|
}
|
||||||
|
// The tags listed here are a subset of the whitelist defined in HTMLDOMSanitizer
|
||||||
|
// Tags causing a visual "line break" in the displayed page (i.e. display: block) are to be replaced by a <span> followed by a <br/>
|
||||||
|
// in order to preserve any inline style/attribute of the removed tag
|
||||||
|
$aTagsToReplace = array(
|
||||||
|
'pre', 'div', 'p', 'hr', 'center', 'h1', 'h2', 'h3', 'h4', 'li', 'fieldset', 'legend', 'nav', 'section', 'tr', 'caption',
|
||||||
|
);
|
||||||
|
// Tags to completely remove from the markup
|
||||||
|
$aTagsToRemove = array(
|
||||||
|
'table', 'thead', 'tbody', 'ul', 'ol', 'td', 'th',
|
||||||
|
);
|
||||||
|
|
||||||
|
// Remove the englobing <div class="HTML" >...</div> to prevent an extra line break
|
||||||
|
$sHtml = preg_replace('|^<div class="HTML" >(.*)</div>$|s', '$1', $sHtml); // Must use the "s" (. matches newline) modifier
|
||||||
|
|
||||||
|
foreach($aTagsToReplace as $sTag)
|
||||||
|
{
|
||||||
|
$sHtml = preg_replace("|<{$sTag} ?([^>]*)>|is", '<span $1>', $sHtml);
|
||||||
|
$sHtml = preg_replace("|</{$sTag}>|i", '</span><br/>', $sHtml);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($aTagsToRemove as $sTag)
|
||||||
|
{
|
||||||
|
$sHtml = preg_replace("|<{$sTag} ?([^>]*)>|is", '', $sHtml);
|
||||||
|
$sHtml = preg_replace("|</{$sTag}>|i", '', $sHtml);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove any trailing <br/>, if any, to prevent an extra line break
|
||||||
|
$sHtml = preg_replace("|<br/>$|", '', $sHtml);
|
||||||
|
|
||||||
|
return $sHtml;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user