| 1 |
<?php |
| 2 |
/* |
| 3 |
* Plugin Name: PDF for Elementor Forms + Drag And Drop Template Builder |
| 4 |
* Description: Automatically generate, email and download PDFs with Elementor Forms |
| 5 |
* Plugin URI: https://add-ons.org/plugin/elementor-form-pdf-generator-attachment/ |
| 6 |
* Requires Plugins: elementor |
| 7 |
* Author: add-ons.org |
| 8 |
* Version: 7.2.0 |
| 9 |
* Requires PHP: 7.0 |
| 10 |
* Elementor tested up to: 4.3 |
| 11 |
* Elementor pro tested up to: 4.3 |
| 12 |
* Author URI: https://add-ons.org/ |
| 13 |
* License: GPL v2 or later |
| 14 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 15 |
*/ |
| 16 |
if (! defined('ABSPATH')) exit; // Exit if accessed directly |
| 17 |
if (!defined('YEEPDF_ELEMENTOR_PDF_PLUGIN_PATH')) { |
| 18 |
define('YEEPDF_ELEMENTOR_PDF_PLUGIN_PATH', plugin_dir_path(__FILE__)); |
| 19 |
define('YEEPDF_ELEMENTOR_PDF_PLUGIN_URL', plugin_dir_url(__FILE__)); |
| 20 |
if (!class_exists('Yeepdf_Creator_Builder')) { |
| 21 |
require 'vendor/autoload.php'; |
| 22 |
if (!defined('YEEPDF_CREATOR_BUILDER_PATH')) { |
| 23 |
define('YEEPDF_CREATOR_BUILDER_PATH', plugin_dir_path(__FILE__)); |
| 24 |
} |
| 25 |
if (!defined('YEEPDF_CREATOR_BUILDER_URL')) { |
| 26 |
define('YEEPDF_CREATOR_BUILDER_URL', plugin_dir_url(__FILE__)); |
| 27 |
} |
| 28 |
class Yeepdf_Creator_Builder |
| 29 |
{ |
| 30 |
function __construct() |
| 31 |
{ |
| 32 |
if (!class_exists('Yeekitqrcode')) { |
| 33 |
include_once YEEPDF_CREATOR_BUILDER_PATH . "libs/phpqrcode.php"; |
| 34 |
} |
| 35 |
$dir = new RecursiveDirectoryIterator(YEEPDF_CREATOR_BUILDER_PATH . "backend"); |
| 36 |
$ite = new RecursiveIteratorIterator($dir); |
| 37 |
$files = new RegexIterator($ite, "/\.php/", RegexIterator::MATCH); |
| 38 |
foreach ($files as $file) { |
| 39 |
if (!$file->isDir()) { |
| 40 |
require_once $file->getPathname(); |
| 41 |
} |
| 42 |
} |
| 43 |
include_once YEEPDF_CREATOR_BUILDER_PATH . "frontend/index.php"; |
| 44 |
} |
| 45 |
} |
| 46 |
new Yeepdf_Creator_Builder; |
| 47 |
} |
| 48 |
class Yeepdf_Creator_Form_Widget_Builder |
| 49 |
{ |
| 50 |
function __construct() |
| 51 |
{ |
| 52 |
add_action('elementor_pro/forms/actions/register', array($this, 'register_new_form_actions')); |
| 53 |
include YEEPDF_ELEMENTOR_PDF_PLUGIN_PATH . "elementor/index.php"; |
| 54 |
include YEEPDF_ELEMENTOR_PDF_PLUGIN_PATH . "yeekit/document.php"; |
| 55 |
register_activation_hook(__FILE__, array($this, 'activation')); |
| 56 |
} |
| 57 |
function register_new_form_actions($form_actions_registrar) |
| 58 |
{ |
| 59 |
include YEEPDF_ELEMENTOR_PDF_PLUGIN_PATH . 'elementor/action-pdf.php'; |
| 60 |
include YEEPDF_ELEMENTOR_PDF_PLUGIN_PATH . 'elementor/action-download.php'; |
| 61 |
$form_actions_registrar->register(new \Superaddons_Pdf_Action_After_Submit()); |
| 62 |
$form_actions_registrar->register(new \Superaddons_Pdf2_Action_After_Submit()); |
| 63 |
$form_actions_registrar->register(new \Superaddons_Pdf3_Action_After_Submit()); |
| 64 |
$form_actions_registrar->register(new \Superaddons_Pdf4_Action_After_Submit()); |
| 65 |
$form_actions_registrar->register(new \Superaddons_Pdf5_Action_After_Submit()); |
| 66 |
$form_actions_registrar->register(new \Superaddons_Pdf6_Action_After_Submit()); |
| 67 |
$form_actions_registrar->register(new \Superaddons_Pdf7_Action_After_Submit()); |
| 68 |
$form_actions_registrar->register(new \Superaddons_Pdf8_Action_After_Submit()); |
| 69 |
$form_actions_registrar->register(new \Superaddons_Pdf9_Action_After_Submit()); |
| 70 |
$form_actions_registrar->register(new \Superaddons_Pdf10_Action_After_Submit()); |
| 71 |
$form_actions_registrar->register(new \Yeepdf_Redirect_Download_PDF_Action_After_Submit()); |
| 72 |
} |
| 73 |
function activation() |
| 74 |
{ |
| 75 |
$check = get_option("yeepdf_elementor_forms_setup"); |
| 76 |
if (!$check) { |
| 77 |
$data = file_get_contents(YEEPDF_ELEMENTOR_PDF_PLUGIN_PATH . "elementor/form-import.json"); |
| 78 |
$my_template = array( |
| 79 |
'post_title' => "Elementor Form Default", |
| 80 |
'post_content' => "", |
| 81 |
'post_status' => 'publish', |
| 82 |
'post_type' => 'yeepdf' |
| 83 |
); |
| 84 |
$id_template = wp_insert_post($my_template); |
| 85 |
add_post_meta($id_template, "data_email", $data); |
| 86 |
add_post_meta($id_template, "_builder_pdf_settings_font_family", 'dejavu sans'); |
| 87 |
update_option("yeepdf_elementor_forms_setup", $id_template); |
| 88 |
} |
| 89 |
} |
| 90 |
} |
| 91 |
new Yeepdf_Creator_Form_Widget_Builder; |
| 92 |
} |
| 93 |
|