@@ -29,7 +29,9 @@ |
||
| 29 | 29 | { |
| 30 | 30 | $list[] = $country; |
| 31 | 31 | $count++; |
| 32 | - if($count > 10) break; |
|
| 32 | + if($count > 10) { |
|
| 33 | + break; |
|
| 34 | + } |
|
| 33 | 35 | } |
| 34 | 36 | } |
| 35 | 37 | return $list; |
@@ -144,10 +144,11 @@ discard block |
||
| 144 | 144 | self::$_pradoPackages = $packages; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - if (isset(self::$_pradoScripts[$name])) |
|
| 148 | - $this->_registeredPradoScripts[$name]=true; |
|
| 149 | - else |
|
| 150 | - throw new TInvalidOperationException('csmanager_pradoscript_invalid',$name); |
|
| 147 | + if (isset(self::$_pradoScripts[$name])) { |
|
| 148 | + $this->_registeredPradoScripts[$name]=true; |
|
| 149 | + } else { |
|
| 150 | + throw new TInvalidOperationException('csmanager_pradoscript_invalid',$name); |
|
| 151 | + } |
|
| 151 | 152 | |
| 152 | 153 | if(($packages=array_keys($this->_registeredPradoScripts))!==array()) |
| 153 | 154 | { |
@@ -159,22 +160,25 @@ discard block |
||
| 159 | 160 | { |
| 160 | 161 | foreach (self::$_pradoScripts[$p] as $dep) |
| 161 | 162 | { |
| 162 | - foreach (self::$_pradoPackages[$dep] as $script) |
|
| 163 | - if (!isset($this->_expandedPradoScripts[$script])) |
|
| 163 | + foreach (self::$_pradoPackages[$dep] as $script) { |
|
| 164 | + if (!isset($this->_expandedPradoScripts[$script])) |
|
| 164 | 165 | { |
| 165 | 166 | $this->_expandedPradoScripts[$script] = true; |
| 167 | + } |
|
| 166 | 168 | if($isDebug) |
| 167 | 169 | { |
| 168 | - if (!in_array($url=$baseUrl.'/'.$script,$packagesUrl)) |
|
| 169 | - $packagesUrl[]=$url; |
|
| 170 | + if (!in_array($url=$baseUrl.'/'.$script,$packagesUrl)) { |
|
| 171 | + $packagesUrl[]=$url; |
|
| 172 | + } |
|
| 170 | 173 | } else { |
| 171 | 174 | if (!in_array($url=$baseUrl.'/min/'.$script,$packagesUrl)) |
| 172 | 175 | { |
| 173 | 176 | if(!is_file($filePath=$path.'/min/'.$script)) |
| 174 | 177 | { |
| 175 | 178 | $dirPath=dirname($filePath); |
| 176 | - if(!is_dir($dirPath)) |
|
| 177 | - mkdir($dirPath, PRADO_CHMOD, true); |
|
| 179 | + if(!is_dir($dirPath)) { |
|
| 180 | + mkdir($dirPath, PRADO_CHMOD, true); |
|
| 181 | + } |
|
| 178 | 182 | file_put_contents($filePath, TJavaScript::JSMin(file_get_contents($base.'/'.$script))); |
| 179 | 183 | chmod($filePath, PRADO_CHMOD); |
| 180 | 184 | } |
@@ -184,8 +188,9 @@ discard block |
||
| 184 | 188 | } |
| 185 | 189 | } |
| 186 | 190 | } |
| 187 | - foreach($packagesUrl as $url) |
|
| 188 | - $this->registerScriptFile($url,$url); |
|
| 191 | + foreach($packagesUrl as $url) { |
|
| 192 | + $this->registerScriptFile($url,$url); |
|
| 193 | + } |
|
| 189 | 194 | } |
| 190 | 195 | } |
| 191 | 196 | } |
@@ -226,8 +231,7 @@ discard block |
||
| 226 | 231 | $base = $dir; |
| 227 | 232 | } |
| 228 | 233 | return array($assets->getPublishedPath($base), $assets->publishFilePath($base)); |
| 229 | - } |
|
| 230 | - else |
|
| 234 | + } else |
|
| 231 | 235 | { |
| 232 | 236 | return array($assets->getBasePath().str_replace($assets->getBaseUrl(),'',$base), $base); |
| 233 | 237 | } |
@@ -278,8 +282,9 @@ discard block |
||
| 278 | 282 | if($class === null) { |
| 279 | 283 | return; |
| 280 | 284 | } |
| 281 | - if(!isset($options['FormID']) && ($form=$this->_page->getForm())!==null) |
|
| 282 | - $options['FormID']=$form->getClientID(); |
|
| 285 | + if(!isset($options['FormID']) && ($form=$this->_page->getForm())!==null) { |
|
| 286 | + $options['FormID']=$form->getClientID(); |
|
| 287 | + } |
|
| 283 | 288 | $optionString=TJavaScript::encode($options); |
| 284 | 289 | $code="new {$class}({$optionString});"; |
| 285 | 290 | |
@@ -300,9 +305,9 @@ discard block |
||
| 300 | 305 | { |
| 301 | 306 | $panelID=is_string($panel)?$panel:$panel->getUniqueID(); |
| 302 | 307 | |
| 303 | - if(is_string($button)) |
|
| 304 | - $buttonID=$button; |
|
| 305 | - else |
|
| 308 | + if(is_string($button)) { |
|
| 309 | + $buttonID=$button; |
|
| 310 | + } else |
|
| 306 | 311 | { |
| 307 | 312 | $button->setIsDefaultButton(true); |
| 308 | 313 | $buttonID=$button->getUniqueID(); |
@@ -339,8 +344,9 @@ discard block |
||
| 339 | 344 | public function registerFocusControl($target) |
| 340 | 345 | { |
| 341 | 346 | $this->registerPradoScriptInternal('jquery'); |
| 342 | - if($target instanceof TControl) |
|
| 343 | - $target=$target->getClientID(); |
|
| 347 | + if($target instanceof TControl) { |
|
| 348 | + $target=$target->getClientID(); |
|
| 349 | + } |
|
| 344 | 350 | $this->_endScripts['prado:focus'] = 'jQuery(\'#'.$target.'\').focus();'; |
| 345 | 351 | |
| 346 | 352 | $params=func_get_args(); |
@@ -371,10 +377,11 @@ discard block |
||
| 371 | 377 | */ |
| 372 | 378 | public function registerStyleSheetFile($key,$url,$media='') |
| 373 | 379 | { |
| 374 | - if($media==='') |
|
| 375 | - $this->_styleSheetFiles[$key]=$url; |
|
| 376 | - else |
|
| 377 | - $this->_styleSheetFiles[$key]=array($url,$media); |
|
| 380 | + if($media==='') { |
|
| 381 | + $this->_styleSheetFiles[$key]=$url; |
|
| 382 | + } else { |
|
| 383 | + $this->_styleSheetFiles[$key]=array($url,$media); |
|
| 384 | + } |
|
| 378 | 385 | |
| 379 | 386 | $params=func_get_args(); |
| 380 | 387 | $this->_page->registerCachingAction('Page.ClientScript','registerStyleSheetFile',$params); |
@@ -405,9 +412,10 @@ discard block |
||
| 405 | 412 | $this->_styleSheetFiles) |
| 406 | 413 | ); |
| 407 | 414 | |
| 408 | - foreach(Prado::getApplication()->getAssetManager()->getPublished() as $path=>$url) |
|
| 409 | - if (substr($url,strlen($url)-4)=='.css') |
|
| 415 | + foreach(Prado::getApplication()->getAssetManager()->getPublished() as $path=>$url) { |
|
| 416 | + if (substr($url,strlen($url)-4)=='.css') |
|
| 410 | 417 | $stylesheets[] = $url; |
| 418 | + } |
|
| 411 | 419 | |
| 412 | 420 | $stylesheets = array_unique($stylesheets); |
| 413 | 421 | |
@@ -601,10 +609,11 @@ discard block |
||
| 601 | 609 | $str=''; |
| 602 | 610 | foreach($this->_styleSheetFiles as $url) |
| 603 | 611 | { |
| 604 | - if(is_array($url)) |
|
| 605 | - $str.="<link rel=\"stylesheet\" type=\"text/css\" media=\"{$url[1]}\" href=\"".THttpUtility::htmlEncode($url[0])."\" />\n"; |
|
| 606 | - else |
|
| 607 | - $str.="<link rel=\"stylesheet\" type=\"text/css\" href=\"".THttpUtility::htmlEncode($url)."\" />\n"; |
|
| 612 | + if(is_array($url)) { |
|
| 613 | + $str.="<link rel=\"stylesheet\" type=\"text/css\" media=\"{$url[1]}\" href=\"".THttpUtility::htmlEncode($url[0])."\" />\n"; |
|
| 614 | + } else { |
|
| 615 | + $str.="<link rel=\"stylesheet\" type=\"text/css\" href=\"".THttpUtility::htmlEncode($url)."\" />\n"; |
|
| 616 | + } |
|
| 608 | 617 | } |
| 609 | 618 | $writer->write($str); |
| 610 | 619 | } |
@@ -614,8 +623,9 @@ discard block |
||
| 614 | 623 | */ |
| 615 | 624 | public function renderStyleSheets($writer) |
| 616 | 625 | { |
| 617 | - if(count($this->_styleSheets)) |
|
| 618 | - $writer->write("<style type=\"text/css\">\n/*<![CDATA[*/\n".implode("\n",$this->_styleSheets)."\n/*]]>*/\n</style>\n"); |
|
| 626 | + if(count($this->_styleSheets)) { |
|
| 627 | + $writer->write("<style type=\"text/css\">\n/*<![CDATA[*/\n".implode("\n",$this->_styleSheets)."\n/*]]>*/\n</style>\n"); |
|
| 628 | + } |
|
| 619 | 629 | } |
| 620 | 630 | |
| 621 | 631 | /** |
@@ -738,25 +748,30 @@ discard block |
||
| 738 | 748 | */ |
| 739 | 749 | protected function renderHiddenFieldsInt($writer, $initial) |
| 740 | 750 | { |
| 741 | - if ($initial) $this->_renderedHiddenFields = array(); |
|
| 751 | + if ($initial) { |
|
| 752 | + $this->_renderedHiddenFields = array(); |
|
| 753 | + } |
|
| 742 | 754 | $str=''; |
| 743 | 755 | foreach($this->_hiddenFields as $name=>$value) |
| 744 | 756 | { |
| 745 | - if (in_array($name,$this->_renderedHiddenFields)) continue; |
|
| 757 | + if (in_array($name,$this->_renderedHiddenFields)) { |
|
| 758 | + continue; |
|
| 759 | + } |
|
| 746 | 760 | $id=strtr($name,':','_'); |
| 747 | 761 | if(is_array($value)) |
| 748 | 762 | { |
| 749 | - foreach($value as $v) |
|
| 750 | - $str.='<input type="hidden" name="'.$name.'[]" id="'.$id.'" value="'.THttpUtility::htmlEncode($value)."\" />\n"; |
|
| 751 | - } |
|
| 752 | - else |
|
| 763 | + foreach($value as $v) { |
|
| 764 | + $str.='<input type="hidden" name="'.$name.'[]" id="'.$id.'" value="'.THttpUtility::htmlEncode($value)."\" />\n"; |
|
| 765 | + } |
|
| 766 | + } else |
|
| 753 | 767 | { |
| 754 | 768 | $str.='<input type="hidden" name="'.$name.'" id="'.$id.'" value="'.THttpUtility::htmlEncode($value)."\" />\n"; |
| 755 | 769 | } |
| 756 | 770 | $this->_renderedHiddenFields[] = $name; |
| 757 | 771 | } |
| 758 | - if($str!=='') |
|
| 759 | - $writer->write("<div style=\"visibility:hidden;\">\n".$str."</div>\n"); |
|
| 772 | + if($str!=='') { |
|
| 773 | + $writer->write("<div style=\"visibility:hidden;\">\n".$str."</div>\n"); |
|
| 774 | + } |
|
| 760 | 775 | } |
| 761 | 776 | |
| 762 | 777 | public function getHiddenFields() |
@@ -769,8 +784,9 @@ discard block |
||
| 769 | 784 | */ |
| 770 | 785 | protected function checkIfNotInRender() |
| 771 | 786 | { |
| 772 | - if ($form = $this->_page->InFormRender) |
|
| 773 | - throw new Exception('Operation invalid when page is already rendering'); |
|
| 787 | + if ($form = $this->_page->InFormRender) { |
|
| 788 | + throw new Exception('Operation invalid when page is already rendering'); |
|
| 789 | + } |
|
| 774 | 790 | } |
| 775 | 791 | } |
| 776 | 792 | |
@@ -802,8 +818,9 @@ discard block |
||
| 802 | 818 | */ |
| 803 | 819 | protected function setFunction($name, $code) |
| 804 | 820 | { |
| 805 | - if(!TJavaScript::isJsLiteral($code)) |
|
| 806 | - $code = TJavaScript::quoteJsLiteral($this->ensureFunction($code)); |
|
| 821 | + if(!TJavaScript::isJsLiteral($code)) { |
|
| 822 | + $code = TJavaScript::quoteJsLiteral($this->ensureFunction($code)); |
|
| 823 | + } |
|
| 807 | 824 | $this->setOption($name, $code); |
| 808 | 825 | } |
| 809 | 826 | |
@@ -812,10 +829,11 @@ discard block |
||
| 812 | 829 | */ |
| 813 | 830 | protected function getOption($name) |
| 814 | 831 | { |
| 815 | - if ($this->_options) |
|
| 816 | - return $this->_options->itemAt($name); |
|
| 817 | - else |
|
| 818 | - return null; |
|
| 832 | + if ($this->_options) { |
|
| 833 | + return $this->_options->itemAt($name); |
|
| 834 | + } else { |
|
| 835 | + return null; |
|
| 836 | + } |
|
| 819 | 837 | } |
| 820 | 838 | |
| 821 | 839 | /** |
@@ -832,8 +850,9 @@ discard block |
||
| 832 | 850 | */ |
| 833 | 851 | public function getOptions() |
| 834 | 852 | { |
| 835 | - if (!$this->_options) |
|
| 836 | - $this->_options = Prado::createComponent('System.Collections.TMap'); |
|
| 853 | + if (!$this->_options) { |
|
| 854 | + $this->_options = Prado::createComponent('System.Collections.TMap'); |
|
| 855 | + } |
|
| 837 | 856 | return $this->_options; |
| 838 | 857 | } |
| 839 | 858 | |
@@ -29,7 +29,9 @@ |
||
| 29 | 29 | { |
| 30 | 30 | $list[] = $country; |
| 31 | 31 | $count++; |
| 32 | - if($count > 10) break; |
|
| 32 | + if($count > 10) { |
|
| 33 | + break; |
|
| 34 | + } |
|
| 33 | 35 | } |
| 34 | 36 | } |
| 35 | 37 | return $list; |
@@ -114,8 +114,7 @@ |
||
| 114 | 114 | { |
| 115 | 115 | $this->projectDao->addUserToProject($project->ID, 'asd'); |
| 116 | 116 | $this->fail(); |
| 117 | - } |
|
| 118 | - catch(TDbException $e) |
|
| 117 | + } catch(TDbException $e) |
|
| 119 | 118 | { |
| 120 | 119 | $this->pass(); |
| 121 | 120 | } |