@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | $sPrefix = trim((string)$sPrefix); |
51 | 51 | $nDepth = intval($nDepth); |
52 | 52 | // Check the max depth |
53 | - if($nDepth < 0 || $nDepth > 9) |
|
53 | + if ($nDepth < 0 || $nDepth > 9) |
|
54 | 54 | { |
55 | 55 | throw new \Jaxon\Exception\Config\Data(jaxon_trans('config.errors.data.depth', |
56 | 56 | array('key' => $sPrefix, 'depth' => $nDepth))); |
57 | 57 | } |
58 | - foreach($aOptions as $sName => $xOption) |
|
58 | + foreach ($aOptions as $sName => $xOption) |
|
59 | 59 | { |
60 | - if(is_int($sName)) |
|
60 | + if (is_int($sName)) |
|
61 | 61 | { |
62 | 62 | continue; |
63 | 63 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | // Save the value of this option |
68 | 68 | $this->aOptions[$sFullName] = $xOption; |
69 | 69 | // Save the values of its sub-options |
70 | - if(is_array($xOption)) |
|
70 | + if (is_array($xOption)) |
|
71 | 71 | { |
72 | 72 | // Recursively read the options in the array |
73 | 73 | $this->_setOptions($xOption, $sFullName, $nDepth + 1); |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | $aKeys = explode('.', (string)$sKeys); |
90 | 90 | foreach ($aKeys as $sKey) |
91 | 91 | { |
92 | - if(($sKey)) |
|
92 | + if (($sKey)) |
|
93 | 93 | { |
94 | - if(!array_key_exists($sKey, $aOptions) || !is_array($aOptions[$sKey])) |
|
94 | + if (!array_key_exists($sKey, $aOptions) || !is_array($aOptions[$sKey])) |
|
95 | 95 | { |
96 | 96 | return; |
97 | 97 | } |
@@ -139,13 +139,12 @@ discard block |
||
139 | 139 | $sPrefix = rtrim($sPrefix, '.') . '.'; |
140 | 140 | $sPrefixLen = strlen($sPrefix); |
141 | 141 | $aOptions = array(); |
142 | - foreach($this->aOptions as $sName => $xValue) |
|
142 | + foreach ($this->aOptions as $sName => $xValue) |
|
143 | 143 | { |
144 | - if(substr($sName, 0, $sPrefixLen) == $sPrefix) |
|
144 | + if (substr($sName, 0, $sPrefixLen) == $sPrefix) |
|
145 | 145 | { |
146 | 146 | $iNextDotPos = strpos($sName, '.', $sPrefixLen); |
147 | - $sOptionName = $iNextDotPos === false ? substr($sName, $sPrefixLen) : |
|
148 | - substr($sName, $sPrefixLen, $iNextDotPos - $sPrefixLen); |
|
147 | + $sOptionName = $iNextDotPos === false ? substr($sName, $sPrefixLen) : substr($sName, $sPrefixLen, $iNextDotPos - $sPrefixLen); |
|
149 | 148 | $aOptions[$sOptionName] = $sPrefix . $sOptionName; |
150 | 149 | } |
151 | 150 | } |
@@ -19,8 +19,6 @@ |
||
19 | 19 | |
20 | 20 | namespace Jaxon\Traits; |
21 | 21 | |
22 | -use Jaxon\Utils\Container; |
|
23 | - |
|
24 | 22 | trait Autoload |
25 | 23 | { |
26 | 24 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @param string $sLibKey The key of the library options in the file |
70 | 70 | * @param string|null $sAppKey The key of the application options in the file |
71 | 71 | * |
72 | - * @return array |
|
72 | + * @return null|\Jaxon\Utils\Config\Config |
|
73 | 73 | */ |
74 | 74 | public function readPhpConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
75 | 75 | { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param string $sLibKey The key of the library options in the file |
84 | 84 | * @param string|null $sAppKey The key of the application options in the file |
85 | 85 | * |
86 | - * @return array |
|
86 | + * @return null|\Jaxon\Utils\Config\Config |
|
87 | 87 | */ |
88 | 88 | public function readYamlConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
89 | 89 | { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @param string $sLibKey The key of the library options in the file |
98 | 98 | * @param string|null $sAppKey The key of the application options in the file |
99 | 99 | * |
100 | - * @return array |
|
100 | + * @return \Jaxon\Utils\Config\Config|null |
|
101 | 101 | */ |
102 | 102 | public function readJsonConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
103 | 103 | { |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @param string $sLibKey The key of the library options in the file |
112 | 112 | * @param string|null $sAppKey The key of the application options in the file |
113 | 113 | * |
114 | - * @return array |
|
114 | + * @return null|\Jaxon\Utils\Config\Config |
|
115 | 115 | */ |
116 | 116 | public function readConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
117 | 117 | { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | 'core.prefix.event' => 'jaxon_event_', |
44 | 44 | // 'core.request.uri' => '', |
45 | 45 | 'core.request.mode' => 'asynchronous', |
46 | - 'core.request.method' => 'POST', // W3C: Method is case sensitive |
|
46 | + 'core.request.method' => 'POST', // W3C: Method is case sensitive |
|
47 | 47 | 'core.debug.on' => false, |
48 | 48 | 'core.debug.verbose' => false, |
49 | 49 | 'core.process.exit' => true, |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | public function readConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
117 | 117 | { |
118 | 118 | $sExt = pathinfo($sConfigFile, PATHINFO_EXTENSION); |
119 | - switch($sExt) |
|
119 | + switch ($sExt) |
|
120 | 120 | { |
121 | 121 | case 'php': |
122 | 122 | return $this->readPhpConfigFile($sConfigFile, $sLibKey, $sAppKey); |
@@ -31,7 +31,7 @@ |
||
31 | 31 | * - 1000 thru 8999: User created plugins, typically, these plugins don't care about order |
32 | 32 | * - 9000 thru 9999: Plugins that generally need to be last or near the end of the plugin list |
33 | 33 | * |
34 | - * @param Plugin $xPlugin An instance of a plugin |
|
34 | + * @param \Jaxon\Plugin\Plugin $xPlugin An instance of a plugin |
|
35 | 35 | * @param integer $nPriority The plugin priority, used to order the plugins |
36 | 36 | * |
37 | 37 | * @return void |
@@ -19,8 +19,6 @@ |
||
19 | 19 | |
20 | 20 | namespace Jaxon\Traits; |
21 | 21 | |
22 | -use Jaxon\Utils\Container; |
|
23 | - |
|
24 | 22 | trait Plugin |
25 | 23 | { |
26 | 24 | /** |
@@ -46,7 +46,7 @@ |
||
46 | 46 | /** |
47 | 47 | * Check uploaded files validity and move them to the user dir |
48 | 48 | * |
49 | - * @return boolean |
|
49 | + * @return null|boolean |
|
50 | 50 | */ |
51 | 51 | public function saveUploadedFiles() |
52 | 52 | { |
@@ -19,11 +19,6 @@ |
||
19 | 19 | |
20 | 20 | namespace Jaxon\Traits; |
21 | 21 | |
22 | -use Jaxon\Plugin\Manager as PluginManager; |
|
23 | -use Jaxon\Request\Manager as RequestManager; |
|
24 | -use Jaxon\Response\Manager as ResponseManager; |
|
25 | - |
|
26 | -use Jaxon\Utils\URI; |
|
27 | 22 | use Exception; |
28 | 23 | use Closure; |
29 | 24 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | trait Upload |
31 | 31 | { |
32 | - /** |
|
32 | + /** |
|
33 | 33 | * Check if uploaded files are available |
34 | 34 | * |
35 | 35 | * @return boolean |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | return $xUploadPlugin->canProcessRequest(); |
44 | 44 | } |
45 | 45 | |
46 | - /** |
|
46 | + /** |
|
47 | 47 | * Check uploaded files validity and move them to the user dir |
48 | 48 | * |
49 | 49 | * @return boolean |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function hasUploadedFiles() |
38 | 38 | { |
39 | - if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
39 | + if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
40 | 40 | { |
41 | 41 | return false; |
42 | 42 | } |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | { |
53 | 53 | try |
54 | 54 | { |
55 | - if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
55 | + if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
56 | 56 | { |
57 | 57 | throw new Exception($this->trans('errors.upload.plugin')); |
58 | 58 | } |
59 | - elseif(!$xUploadPlugin->canProcessRequest()) |
|
59 | + elseif (!$xUploadPlugin->canProcessRequest()) |
|
60 | 60 | { |
61 | 61 | throw new Exception($this->trans('errors.upload.request')); |
62 | 62 | } |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | $sResponse = '{"code": "success", "upl": "' . $sKey . '"}'; |
66 | 66 | $return = true; |
67 | 67 | } |
68 | - catch(Exception $e) |
|
68 | + catch (Exception $e) |
|
69 | 69 | { |
70 | 70 | $sResponse = '{"code": "error", "msg": "' . addslashes($e->getMessage()) . '"}'; |
71 | 71 | $return = false; |
72 | 72 | } |
73 | 73 | // Send the response back to the browser |
74 | 74 | echo '<script>var res = ', $sResponse, '; </script>'; |
75 | - if(($this->getOption('core.process.exit'))) |
|
75 | + if (($this->getOption('core.process.exit'))) |
|
76 | 76 | { |
77 | 77 | exit(); |
78 | 78 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function getUploadedFiles() |
88 | 88 | { |
89 | - if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
89 | + if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
90 | 90 | { |
91 | 91 | return []; |
92 | 92 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function setUploadFileFilter(Closure $fFileFilter) |
104 | 104 | { |
105 | - if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
105 | + if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
106 | 106 | { |
107 | 107 | return; |
108 | 108 | } |
@@ -55,8 +55,7 @@ discard block |
||
55 | 55 | if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
56 | 56 | { |
57 | 57 | throw new Exception($this->trans('errors.upload.plugin')); |
58 | - } |
|
59 | - elseif(!$xUploadPlugin->canProcessRequest()) |
|
58 | + } elseif(!$xUploadPlugin->canProcessRequest()) |
|
60 | 59 | { |
61 | 60 | throw new Exception($this->trans('errors.upload.request')); |
62 | 61 | } |
@@ -64,8 +63,7 @@ discard block |
||
64 | 63 | $sKey = $xUploadPlugin->saveUploadedFiles(); |
65 | 64 | $sResponse = '{"code": "success", "upl": "' . $sKey . '"}'; |
66 | 65 | $return = true; |
67 | - } |
|
68 | - catch(Exception $e) |
|
66 | + } catch(Exception $e) |
|
69 | 67 | { |
70 | 68 | $sResponse = '{"code": "error", "msg": "' . addslashes($e->getMessage()) . '"}'; |
71 | 69 | $return = false; |