| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
Plugin Name: E2Pdf |
| 5 |
Plugin URI: https://e2pdf.com |
| 6 |
Description: Export PDF tool |
| 7 |
Version: 1.32.40 |
| 8 |
Author: E2Pdf.com |
| 9 |
Author URI: https://e2pdf.com/contributors |
| 10 |
Text Domain: e2pdf |
| 11 |
Domain Path: /languages |
| 12 |
License: GPLv3 |
| 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 3 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://www.gnu.org/licenses/gpl-3.0.html. |
| 26 |
*/ |
| 27 |
|
| 28 |
if (!defined('ABSPATH')) { |
| 29 |
die('Access denied.'); |
| 30 |
} |
| 31 |
|
| 32 |
// recoverty mode email |
| 33 |
if (get_option('e2pdf_debug', '0') && get_option('e2pdf_recovery_mode_email', '')) { |
| 34 |
if (!defined('RECOVERY_MODE_EMAIL')) { |
| 35 |
define('RECOVERY_MODE_EMAIL', get_option('e2pdf_recovery_mode_email', '')); |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
if (!defined('E2PDF_ROOT_FILE')) { |
| 40 |
define('E2PDF_ROOT_FILE', __FILE__); |
| 41 |
} |
| 42 |
|
| 43 |
// autoloader name to filename |
| 44 |
function e2pdf_autoloader_convert_name($class_name) { |
| 45 |
$search = [ |
| 46 |
'_', |
| 47 |
'Controller-Frontend-', |
| 48 |
'Controller-', |
| 49 |
'Model-', |
| 50 |
'Helper-', |
| 51 |
'Extension-', |
| 52 |
'Api-', |
| 53 |
]; |
| 54 |
$replace = [ |
| 55 |
'-', |
| 56 |
'', |
| 57 |
'', |
| 58 |
'', |
| 59 |
'', |
| 60 |
'', |
| 61 |
'', |
| 62 |
]; |
| 63 |
return strtolower( |
| 64 |
str_replace($search, $replace, $class_name) |
| 65 |
); |
| 66 |
} |
| 67 |
|
| 68 |
// autoloader |
| 69 |
function e2pdf_autoloader($class_name) { |
| 70 |
if (!preg_match('/^(.*?)E2pdf(.*?)$/', $class_name)) { |
| 71 |
return; |
| 72 |
} |
| 73 |
$path = dirname(__FILE__); |
| 74 |
$path .= '/classes'; |
| 75 |
if (preg_match('/^Helper.+$/', $class_name)) { |
| 76 |
$path .= '/helper/'; |
| 77 |
} elseif (preg_match('/^Controller_Frontend.+$/', $class_name)) { |
| 78 |
$path .= '/controller/frontend/'; |
| 79 |
} elseif (preg_match('/^Controller.+$/', $class_name)) { |
| 80 |
$path .= '/controller/'; |
| 81 |
} elseif (preg_match('/^Model.+$/', $class_name)) { |
| 82 |
$path .= '/model/'; |
| 83 |
} elseif (preg_match('/^View.+$/', $class_name)) { |
| 84 |
$path .= '/view/'; |
| 85 |
} elseif (preg_match('/^Extension.+$/', $class_name)) { |
| 86 |
$path .= '/extension/'; |
| 87 |
} elseif (preg_match('/^Api.+$/', $class_name)) { |
| 88 |
$path .= '/api/'; |
| 89 |
} |
| 90 |
$class_path = e2pdf_autoloader_convert_name($class_name); |
| 91 |
$path .= $class_path . '.php'; |
| 92 |
if (file_exists($path)) { |
| 93 |
include $path; |
| 94 |
} |
| 95 |
} |
| 96 |
|
| 97 |
if (is_array(spl_autoload_functions()) && in_array('__autoload', spl_autoload_functions(), false)) { |
| 98 |
spl_autoload_register('__autoload'); |
| 99 |
} |
| 100 |
spl_autoload_register('e2pdf_autoloader'); |
| 101 |
|
| 102 |
// load |
| 103 |
(new Model_E2pdf_Loader())->load(); |
| 104 |
|