@@ -70,7 +70,7 @@ |
||
70 | 70 | $fname = ucwords(str_replace('_', ' ', $name)); |
71 | 71 | $sorts[$name . ' ASC'] = $fname . ' Ascending'; |
72 | 72 | $sorts[$name . ' DESC'] = $fname . ' Descending'; |
73 | - $headers[] = $fname ; |
|
73 | + $headers[] = $fname; |
|
74 | 74 | } |
75 | 75 | $this->_sort->setDataSource($sorts); |
76 | 76 | $this->_sort->dataBind(); |
@@ -169,9 +169,9 @@ discard block |
||
169 | 169 | { |
170 | 170 | $value = $this->getRecordPropertyValue($column, $record); |
171 | 171 | $hours = []; |
172 | - for($i = 0;$i < 24;$i++) $hours[] = str_pad($i, 2, '0', STR_PAD_LEFT); |
|
172 | + for($i = 0; $i < 24; $i++) $hours[] = str_pad($i, 2, '0', STR_PAD_LEFT); |
|
173 | 173 | $mins = []; |
174 | - for($i = 0;$i < 60;$i++) $mins[] = str_pad($i, 2, '0', STR_PAD_LEFT); |
|
174 | + for($i = 0; $i < 60; $i++) $mins[] = str_pad($i, 2, '0', STR_PAD_LEFT); |
|
175 | 175 | $hour = intval(@date('H')); |
176 | 176 | $min = intval(@date('i')); |
177 | 177 | $sec = intval(@date('s')); |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | $scontrol->setSelectedValue(intval($sec)); |
211 | 211 | $container->Controls[] = $scontrol; |
212 | 212 | |
213 | - return [$hcontrol,$mcontrol,$scontrol]; |
|
213 | + return [$hcontrol, $mcontrol, $scontrol]; |
|
214 | 214 | } |
215 | 215 | |
216 | 216 |
@@ -310,7 +310,7 @@ |
||
310 | 310 | { |
311 | 311 | $source = $this->getSourceRecord(); |
312 | 312 | $builder = $this->getAssociationTableCommandBuilder(); |
313 | - for($i = 0;$i < $total;$i++) |
|
313 | + for($i = 0; $i < $total; $i++) |
|
314 | 314 | $success = $fkObjects[$i]->save() && $success; |
315 | 315 | return $this->updateAssociationTable($obj, $fkObjects, $builder) && $success; |
316 | 316 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | get_class($record), self::TABLE_CONST); |
81 | 81 | return $value; |
82 | 82 | } |
83 | - elseif ($class->hasMethod(self::TABLE_METHOD)) |
|
83 | + elseif($class->hasMethod(self::TABLE_METHOD)) |
|
84 | 84 | { |
85 | 85 | $value = $record->{self::TABLE_METHOD}(); |
86 | 86 | if(empty($value)) |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | else |
362 | 362 | $values[$name] = $value; |
363 | 363 | } |
364 | - return [$values,$primary]; |
|
364 | + return [$values, $primary]; |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | protected function updateAssociatedRecords(TActiveRecord $record, $updateBelongsTo = false) |
@@ -247,8 +247,8 @@ discard block |
||
247 | 247 | { |
248 | 248 | foreach($config['urls'] as $url) |
249 | 249 | { |
250 | - $class = isset($url['class'])?$url['class']:$defaultClass; |
|
251 | - $properties = isset($url['properties'])?$url['properties']:[]; |
|
250 | + $class = isset($url['class']) ? $url['class'] : $defaultClass; |
|
251 | + $properties = isset($url['properties']) ? $url['properties'] : []; |
|
252 | 252 | $this->buildUrlMapping($class, $properties, $url); |
253 | 253 | } |
254 | 254 | } |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | if(is_string($key)) |
320 | 320 | $params[$key] = $value; |
321 | 321 | } |
322 | - if (!$pattern->getIsWildCardPattern()) |
|
322 | + if(!$pattern->getIsWildCardPattern()) |
|
323 | 323 | $params[$pattern->getServiceID()] = $pattern->getServiceParameter(); |
324 | 324 | return $params; |
325 | 325 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | if(is_string($value)) |
145 | 145 | return self::quoteString($value); |
146 | 146 | elseif(is_bool($value)) |
147 | - return $value?'true':'false'; |
|
147 | + return $value ? 'true' : 'false'; |
|
148 | 148 | elseif(is_array($value)) |
149 | 149 | { |
150 | 150 | $results = ''; |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | } |
198 | 198 | } |
199 | 199 | elseif(is_object($value)) |
200 | - if ($value instanceof TJavaScriptLiteral) |
|
200 | + if($value instanceof TJavaScriptLiteral) |
|
201 | 201 | return $value->toJavaScriptLiteral(); |
202 | 202 | else |
203 | 203 | return self::encode(get_object_vars($value), $toMap); |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | */ |
215 | 215 | public static function jsonEncode($value, $options = 0) |
216 | 216 | { |
217 | - if (($g = Prado::getApplication()->getGlobalization(false)) !== null && |
|
217 | + if(($g = Prado::getApplication()->getGlobalization(false)) !== null && |
|
218 | 218 | strtoupper($enc = $g->getCharset()) != 'UTF-8') { |
219 | 219 | self::convertToUtf8($value, $enc); |
220 | 220 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | private static function convertToUtf8(&$value, $sourceEncoding) { |
233 | 233 | if(is_string($value)) |
234 | 234 | $value = iconv($sourceEncoding, 'UTF-8', $value); |
235 | - elseif (is_array($value)) |
|
235 | + elseif(is_array($value)) |
|
236 | 236 | { |
237 | 237 | foreach($value as &$element) |
238 | 238 | self::convertToUtf8($element, $sourceEncoding); |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | |
257 | 257 | private static function checkJsonError() |
258 | 258 | { |
259 | - switch ($err = json_last_error()) |
|
259 | + switch($err = json_last_error()) |
|
260 | 260 | { |
261 | 261 | case JSON_ERROR_NONE: |
262 | 262 | return; |
@@ -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,7 +211,7 @@ 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 | 216 | $this->_contentType = $type; |
217 | 217 | } |
@@ -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)) |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $isIIS = (stripos($this->getRequest()->getServerSoftware(), "microsoft-iis") !== false); |
434 | 434 | if($url[0] === '/') |
435 | 435 | $url = $this->getRequest()->getBaseUrl() . $url; |
436 | - if ($this->_status >= 300 && $this->_status < 400) |
|
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) |
@@ -499,9 +499,9 @@ discard block |
||
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 | 506 | $this->_bufferOutput = false; |
507 | 507 | ob_end_flush(); |
@@ -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 | |
@@ -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,7 +552,7 @@ 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 | 557 | if($charset === false) { |
558 | 558 | $this->appendHeader('Content-Type: ' . $contentType); |
@@ -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 | /** |
@@ -100,7 +100,7 @@ |
||
100 | 100 | */ |
101 | 101 | public function _read($id) |
102 | 102 | { |
103 | - return (string)$this->_cache->get($this->calculateKey($id)); |
|
103 | + return (string) $this->_cache->get($this->calculateKey($id)); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | if(isset($_SERVER['REQUEST_URI'])) |
181 | 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 | 186 | $this->_pathInfo = substr($_SERVER['ORIG_PATH_INFO'], strlen($_SERVER['SCRIPT_NAME'])); |
@@ -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 | /** |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | if($this->_url === null) |
226 | 226 | { |
227 | 227 | $secure = $this->getIsSecureConnection(); |
228 | - $url = $secure?'https://':'http://'; |
|
228 | + $url = $secure ? 'https://' : 'http://'; |
|
229 | 229 | if(empty($_SERVER['HTTP_HOST'])) |
230 | 230 | { |
231 | 231 | $url .= $_SERVER['SERVER_NAME']; |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | { |
278 | 278 | $dependencies = null; |
279 | 279 | if($this->getApplication()->getMode() !== TApplicationMode::Performance) |
280 | - if ($manager instanceof TUrlMapping && $fn = $manager->getConfigFile()) |
|
280 | + if($manager instanceof TUrlMapping && $fn = $manager->getConfigFile()) |
|
281 | 281 | { |
282 | 282 | $fn = Prado::getPathOfNamespace($fn, $this->getApplication()->getConfigurationFileExt()); |
283 | 283 | $dependencies = new TFileCacheDependency($fn); |
@@ -402,7 +402,7 @@ 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 | /** |
@@ -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,7 +449,7 @@ 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 | /** |
@@ -496,9 +496,9 @@ discard block |
||
496 | 496 | public function getBaseUrl($forceSecureConnection = null) |
497 | 497 | { |
498 | 498 | $url = $this->getUrl(); |
499 | - $scheme = ($forceSecureConnection)?"https": (($forceSecureConnection === null)?$url->getScheme():'http'); |
|
499 | + $scheme = ($forceSecureConnection) ? "https" : (($forceSecureConnection === null) ? $url->getScheme() : 'http'); |
|
500 | 500 | $host = $url->getHost(); |
501 | - if (($port = $url->getPort())) $host .= ':' . $port; |
|
501 | + if(($port = $url->getPort())) $host .= ':' . $port; |
|
502 | 502 | return $scheme . '://' . $host; |
503 | 503 | } |
504 | 504 | |
@@ -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 | /** |
@@ -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 | /** |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | { |
577 | 577 | return get_browser(); |
578 | 578 | } |
579 | - catch(TPhpErrorException $e) |
|
579 | + catch (TPhpErrorException $e) |
|
580 | 580 | { |
581 | 581 | throw new TConfigurationException('httprequest_browscap_required'); |
582 | 582 | } |
@@ -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 | /** |
@@ -732,11 +732,11 @@ discard block |
||
732 | 732 | */ |
733 | 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'); |
|
735 | + if($this->_cookieOnly === null) |
|
736 | + $this->_cookieOnly = (int) ini_get('session.use_cookies') && (int) ini_get('session.use_only_cookies'); |
|
737 | 737 | $url = $this->getUrlManagerModule()->constructUrl($serviceID, $serviceParam, $getItems, $encodeAmpersand, $encodeGetItems); |
738 | 738 | if(defined('SID') && SID != '' && !$this->_cookieOnly) |
739 | - return $url . (strpos($url, '?') === false? '?' : ($encodeAmpersand?'&':'&')) . SID; |
|
739 | + return $url . (strpos($url, '?') === false ? '?' : ($encodeAmpersand ? '&' : '&')) . SID; |
|
740 | 740 | else |
741 | 741 | return $url; |
742 | 742 | } |