示例#1
0
 public static function generate_pdf_parameters($index, $form_id, $lead_id, $template = '')
 {
     global $gfpdf;
     $config = $gfpdf->configuration[$index];
     $pdf_name = isset($config['filename']) && strlen($config['filename']) > 0 ? $gfpdf->get_pdf_name($index, $form_id, $lead_id) : PDF_Common::get_pdf_filename($form_id, $lead_id);
     $template = isset($template) && strlen($template) > 0 ? $template : $gfpdf->get_template($index);
     $pdf_size = isset($config['pdf_size']) && (is_array($config['pdf_size']) || strlen($config['pdf_size']) > 0) ? $config['pdf_size'] : PDFGenerator::$default['pdf_size'];
     $orientation = isset($config['orientation']) && strlen($config['orientation']) > 0 ? $config['orientation'] : PDFGenerator::$default['orientation'];
     $security = isset($config['security']) && $config['security'] ? $config['security'] : PDFGenerator::$default['security'];
     $premium = isset($config['premium']) && $config['premium'] === true ? true : false;
     /* added in v3.4.0 */
     $dpi = isset($config['dpi']) && (int) $config['dpi'] > 0 ? (int) $config['dpi'] : false;
     /* added in v3.4.0 */
     $pdfa1b = isset($config['pdfa1b']) && $config['pdfa1b'] === true ? true : false;
     /* added in v3.4.0 */
     $pdfx1a = isset($config['pdfx1a']) && $config['pdfx1a'] === true ? true : false;
     /*
      * Validate privileges 
      * If blank and security is true then set privileges to all
      */
     $privileges = isset($config['pdf_privileges']) ? $gfpdf->validate_privileges($config['pdf_privileges']) : $gfpdf->validate_privileges('');
     $pdf_password = isset($config['pdf_password']) ? PDF_Common::do_mergetags($config['pdf_password'], $form_id, $lead_id) : '';
     $master_password = isset($config['pdf_master_password']) ? PDF_Common::do_mergetags($config['pdf_master_password'], $form_id, $lead_id) : '';
     $rtl = isset($config['rtl']) ? $config['rtl'] : false;
     $form = RGFormsModel::get_form_meta($form_id);
     $lead = RGFormsModel::get_lead($lead_id);
     /*
      * Run the options through filters
      */
     $pdf_name = apply_filters('gfpdfe_pdf_name', $pdf_name, $form, $lead);
     $template = apply_filters('gfpdfe_template', $template, $form, $lead);
     $orientation = apply_filters('gfpdf_orientation', $orientation, $form, $lead);
     $security = apply_filters('gfpdf_security', $security, $form, $lead);
     $privileges = apply_filters('gfpdf_privilages', $privileges, $form, $lead);
     $pdf_password = apply_filters('gfpdf_password', $pdf_password, $form, $lead);
     $master_password = apply_filters('gfpdf_master_password', $master_password, $form, $lead);
     $rtl = apply_filters('gfpdf_rtl', $rtl, $form, $lead);
     $pdf_arguments = array('pdfname' => $pdf_name, 'template' => $template, 'pdf_size' => $pdf_size, 'orientation' => $orientation, 'security' => $security, 'pdf_password' => $pdf_password, 'pdf_privileges' => $privileges, 'pdf_master_password' => $master_password, 'rtl' => $rtl, 'premium' => $premium, 'dpi' => $dpi, 'pdfa1b' => $pdfa1b, 'pdfx1a' => $pdfx1a);
     return $pdf_arguments;
 }
 public function get_pdf_name($id, $form_id = false, $lead_id = false)
 {
     if (isset($this->configuration[$id]['filename'])) {
         return PDF_Common::validate_pdf_name($this->configuration[$id]['filename'], $form_id, $lead_id);
     } else {
         return PDF_Common::validate_pdf_name(PDF_Common::get_pdf_filename($form_id, $lead_id), $form_id, $lead_id);
     }
 }