PluginProbe
CSS & JavaScript Toolbox / 6.0
CSS & JavaScript Toolbox v6.0
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 +16 -6 11.36.0 View file →
@@ -47,12 +47,9 @@
47 47 * put your comment there...
48 48 *
49 49 */
50 50 protected function getStateAction() {
51 - # Get component product types
52 - $licenseTypes = $this->model->getExtensionProductTypes($_REQUEST['component']);
53 - # Return license state back
54 - $this->response = $this->model->getStateStruct($licenseTypes);
51 + $this->response = $this->model->getStateStruct($_REQUEST['component']);
55 52 }
56 53
57 54 /**
58 55 * put your comment there...
@@ -59,17 +56,30 @@
59 56 *
60 57 */
61 58 protected function licenseAction() {
62 59 // Read request parameters!
63 - $action = $_REQUEST['licenseAction'];
60 + $action = $_REQUEST['eddAction'];
64 61 $state['component'] = $_REQUEST['component'];
65 62 $state['license'] = $_REQUEST['license'];
66 63 // Initializing!
67 64 $model =& $this->model;
68 65 // Request EDD through EDD SL APIs!
69 - $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 + }
70 74 // Cahe only if the request is 'activate' or 'deactivate' and the returned state is valid or 'deactivated! respectively.
71 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 + }
72 82 $state['action'] = $model->cacheState($state['component'], $action, $state);
73 83 }
74 84 // Return state object includes (component, license, edd response [and action only if valid])
75 85 $this->response = $state;