@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | private function getJsLibExt() |
103 | 103 | { |
104 | - if(($this->getOption('js.app.minify'))) |
|
104 | + if (($this->getOption('js.app.minify'))) |
|
105 | 105 | { |
106 | 106 | return '.min.js'; |
107 | 107 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | // Check config options |
119 | 119 | // - The js.app.export option must be set to true |
120 | 120 | // - The js.app.uri and js.app.dir options must be set to non null values |
121 | - if(!$this->getOption('js.app.export') || |
|
121 | + if (!$this->getOption('js.app.export') || |
|
122 | 122 | !$this->getOption('js.app.uri') || |
123 | 123 | !$this->getOption('js.app.dir')) |
124 | 124 | { |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | // Check dir access |
128 | 128 | // - The js.app.dir must be writable |
129 | 129 | $sJsAppDir = $this->getOption('js.app.dir'); |
130 | - if(!is_dir($sJsAppDir) || !is_writable($sJsAppDir)) |
|
130 | + if (!is_dir($sJsAppDir) || !is_writable($sJsAppDir)) |
|
131 | 131 | { |
132 | 132 | return false; |
133 | 133 | } |
@@ -142,11 +142,11 @@ discard block |
||
142 | 142 | private function generateHash() |
143 | 143 | { |
144 | 144 | $sHash = jaxon()->getVersion(); |
145 | - foreach($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
145 | + foreach ($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
146 | 146 | { |
147 | 147 | $sHash .= $xPlugin->generateHash(); |
148 | 148 | } |
149 | - foreach($this->xPluginManager->getResponsePlugins() as $xPlugin) |
|
149 | + foreach ($this->xPluginManager->getResponsePlugins() as $xPlugin) |
|
150 | 150 | { |
151 | 151 | $sHash .= $xPlugin->generateHash(); |
152 | 152 | } |
@@ -160,25 +160,25 @@ discard block |
||
160 | 160 | */ |
161 | 161 | private function makePluginsCode() |
162 | 162 | { |
163 | - if($this->sCssCode === null || $this->sJsCode === null || $this->sJsScript === null) |
|
163 | + if ($this->sCssCode === null || $this->sJsCode === null || $this->sJsScript === null) |
|
164 | 164 | { |
165 | 165 | $this->sCssCode = ''; |
166 | 166 | $this->sJsCode = ''; |
167 | 167 | $this->sJsScript = ''; |
168 | - foreach($this->xPluginManager->getPlugins() as $xPlugin) |
|
168 | + foreach ($this->xPluginManager->getPlugins() as $xPlugin) |
|
169 | 169 | { |
170 | - if($xPlugin instanceof Response) |
|
170 | + if ($xPlugin instanceof Response) |
|
171 | 171 | { |
172 | - if(($sCssCode = trim($xPlugin->getCss()))) |
|
172 | + if (($sCssCode = trim($xPlugin->getCss()))) |
|
173 | 173 | { |
174 | 174 | $this->sCssCode .= rtrim($sCssCode, " \n") . "\n"; |
175 | 175 | } |
176 | - if(($sJsCode = trim($xPlugin->getJs()))) |
|
176 | + if (($sJsCode = trim($xPlugin->getJs()))) |
|
177 | 177 | { |
178 | 178 | $this->sJsCode .= rtrim($sJsCode, " \n") . "\n"; |
179 | 179 | } |
180 | 180 | } |
181 | - if(($sJsScript = trim($xPlugin->getScript()))) |
|
181 | + if (($sJsScript = trim($xPlugin->getScript()))) |
|
182 | 182 | { |
183 | 183 | $this->sJsScript .= trim($sJsScript, " \n") . "\n"; |
184 | 184 | } |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | |
220 | 220 | // Add component files to the javascript file array; |
221 | 221 | $aJsFiles = [$sJsCoreUrl]; |
222 | - if($this->getOption('core.debug.on')) |
|
222 | + if ($this->getOption('core.debug.on')) |
|
223 | 223 | { |
224 | 224 | $aJsFiles[] = $sJsDebugUrl; |
225 | 225 | $aJsFiles[] = $sJsLanguageUrl; |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | */ |
318 | 318 | public function getScript($bIncludeJs = false, $bIncludeCss = false) |
319 | 319 | { |
320 | - if(!$this->getOption('core.request.uri')) |
|
320 | + if (!$this->getOption('core.request.uri')) |
|
321 | 321 | { |
322 | 322 | $this->setOption('core.request.uri', URI::detect()); |
323 | 323 | } |
@@ -326,16 +326,16 @@ discard block |
||
326 | 326 | $this->makePluginsCode(); |
327 | 327 | |
328 | 328 | $sScript = ''; |
329 | - if(($bIncludeCss)) |
|
329 | + if (($bIncludeCss)) |
|
330 | 330 | { |
331 | 331 | $sScript .= $this->getCss() . "\n"; |
332 | 332 | } |
333 | - if(($bIncludeJs)) |
|
333 | + if (($bIncludeJs)) |
|
334 | 334 | { |
335 | 335 | $sScript .= $this->getJs() . "\n"; |
336 | 336 | } |
337 | 337 | |
338 | - if($this->canExportJavascript()) |
|
338 | + if ($this->canExportJavascript()) |
|
339 | 339 | { |
340 | 340 | $sJsAppURI = rtrim($this->getOption('js.app.uri'), '/') . '/'; |
341 | 341 | $sJsAppDir = rtrim($this->getOption('js.app.dir'), '/') . '/'; |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | $sExtension = $this->getJsLibExt(); |
344 | 344 | |
345 | 345 | // Check if the final file already exists |
346 | - if(($sFinalFile) && is_file($sJsAppDir . $sFinalFile . $sExtension)) |
|
346 | + if (($sFinalFile) && is_file($sJsAppDir . $sFinalFile . $sExtension)) |
|
347 | 347 | { |
348 | 348 | $sOutFile = $sFinalFile . $sExtension; |
349 | 349 | } |
@@ -353,25 +353,25 @@ discard block |
||
353 | 353 | $sHash = $this->generateHash(); |
354 | 354 | $sOutFile = $sHash . '.js'; |
355 | 355 | $sMinFile = $sHash . '.min.js'; |
356 | - if(!is_file($sJsAppDir . $sOutFile)) |
|
356 | + if (!is_file($sJsAppDir . $sOutFile)) |
|
357 | 357 | { |
358 | 358 | file_put_contents($sJsAppDir . $sOutFile, $this->_getScript()); |
359 | 359 | } |
360 | - if(($this->getOption('js.app.minify'))) |
|
360 | + if (($this->getOption('js.app.minify'))) |
|
361 | 361 | { |
362 | - if(is_file($sJsAppDir . $sMinFile)) |
|
362 | + if (is_file($sJsAppDir . $sMinFile)) |
|
363 | 363 | { |
364 | 364 | $sOutFile = $sMinFile; // The file was already minified |
365 | 365 | } |
366 | - elseif(($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile))) |
|
366 | + elseif (($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile))) |
|
367 | 367 | { |
368 | 368 | $sOutFile = $sMinFile; |
369 | 369 | } |
370 | 370 | } |
371 | 371 | // Copy the file to its final location |
372 | - if(($sFinalFile)) |
|
372 | + if (($sFinalFile)) |
|
373 | 373 | { |
374 | - if(copy($sJsAppDir . $sOutFile, $sJsAppDir . $sFinalFile . $sExtension)) |
|
374 | + if (copy($sJsAppDir . $sOutFile, $sJsAppDir . $sFinalFile . $sExtension)) |
|
375 | 375 | { |
376 | 376 | $sOutFile = $sFinalFile . $sExtension; |
377 | 377 | } |