You are here

function _print_pdf_tools in Printer, email and PDF versions 5.3

Same name and namespace in other branches
  1. 5.4 print_pdf/print_pdf.admin.inc \_print_pdf_tools()
  2. 6 print_pdf/print_pdf.admin.inc \_print_pdf_tools()
  3. 7 print_pdf/print_pdf.admin.inc \_print_pdf_tools()
  4. 5.x print_pdf/print_pdf.admin.inc \_print_pdf_tools()

Auxiliary function to locate suitable PDF generation tools

Return value

array of filenames with the include-able PHP file of the located tools

1 call to _print_pdf_tools()
print_pdf_settings in print_pdf/print_pdf.admin.inc
Menu callback for the PDF version module settings form.

File

print_pdf/print_pdf.admin.inc, line 193
Contains the administrative functions of the PDF version module.

Code

function _print_pdf_tools() {
  $tools = array_keys(file_scan_directory(drupal_get_path('module', 'print'), '^dompdf_config.inc.php$'));
  $tools = array_merge($tools, array_keys(file_scan_directory(drupal_get_path('module', 'print'), '^tcpdf.php$')));
  $num_tools = count($tools);
  if ($num_tools == 0) {
    variable_set('print_pdf_show_link', 0);
    return -1;
  }
  else {

    // Instead of array_combine(), use this to maintain PHP4 compatibility
    $tools2 = array();
    foreach ($tools as $key => $val) {
      $tools2[$val] = $tools[$key];
    }
    return $tools2;
  }
}