@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function hasPageNumber() |
| 72 | 72 | { |
| 73 | - foreach($this->aParameters as $xParameter) |
|
| 73 | + foreach ($this->aParameters as $xParameter) |
|
| 74 | 74 | { |
| 75 | - if($xParameter->getType() == Jaxon::PAGE_NUMBER) |
|
| 75 | + if ($xParameter->getType() == Jaxon::PAGE_NUMBER) |
|
| 76 | 76 | { |
| 77 | 77 | return true; |
| 78 | 78 | } |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | public function setPageNumber($nPageNumber) |
| 91 | 91 | { |
| 92 | 92 | // Set the value of the Jaxon::PAGE_NUMBER parameter |
| 93 | - foreach($this->aParameters as $xParameter) |
|
| 93 | + foreach ($this->aParameters as $xParameter) |
|
| 94 | 94 | { |
| 95 | - if($xParameter->getType() == Jaxon::PAGE_NUMBER) |
|
| 95 | + if ($xParameter->getType() == Jaxon::PAGE_NUMBER) |
|
| 96 | 96 | { |
| 97 | 97 | $xParameter->setValue(intval($nPageNumber)); |
| 98 | 98 | break; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | { |
| 113 | 113 | $this->sCondition = '__confirm__'; |
| 114 | 114 | $this->aMessageArgs = func_get_args(); |
| 115 | - array_walk($this->aMessageArgs, function (&$xParameter) { |
|
| 115 | + array_walk($this->aMessageArgs, function(&$xParameter) { |
|
| 116 | 116 | $xParameter = Parameter::make($xParameter); |
| 117 | 117 | }); |
| 118 | 118 | return $this; |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | public function else($sMessage) |
| 246 | 246 | { |
| 247 | 247 | $this->aMessageArgs = func_get_args(); |
| 248 | - array_walk($this->aMessageArgs, function (&$xParameter) { |
|
| 248 | + array_walk($this->aMessageArgs, function(&$xParameter) { |
|
| 249 | 249 | $xParameter = Parameter::make($xParameter); |
| 250 | 250 | }); |
| 251 | 251 | return $this; |
@@ -270,12 +270,12 @@ discard block |
||
| 270 | 270 | // This array will avoid declaring multiple variables with the same value. |
| 271 | 271 | // The array key is the variable value, while the array value is the variable name. |
| 272 | 272 | $aVariables = array(); // Array of local variables. |
| 273 | - foreach($this->aParameters as &$xParameter) |
|
| 273 | + foreach ($this->aParameters as &$xParameter) |
|
| 274 | 274 | { |
| 275 | 275 | $sParameterStr = $xParameter->getScript(); |
| 276 | - if($xParameter instanceof \Jaxon\JQuery\Dom\Element) |
|
| 276 | + if ($xParameter instanceof \Jaxon\JQuery\Dom\Element) |
|
| 277 | 277 | { |
| 278 | - if(!array_key_exists($sParameterStr, $aVariables)) |
|
| 278 | + if (!array_key_exists($sParameterStr, $aVariables)) |
|
| 279 | 279 | { |
| 280 | 280 | // The value is not yet defined. A new variable is created. |
| 281 | 281 | $sVarName = "jxnVar$nVarId"; |
@@ -293,19 +293,19 @@ discard block |
||
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | $sPhrase = ''; |
| 296 | - if(count($this->aMessageArgs) > 0) |
|
| 296 | + if (count($this->aMessageArgs) > 0) |
|
| 297 | 297 | { |
| 298 | 298 | $sPhrase = array_shift($this->aMessageArgs); // The first array entry is the question. |
| 299 | 299 | // $sPhrase = "'" . addslashes($sPhrase) . "'"; // Wrap the phrase with single quotes |
| 300 | - if(count($this->aMessageArgs) > 0) |
|
| 300 | + if (count($this->aMessageArgs) > 0) |
|
| 301 | 301 | { |
| 302 | 302 | $nParamId = 1; |
| 303 | - foreach($this->aMessageArgs as &$xParameter) |
|
| 303 | + foreach ($this->aMessageArgs as &$xParameter) |
|
| 304 | 304 | { |
| 305 | 305 | $sParameterStr = $xParameter->getScript(); |
| 306 | - if($xParameter instanceof \Jaxon\JQuery\Dom\Element) |
|
| 306 | + if ($xParameter instanceof \Jaxon\JQuery\Dom\Element) |
|
| 307 | 307 | { |
| 308 | - if(!array_key_exists($sParameterStr, $aVariables)) |
|
| 308 | + if (!array_key_exists($sParameterStr, $aVariables)) |
|
| 309 | 309 | { |
| 310 | 310 | // The value is not yet defined. A new variable is created. |
| 311 | 311 | $sVarName = "jxnVar$nVarId"; |
@@ -328,15 +328,15 @@ discard block |
||
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | $sScript = $this->getOption('core.prefix.' . $this->sType) . parent::getScript(); |
| 331 | - if($this->sCondition == '__confirm__') |
|
| 331 | + if ($this->sCondition == '__confirm__') |
|
| 332 | 332 | { |
| 333 | 333 | $xConfirm = $this->getPluginManager()->getConfirm(); |
| 334 | 334 | $sScript = $xConfirm->confirm($sPhrase, $sScript, ''); |
| 335 | 335 | } |
| 336 | - elseif($this->sCondition !== null) |
|
| 336 | + elseif ($this->sCondition !== null) |
|
| 337 | 337 | { |
| 338 | 338 | $sScript = 'if(' . $this->sCondition . '){' . $sScript . ';}'; |
| 339 | - if(($sPhrase)) |
|
| 339 | + if (($sPhrase)) |
|
| 340 | 340 | { |
| 341 | 341 | $xAlert = $this->getPluginManager()->getAlert(); |
| 342 | 342 | $xAlert->setReturn(true); |
@@ -242,9 +242,11 @@ discard block |
||
| 242 | 242 | * |
| 243 | 243 | * @return Request |
| 244 | 244 | */ |
| 245 | - public function else($sMessage) |
|
| 245 | + public function else { |
|
| 246 | + ($sMessage) |
|
| 246 | 247 | { |
| 247 | 248 | $this->aMessageArgs = func_get_args(); |
| 249 | + } |
|
| 248 | 250 | array_walk($this->aMessageArgs, function (&$xParameter) { |
| 249 | 251 | $xParameter = Parameter::make($xParameter); |
| 250 | 252 | }); |
@@ -282,8 +284,7 @@ discard block |
||
| 282 | 284 | $aVariables[$sParameterStr] = $sVarName; |
| 283 | 285 | $sVars .= "$sVarName=$xParameter;"; |
| 284 | 286 | $nVarId++; |
| 285 | - } |
|
| 286 | - else |
|
| 287 | + } else |
|
| 287 | 288 | { |
| 288 | 289 | // The value is already defined. The corresponding variable is assigned. |
| 289 | 290 | $sVarName = $aVariables[$sParameterStr]; |
@@ -312,8 +313,7 @@ discard block |
||
| 312 | 313 | $aVariables[$sParameterStr] = $sVarName; |
| 313 | 314 | $sVars .= "$sVarName=$xParameter;"; |
| 314 | 315 | $nVarId++; |
| 315 | - } |
|
| 316 | - else |
|
| 316 | + } else |
|
| 317 | 317 | { |
| 318 | 318 | // The value is already defined. The corresponding variable is assigned. |
| 319 | 319 | $sVarName = $aVariables[$sParameterStr]; |
@@ -332,8 +332,7 @@ discard block |
||
| 332 | 332 | { |
| 333 | 333 | $xConfirm = $this->getPluginManager()->getConfirm(); |
| 334 | 334 | $sScript = $xConfirm->confirm($sPhrase, $sScript, ''); |
| 335 | - } |
|
| 336 | - elseif($this->sCondition !== null) |
|
| 335 | + } elseif($this->sCondition !== null) |
|
| 337 | 336 | { |
| 338 | 337 | $sScript = 'if(' . $this->sCondition . '){' . $sScript . ';}'; |
| 339 | 338 | if(($sPhrase)) |
@@ -67,19 +67,19 @@ discard block |
||
| 67 | 67 | $this->sRequestedClass = null; |
| 68 | 68 | $this->sRequestedMethod = null; |
| 69 | 69 | |
| 70 | - if(!empty($_GET['jxncls'])) |
|
| 70 | + if (!empty($_GET['jxncls'])) |
|
| 71 | 71 | { |
| 72 | 72 | $this->sRequestedClass = $_GET['jxncls']; |
| 73 | 73 | } |
| 74 | - if(!empty($_GET['jxnmthd'])) |
|
| 74 | + if (!empty($_GET['jxnmthd'])) |
|
| 75 | 75 | { |
| 76 | 76 | $this->sRequestedMethod = $_GET['jxnmthd']; |
| 77 | 77 | } |
| 78 | - if(!empty($_POST['jxncls'])) |
|
| 78 | + if (!empty($_POST['jxncls'])) |
|
| 79 | 79 | { |
| 80 | 80 | $this->sRequestedClass = $_POST['jxncls']; |
| 81 | 81 | } |
| 82 | - if(!empty($_POST['jxnmthd'])) |
|
| 82 | + if (!empty($_POST['jxnmthd'])) |
|
| 83 | 83 | { |
| 84 | 84 | $this->sRequestedMethod = $_POST['jxnmthd']; |
| 85 | 85 | } |
@@ -104,33 +104,33 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public function register($aArgs) |
| 106 | 106 | { |
| 107 | - if(count($aArgs) > 1) |
|
| 107 | + if (count($aArgs) > 1) |
|
| 108 | 108 | { |
| 109 | 109 | $sType = $aArgs[0]; |
| 110 | 110 | |
| 111 | - if($sType == Jaxon::CALLABLE_OBJECT) |
|
| 111 | + if ($sType == Jaxon::CALLABLE_OBJECT) |
|
| 112 | 112 | { |
| 113 | 113 | $xCallableObject = $aArgs[1]; |
| 114 | 114 | |
| 115 | - if(!is_object($xCallableObject) && !is_string($xCallableObject)) |
|
| 115 | + if (!is_object($xCallableObject) && !is_string($xCallableObject)) |
|
| 116 | 116 | { |
| 117 | 117 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.instance')); |
| 118 | 118 | } |
| 119 | - if(is_string($xCallableObject) && !class_exists($xCallableObject)) |
|
| 119 | + if (is_string($xCallableObject) && !class_exists($xCallableObject)) |
|
| 120 | 120 | { |
| 121 | 121 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.instance')); |
| 122 | 122 | } |
| 123 | - if(!($xCallableObject instanceof \Jaxon\Request\Support\CallableObject)) |
|
| 123 | + if (!($xCallableObject instanceof \Jaxon\Request\Support\CallableObject)) |
|
| 124 | 124 | { |
| 125 | 125 | $xCallableObject = new \Jaxon\Request\Support\CallableObject($xCallableObject); |
| 126 | 126 | } |
| 127 | - if(count($aArgs) > 2 && is_array($aArgs[2])) |
|
| 127 | + if (count($aArgs) > 2 && is_array($aArgs[2])) |
|
| 128 | 128 | { |
| 129 | - foreach($aArgs[2] as $sKey => $aValue) |
|
| 129 | + foreach ($aArgs[2] as $sKey => $aValue) |
|
| 130 | 130 | { |
| 131 | - foreach($aValue as $sName => $sValue) |
|
| 131 | + foreach ($aValue as $sName => $sValue) |
|
| 132 | 132 | { |
| 133 | - if($sName == 'classpath' && $sValue != '') |
|
| 133 | + if ($sName == 'classpath' && $sValue != '') |
|
| 134 | 134 | $this->aClassPaths[] = $sValue; |
| 135 | 135 | $xCallableObject->configure($sKey, $sName, $sValue); |
| 136 | 136 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | public function generateHash() |
| 156 | 156 | { |
| 157 | 157 | $sHash = ''; |
| 158 | - foreach($this->aCallableObjects as $xCallableObject) |
|
| 158 | + foreach ($this->aCallableObjects as $xCallableObject) |
|
| 159 | 159 | { |
| 160 | 160 | $sHash .= $xCallableObject->getName(); |
| 161 | 161 | $sHash .= implode('|', $xCallableObject->getMethods()); |
@@ -174,15 +174,15 @@ discard block |
||
| 174 | 174 | // Generate code for javascript classes declaration |
| 175 | 175 | $code = ''; |
| 176 | 176 | $classes = array(); |
| 177 | - foreach($this->aClassPaths as $sClassPath) |
|
| 177 | + foreach ($this->aClassPaths as $sClassPath) |
|
| 178 | 178 | { |
| 179 | 179 | $offset = 0; |
| 180 | 180 | $sClassPath .= '.Null'; // This is a sentinel. The last token is not processed in the while loop. |
| 181 | - while(($dotPosition = strpos($sClassPath, '.', $offset)) !== false) |
|
| 181 | + while (($dotPosition = strpos($sClassPath, '.', $offset)) !== false) |
|
| 182 | 182 | { |
| 183 | 183 | $class = substr($sClassPath, 0, $dotPosition); |
| 184 | 184 | // Generate code for this class |
| 185 | - if(!array_key_exists($class, $classes)) |
|
| 185 | + if (!array_key_exists($class, $classes)) |
|
| 186 | 186 | { |
| 187 | 187 | $code .= "$sJaxonPrefix$class = {};\n"; |
| 188 | 188 | $classes[$class] = $class; |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - foreach($this->aCallableObjects as $xCallableObject) |
|
| 194 | + foreach ($this->aCallableObjects as $xCallableObject) |
|
| 195 | 195 | { |
| 196 | 196 | $code .= $xCallableObject->getScript(); |
| 197 | 197 | } |
@@ -206,13 +206,13 @@ discard block |
||
| 206 | 206 | public function canProcessRequest() |
| 207 | 207 | { |
| 208 | 208 | // Check the validity of the class name |
| 209 | - if(($this->sRequestedClass) && !$this->validateClass($this->sRequestedClass)) |
|
| 209 | + if (($this->sRequestedClass) && !$this->validateClass($this->sRequestedClass)) |
|
| 210 | 210 | { |
| 211 | 211 | $this->sRequestedClass = null; |
| 212 | 212 | $this->sRequestedMethod = null; |
| 213 | 213 | } |
| 214 | 214 | // Check the validity of the method name |
| 215 | - if(($this->sRequestedMethod) && !$this->validateMethod($this->sRequestedMethod)) |
|
| 215 | + if (($this->sRequestedMethod) && !$this->validateMethod($this->sRequestedMethod)) |
|
| 216 | 216 | { |
| 217 | 217 | $this->sRequestedClass = null; |
| 218 | 218 | $this->sRequestedMethod = null; |
@@ -227,20 +227,20 @@ discard block |
||
| 227 | 227 | */ |
| 228 | 228 | public function processRequest() |
| 229 | 229 | { |
| 230 | - if(!$this->canProcessRequest()) |
|
| 230 | + if (!$this->canProcessRequest()) |
|
| 231 | 231 | return false; |
| 232 | 232 | |
| 233 | 233 | $aArgs = $this->getRequestManager()->process(); |
| 234 | 234 | |
| 235 | 235 | // Register an instance of the requested class, if it isn't yet |
| 236 | - if(!($xCallableObject = $this->getCallableObject($this->sRequestedClass))) |
|
| 236 | + if (!($xCallableObject = $this->getCallableObject($this->sRequestedClass))) |
|
| 237 | 237 | { |
| 238 | 238 | $this->getPluginManager()->registerClass($this->sRequestedClass); |
| 239 | 239 | $xCallableObject = $this->getCallableObject($this->sRequestedClass); |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | // Find the requested method |
| 243 | - if(!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod)) |
|
| 243 | + if (!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod)) |
|
| 244 | 244 | { |
| 245 | 245 | // Unable to find the requested object or method |
| 246 | 246 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid', |