@@ -119,11 +119,9 @@ |
||
| 119 | 119 | { |
| 120 | 120 | $this->setChecked(true); |
| 121 | 121 | return true; |
| 122 | - } |
|
| 123 | - else |
|
| 122 | + } else |
|
| 124 | 123 | return false; |
| 125 | - } |
|
| 126 | - elseif($this->getChecked()) |
|
| 124 | + } elseif($this->getChecked()) |
|
| 127 | 125 | $this->setChecked(false); |
| 128 | 126 | return false; |
| 129 | 127 | } |
@@ -112,7 +112,7 @@ |
||
| 112 | 112 | public function loadPostData($key, $values) |
| 113 | 113 | { |
| 114 | 114 | $uniqueGroupName = $this->getUniqueGroupName(); |
| 115 | - $value = isset($values[$uniqueGroupName])?$values[$uniqueGroupName]:null; |
|
| 115 | + $value = isset($values[$uniqueGroupName]) ? $values[$uniqueGroupName] : null; |
|
| 116 | 116 | if($value !== null && $value === $this->getValueAttribute()) |
| 117 | 117 | { |
| 118 | 118 | if(!$this->getChecked()) |
@@ -132,8 +132,7 @@ |
||
| 132 | 132 | { |
| 133 | 133 | $this->raiseBubbleEvent($this, new TDataGridCommandEventParameter($this, $sender, $param)); |
| 134 | 134 | return true; |
| 135 | - } |
|
| 136 | - else |
|
| 135 | + } else |
|
| 137 | 136 | return false; |
| 138 | 137 | } |
| 139 | 138 | } |
| 140 | 139 | \ No newline at end of file |
@@ -39,8 +39,7 @@ |
||
| 39 | 39 | { |
| 40 | 40 | $this->raiseBubbleEvent($this, new TRepeaterCommandEventParameter($this, $sender, $param)); |
| 41 | 41 | return true; |
| 42 | - } |
|
| 43 | - else |
|
| 42 | + } else |
|
| 44 | 43 | return false; |
| 45 | 44 | } |
| 46 | 45 | } |
@@ -137,8 +137,7 @@ |
||
| 137 | 137 | { |
| 138 | 138 | $this->raiseBubbleEvent($this, new TDataListCommandEventParameter($this, $sender, $param)); |
| 139 | 139 | return true; |
| 140 | - } |
|
| 141 | - else |
|
| 140 | + } else |
|
| 142 | 141 | return false; |
| 143 | 142 | } |
| 144 | 143 | } |
| 145 | 144 | \ No newline at end of file |
@@ -54,8 +54,7 @@ |
||
| 54 | 54 | parent::insertAt($index, $item); |
| 55 | 55 | $this->_wizard->getMultiView()->getViews()->insertAt($index, $item); |
| 56 | 56 | $this->_wizard->addedWizardStep($item); |
| 57 | - } |
|
| 58 | - else |
|
| 57 | + } else |
|
| 59 | 58 | throw new TInvalidDataTypeException('wizardstepcollection_wizardstep_required'); |
| 60 | 59 | } |
| 61 | 60 | |
@@ -233,8 +233,7 @@ |
||
| 233 | 233 | $link->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
| 234 | 234 | $cell->getControls()->add($link); |
| 235 | 235 | $cell->registerObject('HyperLink', $link); |
| 236 | - } |
|
| 237 | - else |
|
| 236 | + } else |
|
| 238 | 237 | parent::initializeCell($cell, $columnIndex, $itemType); |
| 239 | 238 | } |
| 240 | 239 | |
@@ -230,7 +230,7 @@ |
||
| 230 | 230 | $link->setNavigateUrl($this->getNavigateUrl()); |
| 231 | 231 | $link->setTarget($this->getTarget()); |
| 232 | 232 | if($this->getDataTextField() !== '' || $this->getDataNavigateUrlField() !== '') |
| 233 | - $link->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
| 233 | + $link->attachEventHandler('OnDataBinding', [$this, 'dataBindColumn']); |
|
| 234 | 234 | $cell->getControls()->add($link); |
| 235 | 235 | $cell->registerObject('HyperLink', $link); |
| 236 | 236 | } |
@@ -177,8 +177,7 @@ |
||
| 177 | 177 | { |
| 178 | 178 | $cultureInfo = CultureInfo::getInstance($culture); |
| 179 | 179 | return $cultureInfo->getDateTimeFormat(); |
| 180 | - } |
|
| 181 | - else |
|
| 180 | + } else |
|
| 182 | 181 | { |
| 183 | 182 | $cultureInfo = CultureInfo::getInvariantCulture(); |
| 184 | 183 | return $cultureInfo->getDateTimeFormat(); |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | public static function getInstance($culture = null) |
| 172 | 172 | { |
| 173 | 173 | |
| 174 | - if ($culture instanceof CultureInfo) |
|
| 174 | + if($culture instanceof CultureInfo) |
|
| 175 | 175 | return $culture->getDateTimeFormat(); |
| 176 | 176 | elseif(is_string($culture)) |
| 177 | 177 | { |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | */ |
| 295 | 295 | public function getAbbreviatedMonthNames() |
| 296 | 296 | { |
| 297 | - if (isset($this->data['monthNames']['format']['abbreviated'])) |
|
| 297 | + if(isset($this->data['monthNames']['format']['abbreviated'])) |
|
| 298 | 298 | return $this->data['monthNames']['format']['abbreviated']; |
| 299 | 299 | else |
| 300 | 300 | return $this->data['monthNames']['format']['wide']; |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | public function formatDateTime($date, $time) |
| 513 | 513 | { |
| 514 | 514 | $pattern = $this->getDateTimeOrderPattern(); |
| 515 | - return str_replace(['{0}','{1}'], [$time, $date], $pattern); |
|
| 515 | + return str_replace(['{0}', '{1}'], [$time, $date], $pattern); |
|
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | } |
@@ -607,15 +607,15 @@ |
||
| 607 | 607 | public function _hash($data, $controlType) |
| 608 | 608 | { |
| 609 | 609 | switch ($controlType) { |
| 610 | - case 'md5': |
|
| 611 | - return md5($data); |
|
| 612 | - case 'crc32': |
|
| 613 | - return sprintf('% 32d', crc32($data)); |
|
| 614 | - case 'strlen': |
|
| 615 | - return sprintf('% 32d', strlen($data)); |
|
| 616 | - default: |
|
| 617 | - $this->raiseError('Unknown controlType ! ' . |
|
| 618 | - '(available values are only \'md5\', \'crc32\', \'strlen\')', -5); |
|
| 610 | + case 'md5': |
|
| 611 | + return md5($data); |
|
| 612 | + case 'crc32': |
|
| 613 | + return sprintf('% 32d', crc32($data)); |
|
| 614 | + case 'strlen': |
|
| 615 | + return sprintf('% 32d', strlen($data)); |
|
| 616 | + default: |
|
| 617 | + $this->raiseError('Unknown controlType ! ' . |
|
| 618 | + '(available values are only \'md5\', \'crc32\', \'strlen\')', -5); |
|
| 619 | 619 | } |
| 620 | 620 | } |
| 621 | 621 | |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | */ |
| 234 | 234 | public function __construct($options = [null]) |
| 235 | 235 | { |
| 236 | - $availableOptions = [ 'automaticSerialization', |
|
| 236 | + $availableOptions = ['automaticSerialization', |
|
| 237 | 237 | 'fileNameProtection', |
| 238 | 238 | 'memoryCaching', |
| 239 | 239 | 'onlyMemoryCaching', |
@@ -269,35 +269,35 @@ discard block |
||
| 269 | 269 | $this->_id = $id; |
| 270 | 270 | $this->_group = $group; |
| 271 | 271 | $data = false; |
| 272 | - if ($this->_caching) { |
|
| 272 | + if($this->_caching) { |
|
| 273 | 273 | $this->_setFileName($id, $group); |
| 274 | - if ($this->_memoryCaching) { |
|
| 275 | - if (isset($this->_memoryCachingArray[$this->_file])) { |
|
| 276 | - if ($this->_automaticSerialization) { |
|
| 274 | + if($this->_memoryCaching) { |
|
| 275 | + if(isset($this->_memoryCachingArray[$this->_file])) { |
|
| 276 | + if($this->_automaticSerialization) { |
|
| 277 | 277 | return unserialize( |
| 278 | 278 | $this->_memoryCachingArray[$this->_file]); |
| 279 | 279 | } else { |
| 280 | 280 | return $this->_memoryCachingArray[$this->_file]; |
| 281 | 281 | } |
| 282 | 282 | } else { |
| 283 | - if ($this->_onlyMemoryCaching) { |
|
| 283 | + if($this->_onlyMemoryCaching) { |
|
| 284 | 284 | return false; |
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | - if ($doNotTestCacheValidity) { |
|
| 289 | - if (file_exists($this->_file)) { |
|
| 288 | + if($doNotTestCacheValidity) { |
|
| 289 | + if(file_exists($this->_file)) { |
|
| 290 | 290 | $data = $this->_read(); |
| 291 | 291 | } |
| 292 | 292 | } else { |
| 293 | - if (@filemtime($this->_file) > $this->_refreshTime) { |
|
| 293 | + if(@filemtime($this->_file) > $this->_refreshTime) { |
|
| 294 | 294 | $data = $this->_read(); |
| 295 | 295 | } |
| 296 | 296 | } |
| 297 | - if (($data) and ($this->_memoryCaching)) { |
|
| 297 | + if(($data) and ($this->_memoryCaching)) { |
|
| 298 | 298 | $this->_memoryCacheAdd($this->_file, $data); |
| 299 | 299 | } |
| 300 | - if ($this->_automaticSerialization && is_string($data)) { |
|
| 300 | + if($this->_automaticSerialization && is_string($data)) { |
|
| 301 | 301 | $data = unserialize($data); |
| 302 | 302 | } |
| 303 | 303 | return $data; |
@@ -317,21 +317,21 @@ discard block |
||
| 317 | 317 | */ |
| 318 | 318 | public function save($data, $id = null, $group = 'default') |
| 319 | 319 | { |
| 320 | - if ($this->_caching) { |
|
| 321 | - if ($this->_automaticSerialization) { |
|
| 320 | + if($this->_caching) { |
|
| 321 | + if($this->_automaticSerialization) { |
|
| 322 | 322 | $data = serialize($data); |
| 323 | 323 | } |
| 324 | - if (isset($id)) { |
|
| 324 | + if(isset($id)) { |
|
| 325 | 325 | $this->_setFileName($id, $group); |
| 326 | 326 | } |
| 327 | - if ($this->_memoryCaching) { |
|
| 327 | + if($this->_memoryCaching) { |
|
| 328 | 328 | $this->_memoryCacheAdd($this->_file, $data); |
| 329 | - if ($this->_onlyMemoryCaching) { |
|
| 329 | + if($this->_onlyMemoryCaching) { |
|
| 330 | 330 | return true; |
| 331 | 331 | } |
| 332 | 332 | } |
| 333 | - if ($this->_writeControl) { |
|
| 334 | - if (!$this->_writeAndControl($data)) { |
|
| 333 | + if($this->_writeControl) { |
|
| 334 | + if(!$this->_writeAndControl($data)) { |
|
| 335 | 335 | @touch($this->_file, time() - 2 * abs($this->_lifeTime)); |
| 336 | 336 | return false; |
| 337 | 337 | } else { |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | public function remove($id, $group = 'default') |
| 356 | 356 | { |
| 357 | 357 | $this->_setFileName($id, $group); |
| 358 | - if (!@unlink($this->_file)) { |
|
| 358 | + if(!@unlink($this->_file)) { |
|
| 359 | 359 | $this->raiseError('TCache_Lite : Unable to remove cache !', -3); |
| 360 | 360 | return false; |
| 361 | 361 | } |
@@ -374,33 +374,33 @@ discard block |
||
| 374 | 374 | */ |
| 375 | 375 | public function clean($group = false) |
| 376 | 376 | { |
| 377 | - if ($this->_fileNameProtection) { |
|
| 377 | + if($this->_fileNameProtection) { |
|
| 378 | 378 | $motif = ($group) ? 'cache_' . md5($group) . '_' : 'cache_'; |
| 379 | 379 | } else { |
| 380 | 380 | $motif = ($group) ? 'cache_' . $group . '_' : 'cache_'; |
| 381 | 381 | } |
| 382 | - if ($this->_memoryCaching) { |
|
| 383 | - while (list($key, $value) = each($this->_memoryCaching)) { |
|
| 384 | - if (strpos($key, $motif, 0)) { |
|
| 382 | + if($this->_memoryCaching) { |
|
| 383 | + while(list($key, $value) = each($this->_memoryCaching)) { |
|
| 384 | + if(strpos($key, $motif, 0)) { |
|
| 385 | 385 | unset($this->_memoryCaching[$key]); |
| 386 | 386 | $this->_memoryCachingCounter = |
| 387 | 387 | $this->_memoryCachingCounter - 1; |
| 388 | 388 | } |
| 389 | 389 | } |
| 390 | - if ($this->_onlyMemoryCaching) { |
|
| 390 | + if($this->_onlyMemoryCaching) { |
|
| 391 | 391 | return true; |
| 392 | 392 | } |
| 393 | 393 | } |
| 394 | - if (!($dh = opendir($this->_cacheDir))) { |
|
| 394 | + if(!($dh = opendir($this->_cacheDir))) { |
|
| 395 | 395 | $this->raiseError('TCache_Lite : Unable to open cache directory !'); |
| 396 | 396 | return false; |
| 397 | 397 | } |
| 398 | - while ($file = readdir($dh)) { |
|
| 399 | - if (($file != '.') && ($file != '..')) { |
|
| 398 | + while($file = readdir($dh)) { |
|
| 399 | + if(($file != '.') && ($file != '..')) { |
|
| 400 | 400 | $file = $this->_cacheDir . $file; |
| 401 | - if (is_file($file)) { |
|
| 402 | - if (strpos($file, $motif, 0)) { |
|
| 403 | - if (!@unlink($file)) { |
|
| 401 | + if(is_file($file)) { |
|
| 402 | + if(strpos($file, $motif, 0)) { |
|
| 403 | + if(!@unlink($file)) { |
|
| 404 | 404 | $this->raiseError('Cache_Lite : Unable to remove cache !', -3); |
| 405 | 405 | return false; |
| 406 | 406 | } |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | */ |
| 430 | 430 | public function saveMemoryCachingState($id, $group = 'default') |
| 431 | 431 | { |
| 432 | - if ($this->_caching) { |
|
| 432 | + if($this->_caching) { |
|
| 433 | 433 | $array = [ |
| 434 | 434 | 'counter' => $this->_memoryCachingCounter, |
| 435 | 435 | 'array' => $this->_memoryCachingState |
@@ -446,8 +446,8 @@ discard block |
||
| 446 | 446 | public function getMemoryCachingState($id, $group = 'default', |
| 447 | 447 | $doNotTestCacheValidity = false) |
| 448 | 448 | { |
| 449 | - if ($this->_caching) { |
|
| 450 | - if ($data = $this->get($id, $group, $doNotTestCacheValidity)) |
|
| 449 | + if($this->_caching) { |
|
| 450 | + if($data = $this->get($id, $group, $doNotTestCacheValidity)) |
|
| 451 | 451 | { |
| 452 | 452 | $array = unserialize($data); |
| 453 | 453 | $this->_memoryCachingCounter = $array['counter']; |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | public function _memoryCacheAdd($id, $data) |
| 493 | 493 | { |
| 494 | 494 | $this->_memoryCachingArray[$this->_file] = $data; |
| 495 | - if ($this->_memoryCachingCounter >= $this->_memoryCachingLimit) { |
|
| 495 | + if($this->_memoryCachingCounter >= $this->_memoryCachingLimit) { |
|
| 496 | 496 | list($key, $value) = each($this->_memoryCachingArray); |
| 497 | 497 | unset($this->_memoryCachingArray[$key]); |
| 498 | 498 | } else { |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | */ |
| 510 | 510 | public function _setFileName($id, $group) |
| 511 | 511 | { |
| 512 | - if ($this->_fileNameProtection) { |
|
| 512 | + if($this->_fileNameProtection) { |
|
| 513 | 513 | $this->_file = ($this->_cacheDir . 'cache_' . md5($group) . '_' |
| 514 | 514 | . md5($id)); |
| 515 | 515 | } else { |
@@ -531,21 +531,21 @@ discard block |
||
| 531 | 531 | public function _read() |
| 532 | 532 | { |
| 533 | 533 | $fp = @fopen($this->_file, "rb"); |
| 534 | - if ($this->_fileLocking) @flock($fp, LOCK_SH); |
|
| 535 | - if ($fp) { |
|
| 534 | + if($this->_fileLocking) @flock($fp, LOCK_SH); |
|
| 535 | + if($fp) { |
|
| 536 | 536 | // because the filesize can be cached by PHP itself... |
| 537 | 537 | clearstatcache(); |
| 538 | 538 | $length = @filesize($this->_file); |
| 539 | - if ($this->_readControl) { |
|
| 539 | + if($this->_readControl) { |
|
| 540 | 540 | $hashControl = @fread($fp, 32); |
| 541 | 541 | $length = $length - 32; |
| 542 | 542 | } |
| 543 | 543 | $data = @fread($fp, $length); |
| 544 | - if ($this->_fileLocking) @flock($fp, LOCK_UN); |
|
| 544 | + if($this->_fileLocking) @flock($fp, LOCK_UN); |
|
| 545 | 545 | @fclose($fp); |
| 546 | - if ($this->_readControl) { |
|
| 546 | + if($this->_readControl) { |
|
| 547 | 547 | $hashData = $this->_hash($data, $this->_readControlType); |
| 548 | - if ($hashData != $hashControl) { |
|
| 548 | + if($hashData != $hashControl) { |
|
| 549 | 549 | @touch($this->_file, time() - 2 * abs($this->_lifeTime)); |
| 550 | 550 | return false; |
| 551 | 551 | } |
@@ -566,14 +566,14 @@ discard block |
||
| 566 | 566 | public function _write($data) |
| 567 | 567 | { |
| 568 | 568 | $fp = @fopen($this->_file, "wb"); |
| 569 | - if ($fp) { |
|
| 570 | - if ($this->_fileLocking) @flock($fp, LOCK_EX); |
|
| 571 | - if ($this->_readControl) { |
|
| 569 | + if($fp) { |
|
| 570 | + if($this->_fileLocking) @flock($fp, LOCK_EX); |
|
| 571 | + if($this->_readControl) { |
|
| 572 | 572 | @fwrite($fp, $this->_hash($data, $this->_readControlType), 32); |
| 573 | 573 | } |
| 574 | 574 | $len = strlen($data); |
| 575 | 575 | @fwrite($fp, $data, $len); |
| 576 | - if ($this->_fileLocking) @flock($fp, LOCK_UN); |
|
| 576 | + if($this->_fileLocking) @flock($fp, LOCK_UN); |
|
| 577 | 577 | @fclose($fp); |
| 578 | 578 | return true; |
| 579 | 579 | } |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | */ |
| 607 | 607 | public function _hash($data, $controlType) |
| 608 | 608 | { |
| 609 | - switch ($controlType) { |
|
| 609 | + switch($controlType) { |
|
| 610 | 610 | case 'md5': |
| 611 | 611 | return md5($data); |
| 612 | 612 | case 'crc32': |
@@ -41,8 +41,7 @@ |
||
| 41 | 41 | $limitStr = ' LIMIT ' . $limit; |
| 42 | 42 | $offsetStr = $offset >= 0 ? ' OFFSET ' . $offset : ''; |
| 43 | 43 | return $sql . $limitStr . $offsetStr; |
| 44 | - } |
|
| 45 | - else |
|
| 44 | + } else |
|
| 46 | 45 | return $sql; |
| 47 | 46 | } |
| 48 | 47 | } |