| @@ -69,9 +69,9 @@ | ||
| 69 | 69 | public function load_actions() { |
| 70 | 70 | if (is_admin()) { |
| 71 | 71 | add_action('wpmu_new_blog', [&$this, 'action_wpmu_new_blog']); |
| 72 | 72 | add_action('admin_menu', [&$this, 'action_admin_menu']); |
| 73 | - add_action('admin_init', [&$this, 'action_admin_init']); | |
| 73 | + add_action('admin_init', [&$this, 'action_admin_init'], 9); | |
| 74 | 74 | add_action('admin_enqueue_scripts', [&$this, 'action_admin_enqueue_scripts']); |
| 75 | 75 | add_action('current_screen', [&$this, 'action_current_screen']); |
| 76 | 76 | add_action('plugins_loaded', [&$this, 'action_plugins_loaded']); |
| 77 | 77 | } |
| @@ -501,8 +501,41 @@ | ||
| 501 | 501 | |
| 502 | 502 | // settings page |
| 503 | 503 | public function action_admin_init() { |
| 504 | 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 | + } | |
| 505 | 538 | } |
| 506 | 539 | |
| 507 | 540 | // admin_enqueue_scripts action |
| 508 | 541 | public function action_admin_enqueue_scripts($page) { |
| @@ -859,8 +892,13 @@ | ||
| 859 | 892 | /* translators: %d: Template ID */ |
| 860 | 893 | 'This will overwrite the Template ID "%d". Continue?' => __('This will overwrite the Template ID "%d". Continue?', 'e2pdf'), |
| 861 | 894 | 'Filter' => __('Filter...', 'e2pdf'), |
| 862 | 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'), | |
| 863 | 901 | ]; |
| 864 | 902 | break; |
| 865 | 903 | case 'params': |
| 866 | 904 | $nonces = []; |
| @@ -925,9 +963,9 @@ | ||
| 925 | 963 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 926 | 964 | if ($current_screen->id == 'e2pdf_page_e2pdf-templates' && !isset($_GET['action'])) { |
| 927 | 965 | $screen_option = [ |
| 928 | 966 | 'label' => __('Templates per page', 'e2pdf') . ':', |
| 929 | - 'default' => get_option('e2pdf_templates_screen_per_page') ? get_option('e2pdf_templates_screen_per_page') : '20', | |
| 967 | + 'default' => (int) get_option('e2pdf_templates_screen_per_page', '20'), | |
| 930 | 968 | 'option' => 'e2pdf_templates_screen_per_page', |
| 931 | 969 | ]; |
| 932 | 970 | add_screen_option('per_page', $screen_option); |
| 933 | 971 | } |
| @@ -1112,8 +1150,12 @@ | ||
| 1112 | 1150 | update_option('e2pdf_adobe_api_version', '0'); |
| 1113 | 1151 | } else { |
| 1114 | 1152 | update_option('e2pdf_adobe_api_version', '1'); |
| 1115 | 1153 | } |
| 1154 | + } | |
| 1155 | + | |
| 1156 | + if ((int) get_option('e2pdf_templates_screen_per_page', '20') <= 0) { | |
| 1157 | + update_option('e2pdf_templates_screen_per_page', '20'); | |
| 1116 | 1158 | } |
| 1117 | 1159 | |
| 1118 | 1160 | delete_option('e2pdf_developer'); |
| 1119 | 1161 | delete_option('e2pdf_developer_ips'); |