@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php echo $this->sPrefix ?><?php echo $this->sEvent ?> = function() { |
| 2 | 2 | return jaxon.request( |
| 3 | 3 | { jxnevt: '<?php echo $this->sEvent ?>' }, |
| 4 | - { parameters: arguments<?php if(($this->sMode)): ?>, mode: '<?php echo $this->sMode ?>'<?php endif ?><?php if(($this->sMethod)): ?>, method: '<?php echo $this->sMethod ?>'<?php endif ?> } |
|
| 4 | + { parameters: arguments<?php if (($this->sMode)): ?>, mode: '<?php echo $this->sMode ?>'<?php endif ?><?php if (($this->sMethod)): ?>, method: '<?php echo $this->sMethod ?>'<?php endif ?> } |
|
| 5 | 5 | ); |
| 6 | 6 | }; |
@@ -1,3 +1,3 @@ |
||
| 1 | -<?php foreach($this->aUrls as $sUrl): ?> |
|
| 1 | +<?php foreach ($this->aUrls as $sUrl): ?> |
|
| 2 | 2 | <script type="text/javascript" src="<?php echo $sUrl ?>" <?php echo $this->sJsOptions ?> charset="UTF-8"></script> |
| 3 | 3 | <?php endforeach ?> |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | jaxon.dom.ready(function() { |
| 2 | 2 | jaxon.command.handler.register('cc', jaxon.confirm.commands); |
| 3 | 3 | |
| 4 | -<?php if($this->sPluginScript): ?> |
|
| 4 | +<?php if ($this->sPluginScript): ?> |
|
| 5 | 5 | <?php echo $this->sPluginScript ?> |
| 6 | 6 | <?php endif ?> |
| 7 | 7 | }); |
@@ -23,7 +23,6 @@ discard block |
||
| 23 | 23 | * Return the javascript call to a Jaxon function or object method |
| 24 | 24 | * |
| 25 | 25 | * @param string $sName The function or method (with class) name |
| 26 | - * @param ... $xParams The parameters of the function or method |
|
| 27 | 26 | * |
| 28 | 27 | * @return \Jaxon\Request\Request |
| 29 | 28 | */ |
@@ -46,7 +45,6 @@ discard block |
||
| 46 | 45 | * Return the javascript call to a generic function |
| 47 | 46 | * |
| 48 | 47 | * @param string $sName The function or method (with class) name |
| 49 | - * @param ... $xParams The parameters of the function or method |
|
| 50 | 48 | * |
| 51 | 49 | * @return \Jaxon\Request\Request |
| 52 | 50 | */ |
@@ -70,7 +68,6 @@ discard block |
||
| 70 | 68 | * @param integer $nItemsPerPage The number of items per page page |
| 71 | 69 | * @param integer $nCurrentPage The current page |
| 72 | 70 | * @param string $sMethod The name of function or a method prepended with its class name |
| 73 | - * @param ... $xParams The parameters of the function or method |
|
| 74 | 71 | * |
| 75 | 72 | * @return string the pagination links |
| 76 | 73 | */ |
@@ -100,7 +100,7 @@ |
||
| 100 | 100 | * |
| 101 | 101 | * @param array $aArgs An array containing the callable object specification |
| 102 | 102 | * |
| 103 | - * @return array |
|
| 103 | + * @return boolean |
|
| 104 | 104 | */ |
| 105 | 105 | public function register($aArgs) |
| 106 | 106 | { |
@@ -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,44 +104,44 @@ 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 | 129 | $aOptions = $aArgs[2]; |
| 130 | 130 | // Save the classpath and the separator in this class |
| 131 | - if(array_key_exists('*', $aOptions) && is_array($aOptions['*'])) |
|
| 131 | + if (array_key_exists('*', $aOptions) && is_array($aOptions['*'])) |
|
| 132 | 132 | { |
| 133 | 133 | $aOptions = $aOptions['*']; |
| 134 | 134 | $sSeparator = '.'; |
| 135 | - if(array_key_exists('separator', $aOptions)) |
|
| 135 | + if (array_key_exists('separator', $aOptions)) |
|
| 136 | 136 | { |
| 137 | 137 | $sSeparator = trim($aOptions['separator']); |
| 138 | 138 | } |
| 139 | - if(!in_array($sSeparator, ['.', '_'])) |
|
| 139 | + if (!in_array($sSeparator, ['.', '_'])) |
|
| 140 | 140 | { |
| 141 | 141 | $sSeparator = '.'; |
| 142 | 142 | } |
| 143 | 143 | $aOptions['separator'] = $sSeparator; |
| 144 | - if(array_key_exists('classpath', $aOptions)) |
|
| 144 | + if (array_key_exists('classpath', $aOptions)) |
|
| 145 | 145 | { |
| 146 | 146 | $aOptions['classpath'] = trim($aOptions['classpath'], ' \\._'); |
| 147 | 147 | // Save classpath with "\" in the parameters |
@@ -150,9 +150,9 @@ discard block |
||
| 150 | 150 | $this->aClassPaths[] = str_replace('\\', $sSeparator, $aOptions['classpath']); |
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | - foreach($aArgs[2] as $sKey => $aValue) |
|
| 153 | + foreach ($aArgs[2] as $sKey => $aValue) |
|
| 154 | 154 | { |
| 155 | - foreach($aValue as $sName => $sValue) |
|
| 155 | + foreach ($aValue as $sName => $sValue) |
|
| 156 | 156 | { |
| 157 | 157 | $xCallableObject->configure($sKey, $sName, $sValue); |
| 158 | 158 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | public function generateHash() |
| 177 | 177 | { |
| 178 | 178 | $sHash = ''; |
| 179 | - foreach($this->aCallableObjects as $xCallableObject) |
|
| 179 | + foreach ($this->aCallableObjects as $xCallableObject) |
|
| 180 | 180 | { |
| 181 | 181 | $sHash .= $xCallableObject->getName(); |
| 182 | 182 | $sHash .= implode('|', $xCallableObject->getMethods()); |
@@ -195,15 +195,15 @@ discard block |
||
| 195 | 195 | // Generate code for javascript objects declaration |
| 196 | 196 | $code = ''; |
| 197 | 197 | $classes = array(); |
| 198 | - foreach($this->aClassPaths as $sClassPath) |
|
| 198 | + foreach ($this->aClassPaths as $sClassPath) |
|
| 199 | 199 | { |
| 200 | 200 | $offset = 0; |
| 201 | 201 | $sClassPath .= '.Null'; // This is a sentinel. The last token is not processed in the while loop. |
| 202 | - while(($dotPosition = strpos($sClassPath, '.', $offset)) !== false) |
|
| 202 | + while (($dotPosition = strpos($sClassPath, '.', $offset)) !== false) |
|
| 203 | 203 | { |
| 204 | 204 | $class = substr($sClassPath, 0, $dotPosition); |
| 205 | 205 | // Generate code for this object |
| 206 | - if(!array_key_exists($class, $classes)) |
|
| 206 | + if (!array_key_exists($class, $classes)) |
|
| 207 | 207 | { |
| 208 | 208 | $code .= "$sJaxonPrefix$class = {};\n"; |
| 209 | 209 | $classes[$class] = $class; |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | } |
| 213 | 213 | } |
| 214 | 214 | // Generate code for javascript methods |
| 215 | - foreach($this->aCallableObjects as $xCallableObject) |
|
| 215 | + foreach ($this->aCallableObjects as $xCallableObject) |
|
| 216 | 216 | { |
| 217 | 217 | $code .= $xCallableObject->getScript(); |
| 218 | 218 | } |
@@ -227,13 +227,13 @@ discard block |
||
| 227 | 227 | public function canProcessRequest() |
| 228 | 228 | { |
| 229 | 229 | // Check the validity of the class name |
| 230 | - if(($this->sRequestedClass) && !$this->validateClass($this->sRequestedClass)) |
|
| 230 | + if (($this->sRequestedClass) && !$this->validateClass($this->sRequestedClass)) |
|
| 231 | 231 | { |
| 232 | 232 | $this->sRequestedClass = null; |
| 233 | 233 | $this->sRequestedMethod = null; |
| 234 | 234 | } |
| 235 | 235 | // Check the validity of the method name |
| 236 | - if(($this->sRequestedMethod) && !$this->validateMethod($this->sRequestedMethod)) |
|
| 236 | + if (($this->sRequestedMethod) && !$this->validateMethod($this->sRequestedMethod)) |
|
| 237 | 237 | { |
| 238 | 238 | $this->sRequestedClass = null; |
| 239 | 239 | $this->sRequestedMethod = null; |
@@ -248,20 +248,20 @@ discard block |
||
| 248 | 248 | */ |
| 249 | 249 | public function processRequest() |
| 250 | 250 | { |
| 251 | - if(!$this->canProcessRequest()) |
|
| 251 | + if (!$this->canProcessRequest()) |
|
| 252 | 252 | return false; |
| 253 | 253 | |
| 254 | 254 | $aArgs = $this->getRequestManager()->process(); |
| 255 | 255 | |
| 256 | 256 | // Register an instance of the requested class, if it isn't yet |
| 257 | - if(!($xCallableObject = $this->getCallableObject($this->sRequestedClass))) |
|
| 257 | + if (!($xCallableObject = $this->getCallableObject($this->sRequestedClass))) |
|
| 258 | 258 | { |
| 259 | 259 | $this->getPluginManager()->registerClass($this->sRequestedClass); |
| 260 | 260 | $xCallableObject = $this->getCallableObject($this->sRequestedClass); |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | // Find the requested method |
| 264 | - if(!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod)) |
|
| 264 | + if (!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod)) |
|
| 265 | 265 | { |
| 266 | 266 | // Unable to find the requested object or method |
| 267 | 267 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid', |
@@ -248,8 +248,9 @@ |
||
| 248 | 248 | */ |
| 249 | 249 | public function processRequest() |
| 250 | 250 | { |
| 251 | - if(!$this->canProcessRequest()) |
|
| 252 | - return false; |
|
| 251 | + if(!$this->canProcessRequest()) { |
|
| 252 | + return false; |
|
| 253 | + } |
|
| 253 | 254 | |
| 254 | 255 | $aArgs = $this->getRequestManager()->process(); |
| 255 | 256 | |
@@ -71,13 +71,13 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public function append(Response $xResponse) |
| 73 | 73 | { |
| 74 | - if(!$this->xResponse) |
|
| 74 | + if (!$this->xResponse) |
|
| 75 | 75 | { |
| 76 | 76 | $this->xResponse = $xResponse; |
| 77 | 77 | } |
| 78 | - elseif(get_class($this->xResponse) == get_class($xResponse)) |
|
| 78 | + elseif (get_class($this->xResponse) == get_class($xResponse)) |
|
| 79 | 79 | { |
| 80 | - if($this->xResponse != $xResponse) |
|
| 80 | + if ($this->xResponse != $xResponse) |
|
| 81 | 81 | { |
| 82 | 82 | $this->xResponse->appendResponse($xResponse); |
| 83 | 83 | } |
@@ -110,9 +110,9 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | public function printDebug() |
| 112 | 112 | { |
| 113 | - if(($this->xResponse)) |
|
| 113 | + if (($this->xResponse)) |
|
| 114 | 114 | { |
| 115 | - foreach($this->aDebugMessages as $sMessage) |
|
| 115 | + foreach ($this->aDebugMessages as $sMessage) |
|
| 116 | 116 | { |
| 117 | 117 | $this->xResponse->debug($sMessage); |
| 118 | 118 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function sendHeaders() |
| 129 | 129 | { |
| 130 | - if(($this->xResponse)) |
|
| 130 | + if (($this->xResponse)) |
|
| 131 | 131 | { |
| 132 | 132 | $this->xResponse->sendHeaders(); |
| 133 | 133 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | public function getOutput() |
| 142 | 142 | { |
| 143 | - if(($this->xResponse)) |
|
| 143 | + if (($this->xResponse)) |
|
| 144 | 144 | { |
| 145 | 145 | return $this->xResponse->getOutput(); |
| 146 | 146 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | public function sendOutput() |
| 156 | 156 | { |
| 157 | - if(($this->xResponse)) |
|
| 157 | + if (($this->xResponse)) |
|
| 158 | 158 | { |
| 159 | 159 | $this->xResponse->sendHeaders(); |
| 160 | 160 | $this->xResponse->printOutput(); |
@@ -74,15 +74,13 @@ |
||
| 74 | 74 | if(!$this->xResponse) |
| 75 | 75 | { |
| 76 | 76 | $this->xResponse = $xResponse; |
| 77 | - } |
|
| 78 | - elseif(get_class($this->xResponse) == get_class($xResponse)) |
|
| 77 | + } elseif(get_class($this->xResponse) == get_class($xResponse)) |
|
| 79 | 78 | { |
| 80 | 79 | if($this->xResponse != $xResponse) |
| 81 | 80 | { |
| 82 | 81 | $this->xResponse->appendResponse($xResponse); |
| 83 | 82 | } |
| 84 | - } |
|
| 85 | - else |
|
| 83 | + } else |
|
| 86 | 84 | { |
| 87 | 85 | $this->debug($this->trans('errors.mismatch.types', array('class' => get_class($xResponse)))); |
| 88 | 86 | } |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | $sSelector = trim($sSelector, " \t"); |
| 53 | 53 | $sContext = trim($sContext, " \t"); |
| 54 | 54 | $this->aCalls = array(); |
| 55 | - if(!$sSelector) |
|
| 55 | + if (!$sSelector) |
|
| 56 | 56 | { |
| 57 | 57 | $this->sSelector = "$(this)"; // If an empty selector is given, use javascript "this" instead |
| 58 | 58 | } |
| 59 | - elseif(($sContext)) |
|
| 59 | + elseif (($sContext)) |
|
| 60 | 60 | { |
| 61 | 61 | $this->sSelector = "$('" . $sSelector . "', $('" . $sContext . "'))"; |
| 62 | 62 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | public function getScript() |
| 114 | 114 | { |
| 115 | - if(count($this->aCalls) == 0) |
|
| 115 | + if (count($this->aCalls) == 0) |
|
| 116 | 116 | { |
| 117 | 117 | return $this->sSelector; |
| 118 | 118 | } |
@@ -55,12 +55,10 @@ |
||
| 55 | 55 | if(!$sSelector) |
| 56 | 56 | { |
| 57 | 57 | $this->sSelector = "$(this)"; // If an empty selector is given, use javascript "this" instead |
| 58 | - } |
|
| 59 | - elseif(($sContext)) |
|
| 58 | + } elseif(($sContext)) |
|
| 60 | 59 | { |
| 61 | 60 | $this->sSelector = "$('" . $sSelector . "', $('" . $sContext . "'))"; |
| 62 | - } |
|
| 63 | - else |
|
| 61 | + } else |
|
| 64 | 62 | { |
| 65 | 63 | $this->sSelector = "$('" . $sSelector . "')"; |
| 66 | 64 | } |
@@ -25,16 +25,16 @@ discard block |
||
| 25 | 25 | { |
| 26 | 26 | $aURL = array(); |
| 27 | 27 | // Try to get the request URL |
| 28 | - if(!empty($_SERVER['REQUEST_URI'])) |
|
| 28 | + if (!empty($_SERVER['REQUEST_URI'])) |
|
| 29 | 29 | { |
| 30 | - $_SERVER['REQUEST_URI'] = str_replace(array('"',"'",'<','>'), array('%22','%27','%3C','%3E'), $_SERVER['REQUEST_URI']); |
|
| 30 | + $_SERVER['REQUEST_URI'] = str_replace(array('"', "'", '<', '>'), array('%22', '%27', '%3C', '%3E'), $_SERVER['REQUEST_URI']); |
|
| 31 | 31 | $aURL = parse_url($_SERVER['REQUEST_URI']); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // Fill in the empty values |
| 35 | - if(empty($aURL['scheme'])) |
|
| 35 | + if (empty($aURL['scheme'])) |
|
| 36 | 36 | { |
| 37 | - if(!empty($_SERVER['HTTP_SCHEME'])) |
|
| 37 | + if (!empty($_SERVER['HTTP_SCHEME'])) |
|
| 38 | 38 | { |
| 39 | 39 | $aURL['scheme'] = $_SERVER['HTTP_SCHEME']; |
| 40 | 40 | } |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - if(empty($aURL['host'])) |
|
| 47 | + if (empty($aURL['host'])) |
|
| 48 | 48 | { |
| 49 | - if(!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) |
|
| 49 | + if (!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) |
|
| 50 | 50 | { |
| 51 | - if(strpos($_SERVER['HTTP_X_FORWARDED_HOST'], ':') > 0) |
|
| 51 | + if (strpos($_SERVER['HTTP_X_FORWARDED_HOST'], ':') > 0) |
|
| 52 | 52 | { |
| 53 | 53 | list($aURL['host'], $aURL['port']) = explode(':', $_SERVER['HTTP_X_FORWARDED_HOST']); |
| 54 | 54 | } |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | $aURL['host'] = $_SERVER['HTTP_X_FORWARDED_HOST']; |
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | - elseif(!empty($_SERVER['HTTP_HOST'])) |
|
| 60 | + elseif (!empty($_SERVER['HTTP_HOST'])) |
|
| 61 | 61 | { |
| 62 | - if(strpos($_SERVER['HTTP_HOST'], ':') > 0) |
|
| 62 | + if (strpos($_SERVER['HTTP_HOST'], ':') > 0) |
|
| 63 | 63 | { |
| 64 | 64 | list($aURL['host'], $aURL['port']) = explode(':', $_SERVER['HTTP_HOST']); |
| 65 | 65 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $aURL['host'] = $_SERVER['HTTP_HOST']; |
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | - elseif(!empty($_SERVER['SERVER_NAME'])) |
|
| 71 | + elseif (!empty($_SERVER['SERVER_NAME'])) |
|
| 72 | 72 | { |
| 73 | 73 | $aURL['host'] = $_SERVER['SERVER_NAME']; |
| 74 | 74 | } |
@@ -78,20 +78,20 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if(empty($aURL['port']) && !empty($_SERVER['SERVER_PORT'])) |
|
| 81 | + if (empty($aURL['port']) && !empty($_SERVER['SERVER_PORT'])) |
|
| 82 | 82 | { |
| 83 | 83 | $aURL['port'] = $_SERVER['SERVER_PORT']; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - if(!empty($aURL['path']) && strlen(basename($aURL['path'])) == 0) |
|
| 86 | + if (!empty($aURL['path']) && strlen(basename($aURL['path'])) == 0) |
|
| 87 | 87 | { |
| 88 | 88 | unset($aURL['path']); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - if(empty($aURL['path'])) |
|
| 91 | + if (empty($aURL['path'])) |
|
| 92 | 92 | { |
| 93 | 93 | $sPath = array(); |
| 94 | - if(!empty($_SERVER['PATH_INFO'])) |
|
| 94 | + if (!empty($_SERVER['PATH_INFO'])) |
|
| 95 | 95 | { |
| 96 | 96 | $sPath = parse_url($_SERVER['PATH_INFO']); |
| 97 | 97 | } |
@@ -99,61 +99,61 @@ discard block |
||
| 99 | 99 | { |
| 100 | 100 | $sPath = parse_url($_SERVER['PHP_SELF']); |
| 101 | 101 | } |
| 102 | - if(isset($sPath['path'])) |
|
| 102 | + if (isset($sPath['path'])) |
|
| 103 | 103 | { |
| 104 | - $aURL['path'] = str_replace(array('"',"'",'<','>'), array('%22','%27','%3C','%3E'), $sPath['path']); |
|
| 104 | + $aURL['path'] = str_replace(array('"', "'", '<', '>'), array('%22', '%27', '%3C', '%3E'), $sPath['path']); |
|
| 105 | 105 | } |
| 106 | 106 | unset($sPath); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - if(empty($aURL['query']) && !empty($_SERVER['QUERY_STRING'])) |
|
| 109 | + if (empty($aURL['query']) && !empty($_SERVER['QUERY_STRING'])) |
|
| 110 | 110 | { |
| 111 | 111 | $aURL['query'] = $_SERVER['QUERY_STRING']; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if(!empty($aURL['query'])) |
|
| 114 | + if (!empty($aURL['query'])) |
|
| 115 | 115 | { |
| 116 | - $aURL['query'] = '?'.$aURL['query']; |
|
| 116 | + $aURL['query'] = '?' . $aURL['query']; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | // Build the URL: Start with scheme, user and pass |
| 120 | - $sURL = $aURL['scheme'].'://'; |
|
| 121 | - if(!empty($aURL['user'])) |
|
| 120 | + $sURL = $aURL['scheme'] . '://'; |
|
| 121 | + if (!empty($aURL['user'])) |
|
| 122 | 122 | { |
| 123 | - $sURL.= $aURL['user']; |
|
| 124 | - if(!empty($aURL['pass'])) |
|
| 123 | + $sURL .= $aURL['user']; |
|
| 124 | + if (!empty($aURL['pass'])) |
|
| 125 | 125 | { |
| 126 | - $sURL.= ':'.$aURL['pass']; |
|
| 126 | + $sURL .= ':' . $aURL['pass']; |
|
| 127 | 127 | } |
| 128 | - $sURL.= '@'; |
|
| 128 | + $sURL .= '@'; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | // Add the host |
| 132 | - $sURL.= $aURL['host']; |
|
| 132 | + $sURL .= $aURL['host']; |
|
| 133 | 133 | |
| 134 | 134 | // Add the port if needed |
| 135 | - if(!empty($aURL['port']) |
|
| 135 | + if (!empty($aURL['port']) |
|
| 136 | 136 | && (($aURL['scheme'] == 'http' && $aURL['port'] != 80) |
| 137 | 137 | || ($aURL['scheme'] == 'https' && $aURL['port'] != 443))) |
| 138 | 138 | { |
| 139 | - $sURL.= ':'.$aURL['port']; |
|
| 139 | + $sURL .= ':' . $aURL['port']; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | // Add the path and the query string |
| 143 | - $sURL.= $aURL['path'].@$aURL['query']; |
|
| 143 | + $sURL .= $aURL['path'] . @$aURL['query']; |
|
| 144 | 144 | |
| 145 | 145 | // Clean up |
| 146 | 146 | unset($aURL); |
| 147 | 147 | |
| 148 | 148 | $aURL = explode("?", $sURL); |
| 149 | 149 | |
| 150 | - if(1 < count($aURL)) |
|
| 150 | + if (1 < count($aURL)) |
|
| 151 | 151 | { |
| 152 | 152 | $aQueries = explode("&", $aURL[1]); |
| 153 | 153 | |
| 154 | - foreach($aQueries as $sKey => $sQuery) |
|
| 154 | + foreach ($aQueries as $sKey => $sQuery) |
|
| 155 | 155 | { |
| 156 | - if("jxnGenerate" == substr($sQuery, 0, 11)) |
|
| 156 | + if ("jxnGenerate" == substr($sQuery, 0, 11)) |
|
| 157 | 157 | unset($aQueries[$sKey]); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -37,8 +37,7 @@ discard block |
||
| 37 | 37 | if(!empty($_SERVER['HTTP_SCHEME'])) |
| 38 | 38 | { |
| 39 | 39 | $aURL['scheme'] = $_SERVER['HTTP_SCHEME']; |
| 40 | - } |
|
| 41 | - else |
|
| 40 | + } else |
|
| 42 | 41 | { |
| 43 | 42 | $aURL['scheme'] = ((!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off') ? 'https' : 'http'); |
| 44 | 43 | } |
@@ -51,28 +50,23 @@ discard block |
||
| 51 | 50 | if(strpos($_SERVER['HTTP_X_FORWARDED_HOST'], ':') > 0) |
| 52 | 51 | { |
| 53 | 52 | list($aURL['host'], $aURL['port']) = explode(':', $_SERVER['HTTP_X_FORWARDED_HOST']); |
| 54 | - } |
|
| 55 | - else |
|
| 53 | + } else |
|
| 56 | 54 | { |
| 57 | 55 | $aURL['host'] = $_SERVER['HTTP_X_FORWARDED_HOST']; |
| 58 | 56 | } |
| 59 | - } |
|
| 60 | - elseif(!empty($_SERVER['HTTP_HOST'])) |
|
| 57 | + } elseif(!empty($_SERVER['HTTP_HOST'])) |
|
| 61 | 58 | { |
| 62 | 59 | if(strpos($_SERVER['HTTP_HOST'], ':') > 0) |
| 63 | 60 | { |
| 64 | 61 | list($aURL['host'], $aURL['port']) = explode(':', $_SERVER['HTTP_HOST']); |
| 65 | - } |
|
| 66 | - else |
|
| 62 | + } else |
|
| 67 | 63 | { |
| 68 | 64 | $aURL['host'] = $_SERVER['HTTP_HOST']; |
| 69 | 65 | } |
| 70 | - } |
|
| 71 | - elseif(!empty($_SERVER['SERVER_NAME'])) |
|
| 66 | + } elseif(!empty($_SERVER['SERVER_NAME'])) |
|
| 72 | 67 | { |
| 73 | 68 | $aURL['host'] = $_SERVER['SERVER_NAME']; |
| 74 | - } |
|
| 75 | - else |
|
| 69 | + } else |
|
| 76 | 70 | { |
| 77 | 71 | throw new \Jaxon\Exception\URI(); |
| 78 | 72 | } |
@@ -94,8 +88,7 @@ discard block |
||
| 94 | 88 | if(!empty($_SERVER['PATH_INFO'])) |
| 95 | 89 | { |
| 96 | 90 | $sPath = parse_url($_SERVER['PATH_INFO']); |
| 97 | - } |
|
| 98 | - else |
|
| 91 | + } else |
|
| 99 | 92 | { |
| 100 | 93 | $sPath = parse_url($_SERVER['PHP_SELF']); |
| 101 | 94 | } |
@@ -153,8 +146,9 @@ discard block |
||
| 153 | 146 | |
| 154 | 147 | foreach($aQueries as $sKey => $sQuery) |
| 155 | 148 | { |
| 156 | - if("jxnGenerate" == substr($sQuery, 0, 11)) |
|
| 157 | - unset($aQueries[$sKey]); |
|
| 149 | + if("jxnGenerate" == substr($sQuery, 0, 11)) { |
|
| 150 | + unset($aQueries[$sKey]); |
|
| 151 | + } |
|
| 158 | 152 | } |
| 159 | 153 | |
| 160 | 154 | $sQueries = implode("&", $aQueries); |
@@ -29,13 +29,13 @@ discard block |
||
| 29 | 29 | public static function read($sConfigFile, $sLibKey = '', $sAppKey = null) |
| 30 | 30 | { |
| 31 | 31 | $sConfigFile = realpath($sConfigFile); |
| 32 | - if(!is_readable($sConfigFile)) |
|
| 32 | + if (!is_readable($sConfigFile)) |
|
| 33 | 33 | { |
| 34 | 34 | throw new \Jaxon\Exception\Config\File(jaxon_trans('config.errors.file.access', array('path' => $sConfigFile))); |
| 35 | 35 | } |
| 36 | 36 | $sFileContent = file_get_contents($sConfigFile); |
| 37 | 37 | $aConfigOptions = json_decode($sFileContent, true); |
| 38 | - if(!is_array($aConfigOptions)) |
|
| 38 | + if (!is_array($aConfigOptions)) |
|
| 39 | 39 | { |
| 40 | 40 | throw new \Jaxon\Exception\Config\File(jaxon_trans('config.errors.file.content', array('path' => $sConfigFile))); |
| 41 | 41 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $jaxon = jaxon(); |
| 45 | 45 | $jaxon->setOptions($aConfigOptions, $sLibKey); |
| 46 | 46 | $config = null; |
| 47 | - if(is_string($sAppKey)) |
|
| 47 | + if (is_string($sAppKey)) |
|
| 48 | 48 | { |
| 49 | 49 | $config = new Config(); |
| 50 | 50 | $config->setOptions($aConfigOptions, $sAppKey); |