| @@ -2,19 +2,19 @@ | ||
| 2 | 2 | |
| 3 | 3 | /* |
| 4 | 4 | Plugin Name: E2Pdf |
| 5 | 5 | Plugin URI: https://e2pdf.com |
| 6 | - Description: Export to PDF tool | |
| 7 | - Version: 1.07.11 | |
| 6 | + Description: Export PDF tool | |
| 7 | + Version: 1.32.49 | |
| 8 | 8 | Author: E2Pdf.com |
| 9 | 9 | Author URI: https://e2pdf.com/contributors |
| 10 | 10 | Text Domain: e2pdf |
| 11 | 11 | Domain Path: /languages |
| 12 | - License: GPL2 | |
| 12 | + License: GPLv3 | |
| 13 | 13 | |
| 14 | - E2pdf is free software: you can redistribute it and/or modify | |
| 14 | + E2Pdf is free software: you can redistribute it and/or modify | |
| 15 | 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 | |
| 16 | + the Free Software Foundation, either version 3 of the License, or | |
| 17 | 17 | any later version. |
| 18 | 18 | |
| 19 | 19 | E2pdf is distributed in the hope that it will be useful, |
| 20 | 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| @@ -21,9 +21,9 @@ | ||
| 21 | 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 | 22 | GNU General Public License for more details. |
| 23 | 23 | |
| 24 | 24 | You should have received a copy of the GNU General Public License |
| 25 | - along with E2pdf. If not, see https://e2pdf.com/license. | |
| 25 | + along with E2pdf. If not, see https://www.gnu.org/licenses/gpl-3.0.html. | |
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | 28 | if (!defined('ABSPATH')) { |
| 29 | 29 | die('Access denied.'); |
| @@ -28,96 +28,76 @@ | ||
| 28 | 28 | if (!defined('ABSPATH')) { |
| 29 | 29 | die('Access denied.'); |
| 30 | 30 | } |
| 31 | 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 | - ); | |
| 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 | +} | |
| 43 | 38 | |
| 44 | - $replace = array( | |
| 45 | - "-", | |
| 46 | - "", | |
| 47 | - "", | |
| 48 | - "", | |
| 49 | - "", | |
| 50 | - "", | |
| 51 | - "" | |
| 52 | - ); | |
| 39 | +if (!defined('E2PDF_ROOT_FILE')) { | |
| 40 | + define('E2PDF_ROOT_FILE', __FILE__); | |
| 41 | +} | |
| 53 | 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 | + ]; | |
| 54 | 63 | return strtolower( |
| 55 | 64 | str_replace($search, $replace, $class_name) |
| 56 | 65 | ); |
| 57 | 66 | } |
| 58 | 67 | |
| 59 | -// e2pdf class autoloader | |
| 68 | +// autoloader | |
| 60 | 69 | function e2pdf_autoloader($class_name) { |
| 61 | - | |
| 62 | 70 | if (!preg_match('/^(.*?)E2pdf(.*?)$/', $class_name)) { |
| 63 | 71 | return; |
| 64 | 72 | } |
| 65 | - | |
| 66 | 73 | $path = dirname(__FILE__); |
| 67 | 74 | $path .= '/classes'; |
| 68 | - | |
| 69 | 75 | if (preg_match('/^Helper.+$/', $class_name)) { |
| 70 | 76 | $path .= '/helper/'; |
| 71 | - } else if (preg_match('/^Controller_Frontend.+$/', $class_name)) { | |
| 77 | + } elseif (preg_match('/^Controller_Frontend.+$/', $class_name)) { | |
| 72 | 78 | $path .= '/controller/frontend/'; |
| 73 | - } else if (preg_match('/^Controller.+$/', $class_name)) { | |
| 79 | + } elseif (preg_match('/^Controller.+$/', $class_name)) { | |
| 74 | 80 | $path .= '/controller/'; |
| 75 | - } else if (preg_match('/^Model.+$/', $class_name)) { | |
| 81 | + } elseif (preg_match('/^Model.+$/', $class_name)) { | |
| 76 | 82 | $path .= '/model/'; |
| 77 | - } else if (preg_match('/^View.+$/', $class_name)) { | |
| 83 | + } elseif (preg_match('/^View.+$/', $class_name)) { | |
| 78 | 84 | $path .= '/view/'; |
| 79 | - } else if (preg_match('/^Extension.+$/', $class_name)) { | |
| 85 | + } elseif (preg_match('/^Extension.+$/', $class_name)) { | |
| 80 | 86 | $path .= '/extension/'; |
| 81 | - } else if (preg_match('/^Api.+$/', $class_name)) { | |
| 87 | + } elseif (preg_match('/^Api.+$/', $class_name)) { | |
| 82 | 88 | $path .= '/api/'; |
| 83 | 89 | } |
| 84 | - | |
| 85 | 90 | $class_path = e2pdf_autoloader_convert_name($class_name); |
| 86 | - | |
| 87 | 91 | $path .= $class_path . '.php'; |
| 88 | - | |
| 89 | 92 | if (file_exists($path)) { |
| 90 | - include($path); | |
| 93 | + include $path; | |
| 91 | 94 | } |
| 92 | 95 | } |
| 93 | 96 | |
| 94 | -if (is_array(spl_autoload_functions()) && in_array('__autoload', spl_autoload_functions())) { | |
| 97 | +if (is_array(spl_autoload_functions()) && in_array('__autoload', spl_autoload_functions(), false)) { | |
| 95 | 98 | spl_autoload_register('__autoload'); |
| 96 | 99 | } |
| 97 | - | |
| 98 | 100 | spl_autoload_register('e2pdf_autoloader'); |
| 99 | 101 | |
| 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 | -$helper->set('cache', get_option('e2pdf_cache')); | |
| 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(); | |
| 102 | +// load | |
| 103 | +(new Model_E2pdf_Loader())->load(); | |