PluginProbe
CSS & JavaScript Toolbox / 8.2
CSS & JavaScript Toolbox v8.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.inc.php +67 -67 11.48.2 View file →
@@ -11,43 +11,43 @@
11 11 /**
12 12 * CJT controller base class.
13 13 */
14 14 abstract class CJTController extends CJTHookableClass {
15 -
15 +
16 16 /** */
17 17 const NONCE_ACTION = 'cjtoolbox';
18 -
18 +
19 19 /**
20 20 * put your comment there...
21 - *
21 + *
22 22 * @var mixed
23 23 */
24 24 protected $action;
25 -
25 +
26 26 /**
27 27 * put your comment there...
28 - *
28 + *
29 29 * @var mixed
30 30 */
31 31 protected $controllerInfo = null;
32 -
32 +
33 33 /**
34 34 * put your comment there...
35 - *
35 + *
36 36 * @var mixed
37 37 */
38 38 protected $defaultAction = 'index';
39 -
39 +
40 40 /**
41 41 * put your comment there...
42 - *
42 + *
43 43 * @var mixed
44 44 */
45 45 protected $request;
46 -
46 +
47 47 /**
48 48 * put your comment there...
49 - *
49 + *
50 50 * @var mixed
51 51 */
52 52 protected $model = null;
53 53
@@ -52,51 +52,51 @@
52 52 protected $model = null;
53 53
54 54 /**
55 55 * put your comment there...
56 - *
56 + *
57 57 * @var mixed
58 58 */
59 59 protected $oncallback = array('parameters' => array('callback', 'action', 'args'));
60 -
60 +
61 61 /**
62 62 * put your comment there...
63 - *
63 + *
64 64 * @var mixed
65 65 */
66 66 protected $ongetactionname = array('parameters' => array('action'));
67 -
67 +
68 68 /**
69 69 * put your comment there...
70 - *
70 + *
71 71 * @var mixed
72 72 */
73 73 protected static $ongetclassname = array('parameters' => array('class', 'name', 'type'));
74 -
74 +
75 75 /**
76 76 * put your comment there...
77 - *
77 + *
78 78 * @var mixed
79 79 */
80 80 protected $ongetviewname = array('parameters' => array('view'));
81 -
81 +
82 82 /**
83 83 * put your comment there...
84 - *
84 + *
85 85 * @var mixed
86 86 */
87 87 protected static $onloadcontroller = array('parameters' => array('file', 'name'));
88 -
88 +
89 89 /**
90 90 * put your comment there...
91 - *
91 + *
92 92 * @var mixed
93 93 */
94 94 protected $view = null;
95 -
95 +
96 96 /**
97 97 * put your comment there...
98 - *
98 + *
99 99 * @param mixed $hasView
100 100 * @param mixed $request
101 101 * @param mixed $overrideControllerPath
102 102 * @param mixed $overrideContollerPrefix
@@ -101,11 +101,11 @@
101 101 * @param mixed $overrideControllerPath
102 102 * @param mixed $overrideContollerPrefix
103 103 * @return CJTController
104 104 */
105 - public function __construct($hasView = null,
106 - $request = null,
107 - $overrideControllerPath = null,
105 + public function __construct($hasView = null,
106 + $request = null,
107 + $overrideControllerPath = null,
108 108 $overrideContollerPrefix = null) {
109 109 // Initialize hookable!
110 110 parent::__construct();
111 111 // Read request parameters.
@@ -115,10 +115,10 @@
115 115 // E_ALL complain!
116 116 if (!isset($this->controllerInfo['model_file'])) {
117 117 $this->controllerInfo['model_file'] = null;
118 118 }
119 - $this->model = CJTModel::create($this->controllerInfo['model'],
120 - $this->request,
119 + $this->model = CJTModel::create($this->controllerInfo['model'],
120 + $this->request,
121 121 $this->controllerInfo['model_file'],
122 122 dirname($overrideControllerPath),
123 123 $overrideContollerPrefix);
124 124 }
@@ -128,10 +128,10 @@
128 128 $view = $this->ongetviewname(isset($this->request['view']) ? $this->request['view'] :
129 129 (isset($this->controllerInfo['view']) ? $this->controllerInfo['view'] : null)
130 130 );
131 131 if ($view) {
132 - $this->view = self::getView($view,
133 - null,
132 + $this->view = self::getView($view,
133 + null,
134 134 dirname($overrideControllerPath),
135 135 $overrideContollerPrefix)
136 136 // Push data into view.
137 137 ->setModel($this->model)
@@ -138,17 +138,17 @@
138 138 ->setRequest($this->request);
139 139 }
140 140 }
141 141 }
142 -
142 +
143 143 /**
144 144 * put your comment there...
145 - *
145 + *
146 146 */
147 147 public function _doAction() {
148 148 // Force use of internal action untless its empty
149 149 // then look for submitted action or get the default!
150 - $action = $this->action ? $this->action :
150 + $action = $this->action ? $this->action :
151 151 (isset($_GET['action']) ? $_GET['action'] : $this->defaultAction);
152 152 // filter action name!
153 153 $action = $this->ongetactionname($action);
154 154 if ($action) {
@@ -158,12 +158,12 @@
158 158 // Callback!
159 159 call_user_func($callback);
160 160 }
161 161 }
162 -
162 +
163 163 /**
164 164 * put your comment there...
165 - *
165 + *
166 166 * @param mixed $name
167 167 * @param mixed $hasView
168 168 * @param mixed $request
169 169 * @param mixed $overrideControllersPath
@@ -168,11 +168,11 @@
168 168 * @param mixed $request
169 169 * @param mixed $overrideControllersPath
170 170 * @param mixed $overrideControllersPrefix
171 171 */
172 - public static function create($name,
173 - $hasView = null,
174 - $request = null,
172 + public static function create($name,
173 + $hasView = null,
174 + $request = null,
175 175 $overrideControllersPath = null,
176 176 $overrideControllersPrefix = null) {
177 177 // Import controller file.
178 178 $pathToControllers = $overrideControllersPath ? $overrideControllersPath : CJTOOLBOX_CONTROLLERS_PATH;
@@ -182,12 +182,12 @@
182 182 $class = self::getClassName($name, 'Controller', $overrideControllersPrefix);
183 183 // Instantiate controller class.
184 184 return new $class($hasView, $request, $overrideControllersPath, $overrideControllersPrefix);
185 185 }
186 -
186 +
187 187 /**
188 188 * put your comment there...
189 - *
189 + *
190 190 * @deprecated Use cssJSToolbox::createSecurityToken
191 191 */
192 192 public function createSecurityToken() {
193 193 return wp_create_nonce(self::NONCE_ACTION);
@@ -194,9 +194,9 @@
194 194 }
195 195
196 196 /**
197 197 * put your comment there...
198 - *
198 + *
199 199 */
200 200 protected function displayAction() {
201 201 // Get view layout!
202 202 $layout = isset($this->request['layout']) ? $this->request['layout'] : 'default';
@@ -207,9 +207,9 @@
207 207 }
208 208
209 209 /**
210 210 * put your comment there...
211 - *
211 + *
212 212 * @param mixed $name
213 213 * @param mixed $hasView
214 214 * @param mixed $request
215 215 * @param mixed $overrideControllersPath
@@ -214,22 +214,22 @@
214 214 * @param mixed $request
215 215 * @param mixed $overrideControllersPath
216 216 */
217 217 public static function getInstance($name,
218 - $hasView = null,
219 - $request = null,
218 + $hasView = null,
219 + $request = null,
220 220 $overrideControllersPath = null,
221 221 $overrideControllersPrefix = null) {
222 222 return self::create($name, $hasView, $request, $overrideControllersPath, $overrideControllersPrefix);
223 223 }
224 -
224 +
225 225 /**
226 226 * Use CJTModel::create instead.
227 - *
227 + *
228 228 * @deprecated No longer used.
229 229 */
230 - public static function getModel($name,
231 - $params = array(),
230 + public static function getModel($name,
231 + $params = array(),
232 232 $file = null,
233 233 $overrideModelsPath = null,
234 234 $overrideModelsPrefix = null) {
235 235 $model = null;
@@ -247,9 +247,9 @@
247 247 }
248 248 $model = new $modelClass($params);
249 249 return $model;
250 250 }
251 -
251 +
252 252 /**
253 253 * @deprecated No longer used.
254 254 */
255 255 public static function getClassName($name, $type, $prefix = null) {
@@ -266,27 +266,27 @@
266 266 // Filter.
267 267 $className = self::trigger('CJTController.getclassname', "{$prefix}{$sanitizedName}", $name, $type);
268 268 return $className;
269 269 }
270 -
270 +
271 271 /**
272 272 * put your comment there...
273 - *
273 + *
274 274 * @param mixed $name
275 275 */
276 276 public function getRequestParameter($name) {
277 - return isset($this->request[$name]) ? $this->request[$name] : null;
277 + return isset($this->request[$name]) ? $this->request[$name] : null;
278 278 }
279 -
279 +
280 280 /**
281 - *
281 + *
282 282 * Use CJTView:create instrad.
283 - *
283 + *
284 284 * @deprecated
285 285 */
286 - public static function getView($path,
287 - $params = null,
288 - $overrideViewsPath = null,
286 + public static function getView($path,
287 + $params = null,
288 + $overrideViewsPath = null,
289 289 $overrideViewsPrefix = null) {
290 290 $view = null;
291 291 // Import view file.
292 292 $viewInfo = self::getViewInfo($path, $overrideViewsPath, $overrideViewsPrefix);
@@ -296,16 +296,16 @@
296 296 $viewClass = self::getClassName($name, 'view', $overrideViewsPrefix);
297 297 $view = new $viewClass($viewInfo, $params);
298 298 return $view;
299 299 }
300 -
300 +
301 301 /**
302 302 * put your comment there...
303 - *
303 + *
304 304 */
305 305 public static function getViewInfo($path, $overrideViewsPath = null, $overrideViewsPrefix = null) {
306 306 // Plugin views Url
307 - $viewsUrl = $overrideViewsPath ?
307 + $viewsUrl = $overrideViewsPath ?
308 308 WP_PLUGIN_URL . '/' . basename(dirname($overrideViewsPath)) :
309 309 CJTOOLBOX_VIEWS_URL;
310 310 // Path to views dir.
311 311 $pathToViews = $overrideViewsPath ? ($overrideViewsPath . DIRECTORY_SEPARATOR . 'views') : CJTOOLBOX_VIEWS_PATH;
@@ -321,12 +321,12 @@
321 321 'viewFile' => "{$pathToViews}/{$path}/view.php",
322 322 );
323 323 return $viewInfo;
324 324 }
325 -
325 +
326 326 /**
327 327 * put your comment there...
328 - *
328 + *
329 329 * @param mixed $action
330 330 */
331 331 public function setAction($action) {
332 332 $this->action = $action;
@@ -331,12 +331,12 @@
331 331 public function setAction($action) {
332 332 $this->action = $action;
333 333 return $this;
334 334 }
335 -
335 +
336 336 /**
337 337 * put your comment there...
338 - *
338 + *
339 339 * @param mixed $name
340 340 * @param mixed $value
341 341 */
342 342 public function setRequestParameter($name, $value) {
@@ -342,9 +342,9 @@
342 342 public function setRequestParameter($name, $value) {
343 343 $this->request[$name] = $value;
344 344 return $this;
345 345 }
346 -
346 +
347 347 } // End class.
348 348
349 349 // Hookable!
350 350 CJTController::define('CJTController', array('hookType' => CJTWordpressEvents::HOOK_FILTER));