@@ -93,6 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | /** |
95 | 95 | * @param boolean whether the keys are case-sensitive. |
96 | + * @param boolean $value |
|
96 | 97 | */ |
97 | 98 | public function setCaseSensitive($value) |
98 | 99 | { |
@@ -126,6 +127,7 @@ discard block |
||
126 | 127 | * Removes an item from the map by its key. |
127 | 128 | * This overrides the parent implementation by converting the key to lower case first if CaseSensitive is false. |
128 | 129 | * @param mixed the key of the item to be removed |
130 | + * @param string $key |
|
129 | 131 | * @return mixed the removed value, null if no such key exists. |
130 | 132 | */ |
131 | 133 | public function remove($key) |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | protected function _getZappableSleepProps(&$exprops) |
53 | 53 | { |
54 | 54 | parent::_getZappableSleepProps($exprops); |
55 | - if ($this->_caseSensitive===false) |
|
56 | - $exprops[] = "\0Prado\Collections\TAttributeCollection\0_caseSensitive"; |
|
55 | + if($this->_caseSensitive===false) |
|
56 | + $exprops[]="\0Prado\Collections\TAttributeCollection\0_caseSensitive"; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function __get($name) |
68 | 68 | { |
69 | - return $this->contains($name)?$this->itemAt($name):parent::__get($name); |
|
69 | + return $this->contains($name) ? $this->itemAt($name) : parent::__get($name); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function itemAt($key) |
108 | 108 | { |
109 | - return parent::itemAt($this->_caseSensitive?$key:strtolower($key)); |
|
109 | + return parent::itemAt($this->_caseSensitive ? $key : strtolower($key)); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function add($key, $value) |
120 | 120 | { |
121 | - parent::add($this->_caseSensitive?$key:strtolower($key), $value); |
|
121 | + parent::add($this->_caseSensitive ? $key : strtolower($key), $value); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function remove($key) |
131 | 131 | { |
132 | - return parent::remove($this->_caseSensitive?$key:strtolower($key)); |
|
132 | + return parent::remove($this->_caseSensitive ? $key : strtolower($key)); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function contains($key) |
142 | 142 | { |
143 | - return parent::contains($this->_caseSensitive?$key:strtolower($key)); |
|
143 | + return parent::contains($this->_caseSensitive ? $key : strtolower($key)); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -90,7 +90,7 @@ |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
93 | - * @return string default culture |
|
93 | + * @return boolean default culture |
|
94 | 94 | */ |
95 | 95 | public function getTranslateDefaultCulture() |
96 | 96 | { |
@@ -212,8 +212,7 @@ discard block |
||
212 | 212 | $config['source']); |
213 | 213 | chmod($config['source'], PRADO_CHMOD); //make it deletable |
214 | 214 | } |
215 | - } |
|
216 | - else |
|
215 | + } else |
|
217 | 216 | { |
218 | 217 | throw new TConfigurationException("invalid source dir '{$config['source']}'"); |
219 | 218 | } |
@@ -228,8 +227,7 @@ discard block |
||
228 | 227 | $config['cache']); |
229 | 228 | chmod($config['cache'], PRADO_CHMOD); //make it deletable |
230 | 229 | } |
231 | - } |
|
232 | - else |
|
230 | + } else |
|
233 | 231 | { |
234 | 232 | unset($config['cache']); |
235 | 233 | } |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | * Default character set is 'UTF-8'. |
35 | 35 | * @var string |
36 | 36 | */ |
37 | - private $_defaultCharset = 'UTF-8'; |
|
37 | + private $_defaultCharset='UTF-8'; |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Default culture is 'en'. |
41 | 41 | * @var string |
42 | 42 | */ |
43 | - private $_defaultCulture = 'en'; |
|
43 | + private $_defaultCulture='en'; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * The current charset. |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | if($config!==null) |
83 | 83 | { |
84 | 84 | if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP) |
85 | - $translation = isset($config['translate'])?$config['translate']:null; |
|
85 | + $translation=isset($config['translate']) ? $config['translate'] : null; |
|
86 | 86 | else |
87 | 87 | { |
88 | - $t = $config->getElementByTagName('translation'); |
|
89 | - $translation = ($t)?$t->getAttributes():null; |
|
88 | + $t=$config->getElementByTagName('translation'); |
|
89 | + $translation=($t) ? $t->getAttributes() : null; |
|
90 | 90 | } |
91 | 91 | if($translation) |
92 | 92 | $this->setTranslationConfiguration($translation); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function setTranslateDefaultCulture($value) |
109 | 109 | { |
110 | - $this->_translateDefaultCulture = TPropertyValue::ensureBoolean($value); |
|
110 | + $this->_translateDefaultCulture=TPropertyValue::ensureBoolean($value); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function setDefaultCulture($culture) |
125 | 125 | { |
126 | - $this->_defaultCulture = str_replace('-', '_', $culture); |
|
126 | + $this->_defaultCulture=str_replace('-', '_', $culture); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function setDefaultCharset($charset) |
141 | 141 | { |
142 | - $this->_defaultCharset = $charset; |
|
142 | + $this->_defaultCharset=$charset; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function setCulture($culture) |
157 | 157 | { |
158 | - $this->_culture = str_replace('-', '_', $culture); |
|
158 | + $this->_culture=str_replace('-', '_', $culture); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function setCharset($charset) |
173 | 173 | { |
174 | - $this->_charset = $charset; |
|
174 | + $this->_charset=$charset; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function getTranslationConfiguration() |
181 | 181 | { |
182 | - return (!$this->_translateDefaultCulture && ($this->getDefaultCulture() == $this->getCulture())) |
|
182 | + return (!$this->_translateDefaultCulture && ($this->getDefaultCulture()==$this->getCulture())) |
|
183 | 183 | ? null |
184 | 184 | : $this->_translation; |
185 | 185 | } |
@@ -200,11 +200,11 @@ discard block |
||
200 | 200 | */ |
201 | 201 | protected function setTranslationConfiguration($config) |
202 | 202 | { |
203 | - if($config['type'] == 'XLIFF' || $config['type'] == 'gettext' || $config['type'] == 'PHP') |
|
203 | + if($config['type']=='XLIFF' || $config['type']=='gettext' || $config['type']=='PHP') |
|
204 | 204 | { |
205 | 205 | if($config['source']) |
206 | 206 | { |
207 | - $config['source'] = Prado::getPathOfNamespace($config['source']); |
|
207 | + $config['source']=Prado::getPathOfNamespace($config['source']); |
|
208 | 208 | if(!is_dir($config['source'])) |
209 | 209 | { |
210 | 210 | if(@mkdir($config['source'])===false) |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | } |
221 | 221 | if(isset($config['cache']) && TPropertyValue::ensureBoolean($config['cache'])) |
222 | 222 | { |
223 | - $config['cache'] = $this->getApplication()->getRunTimePath() . '/i18n'; |
|
223 | + $config['cache']=$this->getApplication()->getRunTimePath().'/i18n'; |
|
224 | 224 | if(!is_dir($config['cache'])) |
225 | 225 | { |
226 | 226 | if(@mkdir($config['cache'])===false) |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | { |
234 | 234 | unset($config['cache']); |
235 | 235 | } |
236 | - $this->_translation = $config; |
|
236 | + $this->_translation=$config; |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | /** |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | */ |
250 | 250 | public function setTranslationCatalogue($value) |
251 | 251 | { |
252 | - $this->_translation['catalogue'] = $value; |
|
252 | + $this->_translation['catalogue']=$value; |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | /** |
@@ -260,11 +260,11 @@ discard block |
||
260 | 260 | */ |
261 | 261 | public function getCultureVariants($culture=null) |
262 | 262 | { |
263 | - if($culture===null) $culture = $this->getCulture(); |
|
264 | - $variants = explode('_', $culture); |
|
265 | - $result = []; |
|
263 | + if($culture===null) $culture=$this->getCulture(); |
|
264 | + $variants=explode('_', $culture); |
|
265 | + $result=[]; |
|
266 | 266 | for(; count($variants) > 0; array_pop($variants)) |
267 | - $result[] = implode('_', $variants); |
|
267 | + $result[]=implode('_', $variants); |
|
268 | 268 | return $result; |
269 | 269 | } |
270 | 270 | |
@@ -289,15 +289,15 @@ discard block |
||
289 | 289 | */ |
290 | 290 | public function getLocalizedResource($file, $culture=null) |
291 | 291 | { |
292 | - $files = []; |
|
293 | - $variants = $this->getCultureVariants($culture); |
|
294 | - $path = pathinfo($file); |
|
292 | + $files=[]; |
|
293 | + $variants=$this->getCultureVariants($culture); |
|
294 | + $path=pathinfo($file); |
|
295 | 295 | foreach($variants as $variant) |
296 | - $files[] = $path['dirname'] . DIRECTORY_SEPARATOR . $variant . DIRECTORY_SEPARATOR . $path['basename']; |
|
297 | - $filename = substr($path['basename'], 0, strrpos($path['basename'], '.')); |
|
296 | + $files[]=$path['dirname'].DIRECTORY_SEPARATOR.$variant.DIRECTORY_SEPARATOR.$path['basename']; |
|
297 | + $filename=substr($path['basename'], 0, strrpos($path['basename'], '.')); |
|
298 | 298 | foreach($variants as $variant) |
299 | - $files[] = $path['dirname'] . DIRECTORY_SEPARATOR . $filename . '.' . $variant . '.' . $path['extension']; |
|
300 | - $files[] = $file; |
|
299 | + $files[]=$path['dirname'].DIRECTORY_SEPARATOR.$filename.'.'.$variant.'.'.$path['extension']; |
|
300 | + $files[]=$file; |
|
301 | 301 | return $files; |
302 | 302 | } |
303 | 303 |
@@ -164,8 +164,7 @@ |
||
164 | 164 | return $handler->createNewInstance(); |
165 | 165 | else |
166 | 166 | return $registry->createInstanceOf($this->getClass()); |
167 | - } |
|
168 | - catch (TSqlMapException $e) |
|
167 | + } catch (TSqlMapException $e) |
|
169 | 168 | { |
170 | 169 | throw new TSqlMapException( |
171 | 170 | 'sqlmap_unable_to_create_new_instance', |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function setClass($value) |
88 | 88 | { |
89 | - $this->_class = $value; |
|
89 | + $this->_class=$value; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function setExtends($value) |
112 | 112 | { |
113 | - $this->_extends = $value; |
|
113 | + $this->_extends=$value; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function setGroupBy($value) |
128 | 128 | { |
129 | - $this->_groupBy = $value; |
|
129 | + $this->_groupBy=$value; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | public function setDiscriminator(TDiscriminator $value) |
144 | 144 | { |
145 | - $this->_discriminator = $value; |
|
145 | + $this->_discriminator=$value; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function addResultProperty(TResultProperty $property) |
153 | 153 | { |
154 | - $this->_columns[$property->getProperty()] = $property; |
|
154 | + $this->_columns[$property->getProperty()]=$property; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function createInstanceOfResult($registry) |
164 | 164 | { |
165 | - $handler = $registry->getTypeHandler($this->getClass()); |
|
165 | + $handler=$registry->getTypeHandler($this->getClass()); |
|
166 | 166 | try |
167 | 167 | { |
168 | 168 | if($handler!==null) |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | else |
171 | 171 | return $registry->createInstanceOf($this->getClass()); |
172 | 172 | } |
173 | - catch (TSqlMapException $e) |
|
173 | + catch(TSqlMapException $e) |
|
174 | 174 | { |
175 | 175 | throw new TSqlMapException( |
176 | 176 | 'sqlmap_unable_to_create_new_instance', |
@@ -186,16 +186,16 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function resolveSubMap($registry, $row) |
188 | 188 | { |
189 | - $subMap = $this; |
|
190 | - if(($disc = $this->getDiscriminator())!==null) |
|
189 | + $subMap=$this; |
|
190 | + if(($disc=$this->getDiscriminator())!==null) |
|
191 | 191 | { |
192 | - $value = $disc->getMapping()->getPropertyValue($registry, $row); |
|
193 | - $subMap = $disc->getSubMap((string)$value); |
|
192 | + $value=$disc->getMapping()->getPropertyValue($registry, $row); |
|
193 | + $subMap=$disc->getSubMap((string) $value); |
|
194 | 194 | |
195 | 195 | if($subMap===null) |
196 | - $subMap = $this; |
|
197 | - elseif($subMap !== $this) |
|
198 | - $subMap = $subMap->resolveSubMap($registry, $row); |
|
196 | + $subMap=$this; |
|
197 | + elseif($subMap!==$this) |
|
198 | + $subMap=$subMap->resolveSubMap($registry, $row); |
|
199 | 199 | } |
200 | 200 | return $subMap; |
201 | 201 | } |
@@ -113,8 +113,7 @@ discard block |
||
113 | 113 | { |
114 | 114 | $userFile = include $this->_userFile; |
115 | 115 | $this->loadUserDataFromPhp($userFile); |
116 | - } |
|
117 | - else |
|
116 | + } else |
|
118 | 117 | { |
119 | 118 | $dom=new TXmlDocument; |
120 | 119 | $dom->loadFromFile($this->_userFile); |
@@ -310,8 +309,7 @@ discard block |
||
310 | 309 | $user=new TUser($this); |
311 | 310 | $user->setIsGuest(true); |
312 | 311 | return $user; |
313 | - } |
|
314 | - else |
|
312 | + } else |
|
315 | 313 | { |
316 | 314 | $username=strtolower($username); |
317 | 315 | if(isset($this->_users[$username])) |
@@ -322,8 +320,7 @@ discard block |
||
322 | 320 | if(isset($this->_roles[$username])) |
323 | 321 | $user->setRoles($this->_roles[$username]); |
324 | 322 | return $user; |
325 | - } |
|
326 | - else |
|
323 | + } else |
|
327 | 324 | return null; |
328 | 325 | } |
329 | 326 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | { |
116 | 116 | if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP) |
117 | 117 | { |
118 | - $userFile = include $this->_userFile; |
|
118 | + $userFile=include $this->_userFile; |
|
119 | 119 | $this->loadUserDataFromPhp($userFile); |
120 | 120 | } |
121 | 121 | else |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | { |
151 | 151 | foreach($config['users'] as $user) |
152 | 152 | { |
153 | - $name = trim(strtolower(isset($user['name'])?$user['name']:'')); |
|
154 | - $password = isset($user['password'])?$user['password']:''; |
|
155 | - $this->_users[$name] = $password; |
|
156 | - $roles = isset($user['roles'])?$user['roles']:''; |
|
153 | + $name=trim(strtolower(isset($user['name']) ? $user['name'] : '')); |
|
154 | + $password=isset($user['password']) ? $user['password'] : ''; |
|
155 | + $this->_users[$name]=$password; |
|
156 | + $roles=isset($user['roles']) ? $user['roles'] : ''; |
|
157 | 157 | if($roles!=='') |
158 | 158 | { |
159 | 159 | foreach(explode(',', $roles) as $role) |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | { |
169 | 169 | foreach($config['roles'] as $role) |
170 | 170 | { |
171 | - $name = isset($role['name'])?$role['name']:''; |
|
172 | - $users = isset($role['users'])?$role['users']:''; |
|
171 | + $name=isset($role['name']) ? $role['name'] : ''; |
|
172 | + $users=isset($role['users']) ? $role['users'] : ''; |
|
173 | 173 | foreach(explode(',', $users) as $user) |
174 | 174 | { |
175 | 175 | if(($user=trim($user))!=='') |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | if(is_array($data) && count($data)===2) |
347 | 347 | { |
348 | 348 | list($username, $token)=$data; |
349 | - if(isset($this->_users[$username]) && $token===md5($username . $this->_users[$username])) |
|
349 | + if(isset($this->_users[$username]) && $token===md5($username.$this->_users[$username])) |
|
350 | 350 | return $this->getUser($username); |
351 | 351 | } |
352 | 352 | } |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | $username=strtolower($user->getName()); |
365 | 365 | if(isset($this->_users[$username])) |
366 | 366 | { |
367 | - $data=[$username,md5($username . $this->_users[$username])]; |
|
367 | + $data=[$username, md5($username.$this->_users[$username])]; |
|
368 | 368 | $cookie->setValue(serialize($data)); |
369 | 369 | } |
370 | 370 | } |
@@ -112,8 +112,7 @@ |
||
112 | 112 | && strlen($datetime[1]) == 1) |
113 | 113 | { |
114 | 114 | $pattern = $datetime; |
115 | - } |
|
116 | - else //no subpattern, try the presets |
|
115 | + } else //no subpattern, try the presets |
|
117 | 116 | $pattern = $this->getPreset($string); |
118 | 117 | |
119 | 118 | //no presets found, use the string as the pattern |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | * A set of pattern presets and their respective formatting shorthand. |
73 | 73 | * @var array |
74 | 74 | */ |
75 | - private static $_patternPresets = [ |
|
76 | - 'fulldate'=>'P','full'=>'P', |
|
77 | - 'longdate'=>'D','long'=>'d', |
|
78 | - 'mediumdate'=>'p','medium'=>'p', |
|
79 | - 'shortdate'=>'d','short'=>'d', |
|
75 | + private static $_patternPresets=[ |
|
76 | + 'fulldate'=>'P', 'full'=>'P', |
|
77 | + 'longdate'=>'D', 'long'=>'d', |
|
78 | + 'mediumdate'=>'p', 'medium'=>'p', |
|
79 | + 'shortdate'=>'d', 'short'=>'d', |
|
80 | 80 | 'fulltime'=>'Q', 'longtime'=>'T', |
81 | 81 | 'mediumtime'=>'q', 'shorttime'=>'t']; |
82 | 82 | |
@@ -95,35 +95,35 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function getPattern() |
97 | 97 | { |
98 | - $string = $this->getViewState('Pattern', ''); |
|
98 | + $string=$this->getViewState('Pattern', ''); |
|
99 | 99 | |
100 | - $pattern = null; |
|
100 | + $pattern=null; |
|
101 | 101 | |
102 | 102 | //try the subpattern of "date time" presets |
103 | - $subpatterns = explode(' ', $string, 2); |
|
104 | - $datetime = []; |
|
103 | + $subpatterns=explode(' ', $string, 2); |
|
104 | + $datetime=[]; |
|
105 | 105 | if(count($subpatterns)==2) |
106 | 106 | { |
107 | - $datetime[] = $this->getPreset($subpatterns[0]); |
|
108 | - $datetime[] = $this->getPreset($subpatterns[1]); |
|
107 | + $datetime[]=$this->getPreset($subpatterns[0]); |
|
108 | + $datetime[]=$this->getPreset($subpatterns[1]); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | //we have a good subpattern |
112 | - if(count($datetime) == 2 |
|
113 | - && strlen($datetime[0]) == 1 |
|
114 | - && strlen($datetime[1]) == 1) |
|
112 | + if(count($datetime)==2 |
|
113 | + && strlen($datetime[0])==1 |
|
114 | + && strlen($datetime[1])==1) |
|
115 | 115 | { |
116 | - $pattern = $datetime; |
|
116 | + $pattern=$datetime; |
|
117 | 117 | } |
118 | 118 | else //no subpattern, try the presets |
119 | - $pattern = $this->getPreset($string); |
|
119 | + $pattern=$this->getPreset($string); |
|
120 | 120 | |
121 | 121 | //no presets found, use the string as the pattern |
122 | 122 | //and let the DateFormat handle it. |
123 | 123 | if($pattern===null) |
124 | - $pattern = $string; |
|
125 | - if (!is_array($pattern) && strlen($pattern) == 0) |
|
126 | - $pattern = null; |
|
124 | + $pattern=$string; |
|
125 | + if(!is_array($pattern) && strlen($pattern)==0) |
|
126 | + $pattern=null; |
|
127 | 127 | return $pattern; |
128 | 128 | } |
129 | 129 | |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | */ |
135 | 135 | protected function getPreset($string) |
136 | 136 | { |
137 | - $string = strtolower($string); |
|
137 | + $string=strtolower($string); |
|
138 | 138 | foreach(self::$_patternPresets as $pattern => $preset) |
139 | 139 | { |
140 | - if($string == $pattern) |
|
140 | + if($string==$pattern) |
|
141 | 141 | return $preset; |
142 | 142 | } |
143 | 143 | } |
@@ -148,10 +148,10 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function getValue() |
150 | 150 | { |
151 | - $value = $this->getViewState('Value', ''); |
|
151 | + $value=$this->getViewState('Value', ''); |
|
152 | 152 | if(empty($value)) |
153 | 153 | { |
154 | - $defaultText = $this->getDefaultText(); |
|
154 | + $defaultText=$this->getDefaultText(); |
|
155 | 155 | if(empty($defaultText)) |
156 | 156 | return time(); |
157 | 157 | } |
@@ -219,29 +219,29 @@ discard block |
||
219 | 219 | */ |
220 | 220 | protected function getFormattedDate() |
221 | 221 | { |
222 | - $value = $this->getValue(); |
|
223 | - $defaultText = $this->getDefaultText(); |
|
222 | + $value=$this->getValue(); |
|
223 | + $defaultText=$this->getDefaultText(); |
|
224 | 224 | if(empty($value) && !empty($defaultText)) |
225 | 225 | return $this->getDefaultText(); |
226 | 226 | |
227 | - $app = $this->getApplication()->getGlobalization(); |
|
227 | + $app=$this->getApplication()->getGlobalization(); |
|
228 | 228 | |
229 | 229 | //initialized the default class wide formatter |
230 | 230 | if(self::$formatter===null) |
231 | - self::$formatter = new DateFormat($app->getCulture()); |
|
231 | + self::$formatter=new DateFormat($app->getCulture()); |
|
232 | 232 | |
233 | - $culture = $this->getCulture(); |
|
233 | + $culture=$this->getCulture(); |
|
234 | 234 | |
235 | 235 | //return the specific cultural formatted date time |
236 | - if(strlen($culture) && $app->getCulture() !== $culture) |
|
236 | + if(strlen($culture) && $app->getCulture()!==$culture) |
|
237 | 237 | { |
238 | - $formatter = new DateFormat($culture); |
|
238 | + $formatter=new DateFormat($culture); |
|
239 | 239 | return $formatter->format($value, |
240 | 240 | $this->getPattern(), |
241 | 241 | $this->getCharset()); |
242 | 242 | } |
243 | 243 | //return the application wide culture formatted date time. |
244 | - $result = self::$formatter->format($value, |
|
244 | + $result=self::$formatter->format($value, |
|
245 | 245 | $this->getPattern(), |
246 | 246 | $this->getCharset()); |
247 | 247 | return $result; |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $status=TPropertyValue::ensureInteger($status); |
282 | 282 | if(isset(self::$HTTP_STATUS_CODES[$status])) { |
283 | 283 | $this->_reason=self::$HTTP_STATUS_CODES[$status]; |
284 | - }else{ |
|
284 | + } else{ |
|
285 | 285 | if($reason===null || $reason==='') { |
286 | 286 | throw new TInvalidDataValueException("response_status_reason_missing"); |
287 | 287 | } |
@@ -377,8 +377,7 @@ discard block |
||
377 | 377 | { |
378 | 378 | foreach($headers as $h) |
379 | 379 | header($h); |
380 | - } |
|
381 | - else |
|
380 | + } else |
|
382 | 381 | { |
383 | 382 | header('Pragma: public'); |
384 | 383 | header('Expires: 0'); |
@@ -488,13 +487,11 @@ discard block |
||
488 | 487 | { |
489 | 488 | $this->_bufferOutput = false; |
490 | 489 | ob_end_flush(); |
491 | - } |
|
492 | - else |
|
490 | + } else |
|
493 | 491 | ob_flush(); |
494 | 492 | flush(); |
495 | 493 | } |
496 | - } |
|
497 | - else |
|
494 | + } else |
|
498 | 495 | flush(); |
499 | 496 | } |
500 | 497 | |
@@ -645,8 +642,7 @@ discard block |
||
645 | 642 | $cookie->getSecure(), |
646 | 643 | $cookie->getHttpOnly() |
647 | 644 | ); |
648 | - } |
|
649 | - else { |
|
645 | + } else { |
|
650 | 646 | setcookie( |
651 | 647 | $cookie->getName(), |
652 | 648 | $cookie->getValue(), |
@@ -233,6 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | /** |
235 | 235 | * @param string|boolean output charset. |
236 | + * @param string $charset |
|
236 | 237 | */ |
237 | 238 | public function setCharset($charset) |
238 | 239 | { |
@@ -402,6 +403,7 @@ discard block |
||
402 | 403 | * The current application will be terminated after this method is invoked. |
403 | 404 | * @param string URL to be redirected to. If the URL is a relative one, the base URL of |
404 | 405 | * the current request will be inserted at the beginning. |
406 | + * @param string $url |
|
405 | 407 | */ |
406 | 408 | public function redirect($url) |
407 | 409 | { |
@@ -605,6 +607,7 @@ discard block |
||
605 | 607 | * Sends a header. |
606 | 608 | * @param string header |
607 | 609 | * @param boolean whether the header should replace a previous similar header, or add a second header of the same type |
610 | + * @param string $value |
|
608 | 611 | */ |
609 | 612 | public function appendHeader($value, $replace=true) |
610 | 613 | { |
@@ -630,6 +633,7 @@ discard block |
||
630 | 633 | * Sends a cookie. |
631 | 634 | * Do not call this method directly. Operate with the result of {@link getCookies} instead. |
632 | 635 | * @param THttpCookie cook to be sent |
636 | + * @param THttpCookie $cookie |
|
633 | 637 | */ |
634 | 638 | public function addCookie($cookie) |
635 | 639 | { |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | */ |
67 | 67 | class THttpResponse extends \Prado\TModule implements \Prado\IO\ITextWriter |
68 | 68 | { |
69 | - const DEFAULT_CONTENTTYPE = 'text/html'; |
|
70 | - const DEFAULT_CHARSET = 'UTF-8'; |
|
69 | + const DEFAULT_CONTENTTYPE='text/html'; |
|
70 | + const DEFAULT_CHARSET='UTF-8'; |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * @var The differents defined status code by RFC 2616 {@link http://www.faqs.org/rfcs/rfc2616} |
74 | 74 | */ |
75 | - private static $HTTP_STATUS_CODES = [ |
|
75 | + private static $HTTP_STATUS_CODES=[ |
|
76 | 76 | 100 => 'Continue', 101 => 'Switching Protocols', |
77 | 77 | 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', |
78 | 78 | 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 307 => 'Temporary Redirect', |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public function setCacheControl($value) |
205 | 205 | { |
206 | - session_cache_limiter(TPropertyValue::ensureEnum($value, ['none','nocache','private','private_no_expire','public'])); |
|
206 | + session_cache_limiter(TPropertyValue::ensureEnum($value, ['none', 'nocache', 'private', 'private_no_expire', 'public'])); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | */ |
212 | 212 | public function setContentType($type) |
213 | 213 | { |
214 | - if ($this->_contentTypeHeaderSent) |
|
214 | + if($this->_contentTypeHeaderSent) |
|
215 | 215 | throw new \Exception('Unable to alter content-type as it has been already sent'); |
216 | - $this->_contentType = $type; |
|
216 | + $this->_contentType=$type; |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public function setCharset($charset) |
239 | 239 | { |
240 | - $this->_charset = (strToLower($charset) === 'false') ? false : (string)$charset; |
|
240 | + $this->_charset=(strToLower($charset)==='false') ? false : (string) $charset; |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | /** |
@@ -278,12 +278,12 @@ discard block |
||
278 | 278 | */ |
279 | 279 | public function setStatusCode($status, $reason=null) |
280 | 280 | { |
281 | - if ($this->_httpHeaderSent) |
|
281 | + if($this->_httpHeaderSent) |
|
282 | 282 | throw new \Exception('Unable to alter response as HTTP header already sent'); |
283 | 283 | $status=TPropertyValue::ensureInteger($status); |
284 | 284 | if(isset(self::$HTTP_STATUS_CODES[$status])) { |
285 | 285 | $this->_reason=self::$HTTP_STATUS_CODES[$status]; |
286 | - }else{ |
|
286 | + } else { |
|
287 | 287 | if($reason===null || $reason==='') { |
288 | 288 | throw new TInvalidDataValueException("response_status_reason_missing"); |
289 | 289 | } |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | public function write($str) |
322 | 322 | { |
323 | 323 | // when starting output make sure we send the headers first |
324 | - if (!$this->_bufferOutput and !$this->_httpHeaderSent) |
|
324 | + if(!$this->_bufferOutput and !$this->_httpHeaderSent) |
|
325 | 325 | $this->ensureHeadersSent(); |
326 | 326 | echo $str; |
327 | 327 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | $clientFileName=basename($clientFileName); |
373 | 373 | |
374 | 374 | if($fileSize===null || $fileSize < 0) |
375 | - $fileSize = ($content===null?filesize($fileName):strlen($content)); |
|
375 | + $fileSize=($content===null ?filesize($fileName) : strlen($content)); |
|
376 | 376 | |
377 | 377 | $this->sendHttpHeader(); |
378 | 378 | if(is_array($headers)) |
@@ -386,11 +386,11 @@ discard block |
||
386 | 386 | header('Expires: 0'); |
387 | 387 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
388 | 388 | header("Content-Type: $mimeType"); |
389 | - $this->_contentTypeHeaderSent = true; |
|
389 | + $this->_contentTypeHeaderSent=true; |
|
390 | 390 | } |
391 | 391 | |
392 | - header('Content-Length: ' . $fileSize); |
|
393 | - header("Content-Disposition: " . ($forceDownload ? 'attachment' : 'inline') . "; filename=\"$clientFileName\""); |
|
392 | + header('Content-Length: '.$fileSize); |
|
393 | + header("Content-Disposition: ".($forceDownload ? 'attachment' : 'inline')."; filename=\"$clientFileName\""); |
|
394 | 394 | header('Content-Transfer-Encoding: binary'); |
395 | 395 | if($content===null) |
396 | 396 | readfile($fileName); |
@@ -430,25 +430,25 @@ discard block |
||
430 | 430 | |
431 | 431 | // Under IIS, explicitly send an HTTP response including the status code |
432 | 432 | // this is handled automatically by PHP on Apache and others |
433 | - $isIIS = (stripos($this->getRequest()->getServerSoftware(), "microsoft-iis") !== false); |
|
433 | + $isIIS=(stripos($this->getRequest()->getServerSoftware(), "microsoft-iis")!==false); |
|
434 | 434 | if($url[0]==='/') |
435 | - $url=$this->getRequest()->getBaseUrl() . $url; |
|
436 | - if ($this->_status >= 300 && $this->_status < 400) |
|
435 | + $url=$this->getRequest()->getBaseUrl().$url; |
|
436 | + if($this->_status >= 300 && $this->_status < 400) |
|
437 | 437 | { |
438 | 438 | // The status code has been modified to a valid redirection status, send it |
439 | 439 | if($isIIS) |
440 | 440 | { |
441 | - header('HTTP/1.1 ' . $this->_status . ' ' . self::$HTTP_STATUS_CODES[ |
|
441 | + header('HTTP/1.1 '.$this->_status.' '.self::$HTTP_STATUS_CODES[ |
|
442 | 442 | array_key_exists($this->_status, self::$HTTP_STATUS_CODES) |
443 | 443 | ? $this->_status |
444 | 444 | : 302 |
445 | 445 | ]); |
446 | 446 | } |
447 | - header('Location: ' . str_replace('&', '&', $url), true, $this->_status); |
|
447 | + header('Location: '.str_replace('&', '&', $url), true, $this->_status); |
|
448 | 448 | } else { |
449 | 449 | if($isIIS) |
450 | - header('HTTP/1.1 302 ' . self::$HTTP_STATUS_CODES[302]); |
|
451 | - header('Location: ' . str_replace('&', '&', $url)); |
|
450 | + header('HTTP/1.1 302 '.self::$HTTP_STATUS_CODES[302]); |
|
451 | + header('Location: '.str_replace('&', '&', $url)); |
|
452 | 452 | } |
453 | 453 | |
454 | 454 | if(!$this->getApplication()->getRequestCompleted()) |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | /** |
471 | 471 | * Flush the response contents and headers. |
472 | 472 | */ |
473 | - public function flush($continueBuffering = true) |
|
473 | + public function flush($continueBuffering=true) |
|
474 | 474 | { |
475 | 475 | if($this->getHasAdapter()) |
476 | 476 | $this->_adapter->flushContent($continueBuffering); |
@@ -492,18 +492,18 @@ discard block |
||
492 | 492 | * This method is used internally. Please use {@link flush} instead. |
493 | 493 | * @param boolean whether to continue buffering after flush if buffering was active |
494 | 494 | */ |
495 | - public function flushContent($continueBuffering = true) |
|
495 | + public function flushContent($continueBuffering=true) |
|
496 | 496 | { |
497 | 497 | Prado::trace("Flushing output", 'Prado\Web\THttpResponse'); |
498 | 498 | $this->ensureHeadersSent(); |
499 | 499 | if($this->_bufferOutput) |
500 | 500 | { |
501 | 501 | // avoid forced send of http headers (ob_flush() does that) if there's no output yet |
502 | - if (ob_get_length()>0) |
|
502 | + if(ob_get_length() > 0) |
|
503 | 503 | { |
504 | - if (!$continueBuffering) |
|
504 | + if(!$continueBuffering) |
|
505 | 505 | { |
506 | - $this->_bufferOutput = false; |
|
506 | + $this->_bufferOutput=false; |
|
507 | 507 | ob_end_flush(); |
508 | 508 | } |
509 | 509 | else |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | */ |
521 | 521 | protected function ensureHttpHeaderSent() |
522 | 522 | { |
523 | - if (!$this->_httpHeaderSent) |
|
523 | + if(!$this->_httpHeaderSent) |
|
524 | 524 | $this->sendHttpHeader(); |
525 | 525 | } |
526 | 526 | |
@@ -530,12 +530,12 @@ discard block |
||
530 | 530 | protected function sendHttpHeader() |
531 | 531 | { |
532 | 532 | $protocol=$this->getRequest()->getHttpProtocolVersion(); |
533 | - if($this->getRequest()->getHttpProtocolVersion() === null) |
|
533 | + if($this->getRequest()->getHttpProtocolVersion()===null) |
|
534 | 534 | $protocol='HTTP/1.1'; |
535 | 535 | |
536 | - header($protocol . ' ' . $this->_status . ' ' . $this->_reason, true, TPropertyValue::ensureInteger($this->_status)); |
|
536 | + header($protocol.' '.$this->_status.' '.$this->_reason, true, TPropertyValue::ensureInteger($this->_status)); |
|
537 | 537 | |
538 | - $this->_httpHeaderSent = true; |
|
538 | + $this->_httpHeaderSent=true; |
|
539 | 539 | } |
540 | 540 | |
541 | 541 | /** |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | */ |
544 | 544 | protected function ensureContentTypeHeaderSent() |
545 | 545 | { |
546 | - if (!$this->_contentTypeHeaderSent) |
|
546 | + if(!$this->_contentTypeHeaderSent) |
|
547 | 547 | $this->sendContentTypeHeader(); |
548 | 548 | } |
549 | 549 | |
@@ -552,20 +552,20 @@ discard block |
||
552 | 552 | */ |
553 | 553 | protected function sendContentTypeHeader() |
554 | 554 | { |
555 | - $contentType=$this->_contentType===null?self::DEFAULT_CONTENTTYPE:$this->_contentType; |
|
555 | + $contentType=$this->_contentType===null ?self::DEFAULT_CONTENTTYPE : $this->_contentType; |
|
556 | 556 | $charset=$this->getCharset(); |
557 | - if($charset === false) { |
|
558 | - $this->appendHeader('Content-Type: ' . $contentType); |
|
557 | + if($charset===false) { |
|
558 | + $this->appendHeader('Content-Type: '.$contentType); |
|
559 | 559 | return; |
560 | 560 | } |
561 | 561 | |
562 | 562 | if($charset==='' && ($globalization=$this->getApplication()->getGlobalization(false))!==null) |
563 | 563 | $charset=$globalization->getCharset(); |
564 | 564 | |
565 | - if($charset==='') $charset = self::DEFAULT_CHARSET; |
|
566 | - $this->appendHeader('Content-Type: ' . $contentType . ';charset=' . $charset); |
|
565 | + if($charset==='') $charset=self::DEFAULT_CHARSET; |
|
566 | + $this->appendHeader('Content-Type: '.$contentType.';charset='.$charset); |
|
567 | 567 | |
568 | - $this->_contentTypeHeaderSent = true; |
|
568 | + $this->_contentTypeHeaderSent=true; |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | /** |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | public function getContents() |
578 | 578 | { |
579 | 579 | Prado::trace("Retrieving output", 'Prado\Web\THttpResponse'); |
580 | - return $this->_bufferOutput?ob_get_contents():''; |
|
580 | + return $this->_bufferOutput ?ob_get_contents() : ''; |
|
581 | 581 | } |
582 | 582 | |
583 | 583 | /** |
@@ -596,19 +596,19 @@ discard block |
||
596 | 596 | */ |
597 | 597 | public function getHeaders($case=null) |
598 | 598 | { |
599 | - $result = []; |
|
600 | - $headers = headers_list(); |
|
599 | + $result=[]; |
|
600 | + $headers=headers_list(); |
|
601 | 601 | foreach($headers as $header) { |
602 | - $tmp = explode(':', $header); |
|
603 | - $key = trim(array_shift($tmp)); |
|
604 | - $value = trim(implode(':', $tmp)); |
|
602 | + $tmp=explode(':', $header); |
|
603 | + $key=trim(array_shift($tmp)); |
|
604 | + $value=trim(implode(':', $tmp)); |
|
605 | 605 | if(isset($result[$key])) |
606 | - $result[$key] .= ', ' . $value; |
|
606 | + $result[$key].=', '.$value; |
|
607 | 607 | else |
608 | - $result[$key] = $value; |
|
608 | + $result[$key]=$value; |
|
609 | 609 | } |
610 | 610 | |
611 | - if($case !== null) |
|
611 | + if($case!==null) |
|
612 | 612 | return array_change_key_case($result, $case); |
613 | 613 | |
614 | 614 | return $result; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function setDecayRate($value) |
81 | 81 | { |
82 | - $decay = TPropertyValue::ensureFloat($value); |
|
82 | + $decay=TPropertyValue::ensureFloat($value); |
|
83 | 83 | if($decay < 0) |
84 | 84 | throw new TConfigurationException('callback_decay_be_not_negative', $this->getID()); |
85 | 85 | $this->setViewState('Decay', $decay); |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | */ |
91 | 91 | protected function getTriggerOptions() |
92 | 92 | { |
93 | - $options = parent::getTriggerOptions(); |
|
94 | - $options['PropertyName'] = $this->getPropertyName(); |
|
95 | - $options['Interval'] = $this->getInterval(); |
|
96 | - $options['Decay'] = $this->getDecayRate(); |
|
93 | + $options=parent::getTriggerOptions(); |
|
94 | + $options['PropertyName']=$this->getPropertyName(); |
|
95 | + $options['Interval']=$this->getInterval(); |
|
96 | + $options['Decay']=$this->getDecayRate(); |
|
97 | 97 | return $options; |
98 | 98 | } |
99 | 99 |
@@ -36,7 +36,7 @@ |
||
36 | 36 | public function getClientSide() |
37 | 37 | { |
38 | 38 | if($this->_clientSide===null) |
39 | - $this->_clientSide = $this->createClientSide(); |
|
39 | + $this->_clientSide=$this->createClientSide(); |
|
40 | 40 | return $this->_clientSide; |
41 | 41 | } |
42 | 42 |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | */ |
265 | 265 | public function setEnablePageStateUpdate($value) |
266 | 266 | { |
267 | - $enabled = TPropertyValue::ensureBoolean($value); |
|
267 | + $enabled=TPropertyValue::ensureBoolean($value); |
|
268 | 268 | $this->setOption('EnablePageStateUpdate', $enabled); |
269 | 269 | } |
270 | 270 | |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | */ |
275 | 275 | public function getEnablePageStateUpdate() |
276 | 276 | { |
277 | - $option = $this->getOption('EnablePageStateUpdate'); |
|
277 | + $option=$this->getOption('EnablePageStateUpdate'); |
|
278 | 278 | return ($option===null) ? true : $option; |
279 | 279 | } |
280 | 280 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | public function setPostBackTarget($value) |
293 | 293 | { |
294 | 294 | if($value instanceof TControl) |
295 | - $value = $value->getUniqueID(); |
|
295 | + $value=$value->getUniqueID(); |
|
296 | 296 | $this->setOption('EventTarget', $value); |
297 | 297 | } |
298 | 298 |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
207 | - * @return boolean true to post the inputs of the form on callback, default |
|
207 | + * @return string true to post the inputs of the form on callback, default |
|
208 | 208 | * is post the inputs on callback. |
209 | 209 | */ |
210 | 210 | public function getPostState() |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | } |
223 | 223 | |
224 | 224 | /** |
225 | - * @return integer callback request timeout. |
|
225 | + * @return string callback request timeout. |
|
226 | 226 | */ |
227 | 227 | public function getRequestTimeOut() |
228 | 228 | { |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
253 | - * @return boolean client-side viewstate will be updated on callback |
|
253 | + * @return boolean|string client-side viewstate will be updated on callback |
|
254 | 254 | * response if true. Default is true. |
255 | 255 | */ |
256 | 256 | public function getEnablePageStateUpdate() |