@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | public function confirm($question, $yesScript, $noScript) |
24 | 24 | { |
25 | - if(!$noScript) |
|
25 | + if (!$noScript) |
|
26 | 26 | { |
27 | 27 | return 'if(confirm(' . $question . ')){' . $yesScript . ';}'; |
28 | 28 | } |
@@ -25,8 +25,7 @@ |
||
25 | 25 | if(!$noScript) |
26 | 26 | { |
27 | 27 | return 'if(confirm(' . $question . ')){' . $yesScript . ';}'; |
28 | - } |
|
29 | - else |
|
28 | + } else |
|
30 | 29 | { |
31 | 30 | return 'if(confirm(' . $question . ')){' . $yesScript . ';}else{' . $noScript . ';}'; |
32 | 31 | } |
@@ -91,19 +91,19 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public static function make($xValue) |
93 | 93 | { |
94 | - if($xValue instanceof Interfaces\Parameter) |
|
94 | + if ($xValue instanceof Interfaces\Parameter) |
|
95 | 95 | { |
96 | 96 | return $xValue; |
97 | 97 | } |
98 | - else if(is_numeric($xValue)) |
|
98 | + else if (is_numeric($xValue)) |
|
99 | 99 | { |
100 | 100 | return new Parameter(Jaxon::NUMERIC_VALUE, $xValue); |
101 | 101 | } |
102 | - else if(is_string($xValue)) |
|
102 | + else if (is_string($xValue)) |
|
103 | 103 | { |
104 | 104 | return new Parameter(Jaxon::QUOTED_VALUE, $xValue); |
105 | 105 | } |
106 | - else if(is_bool($xValue)) |
|
106 | + else if (is_bool($xValue)) |
|
107 | 107 | { |
108 | 108 | return new Parameter(Jaxon::BOOL_VALUE, $xValue); |
109 | 109 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | { |
123 | 123 | $sJsCode = ''; |
124 | 124 | $sQuoteCharacter = "'"; |
125 | - switch($this->sType) |
|
125 | + switch ($this->sType) |
|
126 | 126 | { |
127 | 127 | case Jaxon::FORM_VALUES: |
128 | 128 | $sFormID = (string)$this->xValue; |
@@ -130,11 +130,11 @@ discard block |
||
130 | 130 | break; |
131 | 131 | case Jaxon::INPUT_VALUE: |
132 | 132 | $sInputID = (string)$this->xValue; |
133 | - $sJsCode = "jaxon.$(" . $sQuoteCharacter . $sInputID . $sQuoteCharacter . ").value"; |
|
133 | + $sJsCode = "jaxon.$(" . $sQuoteCharacter . $sInputID . $sQuoteCharacter . ").value"; |
|
134 | 134 | break; |
135 | 135 | case Jaxon::CHECKED_VALUE: |
136 | 136 | $sCheckedID = (string)$this->xValue; |
137 | - $sJsCode = "jaxon.$(" . $sQuoteCharacter . $sCheckedID . $sQuoteCharacter . ").checked"; |
|
137 | + $sJsCode = "jaxon.$(" . $sQuoteCharacter . $sCheckedID . $sQuoteCharacter . ").checked"; |
|
138 | 138 | break; |
139 | 139 | case Jaxon::ELEMENT_INNERHTML: |
140 | 140 | $sElementID = (string)$this->xValue; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $sJsCode = (string)$this->xValue; |
154 | 154 | break; |
155 | 155 | case Jaxon::JS_VALUE: |
156 | - if(is_array($this->xValue) || is_object($this->xValue)) |
|
156 | + if (is_array($this->xValue) || is_object($this->xValue)) |
|
157 | 157 | { |
158 | 158 | // Unable to use double quotes here because they cannot be handled on client side. |
159 | 159 | // So we are using simple quotes even if the Json standard recommends double quotes. |
@@ -94,20 +94,16 @@ discard block |
||
94 | 94 | if($xValue instanceof Interfaces\Parameter) |
95 | 95 | { |
96 | 96 | return $xValue; |
97 | - } |
|
98 | - else if(is_numeric($xValue)) |
|
97 | + } else if(is_numeric($xValue)) |
|
99 | 98 | { |
100 | 99 | return new Parameter(Jaxon::NUMERIC_VALUE, $xValue); |
101 | - } |
|
102 | - else if(is_string($xValue)) |
|
100 | + } else if(is_string($xValue)) |
|
103 | 101 | { |
104 | 102 | return new Parameter(Jaxon::QUOTED_VALUE, $xValue); |
105 | - } |
|
106 | - else if(is_bool($xValue)) |
|
103 | + } else if(is_bool($xValue)) |
|
107 | 104 | { |
108 | 105 | return new Parameter(Jaxon::BOOL_VALUE, $xValue); |
109 | - } |
|
110 | - else // if(is_array($xValue) || is_object($xValue)) |
|
106 | + } else // if(is_array($xValue) || is_object($xValue)) |
|
111 | 107 | { |
112 | 108 | return new Parameter(Jaxon::JS_VALUE, $xValue); |
113 | 109 | } |
@@ -158,8 +154,7 @@ discard block |
||
158 | 154 | // Unable to use double quotes here because they cannot be handled on client side. |
159 | 155 | // So we are using simple quotes even if the Json standard recommends double quotes. |
160 | 156 | $sJsCode = str_replace(['"'], ["'"], json_encode($this->xValue, JSON_HEX_APOS | JSON_HEX_QUOT)); |
161 | - } |
|
162 | - else |
|
157 | + } else |
|
163 | 158 | { |
164 | 159 | $sJsCode = (string)$this->xValue; |
165 | 160 | } |
@@ -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 | - else if(!empty($_SERVER['HTTP_HOST'])) |
|
60 | + else if (!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 | - else if(!empty($_SERVER['SERVER_NAME'])) |
|
71 | + else if (!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 | - else if(!empty($_SERVER['HTTP_HOST'])) |
|
57 | + } else if(!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 | - else if(!empty($_SERVER['SERVER_NAME'])) |
|
66 | + } else if(!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); |
@@ -27,7 +27,7 @@ |
||
27 | 27 | public function render($sPath, array $aVars = array()) |
28 | 28 | { |
29 | 29 | // Make the template vars available as attributes |
30 | - foreach($aVars as $sName => $xValue) |
|
30 | + foreach ($aVars as $sName => $xValue) |
|
31 | 31 | { |
32 | 32 | $sName = (string)$sName; |
33 | 33 | $this->$sName = $xValue; |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function addNamespace($sNamespace, $sDirectory, $sExtension = '') |
46 | 46 | { |
47 | 47 | // The 'jaxon' key cannot be overriden |
48 | - if($sNamespace == 'jaxon') |
|
48 | + if ($sNamespace == 'jaxon') |
|
49 | 49 | { |
50 | 50 | return; |
51 | 51 | } |
@@ -82,18 +82,18 @@ discard block |
||
82 | 82 | // Get the namespace name |
83 | 83 | $sNamespace = ''; |
84 | 84 | $iSeparatorPosition = strrpos($sTemplate, '::'); |
85 | - if($iSeparatorPosition !== false) |
|
85 | + if ($iSeparatorPosition !== false) |
|
86 | 86 | { |
87 | 87 | $sNamespace = substr($sTemplate, 0, $iSeparatorPosition); |
88 | 88 | $sTemplate = substr($sTemplate, $iSeparatorPosition + 2); |
89 | 89 | } |
90 | 90 | // The default namespace is 'jaxon' |
91 | - if(!($sNamespace = trim($sNamespace))) |
|
91 | + if (!($sNamespace = trim($sNamespace))) |
|
92 | 92 | { |
93 | 93 | $sNamespace = 'jaxon'; |
94 | 94 | } |
95 | 95 | // Check if the namespace is defined |
96 | - if(!key_exists($sNamespace, $this->aNamespaces)) |
|
96 | + if (!key_exists($sNamespace, $this->aNamespaces)) |
|
97 | 97 | { |
98 | 98 | return false; |
99 | 99 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | protected function getPrevLink() |
57 | 57 | { |
58 | - if(!($sCall = $this->xPaginator->getPrevCall())) |
|
58 | + if (!($sCall = $this->xPaginator->getPrevCall())) |
|
59 | 59 | { |
60 | 60 | return ''; |
61 | 61 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | protected function getNextLink() |
71 | 71 | { |
72 | - if(!($sCall = $this->xPaginator->getNextCall())) |
|
72 | + if (!($sCall = $this->xPaginator->getNextCall())) |
|
73 | 73 | { |
74 | 74 | return ''; |
75 | 75 | } |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | protected function getLinks() |
85 | 85 | { |
86 | 86 | $sLinks = ''; |
87 | - foreach($this->xPaginator->getPages() as $page) |
|
87 | + foreach ($this->xPaginator->getPages() as $page) |
|
88 | 88 | { |
89 | - if($page['call']) |
|
89 | + if ($page['call']) |
|
90 | 90 | { |
91 | 91 | $sTemplate = ($page['isCurrent'] ? 'pagination::links/current' : 'pagination::links/enabled'); |
92 | 92 | $sLinks .= $this->_render($sTemplate, ['call' => $page['call'], 'text' => $page['num']]); |
@@ -90,8 +90,7 @@ |
||
90 | 90 | { |
91 | 91 | $sTemplate = ($page['isCurrent'] ? 'pagination::links/current' : 'pagination::links/enabled'); |
92 | 92 | $sLinks .= $this->_render($sTemplate, ['call' => $page['call'], 'text' => $page['num']]); |
93 | - } |
|
94 | - else |
|
93 | + } else |
|
95 | 94 | { |
96 | 95 | $sLinks .= $this->_render('pagination::links/disabled', ['text' => $page['num']]); |
97 | 96 | } |
@@ -29,12 +29,12 @@ 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 | $aConfigOptions = include($sConfigFile); |
37 | - if(!is_array($aConfigOptions)) |
|
37 | + if (!is_array($aConfigOptions)) |
|
38 | 38 | { |
39 | 39 | throw new \Jaxon\Exception\Config\File(jaxon_trans('config.errors.file.content', array('path' => $sConfigFile))); |
40 | 40 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | // Setup the config options into the library. |
43 | 43 | $jaxon = jaxon(); |
44 | 44 | $jaxon->setOptions($aConfigOptions, $sLibKey); |
45 | - if(!is_string($sAppKey)) |
|
45 | + if (!is_string($sAppKey)) |
|
46 | 46 | { |
47 | 47 | return null; |
48 | 48 | } |
@@ -29,16 +29,16 @@ discard block |
||
29 | 29 | public static function read($sConfigFile, $sLibKey = '', $sAppKey = null) |
30 | 30 | { |
31 | 31 | $sConfigFile = realpath($sConfigFile); |
32 | - if(!extension_loaded('yaml')) |
|
32 | + if (!extension_loaded('yaml')) |
|
33 | 33 | { |
34 | 34 | throw new \Jaxon\Exception\Config\Yaml(jaxon_trans('config.errors.yaml.install')); |
35 | 35 | } |
36 | - if(!is_readable($sConfigFile)) |
|
36 | + if (!is_readable($sConfigFile)) |
|
37 | 37 | { |
38 | 38 | throw new \Jaxon\Exception\Config\File(jaxon_trans('config.errors.file.access', array('path' => $sConfigFile))); |
39 | 39 | } |
40 | 40 | $aConfigOptions = yaml_parse_file($sConfigFile); |
41 | - if(!is_array($aConfigOptions)) |
|
41 | + if (!is_array($aConfigOptions)) |
|
42 | 42 | { |
43 | 43 | throw new \Jaxon\Exception\Config\File(jaxon_trans('config.errors.file.content', array('path' => $sConfigFile))); |
44 | 44 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | // Setup the config options into the library. |
47 | 47 | $jaxon = jaxon(); |
48 | 48 | $jaxon->setOptions($aConfigOptions, $sLibKey); |
49 | - if(!is_string($sAppKey)) |
|
49 | + if (!is_string($sAppKey)) |
|
50 | 50 | { |
51 | 51 | return null; |
52 | 52 | } |
@@ -50,17 +50,17 @@ 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 | 58 | $aValues = false; |
59 | - foreach($aOptions as $sName => $xOption) |
|
59 | + foreach ($aOptions as $sName => $xOption) |
|
60 | 60 | { |
61 | - if(is_int($sName)) |
|
61 | + if (is_int($sName)) |
|
62 | 62 | { |
63 | - if(is_array($aValues)) |
|
63 | + if (is_array($aValues)) |
|
64 | 64 | { |
65 | 65 | $aValues[] = $xOption; |
66 | 66 | } |
@@ -73,18 +73,18 @@ discard block |
||
73 | 73 | |
74 | 74 | $sName = trim($sName); |
75 | 75 | $sFullName = ($sPrefix) ? $sPrefix . '.' . $sName : $sName; |
76 | - if(is_array($xOption)) |
|
76 | + if (is_array($xOption)) |
|
77 | 77 | { |
78 | 78 | // Recursively read the options in the array |
79 | 79 | $this->_setOptions($xOption, $sFullName, $nDepth + 1); |
80 | 80 | } |
81 | - else if(is_string($xOption) || is_numeric($xOption) || is_bool($xOption)) |
|
81 | + else if (is_string($xOption) || is_numeric($xOption) || is_bool($xOption)) |
|
82 | 82 | { |
83 | 83 | // Save the value of this option |
84 | 84 | $this->aOptions[$sFullName] = $xOption; |
85 | 85 | } |
86 | 86 | } |
87 | - if(is_array($aValues) && ($sPrefix)) |
|
87 | + if (is_array($aValues) && ($sPrefix)) |
|
88 | 88 | { |
89 | 89 | $this->aOptions[$sPrefix] = $aValues; |
90 | 90 | } |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | $aKeys = explode('.', (string)$sKeys); |
105 | 105 | foreach ($aKeys as $sKey) |
106 | 106 | { |
107 | - if(($sKey)) |
|
107 | + if (($sKey)) |
|
108 | 108 | { |
109 | - if(!array_key_exists($sKey, $aOptions) || !is_array($aOptions[$sKey])) |
|
109 | + if (!array_key_exists($sKey, $aOptions) || !is_array($aOptions[$sKey])) |
|
110 | 110 | { |
111 | 111 | throw new \Jaxon\Exception\Config\Data(jaxon_trans('config.errors.data.missing', array('key' => $sKeys))); |
112 | 112 | } |
@@ -154,13 +154,12 @@ discard block |
||
154 | 154 | $sPrefix = rtrim($sPrefix, '.') . '.'; |
155 | 155 | $sPrefixLen = strlen($sPrefix); |
156 | 156 | $aOptions = array(); |
157 | - foreach($this->aOptions as $sName => $xValue) |
|
157 | + foreach ($this->aOptions as $sName => $xValue) |
|
158 | 158 | { |
159 | - if(substr($sName, 0, $sPrefixLen) == $sPrefix) |
|
159 | + if (substr($sName, 0, $sPrefixLen) == $sPrefix) |
|
160 | 160 | { |
161 | 161 | $iNextDotPos = strpos($sName, '.', $sPrefixLen); |
162 | - $sOptionName = $iNextDotPos === false ? substr($sName, $sPrefixLen) : |
|
163 | - substr($sName, $sPrefixLen, $iNextDotPos - $sPrefixLen); |
|
162 | + $sOptionName = $iNextDotPos === false ? substr($sName, $sPrefixLen) : substr($sName, $sPrefixLen, $iNextDotPos - $sPrefixLen); |
|
164 | 163 | $aOptions[$sOptionName] = $sPrefix . $sOptionName; |
165 | 164 | } |
166 | 165 | } |
@@ -63,8 +63,7 @@ discard block |
||
63 | 63 | if(is_array($aValues)) |
64 | 64 | { |
65 | 65 | $aValues[] = $xOption; |
66 | - } |
|
67 | - else |
|
66 | + } else |
|
68 | 67 | { |
69 | 68 | $aValues = array($xOption); |
70 | 69 | } |
@@ -77,8 +76,7 @@ discard block |
||
77 | 76 | { |
78 | 77 | // Recursively read the options in the array |
79 | 78 | $this->_setOptions($xOption, $sFullName, $nDepth + 1); |
80 | - } |
|
81 | - else if(is_string($xOption) || is_numeric($xOption) || is_bool($xOption)) |
|
79 | + } else if(is_string($xOption) || is_numeric($xOption) || is_bool($xOption)) |
|
82 | 80 | { |
83 | 81 | // Save the value of this option |
84 | 82 | $this->aOptions[$sFullName] = $xOption; |