@@ -22,9 +22,7 @@ |
||
| 22 | 22 | namespace Jaxon\Plugin; |
| 23 | 23 | |
| 24 | 24 | use Jaxon\Jaxon; |
| 25 | -use Jaxon\Plugin\Package; |
|
| 26 | 25 | use Jaxon\Config\Config; |
| 27 | - |
|
| 28 | 26 | use Closure; |
| 29 | 27 | |
| 30 | 28 | class Manager |
@@ -132,32 +132,32 @@ discard block |
||
| 132 | 132 | { |
| 133 | 133 | $bIsAlert = ($xPlugin instanceof \Jaxon\Dialog\Interfaces\Alert); |
| 134 | 134 | $bIsConfirm = ($xPlugin instanceof \Jaxon\Dialog\Interfaces\Confirm); |
| 135 | - if($xPlugin instanceof Request) |
|
| 135 | + if ($xPlugin instanceof Request) |
|
| 136 | 136 | { |
| 137 | 137 | // The name of a request plugin is used as key in the plugin table |
| 138 | 138 | $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin; |
| 139 | 139 | } |
| 140 | - elseif($xPlugin instanceof Response) |
|
| 140 | + elseif ($xPlugin instanceof Response) |
|
| 141 | 141 | { |
| 142 | 142 | // The name of a response plugin is used as key in the plugin table |
| 143 | 143 | $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin; |
| 144 | 144 | } |
| 145 | - elseif(!$bIsConfirm && !$bIsAlert) |
|
| 145 | + elseif (!$bIsConfirm && !$bIsAlert) |
|
| 146 | 146 | { |
| 147 | 147 | throw new \Jaxon\Exception\Error($this->trans('errors.register.invalid', ['name' => get_class($xPlugin)])); |
| 148 | 148 | } |
| 149 | 149 | // This plugin implements the Alert interface |
| 150 | - if($bIsAlert) |
|
| 150 | + if ($bIsAlert) |
|
| 151 | 151 | { |
| 152 | 152 | jaxon()->dialog()->setAlert($xPlugin); |
| 153 | 153 | } |
| 154 | 154 | // This plugin implements the Confirm interface |
| 155 | - if($bIsConfirm) |
|
| 155 | + if ($bIsConfirm) |
|
| 156 | 156 | { |
| 157 | 157 | jaxon()->dialog()->setConfirm($xPlugin); |
| 158 | 158 | } |
| 159 | 159 | // Register the plugin as an event listener |
| 160 | - if($xPlugin instanceof \Jaxon\Utils\Interfaces\EventListener) |
|
| 160 | + if ($xPlugin instanceof \Jaxon\Utils\Interfaces\EventListener) |
|
| 161 | 161 | { |
| 162 | 162 | $this->addEventListener($xPlugin); |
| 163 | 163 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | public function register($sType, $sCallable, $aOptions = []) |
| 194 | 194 | { |
| 195 | - if(!key_exists($sType, $this->aRequestPlugins)) |
|
| 195 | + if (!key_exists($sType, $this->aRequestPlugins)) |
|
| 196 | 196 | { |
| 197 | 197 | throw new \Jaxon\Exception\Error($this->trans('errors.register.plugin', ['name' => $sType])); |
| 198 | 198 | } |
@@ -220,14 +220,14 @@ discard block |
||
| 220 | 220 | { |
| 221 | 221 | // Register user functions |
| 222 | 222 | $aFunctionsConfig = $xAppConfig->getOption('functions', []); |
| 223 | - foreach($aFunctionsConfig as $xKey => $xValue) |
|
| 223 | + foreach ($aFunctionsConfig as $xKey => $xValue) |
|
| 224 | 224 | { |
| 225 | - if(is_integer($xKey) && is_string($xValue)) |
|
| 225 | + if (is_integer($xKey) && is_string($xValue)) |
|
| 226 | 226 | { |
| 227 | 227 | // Register a function without options |
| 228 | 228 | $this->register(Jaxon::USER_FUNCTION, $xValue); |
| 229 | 229 | } |
| 230 | - elseif(is_string($xKey) && is_array($xValue)) |
|
| 230 | + elseif (is_string($xKey) && is_array($xValue)) |
|
| 231 | 231 | { |
| 232 | 232 | // Register a function with options |
| 233 | 233 | $this->register(Jaxon::USER_FUNCTION, $xKey, $xValue); |
@@ -241,22 +241,22 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | // Register classes and directories |
| 243 | 243 | $aClassesConfig = $xAppConfig->getOption('classes', []); |
| 244 | - foreach($aClassesConfig as $xKey => $xValue) |
|
| 244 | + foreach ($aClassesConfig as $xKey => $xValue) |
|
| 245 | 245 | { |
| 246 | - if(is_integer($xKey) && is_string($xValue)) |
|
| 246 | + if (is_integer($xKey) && is_string($xValue)) |
|
| 247 | 247 | { |
| 248 | 248 | // Register a class without options |
| 249 | 249 | $this->register(Jaxon::CALLABLE_CLASS, $xValue); |
| 250 | 250 | } |
| 251 | - elseif(is_string($xKey) && is_array($xValue)) |
|
| 251 | + elseif (is_string($xKey) && is_array($xValue)) |
|
| 252 | 252 | { |
| 253 | 253 | // Register a class with options |
| 254 | 254 | $this->register(Jaxon::CALLABLE_CLASS, $xKey, $aOptions); |
| 255 | 255 | } |
| 256 | - elseif(is_integer($xKey) && is_array($xValue)) |
|
| 256 | + elseif (is_integer($xKey) && is_array($xValue)) |
|
| 257 | 257 | { |
| 258 | 258 | // The directory path is required |
| 259 | - if(!key_exists('directory', $xValue)) |
|
| 259 | + if (!key_exists('directory', $xValue)) |
|
| 260 | 260 | { |
| 261 | 261 | continue; |
| 262 | 262 | // Todo: throw an exception |
@@ -264,17 +264,17 @@ discard block |
||
| 264 | 264 | // Registering a directory |
| 265 | 265 | $sDirectory = $xValue['directory']; |
| 266 | 266 | $aOptions = []; |
| 267 | - if(key_exists('options', $xValue) && |
|
| 267 | + if (key_exists('options', $xValue) && |
|
| 268 | 268 | is_array($xValue['options']) || is_string($xValue['options'])) |
| 269 | 269 | { |
| 270 | 270 | $aOptions = $xValue['options']; |
| 271 | 271 | } |
| 272 | 272 | // Setup directory options |
| 273 | - if(key_exists('namespace', $xValue)) |
|
| 273 | + if (key_exists('namespace', $xValue)) |
|
| 274 | 274 | { |
| 275 | 275 | $aOptions['namespace'] = $xValue['namespace']; |
| 276 | 276 | } |
| 277 | - if(key_exists('separator', $xValue)) |
|
| 277 | + if (key_exists('separator', $xValue)) |
|
| 278 | 278 | { |
| 279 | 279 | $aOptions['separator'] = $xValue['separator']; |
| 280 | 280 | } |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | */ |
| 300 | 300 | public function getResponsePlugin($sName) |
| 301 | 301 | { |
| 302 | - if(array_key_exists($sName, $this->aResponsePlugins)) |
|
| 302 | + if (array_key_exists($sName, $this->aResponsePlugins)) |
|
| 303 | 303 | { |
| 304 | 304 | return $this->aResponsePlugins[$sName]; |
| 305 | 305 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | */ |
| 316 | 316 | public function getRequestPlugin($sName) |
| 317 | 317 | { |
| 318 | - if(array_key_exists($sName, $this->aRequestPlugins)) |
|
| 318 | + if (array_key_exists($sName, $this->aRequestPlugins)) |
|
| 319 | 319 | { |
| 320 | 320 | return $this->aRequestPlugins[$sName]; |
| 321 | 321 | } |
@@ -136,13 +136,11 @@ discard block |
||
| 136 | 136 | { |
| 137 | 137 | // The name of a request plugin is used as key in the plugin table |
| 138 | 138 | $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin; |
| 139 | - } |
|
| 140 | - elseif($xPlugin instanceof Response) |
|
| 139 | + } elseif($xPlugin instanceof Response) |
|
| 141 | 140 | { |
| 142 | 141 | // The name of a response plugin is used as key in the plugin table |
| 143 | 142 | $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin; |
| 144 | - } |
|
| 145 | - elseif(!$bIsConfirm && !$bIsAlert) |
|
| 143 | + } elseif(!$bIsConfirm && !$bIsAlert) |
|
| 146 | 144 | { |
| 147 | 145 | throw new \Jaxon\Exception\Error($this->trans('errors.register.invalid', ['name' => get_class($xPlugin)])); |
| 148 | 146 | } |
@@ -226,13 +224,11 @@ discard block |
||
| 226 | 224 | { |
| 227 | 225 | // Register a function without options |
| 228 | 226 | $this->register(Jaxon::USER_FUNCTION, $xValue); |
| 229 | - } |
|
| 230 | - elseif(is_string($xKey) && is_array($xValue)) |
|
| 227 | + } elseif(is_string($xKey) && is_array($xValue)) |
|
| 231 | 228 | { |
| 232 | 229 | // Register a function with options |
| 233 | 230 | $this->register(Jaxon::USER_FUNCTION, $xKey, $xValue); |
| 234 | - } |
|
| 235 | - else |
|
| 231 | + } else |
|
| 236 | 232 | { |
| 237 | 233 | continue; |
| 238 | 234 | // Todo: throw an exception |
@@ -247,13 +243,11 @@ discard block |
||
| 247 | 243 | { |
| 248 | 244 | // Register a class without options |
| 249 | 245 | $this->register(Jaxon::CALLABLE_CLASS, $xValue); |
| 250 | - } |
|
| 251 | - elseif(is_string($xKey) && is_array($xValue)) |
|
| 246 | + } elseif(is_string($xKey) && is_array($xValue)) |
|
| 252 | 247 | { |
| 253 | 248 | // Register a class with options |
| 254 | 249 | $this->register(Jaxon::CALLABLE_CLASS, $xKey, $aOptions); |
| 255 | - } |
|
| 256 | - elseif(is_integer($xKey) && is_array($xValue)) |
|
| 250 | + } elseif(is_integer($xKey) && is_array($xValue)) |
|
| 257 | 251 | { |
| 258 | 252 | // The directory path is required |
| 259 | 253 | if(!key_exists('directory', $xValue)) |
@@ -280,8 +274,7 @@ discard block |
||
| 280 | 274 | } |
| 281 | 275 | // Register a class without options |
| 282 | 276 | $this->register(Jaxon::CALLABLE_DIR, $sDirectory, $aOptions); |
| 283 | - } |
|
| 284 | - else |
|
| 277 | + } else |
|
| 285 | 278 | { |
| 286 | 279 | continue; |
| 287 | 280 | // Todo: throw an exception |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | public function plugin($sName) |
| 97 | 97 | { |
| 98 | 98 | $xPlugin = $this->getPluginManager()->getResponsePlugin($sName); |
| 99 | - if(!$xPlugin) |
|
| 99 | + if (!$xPlugin) |
|
| 100 | 100 | { |
| 101 | 101 | return null; |
| 102 | 102 | } |
@@ -159,23 +159,23 @@ discard block |
||
| 159 | 159 | public function addCommand($aAttributes, $mData) |
| 160 | 160 | { |
| 161 | 161 | /* merge commands if possible */ |
| 162 | - if(in_array($aAttributes['cmd'], array('js', 'ap'))) |
|
| 162 | + if (in_array($aAttributes['cmd'], array('js', 'ap'))) |
|
| 163 | 163 | { |
| 164 | - if(($aLastCommand = array_pop($this->aCommands))) |
|
| 164 | + if (($aLastCommand = array_pop($this->aCommands))) |
|
| 165 | 165 | { |
| 166 | - if($aLastCommand['cmd'] == $aAttributes['cmd']) |
|
| 166 | + if ($aLastCommand['cmd'] == $aAttributes['cmd']) |
|
| 167 | 167 | { |
| 168 | - if($this->getOption('core.response.merge.js') && |
|
| 168 | + if ($this->getOption('core.response.merge.js') && |
|
| 169 | 169 | $aLastCommand['cmd'] == 'js') |
| 170 | 170 | { |
| 171 | - $mData = $aLastCommand['data'].'; '.$mData; |
|
| 171 | + $mData = $aLastCommand['data'] . '; ' . $mData; |
|
| 172 | 172 | } |
| 173 | - elseif($this->getOption('core.response.merge.ap') && |
|
| 173 | + elseif ($this->getOption('core.response.merge.ap') && |
|
| 174 | 174 | $aLastCommand['cmd'] == 'ap' && |
| 175 | 175 | $aLastCommand['id'] == $aAttributes['id'] && |
| 176 | 176 | $aLastCommand['prop'] == $aAttributes['prop']) |
| 177 | 177 | { |
| 178 | - $mData = $aLastCommand['data'].' '.$mData; |
|
| 178 | + $mData = $aLastCommand['data'] . ' ' . $mData; |
|
| 179 | 179 | } |
| 180 | 180 | else |
| 181 | 181 | { |
@@ -233,26 +233,26 @@ discard block |
||
| 233 | 233 | public function appendResponse($mCommands, $bBefore = false) |
| 234 | 234 | { |
| 235 | 235 | $aCommands = []; |
| 236 | - if($mCommands instanceof Response) |
|
| 236 | + if ($mCommands instanceof Response) |
|
| 237 | 237 | { |
| 238 | 238 | $this->returnValue = $mCommands->returnValue; |
| 239 | 239 | $aCommands = $mCommands->aCommands; |
| 240 | 240 | } |
| 241 | - elseif(is_array($mCommands)) |
|
| 241 | + elseif (is_array($mCommands)) |
|
| 242 | 242 | { |
| 243 | 243 | $aCommands = $mCommands; |
| 244 | 244 | } |
| 245 | 245 | else |
| 246 | 246 | { |
| 247 | - if(!empty($mCommands)) |
|
| 247 | + if (!empty($mCommands)) |
|
| 248 | 248 | { |
| 249 | 249 | throw new \Jaxon\Exception\Error($this->trans('errors.response.data.invalid')); |
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - if(count($aCommands) > 0) |
|
| 253 | + if (count($aCommands) > 0) |
|
| 254 | 254 | { |
| 255 | - if($bBefore) |
|
| 255 | + if ($bBefore) |
|
| 256 | 256 | { |
| 257 | 257 | $this->aCommands = array_merge($aCommands, $this->aCommands); |
| 258 | 258 | } |
@@ -524,33 +524,33 @@ discard block |
||
| 524 | 524 | * |
| 525 | 525 | * @return \Jaxon\Plugin\Response |
| 526 | 526 | */ |
| 527 | - public function redirect($sURL, $iDelay=0) |
|
| 527 | + public function redirect($sURL, $iDelay = 0) |
|
| 528 | 528 | { |
| 529 | 529 | // we need to parse the query part so that the values are rawurlencode()'ed |
| 530 | 530 | // can't just use parse_url() cos we could be dealing with a relative URL which |
| 531 | 531 | // parse_url() can't deal with. |
| 532 | 532 | $queryStart = strpos($sURL, '?', strrpos($sURL, '/')); |
| 533 | - if($queryStart !== false) |
|
| 533 | + if ($queryStart !== false) |
|
| 534 | 534 | { |
| 535 | 535 | $queryStart++; |
| 536 | 536 | $queryEnd = strpos($sURL, '#', $queryStart); |
| 537 | - if($queryEnd === false) |
|
| 537 | + if ($queryEnd === false) |
|
| 538 | 538 | $queryEnd = strlen($sURL); |
| 539 | - $queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart); |
|
| 539 | + $queryPart = substr($sURL, $queryStart, $queryEnd - $queryStart); |
|
| 540 | 540 | parse_str($queryPart, $queryParts); |
| 541 | 541 | $newQueryPart = ""; |
| 542 | - if($queryParts) |
|
| 542 | + if ($queryParts) |
|
| 543 | 543 | { |
| 544 | 544 | $first = true; |
| 545 | - foreach($queryParts as $key => $value) |
|
| 545 | + foreach ($queryParts as $key => $value) |
|
| 546 | 546 | { |
| 547 | - if($first) |
|
| 547 | + if ($first) |
|
| 548 | 548 | $first = false; |
| 549 | 549 | else |
| 550 | 550 | $newQueryPart .= '&'; |
| 551 | - $newQueryPart .= rawurlencode($key).'='.rawurlencode($value); |
|
| 551 | + $newQueryPart .= rawurlencode($key) . '=' . rawurlencode($value); |
|
| 552 | 552 | } |
| 553 | - } elseif($_SERVER['QUERY_STRING']) { |
|
| 553 | + } elseif ($_SERVER['QUERY_STRING']) { |
|
| 554 | 554 | //couldn't break up the query, but there's one there |
| 555 | 555 | //possibly "http://url/page.html?query1234" type of query? |
| 556 | 556 | //just encode it and hope it works |
@@ -558,8 +558,8 @@ discard block |
||
| 558 | 558 | } |
| 559 | 559 | $sURL = str_replace($queryPart, $newQueryPart, $sURL); |
| 560 | 560 | } |
| 561 | - if($iDelay) |
|
| 562 | - $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');'); |
|
| 561 | + if ($iDelay) |
|
| 562 | + $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay * 1000) . ');'); |
|
| 563 | 563 | else |
| 564 | 564 | $this->script('window.location = "' . $sURL . '";'); |
| 565 | 565 | return $this; |
@@ -896,10 +896,10 @@ discard block |
||
| 896 | 896 | { |
| 897 | 897 | $command = array('cmd' => 'in'); |
| 898 | 898 | |
| 899 | - if(($sType)) |
|
| 899 | + if (($sType)) |
|
| 900 | 900 | $command['type'] = trim((string)$sType, " \t"); |
| 901 | 901 | |
| 902 | - if(($sId)) |
|
| 902 | + if (($sId)) |
|
| 903 | 903 | $command['elm_id'] = trim((string)$sId, " \t"); |
| 904 | 904 | |
| 905 | 905 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
@@ -917,10 +917,10 @@ discard block |
||
| 917 | 917 | { |
| 918 | 918 | $command = array('cmd' => 'ino'); |
| 919 | 919 | |
| 920 | - if(($sType)) |
|
| 920 | + if (($sType)) |
|
| 921 | 921 | $command['type'] = trim((string)$sType, " \t"); |
| 922 | 922 | |
| 923 | - if(($sId)) |
|
| 923 | + if (($sId)) |
|
| 924 | 924 | $command['elm_id'] = trim((string)$sId, " \t"); |
| 925 | 925 | |
| 926 | 926 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
@@ -961,7 +961,7 @@ discard block |
||
| 961 | 961 | { |
| 962 | 962 | $command = array('cmd' => 'css'); |
| 963 | 963 | |
| 964 | - if(($sMedia)) |
|
| 964 | + if (($sMedia)) |
|
| 965 | 965 | $command['media'] = trim((string)$sMedia, " \t"); |
| 966 | 966 | |
| 967 | 967 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
@@ -980,7 +980,7 @@ discard block |
||
| 980 | 980 | { |
| 981 | 981 | $command = array('cmd' => 'rcss'); |
| 982 | 982 | |
| 983 | - if(($sMedia)) |
|
| 983 | + if (($sMedia)) |
|
| 984 | 984 | $command['media'] = trim((string)$sMedia, " \t"); |
| 985 | 985 | |
| 986 | 986 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
@@ -1121,10 +1121,10 @@ discard block |
||
| 1121 | 1121 | { |
| 1122 | 1122 | $command = array('cmd' => 'DRC'); |
| 1123 | 1123 | |
| 1124 | - if(($skip)) |
|
| 1124 | + if (($skip)) |
|
| 1125 | 1125 | $command['skip'] = $skip; |
| 1126 | 1126 | |
| 1127 | - if(($remove)) |
|
| 1127 | + if (($remove)) |
|
| 1128 | 1128 | $command['remove'] = $remove; |
| 1129 | 1129 | |
| 1130 | 1130 | return $this->addCommand($command, $parent); |
@@ -1249,7 +1249,7 @@ discard block |
||
| 1249 | 1249 | */ |
| 1250 | 1250 | public function sendHeaders() |
| 1251 | 1251 | { |
| 1252 | - if($this->getRequesthandler()->getRequestMethod() == Jaxon::METHOD_GET) |
|
| 1252 | + if ($this->getRequesthandler()->getRequestMethod() == Jaxon::METHOD_GET) |
|
| 1253 | 1253 | { |
| 1254 | 1254 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
| 1255 | 1255 | header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
@@ -1259,7 +1259,7 @@ discard block |
||
| 1259 | 1259 | |
| 1260 | 1260 | $sCharacterSet = ''; |
| 1261 | 1261 | $sCharacterEncoding = trim($this->getOption('core.encoding')); |
| 1262 | - if(($sCharacterEncoding) && strlen($sCharacterEncoding) > 0) |
|
| 1262 | + if (($sCharacterEncoding) && strlen($sCharacterEncoding) > 0) |
|
| 1263 | 1263 | { |
| 1264 | 1264 | $sCharacterSet = '; charset="' . trim($sCharacterEncoding) . '"'; |
| 1265 | 1265 | } |
@@ -1276,13 +1276,13 @@ discard block |
||
| 1276 | 1276 | { |
| 1277 | 1277 | $response = []; |
| 1278 | 1278 | |
| 1279 | - if(($this->returnValue)) |
|
| 1279 | + if (($this->returnValue)) |
|
| 1280 | 1280 | { |
| 1281 | 1281 | $response['jxnrv'] = $this->returnValue; |
| 1282 | 1282 | } |
| 1283 | 1283 | $response['jxnobj'] = []; |
| 1284 | 1284 | |
| 1285 | - foreach($this->aCommands as $xCommand) |
|
| 1285 | + foreach ($this->aCommands as $xCommand) |
|
| 1286 | 1286 | { |
| 1287 | 1287 | $response['jxnobj'][] = $xCommand; |
| 1288 | 1288 | } |
@@ -169,20 +169,17 @@ discard block |
||
| 169 | 169 | $aLastCommand['cmd'] == 'js') |
| 170 | 170 | { |
| 171 | 171 | $mData = $aLastCommand['data'].'; '.$mData; |
| 172 | - } |
|
| 173 | - elseif($this->getOption('core.response.merge.ap') && |
|
| 172 | + } elseif($this->getOption('core.response.merge.ap') && |
|
| 174 | 173 | $aLastCommand['cmd'] == 'ap' && |
| 175 | 174 | $aLastCommand['id'] == $aAttributes['id'] && |
| 176 | 175 | $aLastCommand['prop'] == $aAttributes['prop']) |
| 177 | 176 | { |
| 178 | 177 | $mData = $aLastCommand['data'].' '.$mData; |
| 179 | - } |
|
| 180 | - else |
|
| 178 | + } else |
|
| 181 | 179 | { |
| 182 | 180 | $this->aCommands[] = $aLastCommand; |
| 183 | 181 | } |
| 184 | - } |
|
| 185 | - else |
|
| 182 | + } else |
|
| 186 | 183 | { |
| 187 | 184 | $this->aCommands[] = $aLastCommand; |
| 188 | 185 | } |
@@ -237,12 +234,10 @@ discard block |
||
| 237 | 234 | { |
| 238 | 235 | $this->returnValue = $mCommands->returnValue; |
| 239 | 236 | $aCommands = $mCommands->aCommands; |
| 240 | - } |
|
| 241 | - elseif(is_array($mCommands)) |
|
| 237 | + } elseif(is_array($mCommands)) |
|
| 242 | 238 | { |
| 243 | 239 | $aCommands = $mCommands; |
| 244 | - } |
|
| 245 | - else |
|
| 240 | + } else |
|
| 246 | 241 | { |
| 247 | 242 | if(!empty($mCommands)) |
| 248 | 243 | { |
@@ -255,8 +250,7 @@ discard block |
||
| 255 | 250 | if($bBefore) |
| 256 | 251 | { |
| 257 | 252 | $this->aCommands = array_merge($aCommands, $this->aCommands); |
| 258 | - } |
|
| 259 | - else |
|
| 253 | + } else |
|
| 260 | 254 | { |
| 261 | 255 | $this->aCommands = array_merge($this->aCommands, $aCommands); |
| 262 | 256 | } |
@@ -534,8 +528,9 @@ discard block |
||
| 534 | 528 | { |
| 535 | 529 | $queryStart++; |
| 536 | 530 | $queryEnd = strpos($sURL, '#', $queryStart); |
| 537 | - if($queryEnd === false) |
|
| 538 | - $queryEnd = strlen($sURL); |
|
| 531 | + if($queryEnd === false) { |
|
| 532 | + $queryEnd = strlen($sURL); |
|
| 533 | + } |
|
| 539 | 534 | $queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart); |
| 540 | 535 | parse_str($queryPart, $queryParts); |
| 541 | 536 | $newQueryPart = ""; |
@@ -544,10 +539,11 @@ discard block |
||
| 544 | 539 | $first = true; |
| 545 | 540 | foreach($queryParts as $key => $value) |
| 546 | 541 | { |
| 547 | - if($first) |
|
| 548 | - $first = false; |
|
| 549 | - else |
|
| 550 | - $newQueryPart .= '&'; |
|
| 542 | + if($first) { |
|
| 543 | + $first = false; |
|
| 544 | + } else { |
|
| 545 | + $newQueryPart .= '&'; |
|
| 546 | + } |
|
| 551 | 547 | $newQueryPart .= rawurlencode($key).'='.rawurlencode($value); |
| 552 | 548 | } |
| 553 | 549 | } elseif($_SERVER['QUERY_STRING']) { |
@@ -558,10 +554,11 @@ discard block |
||
| 558 | 554 | } |
| 559 | 555 | $sURL = str_replace($queryPart, $newQueryPart, $sURL); |
| 560 | 556 | } |
| 561 | - if($iDelay) |
|
| 562 | - $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');'); |
|
| 563 | - else |
|
| 564 | - $this->script('window.location = "' . $sURL . '";'); |
|
| 557 | + if($iDelay) { |
|
| 558 | + $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');'); |
|
| 559 | + } else { |
|
| 560 | + $this->script('window.location = "' . $sURL . '";'); |
|
| 561 | + } |
|
| 565 | 562 | return $this; |
| 566 | 563 | } |
| 567 | 564 | |
@@ -896,11 +893,13 @@ discard block |
||
| 896 | 893 | { |
| 897 | 894 | $command = array('cmd' => 'in'); |
| 898 | 895 | |
| 899 | - if(($sType)) |
|
| 900 | - $command['type'] = trim((string)$sType, " \t"); |
|
| 896 | + if(($sType)) { |
|
| 897 | + $command['type'] = trim((string)$sType, " \t"); |
|
| 898 | + } |
|
| 901 | 899 | |
| 902 | - if(($sId)) |
|
| 903 | - $command['elm_id'] = trim((string)$sId, " \t"); |
|
| 900 | + if(($sId)) { |
|
| 901 | + $command['elm_id'] = trim((string)$sId, " \t"); |
|
| 902 | + } |
|
| 904 | 903 | |
| 905 | 904 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
| 906 | 905 | } |
@@ -917,11 +916,13 @@ discard block |
||
| 917 | 916 | { |
| 918 | 917 | $command = array('cmd' => 'ino'); |
| 919 | 918 | |
| 920 | - if(($sType)) |
|
| 921 | - $command['type'] = trim((string)$sType, " \t"); |
|
| 919 | + if(($sType)) { |
|
| 920 | + $command['type'] = trim((string)$sType, " \t"); |
|
| 921 | + } |
|
| 922 | 922 | |
| 923 | - if(($sId)) |
|
| 924 | - $command['elm_id'] = trim((string)$sId, " \t"); |
|
| 923 | + if(($sId)) { |
|
| 924 | + $command['elm_id'] = trim((string)$sId, " \t"); |
|
| 925 | + } |
|
| 925 | 926 | |
| 926 | 927 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
| 927 | 928 | } |
@@ -961,8 +962,9 @@ discard block |
||
| 961 | 962 | { |
| 962 | 963 | $command = array('cmd' => 'css'); |
| 963 | 964 | |
| 964 | - if(($sMedia)) |
|
| 965 | - $command['media'] = trim((string)$sMedia, " \t"); |
|
| 965 | + if(($sMedia)) { |
|
| 966 | + $command['media'] = trim((string)$sMedia, " \t"); |
|
| 967 | + } |
|
| 966 | 968 | |
| 967 | 969 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
| 968 | 970 | } |
@@ -980,8 +982,9 @@ discard block |
||
| 980 | 982 | { |
| 981 | 983 | $command = array('cmd' => 'rcss'); |
| 982 | 984 | |
| 983 | - if(($sMedia)) |
|
| 984 | - $command['media'] = trim((string)$sMedia, " \t"); |
|
| 985 | + if(($sMedia)) { |
|
| 986 | + $command['media'] = trim((string)$sMedia, " \t"); |
|
| 987 | + } |
|
| 985 | 988 | |
| 986 | 989 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
| 987 | 990 | } |
@@ -1121,11 +1124,13 @@ discard block |
||
| 1121 | 1124 | { |
| 1122 | 1125 | $command = array('cmd' => 'DRC'); |
| 1123 | 1126 | |
| 1124 | - if(($skip)) |
|
| 1125 | - $command['skip'] = $skip; |
|
| 1127 | + if(($skip)) { |
|
| 1128 | + $command['skip'] = $skip; |
|
| 1129 | + } |
|
| 1126 | 1130 | |
| 1127 | - if(($remove)) |
|
| 1128 | - $command['remove'] = $remove; |
|
| 1131 | + if(($remove)) { |
|
| 1132 | + $command['remove'] = $remove; |
|
| 1133 | + } |
|
| 1129 | 1134 | |
| 1130 | 1135 | return $this->addCommand($command, $parent); |
| 1131 | 1136 | } |