From f33cc4fa48a8fb3208d8451fbdfdf6fd8c07b09b Mon Sep 17 00:00:00 2001 From: Alfredo Esteban Date: Fri, 19 Dec 2014 20:25:25 +0100 Subject: [PATCH] Fixed issue: Removing HTML tags from pdf title --- application/libraries/admin/pdf.php | 30 +++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/application/libraries/admin/pdf.php b/application/libraries/admin/pdf.php index 16e8aaca817..ecbff6ecbdd 100644 --- a/application/libraries/admin/pdf.php +++ b/application/libraries/admin/pdf.php @@ -653,12 +653,34 @@ function initAnswerPDF($aSurveyInfo, $aPdfLanguageSettings, $sSiteName, $sSurvey $this->AddPage(); $this->SetFillColor(220, 220, 220); - if(!empty($sSurveyName)) + $this->addTitle($sSurveyName); + } + + /** + * + * Add title to pdf + * @param $sTitle - Title + * @param $sSubtitle - Subtitle + * @return unknown_type + */ + function addTitle($sTitle, $sSubtitle="") + { + if(!empty($sTitle)) { + $this->ln(1); + $this->SetFontSize($this->_ibaseAnswerFontSize + 6); + $oPurifier = new CHtmlPurifier(); + $sTitleHTML = html_entity_decode(stripJavaScript($oPurifier->purify($sTitle)),ENT_COMPAT); + $this->WriteHTMLCell(0, $this->_iCellHeight, $this->getX(), $this->getY(), $sTitleHTML, 0, 1, false, true, 'C'); + if (!empty($sSubtitle)) + { $this->ln(1); - $this->SetFontSize($this->_ibaseAnswerFontSize + 6); - $this->MultiCell('','',$sSurveyName,'','C',0); - $this->ln(6); + $this->SetFontSize($this->_ibaseAnswerFontSize + 2); + $sSubtitleHTML = html_entity_decode(stripJavaScript($oPurifier->purify($sSubtitle)),ENT_COMPAT); + $this->WriteHTMLCell(0, $this->_iCellHeight, $this->getX(), $this->getY(), $sSubtitleHTML, 0, 1, false, true, 'C'); + } + $this->ln(6); + $this->SetFontSize($this->_ibaseAnswerFontSize); } }