PluginProbe
E2Pdf – Export Pdf Tool for WordPress / trunk
E2Pdf – Export Pdf Tool for WordPress vtrunk
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 1.08.09 All 71 releases
e2pdf / classes / controller / e2pdf-license.php

e2pdf-license.php in E2Pdf – Export Pdf Tool for WordPress trunk, at classes/controller/e2pdf-license.php

87 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * File: /controller/e2pdf-license.php
5 *
6 * @package E2Pdf
7 * @license GPLv3
8 * @link https://e2pdf.com
9 */
10 if (!defined('ABSPATH')) {
11 die('Access denied.');
12 }
13
14 class Controller_E2pdf_License extends Helper_E2pdf_View {
15
16 /**
17 * @url admin.php?page=e2pdf-license
18 */
19 public function index_action() {
20 $this->load_scripts();
21 $this->load_styles();
22 $this->view('license', $this->helper->get('license'));
23 }
24
25 /**
26 * Load javascript on license page
27 */
28 public function load_scripts() {
29 wp_enqueue_script('jquery-ui-dialog');
30 }
31
32 /**
33 * Load style on license page
34 */
35 public function load_styles() {
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);
38 }
39
40 /**
41 * Change license key via ajax
42 * action: wp_ajax_e2pdf_license_key
43 * function: e2pdf_license_key
44 * @return json
45 */
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 }
63
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 ];
81 } else {
82 $response['error'] = $this->message('wp_verify_nonce_error');
83 }
84 $this->json_response($response);
85 }
86 }
87