PluginProbe
CSS & JavaScript Toolbox / 11.9.1
CSS & JavaScript Toolbox v11.9.1
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
css-javascript-toolbox / framework / ServicesAPI / Module.class.php

Module.class.php in CSS & JavaScript Toolbox 11.9.1, at framework/ServicesAPI/Module.class.php

107 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 *
4 */
5
6 /**
7 *
8 */
9 abstract class CJTServicesClientModule {
10
11 /**
12 * put your comment there...
13 *
14 * @var WP_Error
15 */
16 private $response;
17
18 /**
19 * put your comment there...
20 *
21 * @var mixed
22 */
23 private $responseData;
24
25 /**
26 * put your comment there...
27 *
28 * @var mixed
29 */
30 private $servicesAPI;
31
32 /**
33 * put your comment there...
34 *
35 * @param mixed $extensionData
36 * @return CJTProUpdateCheck
37 */
38 public function __construct() {
39 # Get Services API instance
40 $this->servicesAPI =& CJTServicesClient::getInstance();
41 # Obtain module name from $this class name with CJT prefix removed
42 $this->moduleName = strtolower( substr( get_class( $this ), 3 ) );
43 }
44
45 /**
46 * put your comment there...
47 *
48 * @param mixed $name
49 */
50 protected function get($name) {
51 return isset( $this->responseData[ $name ] ) ? $this->responseData[ $name ] : null;
52 }
53
54 /**
55 * put your comment there...
56 *
57 */
58 public function getModuleName() {
59 return $this->moduleName;
60 }
61
62 /**
63 * put your comment there...
64 *
65 */
66 public function getResponseData() {
67 return $this->responseData;
68 }
69
70 /**
71 * put your comment there...
72 *
73 */
74 public function & getServicesAPI() {
75 return $this->servicesAPI;
76 }
77
78 /**
79 * put your comment there...
80 *
81 * @param mixed $json
82 */
83 protected function jsonDecode( $json ) {
84 return json_decode( $json, true );
85 }
86
87 /**
88 * put your comment there...
89 *
90 * @param mixed $method
91 * @param mixed $params
92 * @param mixed $postData
93 */
94 public function makeCall($method, $params = null, $postData = null) {
95 # Reset response object
96 $this->response = null;
97 $this->responseData = null;
98 # Dispatch and store response
99 $this->response = $this->getServicesAPI()->makeCall( $this->getModuleName(), $method, $params, $postData );
100 # Read response data
101 $this->responseData = wp_remote_retrieve_body( $this->response );
102 # Chain
103 return $this;
104 }
105
106 }
107