PluginProbe
E2Pdf – Export Pdf Tool for WordPress / 1.06.02
E2Pdf – Export Pdf Tool for WordPress v1.06.02
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 1.06.02, at classes/controller/e2pdf-license.php

83 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
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
11 */
12 if (!defined('ABSPATH')) {
13 die('Access denied.');
14 }
15
16 class Controller_E2pdf_License extends Helper_E2pdf_View {
17
18 /**
19 * @url admin.php?page=e2pdf-license
20 */
21 public function index_action() {
22
23 $this->load_scripts();
24 $this->load_styles();
25 if ($this->helper->get('license')->get('error')) {
26 $this->add_notification('error', $this->helper->get('license')->get('error'));
27 }
28 $this->view('license', $this->helper->get('license'));
29 }
30
31 /**
32 * Load javascript on license page
33 */
34 public function load_scripts() {
35
36 wp_enqueue_script('jquery-ui-dialog');
37 }
38
39 /**
40 * Load style on license page
41 */
42 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);
45 }
46
47 /**
48 * Change license key via ajax
49 * action: wp_ajax_e2pdf_license_key
50 * function: e2pdf_license_key
51 *
52 * @return json
53 */
54 public function ajax_change_license_key() {
55
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']);
69 } else {
70 $this->add_notification('update', __('License Key updated successfully', 'e2pdf'));
71 }
72
73 $response = array(
74 'redirect' => $this->helper->get_url(array(
75 'page' => 'e2pdf-license',
76 )
77 )
78 );
79 $this->json_response($response);
80 }
81
82 }
83