@@ -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,48 +168,48 @@ 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 | - if(($sJsReady = trim($xPackage->ready()))) |
|
| 212 | + if (($sJsReady = trim($xPackage->ready()))) |
|
| 213 | 213 | { |
| 214 | 214 | $this->sJsReady .= trim($sJsReady, " \n") . "\n"; |
| 215 | 215 | } |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | // Add component files to the javascript file array; |
| 235 | 235 | $aJsFiles = array($sJsCoreUrl); |
| 236 | - if($this->getOption('core.debug.on')) |
|
| 236 | + if ($this->getOption('core.debug.on')) |
|
| 237 | 237 | { |
| 238 | 238 | $aJsFiles[] = $sJsDebugUrl; |
| 239 | 239 | $aJsFiles[] = $sJsLanguageUrl; |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | $this->setTemplateCacheDir(); |
| 329 | 329 | $this->makePluginsCode(); |
| 330 | 330 | |
| 331 | - if($this->canExportJavascript()) |
|
| 331 | + if ($this->canExportJavascript()) |
|
| 332 | 332 | { |
| 333 | 333 | $sJsAppURI = rtrim($this->getOption('js.app.uri'), '/') . '/'; |
| 334 | 334 | $sJsAppDir = rtrim($this->getOption('js.app.dir'), '/') . '/'; |
@@ -337,13 +337,13 @@ discard block |
||
| 337 | 337 | $sHash = $this->generateHash(); |
| 338 | 338 | $sOutFile = $sHash . '.js'; |
| 339 | 339 | $sMinFile = $sHash . '.min.js'; |
| 340 | - if(!is_file($sJsAppDir . $sOutFile)) |
|
| 340 | + if (!is_file($sJsAppDir . $sOutFile)) |
|
| 341 | 341 | { |
| 342 | 342 | file_put_contents($sJsAppDir . $sOutFile, $this->_getScript()); |
| 343 | 343 | } |
| 344 | - if(($this->getOption('js.app.minify')) && !is_file($sJsAppDir . $sMinFile)) |
|
| 344 | + if (($this->getOption('js.app.minify')) && !is_file($sJsAppDir . $sMinFile)) |
|
| 345 | 345 | { |
| 346 | - if(($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile))) |
|
| 346 | + if (($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile))) |
|
| 347 | 347 | { |
| 348 | 348 | $sOutFile = $sMinFile; |
| 349 | 349 | } |