|
|
|
@ -55,6 +55,7 @@ class PDF { |
|
|
|
$course_data = api_get_course_info($course_code); |
|
|
|
$course_data = api_get_course_info($course_code); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//clean styles and javascript document |
|
|
|
//clean styles and javascript document |
|
|
|
$clean_search = array ( |
|
|
|
$clean_search = array ( |
|
|
|
'@<script[^>]*?>.*?</script>@si', |
|
|
|
'@<script[^>]*?>.*?</script>@si', |
|
|
|
@ -70,7 +71,7 @@ class PDF { |
|
|
|
// then print the title in the PDF |
|
|
|
// then print the title in the PDF |
|
|
|
if (is_array($html_file) && isset($html_file['title'])) { |
|
|
|
if (is_array($html_file) && isset($html_file['title'])) { |
|
|
|
$html_title = $html_file['title']; |
|
|
|
$html_title = $html_file['title']; |
|
|
|
$html_file = $html_file['path']; |
|
|
|
$html_file = $html_file['path']; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
//we suppose we've only been sent a file path |
|
|
|
//we suppose we've only been sent a file path |
|
|
|
$html_title = basename($html_file); |
|
|
|
$html_title = basename($html_file); |
|
|
|
@ -82,10 +83,12 @@ class PDF { |
|
|
|
} |
|
|
|
} |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!file_exists($html_file)) { |
|
|
|
if (!file_exists($html_file)) { |
|
|
|
//the file doesn't exist, skip |
|
|
|
//the file doesn't exist, skip |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//it's not a chapter but the file exists, print its title |
|
|
|
//it's not a chapter but the file exists, print its title |
|
|
|
if ($print_title) { |
|
|
|
if ($print_title) { |
|
|
|
$this->pdf->WriteHTML('<html><body><h2>'.$html_title.'</h2></body></html>',2); |
|
|
|
$this->pdf->WriteHTML('<html><body><h2>'.$html_title.'</h2></body></html>',2); |
|
|
|
@ -97,7 +100,7 @@ class PDF { |
|
|
|
$filename =str_replace('_',' ',$filename); |
|
|
|
$filename =str_replace('_',' ',$filename); |
|
|
|
$extension = $file_info['extension']; |
|
|
|
$extension = $file_info['extension']; |
|
|
|
if (!($extension == 'html' || $extension == 'htm')) { |
|
|
|
if (!($extension == 'html' || $extension == 'htm')) { |
|
|
|
return false; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
if ($extension == 'html') { |
|
|
|
if ($extension == 'html') { |
|
|
|
$filename =basename($filename,'.html'); |
|
|
|
$filename =basename($filename,'.html'); |
|
|
|
|