private function generate_pdf_parameters($index, $form_id, $lead_id, $template = '') { $pdf_name = isset($this->configuration[$index]['filename']) && strlen($this->configuration[$index]['filename']) > 0 ? FPPDF_Common::validate_pdf_name($this->configuration[$index]['filename'], $form_id, $lead_id) : FPPDF_Common::get_pdf_filename($form_id, $lead_id); $template = isset($template) && strlen($template) > 0 ? $template : $this->get_template($index); $pdf_size = isset($this->configuration[$index]['pdf_size']) && (is_array($this->configuration[$index]['pdf_size']) || strlen($this->configuration[$index]['pdf_size']) > 0) ? $this->configuration[$index]['pdf_size'] : self::$default['pdf_size']; $orientation = isset($this->configuration[$index]['orientation']) && strlen($this->configuration[$index]['orientation']) > 0 ? $this->configuration[$index]['orientation'] : self::$default['orientation']; $security = isset($this->configuration[$index]['security']) && $this->configuration[$index]['security'] ? $this->configuration[$index]['security'] : self::$default['security']; $premium = isset($this->configuration[$index]['premium']) && $this->configuration[$index]['premium'] === true ? true : false; /* * Validate privileges * If blank and security is true then set privileges to all */ $privileges = isset($this->configuration[$index]['pdf_privileges']) ? $this->validate_privileges($this->configuration[$index]['pdf_privileges']) : $this->validate_privileges(''); $pdf_password = isset($this->configuration[$index]['pdf_password']) ? FPPDF_Common::do_mergetags($this->configuration[$index]['pdf_password'], $form_id, $lead_id) : ''; $master_password = isset($this->configuration[$index]['pdf_master_password']) ? FPPDF_Common::do_mergetags($this->configuration[$index]['pdf_master_password'], $form_id, $lead_id) : ''; $rtl = isset($this->configuration[$index]['rtl']) ? $this->configuration[$index]['rtl'] : false; /* added in v3.4.0 */ $pdfa1b = isset($this->configuration[$index]['pdfa1b']) && $this->configuration[$index]['pdfa1b'] === true ? true : false; /* added in v3.4.0 */ $pdfx1a = isset($this->configuration[$index]['pdfx1a']) && $this->configuration[$index]['pdfx1a'] === true ? true : false; /* * Run the options through filters */ $pdf_name = apply_filters('fppdf_pdf_name', $pdf_name, $form_id, $lead_id); $template = apply_filters('fppdf_template', $template, $form_id, $lead_id); $orientation = apply_filters('fppdf_orientation', $orientation, $form_id, $lead_id); $security = apply_filters('fppdf_security', $security, $form_id, $lead_id); $privileges = apply_filters('fppdf_privilages', $privileges, $form_id, $lead_id); $pdf_password = apply_filters('fppdf_password', $pdf_password, $form_id, $lead_id); $master_password = apply_filters('fppdf_master_password', $master_password, $form_id, $lead_id); $rtl = apply_filters('fppdf_rtl', $rtl, $form_id, $lead_id); $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, 'pdfa1b' => $pdfa1b, 'pdfx1a' => $pdfx1a); return $pdf_arguments; }
<link rel='stylesheet' href='<?php echo $stylesheet_location; ?> ' type='text/css' /> <title>Formidable Pro PDF Extended</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <?php foreach ($lead_ids as $lead_id) { $fields = FPPDF_Common::get_form_fields($form_id, $lead_id); $form_data = FPPDF_Entry::show_entry(array('id' => $lead_id, 'fields' => $fields, 'user_info' => false, 'type' => 'array')); /* * Add &data=1 when viewing the PDF via the admin area to view the $form_data array */ FPPDF_Common::view_data($form_data); /* get all the form values */ $date_created = $form_data['date_created']; /* format the template */ ?> <div class="body_copy"> <img src="<?php echo FP_PDF_PLUGIN_DIR; ?> /images/formidablepro-logo.jpg" width="311" height="66" /> <p class="date"><?php
FPPDF_Common::setup_ids(); global $fppdf; $configuration_data = $fppdf->get_config_data($form_id); $show_html_fields = isset($configuration_data['default-show-html']) && $configuration_data['default-show-html'] == 1 ? true : false; $show_empty_fields = isset($configuration_data['default-show-empty']) && $configuration_data['default-show-empty'] == 1 ? true : false; $stylesheet_location = file_exists(FP_PDF_TEMPLATE_LOCATION . 'template.css') ? FP_PDF_TEMPLATE_URL_LOCATION . 'template.css' : FP_PDF_PLUGIN_URL . 'styles/template.css'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <!--<link rel='stylesheet' href='/css/print.css' type='text/css' />--> <link rel='stylesheet' href='<?php echo $stylesheet_location; ?> ' type='text/css' /> <title>Formidable Pro PDF Extended</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <div class="no-style"> <?php foreach ($lead_ids as $lead_id) { $fields = FPPDF_Common::get_form_fields($form_id, $lead_id); echo FPPDF_Entry::show_entry(array('id' => $lead_id, 'fields' => $fields, 'user_info' => false, 'include_blank' => $show_empty_fields, 'show_html' => $show_html_fields)); } ?> </div> </body> </html>
public static function display_documentation_details() { $message = sprintf(__("Please review the %sFormidable Pro PDF Extended documentation%s for comprehensive installation instructions."), "<a href='http://formidablepropdfextended.com/documentation-v1/installation-and-configuration/'>", "</a>"); FPPDF_Common::display_plugin_message($message); }
<?php /** * Debugging can be done by adding &html=1 to the end of the URL when viewing the PDF * We no longer need to access the file directly. */ if (!class_exists('FPPDF_Core')) { /* Accessed directly */ exit; } /** * Set up the form ID and lead ID, as well as we want page breaks displayed. * Form ID and Lead ID can be set by passing it to the URL - ?fid=1&lid=10 */ FPPDF_Common::setup_ids(); /** * Load the form data, including the custom style sheet which looks in the plugin's theme folder before defaulting back to the plugin's file. */ $form = RGFormsModel::get_form_meta($form_id); $stylesheet_location = file_exists(FP_PDF_TEMPLATE_LOCATION . 'template.css') ? FP_PDF_TEMPLATE_URL_LOCATION . 'template.css' : FP_PDF_PLUGIN_URL . 'styles/template.css'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Formidable Pro PDF Extended</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body>
public static function do_theme_switch($previous_pdf_path, $current_pdf_path) { /* * Prepare for calling the WP Filesystem * It only allows post data to be added so we have to manually assign them */ $_POST['previous_pdf_path'] = $previous_pdf_path; $_POST['current_pdf_path'] = $current_pdf_path; /* * Initialise the Wordpress Filesystem API */ if (FPPDF_Common::initialise_WP_filesystem_API(array('previous_pdf_path', 'current_pdf_path'), 'gfpdfe_sync_now') === false) { return false; } /* * If we got here we should have $wp_filesystem available */ global $wp_filesystem; /* * Assume FTP is rooted to the Wordpress install */ $previous_pdf_path = self::get_base_directory($previous_pdf_path); $current_pdf_path = self::get_base_directory($current_pdf_path); if ($wp_filesystem->is_dir($previous_pdf_path)) { self::pdf_extended_copy_directory($previous_pdf_path, $current_pdf_path, true, true); } /* * Remove the options key that triggers the switch theme function */ delete_option('fppdfe_switch_theme'); add_action('fppdfe_notices', array("FPPDF_InstallUpdater", "fp_pdf_theme_sync_success")); /* * Show success message to user */ return true; }
/** * Loads the Gravity Form output script (actually the print preview) */ private function load_entry_data($form_id, $lead_id, $template) { /* set up contstants for Formidable Pro to use so we can override the security on the printed version */ if (file_exists(FP_PDF_TEMPLATE_LOCATION . $template)) { return FPPDF_Common::get_html_template(FP_PDF_TEMPLATE_LOCATION . $template); } else { /* * Check if template file exists in the plugin's core template folder */ if (file_exists(FP_PDF_PLUGIN_DIR . "templates/" . $template)) { return FPPDF_Common::get_html_template(FP_PDF_PLUGIN_DIR . "templates/" . $template); } else { return FPPDF_Common::get_html_template(FP_PDF_PLUGIN_DIR . "templates/" . FPPDFGenerator::$default['template']); } } }
public function get_pdf_name($index, $form_id = false, $lead_id = false) { if (isset($this->configuration[$index]['filename'])) { return FPPDF_Common::validate_pdf_name($this->configuration[$index]['filename'], $form_id, $lead_id); } else { return FPPDF_Common::validate_pdf_name(FPPDF_Common::get_pdf_filename($form_id, $lead_id), $form_id, $lead_id); } }