PluginProbe
E2Pdf – Export Pdf Tool for WordPress / 1.32.53
E2Pdf – Export Pdf Tool for WordPress v1.32.53
1.32.53 1.32.51 1.32.49 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 All 74 releases
← All changes | classes/model/e2pdf-loader.php +51 -25 1.32.18 → 1.32.53 View file →
@@ -51,9 +51,8 @@
51 51 add_action('wp_ajax_e2pdf_visual_mapper', [new Controller_E2pdf_Templates(), 'ajax_visual_mapper']);
52 52 add_action('wp_ajax_e2pdf_get_styles', [new Controller_E2pdf_Templates(), 'ajax_get_styles']);
53 53 add_action('wp_ajax_e2pdf_email', [new Controller_E2pdf_Templates(), 'ajax_email']);
54 54 add_action('wp_ajax_e2pdf_license_key', [new Controller_E2pdf_License(), 'ajax_change_license_key']);
55 - add_action('wp_ajax_e2pdf_restore_license_key', [new Controller_E2pdf_License(), 'ajax_restore_license_key']);
56 55 add_action('wp_ajax_e2pdf_deactivate_all_templates', [new Controller_E2pdf_License(), 'ajax_deactivate_all_templates']);
57 56 add_action('wp_ajax_e2pdf_templates', [new Controller_E2pdf(), 'ajax_templates']);
58 57 add_action('wp_ajax_e2pdf_dataset', [new Controller_E2pdf(), 'ajax_dataset']);
59 58 add_action('wp_ajax_e2pdf_datasets_refresh', [new Controller_E2pdf(), 'ajax_datasets_refresh']);
@@ -70,9 +69,9 @@
70 69 public function load_actions() {
71 70 if (is_admin()) {
72 71 add_action('wpmu_new_blog', [&$this, 'action_wpmu_new_blog']);
73 72 add_action('admin_menu', [&$this, 'action_admin_menu']);
74 - add_action('admin_init', [&$this, 'action_admin_init']);
73 + add_action('admin_init', [&$this, 'action_admin_init'], 9);
75 74 add_action('admin_enqueue_scripts', [&$this, 'action_admin_enqueue_scripts']);
76 75 add_action('current_screen', [&$this, 'action_current_screen']);
77 76 add_action('plugins_loaded', [&$this, 'action_plugins_loaded']);
78 77 }
@@ -502,8 +501,41 @@
502 501
503 502 // settings page
504 503 public function action_admin_init() {
505 504 register_setting('e2pdf-settings', 'e2pdf_debug');
505 +
506 + /**
507 + * Compatibility fix with Gallery : FooGallery
508 + * https://wordpress.org/plugins/foogallery/
509 + */
510 + if (class_exists('FooGallery_Admin_Extensions')) {
511 + if (!wp_doing_ajax()) {
512 + return;
513 + }
514 + $action = isset($_REQUEST['action']) && is_string($_REQUEST['action']) ? $_REQUEST['action'] : '';
515 + if ('e2pdf_upload' !== $action) {
516 + return;
517 + }
518 + global $wp_filter;
519 + if (isset($wp_filter['admin_init']) && $wp_filter['admin_init'] instanceof WP_Hook) {
520 + foreach ($wp_filter['admin_init']->callbacks as $priority => $callbacks) {
521 + if (!is_array($callbacks)) {
522 + continue;
523 + }
524 + foreach ($callbacks as $callback) {
525 + if (
526 + isset($callback['function']) &&
527 + is_array($callback['function']) &&
528 + isset($callback['function'][0], $callback['function'][1]) &&
529 + $callback['function'][0] instanceof FooGallery_Admin_Extensions &&
530 + 'handle_extension_action' === $callback['function'][1]
531 + ) {
532 + remove_action('admin_init', $callback['function'], $priority);
533 + }
534 + }
535 + }
536 + }
537 + }
506 538 }
507 539
508 540 // admin_enqueue_scripts action
509 541 public function action_admin_enqueue_scripts($page) {
@@ -858,8 +890,15 @@
858 890 'Quick Props' => __('Quick Props', 'e2pdf'),
859 891 'The Template ID used in the backup will be overwritten. Continue?' => __('The Template ID used in the backup will be overwritten. Continue?', 'e2pdf'),
860 892 /* translators: %d: Template ID */
861 893 'This will overwrite the Template ID "%d". Continue?' => __('This will overwrite the Template ID "%d". Continue?', 'e2pdf'),
894 + 'Filter' => __('Filter...', 'e2pdf'),
895 + 'Not linked' => __('Not linked', 'e2pdf'),
896 + 'Inner Radius' => __('Inner Radius', 'e2pdf'),
897 + 'Start Angle' => __('Start Angle', 'e2pdf'),
898 + 'Key Labels' => __('Key Labels', 'e2pdf'),
899 + 'Amount Labels' => __('Amount Labels', 'e2pdf'),
900 + 'Percent Labels' => __('Percent Labels', 'e2pdf'),
862 901 ];
863 902 break;
864 903 case 'params':
865 904 $nonces = [];
@@ -880,13 +919,8 @@
880 919 'css_styles' => array_keys($this->helper->load('properties')->css_styles()),
881 920 'undo_limit' => get_option('e2pdf_undo_limit', '20'),
882 921 ];
883 922 break;
884 - case 'frontend_params':
885 - $data = [
886 - 'pdfjs' => plugins_url('assets/pdf.js', $this->helper->get('plugin_file_path')),
887 - ];
888 - break;
889 923 default:
890 924 break;
891 925 }
892 926 return $data;
@@ -924,20 +958,14 @@
924 958 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
925 959 if ($current_screen->id == 'e2pdf_page_e2pdf-templates' && !isset($_GET['action'])) {
926 960 $screen_option = [
927 961 'label' => __('Templates per page', 'e2pdf') . ':',
928 - 'default' => get_option('e2pdf_templates_screen_per_page') ? get_option('e2pdf_templates_screen_per_page') : '20',
962 + 'default' => (int) get_option('e2pdf_templates_screen_per_page', '20'),
929 963 'option' => 'e2pdf_templates_screen_per_page',
930 964 ];
931 965 add_screen_option('per_page', $screen_option);
932 966 }
933 -
934 - $this->helper->set('license', new Model_E2pdf_License());
935 - if ($this->helper->get('license')->get('error') === 'Site Url Not Found. Please try to "Reactivate" plugin.') {
936 - update_option('e2pdf_version', '1.00.00');
937 - $this->action_plugins_loaded();
938 - $this->helper->set('license', new Model_E2pdf_License());
939 - }
967 + $this->helper->load('license')->load();
940 968 }
941 969
942 970 // wp_loaded action
943 971 public function action_wp_loaded() {
@@ -1119,8 +1147,12 @@
1119 1147 update_option('e2pdf_adobe_api_version', '1');
1120 1148 }
1121 1149 }
1122 1150
1151 + if ((int) get_option('e2pdf_templates_screen_per_page', '20') <= 0) {
1152 + update_option('e2pdf_templates_screen_per_page', '20');
1153 + }
1154 +
1123 1155 delete_option('e2pdf_developer');
1124 1156 delete_option('e2pdf_developer_ips');
1125 1157 delete_option('e2pdf_translatepress_translation');
1126 1158 delete_option('e2pdf_wc_invoice_template_id');
@@ -1128,18 +1160,12 @@
1128 1160 delete_option('e2pdf_wc_checkout_template_id_order');
1129 1161 delete_option('e2pdf_wc_cart_template_id_order');
1130 1162 delete_option('e2pdf_hash_timeout');
1131 1163
1132 - $model_e2pdf_api = new Model_E2pdf_Api();
1133 - $model_e2pdf_api->set(
1134 - [
1135 - 'action' => 'common/activate',
1136 - ]
1137 - );
1138 - $model_e2pdf_api->request();
1139 -
1140 - $model_e2pdf_license = new Model_E2pdf_License();
1141 - $model_e2pdf_license->load_templates();
1164 + $license = $this->helper->load('license');
1165 + if ($license && method_exists($license, 'activate')) {
1166 + $license->activate();
1167 + }
1142 1168
1143 1169 wp_clear_scheduled_hook('e2pdf_cronjob');
1144 1170 if (!wp_next_scheduled('e2pdf_cache_tmp_cron')) {
1145 1171 wp_schedule_event(time(), 'daily', 'e2pdf_cache_tmp_cron');