function print_pdf_init in Printer, email and PDF versions 7
Same name and namespace in other branches
- 6 print_pdf/print_pdf.module \print_pdf_init()
- 7.2 print_pdf/print_pdf.module \print_pdf_init()
Implements hook_init().
File
- print_pdf/
print_pdf.module, line 92 - Displays Printer-friendly versions of Drupal pages.
Code
function print_pdf_init() {
if (variable_get('print_pdf_autoconfig', PRINT_PDF_AUTOCONFIG_DEFAULT)) {
$pdf_dirs = array();
$print_pdf_pdf_tool = variable_get('print_pdf_pdf_tool', PRINT_PDF_PDF_TOOL_DEFAULT);
if (basename($print_pdf_pdf_tool) == 'dompdf_config.inc.php') {
$pdf_dirs[] = PRINT_PDF_DOMPDF_CACHE_DIR_DEFAULT . '/fonts';
}
elseif (basename($print_pdf_pdf_tool) == 'tcpdf.php') {
foreach (array(
'cache',
'images',
) as $dir) {
$pdf_dirs[] = PRINT_PDF_TCPDF_CACHE_DIR_DEFAULT . '/' . $dir;
}
}
if (!empty($pdf_dirs)) {
foreach ($pdf_dirs as $pdf_dir) {
$directory = 'public://' . $pdf_dir;
file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
}
}
}
}