PluginProbe ʕ •ᴥ•ʔ
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel / 1.3.6
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel v1.3.6
trunk 0.9.0 0.9.1 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0 1.2.1 1.2.10 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.14 1.4.15 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0
wp-all-export / src / App / Controller / SchedulingLicenseController.php
wp-all-export / src / App / Controller Last commit date
CategoriesController.php 8 years ago ExportController.php 4 years ago GoogleCategoriesController.php 8 years ago SchedulingConnectionController.php 8 years ago SchedulingLicenseController.php 7 years ago
SchedulingLicenseController.php
89 lines
1 <?php
2
3 namespace Wpae\App\Controller;
4
5 use PMXE_Plugin;
6 use Wpae\App\Service\License\LicenseActivator;
7 use Wpae\Http\JsonResponse;
8 use Wpae\Scheduling\LicensingManager;
9
10 class SchedulingLicenseController
11 {
12 /** @var LicensingManager */
13 private $licensingManager;
14
15 /** @var LicenseActivator */
16 private $licensingActivator;
17
18 private $slug = 'wp-all-export-pro';
19
20 public function __construct()
21 {
22 $this->licensingManager = new LicensingManager();
23 $this->licensingActivator = new LicenseActivator();
24 }
25
26 public function getSchedulingLicense()
27 {
28 $options = \PMXE_Plugin::getInstance()->getOption();
29
30 if (empty($options['scheduling_license'])) {
31 return false;
32 }
33
34 return new JsonResponse(
35 array(
36 'license' => $this->licensingManager->checkLicense($options['scheduling_license'], \PMXE_Plugin::getSchedulingName())
37 )
38 );
39 }
40
41 public function saveSchedulingLicenseAction()
42 {
43 $license = $_POST['license'];
44
45 if($this->licensingManager->checkLicense($license, \PMXE_Plugin::getSchedulingName())){
46 PMXE_Plugin::getInstance()->updateOption(array('scheduling_license' => $license));
47 $post['license_status'] = $this->check_scheduling_license();
48 $response = $this->activate_scheduling_licenses();
49
50 return new JsonResponse(array('success' => true));
51 } else {
52 return new JsonResponse(array('success'=> false));
53 }
54 }
55
56 /*
57 *
58 * Activate licenses for main plugin and all premium addons
59 *
60 */
61 protected function activate_scheduling_licenses()
62 {
63 global $wpdb;
64
65 delete_transient(PMXE_Plugin::$cache_key);
66
67 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->options WHERE option_name = %s", $this->slug . '_' . PMXE_Plugin::$cache_key) );
68 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->options WHERE option_name = %s", $this->slug . '_timeout_' . PMXE_Plugin::$cache_key) );
69
70 delete_site_transient('update_plugins');
71
72 // retrieve the license from the database
73 return $this->licensingActivator->activateLicense(PMXE_Plugin::getSchedulingName(),\Wpae\App\Service\License\LicenseActivator::CONTEXT_SCHEDULING);
74 }
75
76 public function check_scheduling_license()
77 {
78 $options = PMXE_Plugin::getInstance()->getOption();
79
80 global $wpdb;
81
82 delete_transient(PMXE_Plugin::$cache_key);
83
84 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->options WHERE option_name = %s", $this->slug . '_' . PMXE_Plugin::$cache_key) );
85 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->options WHERE option_name = %s", $this->slug . '_timeout_' . PMXE_Plugin::$cache_key) );
86
87 return $this->licensingActivator->checkLicense(PMXE_Plugin::getSchedulingName(), $options, LicenseActivator::CONTEXT_SCHEDULING);
88 }
89 }