@@ -27,8 +27,8 @@ |
||
27 | 27 | */ |
28 | 28 | public function getDifference() |
29 | 29 | { |
30 | - if(gettype($this->_new) === gettype($this->_old) |
|
31 | - && $this->_new === $this->_old) |
|
30 | + if(gettype($this->_new)===gettype($this->_old) |
|
31 | + && $this->_new===$this->_old) |
|
32 | 32 | return $this->_null; |
33 | 33 | else |
34 | 34 | return $this->_new; |
@@ -41,9 +41,9 @@ |
||
41 | 41 | */ |
42 | 42 | public function __construct($new, $old, $null) |
43 | 43 | { |
44 | - $this->_new = $new; |
|
45 | - $this->_old = $old; |
|
46 | - $this->_null = $null; |
|
44 | + $this->_new=$new; |
|
45 | + $this->_old=$old; |
|
46 | + $this->_null=$null; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -30,8 +30,8 @@ |
||
30 | 30 | */ |
31 | 31 | public function getClientSide() |
32 | 32 | { |
33 | - if($this->_callbackoptions === null) |
|
34 | - $this->_callbackoptions = new TCallbackOptions; |
|
33 | + if($this->_callbackoptions===null) |
|
34 | + $this->_callbackoptions=new TCallbackOptions; |
|
35 | 35 | return $this->_callbackoptions->getClientSide(); |
36 | 36 | } |
37 | 37 | } |
38 | 38 | \ No newline at end of file |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | protected function setFunction($name, $code) |
44 | 44 | { |
45 | 45 | if(!TJavaScript::isJsLiteral($code)) |
46 | - $code = TJavaScript::quoteJsLiteral($this->ensureFunction($code)); |
|
46 | + $code=TJavaScript::quoteJsLiteral($this->ensureFunction($code)); |
|
47 | 47 | $this->setOption($name, $code); |
48 | 48 | } |
49 | 49 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | protected function getOption($name) |
54 | 54 | { |
55 | - if ($this->_options) |
|
55 | + if($this->_options) |
|
56 | 56 | return $this->_options->itemAt($name); |
57 | 57 | else |
58 | 58 | return null; |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function getOptions() |
74 | 74 | { |
75 | - if (!$this->_options) |
|
76 | - $this->_options = new TMap; |
|
75 | + if(!$this->_options) |
|
76 | + $this->_options=new TMap; |
|
77 | 77 | return $this->_options; |
78 | 78 | } |
79 | 79 |
@@ -39,6 +39,7 @@ discard block |
||
39 | 39 | * javascript statements. |
40 | 40 | * @param string option name |
41 | 41 | * @param string javascript statements. |
42 | + * @param string $name |
|
42 | 43 | */ |
43 | 44 | protected function setFunction($name, $code) |
44 | 45 | { |
@@ -48,6 +49,7 @@ discard block |
||
48 | 49 | } |
49 | 50 | |
50 | 51 | /** |
52 | + * @param string $name |
|
51 | 53 | * @return string gets a particular option, null if not set. |
52 | 54 | */ |
53 | 55 | protected function getOption($name) |
@@ -27,29 +27,29 @@ |
||
27 | 27 | * Keep current SecureConnection status |
28 | 28 | * means no prefixing |
29 | 29 | */ |
30 | - const Automatic = 'Automatic'; |
|
30 | + const Automatic='Automatic'; |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * Force use secured connection |
34 | 34 | * always prefixing with https://example.com/path/to/app |
35 | 35 | */ |
36 | - const Enable = 'Enable'; |
|
36 | + const Enable='Enable'; |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * Force use unsecured connection |
40 | 40 | * always prefixing with http://example.com/path/to/app |
41 | 41 | */ |
42 | - const Disable = 'Disable'; |
|
42 | + const Disable='Disable'; |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * Force use secured connection, if in unsecured mode |
46 | 46 | * prefixing with https://example.com/path/to/app |
47 | 47 | */ |
48 | - const EnableIfNotSecure = 'EnableIfNotSecure'; |
|
48 | + const EnableIfNotSecure='EnableIfNotSecure'; |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * Force use unsecured connection, if in secured mode |
52 | 52 | * prefixing with https://example.com/path/to/app |
53 | 53 | */ |
54 | - const DisableIfSecure = 'DisableIfSecure'; |
|
54 | + const DisableIfSecure='DisableIfSecure'; |
|
55 | 55 | } |
56 | 56 | \ No newline at end of file |
@@ -96,6 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | /** |
98 | 98 | * @param boolean whether to allow custom paging |
99 | + * @param boolean $value |
|
99 | 100 | */ |
100 | 101 | public function setCustomPaging($value) |
101 | 102 | { |
@@ -143,6 +144,7 @@ discard block |
||
143 | 144 | * Raises <b>OnPageIndexChanged</b> event. |
144 | 145 | * This event is raised each time when the list changes to a different page. |
145 | 146 | * @param TPagedListPageChangedEventParameter event parameter |
147 | + * @param TPagedListPageChangedEventParameter|null $param |
|
146 | 148 | */ |
147 | 149 | public function onPageIndexChanged($param) |
148 | 150 | { |
@@ -155,6 +157,7 @@ discard block |
||
155 | 157 | * and needs the new page of data. This event can only be raised when |
156 | 158 | * {@link setCustomPaging CustomPaging} is true. |
157 | 159 | * @param TPagedListFetchDataEventParameter event parameter |
160 | + * @param TPagedListFetchDataEventParameter $param |
|
158 | 161 | */ |
159 | 162 | public function onFetchData($param) |
160 | 163 | { |
@@ -290,7 +293,7 @@ discard block |
||
290 | 293 | } |
291 | 294 | |
292 | 295 | /** |
293 | - * @return Iterator iterator |
|
296 | + * @return \ArrayIterator iterator |
|
294 | 297 | */ |
295 | 298 | public function getIterator() |
296 | 299 | { |
@@ -63,26 +63,26 @@ discard block |
||
63 | 63 | /** |
64 | 64 | * @var boolean whether to allow custom paging |
65 | 65 | */ |
66 | - private $_customPaging = false; |
|
66 | + private $_customPaging=false; |
|
67 | 67 | /** |
68 | 68 | * @var integer number of items in each page |
69 | 69 | */ |
70 | - private $_pageSize = 10; |
|
70 | + private $_pageSize=10; |
|
71 | 71 | /** |
72 | 72 | * @var integer current page index |
73 | 73 | */ |
74 | - private $_currentPageIndex = -1; |
|
74 | + private $_currentPageIndex=-1; |
|
75 | 75 | /** |
76 | 76 | * @var integer user-assigned number of items in data source |
77 | 77 | */ |
78 | - private $_virtualCount = -1; |
|
78 | + private $_virtualCount=-1; |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * Constructor. |
82 | 82 | * @param array|Iterator the initial data. Default is null, meaning no initialization. |
83 | 83 | * @param boolean whether the list is read-only. Always true for paged list. |
84 | 84 | */ |
85 | - public function __construct($data = null, $readOnly = false) |
|
85 | + public function __construct($data=null, $readOnly=false) |
|
86 | 86 | { |
87 | 87 | parent::__construct($data, true); |
88 | 88 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function setCustomPaging($value) |
102 | 102 | { |
103 | - $this->_customPaging = TPropertyValue::ensureBoolean($value); |
|
103 | + $this->_customPaging=TPropertyValue::ensureBoolean($value); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function setPageSize($value) |
118 | 118 | { |
119 | - if(($value = TPropertyValue::ensureInteger($value)) > 0) |
|
120 | - $this->_pageSize = $value; |
|
119 | + if(($value=TPropertyValue::ensureInteger($value)) > 0) |
|
120 | + $this->_pageSize=$value; |
|
121 | 121 | else |
122 | 122 | throw new TInvalidDataValueException('pagedlist_pagesize_invalid'); |
123 | 123 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public function setCurrentPageIndex($value) |
138 | 138 | { |
139 | - if($this->gotoPage($value = TPropertyValue::ensureInteger($value)) === false) |
|
139 | + if($this->gotoPage($value=TPropertyValue::ensureInteger($value))===false) |
|
140 | 140 | throw new TInvalidDataValueException('pagedlist_currentpageindex_invalid'); |
141 | 141 | } |
142 | 142 | |
@@ -169,21 +169,21 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function gotoPage($pageIndex) |
171 | 171 | { |
172 | - if($pageIndex === $this->_currentPageIndex) |
|
172 | + if($pageIndex===$this->_currentPageIndex) |
|
173 | 173 | return $pageIndex; |
174 | 174 | if($this->_customPaging) |
175 | 175 | { |
176 | 176 | if($pageIndex >= 0 && ($this->_virtualCount < 0 || $pageIndex < $this->getPageCount())) |
177 | 177 | { |
178 | - $param = new TPagedListFetchDataEventParameter($pageIndex, $this->_pageSize * $pageIndex, $this->_pageSize); |
|
178 | + $param=new TPagedListFetchDataEventParameter($pageIndex, $this->_pageSize * $pageIndex, $this->_pageSize); |
|
179 | 179 | $this->onFetchData($param); |
180 | - if(($data = $param->getData()) !== null) |
|
180 | + if(($data=$param->getData())!==null) |
|
181 | 181 | { |
182 | 182 | $this->setReadOnly(false); |
183 | 183 | $this->copyFrom($data); |
184 | 184 | $this->setReadOnly(true); |
185 | - $oldPage = $this->_currentPageIndex; |
|
186 | - $this->_currentPageIndex = $pageIndex; |
|
185 | + $oldPage=$this->_currentPageIndex; |
|
186 | + $this->_currentPageIndex=$pageIndex; |
|
187 | 187 | $this->onPageIndexChanged(new TPagedListPageChangedEventParameter($oldPage)); |
188 | 188 | return $pageIndex; |
189 | 189 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | { |
198 | 198 | if($pageIndex >= 0 && $pageIndex < $this->getPageCount()) |
199 | 199 | { |
200 | - $this->_currentPageIndex = $pageIndex; |
|
200 | + $this->_currentPageIndex=$pageIndex; |
|
201 | 201 | $this->onPageIndexChanged(null); |
202 | 202 | return $pageIndex; |
203 | 203 | } |
@@ -237,9 +237,9 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public function setVirtualCount($value) |
239 | 239 | { |
240 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
241 | - $value = -1; |
|
242 | - $this->_virtualCount = $value; |
|
240 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
241 | + $value=-1; |
|
242 | + $this->_virtualCount=$value; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
@@ -250,12 +250,12 @@ discard block |
||
250 | 250 | if($this->_customPaging) |
251 | 251 | { |
252 | 252 | if($this->_virtualCount >= 0) |
253 | - return (int)(($this->_virtualCount + $this->_pageSize - 1) / $this->_pageSize); |
|
253 | + return (int) (($this->_virtualCount + $this->_pageSize - 1) / $this->_pageSize); |
|
254 | 254 | else |
255 | 255 | return -1; |
256 | 256 | } |
257 | 257 | else |
258 | - return (int)((parent::getCount() + $this->_pageSize - 1) / $this->_pageSize); |
|
258 | + return (int) ((parent::getCount() + $this->_pageSize - 1) / $this->_pageSize); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | /** |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | */ |
264 | 264 | public function getIsFirstPage() |
265 | 265 | { |
266 | - return $this->_currentPageIndex === 0; |
|
266 | + return $this->_currentPageIndex===0; |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | */ |
272 | 272 | public function getIsLastPage() |
273 | 273 | { |
274 | - return $this->_currentPageIndex === $this->getPageCount() - 1; |
|
274 | + return $this->_currentPageIndex===$this->getPageCount() - 1; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | return parent::getCount(); |
284 | 284 | else |
285 | 285 | { |
286 | - if($this->_currentPageIndex === $this->getPageCount() - 1) |
|
286 | + if($this->_currentPageIndex===$this->getPageCount() - 1) |
|
287 | 287 | return parent::getCount() - $this->_pageSize * $this->_currentPageIndex; |
288 | 288 | else |
289 | 289 | return $this->_pageSize; |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | return parent::getIterator(); |
300 | 300 | else |
301 | 301 | { |
302 | - $data = $this->toArray(); |
|
302 | + $data=$this->toArray(); |
|
303 | 303 | return new \ArrayIterator($data); |
304 | 304 | } |
305 | 305 | } |
@@ -325,9 +325,9 @@ discard block |
||
325 | 325 | */ |
326 | 326 | public function indexOf($item) |
327 | 327 | { |
328 | - $c = $this->getCount(); |
|
329 | - for($i = 0;$i < $c;++$i) |
|
330 | - if($this->itemAt($i) === $item) |
|
328 | + $c=$this->getCount(); |
|
329 | + for($i=0; $i < $c; ++$i) |
|
330 | + if($this->itemAt($i)===$item) |
|
331 | 331 | return $i; |
332 | 332 | return -1; |
333 | 333 | } |
@@ -360,10 +360,10 @@ discard block |
||
360 | 360 | */ |
361 | 361 | public function toArray() |
362 | 362 | { |
363 | - $c = $this->getCount(); |
|
364 | - $array = []; |
|
365 | - for($i = 0;$i < $c;++$i) |
|
366 | - $array[$i] = $this->itemAt($i); |
|
363 | + $c=$this->getCount(); |
|
364 | + $array=[]; |
|
365 | + for($i=0; $i < $c; ++$i) |
|
366 | + $array[$i]=$this->itemAt($i); |
|
367 | 367 | return $array; |
368 | 368 | } |
369 | 369 | } |
370 | 370 | \ No newline at end of file |
@@ -186,22 +186,18 @@ discard block |
||
186 | 186 | $this->_currentPageIndex = $pageIndex; |
187 | 187 | $this->onPageIndexChanged(new TPagedListPageChangedEventParameter($oldPage)); |
188 | 188 | return $pageIndex; |
189 | - } |
|
190 | - else |
|
189 | + } else |
|
191 | 190 | return false; |
192 | - } |
|
193 | - else |
|
191 | + } else |
|
194 | 192 | return false; |
195 | - } |
|
196 | - else |
|
193 | + } else |
|
197 | 194 | { |
198 | 195 | if($pageIndex >= 0 && $pageIndex < $this->getPageCount()) |
199 | 196 | { |
200 | 197 | $this->_currentPageIndex = $pageIndex; |
201 | 198 | $this->onPageIndexChanged(null); |
202 | 199 | return $pageIndex; |
203 | - } |
|
204 | - else |
|
200 | + } else |
|
205 | 201 | return false; |
206 | 202 | } |
207 | 203 | } |
@@ -253,8 +249,7 @@ discard block |
||
253 | 249 | return (int)(($this->_virtualCount + $this->_pageSize - 1) / $this->_pageSize); |
254 | 250 | else |
255 | 251 | return -1; |
256 | - } |
|
257 | - else |
|
252 | + } else |
|
258 | 253 | return (int)((parent::getCount() + $this->_pageSize - 1) / $this->_pageSize); |
259 | 254 | } |
260 | 255 |
@@ -266,6 +266,7 @@ discard block |
||
266 | 266 | |
267 | 267 | /** |
268 | 268 | * Saves the current UrlManager instance to cache. |
269 | + * @param TUrlManager $manager |
|
269 | 270 | * @return boolean true if UrlManager instance was cached, false otherwise. |
270 | 271 | */ |
271 | 272 | protected function cacheUrlManager($manager) |
@@ -357,7 +358,7 @@ discard block |
||
357 | 358 | } |
358 | 359 | |
359 | 360 | /** |
360 | - * @return THttpRequestUrlFormat the format of URLs. Defaults to THttpRequestUrlFormat::Get. |
|
361 | + * @return string the format of URLs. Defaults to THttpRequestUrlFormat::Get. |
|
361 | 362 | */ |
362 | 363 | public function getUrlFormat() |
363 | 364 | { |
@@ -718,6 +719,7 @@ discard block |
||
718 | 719 | * @param array GET parameters, null if not needed |
719 | 720 | * @param boolean whether to encode the ampersand in URL, defaults to true. |
720 | 721 | * @param boolean whether to encode the GET parameters (their names and values), defaults to false. |
722 | + * @param string $serviceID |
|
721 | 723 | * @return string URL |
722 | 724 | * @see TUrlManager::constructUrl |
723 | 725 | */ |
@@ -820,7 +822,7 @@ discard block |
||
820 | 822 | /** |
821 | 823 | * Returns an iterator for traversing the items in the list. |
822 | 824 | * This method is required by the interface \IteratorAggregate. |
823 | - * @return Iterator an iterator for traversing the items in the list. |
|
825 | + * @return \ArrayIterator an iterator for traversing the items in the list. |
|
824 | 826 | */ |
825 | 827 | public function getIterator() |
826 | 828 | { |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | */ |
77 | 77 | class THttpRequest extends \Prado\TApplicationComponent implements \IteratorAggregate, \ArrayAccess, \Countable, \Prado\IModule |
78 | 78 | { |
79 | - const CGIFIX__PATH_INFO = 1; |
|
80 | - const CGIFIX__SCRIPT_NAME = 2; |
|
79 | + const CGIFIX__PATH_INFO=1; |
|
80 | + const CGIFIX__SCRIPT_NAME=2; |
|
81 | 81 | /** |
82 | 82 | * @var TUrlManager the URL manager module |
83 | 83 | */ |
@@ -85,11 +85,11 @@ discard block |
||
85 | 85 | /** |
86 | 86 | * @var string the ID of the URL manager module |
87 | 87 | */ |
88 | - private $_urlManagerID = ''; |
|
88 | + private $_urlManagerID=''; |
|
89 | 89 | /** |
90 | 90 | * @var string Separator used to separate GET variable name and value when URL format is Path. |
91 | 91 | */ |
92 | - private $_separator = ','; |
|
92 | + private $_separator=','; |
|
93 | 93 | /** |
94 | 94 | * @var string requested service ID |
95 | 95 | */ |
@@ -114,15 +114,15 @@ discard block |
||
114 | 114 | * @var boolean whether the session ID should be kept in cookie only |
115 | 115 | */ |
116 | 116 | private $_cookieOnly; |
117 | - private $_urlFormat = THttpRequestUrlFormat::Get; |
|
117 | + private $_urlFormat=THttpRequestUrlFormat::Get; |
|
118 | 118 | private $_services; |
119 | - private $_requestResolved = false; |
|
120 | - private $_enableCookieValidation = false; |
|
121 | - private $_cgiFix = 0; |
|
119 | + private $_requestResolved=false; |
|
120 | + private $_enableCookieValidation=false; |
|
121 | + private $_cgiFix=0; |
|
122 | 122 | /** |
123 | 123 | * @var boolean whether to cache the TUrlManager class (useful with a lot of TUrlMappings) |
124 | 124 | */ |
125 | - private $_enableCache = false; |
|
125 | + private $_enableCache=false; |
|
126 | 126 | /** |
127 | 127 | * @var string request URL |
128 | 128 | */ |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | /** |
137 | 137 | * @var array contains all request variables |
138 | 138 | */ |
139 | - private $_items = []; |
|
139 | + private $_items=[]; |
|
140 | 140 | |
141 | 141 | /** |
142 | 142 | * @return string id of this module |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function setID($value) |
153 | 153 | { |
154 | - $this->_id = $value; |
|
154 | + $this->_id=$value; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -162,13 +162,13 @@ discard block |
||
162 | 162 | public function init($config) |
163 | 163 | { |
164 | 164 | // Fill in default request info when the script is run in command line |
165 | - if(php_sapi_name() === 'cli') |
|
165 | + if(php_sapi_name()==='cli') |
|
166 | 166 | { |
167 | - $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; |
|
168 | - $_SERVER['REQUEST_METHOD'] = 'GET'; |
|
169 | - $_SERVER['SERVER_NAME'] = 'localhost'; |
|
170 | - $_SERVER['SERVER_PORT'] = 80; |
|
171 | - $_SERVER['HTTP_USER_AGENT'] = ''; |
|
167 | + $_SERVER['REMOTE_ADDR']='127.0.0.1'; |
|
168 | + $_SERVER['REQUEST_METHOD']='GET'; |
|
169 | + $_SERVER['SERVER_NAME']='localhost'; |
|
170 | + $_SERVER['SERVER_PORT']=80; |
|
171 | + $_SERVER['HTTP_USER_AGENT']=''; |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | // Info about server variables: |
@@ -178,29 +178,29 @@ discard block |
||
178 | 178 | // REQUEST_URI contains the URI part entered in the browser address bar |
179 | 179 | // SCRIPT_FILENAME is the file path to the executing script |
180 | 180 | if(isset($_SERVER['REQUEST_URI'])) |
181 | - $this->_requestUri = $_SERVER['REQUEST_URI']; |
|
181 | + $this->_requestUri=$_SERVER['REQUEST_URI']; |
|
182 | 182 | else // TBD: in this case, SCRIPT_NAME need to be escaped |
183 | - $this->_requestUri = $_SERVER['SCRIPT_NAME'] . (empty($_SERVER['QUERY_STRING'])?'':'?' . $_SERVER['QUERY_STRING']); |
|
183 | + $this->_requestUri=$_SERVER['SCRIPT_NAME'].(empty($_SERVER['QUERY_STRING']) ? '' : '?'.$_SERVER['QUERY_STRING']); |
|
184 | 184 | |
185 | 185 | if($this->_cgiFix & self::CGIFIX__PATH_INFO && isset($_SERVER['ORIG_PATH_INFO'])) |
186 | - $this->_pathInfo = substr($_SERVER['ORIG_PATH_INFO'], strlen($_SERVER['SCRIPT_NAME'])); |
|
186 | + $this->_pathInfo=substr($_SERVER['ORIG_PATH_INFO'], strlen($_SERVER['SCRIPT_NAME'])); |
|
187 | 187 | elseif(isset($_SERVER['PATH_INFO'])) |
188 | - $this->_pathInfo = $_SERVER['PATH_INFO']; |
|
189 | - elseif(strpos($_SERVER['PHP_SELF'], $_SERVER['SCRIPT_NAME']) === 0 && $_SERVER['PHP_SELF'] !== $_SERVER['SCRIPT_NAME']) |
|
190 | - $this->_pathInfo = substr($_SERVER['PHP_SELF'], strlen($_SERVER['SCRIPT_NAME'])); |
|
188 | + $this->_pathInfo=$_SERVER['PATH_INFO']; |
|
189 | + elseif(strpos($_SERVER['PHP_SELF'], $_SERVER['SCRIPT_NAME'])===0 && $_SERVER['PHP_SELF']!==$_SERVER['SCRIPT_NAME']) |
|
190 | + $this->_pathInfo=substr($_SERVER['PHP_SELF'], strlen($_SERVER['SCRIPT_NAME'])); |
|
191 | 191 | else |
192 | - $this->_pathInfo = ''; |
|
192 | + $this->_pathInfo=''; |
|
193 | 193 | |
194 | 194 | if(get_magic_quotes_gpc()) |
195 | 195 | { |
196 | 196 | if(isset($_GET)) |
197 | - $_GET = $this->stripSlashes($_GET); |
|
197 | + $_GET=$this->stripSlashes($_GET); |
|
198 | 198 | if(isset($_POST)) |
199 | - $_POST = $this->stripSlashes($_POST); |
|
199 | + $_POST=$this->stripSlashes($_POST); |
|
200 | 200 | if(isset($_REQUEST)) |
201 | - $_REQUEST = $this->stripSlashes($_REQUEST); |
|
201 | + $_REQUEST=$this->stripSlashes($_REQUEST); |
|
202 | 202 | if(isset($_COOKIE)) |
203 | - $_COOKIE = $this->stripSlashes($_COOKIE); |
|
203 | + $_COOKIE=$this->stripSlashes($_COOKIE); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | $this->getApplication()->setRequest($this); |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | */ |
215 | 215 | public function stripSlashes(&$data) |
216 | 216 | { |
217 | - return is_array($data)?array_map([$this,'stripSlashes'], $data):stripslashes($data); |
|
217 | + return is_array($data) ?array_map([$this, 'stripSlashes'], $data) : stripslashes($data); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -222,21 +222,21 @@ discard block |
||
222 | 222 | */ |
223 | 223 | public function getUrl() |
224 | 224 | { |
225 | - if($this->_url === null) |
|
225 | + if($this->_url===null) |
|
226 | 226 | { |
227 | - $secure = $this->getIsSecureConnection(); |
|
228 | - $url = $secure?'https://':'http://'; |
|
227 | + $secure=$this->getIsSecureConnection(); |
|
228 | + $url=$secure ? 'https://' : 'http://'; |
|
229 | 229 | if(empty($_SERVER['HTTP_HOST'])) |
230 | 230 | { |
231 | - $url .= $_SERVER['SERVER_NAME']; |
|
232 | - $port = $_SERVER['SERVER_PORT']; |
|
233 | - if(($port != 80 && !$secure) || ($port != 443 && $secure)) |
|
234 | - $url .= ':' . $port; |
|
231 | + $url.=$_SERVER['SERVER_NAME']; |
|
232 | + $port=$_SERVER['SERVER_PORT']; |
|
233 | + if(($port!=80 && !$secure) || ($port!=443 && $secure)) |
|
234 | + $url.=':'.$port; |
|
235 | 235 | } |
236 | 236 | else |
237 | - $url .= $_SERVER['HTTP_HOST']; |
|
238 | - $url .= $this->getRequestUri(); |
|
239 | - $this->_url = new TUri($url); |
|
237 | + $url.=$_SERVER['HTTP_HOST']; |
|
238 | + $url.=$this->getRequestUri(); |
|
239 | + $this->_url=new TUri($url); |
|
240 | 240 | } |
241 | 241 | return $this->_url; |
242 | 242 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | */ |
249 | 249 | public function setEnableCache($value) |
250 | 250 | { |
251 | - $this->_enableCache = TPropertyValue::ensureBoolean($value); |
|
251 | + $this->_enableCache=TPropertyValue::ensureBoolean($value); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
@@ -272,15 +272,15 @@ discard block |
||
272 | 272 | { |
273 | 273 | if($this->getEnableCache()) |
274 | 274 | { |
275 | - $cache = $this->getApplication()->getCache(); |
|
276 | - if($cache !== null) |
|
275 | + $cache=$this->getApplication()->getCache(); |
|
276 | + if($cache!==null) |
|
277 | 277 | { |
278 | - $dependencies = null; |
|
279 | - if($this->getApplication()->getMode() !== TApplicationMode::Performance) |
|
280 | - if ($manager instanceof TUrlMapping && $fn = $manager->getConfigFile()) |
|
278 | + $dependencies=null; |
|
279 | + if($this->getApplication()->getMode()!==TApplicationMode::Performance) |
|
280 | + if($manager instanceof TUrlMapping && $fn=$manager->getConfigFile()) |
|
281 | 281 | { |
282 | - $fn = Prado::getPathOfNamespace($fn, $this->getApplication()->getConfigurationFileExt()); |
|
283 | - $dependencies = new TFileCacheDependency($fn); |
|
282 | + $fn=Prado::getPathOfNamespace($fn, $this->getApplication()->getConfigurationFileExt()); |
|
283 | + $dependencies=new TFileCacheDependency($fn); |
|
284 | 284 | } |
285 | 285 | return $cache->set($this->getCacheKey(), $manager, 0, $dependencies); |
286 | 286 | } |
@@ -296,10 +296,10 @@ discard block |
||
296 | 296 | { |
297 | 297 | if($this->getEnableCache()) |
298 | 298 | { |
299 | - $cache = $this->getApplication()->getCache(); |
|
300 | - if($cache !== null) |
|
299 | + $cache=$this->getApplication()->getCache(); |
|
300 | + if($cache!==null) |
|
301 | 301 | { |
302 | - $manager = $cache->get($this->getCacheKey()); |
|
302 | + $manager=$cache->get($this->getCacheKey()); |
|
303 | 303 | if($manager instanceof TUrlManager) |
304 | 304 | return $manager; |
305 | 305 | } |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | */ |
326 | 326 | public function setUrlManager($value) |
327 | 327 | { |
328 | - $this->_urlManagerID = $value; |
|
328 | + $this->_urlManagerID=$value; |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
@@ -333,19 +333,19 @@ discard block |
||
333 | 333 | */ |
334 | 334 | public function getUrlManagerModule() |
335 | 335 | { |
336 | - if($this->_urlManager === null) |
|
336 | + if($this->_urlManager===null) |
|
337 | 337 | { |
338 | - if(($this->_urlManager = $this->loadCachedUrlManager()) === null) |
|
338 | + if(($this->_urlManager=$this->loadCachedUrlManager())===null) |
|
339 | 339 | { |
340 | 340 | if(empty($this->_urlManagerID)) |
341 | 341 | { |
342 | - $this->_urlManager = new TUrlManager; |
|
342 | + $this->_urlManager=new TUrlManager; |
|
343 | 343 | $this->_urlManager->init(null); |
344 | 344 | } |
345 | 345 | else |
346 | 346 | { |
347 | - $this->_urlManager = $this->getApplication()->getModule($this->_urlManagerID); |
|
348 | - if($this->_urlManager === null) |
|
347 | + $this->_urlManager=$this->getApplication()->getModule($this->_urlManagerID); |
|
348 | + if($this->_urlManager===null) |
|
349 | 349 | throw new TConfigurationException('httprequest_urlmanager_inexist', $this->_urlManagerID); |
350 | 350 | if(!($this->_urlManager instanceof TUrlManager)) |
351 | 351 | throw new TConfigurationException('httprequest_urlmanager_invalid', $this->_urlManagerID); |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | */ |
375 | 375 | public function setUrlFormat($value) |
376 | 376 | { |
377 | - $this->_urlFormat = TPropertyValue::ensureEnum($value, 'Prado\\Web\\THttpRequestUrlFormat'); |
|
377 | + $this->_urlFormat=TPropertyValue::ensureEnum($value, 'Prado\\Web\\THttpRequestUrlFormat'); |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | /** |
@@ -391,8 +391,8 @@ discard block |
||
391 | 391 | */ |
392 | 392 | public function setUrlParamSeparator($value) |
393 | 393 | { |
394 | - if(strlen($value) === 1) |
|
395 | - $this->_separator = $value; |
|
394 | + if(strlen($value)===1) |
|
395 | + $this->_separator=$value; |
|
396 | 396 | else |
397 | 397 | throw new TInvalidDataValueException('httprequest_separator_invalid'); |
398 | 398 | } |
@@ -402,19 +402,19 @@ discard block |
||
402 | 402 | */ |
403 | 403 | public function getRequestType() |
404 | 404 | { |
405 | - return isset($_SERVER['REQUEST_METHOD'])?$_SERVER['REQUEST_METHOD']:null; |
|
405 | + return isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : null; |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | /** |
409 | 409 | * @param boolean $mimetypeOnly whether to return only the mimetype (default: true) |
410 | 410 | * @return string content type (e.g. 'application/json' or 'text/html; encoding=gzip') or null if not specified |
411 | 411 | */ |
412 | - public function getContentType($mimetypeOnly = true) |
|
412 | + public function getContentType($mimetypeOnly=true) |
|
413 | 413 | { |
414 | 414 | if(!isset($_SERVER['CONTENT_TYPE'])) |
415 | 415 | return null; |
416 | 416 | |
417 | - if($mimetypeOnly === true && ($_pos = strpos(';', $_SERVER['CONTENT_TYPE'])) !== false) |
|
417 | + if($mimetypeOnly===true && ($_pos=strpos(';', $_SERVER['CONTENT_TYPE']))!==false) |
|
418 | 418 | return substr($_SERVER['CONTENT_TYPE'], 0, $_pos); |
419 | 419 | |
420 | 420 | return $_SERVER['CONTENT_TYPE']; |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | */ |
442 | 442 | public function getQueryString() |
443 | 443 | { |
444 | - return isset($_SERVER['QUERY_STRING'])?$_SERVER['QUERY_STRING']:null; |
|
444 | + return isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : null; |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | /** |
@@ -449,30 +449,30 @@ discard block |
||
449 | 449 | */ |
450 | 450 | public function getHttpProtocolVersion() |
451 | 451 | { |
452 | - return isset($_SERVER['SERVER_PROTOCOL'])?$_SERVER['SERVER_PROTOCOL']:null; |
|
452 | + return isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : null; |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | /** |
456 | 456 | * @param integer|null Either {@link CASE_UPPER} or {@link CASE_LOWER} or as is null (default) |
457 | 457 | * @return array |
458 | 458 | */ |
459 | - public function getHeaders($case = null) |
|
459 | + public function getHeaders($case=null) |
|
460 | 460 | { |
461 | 461 | static $result; |
462 | 462 | |
463 | - if($result === null && function_exists('apache_request_headers')) { |
|
464 | - $result = apache_request_headers(); |
|
463 | + if($result===null && function_exists('apache_request_headers')) { |
|
464 | + $result=apache_request_headers(); |
|
465 | 465 | } |
466 | - elseif($result === null) { |
|
467 | - $result = []; |
|
466 | + elseif($result===null) { |
|
467 | + $result=[]; |
|
468 | 468 | foreach($_SERVER as $key => $value) { |
469 | - if(strncasecmp($key, 'HTTP_', 5) !== 0) continue; |
|
470 | - $key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($key, 5))))); |
|
471 | - $result[$key] = $value; |
|
469 | + if(strncasecmp($key, 'HTTP_', 5)!==0) continue; |
|
470 | + $key=str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($key, 5))))); |
|
471 | + $result[$key]=$value; |
|
472 | 472 | } |
473 | 473 | } |
474 | 474 | |
475 | - if($case !== null) |
|
475 | + if($case!==null) |
|
476 | 476 | return array_change_key_case($result, $case); |
477 | 477 | |
478 | 478 | return $result; |
@@ -493,13 +493,13 @@ discard block |
||
493 | 493 | * false - force http |
494 | 494 | * @return string schema and hostname of the requested URL |
495 | 495 | */ |
496 | - public function getBaseUrl($forceSecureConnection = null) |
|
496 | + public function getBaseUrl($forceSecureConnection=null) |
|
497 | 497 | { |
498 | - $url = $this->getUrl(); |
|
499 | - $scheme = ($forceSecureConnection)?"https": (($forceSecureConnection === null)?$url->getScheme():'http'); |
|
500 | - $host = $url->getHost(); |
|
501 | - if (($port = $url->getPort())) $host .= ':' . $port; |
|
502 | - return $scheme . '://' . $host; |
|
498 | + $url=$this->getUrl(); |
|
499 | + $scheme=($forceSecureConnection) ? "https" : (($forceSecureConnection===null) ? $url->getScheme() : 'http'); |
|
500 | + $host=$url->getHost(); |
|
501 | + if(($port=$url->getPort())) $host.=':'.$port; |
|
502 | + return $scheme.'://'.$host; |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | /** |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | if($this->_cgiFix & self::CGIFIX__SCRIPT_NAME && isset($_SERVER['ORIG_SCRIPT_NAME'])) |
511 | 511 | return $_SERVER['ORIG_SCRIPT_NAME']; |
512 | 512 | |
513 | - return isset($_SERVER['SCRIPT_NAME'])?$_SERVER['SCRIPT_NAME']:null; |
|
513 | + return isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : null; |
|
514 | 514 | } |
515 | 515 | |
516 | 516 | /** |
@@ -520,9 +520,9 @@ discard block |
||
520 | 520 | * false - force http |
521 | 521 | * @return string entry script URL (w/ host part) |
522 | 522 | */ |
523 | - public function getAbsoluteApplicationUrl($forceSecureConnection = null) |
|
523 | + public function getAbsoluteApplicationUrl($forceSecureConnection=null) |
|
524 | 524 | { |
525 | - return $this->getBaseUrl($forceSecureConnection) . $this->getApplicationUrl(); |
|
525 | + return $this->getBaseUrl($forceSecureConnection).$this->getApplicationUrl(); |
|
526 | 526 | } |
527 | 527 | |
528 | 528 | /** |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | */ |
531 | 531 | public function getApplicationFilePath() |
532 | 532 | { |
533 | - return realpath(isset($_SERVER['SCRIPT_FILENAME'])?$_SERVER['SCRIPT_FILENAME']:null); |
|
533 | + return realpath(isset($_SERVER['SCRIPT_FILENAME']) ? $_SERVER['SCRIPT_FILENAME'] : null); |
|
534 | 534 | } |
535 | 535 | |
536 | 536 | /** |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | */ |
539 | 539 | public function getServerName() |
540 | 540 | { |
541 | - return isset($_SERVER['SERVER_NAME'])?$_SERVER['SERVER_NAME']:null; |
|
541 | + return isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : null; |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | /** |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | */ |
547 | 547 | public function getServerPort() |
548 | 548 | { |
549 | - return isset($_SERVER['SERVER_PORT'])?$_SERVER['SERVER_PORT']:null; |
|
549 | + return isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : null; |
|
550 | 550 | } |
551 | 551 | |
552 | 552 | /** |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | */ |
555 | 555 | public function getUrlReferrer() |
556 | 556 | { |
557 | - return isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:null; |
|
557 | + return isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null; |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | /** |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | */ |
564 | 564 | public function getServerSoftware() |
565 | 565 | { |
566 | - return isset($_SERVER['SERVER_SOFTWARE'])?$_SERVER['SERVER_SOFTWARE']:null; |
|
566 | + return isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : null; |
|
567 | 567 | } |
568 | 568 | |
569 | 569 | /** |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | */ |
588 | 588 | public function getUserAgent() |
589 | 589 | { |
590 | - return isset($_SERVER['HTTP_USER_AGENT'])?$_SERVER['HTTP_USER_AGENT']:null; |
|
590 | + return isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null; |
|
591 | 591 | } |
592 | 592 | |
593 | 593 | /** |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | */ |
596 | 596 | public function getUserHostAddress() |
597 | 597 | { |
598 | - return isset($_SERVER['REMOTE_ADDR'])?$_SERVER['REMOTE_ADDR']:null; |
|
598 | + return isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null; |
|
599 | 599 | } |
600 | 600 | |
601 | 601 | /** |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | */ |
604 | 604 | public function getUserHost() |
605 | 605 | { |
606 | - return isset($_SERVER['REMOTE_HOST'])?$_SERVER['REMOTE_HOST']:null; |
|
606 | + return isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : null; |
|
607 | 607 | } |
608 | 608 | |
609 | 609 | /** |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | public function getAcceptTypes() |
613 | 613 | { |
614 | 614 | // TBD: break it into array?? |
615 | - return isset($_SERVER['HTTP_ACCEPT'])?$_SERVER['HTTP_ACCEPT']:null; |
|
615 | + return isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : null; |
|
616 | 616 | } |
617 | 617 | |
618 | 618 | /** |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | */ |
641 | 641 | public function setEnableCookieValidation($value) |
642 | 642 | { |
643 | - $this->_enableCookieValidation = TPropertyValue::ensureBoolean($value); |
|
643 | + $this->_enableCookieValidation=TPropertyValue::ensureBoolean($value); |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | /** |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | */ |
661 | 661 | public function setCgiFix($value) |
662 | 662 | { |
663 | - $this->_cgiFix = TPropertyValue::ensureInteger($value); |
|
663 | + $this->_cgiFix=TPropertyValue::ensureInteger($value); |
|
664 | 664 | } |
665 | 665 | |
666 | 666 | /** |
@@ -668,15 +668,15 @@ discard block |
||
668 | 668 | */ |
669 | 669 | public function getCookies() |
670 | 670 | { |
671 | - if($this->_cookies === null) |
|
671 | + if($this->_cookies===null) |
|
672 | 672 | { |
673 | - $this->_cookies = new THttpCookieCollection; |
|
673 | + $this->_cookies=new THttpCookieCollection; |
|
674 | 674 | if($this->getEnableCookieValidation()) |
675 | 675 | { |
676 | - $sm = $this->getApplication()->getSecurityManager(); |
|
676 | + $sm=$this->getApplication()->getSecurityManager(); |
|
677 | 677 | foreach($_COOKIE as $key => $value) |
678 | 678 | { |
679 | - if(($value = $sm->validateData($value)) !== false) |
|
679 | + if(($value=$sm->validateData($value))!==false) |
|
680 | 680 | $this->_cookies->add(new THttpCookie($key, $value)); |
681 | 681 | } |
682 | 682 | } |
@@ -730,13 +730,13 @@ discard block |
||
730 | 730 | * @return string URL |
731 | 731 | * @see TUrlManager::constructUrl |
732 | 732 | */ |
733 | - public function constructUrl($serviceID, $serviceParam, $getItems = null, $encodeAmpersand = true, $encodeGetItems = true) |
|
733 | + public function constructUrl($serviceID, $serviceParam, $getItems=null, $encodeAmpersand=true, $encodeGetItems=true) |
|
734 | 734 | { |
735 | - if ($this->_cookieOnly === null) |
|
736 | - $this->_cookieOnly = (int)ini_get('session.use_cookies') && (int)ini_get('session.use_only_cookies'); |
|
737 | - $url = $this->getUrlManagerModule()->constructUrl($serviceID, $serviceParam, $getItems, $encodeAmpersand, $encodeGetItems); |
|
738 | - if(defined('SID') && SID != '' && !$this->_cookieOnly) |
|
739 | - return $url . (strpos($url, '?') === false? '?' : ($encodeAmpersand?'&':'&')) . SID; |
|
735 | + if($this->_cookieOnly===null) |
|
736 | + $this->_cookieOnly=(int) ini_get('session.use_cookies') && (int) ini_get('session.use_only_cookies'); |
|
737 | + $url=$this->getUrlManagerModule()->constructUrl($serviceID, $serviceParam, $getItems, $encodeAmpersand, $encodeGetItems); |
|
738 | + if(defined('SID') && SID!='' && !$this->_cookieOnly) |
|
739 | + return $url.(strpos($url, '?')===false ? '?' : ($encodeAmpersand ? '&' : '&')).SID; |
|
740 | 740 | else |
741 | 741 | return $url; |
742 | 742 | } |
@@ -764,12 +764,12 @@ discard block |
||
764 | 764 | */ |
765 | 765 | public function resolveRequest($serviceIDs) |
766 | 766 | { |
767 | - Prado::trace("Resolving request from " . $_SERVER['REMOTE_ADDR'], 'Prado\Web\THttpRequest'); |
|
768 | - $getParams = $this->parseUrl(); |
|
767 | + Prado::trace("Resolving request from ".$_SERVER['REMOTE_ADDR'], 'Prado\Web\THttpRequest'); |
|
768 | + $getParams=$this->parseUrl(); |
|
769 | 769 | foreach($getParams as $name => $value) |
770 | - $_GET[$name] = $value; |
|
771 | - $this->_items = array_merge($_GET, $_POST); |
|
772 | - $this->_requestResolved = true; |
|
770 | + $_GET[$name]=$value; |
|
771 | + $this->_items=array_merge($_GET, $_POST); |
|
772 | + $this->_requestResolved=true; |
|
773 | 773 | foreach($serviceIDs as $serviceID) |
774 | 774 | { |
775 | 775 | if($this->contains($serviceID)) |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | */ |
805 | 805 | public function setServiceID($value) |
806 | 806 | { |
807 | - $this->_serviceID = $value; |
|
807 | + $this->_serviceID=$value; |
|
808 | 808 | } |
809 | 809 | |
810 | 810 | /** |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | */ |
822 | 822 | public function setServiceParameter($value) |
823 | 823 | { |
824 | - $this->_serviceParam = $value; |
|
824 | + $this->_serviceParam=$value; |
|
825 | 825 | } |
826 | 826 | |
827 | 827 | //------ The following methods enable THttpRequest to be TMap-like ----- |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | */ |
882 | 882 | public function add($key, $value) |
883 | 883 | { |
884 | - $this->_items[$key] = $value; |
|
884 | + $this->_items[$key]=$value; |
|
885 | 885 | } |
886 | 886 | |
887 | 887 | /** |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | { |
895 | 895 | if(isset($this->_items[$key]) || array_key_exists($key, $this->_items)) |
896 | 896 | { |
897 | - $value = $this->_items[$key]; |
|
897 | + $value=$this->_items[$key]; |
|
898 | 898 | unset($this->_items[$key]); |
899 | 899 | return $value; |
900 | 900 | } |
@@ -232,8 +232,7 @@ discard block |
||
232 | 232 | $port = $_SERVER['SERVER_PORT']; |
233 | 233 | if(($port != 80 && !$secure) || ($port != 443 && $secure)) |
234 | 234 | $url .= ':' . $port; |
235 | - } |
|
236 | - else |
|
235 | + } else |
|
237 | 236 | $url .= $_SERVER['HTTP_HOST']; |
238 | 237 | $url .= $this->getRequestUri(); |
239 | 238 | $this->_url = new TUri($url); |
@@ -341,8 +340,7 @@ discard block |
||
341 | 340 | { |
342 | 341 | $this->_urlManager = new TUrlManager; |
343 | 342 | $this->_urlManager->init(null); |
344 | - } |
|
345 | - else |
|
343 | + } else |
|
346 | 344 | { |
347 | 345 | $this->_urlManager = $this->getApplication()->getModule($this->_urlManagerID); |
348 | 346 | if($this->_urlManager === null) |
@@ -462,8 +460,7 @@ discard block |
||
462 | 460 | |
463 | 461 | if($result === null && function_exists('apache_request_headers')) { |
464 | 462 | $result = apache_request_headers(); |
465 | - } |
|
466 | - elseif($result === null) { |
|
463 | + } elseif($result === null) { |
|
467 | 464 | $result = []; |
468 | 465 | foreach($_SERVER as $key => $value) { |
469 | 466 | if(strncasecmp($key, 'HTTP_', 5) !== 0) continue; |
@@ -575,8 +572,7 @@ discard block |
||
575 | 572 | try |
576 | 573 | { |
577 | 574 | return get_browser(); |
578 | - } |
|
579 | - catch(TPhpErrorException $e) |
|
575 | + } catch(TPhpErrorException $e) |
|
580 | 576 | { |
581 | 577 | throw new TConfigurationException('httprequest_browscap_required'); |
582 | 578 | } |
@@ -679,8 +675,7 @@ discard block |
||
679 | 675 | if(($value = $sm->validateData($value)) !== false) |
680 | 676 | $this->_cookies->add(new THttpCookie($key, $value)); |
681 | 677 | } |
682 | - } |
|
683 | - else |
|
678 | + } else |
|
684 | 679 | { |
685 | 680 | foreach($_COOKIE as $key => $value) |
686 | 681 | $this->_cookies->add(new THttpCookie($key, $value)); |
@@ -897,8 +892,7 @@ discard block |
||
897 | 892 | $value = $this->_items[$key]; |
898 | 893 | unset($this->_items[$key]); |
899 | 894 | return $value; |
900 | - } |
|
901 | - else |
|
895 | + } else |
|
902 | 896 | return null; |
903 | 897 | } |
904 | 898 |
@@ -260,6 +260,7 @@ discard block |
||
260 | 260 | * method, be sure to call the parent implementation so that the event |
261 | 261 | * handler can be invoked. |
262 | 262 | * @param TCallbackEventParameter event parameter to be passed to the event handlers |
263 | + * @param TJuiAutoCompleteEventParameter $param |
|
263 | 264 | */ |
264 | 265 | public function onSuggest($param) |
265 | 266 | { |
@@ -272,6 +273,7 @@ discard block |
||
272 | 273 | * method, be sure to call the parent implementation so that the event |
273 | 274 | * handler can be invoked. |
274 | 275 | * @param TCallbackEventParameter event parameter to be passed to the event handlers |
276 | + * @param TJuiAutoCompleteEventParameter $param |
|
275 | 277 | */ |
276 | 278 | public function onSuggestionSelected($param) |
277 | 279 | { |
@@ -243,14 +243,12 @@ |
||
243 | 243 | { |
244 | 244 | $parameter = new TJuiAutoCompleteEventParameter($this->getResponse(), $token[0]); |
245 | 245 | $this->onSuggest($parameter); |
246 | - } |
|
247 | - elseif($token[1] === '__TJuiAutoComplete_onSuggestionSelected__') |
|
246 | + } elseif($token[1] === '__TJuiAutoComplete_onSuggestionSelected__') |
|
248 | 247 | { |
249 | 248 | $parameter = new TJuiAutoCompleteEventParameter($this->getResponse(), null, $token[0]); |
250 | 249 | $this->onSuggestionSelected($parameter); |
251 | 250 | } |
252 | - } |
|
253 | - elseif($this->getAutoPostBack()) |
|
251 | + } elseif($this->getAutoPostBack()) |
|
254 | 252 | parent::raiseCallbackEvent($param); |
255 | 253 | } |
256 | 254 |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function getOptions() |
133 | 133 | { |
134 | - if (($options = $this->getViewState('JuiOptions')) === null) |
|
134 | + if(($options=$this->getViewState('JuiOptions'))===null) |
|
135 | 135 | { |
136 | - $options = new TJuiControlOptions($this); |
|
136 | + $options=new TJuiControlOptions($this); |
|
137 | 137 | $this->setViewState('JuiOptions', $options); |
138 | 138 | } |
139 | 139 | return $options; |
@@ -236,17 +236,17 @@ discard block |
||
236 | 236 | */ |
237 | 237 | public function raiseCallbackEvent($param) |
238 | 238 | { |
239 | - $token = $param->getCallbackParameter(); |
|
240 | - if(is_array($token) && count($token) == 2) |
|
239 | + $token=$param->getCallbackParameter(); |
|
240 | + if(is_array($token) && count($token)==2) |
|
241 | 241 | { |
242 | - if($token[1] === '__TJuiAutoComplete_onSuggest__') |
|
242 | + if($token[1]==='__TJuiAutoComplete_onSuggest__') |
|
243 | 243 | { |
244 | - $parameter = new TJuiAutoCompleteEventParameter($this->getResponse(), $token[0]); |
|
244 | + $parameter=new TJuiAutoCompleteEventParameter($this->getResponse(), $token[0]); |
|
245 | 245 | $this->onSuggest($parameter); |
246 | 246 | } |
247 | - elseif($token[1] === '__TJuiAutoComplete_onSuggestionSelected__') |
|
247 | + elseif($token[1]==='__TJuiAutoComplete_onSuggestionSelected__') |
|
248 | 248 | { |
249 | - $parameter = new TJuiAutoCompleteEventParameter($this->getResponse(), null, $token[0]); |
|
249 | + $parameter=new TJuiAutoCompleteEventParameter($this->getResponse(), null, $token[0]); |
|
250 | 250 | $this->onSuggestionSelected($parameter); |
251 | 251 | } |
252 | 252 | } |
@@ -302,8 +302,8 @@ discard block |
||
302 | 302 | */ |
303 | 303 | public function getResultPanel() |
304 | 304 | { |
305 | - if($this->_resultPanel === null) |
|
306 | - $this->_resultPanel = $this->createResultPanel(); |
|
305 | + if($this->_resultPanel===null) |
|
306 | + $this->_resultPanel=$this->createResultPanel(); |
|
307 | 307 | return $this->_resultPanel; |
308 | 308 | } |
309 | 309 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | */ |
313 | 313 | protected function createResultPanel() |
314 | 314 | { |
315 | - $panel = new TPanel; |
|
315 | + $panel=new TPanel; |
|
316 | 316 | $this->getControls()->add($panel); |
317 | 317 | $panel->setID('result'); |
318 | 318 | return $panel; |
@@ -323,8 +323,8 @@ discard block |
||
323 | 323 | */ |
324 | 324 | public function getSuggestions() |
325 | 325 | { |
326 | - if($this->_repeater === null) |
|
327 | - $this->_repeater = $this->createRepeater(); |
|
326 | + if($this->_repeater===null) |
|
327 | + $this->_repeater=$this->createRepeater(); |
|
328 | 328 | return $this->_repeater; |
329 | 329 | } |
330 | 330 | |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | */ |
334 | 334 | protected function createRepeater() |
335 | 335 | { |
336 | - $repeater = new TRepeater; |
|
336 | + $repeater=new TRepeater; |
|
337 | 337 | $repeater->setItemTemplate(new TTemplate('<%# $this->Data %>', null)); |
338 | 338 | $this->getControls()->add($repeater); |
339 | 339 | return $repeater; |
@@ -374,14 +374,14 @@ discard block |
||
374 | 374 | { |
375 | 375 | if($this->getActiveControl()->canUpdateClientSide(true)) |
376 | 376 | { |
377 | - $data = []; |
|
378 | - $items = $this->getSuggestions()->getItems(); |
|
379 | - $writer = new TTextWriter; |
|
380 | - for($i = 0; $i < $items->Count; $i++) |
|
377 | + $data=[]; |
|
378 | + $items=$this->getSuggestions()->getItems(); |
|
379 | + $writer=new TTextWriter; |
|
380 | + for($i=0; $i < $items->Count; $i++) |
|
381 | 381 | { |
382 | 382 | $items->itemAt($i)->render($writer); |
383 | - $item = $writer->flush(); |
|
384 | - $data[] = [ 'id' => $i, 'label' => $item]; |
|
383 | + $item=$writer->flush(); |
|
384 | + $data[]=['id' => $i, 'label' => $item]; |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | $this->getResponse()->getAdapter()->setResponseData($data); |
@@ -393,25 +393,25 @@ discard block |
||
393 | 393 | */ |
394 | 394 | protected function getPostBackOptions() |
395 | 395 | { |
396 | - $options = $this->getOptions()->toArray(); |
|
396 | + $options=$this->getOptions()->toArray(); |
|
397 | 397 | |
398 | - if(strlen($separator = $this->getSeparator())) |
|
399 | - $options['Separators'] = $separator; |
|
398 | + if(strlen($separator=$this->getSeparator())) |
|
399 | + $options['Separators']=$separator; |
|
400 | 400 | |
401 | 401 | if($this->getAutoPostBack()) |
402 | 402 | { |
403 | - $options = array_merge($options, parent::getPostBackOptions()); |
|
404 | - $options['AutoPostBack'] = true; |
|
403 | + $options=array_merge($options, parent::getPostBackOptions()); |
|
404 | + $options['AutoPostBack']=true; |
|
405 | 405 | } |
406 | - if(strlen($textCssClass = $this->getTextCssClass())) |
|
407 | - $options['textCssClass'] = $textCssClass; |
|
408 | - $options['minLength'] = $this->getMinChars(); |
|
409 | - $options['delay'] = $this->getFrequency() * 1000.0; |
|
410 | - $options['appendTo'] = '#' . $this->getResultPanel()->getClientID(); |
|
411 | - $options['ID'] = $this->getClientID(); |
|
412 | - $options['EventTarget'] = $this->getUniqueID(); |
|
413 | - $options['CausesValidation'] = $this->getCausesValidation(); |
|
414 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
406 | + if(strlen($textCssClass=$this->getTextCssClass())) |
|
407 | + $options['textCssClass']=$textCssClass; |
|
408 | + $options['minLength']=$this->getMinChars(); |
|
409 | + $options['delay']=$this->getFrequency() * 1000.0; |
|
410 | + $options['appendTo']='#'.$this->getResultPanel()->getClientID(); |
|
411 | + $options['ID']=$this->getClientID(); |
|
412 | + $options['EventTarget']=$this->getUniqueID(); |
|
413 | + $options['CausesValidation']=$this->getCausesValidation(); |
|
414 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
415 | 415 | return $options; |
416 | 416 | } |
417 | 417 |
@@ -222,6 +222,7 @@ |
||
222 | 222 | * If you override this method, be sure to call the parent implementation |
223 | 223 | * so that the event handlers can be invoked. |
224 | 224 | * @param \Prado\Web\UI\TCommandEventParameter event parameter to be passed to the event handlers |
225 | + * @param TCommandEventParameter $param |
|
225 | 226 | */ |
226 | 227 | public function onCommand($param) |
227 | 228 | { |
@@ -102,12 +102,12 @@ discard block |
||
102 | 102 | */ |
103 | 103 | protected function addAttributesToRender($writer) |
104 | 104 | { |
105 | - $page = $this->getPage(); |
|
105 | + $page=$this->getPage(); |
|
106 | 106 | $page->ensureRenderInForm($this); |
107 | 107 | $writer->addAttribute('type', strtolower($this->getButtonType())); |
108 | - if(($uniqueID = $this->getUniqueID()) !== '') |
|
108 | + if(($uniqueID=$this->getUniqueID())!=='') |
|
109 | 109 | $writer->addAttribute('name', $uniqueID); |
110 | - if($this->getButtonTag() === TButtonTag::Button) |
|
110 | + if($this->getButtonTag()===TButtonTag::Button) |
|
111 | 111 | $this->addParsedObject($this->getText()); |
112 | 112 | else |
113 | 113 | $writer->addAttribute('value', $this->getText()); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | { |
149 | 149 | if($this->getCausesValidation()) |
150 | 150 | { |
151 | - $group = $this->getValidationGroup(); |
|
151 | + $group=$this->getValidationGroup(); |
|
152 | 152 | return $this->getPage()->getValidators($group)->getCount() > 0; |
153 | 153 | } |
154 | 154 | else |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | */ |
177 | 177 | protected function needPostBackScript() |
178 | 178 | { |
179 | - return $this->canCauseValidation() || ($this->getButtonType() !== TButtonType::Submit && |
|
179 | + return $this->canCauseValidation() || ($this->getButtonType()!==TButtonType::Submit && |
|
180 | 180 | ($this->hasEventHandler('OnClick') || $this->hasEventHandler('OnCommand'))) |
181 | 181 | || $this->getIsDefaultButton(); |
182 | 182 | } |
@@ -188,10 +188,10 @@ discard block |
||
188 | 188 | */ |
189 | 189 | protected function getPostBackOptions() |
190 | 190 | { |
191 | - $options['ID'] = $this->getClientID(); |
|
192 | - $options['CausesValidation'] = $this->getCausesValidation(); |
|
193 | - $options['EventTarget'] = $this->getUniqueID(); |
|
194 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
191 | + $options['ID']=$this->getClientID(); |
|
192 | + $options['CausesValidation']=$this->getCausesValidation(); |
|
193 | + $options['EventTarget']=$this->getUniqueID(); |
|
194 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
195 | 195 | |
196 | 196 | return $options; |
197 | 197 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public function renderContents($writer) |
206 | 206 | { |
207 | - if($this->getButtonTag() === TButtonTag::Button) |
|
207 | + if($this->getButtonTag()===TButtonTag::Button) |
|
208 | 208 | parent::renderContents($writer); |
209 | 209 | } |
210 | 210 |
@@ -115,8 +115,7 @@ discard block |
||
115 | 115 | { |
116 | 116 | if($this->getEnableClientScript() && $this->needPostBackScript()) |
117 | 117 | $this->renderClientControlScript($writer); |
118 | - } |
|
119 | - elseif($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
118 | + } elseif($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
120 | 119 | $writer->addAttribute('disabled', 'disabled'); |
121 | 120 | |
122 | 121 | parent::addAttributesToRender($writer); |
@@ -150,8 +149,7 @@ discard block |
||
150 | 149 | { |
151 | 150 | $group = $this->getValidationGroup(); |
152 | 151 | return $this->getPage()->getValidators($group)->getCount() > 0; |
153 | - } |
|
154 | - else |
|
152 | + } else |
|
155 | 153 | return false; |
156 | 154 | } |
157 | 155 |