function _fillpdf_process_filename in FillPDF 6
Same name and namespace in other branches
- 7.2 fillpdf.module \_fillpdf_process_filename()
- 7 fillpdf.module \_fillpdf_process_filename()
1 call to _fillpdf_process_filename()
- fillpdf_merge_pdf in ./
fillpdf.module - Constructs a page from scratch (pdf content-type) and sends it to the browser or saves it, depending on if a custom path is configured or not.
File
- ./
fillpdf.module, line 482 - Allows mappings of PDFs to site content
Code
function _fillpdf_process_filename($original, $token_objects) {
// Replace tokens *before* sanitization
if (!empty($token_objects)) {
if (isset($token_objects['node'])) {
$type = 'node';
}
elseif (isset($token_objects['webform'])) {
$type = 'webform';
}
$original = token_replace($original, $type, $token_objects[$type]);
}
$output_name = str_replace(' ', '_', $original);
$output_name = preg_replace('/\\.pdf$/i', '', $output_name);
$output_name = preg_replace('/[^a-zA-Z0-9_.-]+/', '', $output_name) . '.pdf';
return $output_name;
}