PluginProbe
CSS & JavaScript Toolbox / 6.1.3
CSS & JavaScript Toolbox v6.1.3
trunk 0.3 0.8 10 10.1 11 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 11.9.1 12 12.0 12.0.1 12.0.3 12.0.4 12.0.5 12.0.6 12.0.7 6.0 6.0.11 All 60 releases
← All changes | controllers/setup.php +32 -32 11.56.1.3 View file →
@@ -1,7 +1,7 @@
1 1 <?php
2 2 /**
3 -*
3 +*
4 4 */
5 5
6 6 // Disallow direct access.
7 7 defined('ABSPATH') or die("Access denied");
@@ -9,86 +9,86 @@
9 9 // import dependencies.
10 10 cssJSToolbox::import('framework:mvc:controller-ajax.inc.php');
11 11
12 12 /**
13 -*
13 +*
14 14 */
15 15 class CJTsetupController extends CJTAjaxController {
16 -
16 +
17 17 /**
18 18 * put your comment there...
19 - *
19 + *
20 20 * @var mixed
21 21 */
22 22 protected $controllerInfo = array('model' => 'setup');
23 -
23 +
24 24 /**
25 25 * put your comment there...
26 - *
26 + *
27 27 */
28 28 public function __construct() {
29 29 parent::__construct();
30 30 // Register actions!
31 31 $this->registryAction('activationFormView');
32 - $this->registryAction('promoTextView');
33 - $this->registryAction('getState');
32 + $this->registryAction('getState');
34 33 $this->registryAction('license');
35 34 $this->registryAction('reset');
36 35 }
37 -
36 +
38 37 /**
39 38 * Display Activation form!
40 - *
39 + *
41 40 */
42 41 protected function activationFormViewAction() {
43 42 // Display activation for for the requested component!
44 43 parent::displayAction();
45 44 }
46 -
45 +
47 46 /**
48 - * Display CJT Promo form!
49 - *
50 - */
51 - protected function promoTextViewAction() {
52 - // Display activation for for the requested component!
53 - parent::displayAction();
54 - }
55 -
56 - /**
57 47 * put your comment there...
58 - *
48 + *
59 49 */
60 50 protected function getStateAction() {
61 - # Get component product types
62 - $licenseTypes = $this->model->getExtensionProductTypes($_REQUEST['component']);
63 - # Return license state back
64 - $this->response = $this->model->getStateStruct($licenseTypes);
51 + $this->response = $this->model->getStateStruct($_REQUEST['component']);
65 52 }
66 -
53 +
67 54 /**
68 55 * put your comment there...
69 - *
56 + *
70 57 */
71 58 protected function licenseAction() {
72 59 // Read request parameters!
73 - $action = $_REQUEST['licenseAction'];
60 + $action = $_REQUEST['eddAction'];
74 61 $state['component'] = $_REQUEST['component'];
75 62 $state['license'] = $_REQUEST['license'];
76 63 // Initializing!
77 64 $model =& $this->model;
78 65 // Request EDD through EDD SL APIs!
79 - $state['response'] = $model->dispatchLicenseAction($action, $state['component'], $state['license']);
66 + $state['response'] = $model->dispatchEddCall($action, $state['component'], $state['license']);
67 + // Standarize response object! As check and activate responde by 'valid' and 'invalid' and deactivate responde
68 + // by deactivated and faild we then need to make them all likce check and activate!
69 + if (($action == 'deactivate') && ($state['response']['license'] != 'error')) {
70 + $map = array('deactivated' => 'valid', 'failed' => 'invalid');
71 + $deactivateResponseState = $state['response']['license'];
72 + $state['response']['license'] = $map[$deactivateResponseState];
73 + }
80 74 // Cahe only if the request is 'activate' or 'deactivate' and the returned state is valid or 'deactivated! respectively.
81 75 if (($action != 'check') && ($state['response']['license'] == 'valid')) {
76 + // We need to standarize the response object so the access will be always the same
77 + // EDD return 'deactivated' and 'valid' with the success request using 'deactivate' and 'activate' repectively!
78 + // Use valid instead of deactivate!
79 + if ($action == 'deactivate') {
80 + $state['response']['license'] = 'valid';
81 + }
82 82 $state['action'] = $model->cacheState($state['component'], $action, $state);
83 83 }
84 84 // Return state object includes (component, license, edd response [and action only if valid])
85 85 $this->response = $state;
86 86 }
87 -
87 +
88 88 /**
89 89 * put your comment there...
90 - *
90 + *
91 91 */
92 92 protected function resetAction() {
93 93 // Initializing!
94 94 $model =& $this->model;
@@ -103,6 +103,6 @@
103 103 // even those not belongs to EDD real requests!!
104 104 $state['response']['item_name'] = $state['component']['name'];
105 105 $this->response = $state;
106 106 }
107 -
107 +
108 108 } // End class.