| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Plugin Name: PDF for WPForms + Drag and Drop Template Builder |
| 5 |
* Description: WPForms PDF Customizer is a helpful tool that helps you build and customize the PDF Templates for WPforms. |
| 6 |
* Plugin URI: https://add-ons.org/plugin/wpforms-pdf-generator-attachment/ |
| 7 |
* Version: 7.2.0 |
| 8 |
* Author: add-ons.org |
| 9 |
* Author URI: https://add-ons.org/ |
| 10 |
* Text Domain: pdf-for-wpforms |
| 11 |
* Domain Path: /languages |
| 12 |
* License: GPL v2 or later |
| 13 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 14 |
*/ |
| 15 |
if (!defined('ABSPATH')) |
| 16 |
exit; // Exit if accessed directly |
| 17 |
define('BUIDER_PDF_WPFORMS_PLUGIN_URL', plugin_dir_url(__FILE__)); |
| 18 |
define('BUIDER_PDF_WPFORMS_PLUGIN_PATH', plugin_dir_path(__FILE__)); |
| 19 |
if (!class_exists('Yeepdf_Creator_Builder')) { |
| 20 |
require 'vendor/autoload.php'; |
| 21 |
if (!defined('YEEPDF_CREATOR_BUILDER_PATH')) { |
| 22 |
define('YEEPDF_CREATOR_BUILDER_PATH', plugin_dir_path(__FILE__)); |
| 23 |
} |
| 24 |
if (!defined('YEEPDF_CREATOR_BUILDER_URL')) { |
| 25 |
define('YEEPDF_CREATOR_BUILDER_URL', plugin_dir_url(__FILE__)); |
| 26 |
} |
| 27 |
class Yeepdf_Creator_Builder |
| 28 |
{ |
| 29 |
function __construct() |
| 30 |
{ |
| 31 |
if (!class_exists('Yeekitqrcode')) { |
| 32 |
include_once YEEPDF_CREATOR_BUILDER_PATH . "libs/phpqrcode.php"; |
| 33 |
} |
| 34 |
$dir = new RecursiveDirectoryIterator(YEEPDF_CREATOR_BUILDER_PATH . "backend"); |
| 35 |
$ite = new RecursiveIteratorIterator($dir); |
| 36 |
$files = new RegexIterator($ite, "/\.php/", RegexIterator::MATCH); |
| 37 |
foreach ($files as $file) { |
| 38 |
if (!$file->isDir()) { |
| 39 |
require_once $file->getPathname(); |
| 40 |
} |
| 41 |
} |
| 42 |
include_once YEEPDF_CREATOR_BUILDER_PATH . "frontend/index.php"; |
| 43 |
} |
| 44 |
} |
| 45 |
new Yeepdf_Creator_Builder; |
| 46 |
} |
| 47 |
class Yeepdf_Creator_Wpforms_Builder |
| 48 |
{ |
| 49 |
function __construct() |
| 50 |
{ |
| 51 |
register_activation_hook(__FILE__, array($this, 'activation')); |
| 52 |
add_action('init', array($this, 'load_textdomain')); |
| 53 |
include BUIDER_PDF_WPFORMS_PLUGIN_PATH . "wpforms/index.php"; |
| 54 |
include_once BUIDER_PDF_WPFORMS_PLUGIN_PATH . "yeekit/document.php"; |
| 55 |
} |
| 56 |
function load_textdomain() |
| 57 |
{ |
| 58 |
load_plugin_textdomain('pdf-for-wpforms', false, dirname(plugin_basename(__FILE__)) . '/languages'); |
| 59 |
} |
| 60 |
function activation() |
| 61 |
{ |
| 62 |
$check = get_option("yeepdf_wpforms_setup"); |
| 63 |
if (!$check) { |
| 64 |
$data = file_get_contents(BUIDER_PDF_WPFORMS_PLUGIN_PATH . "wpforms/form-import.json"); |
| 65 |
$my_template = array( |
| 66 |
'post_title' => "WPForms Default PDF", |
| 67 |
'post_content' => "", |
| 68 |
'post_status' => 'publish', |
| 69 |
'post_type' => 'yeepdf' |
| 70 |
); |
| 71 |
$id_template = wp_insert_post($my_template); |
| 72 |
add_post_meta($id_template, "data_email", $data); |
| 73 |
add_post_meta($id_template, "_builder_pdf_settings_font_family", 'dejavu sans'); |
| 74 |
update_option("yeepdf_wpforms_setup", $id_template); |
| 75 |
} |
| 76 |
} |
| 77 |
} |
| 78 |
new Yeepdf_Creator_Wpforms_Builder; |
| 79 |
|