diff --git a/main/inc/lib/pdf.lib.php b/main/inc/lib/pdf.lib.php index 92c4f22b81..50b43f7628 100644 --- a/main/inc/lib/pdf.lib.php +++ b/main/inc/lib/pdf.lib.php @@ -99,26 +99,32 @@ class PDF { * @param bool Whether to print the header, footer and watermark (true) or just the content (false) * @return void */ - public function html_to_pdf($html_file_array, $pdf_name = '', $course_code = null, $print_title = false, $complete_style = true) { - if ($complete_style === false) { error_log(__FUNCTION__.' with no style'); } + public function html_to_pdf($html_file_array, $pdf_name = '', $course_code = null, $print_title = false, $complete_style = true) + { + if ($complete_style === false) { + error_log(__FUNCTION__.' with no style'); + } + if (empty($html_file_array)) { return false; } if (is_array($html_file_array)) { - if (count($html_file_array) == 0) + if (count($html_file_array) == 0) { return false; + } } else { if (!file_exists($html_file_array)) { return false; } - //Converting the string into an array + + // Converting the string into an array $html_file_array = array($html_file_array); } $course_data = array(); if (!empty($course_code)) { - $course_data = api_get_course_info($course_code); + $course_data = api_get_course_info($course_code); } else { $course_data = api_get_course_info(); } @@ -148,15 +154,15 @@ class PDF { //if the array provided contained subarrays with 'title' entry, // then print the title in the PDF if (is_array($file) && isset($file['title'])) { - $html_title = $file['title']; + $html_title = $file['title']; $file = $file['path']; } else { - //we suppose we've only been sent a file path - $html_title = basename($file); + // We suppose we've only been sent a file path. + $html_title = basename($file); } if (empty($file) && !empty($html_title)) { - //this is a chapter, print title & skip the rest + //this is a chapter, print title & skip the rest if ($print_title) { $this->pdf->WriteHTML('