PluginProbe
CSS & JavaScript Toolbox / 9.2
CSS & JavaScript Toolbox v9.2
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 | framework/mvc/controller-ajax.inc.php +37 -37 11.79.2 View file →
@@ -1,90 +1,90 @@
1 1 <?php
2 2 /**
3 -*
3 +*
4 4 */
5 5
6 6 /**
7 -*
7 +*
8 8 */
9 9 abstract class CJTAjaxController extends CJTController {
10 -
10 +
11 11 /** */
12 12 const ACTION_PREFIX = 'wp_ajax_cjtoolbox_';
13 -
13 +
14 14 /**
15 15 * put your comment there...
16 - *
16 + *
17 17 * @var mixed
18 18 */
19 19 protected $methodName;
20 -
20 +
21 21 /**
22 22 * put your comment there...
23 - *
23 + *
24 24 * @var mixed
25 25 */
26 26 protected $actionsMap = array();
27 -
27 +
28 28 /**
29 29 * put your comment there...
30 - *
30 + *
31 31 * @var mixed
32 32 */
33 33 protected $defaultCapability = array('administrator');
34 -
34 +
35 35 /**
36 36 * put your comment there...
37 - *
37 + *
38 38 * @var mixed
39 39 */
40 40 protected $impersonated = false;
41 -
41 +
42 42 /**
43 43 * put your comment there...
44 - *
44 + *
45 45 * @var mixed
46 46 */
47 47 public $httpCode = '200 OK';
48 -
48 +
49 49 /**
50 50 * put your comment there...
51 - *
51 + *
52 52 * @var mixed
53 53 */
54 54 public $httpContentType = 'text/plain';
55 -
55 +
56 56 /**
57 57 * put your comment there...
58 - *
58 + *
59 59 * @var mixed
60 60 */
61 61 protected $onauthorize = array('parameters' => array('authorized'));
62 -
62 +
63 63 /**
64 64 * put your comment there...
65 - *
65 + *
66 66 * @var mixed
67 67 */
68 68 protected $onregisteraction = array('parameters' => array('callback', 'action'));
69 -
69 +
70 70 /**
71 71 * put your comment there...
72 - *
72 + *
73 73 * @var mixed
74 74 */
75 75 protected $onresponse = array('hookType' => CJTWordpressEvents::HOOK_ACTION);
76 -
76 +
77 77 /**
78 78 * put your comment there...
79 - *
79 + *
80 80 * @var mixed
81 81 */
82 82 public $response = false;
83 -
83 +
84 84 /**
85 85 * put your comment there...
86 - *
86 + *
87 87 */
88 88 public function _doAction() {
89 89 // Authorize request.
90 90 $authorized = $this->onauthorize(check_ajax_referer(self::NONCE_ACTION, 'security', false));
@@ -108,9 +108,9 @@
108 108 // Get method name from action name.
109 109 $method = ucfirst(str_replace('_', ' ', $method));
110 110 $method = str_replace(' ', '', $method);
111 111 // Lower case the first character.
112 - $method = strtolower($method[0]) . substr($method, 1);
112 + $method = strtolower($method{0}) . substr($method, 1);
113 113 // Cahe method name for child classes to use!
114 114 $this->methodName = $method;
115 115 // Relying on the trailer "Action" for security.
116 116 // Derivded class should not never use trailer "Action"
@@ -149,9 +149,9 @@
149 149 switch ($this->httpContentType) {
150 150 case 'text/plain':
151 151 echo json_encode($this->response);
152 152 break;
153 -
153 +
154 154 default :
155 155 echo $this->response;
156 156 }
157 157 die();
@@ -158,26 +158,26 @@
158 158 }
159 159
160 160 /**
161 161 * Display templates manager form.
162 - *
162 + *
163 163 */
164 - protected function displayAction() {
164 + protected function displayAction() {
165 165 // Return view.
166 166 $this->httpContentType = 'text/html';
167 167 $this->response = parent::displayAction();
168 168 }
169 -
169 +
170 170 /**
171 171 * Redirect the request to another controller.
172 - *
172 + *
173 173 * Why this method is created anyway is to allow
174 174 * deprecating old controllers and start to create new one
175 175 * a quiet manner!
176 - *
176 + *
177 177 * The idea is to create the new controller, adding new Action there
178 - * and redirect the call through current deprecated controller.
179 - *
178 + * and redirect the call throught current deprecated controller.
179 + *
180 180 * @param mixed $controller
181 181 */
182 182 protected function redirect($controller) {
183 183 // Initialize vars.
@@ -188,12 +188,12 @@
188 188 CJTController::getInstance($controller);
189 189 // Fire the action manually.
190 190 do_action($currentFilter);
191 191 }
192 -
192 +
193 193 /**
194 194 * put your comment there...
195 - *
195 + *
196 196 * @param mixed $action
197 197 * @param mixed $priority
198 198 * @param mixed $paramsCount
199 199 */
@@ -203,9 +203,9 @@
203 203 // Adding action!
204 204 add_action($action, $callback , $priority, $paramsCount);
205 205 return $this;
206 206 }
207 -
207 +
208 208 } // End class.
209 209
210 210 // Hookable!
211 211 CJTAjaxController::define('CJTAjaxController', array('hookType' => CJTWordpressEvents::HOOK_FILTER));