PluginProbe
E2Pdf – Export Pdf Tool for WordPress / 1.32.49
E2Pdf – Export Pdf Tool for WordPress v1.32.49
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 1.08.00 1.08.06 All 72 releases
← All changes | classes/controller/e2pdf-license.php +41 -37 1.08.001.32.49 View file →
@@ -1,14 +1,12 @@
1 1 <?php
2 2
3 3 /**
4 - * E2pdf License Controller
5 - *
6 - * @copyright Copyright 2017 https://e2pdf.com
7 - * @license GPL v2
8 - * @version 1
9 - * @link https://e2pdf.com
10 - * @since 0.00.01
4 + * File: /controller/e2pdf-license.php
5 + *
6 + * @package E2Pdf
7 + * @license GPLv3
8 + * @link https://e2pdf.com
11 9 */
12 10 if (!defined('ABSPATH')) {
13 11 die('Access denied.');
14 12 }
@@ -18,14 +16,10 @@
18 16 /**
19 17 * @url admin.php?page=e2pdf-license
20 18 */
21 19 public function index_action() {
22 -
23 20 $this->load_scripts();
24 21 $this->load_styles();
25 - if ($this->helper->get('license')->get('error')) {
26 - $this->add_notification('error', $this->helper->get('license')->get('error'));
27 - }
28 22 $this->view('license', $this->helper->get('license'));
29 23 }
30 24
31 25 /**
@@ -31,9 +25,8 @@
31 25 /**
32 26 * Load javascript on license page
33 27 */
34 28 public function load_scripts() {
35 -
36 29 wp_enqueue_script('jquery-ui-dialog');
37 30 }
38 31
39 32 /**
@@ -39,10 +32,10 @@
39 32 /**
40 33 * Load style on license page
41 34 */
42 35 public function load_styles() {
43 -
44 - wp_enqueue_style('plugin_name-admin-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css', false, false, false);
36 + $version = get_option('e2pdf_debug', '0') === '1' ? strtotime('now') : $this->helper->get('version');
37 + wp_enqueue_style('css/e2pdf.jquery-ui', plugins_url('css/jquery-ui.css', $this->helper->get('plugin_file_path')), false, $version, false);
45 38 }
46 39
47 40 /**
48 41 * Change license key via ajax
@@ -47,36 +40,47 @@
47 40 /**
48 41 * Change license key via ajax
49 42 * action: wp_ajax_e2pdf_license_key
50 43 * function: e2pdf_license_key
51 - *
52 44 * @return json
53 45 */
54 46 public function ajax_change_license_key() {
47 + if (wp_verify_nonce($this->get->get('_wpnonce'), 'e2pdf_license')) {
48 + $data = $this->post->get('data');
49 + $this->helper->load('license')->change(isset($data['license_key']) ? $data['license_key'] : '');
50 + $response = [
51 + 'redirect' => $this->helper->get_url(
52 + [
53 + 'page' => 'e2pdf-license',
54 + 'notification' => isset($request['error']) ? $this->add_notification('error', $request['error']) : $this->add_notification('update', __('License Key Changed', 'e2pdf')),
55 + ]
56 + ),
57 + ];
58 + } else {
59 + $response['error'] = $this->message('wp_verify_nonce_error');
60 + }
61 + $this->json_response($response);
62 + }
55 63
56 - $data = $this->post->get('data');
57 -
58 - $model_e2pdf_api = new Model_E2pdf_Api();
59 - $model_e2pdf_api->set(array(
60 - 'action' => 'license/update',
61 - 'data' => array(
62 - 'license_key' => trim($data['license_key'])
63 - )
64 - ));
65 - $request = $model_e2pdf_api->request();
66 -
67 - if (isset($request['error'])) {
68 - $this->add_notification('error', $request['error']);
64 + public function ajax_deactivate_all_templates() {
65 + if (wp_verify_nonce($this->get->get('_wpnonce'), 'e2pdf_license')) {
66 + $model_e2pdf_api = new Model_E2pdf_Api();
67 + $model_e2pdf_api->set(
68 + [
69 + 'action' => 'template/deactivateall',
70 + ]
71 + );
72 + $request = $model_e2pdf_api->request();
73 + $response = [
74 + 'redirect' => $this->helper->get_url(
75 + [
76 + 'page' => 'e2pdf-license',
77 + 'notification' => isset($request['error']) ? $this->add_notification('error', $request['error']) : $this->add_notification('update', __('Templates Deactivated', 'e2pdf')),
78 + ]
79 + ),
80 + ];
69 81 } else {
70 - $this->add_notification('update', __('License Key updated successfully', 'e2pdf'));
82 + $response['error'] = $this->message('wp_verify_nonce_error');
71 83 }
72 -
73 - $response = array(
74 - 'redirect' => $this->helper->get_url(array(
75 - 'page' => 'e2pdf-license',
76 - )
77 - )
78 - );
79 84 $this->json_response($response);
80 85 }
81 -
82 86 }