@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | |
52 | 52 | $this->sRequestedEvent = null; |
53 | 53 | |
54 | - if(isset($_GET['jxnevt'])) |
|
54 | + if (isset($_GET['jxnevt'])) |
|
55 | 55 | { |
56 | 56 | $this->sRequestedEvent = $_GET['jxnevt']; |
57 | 57 | } |
58 | - if(isset($_POST['jxnevt'])) |
|
58 | + if (isset($_POST['jxnevt'])) |
|
59 | 59 | { |
60 | 60 | $this->sRequestedEvent = $_POST['jxnevt']; |
61 | 61 | } |
@@ -80,19 +80,19 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function register($aArgs) |
82 | 82 | { |
83 | - if(count($aArgs) > 1) |
|
83 | + if (count($aArgs) > 1) |
|
84 | 84 | { |
85 | 85 | $sType = $aArgs[0]; |
86 | 86 | |
87 | - if($sType == Jaxon::BROWSER_EVENT) |
|
87 | + if ($sType == Jaxon::BROWSER_EVENT) |
|
88 | 88 | { |
89 | 89 | $sEvent = $aArgs[1]; |
90 | - if(!isset($this->aEvents[$sEvent])) |
|
90 | + if (!isset($this->aEvents[$sEvent])) |
|
91 | 91 | { |
92 | 92 | $xBrowserEvent = new \Jaxon\Support\BrowserEvent($sEvent); |
93 | - if(count($aArgs) > 2 && is_array($aArgs[2])) |
|
93 | + if (count($aArgs) > 2 && is_array($aArgs[2])) |
|
94 | 94 | { |
95 | - foreach($aArgs[2] as $sKey => $sValue) |
|
95 | + foreach ($aArgs[2] as $sKey => $sValue) |
|
96 | 96 | { |
97 | 97 | $xBrowserEvent->configure($sKey, $sValue); |
98 | 98 | } |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | return $xBrowserEvent->generateRequest(); |
102 | 102 | } |
103 | 103 | } |
104 | - elseif($sType == Jaxon::EVENT_HANDLER) |
|
104 | + elseif ($sType == Jaxon::EVENT_HANDLER) |
|
105 | 105 | { |
106 | 106 | $sEvent = $aArgs[1]; |
107 | - if(isset($this->aEvents[$sEvent]) && isset($aArgs[2])) |
|
107 | + if (isset($this->aEvents[$sEvent]) && isset($aArgs[2])) |
|
108 | 108 | { |
109 | 109 | $xUserFunction = $aArgs[2]; |
110 | - if(!($xUserFunction instanceof \Jaxon\Request\Support\UserFunction)) |
|
110 | + if (!($xUserFunction instanceof \Jaxon\Request\Support\UserFunction)) |
|
111 | 111 | { |
112 | 112 | $xUserFunction = new \Jaxon\Request\Support\UserFunction($xUserFunction); |
113 | 113 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | public function generateHash() |
130 | 130 | { |
131 | 131 | $sHash = ''; |
132 | - foreach($this->aEvents as $xEvent) |
|
132 | + foreach ($this->aEvents as $xEvent) |
|
133 | 133 | { |
134 | 134 | $sHash .= $xEvent->getName(); |
135 | 135 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | public function getScript() |
145 | 145 | { |
146 | 146 | $sCode = ''; |
147 | - foreach($this->aEvents as $xEvent) |
|
147 | + foreach ($this->aEvents as $xEvent) |
|
148 | 148 | { |
149 | 149 | $sCode .= $xEvent->getScript(); |
150 | 150 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | public function canProcessRequest() |
160 | 160 | { |
161 | 161 | // Check the validity of the event name |
162 | - if(($this->sRequestedEvent) && !$this->validateEvent($this->sRequestedEvent)) |
|
162 | + if (($this->sRequestedEvent) && !$this->validateEvent($this->sRequestedEvent)) |
|
163 | 163 | { |
164 | 164 | $this->sRequestedEvent = null; |
165 | 165 | } |
@@ -173,12 +173,12 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public function processRequest() |
175 | 175 | { |
176 | - if(!$this->canProcessRequest()) |
|
176 | + if (!$this->canProcessRequest()) |
|
177 | 177 | return false; |
178 | 178 | |
179 | 179 | $aArgs = $this->getRequestManager()->process(); |
180 | 180 | |
181 | - if(array_key_exists($this->sRequestedEvent, $this->aEvents)) |
|
181 | + if (array_key_exists($this->sRequestedEvent, $this->aEvents)) |
|
182 | 182 | { |
183 | 183 | $this->aEvents[$this->sRequestedEvent]->fire($aArgs); |
184 | 184 | return true; |
@@ -100,8 +100,7 @@ discard block |
||
100 | 100 | $this->aEvents[$sEvent] = $xBrowserEvent; |
101 | 101 | return $xBrowserEvent->generateRequest(); |
102 | 102 | } |
103 | - } |
|
104 | - elseif($sType == Jaxon::EVENT_HANDLER) |
|
103 | + } elseif($sType == Jaxon::EVENT_HANDLER) |
|
105 | 104 | { |
106 | 105 | $sEvent = $aArgs[1]; |
107 | 106 | if(isset($this->aEvents[$sEvent]) && isset($aArgs[2])) |
@@ -173,8 +172,9 @@ discard block |
||
173 | 172 | */ |
174 | 173 | public function processRequest() |
175 | 174 | { |
176 | - if(!$this->canProcessRequest()) |
|
177 | - return false; |
|
175 | + if(!$this->canProcessRequest()) { |
|
176 | + return false; |
|
177 | + } |
|
178 | 178 | |
179 | 179 | $aArgs = $this->getRequestManager()->process(); |
180 | 180 |
@@ -212,8 +212,9 @@ discard block |
||
212 | 212 | { |
213 | 213 | $sEvent = $xArgs; |
214 | 214 | $xUserFunction = $aArgs[2]; |
215 | - if(!is_a($xUserFunction, 'Request\\Support\\UserFunction')) |
|
216 | - $xUserFunction = new Request\Support\UserFunction($xUserFunction); |
|
215 | + if(!is_a($xUserFunction, 'Request\\Support\\UserFunction')) { |
|
216 | + $xUserFunction = new Request\Support\UserFunction($xUserFunction); |
|
217 | + } |
|
217 | 218 | $this->aProcessingEvents[$sEvent] = $xUserFunction; |
218 | 219 | } |
219 | 220 | /*else |
@@ -326,8 +327,7 @@ discard block |
||
326 | 327 | try |
327 | 328 | { |
328 | 329 | $mResult = $this->getPluginManager()->processRequest(); |
329 | - } |
|
330 | - catch(Exception $e) |
|
330 | + } catch(Exception $e) |
|
331 | 331 | { |
332 | 332 | // An exception was thrown while processing the request. |
333 | 333 | // The request missed the corresponding handler function, |
@@ -344,8 +344,7 @@ discard block |
||
344 | 344 | { |
345 | 345 | $sEvent = self::PROCESSING_EVENT_INVALID; |
346 | 346 | $aParams = array($e->getMessage()); |
347 | - } |
|
348 | - else |
|
347 | + } else |
|
349 | 348 | { |
350 | 349 | $sEvent = self::PROCESSING_EVENT_ERROR; |
351 | 350 | $aParams = array($e); |
@@ -355,8 +354,7 @@ discard block |
||
355 | 354 | { |
356 | 355 | // Call the processing event |
357 | 356 | $this->aProcessingEvents[$sEvent]->call($aParams); |
358 | - } |
|
359 | - else |
|
357 | + } else |
|
360 | 358 | { |
361 | 359 | // The exception is not to be processed here. |
362 | 360 | throw $e; |
@@ -141,15 +141,6 @@ |
||
141 | 141 | * - Jaxon::CALLABLE_OBJECT: an object who's methods are to be registered |
142 | 142 | * - Jaxon::BROWSER_EVENT: an event which will cause zero or more event handlers to be called |
143 | 143 | * - Jaxon::EVENT_HANDLER: register an event handler function. |
144 | - * @param mixed $sFunction | $objObject | $sEvent |
|
145 | - * When registering a function, this is the name of the function |
|
146 | - * When registering a callable object, this is the object being registered |
|
147 | - * When registering an event or event handler, this is the name of the event |
|
148 | - * @param mixed $sIncludeFile | $aCallOptions | $sEventHandler |
|
149 | - * When registering a function, this is the (optional) include file |
|
150 | - * When registering a callable object, this is an (optional) array |
|
151 | - * of call options for the functions being registered |
|
152 | - * When registering an event handler, this is the name of the function |
|
153 | 144 | * |
154 | 145 | * @return mixed |
155 | 146 | */ |
@@ -158,13 +158,13 @@ discard block |
||
158 | 158 | $aArgs = func_get_args(); |
159 | 159 | $nArgs = func_num_args(); |
160 | 160 | |
161 | - if(self::PROCESSING_EVENT == $sType) |
|
161 | + if (self::PROCESSING_EVENT == $sType) |
|
162 | 162 | { |
163 | - if($nArgs > 2) |
|
163 | + if ($nArgs > 2) |
|
164 | 164 | { |
165 | 165 | $sEvent = $xArgs; |
166 | 166 | $xUserFunction = $aArgs[2]; |
167 | - if(!is_a($xUserFunction, 'Request\\Support\\UserFunction')) |
|
167 | + if (!is_a($xUserFunction, 'Request\\Support\\UserFunction')) |
|
168 | 168 | $xUserFunction = new Request\Support\UserFunction($xUserFunction); |
169 | 169 | $this->aProcessingEvents[$sEvent] = $xUserFunction; |
170 | 170 | } |
@@ -236,16 +236,16 @@ discard block |
||
236 | 236 | */ |
237 | 237 | public function getScript($bIncludeJs = false, $bIncludeCss = false) |
238 | 238 | { |
239 | - if(!$this->getOption('core.request.uri')) |
|
239 | + if (!$this->getOption('core.request.uri')) |
|
240 | 240 | { |
241 | 241 | $this->setOption('core.request.uri', URI::detect()); |
242 | 242 | } |
243 | 243 | $sCode = ''; |
244 | - if(($bIncludeCss)) |
|
244 | + if (($bIncludeCss)) |
|
245 | 245 | { |
246 | 246 | $sCode .= $this->getPluginManager()->getCss() . "\n"; |
247 | 247 | } |
248 | - if(($bIncludeJs)) |
|
248 | + if (($bIncludeJs)) |
|
249 | 249 | { |
250 | 250 | $sCode .= $this->getPluginManager()->getJs() . "\n"; |
251 | 251 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | public function processRequest() |
317 | 317 | { |
318 | 318 | // Check to see if headers have already been sent out, in which case we can't do our job |
319 | - if(headers_sent($filename, $linenumber)) |
|
319 | + if (headers_sent($filename, $linenumber)) |
|
320 | 320 | { |
321 | 321 | echo $this->trans('errors.output.already-sent', array( |
322 | 322 | 'location' => $filename . ':' . $linenumber |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | } |
326 | 326 | |
327 | 327 | // Check if there is a plugin to process this request |
328 | - if(!$this->canProcessRequest()) |
|
328 | + if (!$this->canProcessRequest()) |
|
329 | 329 | { |
330 | 330 | return; |
331 | 331 | } |
@@ -334,18 +334,18 @@ discard block |
||
334 | 334 | $mResult = true; |
335 | 335 | |
336 | 336 | // Handle before processing event |
337 | - if(isset($this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE])) |
|
337 | + if (isset($this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE])) |
|
338 | 338 | { |
339 | 339 | $this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE]->call(array(&$bEndRequest)); |
340 | 340 | } |
341 | 341 | |
342 | - if(!$bEndRequest) |
|
342 | + if (!$bEndRequest) |
|
343 | 343 | { |
344 | 344 | try |
345 | 345 | { |
346 | 346 | $mResult = $this->getPluginManager()->processRequest(); |
347 | 347 | } |
348 | - catch(Exception $e) |
|
348 | + catch (Exception $e) |
|
349 | 349 | { |
350 | 350 | // An exception was thrown while processing the request. |
351 | 351 | // The request missed the corresponding handler function, |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | $xResponseManager->debug($e->getMessage()); |
359 | 359 | $mResult = false; |
360 | 360 | |
361 | - if($e instanceof \Jaxon\Exception\Error) |
|
361 | + if ($e instanceof \Jaxon\Exception\Error) |
|
362 | 362 | { |
363 | 363 | $sEvent = self::PROCESSING_EVENT_INVALID; |
364 | 364 | $aParams = array($e->getMessage()); |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $aParams = array($e); |
370 | 370 | } |
371 | 371 | |
372 | - if(isset($this->aProcessingEvents[$sEvent])) |
|
372 | + if (isset($this->aProcessingEvents[$sEvent])) |
|
373 | 373 | { |
374 | 374 | // Call the processing event |
375 | 375 | $this->aProcessingEvents[$sEvent]->call($aParams); |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | } |
383 | 383 | } |
384 | 384 | // Clean the processing buffer |
385 | - if(($this->getOption('core.process.clean'))) |
|
385 | + if (($this->getOption('core.process.clean'))) |
|
386 | 386 | { |
387 | 387 | $er = error_reporting(0); |
388 | 388 | while (ob_get_level() > 0) |
@@ -392,10 +392,10 @@ discard block |
||
392 | 392 | error_reporting($er); |
393 | 393 | } |
394 | 394 | |
395 | - if($mResult === true) |
|
395 | + if ($mResult === true) |
|
396 | 396 | { |
397 | 397 | // Handle after processing event |
398 | - if(isset($this->aProcessingEvents[self::PROCESSING_EVENT_AFTER])) |
|
398 | + if (isset($this->aProcessingEvents[self::PROCESSING_EVENT_AFTER])) |
|
399 | 399 | { |
400 | 400 | $bEndRequest = false; |
401 | 401 | $this->aProcessingEvents[self::PROCESSING_EVENT_AFTER]->call(array($bEndRequest)); |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | |
405 | 405 | $this->getResponseManager()->printDebug(); |
406 | 406 | |
407 | - if(($this->getOption('core.process.exit'))) |
|
407 | + if (($this->getOption('core.process.exit'))) |
|
408 | 408 | { |
409 | 409 | $this->getResponseManager()->sendOutput(); |
410 | 410 | exit(); |
@@ -25,14 +25,9 @@ |
||
25 | 25 | |
26 | 26 | namespace Jaxon; |
27 | 27 | |
28 | -use Jaxon\Plugin\Manager as PluginManager; |
|
29 | -use Jaxon\Request\Manager as RequestManager; |
|
30 | -use Jaxon\Response\Manager as ResponseManager; |
|
31 | - |
|
32 | 28 | use Jaxon\Utils\URI; |
33 | 29 | use Jaxon\DI\Container; |
34 | 30 | use Exception; |
35 | -use Closure; |
|
36 | 31 | |
37 | 32 | class Jaxon |
38 | 33 | { |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | // Verify the file extension |
130 | 130 | $xDefault = $this->xConfig->getOption('upload.default.types'); |
131 | 131 | $aAllowed = $this->xConfig->getOption('upload.files.' . $sName . '.types', $xDefault); |
132 | - if(is_array($aAllowed) && !in_array($aUploadedFile['type'], $aAllowed)) |
|
132 | + if (is_array($aAllowed) && !in_array($aUploadedFile['type'], $aAllowed)) |
|
133 | 133 | { |
134 | 134 | $this->sErrorMessage = $this->xTranslator->trans('errors.upload.type', $aUploadedFile); |
135 | 135 | return false; |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | // Verify the file extension |
138 | 138 | $xDefault = $this->xConfig->getOption('upload.default.extensions'); |
139 | 139 | $aAllowed = $this->xConfig->getOption('upload.files.' . $sName . '.extensions', $xDefault); |
140 | - if(is_array($aAllowed) && !in_array($aUploadedFile['extension'], $aAllowed)) |
|
140 | + if (is_array($aAllowed) && !in_array($aUploadedFile['extension'], $aAllowed)) |
|
141 | 141 | { |
142 | 142 | $this->sErrorMessage = $this->xTranslator->trans('errors.upload.extension', $aUploadedFile); |
143 | 143 | return false; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | // Verify the max size |
146 | 146 | $xDefault = $this->xConfig->getOption('upload.default.max-size', 0); |
147 | 147 | $iSize = $this->xConfig->getOption('upload.files.' . $sName . '.max-size', $xDefault); |
148 | - if($iSize > 0 && $aUploadedFile['size'] > $iSize) |
|
148 | + if ($iSize > 0 && $aUploadedFile['size'] > $iSize) |
|
149 | 149 | { |
150 | 150 | $this->sErrorMessage = $this->xTranslator->trans('errors.upload.max-size', $aUploadedFile); |
151 | 151 | return false; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | // Verify the min size |
154 | 154 | $xDefault = $this->xConfig->getOption('upload.default.min-size', 0); |
155 | 155 | $iSize = $this->xConfig->getOption('upload.files.' . $sName . '.min-size', $xDefault); |
156 | - if($iSize > 0 && $aUploadedFile['size'] < $iSize) |
|
156 | + if ($iSize > 0 && $aUploadedFile['size'] < $iSize) |
|
157 | 157 | { |
158 | 158 | $this->sErrorMessage = $this->xTranslator->trans('errors.upload.min-size', $aUploadedFile); |
159 | 159 | return false; |
@@ -121,7 +121,7 @@ |
||
121 | 121 | } |
122 | 122 | if(!array_key_exists($sLanguage, $this->aTranslations) || !array_key_exists($sText, $this->aTranslations[$sLanguage])) |
123 | 123 | { |
124 | - return $sText; |
|
124 | + return $sText; |
|
125 | 125 | } |
126 | 126 | $message = $this->aTranslations[$sLanguage][$sText]; |
127 | 127 | foreach($aPlaceHolders as $name => $value) |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | */ |
56 | 56 | private function _loadTranslations($sLanguage, $sPrefix, array $aTranslations) |
57 | 57 | { |
58 | - foreach($aTranslations as $sName => $xTranslation) |
|
58 | + foreach ($aTranslations as $sName => $xTranslation) |
|
59 | 59 | { |
60 | 60 | $sName = trim($sName); |
61 | 61 | $sName = ($sPrefix) ? $sPrefix . '.' . $sName : $sName; |
62 | - if(!is_array($xTranslation)) |
|
62 | + if (!is_array($xTranslation)) |
|
63 | 63 | { |
64 | 64 | // Save this translation |
65 | 65 | $this->aTranslations[$sLanguage][$sName] = $xTranslation; |
@@ -82,17 +82,17 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function loadTranslations($sFilePath, $sLanguage) |
84 | 84 | { |
85 | - if(!file_exists($sFilePath)) |
|
85 | + if (!file_exists($sFilePath)) |
|
86 | 86 | { |
87 | 87 | return; |
88 | 88 | } |
89 | 89 | $aTranslations = require($sFilePath); |
90 | - if(!is_array($aTranslations)) |
|
90 | + if (!is_array($aTranslations)) |
|
91 | 91 | { |
92 | 92 | return; |
93 | 93 | } |
94 | 94 | // Load the translations |
95 | - if(!array_key_exists($sLanguage, $this->aTranslations)) |
|
95 | + if (!array_key_exists($sLanguage, $this->aTranslations)) |
|
96 | 96 | { |
97 | 97 | $this->aTranslations[$sLanguage] = []; |
98 | 98 | } |
@@ -111,20 +111,20 @@ discard block |
||
111 | 111 | public function trans($sText, array $aPlaceHolders = array(), $sLanguage = null) |
112 | 112 | { |
113 | 113 | $sText = trim((string)$sText); |
114 | - if(!$sLanguage) |
|
114 | + if (!$sLanguage) |
|
115 | 115 | { |
116 | 116 | $sLanguage = $this->xConfig->getOption('language'); |
117 | 117 | } |
118 | - if(!$sLanguage) |
|
118 | + if (!$sLanguage) |
|
119 | 119 | { |
120 | 120 | $sLanguage = $this->sDefaultLocale; |
121 | 121 | } |
122 | - if(!array_key_exists($sLanguage, $this->aTranslations) || !array_key_exists($sText, $this->aTranslations[$sLanguage])) |
|
122 | + if (!array_key_exists($sLanguage, $this->aTranslations) || !array_key_exists($sText, $this->aTranslations[$sLanguage])) |
|
123 | 123 | { |
124 | 124 | return $sText; |
125 | 125 | } |
126 | 126 | $message = $this->aTranslations[$sLanguage][$sText]; |
127 | - foreach($aPlaceHolders as $name => $value) |
|
127 | + foreach ($aPlaceHolders as $name => $value) |
|
128 | 128 | { |
129 | 129 | $message = str_replace(':' . $name, $value, $message); |
130 | 130 | } |
@@ -63,8 +63,7 @@ |
||
63 | 63 | { |
64 | 64 | // Save this translation |
65 | 65 | $this->aTranslations[$sLanguage][$sName] = $xTranslation; |
66 | - } |
|
67 | - else |
|
66 | + } else |
|
68 | 67 | { |
69 | 68 | // Recursively read the translations in the array |
70 | 69 | $this->_loadTranslations($sLanguage, $sName, $xTranslation); |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * |
281 | 281 | * @param array $aArgs An array containing the event specification |
282 | 282 | * |
283 | - * @return \Jaxon\Request\Request |
|
283 | + * @return boolean |
|
284 | 284 | */ |
285 | 285 | public function register($aArgs) |
286 | 286 | { |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | /** |
343 | 343 | * Check uploaded files validity and move them to the user dir |
344 | 344 | * |
345 | - * @return boolean |
|
345 | + * @return string |
|
346 | 346 | */ |
347 | 347 | public function saveUploadedFiles() |
348 | 348 | { |
@@ -217,7 +217,7 @@ |
||
217 | 217 | $aFiles[$sVarName] = []; |
218 | 218 | foreach($aUserFiles as $aUserFile) |
219 | 219 | { |
220 | - $aFiles[$sVarName][] = $aUserFile->toTempData(); |
|
220 | + $aFiles[$sVarName][] = $aUserFile->toTempData(); |
|
221 | 221 | } |
222 | 222 | } |
223 | 223 | // Save upload data in a temp file |
@@ -49,11 +49,11 @@ discard block |
||
49 | 49 | { |
50 | 50 | $this->aUserFiles = []; |
51 | 51 | |
52 | - if(array_key_exists('jxnupl', $_POST)) |
|
52 | + if (array_key_exists('jxnupl', $_POST)) |
|
53 | 53 | { |
54 | 54 | $this->sTempFile = $_POST['jxnupl']; |
55 | 55 | } |
56 | - elseif(array_key_exists('jxnupl', $_GET)) |
|
56 | + elseif (array_key_exists('jxnupl', $_GET)) |
|
57 | 57 | { |
58 | 58 | $this->sTempFile = $_GET['jxnupl']; |
59 | 59 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | protected function filterFilename($sFilename, $sVarName) |
83 | 83 | { |
84 | - if(($this->fFileFilter)) |
|
84 | + if (($this->fFileFilter)) |
|
85 | 85 | { |
86 | 86 | $fFileFilter = $this->fFileFilter; |
87 | 87 | $sFilename = (string)$fFileFilter($sFilename, $sVarName); |
@@ -98,17 +98,17 @@ discard block |
||
98 | 98 | { |
99 | 99 | // Check validity of the uploaded files |
100 | 100 | $aTempFiles = []; |
101 | - foreach($_FILES as $sVarName => $aFile) |
|
101 | + foreach ($_FILES as $sVarName => $aFile) |
|
102 | 102 | { |
103 | - if(is_array($aFile['name'])) |
|
103 | + if (is_array($aFile['name'])) |
|
104 | 104 | { |
105 | - for($i = 0; $i < count($aFile['name']); $i++) |
|
105 | + for ($i = 0; $i < count($aFile['name']); $i++) |
|
106 | 106 | { |
107 | - if(!$aFile['name'][$i]) |
|
107 | + if (!$aFile['name'][$i]) |
|
108 | 108 | { |
109 | 109 | continue; |
110 | 110 | } |
111 | - if(!array_key_exists($sVarName, $aTempFiles)) |
|
111 | + if (!array_key_exists($sVarName, $aTempFiles)) |
|
112 | 112 | { |
113 | 113 | $aTempFiles[$sVarName] = []; |
114 | 114 | } |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | } |
129 | 129 | else |
130 | 130 | { |
131 | - if(!$aFile['name']) |
|
131 | + if (!$aFile['name']) |
|
132 | 132 | { |
133 | 133 | continue; |
134 | 134 | } |
135 | - if(!array_key_exists($sVarName, $aTempFiles)) |
|
135 | + if (!array_key_exists($sVarName, $aTempFiles)) |
|
136 | 136 | { |
137 | 137 | $aTempFiles[$sVarName] = []; |
138 | 138 | } |
@@ -155,24 +155,24 @@ discard block |
||
155 | 155 | $sDefaultUploadDir = $this->getOption('upload.default.dir'); |
156 | 156 | |
157 | 157 | // Check uploaded files validity |
158 | - foreach($aTempFiles as $sVarName => $aFiles) |
|
158 | + foreach ($aTempFiles as $sVarName => $aFiles) |
|
159 | 159 | { |
160 | - foreach($aFiles as $aFile) |
|
160 | + foreach ($aFiles as $aFile) |
|
161 | 161 | { |
162 | 162 | // Verify upload result |
163 | - if($aFile['error'] != 0) |
|
163 | + if ($aFile['error'] != 0) |
|
164 | 164 | { |
165 | 165 | throw new \Jaxon\Exception\Error($this->trans('errors.upload.failed', $aFile)); |
166 | 166 | } |
167 | 167 | // Verify file validity (format, size) |
168 | - if(!$this->validateUploadedFile($sVarName, $aFile)) |
|
168 | + if (!$this->validateUploadedFile($sVarName, $aFile)) |
|
169 | 169 | { |
170 | 170 | throw new \Jaxon\Exception\Error($this->getValidatorMessage()); |
171 | 171 | } |
172 | 172 | // Verify that the upload dir exists and is writable |
173 | 173 | $sUploadDir = $this->getOption('upload.files.' . $sVarName . '.dir', $sDefaultUploadDir); |
174 | 174 | $sUploadDir = rtrim(trim($sUploadDir), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
175 | - if(!is_writable($sUploadDir)) |
|
175 | + if (!is_writable($sUploadDir)) |
|
176 | 176 | { |
177 | 177 | throw new \Jaxon\Exception\Error($this->trans('errors.upload.access')); |
178 | 178 | } |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | // Copy the uploaded files from the temp dir to the user dir |
183 | - foreach($aTempFiles as $sVarName => $aTempFiles) |
|
183 | + foreach ($aTempFiles as $sVarName => $aTempFiles) |
|
184 | 184 | { |
185 | 185 | $this->aUserFiles[$sVarName] = []; |
186 | - foreach($aTempFiles as $aFile) |
|
186 | + foreach ($aTempFiles as $aFile) |
|
187 | 187 | { |
188 | 188 | // Set the user file data |
189 | 189 | $sUploadDir = $this->getOption('upload.files.' . $sVarName . '.dir', $sDefaultUploadDir); |
@@ -206,16 +206,16 @@ discard block |
||
206 | 206 | // Default upload dir |
207 | 207 | $sUploadDir = $this->getOption('upload.default.dir'); |
208 | 208 | $sUploadDir = rtrim(trim($sUploadDir), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
209 | - if(!is_writable($sUploadDir)) |
|
209 | + if (!is_writable($sUploadDir)) |
|
210 | 210 | { |
211 | 211 | throw new \Jaxon\Exception\Error($this->trans('errors.upload.access')); |
212 | 212 | } |
213 | 213 | // Convert uploaded file to an array |
214 | 214 | $aFiles = []; |
215 | - foreach($this->aUserFiles as $sVarName => $aUserFiles) |
|
215 | + foreach ($this->aUserFiles as $sVarName => $aUserFiles) |
|
216 | 216 | { |
217 | 217 | $aFiles[$sVarName] = []; |
218 | - foreach($aUserFiles as $aUserFile) |
|
218 | + foreach ($aUserFiles as $aUserFile) |
|
219 | 219 | { |
220 | 220 | $aFiles[$sVarName][] = $aUserFile->toTempData(); |
221 | 221 | } |
@@ -238,16 +238,16 @@ discard block |
||
238 | 238 | $sUploadDir = $this->getOption('upload.default.dir'); |
239 | 239 | $sUploadDir = rtrim(trim($sUploadDir), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
240 | 240 | $sUploadDir .= 'tmp' . DIRECTORY_SEPARATOR; |
241 | - if(!is_readable($sUploadDir . $this->sTempFile . '.json')) |
|
241 | + if (!is_readable($sUploadDir . $this->sTempFile . '.json')) |
|
242 | 242 | { |
243 | 243 | throw new \Jaxon\Exception\Error($this->trans('errors.upload.access')); |
244 | 244 | } |
245 | 245 | $aFiles = file_get_contents($sUploadDir . $this->sTempFile . '.json'); |
246 | 246 | $aFiles = json_decode($aFiles, true); |
247 | - foreach($aFiles as $sVarName => $aUserFiles) |
|
247 | + foreach ($aFiles as $sVarName => $aUserFiles) |
|
248 | 248 | { |
249 | 249 | $this->aUserFiles[$sVarName] = []; |
250 | - foreach($aUserFiles as $aUserFile) |
|
250 | + foreach ($aUserFiles as $aUserFile) |
|
251 | 251 | { |
252 | 252 | $this->aUserFiles[$sVarName][] = UploadedFile::fromTempData($aUserFile); |
253 | 253 | } |
@@ -324,15 +324,15 @@ discard block |
||
324 | 324 | */ |
325 | 325 | public function processRequest() |
326 | 326 | { |
327 | - if(!$this->canProcessRequest()) |
|
327 | + if (!$this->canProcessRequest()) |
|
328 | 328 | { |
329 | 329 | return false; |
330 | 330 | } |
331 | - if(count($_FILES) > 0) |
|
331 | + if (count($_FILES) > 0) |
|
332 | 332 | { |
333 | 333 | $this->readFromHttpData(); |
334 | 334 | } |
335 | - elseif(($this->sTempFile)) |
|
335 | + elseif (($this->sTempFile)) |
|
336 | 336 | { |
337 | 337 | $this->readFromTempFile(); |
338 | 338 | } |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | public function saveUploadedFiles() |
348 | 348 | { |
349 | 349 | // Process uploaded files |
350 | - if(!$this->processRequest()) |
|
350 | + if (!$this->processRequest()) |
|
351 | 351 | { |
352 | 352 | return ''; |
353 | 353 | } |
@@ -52,8 +52,7 @@ discard block |
||
52 | 52 | if(array_key_exists('jxnupl', $_POST)) |
53 | 53 | { |
54 | 54 | $this->sTempFile = $_POST['jxnupl']; |
55 | - } |
|
56 | - elseif(array_key_exists('jxnupl', $_GET)) |
|
55 | + } elseif(array_key_exists('jxnupl', $_GET)) |
|
57 | 56 | { |
58 | 57 | $this->sTempFile = $_GET['jxnupl']; |
59 | 58 | } |
@@ -125,8 +124,7 @@ discard block |
||
125 | 124 | 'extension' => pathinfo($aFile['name'][$i], PATHINFO_EXTENSION), |
126 | 125 | ]; |
127 | 126 | } |
128 | - } |
|
129 | - else |
|
127 | + } else |
|
130 | 128 | { |
131 | 129 | if(!$aFile['name']) |
132 | 130 | { |
@@ -331,8 +329,7 @@ discard block |
||
331 | 329 | if(count($_FILES) > 0) |
332 | 330 | { |
333 | 331 | $this->readFromHttpData(); |
334 | - } |
|
335 | - elseif(($this->sTempFile)) |
|
332 | + } elseif(($this->sTempFile)) |
|
336 | 333 | { |
337 | 334 | $this->readFromTempFile(); |
338 | 335 | } |
@@ -15,7 +15,6 @@ |
||
15 | 15 | use Jaxon\Jaxon; |
16 | 16 | use Jaxon\Plugin\Request as RequestPlugin; |
17 | 17 | use Jaxon\Request\Support\UploadedFile; |
18 | - |
|
19 | 18 | use Closure; |
20 | 19 | |
21 | 20 | class FileUpload extends RequestPlugin |
@@ -14,18 +14,18 @@ |
||
14 | 14 | jaxon.config.defaultMode = "<?php echo $this->sDefaultMode ?>"; |
15 | 15 | jaxon.config.defaultMethod = "<?php echo $this->sDefaultMethod ?>"; |
16 | 16 | jaxon.config.responseType = "<?php echo $this->sResponseType ?>"; |
17 | -<?php if($this->nResponseQueueSize > 0): ?> |
|
17 | +<?php if ($this->nResponseQueueSize > 0): ?> |
|
18 | 18 | jaxon.config.responseQueueSize = <?php echo $this->nResponseQueueSize ?>; |
19 | 19 | <?php endif ?> |
20 | -<?php if(($this->bDebug)): ?> |
|
21 | -<?php if(($this->sDebugOutputID)): ?> |
|
20 | +<?php if (($this->bDebug)): ?> |
|
21 | +<?php if (($this->sDebugOutputID)): ?> |
|
22 | 22 | jaxon.debug.outputID = "<?php echo $this->sDebugOutputID ?>"; |
23 | 23 | <?php endif ?> |
24 | -<?php if(($this->bVerboseDebug)): ?> |
|
24 | +<?php if (($this->bVerboseDebug)): ?> |
|
25 | 25 | jaxon.debug.verbose.active = true; |
26 | 26 | <?php endif ?> |
27 | 27 | <?php endif ?> |
28 | -<?php if(($this->sCsrfMetaName)): ?> |
|
28 | +<?php if (($this->sCsrfMetaName)): ?> |
|
29 | 29 | metaTags = document.getElementsByTagName('meta'); |
30 | 30 | for(i = 0; i < metaTags.length; i++) |
31 | 31 | { |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * @param array $aAttributes Associative array of attributes that will describe the command |
160 | 160 | * @param mixed $mData The data to be associated with this command |
161 | 161 | * |
162 | - * @return \Jaxon\Plugin\Response |
|
162 | + * @return Response |
|
163 | 163 | */ |
164 | 164 | public function addCommand($aAttributes, $mData) |
165 | 165 | { |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | /** |
201 | 201 | * Clear all the commands already added to the response |
202 | 202 | * |
203 | - * @return \Jaxon\Plugin\Response |
|
203 | + * @return Response |
|
204 | 204 | */ |
205 | 205 | public function clearCommands() |
206 | 206 | { |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | * |
215 | 215 | * @param \Jaxon\Plugin\Plugin $xPlugin The plugin object |
216 | 216 | * @param array $aAttributes The attributes for this response command |
217 | - * @param mixed $mData The data to be sent with this command |
|
217 | + * @param string $mData The data to be sent with this command |
|
218 | 218 | * |
219 | - * @return \Jaxon\Plugin\Response |
|
219 | + * @return Response |
|
220 | 220 | */ |
221 | 221 | public function addPluginCommand($xPlugin, $aAttributes, $mData) |
222 | 222 | { |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * @param integer $iCmdNumber The number of commands to skip upon cancel |
278 | 278 | * @param string $sMessage The message to display to the user |
279 | 279 | * |
280 | - * @return \Jaxon\Plugin\Response |
|
280 | + * @return Response |
|
281 | 281 | */ |
282 | 282 | public function confirmCommands($iCmdNumber, $sMessage) |
283 | 283 | { |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @param string $sAttribute The attribute to be assigned |
298 | 298 | * @param string $sData The value to be assigned to the attribute |
299 | 299 | * |
300 | - * @return \Jaxon\Plugin\Response |
|
300 | + * @return Response |
|
301 | 301 | */ |
302 | 302 | public function assign($sTarget, $sAttribute, $sData) |
303 | 303 | { |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @param string $sTarget The id of the html element on the browser |
320 | 320 | * @param string $sData The value to be assigned to the attribute |
321 | 321 | * |
322 | - * @return \Jaxon\Plugin\Response |
|
322 | + * @return Response |
|
323 | 323 | */ |
324 | 324 | public function html($sTarget, $sData) |
325 | 325 | { |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | * @param string $sAttribute The name of the attribute to be appended to |
334 | 334 | * @param string $sData The data to be appended to the attribute |
335 | 335 | * |
336 | - * @return \Jaxon\Plugin\Response |
|
336 | + * @return Response |
|
337 | 337 | */ |
338 | 338 | public function append($sTarget, $sAttribute, $sData) |
339 | 339 | { |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | * @param string $sAttribute The name of the attribute to be prepended to |
355 | 355 | * @param string $sData The value to be prepended to the attribute |
356 | 356 | * |
357 | - * @return \Jaxon\Plugin\Response |
|
357 | + * @return Response |
|
358 | 358 | */ |
359 | 359 | public function prepend($sTarget, $sAttribute, $sData) |
360 | 360 | { |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | * @param string $sSearch The needle to search for |
377 | 377 | * @param string $sData The data to use in place of the needle |
378 | 378 | * |
379 | - * @return \Jaxon\Plugin\Response |
|
379 | + * @return Response |
|
380 | 380 | */ |
381 | 381 | public function replace($sTarget, $sAttribute, $sSearch, $sData) |
382 | 382 | { |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | * @param string $sTarget The id of the element to be updated. |
400 | 400 | * @param string $sAttribute The attribute to be cleared |
401 | 401 | * |
402 | - * @return \Jaxon\Plugin\Response |
|
402 | + * @return Response |
|
403 | 403 | */ |
404 | 404 | public function clear($sTarget, $sAttribute) |
405 | 405 | { |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | * @param string $sAttribute The attribute to be updated |
416 | 416 | * @param string $sData The value to assign |
417 | 417 | * |
418 | - * @return \Jaxon\Plugin\Response |
|
418 | + * @return Response |
|
419 | 419 | */ |
420 | 420 | public function contextAssign($sAttribute, $sData) |
421 | 421 | { |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | * @param string $sAttribute The attribute to be appended to |
438 | 438 | * @param string $sData The value to append |
439 | 439 | * |
440 | - * @return \Jaxon\Plugin\Response |
|
440 | + * @return Response |
|
441 | 441 | */ |
442 | 442 | public function contextAppend($sAttribute, $sData) |
443 | 443 | { |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | * @param string $sAttribute The attribute to be updated |
460 | 460 | * @param string $sData The value to be prepended |
461 | 461 | * |
462 | - * @return \Jaxon\Plugin\Response |
|
462 | + * @return Response |
|
463 | 463 | */ |
464 | 464 | public function contextPrepend($sAttribute, $sData) |
465 | 465 | { |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | * |
481 | 481 | * @param string $sAttribute The attribute to be cleared |
482 | 482 | * |
483 | - * @return \Jaxon\Plugin\Response |
|
483 | + * @return Response |
|
484 | 484 | */ |
485 | 485 | public function contextClear($sAttribute) |
486 | 486 | { |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | * |
493 | 493 | * @param string $sMessage The message to be displayed |
494 | 494 | * |
495 | - * @return \Jaxon\Plugin\Response |
|
495 | + * @return Response |
|
496 | 496 | */ |
497 | 497 | public function alert($sMessage) |
498 | 498 | { |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | * |
510 | 510 | * @param string $sMessage The message to be displayed |
511 | 511 | * |
512 | - * @return \Jaxon\Plugin\Response |
|
512 | + * @return Response |
|
513 | 513 | */ |
514 | 514 | public function debug($sMessage) |
515 | 515 | { |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | * @param string $sURL The relative or fully qualified URL |
528 | 528 | * @param integer $iDelay Number of seconds to delay before the redirect occurs |
529 | 529 | * |
530 | - * @return \Jaxon\Plugin\Response |
|
530 | + * @return Response |
|
531 | 531 | */ |
532 | 532 | public function redirect($sURL, $iDelay=0) |
533 | 533 | { |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | * |
581 | 581 | * @param string $sJS The script to execute |
582 | 582 | * |
583 | - * @return \Jaxon\Plugin\Response |
|
583 | + * @return Response |
|
584 | 584 | */ |
585 | 585 | public function script($sJS) |
586 | 586 | { |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | * |
598 | 598 | * @param string $sFunc The name of the function to call |
599 | 599 | * |
600 | - * @return \Jaxon\Plugin\Response |
|
600 | + * @return Response |
|
601 | 601 | */ |
602 | 602 | public function call($sFunc) |
603 | 603 | { |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | * |
618 | 618 | * @param string $sTarget The id of the element to be removed |
619 | 619 | * |
620 | - * @return \Jaxon\Plugin\Response |
|
620 | + * @return Response |
|
621 | 621 | */ |
622 | 622 | public function remove($sTarget) |
623 | 623 | { |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | * @param string $sTag The tag name to be used for the new element |
638 | 638 | * @param string $sId The id to assign to the new element |
639 | 639 | * |
640 | - * @return \Jaxon\Plugin\Response |
|
640 | + * @return Response |
|
641 | 641 | */ |
642 | 642 | public function create($sParent, $sTag, $sId) |
643 | 643 | { |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | * @param string $sTag The tag name to be used for the new element |
659 | 659 | * @param string $sId The id to assign to the new element |
660 | 660 | * |
661 | - * @return \Jaxon\Plugin\Response |
|
661 | + * @return Response |
|
662 | 662 | */ |
663 | 663 | public function insert($sBefore, $sTag, $sId) |
664 | 664 | { |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | * @param string $sTag The tag name to be used for the new element |
680 | 680 | * @param string $sId The id to assign to the new element |
681 | 681 | * |
682 | - * @return \Jaxon\Plugin\Response |
|
682 | + * @return Response |
|
683 | 683 | */ |
684 | 684 | public function insertAfter($sAfter, $sTag, $sId) |
685 | 685 | { |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | * @param string $sName The name of the new input element |
702 | 702 | * @param string $sId The id of the new element |
703 | 703 | * |
704 | - * @return \Jaxon\Plugin\Response |
|
704 | + * @return Response |
|
705 | 705 | */ |
706 | 706 | public function createInput($sParent, $sType, $sName, $sId) |
707 | 707 | { |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | * @param string $sName The name of the new input element |
725 | 725 | * @param string $sId The id of the new element |
726 | 726 | * |
727 | - * @return \Jaxon\Plugin\Response |
|
727 | + * @return Response |
|
728 | 728 | */ |
729 | 729 | public function insertInput($sBefore, $sType, $sName, $sId) |
730 | 730 | { |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | * @param string $sName The name of the new input element |
748 | 748 | * @param string $sId The id of the new element |
749 | 749 | * |
750 | - * @return \Jaxon\Plugin\Response |
|
750 | + * @return Response |
|
751 | 751 | */ |
752 | 752 | public function insertInputAfter($sAfter, $sType, $sName, $sId) |
753 | 753 | { |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | * @param string $sEvent The name of the event |
770 | 770 | * @param string $sScript The javascript to execute when the event is fired |
771 | 771 | * |
772 | - * @return \Jaxon\Plugin\Response |
|
772 | + * @return Response |
|
773 | 773 | */ |
774 | 774 | public function setEvent($sTarget, $sEvent, $sScript) |
775 | 775 | { |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | * @param string $sTarget The id of the element that contains the event |
790 | 790 | * @param string $sScript The javascript to execute when the event is fired |
791 | 791 | * |
792 | - * @return \Jaxon\Plugin\Response |
|
792 | + * @return Response |
|
793 | 793 | */ |
794 | 794 | public function onClick($sTarget, $sScript) |
795 | 795 | { |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | * @param string $sEvent The name of the event |
806 | 806 | * @param string $sHandler The name of the javascript function to call when the event is fired |
807 | 807 | * |
808 | - * @return \Jaxon\Plugin\Response |
|
808 | + * @return Response |
|
809 | 809 | */ |
810 | 810 | public function addHandler($sTarget, $sEvent, $sHandler) |
811 | 811 | { |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | * @param string $sEvent The name of the event |
827 | 827 | * @param string $sHandler The name of the javascript function called when the event is fired |
828 | 828 | * |
829 | - * @return \Jaxon\Plugin\Response |
|
829 | + * @return Response |
|
830 | 830 | */ |
831 | 831 | public function removeHandler($sTarget, $sEvent, $sHandler) |
832 | 832 | { |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | * @param string $sArgs Comma separated list of parameter names |
848 | 848 | * @param string $sScript The javascript code that will become the body of the function |
849 | 849 | * |
850 | - * @return \Jaxon\Plugin\Response |
|
850 | + * @return Response |
|
851 | 851 | */ |
852 | 852 | public function setFunction($sFunction, $sArgs, $sScript) |
853 | 853 | { |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | * @param string $sReturnValueVar The name of the variable that will retain the return value |
875 | 875 | * from the call to the original function |
876 | 876 | * |
877 | - * @return \Jaxon\Plugin\Response |
|
877 | + * @return Response |
|
878 | 878 | */ |
879 | 879 | public function wrapFunction($sFunction, $sArgs, $aScripts, $sReturnValueVar) |
880 | 880 | { |
@@ -895,7 +895,7 @@ discard block |
||
895 | 895 | * @param string $sFileName The relative or fully qualified URI of the javascript file |
896 | 896 | * @param string $sType Determines the script type. Defaults to 'text/javascript' |
897 | 897 | * |
898 | - * @return \Jaxon\Plugin\Response |
|
898 | + * @return Response |
|
899 | 899 | */ |
900 | 900 | public function includeScript($sFileName, $sType = null, $sId = null) |
901 | 901 | { |
@@ -916,7 +916,7 @@ discard block |
||
916 | 916 | * @param string $sFileName The relative or fully qualified URI of the javascript file |
917 | 917 | * @param string $sType Determines the script type. Defaults to 'text/javascript' |
918 | 918 | * |
919 | - * @return \Jaxon\Plugin\Response |
|
919 | + * @return Response |
|
920 | 920 | */ |
921 | 921 | public function includeScriptOnce($sFileName, $sType = null, $sId = null) |
922 | 922 | { |
@@ -939,7 +939,7 @@ discard block |
||
939 | 939 | * @param string $sFileName The relative or fully qualified URI of the javascript file |
940 | 940 | * @param string $sUnload Name of a javascript function to call prior to unlaoding the file |
941 | 941 | * |
942 | - * @return \Jaxon\Plugin\Response |
|
942 | + * @return Response |
|
943 | 943 | */ |
944 | 944 | public function removeScript($sFileName, $sUnload = '') |
945 | 945 | { |
@@ -960,7 +960,7 @@ discard block |
||
960 | 960 | * @param string $sFileName The relative or fully qualified URI of the css file |
961 | 961 | * @param string $sMedia The media type of the CSS file. Defaults to 'screen' |
962 | 962 | * |
963 | - * @return \Jaxon\Plugin\Response |
|
963 | + * @return Response |
|
964 | 964 | */ |
965 | 965 | public function includeCSS($sFileName, $sMedia = null) |
966 | 966 | { |
@@ -979,7 +979,7 @@ discard block |
||
979 | 979 | * |
980 | 980 | * @param string $sFileName The relative or fully qualified URI of the css file |
981 | 981 | * |
982 | - * @return \Jaxon\Plugin\Response |
|
982 | + * @return Response |
|
983 | 983 | */ |
984 | 984 | public function removeCSS($sFileName, $sMedia = null) |
985 | 985 | { |
@@ -1004,7 +1004,7 @@ discard block |
||
1004 | 1004 | * @param integer $iTimeout The number of 1/10ths of a second to pause before timing out |
1005 | 1005 | * and continuing with the execution of the response commands |
1006 | 1006 | * |
1007 | - * @return \Jaxon\Plugin\Response |
|
1007 | + * @return Response |
|
1008 | 1008 | */ |
1009 | 1009 | public function waitForCSS($iTimeout = 600) |
1010 | 1010 | { |
@@ -1029,7 +1029,7 @@ discard block |
||
1029 | 1029 | * @param integer $tenths The number of 1/10ths of a second to wait before timing out |
1030 | 1030 | * and continuing with the execution of the response commands. |
1031 | 1031 | * |
1032 | - * @return \Jaxon\Plugin\Response |
|
1032 | + * @return Response |
|
1033 | 1033 | */ |
1034 | 1034 | public function waitFor($script, $tenths) |
1035 | 1035 | { |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | * |
1051 | 1051 | * @param integer $tenths The number of 1/10ths of a second to sleep |
1052 | 1052 | * |
1053 | - * @return \Jaxon\Plugin\Response |
|
1053 | + * @return Response |
|
1054 | 1054 | */ |
1055 | 1055 | public function sleep($tenths) |
1056 | 1056 | { |
@@ -1079,7 +1079,7 @@ discard block |
||
1079 | 1079 | * @param string $variable The DOM element name (id or class) |
1080 | 1080 | * @param string $tag The HTML tag of the new DOM element |
1081 | 1081 | * |
1082 | - * @return \Jaxon\Plugin\Response |
|
1082 | + * @return Response |
|
1083 | 1083 | */ |
1084 | 1084 | public function domCreateElement($variable, $tag) |
1085 | 1085 | { |
@@ -1099,7 +1099,7 @@ discard block |
||
1099 | 1099 | * @param string $key The name of the attribute |
1100 | 1100 | * @param string $value The value of the attribute |
1101 | 1101 | * |
1102 | - * @return \Jaxon\Plugin\Response |
|
1102 | + * @return Response |
|
1103 | 1103 | */ |
1104 | 1104 | public function domSetAttribute($variable, $key, $value) |
1105 | 1105 | { |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | * @param string $skip The ?? |
1121 | 1121 | * @param string $remove The ?? |
1122 | 1122 | * |
1123 | - * @return \Jaxon\Plugin\Response |
|
1123 | + * @return Response |
|
1124 | 1124 | */ |
1125 | 1125 | public function domRemoveChildren($parent, $skip = null, $remove = null) |
1126 | 1126 | { |
@@ -1141,7 +1141,7 @@ discard block |
||
1141 | 1141 | * @param string $parent The DOM parent element |
1142 | 1142 | * @param string $variable The DOM element name (id or class) |
1143 | 1143 | * |
1144 | - * @return \Jaxon\Plugin\Response |
|
1144 | + * @return Response |
|
1145 | 1145 | */ |
1146 | 1146 | public function domAppendChild($parent, $variable) |
1147 | 1147 | { |
@@ -1160,7 +1160,7 @@ discard block |
||
1160 | 1160 | * @param string $target The DOM target element |
1161 | 1161 | * @param string $variable The DOM element name (id or class) |
1162 | 1162 | * |
1163 | - * @return \Jaxon\Plugin\Response |
|
1163 | + * @return Response |
|
1164 | 1164 | */ |
1165 | 1165 | public function domInsertBefore($target, $variable) |
1166 | 1166 | { |
@@ -1179,7 +1179,7 @@ discard block |
||
1179 | 1179 | * @param string $target The DOM target element |
1180 | 1180 | * @param string $variable The DOM element name (id or class) |
1181 | 1181 | * |
1182 | - * @return \Jaxon\Plugin\Response |
|
1182 | + * @return Response |
|
1183 | 1183 | */ |
1184 | 1184 | public function domInsertAfter($target, $variable) |
1185 | 1185 | { |
@@ -1198,7 +1198,7 @@ discard block |
||
1198 | 1198 | * @param string $parent The DOM parent element |
1199 | 1199 | * @param string $text The HTML text to append |
1200 | 1200 | * |
1201 | - * @return \Jaxon\Plugin\Response |
|
1201 | + * @return Response |
|
1202 | 1202 | */ |
1203 | 1203 | public function domAppendText($parent, $text) |
1204 | 1204 | { |
@@ -1239,7 +1239,7 @@ discard block |
||
1239 | 1239 | * |
1240 | 1240 | * @param mixed $value Any value |
1241 | 1241 | * |
1242 | - * @return \Jaxon\Plugin\Response |
|
1242 | + * @return Response |
|
1243 | 1243 | */ |
1244 | 1244 | public function setReturnValue($value) |
1245 | 1245 | { |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | public function plugin($sName) |
102 | 102 | { |
103 | 103 | $xPlugin = $this->getPluginManager()->getResponsePlugin($sName); |
104 | - if(!$xPlugin) |
|
104 | + if (!$xPlugin) |
|
105 | 105 | { |
106 | 106 | return null; |
107 | 107 | } |
@@ -164,23 +164,23 @@ discard block |
||
164 | 164 | public function addCommand($aAttributes, $mData) |
165 | 165 | { |
166 | 166 | /* merge commands if possible */ |
167 | - if(in_array($aAttributes['cmd'], array('js', 'ap'))) |
|
167 | + if (in_array($aAttributes['cmd'], array('js', 'ap'))) |
|
168 | 168 | { |
169 | - if(($aLastCommand = array_pop($this->aCommands))) |
|
169 | + if (($aLastCommand = array_pop($this->aCommands))) |
|
170 | 170 | { |
171 | - if($aLastCommand['cmd'] == $aAttributes['cmd']) |
|
171 | + if ($aLastCommand['cmd'] == $aAttributes['cmd']) |
|
172 | 172 | { |
173 | - if($this->getOption('core.response.merge.js') && |
|
173 | + if ($this->getOption('core.response.merge.js') && |
|
174 | 174 | $aLastCommand['cmd'] == 'js') |
175 | 175 | { |
176 | - $mData = $aLastCommand['data'].'; '.$mData; |
|
176 | + $mData = $aLastCommand['data'] . '; ' . $mData; |
|
177 | 177 | } |
178 | - elseif($this->getOption('core.response.merge.ap') && |
|
178 | + elseif ($this->getOption('core.response.merge.ap') && |
|
179 | 179 | $aLastCommand['cmd'] == 'ap' && |
180 | 180 | $aLastCommand['id'] == $aAttributes['id'] && |
181 | 181 | $aLastCommand['prop'] == $aAttributes['prop']) |
182 | 182 | { |
183 | - $mData = $aLastCommand['data'].' '.$mData; |
|
183 | + $mData = $aLastCommand['data'] . ' ' . $mData; |
|
184 | 184 | } |
185 | 185 | else |
186 | 186 | { |
@@ -237,11 +237,11 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public function appendResponse($mCommands, $bBefore = false) |
239 | 239 | { |
240 | - if($mCommands instanceof Response) |
|
240 | + if ($mCommands instanceof Response) |
|
241 | 241 | { |
242 | 242 | $this->returnValue = $mCommands->returnValue; |
243 | 243 | |
244 | - if($bBefore) |
|
244 | + if ($bBefore) |
|
245 | 245 | { |
246 | 246 | $this->aCommands = array_merge($mCommands->aCommands, $this->aCommands); |
247 | 247 | } |
@@ -250,9 +250,9 @@ discard block |
||
250 | 250 | $this->aCommands = array_merge($this->aCommands, $mCommands->aCommands); |
251 | 251 | } |
252 | 252 | } |
253 | - elseif(is_array($mCommands)) |
|
253 | + elseif (is_array($mCommands)) |
|
254 | 254 | { |
255 | - if($bBefore) |
|
255 | + if ($bBefore) |
|
256 | 256 | { |
257 | 257 | $this->aCommands = array_merge($mCommands, $this->aCommands); |
258 | 258 | } |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | } |
264 | 264 | else |
265 | 265 | { |
266 | - if(!empty($mCommands)) |
|
266 | + if (!empty($mCommands)) |
|
267 | 267 | { |
268 | 268 | throw new \Jaxon\Exception\Error($this->trans('errors.response.data.invalid')); |
269 | 269 | } |
@@ -531,33 +531,33 @@ discard block |
||
531 | 531 | * |
532 | 532 | * @return \Jaxon\Plugin\Response |
533 | 533 | */ |
534 | - public function redirect($sURL, $iDelay=0) |
|
534 | + public function redirect($sURL, $iDelay = 0) |
|
535 | 535 | { |
536 | 536 | // we need to parse the query part so that the values are rawurlencode()'ed |
537 | 537 | // can't just use parse_url() cos we could be dealing with a relative URL which |
538 | 538 | // parse_url() can't deal with. |
539 | 539 | $queryStart = strpos($sURL, '?', strrpos($sURL, '/')); |
540 | - if($queryStart !== false) |
|
540 | + if ($queryStart !== false) |
|
541 | 541 | { |
542 | 542 | $queryStart++; |
543 | 543 | $queryEnd = strpos($sURL, '#', $queryStart); |
544 | - if($queryEnd === false) |
|
544 | + if ($queryEnd === false) |
|
545 | 545 | $queryEnd = strlen($sURL); |
546 | - $queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart); |
|
546 | + $queryPart = substr($sURL, $queryStart, $queryEnd - $queryStart); |
|
547 | 547 | parse_str($queryPart, $queryParts); |
548 | 548 | $newQueryPart = ""; |
549 | - if($queryParts) |
|
549 | + if ($queryParts) |
|
550 | 550 | { |
551 | 551 | $first = true; |
552 | - foreach($queryParts as $key => $value) |
|
552 | + foreach ($queryParts as $key => $value) |
|
553 | 553 | { |
554 | - if($first) |
|
554 | + if ($first) |
|
555 | 555 | $first = false; |
556 | 556 | else |
557 | 557 | $newQueryPart .= '&'; |
558 | - $newQueryPart .= rawurlencode($key).'='.rawurlencode($value); |
|
558 | + $newQueryPart .= rawurlencode($key) . '=' . rawurlencode($value); |
|
559 | 559 | } |
560 | - } elseif($_SERVER['QUERY_STRING']) { |
|
560 | + } elseif ($_SERVER['QUERY_STRING']) { |
|
561 | 561 | //couldn't break up the query, but there's one there |
562 | 562 | //possibly "http://url/page.html?query1234" type of query? |
563 | 563 | //just encode it and hope it works |
@@ -565,8 +565,8 @@ discard block |
||
565 | 565 | } |
566 | 566 | $sURL = str_replace($queryPart, $newQueryPart, $sURL); |
567 | 567 | } |
568 | - if($iDelay) |
|
569 | - $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');'); |
|
568 | + if ($iDelay) |
|
569 | + $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay * 1000) . ');'); |
|
570 | 570 | else |
571 | 571 | $this->script('window.location = "' . $sURL . '";'); |
572 | 572 | return $this; |
@@ -903,10 +903,10 @@ discard block |
||
903 | 903 | { |
904 | 904 | $command = array('cmd' => 'in'); |
905 | 905 | |
906 | - if(($sType)) |
|
906 | + if (($sType)) |
|
907 | 907 | $command['type'] = trim((string)$sType, " \t"); |
908 | 908 | |
909 | - if(($sId)) |
|
909 | + if (($sId)) |
|
910 | 910 | $command['elm_id'] = trim((string)$sId, " \t"); |
911 | 911 | |
912 | 912 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
@@ -924,10 +924,10 @@ discard block |
||
924 | 924 | { |
925 | 925 | $command = array('cmd' => 'ino'); |
926 | 926 | |
927 | - if(($sType)) |
|
927 | + if (($sType)) |
|
928 | 928 | $command['type'] = trim((string)$sType, " \t"); |
929 | 929 | |
930 | - if(($sId)) |
|
930 | + if (($sId)) |
|
931 | 931 | $command['elm_id'] = trim((string)$sId, " \t"); |
932 | 932 | |
933 | 933 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
@@ -968,7 +968,7 @@ discard block |
||
968 | 968 | { |
969 | 969 | $command = array('cmd' => 'css'); |
970 | 970 | |
971 | - if(($sMedia)) |
|
971 | + if (($sMedia)) |
|
972 | 972 | $command['media'] = trim((string)$sMedia, " \t"); |
973 | 973 | |
974 | 974 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
@@ -987,7 +987,7 @@ discard block |
||
987 | 987 | { |
988 | 988 | $command = array('cmd' => 'rcss'); |
989 | 989 | |
990 | - if(($sMedia)) |
|
990 | + if (($sMedia)) |
|
991 | 991 | $command['media'] = trim((string)$sMedia, " \t"); |
992 | 992 | |
993 | 993 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
@@ -1128,10 +1128,10 @@ discard block |
||
1128 | 1128 | { |
1129 | 1129 | $command = array('cmd' => 'DRC'); |
1130 | 1130 | |
1131 | - if(($skip)) |
|
1131 | + if (($skip)) |
|
1132 | 1132 | $command['skip'] = $skip; |
1133 | 1133 | |
1134 | - if(($remove)) |
|
1134 | + if (($remove)) |
|
1135 | 1135 | $command['remove'] = $remove; |
1136 | 1136 | |
1137 | 1137 | return $this->addCommand($command, $parent); |
@@ -1257,7 +1257,7 @@ discard block |
||
1257 | 1257 | public function sendHeaders() |
1258 | 1258 | { |
1259 | 1259 | $xRequestManager = $this->getRequestManager(); |
1260 | - if($xRequestManager->getRequestMethod() == Jaxon::METHOD_GET) |
|
1260 | + if ($xRequestManager->getRequestMethod() == Jaxon::METHOD_GET) |
|
1261 | 1261 | { |
1262 | 1262 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
1263 | 1263 | header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
@@ -1267,7 +1267,7 @@ discard block |
||
1267 | 1267 | |
1268 | 1268 | $sCharacterSet = ''; |
1269 | 1269 | $sCharacterEncoding = trim($this->getOption('core.encoding')); |
1270 | - if(($sCharacterEncoding) && strlen($sCharacterEncoding) > 0) |
|
1270 | + if (($sCharacterEncoding) && strlen($sCharacterEncoding) > 0) |
|
1271 | 1271 | { |
1272 | 1272 | $sCharacterSet = '; charset="' . trim($sCharacterEncoding) . '"'; |
1273 | 1273 | } |
@@ -1284,13 +1284,13 @@ discard block |
||
1284 | 1284 | { |
1285 | 1285 | $response = array(); |
1286 | 1286 | |
1287 | - if(($this->returnValue)) |
|
1287 | + if (($this->returnValue)) |
|
1288 | 1288 | { |
1289 | 1289 | $response['jxnrv'] = $this->returnValue; |
1290 | 1290 | } |
1291 | 1291 | $response['jxnobj'] = array(); |
1292 | 1292 | |
1293 | - foreach($this->aCommands as $xCommand) |
|
1293 | + foreach ($this->aCommands as $xCommand) |
|
1294 | 1294 | { |
1295 | 1295 | $response['jxnobj'][] = $xCommand; |
1296 | 1296 | } |
@@ -174,20 +174,17 @@ discard block |
||
174 | 174 | $aLastCommand['cmd'] == 'js') |
175 | 175 | { |
176 | 176 | $mData = $aLastCommand['data'].'; '.$mData; |
177 | - } |
|
178 | - elseif($this->getOption('core.response.merge.ap') && |
|
177 | + } elseif($this->getOption('core.response.merge.ap') && |
|
179 | 178 | $aLastCommand['cmd'] == 'ap' && |
180 | 179 | $aLastCommand['id'] == $aAttributes['id'] && |
181 | 180 | $aLastCommand['prop'] == $aAttributes['prop']) |
182 | 181 | { |
183 | 182 | $mData = $aLastCommand['data'].' '.$mData; |
184 | - } |
|
185 | - else |
|
183 | + } else |
|
186 | 184 | { |
187 | 185 | $this->aCommands[] = $aLastCommand; |
188 | 186 | } |
189 | - } |
|
190 | - else |
|
187 | + } else |
|
191 | 188 | { |
192 | 189 | $this->aCommands[] = $aLastCommand; |
193 | 190 | } |
@@ -244,24 +241,20 @@ discard block |
||
244 | 241 | if($bBefore) |
245 | 242 | { |
246 | 243 | $this->aCommands = array_merge($mCommands->aCommands, $this->aCommands); |
247 | - } |
|
248 | - else |
|
244 | + } else |
|
249 | 245 | { |
250 | 246 | $this->aCommands = array_merge($this->aCommands, $mCommands->aCommands); |
251 | 247 | } |
252 | - } |
|
253 | - elseif(is_array($mCommands)) |
|
248 | + } elseif(is_array($mCommands)) |
|
254 | 249 | { |
255 | 250 | if($bBefore) |
256 | 251 | { |
257 | 252 | $this->aCommands = array_merge($mCommands, $this->aCommands); |
258 | - } |
|
259 | - else |
|
253 | + } else |
|
260 | 254 | { |
261 | 255 | $this->aCommands = array_merge($this->aCommands, $mCommands); |
262 | 256 | } |
263 | - } |
|
264 | - else |
|
257 | + } else |
|
265 | 258 | { |
266 | 259 | if(!empty($mCommands)) |
267 | 260 | { |
@@ -541,8 +534,9 @@ discard block |
||
541 | 534 | { |
542 | 535 | $queryStart++; |
543 | 536 | $queryEnd = strpos($sURL, '#', $queryStart); |
544 | - if($queryEnd === false) |
|
545 | - $queryEnd = strlen($sURL); |
|
537 | + if($queryEnd === false) { |
|
538 | + $queryEnd = strlen($sURL); |
|
539 | + } |
|
546 | 540 | $queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart); |
547 | 541 | parse_str($queryPart, $queryParts); |
548 | 542 | $newQueryPart = ""; |
@@ -551,10 +545,11 @@ discard block |
||
551 | 545 | $first = true; |
552 | 546 | foreach($queryParts as $key => $value) |
553 | 547 | { |
554 | - if($first) |
|
555 | - $first = false; |
|
556 | - else |
|
557 | - $newQueryPart .= '&'; |
|
548 | + if($first) { |
|
549 | + $first = false; |
|
550 | + } else { |
|
551 | + $newQueryPart .= '&'; |
|
552 | + } |
|
558 | 553 | $newQueryPart .= rawurlencode($key).'='.rawurlencode($value); |
559 | 554 | } |
560 | 555 | } elseif($_SERVER['QUERY_STRING']) { |
@@ -565,10 +560,11 @@ discard block |
||
565 | 560 | } |
566 | 561 | $sURL = str_replace($queryPart, $newQueryPart, $sURL); |
567 | 562 | } |
568 | - if($iDelay) |
|
569 | - $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');'); |
|
570 | - else |
|
571 | - $this->script('window.location = "' . $sURL . '";'); |
|
563 | + if($iDelay) { |
|
564 | + $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');'); |
|
565 | + } else { |
|
566 | + $this->script('window.location = "' . $sURL . '";'); |
|
567 | + } |
|
572 | 568 | return $this; |
573 | 569 | } |
574 | 570 | |
@@ -903,11 +899,13 @@ discard block |
||
903 | 899 | { |
904 | 900 | $command = array('cmd' => 'in'); |
905 | 901 | |
906 | - if(($sType)) |
|
907 | - $command['type'] = trim((string)$sType, " \t"); |
|
902 | + if(($sType)) { |
|
903 | + $command['type'] = trim((string)$sType, " \t"); |
|
904 | + } |
|
908 | 905 | |
909 | - if(($sId)) |
|
910 | - $command['elm_id'] = trim((string)$sId, " \t"); |
|
906 | + if(($sId)) { |
|
907 | + $command['elm_id'] = trim((string)$sId, " \t"); |
|
908 | + } |
|
911 | 909 | |
912 | 910 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
913 | 911 | } |
@@ -924,11 +922,13 @@ discard block |
||
924 | 922 | { |
925 | 923 | $command = array('cmd' => 'ino'); |
926 | 924 | |
927 | - if(($sType)) |
|
928 | - $command['type'] = trim((string)$sType, " \t"); |
|
925 | + if(($sType)) { |
|
926 | + $command['type'] = trim((string)$sType, " \t"); |
|
927 | + } |
|
929 | 928 | |
930 | - if(($sId)) |
|
931 | - $command['elm_id'] = trim((string)$sId, " \t"); |
|
929 | + if(($sId)) { |
|
930 | + $command['elm_id'] = trim((string)$sId, " \t"); |
|
931 | + } |
|
932 | 932 | |
933 | 933 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
934 | 934 | } |
@@ -968,8 +968,9 @@ discard block |
||
968 | 968 | { |
969 | 969 | $command = array('cmd' => 'css'); |
970 | 970 | |
971 | - if(($sMedia)) |
|
972 | - $command['media'] = trim((string)$sMedia, " \t"); |
|
971 | + if(($sMedia)) { |
|
972 | + $command['media'] = trim((string)$sMedia, " \t"); |
|
973 | + } |
|
973 | 974 | |
974 | 975 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
975 | 976 | } |
@@ -987,8 +988,9 @@ discard block |
||
987 | 988 | { |
988 | 989 | $command = array('cmd' => 'rcss'); |
989 | 990 | |
990 | - if(($sMedia)) |
|
991 | - $command['media'] = trim((string)$sMedia, " \t"); |
|
991 | + if(($sMedia)) { |
|
992 | + $command['media'] = trim((string)$sMedia, " \t"); |
|
993 | + } |
|
992 | 994 | |
993 | 995 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
994 | 996 | } |
@@ -1128,11 +1130,13 @@ discard block |
||
1128 | 1130 | { |
1129 | 1131 | $command = array('cmd' => 'DRC'); |
1130 | 1132 | |
1131 | - if(($skip)) |
|
1132 | - $command['skip'] = $skip; |
|
1133 | + if(($skip)) { |
|
1134 | + $command['skip'] = $skip; |
|
1135 | + } |
|
1133 | 1136 | |
1134 | - if(($remove)) |
|
1135 | - $command['remove'] = $remove; |
|
1137 | + if(($remove)) { |
|
1138 | + $command['remove'] = $remove; |
|
1139 | + } |
|
1136 | 1140 | |
1137 | 1141 | return $this->addCommand($command, $parent); |
1138 | 1142 | } |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | $sPrefix = trim((string)$sPrefix); |
51 | 51 | $nDepth = intval($nDepth); |
52 | 52 | // Check the max depth |
53 | - if($nDepth < 0 || $nDepth > 9) |
|
53 | + if ($nDepth < 0 || $nDepth > 9) |
|
54 | 54 | { |
55 | 55 | throw new \Jaxon\Exception\Config\Data(jaxon_trans('config.errors.data.depth', |
56 | 56 | array('key' => $sPrefix, 'depth' => $nDepth))); |
57 | 57 | } |
58 | - foreach($aOptions as $sName => $xOption) |
|
58 | + foreach ($aOptions as $sName => $xOption) |
|
59 | 59 | { |
60 | - if(is_int($sName)) |
|
60 | + if (is_int($sName)) |
|
61 | 61 | { |
62 | 62 | continue; |
63 | 63 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | // Save the value of this option |
68 | 68 | $this->aOptions[$sFullName] = $xOption; |
69 | 69 | // Save the values of its sub-options |
70 | - if(is_array($xOption)) |
|
70 | + if (is_array($xOption)) |
|
71 | 71 | { |
72 | 72 | // Recursively read the options in the array |
73 | 73 | $this->_setOptions($xOption, $sFullName, $nDepth + 1); |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | $aKeys = explode('.', (string)$sKeys); |
90 | 90 | foreach ($aKeys as $sKey) |
91 | 91 | { |
92 | - if(($sKey)) |
|
92 | + if (($sKey)) |
|
93 | 93 | { |
94 | - if(!array_key_exists($sKey, $aOptions) || !is_array($aOptions[$sKey])) |
|
94 | + if (!array_key_exists($sKey, $aOptions) || !is_array($aOptions[$sKey])) |
|
95 | 95 | { |
96 | 96 | return; |
97 | 97 | } |
@@ -139,13 +139,12 @@ discard block |
||
139 | 139 | $sPrefix = rtrim($sPrefix, '.') . '.'; |
140 | 140 | $sPrefixLen = strlen($sPrefix); |
141 | 141 | $aOptions = array(); |
142 | - foreach($this->aOptions as $sName => $xValue) |
|
142 | + foreach ($this->aOptions as $sName => $xValue) |
|
143 | 143 | { |
144 | - if(substr($sName, 0, $sPrefixLen) == $sPrefix) |
|
144 | + if (substr($sName, 0, $sPrefixLen) == $sPrefix) |
|
145 | 145 | { |
146 | 146 | $iNextDotPos = strpos($sName, '.', $sPrefixLen); |
147 | - $sOptionName = $iNextDotPos === false ? substr($sName, $sPrefixLen) : |
|
148 | - substr($sName, $sPrefixLen, $iNextDotPos - $sPrefixLen); |
|
147 | + $sOptionName = $iNextDotPos === false ? substr($sName, $sPrefixLen) : substr($sName, $sPrefixLen, $iNextDotPos - $sPrefixLen); |
|
149 | 148 | $aOptions[$sOptionName] = $sPrefix . $sOptionName; |
150 | 149 | } |
151 | 150 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @param string $sLibKey The key of the library options in the file |
70 | 70 | * @param string|null $sAppKey The key of the application options in the file |
71 | 71 | * |
72 | - * @return array |
|
72 | + * @return null|\Jaxon\Utils\Config\Config |
|
73 | 73 | */ |
74 | 74 | public function readPhpConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
75 | 75 | { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param string $sLibKey The key of the library options in the file |
84 | 84 | * @param string|null $sAppKey The key of the application options in the file |
85 | 85 | * |
86 | - * @return array |
|
86 | + * @return null|\Jaxon\Utils\Config\Config |
|
87 | 87 | */ |
88 | 88 | public function readYamlConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
89 | 89 | { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @param string $sLibKey The key of the library options in the file |
98 | 98 | * @param string|null $sAppKey The key of the application options in the file |
99 | 99 | * |
100 | - * @return array |
|
100 | + * @return \Jaxon\Utils\Config\Config|null |
|
101 | 101 | */ |
102 | 102 | public function readJsonConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
103 | 103 | { |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @param string $sLibKey The key of the library options in the file |
112 | 112 | * @param string|null $sAppKey The key of the application options in the file |
113 | 113 | * |
114 | - * @return array |
|
114 | + * @return null|\Jaxon\Utils\Config\Config |
|
115 | 115 | */ |
116 | 116 | public function readConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
117 | 117 | { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | 'core.prefix.event' => 'jaxon_event_', |
44 | 44 | // 'core.request.uri' => '', |
45 | 45 | 'core.request.mode' => 'asynchronous', |
46 | - 'core.request.method' => 'POST', // W3C: Method is case sensitive |
|
46 | + 'core.request.method' => 'POST', // W3C: Method is case sensitive |
|
47 | 47 | 'core.response.merge.ap' => true, |
48 | 48 | 'core.response.merge.js' => true, |
49 | 49 | 'core.debug.on' => false, |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | public function readConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
119 | 119 | { |
120 | 120 | $sExt = pathinfo($sConfigFile, PATHINFO_EXTENSION); |
121 | - switch($sExt) |
|
121 | + switch ($sExt) |
|
122 | 122 | { |
123 | 123 | case 'php': |
124 | 124 | return $this->readPhpConfigFile($sConfigFile, $sLibKey, $sAppKey); |