PluginProbe
E2Pdf – Export Pdf Tool for WordPress / 1.06.02
E2Pdf – Export Pdf Tool for WordPress v1.06.02
1.32.48 1.32.43 1.32.40 1.32.34 1.32.32 1.32.31 1.32.26 1.32.22 1.32.23 1.32.18 1.32.17 1.32.15 trunk 1.00.00 1.00.13 1.01.01 1.02.02 1.03.07 1.04.07 1.05.03 1.06.02 1.07.11 1.08.00 1.08.06 1.08.09 All 71 releases
e2pdf / e2pdf.php

e2pdf.php in E2Pdf – Export Pdf Tool for WordPress 1.06.02, at e2pdf.php

124 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 Plugin Name: E2Pdf
5 Plugin URI: https://e2pdf.com
6 Description: Export to PDF tool
7 Version: 1.06.02
8 Author: E2Pdf.com
9 Author URI: https://e2pdf.com/contributors
10 Text Domain: e2pdf
11 Domain Path: /languages
12 License: GPL2
13
14 E2pdf is free software: you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 2 of the License, or
17 any later version.
18
19 E2pdf is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with E2pdf. If not, see https://e2pdf.com/license.
26 */
27
28 if (!defined('ABSPATH')) {
29 die('Access denied.');
30 }
31
32 // Autoloader convert class name to filename
33 function e2pdf_autoloader_convert_name($class_name) {
34 $search = array(
35 "_",
36 "Controller-Frontend-",
37 "Controller-",
38 "Model-",
39 "Helper-",
40 "Extension-",
41 "Api-"
42 );
43
44 $replace = array(
45 "-",
46 "",
47 "",
48 "",
49 "",
50 "",
51 ""
52 );
53
54 return strtolower(
55 str_replace($search, $replace, $class_name)
56 );
57 }
58
59 // e2pdf class autoloader
60 function e2pdf_autoloader($class_name) {
61
62 if (!preg_match('/^(.*?)E2pdf(.*?)$/', $class_name)) {
63 return;
64 }
65
66 $path = dirname(__FILE__);
67 $path .= '/classes';
68
69 if (preg_match('/^Helper.+$/', $class_name)) {
70 $path .= '/helper/';
71 } else if (preg_match('/^Controller_Frontend.+$/', $class_name)) {
72 $path .= '/controller/frontend/';
73 } else if (preg_match('/^Controller.+$/', $class_name)) {
74 $path .= '/controller/';
75 } else if (preg_match('/^Model.+$/', $class_name)) {
76 $path .= '/model/';
77 } else if (preg_match('/^View.+$/', $class_name)) {
78 $path .= '/view/';
79 } else if (preg_match('/^Extension.+$/', $class_name)) {
80 $path .= '/extension/';
81 } else if (preg_match('/^Api.+$/', $class_name)) {
82 $path .= '/api/';
83 }
84
85 $class_path = e2pdf_autoloader_convert_name($class_name);
86
87 $path .= $class_path . '.php';
88
89 if (file_exists($path)) {
90 include($path);
91 }
92 }
93
94 if (is_array(spl_autoload_functions()) && in_array('__autoload', spl_autoload_functions())) {
95 spl_autoload_register('__autoload');
96 }
97
98 spl_autoload_register('e2pdf_autoloader');
99
100 $e2pdf_wp_upload_dir = wp_upload_dir();
101
102 $e2pdf_plugin_data = get_file_data(__FILE__, array('version' => 'Version'), false);
103 $helper = Helper_E2pdf_Helper::instance();
104 $helper->set('plugin_dir', plugin_dir_path(__FILE__));
105 $helper->set('upload_dir', $e2pdf_wp_upload_dir['basedir'] . '/e2pdf/');
106 $helper->set('tmp_dir', $helper->get('upload_dir') . 'tmp/');
107 $helper->set('pdf_dir', $helper->get('upload_dir') . 'pdf/');
108 $helper->set('fonts_dir', $helper->get('upload_dir') . 'fonts/');
109 $helper->set('tpl_dir', $helper->get('upload_dir') . 'tpl/');
110 $helper->set('plugin_file_path', __FILE__);
111 $helper->set('version', $e2pdf_plugin_data['version']);
112 $helper->set('plugin_slug', plugin_basename(__FILE__));
113 list ($t1, $t2) = explode('/', plugin_basename(__FILE__));
114 $helper->set('slug', str_replace('.php', '', $t2));
115
116
117 if (get_option('e2pdf_memory_time')) {
118 $helper->set('memory_debug', memory_get_usage());
119 $helper->set('time_debug', microtime(true));
120 }
121
122 $loader = new Model_E2pdf_Loader();
123 $loader->load();
124