@@ -84,19 +84,19 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public static function make($xValue) |
| 86 | 86 | { |
| 87 | - if($xValue instanceof Interfaces\Parameter) |
|
| 87 | + if ($xValue instanceof Interfaces\Parameter) |
|
| 88 | 88 | { |
| 89 | 89 | return $xValue; |
| 90 | 90 | } |
| 91 | - elseif(is_numeric($xValue)) |
|
| 91 | + elseif (is_numeric($xValue)) |
|
| 92 | 92 | { |
| 93 | 93 | return new Parameter(Jaxon::NUMERIC_VALUE, $xValue); |
| 94 | 94 | } |
| 95 | - elseif(is_string($xValue)) |
|
| 95 | + elseif (is_string($xValue)) |
|
| 96 | 96 | { |
| 97 | 97 | return new Parameter(Jaxon::QUOTED_VALUE, $xValue); |
| 98 | 98 | } |
| 99 | - elseif(is_bool($xValue)) |
|
| 99 | + elseif (is_bool($xValue)) |
|
| 100 | 100 | { |
| 101 | 101 | return new Parameter(Jaxon::BOOL_VALUE, $xValue); |
| 102 | 102 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | public function getScript() |
| 141 | 141 | { |
| 142 | 142 | $sJsCode = ''; |
| 143 | - switch($this->sType) |
|
| 143 | + switch ($this->sType) |
|
| 144 | 144 | { |
| 145 | 145 | case Jaxon::FORM_VALUES: |
| 146 | 146 | $sJsCode = $this->getJsCall('getFormValues', $this->xValue); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $sJsCode = (string)$this->xValue; |
| 168 | 168 | break; |
| 169 | 169 | case Jaxon::JS_VALUE: |
| 170 | - if(is_array($this->xValue) || is_object($this->xValue)) |
|
| 170 | + if (is_array($this->xValue) || is_object($this->xValue)) |
|
| 171 | 171 | { |
| 172 | 172 | // Unable to use double quotes here because they cannot be handled on client side. |
| 173 | 173 | // So we are using simple quotes even if the Json standard recommends double quotes. |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | private function getJsLibUri() |
| 75 | 75 | { |
| 76 | - if(!$this->hasOption('js.lib.uri')) |
|
| 76 | + if (!$this->hasOption('js.lib.uri')) |
|
| 77 | 77 | { |
| 78 | 78 | // return 'https://cdn.jsdelivr.net/jaxon/1.2.0/'; |
| 79 | 79 | return 'https://cdn.jsdelivr.net/gh/jaxon-php/[email protected]/dist/'; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | // The jsDelivr CDN only hosts minified files |
| 97 | 97 | // if(($this->getOption('js.app.minify')) || substr($this->getJsLibUri(), 0, $nLen) == $jsDelivrUri) |
| 98 | 98 | // Starting from version 2.0.0 of the js lib, the jsDelivr CDN also hosts non minified files. |
| 99 | - if(($this->getOption('js.app.minify'))) |
|
| 99 | + if (($this->getOption('js.app.minify'))) |
|
| 100 | 100 | { |
| 101 | 101 | return '.min.js'; |
| 102 | 102 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | // Check config options |
| 114 | 114 | // - The js.app.extern option must be set to true |
| 115 | 115 | // - The js.app.uri and js.app.dir options must be set to non null values |
| 116 | - if(!$this->getOption('js.app.extern') || |
|
| 116 | + if (!$this->getOption('js.app.extern') || |
|
| 117 | 117 | !$this->getOption('js.app.uri') || |
| 118 | 118 | !$this->getOption('js.app.dir')) |
| 119 | 119 | { |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | // Check dir access |
| 123 | 123 | // - The js.app.dir must be writable |
| 124 | 124 | $sJsAppDir = $this->getOption('js.app.dir'); |
| 125 | - if(!is_dir($sJsAppDir) || !is_writable($sJsAppDir)) |
|
| 125 | + if (!is_dir($sJsAppDir) || !is_writable($sJsAppDir)) |
|
| 126 | 126 | { |
| 127 | 127 | return false; |
| 128 | 128 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | private function setTemplateCacheDir() |
| 138 | 138 | { |
| 139 | - if($this->hasOption('core.template.cache_dir')) |
|
| 139 | + if ($this->hasOption('core.template.cache_dir')) |
|
| 140 | 140 | { |
| 141 | 141 | $this->setCacheDir($this->getOption('core.template.cache_dir')); |
| 142 | 142 | } |
@@ -150,11 +150,11 @@ discard block |
||
| 150 | 150 | private function generateHash() |
| 151 | 151 | { |
| 152 | 152 | $sHash = jaxon()->getVersion(); |
| 153 | - foreach($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
| 153 | + foreach ($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
| 154 | 154 | { |
| 155 | 155 | $sHash .= $xPlugin->generateHash(); |
| 156 | 156 | } |
| 157 | - foreach($this->xPluginManager->getResponsePlugins() as $xPlugin) |
|
| 157 | + foreach ($this->xPluginManager->getResponsePlugins() as $xPlugin) |
|
| 158 | 158 | { |
| 159 | 159 | $sHash .= $xPlugin->generateHash(); |
| 160 | 160 | } |
@@ -168,49 +168,49 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | private function makePluginsCode() |
| 170 | 170 | { |
| 171 | - if($this->sCssCode === null || $this->sJsCode === null || $this->sJsReady === null) |
|
| 171 | + if ($this->sCssCode === null || $this->sJsCode === null || $this->sJsReady === null) |
|
| 172 | 172 | { |
| 173 | 173 | $this->sCssCode = ''; |
| 174 | 174 | $this->sJsCode = ''; |
| 175 | 175 | $this->sJsReady = ''; |
| 176 | - foreach($this->xPluginManager->getResponsePlugins() as $xResponsePlugin) |
|
| 176 | + foreach ($this->xPluginManager->getResponsePlugins() as $xResponsePlugin) |
|
| 177 | 177 | { |
| 178 | - if(($sCssCode = trim($xResponsePlugin->getCss()))) |
|
| 178 | + if (($sCssCode = trim($xResponsePlugin->getCss()))) |
|
| 179 | 179 | { |
| 180 | 180 | $this->sCssCode .= rtrim($sCssCode, " \n") . "\n"; |
| 181 | 181 | } |
| 182 | - if(($sJsCode = trim($xResponsePlugin->getJs()))) |
|
| 182 | + if (($sJsCode = trim($xResponsePlugin->getJs()))) |
|
| 183 | 183 | { |
| 184 | 184 | $this->sJsCode .= rtrim($sJsCode, " \n") . "\n"; |
| 185 | 185 | } |
| 186 | - if(($sJsReady = trim($xResponsePlugin->getScript()))) |
|
| 186 | + if (($sJsReady = trim($xResponsePlugin->getScript()))) |
|
| 187 | 187 | { |
| 188 | 188 | $this->sJsReady .= trim($sJsReady, " \n") . "\n"; |
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | $this->sJsReady = $this->render('jaxon::plugins/ready.js', ['sPluginScript' => $this->sJsReady]); |
| 193 | - foreach($this->xPluginManager->getRequestPlugins() as $xRequestPlugin) |
|
| 193 | + foreach ($this->xPluginManager->getRequestPlugins() as $xRequestPlugin) |
|
| 194 | 194 | { |
| 195 | - if(($sJsReady = trim($xRequestPlugin->getScript()))) |
|
| 195 | + if (($sJsReady = trim($xRequestPlugin->getScript()))) |
|
| 196 | 196 | { |
| 197 | 197 | $this->sJsReady .= trim($sJsReady, " \n") . "\n"; |
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - foreach($this->xPluginManager->getPackages() as $sPackageClass) |
|
| 201 | + foreach ($this->xPluginManager->getPackages() as $sPackageClass) |
|
| 202 | 202 | { |
| 203 | 203 | $xPackage = jaxon()->di()->get($sPackageClass); |
| 204 | - if(($sCssCode = trim($xPackage->css()))) |
|
| 204 | + if (($sCssCode = trim($xPackage->css()))) |
|
| 205 | 205 | { |
| 206 | 206 | $this->sCssCode .= rtrim($sCssCode, " \n") . "\n"; |
| 207 | 207 | } |
| 208 | - if(($sJsCode = trim($xPackage->js()))) |
|
| 208 | + if (($sJsCode = trim($xPackage->js()))) |
|
| 209 | 209 | { |
| 210 | 210 | $this->sJsCode .= rtrim($sJsCode, " \n") . "\n"; |
| 211 | 211 | } |
| 212 | 212 | $xPackage = jaxon()->di()->get($sClass); |
| 213 | - if(($sJsReady = trim($xPackage->ready()))) |
|
| 213 | + if (($sJsReady = trim($xPackage->ready()))) |
|
| 214 | 214 | { |
| 215 | 215 | $this->sJsReady .= trim($sJsReady, " \n") . "\n"; |
| 216 | 216 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | // Add component files to the javascript file array; |
| 236 | 236 | $aJsFiles = array($sJsCoreUrl); |
| 237 | - if($this->getOption('core.debug.on')) |
|
| 237 | + if ($this->getOption('core.debug.on')) |
|
| 238 | 238 | { |
| 239 | 239 | $aJsFiles[] = $sJsDebugUrl; |
| 240 | 240 | $aJsFiles[] = $sJsLanguageUrl; |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | $this->setTemplateCacheDir(); |
| 330 | 330 | $this->makePluginsCode(); |
| 331 | 331 | |
| 332 | - if($this->canExportJavascript()) |
|
| 332 | + if ($this->canExportJavascript()) |
|
| 333 | 333 | { |
| 334 | 334 | $sJsAppURI = rtrim($this->getOption('js.app.uri'), '/') . '/'; |
| 335 | 335 | $sJsAppDir = rtrim($this->getOption('js.app.dir'), '/') . '/'; |
@@ -338,13 +338,13 @@ discard block |
||
| 338 | 338 | $sHash = $this->generateHash(); |
| 339 | 339 | $sOutFile = $sHash . '.js'; |
| 340 | 340 | $sMinFile = $sHash . '.min.js'; |
| 341 | - if(!is_file($sJsAppDir . $sOutFile)) |
|
| 341 | + if (!is_file($sJsAppDir . $sOutFile)) |
|
| 342 | 342 | { |
| 343 | 343 | file_put_contents($sJsAppDir . $sOutFile, $this->_getScript()); |
| 344 | 344 | } |
| 345 | - if(($this->getOption('js.app.minify')) && !is_file($sJsAppDir . $sMinFile)) |
|
| 345 | + if (($this->getOption('js.app.minify')) && !is_file($sJsAppDir . $sMinFile)) |
|
| 346 | 346 | { |
| 347 | - if(($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile))) |
|
| 347 | + if (($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile))) |
|
| 348 | 348 | { |
| 349 | 349 | $sOutFile = $sMinFile; |
| 350 | 350 | } |