@@ -64,8 +64,7 @@ discard block |
||
| 64 | 64 | $rules=$attributes["rules"]; |
| 65 | 65 | if(\is_array($rules)){ |
| 66 | 66 | $element->addRules($rules); |
| 67 | - } |
|
| 68 | - else{ |
|
| 67 | + } else{ |
|
| 69 | 68 | $element->addRule($rules); |
| 70 | 69 | } |
| 71 | 70 | unset($attributes["rules"]); |
@@ -117,8 +116,9 @@ discard block |
||
| 117 | 116 | public function fieldAsLabel($index,$icon=NULL,$attributes=NULL){ |
| 118 | 117 | return $this->_fieldAs(function($id,$name,$value) use($icon){ |
| 119 | 118 | $lbl=new HtmlLabel($id,$value); |
| 120 | - if(isset($icon)) |
|
| 121 | - $lbl->addIcon($icon); |
|
| 119 | + if(isset($icon)) { |
|
| 120 | + $lbl->addIcon($icon); |
|
| 121 | + } |
|
| 122 | 122 | return $lbl; |
| 123 | 123 | }, $index,$attributes,"label"); |
| 124 | 124 | } |
@@ -126,8 +126,9 @@ discard block |
||
| 126 | 126 | public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){ |
| 127 | 127 | return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){ |
| 128 | 128 | $header=new HtmlHeader($id,$niveau,$value); |
| 129 | - if(isset($icon)) |
|
| 130 | - $header->asIcon($icon, $value); |
|
| 129 | + if(isset($icon)) { |
|
| 130 | + $header->asIcon($icon, $value); |
|
| 131 | + } |
|
| 131 | 132 | return $header; |
| 132 | 133 | }, $index,$attributes,"header"); |
| 133 | 134 | } |
@@ -135,7 +136,9 @@ discard block |
||
| 135 | 136 | |
| 136 | 137 | public function fieldAsImage($index,$size=Size::MINI,$circular=false){ |
| 137 | 138 | $this->setValueFunction($index,function($img) use($size,$circular){ |
| 138 | - $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular(); |
|
| 139 | + $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular) { |
|
| 140 | + $image->setCircular(); |
|
| 141 | + } |
|
| 139 | 142 | return $image; |
| 140 | 143 | }); |
| 141 | 144 | return $this; |
@@ -230,14 +233,14 @@ discard block |
||
| 230 | 233 | $i=0; |
| 231 | 234 | if(JArray::isAssociative($types)){ |
| 232 | 235 | foreach ($types as $type=>$attributes){ |
| 233 | - if(\is_int($type)) |
|
| 234 | - $this->fieldAs($i++,$attributes,[]); |
|
| 235 | - else{ |
|
| 236 | + if(\is_int($type)) { |
|
| 237 | + $this->fieldAs($i++,$attributes,[]); |
|
| 238 | + } else{ |
|
| 236 | 239 | $type=preg_replace('/\d/', '', $type ); |
| 237 | 240 | $this->fieldAs($i++,$type,$attributes); |
| 238 | 241 | } |
| 239 | 242 | } |
| 240 | - }else{ |
|
| 243 | + } else{ |
|
| 241 | 244 | foreach ($types as $type){ |
| 242 | 245 | $this->fieldAs($i++,$type); |
| 243 | 246 | } |
@@ -249,7 +252,7 @@ discard block |
||
| 249 | 252 | if(\method_exists($this, $method)){ |
| 250 | 253 | if(!\is_array($attributes)){ |
| 251 | 254 | $attributes=[$index]; |
| 252 | - }else{ |
|
| 255 | + } else{ |
|
| 253 | 256 | \array_unshift($attributes, $index); |
| 254 | 257 | } |
| 255 | 258 | \call_user_func_array([$this,$method], $attributes); |
@@ -322,8 +322,9 @@ discard block |
||
| 322 | 322 | $result= $this->getBody()->_addRow($result); |
| 323 | 323 | } |
| 324 | 324 | if(isset($this->_afterCompileEvents["onNewRow"])){ |
| 325 | - if(\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
| 326 | - $this->_afterCompileEvents["onNewRow"]($result,$object); |
|
| 325 | + if(\is_callable($this->_afterCompileEvents["onNewRow"])) { |
|
| 326 | + $this->_afterCompileEvents["onNewRow"]($result,$object); |
|
| 327 | + } |
|
| 327 | 328 | } |
| 328 | 329 | return $result; |
| 329 | 330 | } |
@@ -345,8 +346,9 @@ discard block |
||
| 345 | 346 | |
| 346 | 347 | public function run(JsUtils $js){ |
| 347 | 348 | $result= parent::run($js); |
| 348 | - if(isset($this->_footer)) |
|
| 349 | - $this->_footer->run($js); |
|
| 349 | + if(isset($this->_footer)) { |
|
| 350 | + $this->_footer->run($js); |
|
| 351 | + } |
|
| 350 | 352 | return $result; |
| 351 | 353 | } |
| 352 | 354 | |
@@ -387,9 +389,10 @@ discard block |
||
| 387 | 389 | public function setColWidth($colIndex,$width){ |
| 388 | 390 | if($this->hasPart("thead")){ |
| 389 | 391 | $this->getHeader()->getCell(0, $colIndex)->setWidth($width); |
| 390 | - }else{ |
|
| 391 | - if($this->getBody()->count()>0) |
|
| 392 | - $this->getBody()->getCell(0, $colIndex)->setWidth($width); |
|
| 392 | + } else{ |
|
| 393 | + if($this->getBody()->count()>0) { |
|
| 394 | + $this->getBody()->getCell(0, $colIndex)->setWidth($width); |
|
| 395 | + } |
|
| 393 | 396 | } |
| 394 | 397 | return $this; |
| 395 | 398 | } |
@@ -57,10 +57,12 @@ discard block |
||
| 57 | 57 | $js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]); |
| 58 | 58 | $js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]); |
| 59 | 59 | } |
| 60 | - if(\is_array($this->_deleteBehavior)) |
|
| 61 | - $this->_generateBehavior("delete",$this->_deleteBehavior, $js); |
|
| 62 | - if(\is_array($this->_editBehavior)) |
|
| 63 | - $this->_generateBehavior("edit",$this->_editBehavior,$js); |
|
| 60 | + if(\is_array($this->_deleteBehavior)) { |
|
| 61 | + $this->_generateBehavior("delete",$this->_deleteBehavior, $js); |
|
| 62 | + } |
|
| 63 | + if(\is_array($this->_editBehavior)) { |
|
| 64 | + $this->_generateBehavior("edit",$this->_editBehavior,$js); |
|
| 65 | + } |
|
| 64 | 66 | return parent::run($js); |
| 65 | 67 | } |
| 66 | 68 | |
@@ -96,12 +98,14 @@ discard block |
||
| 96 | 98 | $table->setRowCount(0, \sizeof($captions)); |
| 97 | 99 | $this->_generateHeader($table,$captions); |
| 98 | 100 | |
| 99 | - if(isset($this->_compileParts)) |
|
| 100 | - $table->setCompileParts($this->_compileParts); |
|
| 101 | + if(isset($this->_compileParts)) { |
|
| 102 | + $table->setCompileParts($this->_compileParts); |
|
| 103 | + } |
|
| 101 | 104 | |
| 102 | 105 | if(isset($this->_searchField) && isset($js)){ |
| 103 | - if(isset($this->_urls["refresh"])) |
|
| 104 | - $this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
| 106 | + if(isset($this->_urls["refresh"])) { |
|
| 107 | + $this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
| 108 | + } |
|
| 105 | 109 | } |
| 106 | 110 | |
| 107 | 111 | $this->_generateContent($table); |
@@ -119,8 +123,9 @@ discard block |
||
| 119 | 123 | |
| 120 | 124 | $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"table",PositionInTable::AFTERTABLE]); |
| 121 | 125 | $this->_compileForm(); |
| 122 | - if(isset($this->_hiddenColumns)) |
|
| 123 | - $this->_hideColumns(); |
|
| 126 | + if(isset($this->_hiddenColumns)) { |
|
| 127 | + $this->_hideColumns(); |
|
| 128 | + } |
|
| 124 | 129 | if(isset($this->_colWidths)){ |
| 125 | 130 | foreach ($this->_colWidths as $colIndex=>$width){ |
| 126 | 131 | $table->setColWidth($colIndex,$width); |
@@ -176,8 +181,9 @@ discard block |
||
| 176 | 181 | $field=$ck->getField(); |
| 177 | 182 | $field->setProperty("value",$id); |
| 178 | 183 | $field->setProperty("name", "selection[]"); |
| 179 | - if(isset($checkedClass)) |
|
| 180 | - $field->setClass($checkedClass); |
|
| 184 | + if(isset($checkedClass)) { |
|
| 185 | + $field->setClass($checkedClass); |
|
| 186 | + } |
|
| 181 | 187 | \array_unshift($values, $ck); |
| 182 | 188 | } |
| 183 | 189 | $result=$table->newRow(); |
@@ -190,8 +196,9 @@ discard block |
||
| 190 | 196 | |
| 191 | 197 | protected function _generatePagination($table,$js=NULL){ |
| 192 | 198 | if(isset($this->_toolbar)){ |
| 193 | - if($this->_toolbarPosition==PositionInTable::FOOTER) |
|
| 194 | - $this->_toolbar->setFloated("left"); |
|
| 199 | + if($this->_toolbarPosition==PositionInTable::FOOTER) { |
|
| 200 | + $this->_toolbar->setFloated("left"); |
|
| 201 | + } |
|
| 195 | 202 | } |
| 196 | 203 | $footer=$table->getFooter(); |
| 197 | 204 | $footer->mergeCol(); |
@@ -210,8 +217,9 @@ discard block |
||
| 210 | 217 | |
| 211 | 218 | protected function _getFieldName($index){ |
| 212 | 219 | $fieldName=parent::_getFieldName($index); |
| 213 | - if(\is_object($fieldName)) |
|
| 214 | - $fieldName="field-".$index; |
|
| 220 | + if(\is_object($fieldName)) { |
|
| 221 | + $fieldName="field-".$index; |
|
| 222 | + } |
|
| 215 | 223 | return $fieldName."[]"; |
| 216 | 224 | } |
| 217 | 225 | |
@@ -251,7 +259,7 @@ discard block |
||
| 251 | 259 | $hasPart=$table->hasPart($part); |
| 252 | 260 | if($hasPart){ |
| 253 | 261 | $row=$table->getPart($part)->addRow(\sizeof($captions)); |
| 254 | - }else{ |
|
| 262 | + } else{ |
|
| 255 | 263 | $row=$table->getPart($part)->getRow(0); |
| 256 | 264 | } |
| 257 | 265 | $row->mergeCol(); |
@@ -276,7 +284,7 @@ discard block |
||
| 276 | 284 | $this->_urls["refresh"]=JArray::getValue($urls, "refresh",0); |
| 277 | 285 | $this->_urls["edit"]=JArray::getValue($urls, "edit",1); |
| 278 | 286 | $this->_urls["delete"]=JArray::getValue($urls, "delete",2); |
| 279 | - }else{ |
|
| 287 | + } else{ |
|
| 280 | 288 | $this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls]; |
| 281 | 289 | } |
| 282 | 290 | return $this; |
@@ -350,8 +358,9 @@ discard block |
||
| 350 | 358 | |
| 351 | 359 | protected function getTargetSelector() { |
| 352 | 360 | $result=$this->_targetSelector; |
| 353 | - if(!isset($result)) |
|
| 354 | - $result="#".$this->identifier; |
|
| 361 | + if(!isset($result)) { |
|
| 362 | + $result="#".$this->identifier; |
|
| 363 | + } |
|
| 355 | 364 | return $result; |
| 356 | 365 | } |
| 357 | 366 | |
@@ -366,8 +375,9 @@ discard block |
||
| 366 | 375 | } |
| 367 | 376 | |
| 368 | 377 | public function getRefreshSelector() { |
| 369 | - if(isset($this->_refreshSelector)) |
|
| 370 | - return $this->_refreshSelector; |
|
| 378 | + if(isset($this->_refreshSelector)) { |
|
| 379 | + return $this->_refreshSelector; |
|
| 380 | + } |
|
| 371 | 381 | return "#".$this->identifier." tbody"; |
| 372 | 382 | } |
| 373 | 383 | |
@@ -386,8 +396,9 @@ discard block |
||
| 386 | 396 | */ |
| 387 | 397 | public function show($modelInstance){ |
| 388 | 398 | if(\is_array($modelInstance)){ |
| 389 | - if(\is_array(array_values($modelInstance)[0])) |
|
| 390 | - $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
|
| 399 | + if(\is_array(array_values($modelInstance)[0])) { |
|
| 400 | + $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
|
| 401 | + } |
|
| 391 | 402 | } |
| 392 | 403 | $this->_modelInstance=$modelInstance; |
| 393 | 404 | } |
@@ -427,8 +438,9 @@ discard block |
||
| 427 | 438 | } |
| 428 | 439 | |
| 429 | 440 | public function hideColumn($colIndex){ |
| 430 | - if(!\is_array($this->_hiddenColumns)) |
|
| 431 | - $this->_hiddenColumns=[]; |
|
| 441 | + if(!\is_array($this->_hiddenColumns)) { |
|
| 442 | + $this->_hiddenColumns=[]; |
|
| 443 | + } |
|
| 432 | 444 | $this->_hiddenColumns[]=$colIndex; |
| 433 | 445 | return $this; |
| 434 | 446 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | foreach ($ajaxSubmit as $ajaxSubmitItem){ |
| 49 | 49 | $compilation.=$ajaxSubmitItem->compile($js); |
| 50 | 50 | } |
| 51 | - }elseif($ajaxSubmit instanceof AjaxCall){ |
|
| 51 | + } elseif($ajaxSubmit instanceof AjaxCall){ |
|
| 52 | 52 | $compilation=$ajaxSubmit->compile($js); |
| 53 | 53 | } |
| 54 | 54 | $compilation=str_ireplace("\"","%quote%", $compilation); |
@@ -66,8 +66,9 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | public function setAttached($value=true){ |
| 68 | 68 | $form=$this->getForm(); |
| 69 | - if($value) |
|
| 70 | - $form->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
| 69 | + if($value) { |
|
| 70 | + $form->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
| 71 | + } |
|
| 71 | 72 | return $form; |
| 72 | 73 | } |
| 73 | 74 | |
@@ -89,10 +90,11 @@ discard block |
||
| 89 | 90 | */ |
| 90 | 91 | public function submitOn($event,$identifierOrElement,$url,$responseElement,$parameters=NULL){ |
| 91 | 92 | $form=$this->getForm(); |
| 92 | - if($identifierOrElement instanceof BaseHtml) |
|
| 93 | - $elem=$identifierOrElement; |
|
| 94 | - else |
|
| 95 | - $elem=$form->getElementById($identifierOrElement, $form->getContent()); |
|
| 93 | + if($identifierOrElement instanceof BaseHtml) { |
|
| 94 | + $elem=$identifierOrElement; |
|
| 95 | + } else { |
|
| 96 | + $elem=$form->getElementById($identifierOrElement, $form->getContent()); |
|
| 97 | + } |
|
| 96 | 98 | if(isset($elem)){ |
| 97 | 99 | $this->_buttonAsSubmit($elem, $event,$url,$responseElement,$parameters); |
| 98 | 100 | } |
@@ -120,8 +122,9 @@ discard block |
||
| 120 | 122 | public function setSubmitParams($url,$responseElement=NULL,$parameters=NULL){ |
| 121 | 123 | $form=$this->getForm(); |
| 122 | 124 | $params=["form"=>$form->getIdentifier(),"responseElement"=>$responseElement,"url"=>$url,"stopPropagation"=>true]; |
| 123 | - if(\is_array($parameters)) |
|
| 124 | - $params=\array_merge($params,$parameters); |
|
| 125 | + if(\is_array($parameters)) { |
|
| 126 | + $params=\array_merge($params,$parameters); |
|
| 127 | + } |
|
| 125 | 128 | $form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", $params)); |
| 126 | 129 | return $this; |
| 127 | 130 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | if(!$item instanceof HtmlDropdownItem){ |
| 103 | 103 | $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description); |
| 104 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
| 104 | + } elseif($itemO instanceof HtmlDropdownItem){ |
|
| 105 | 105 | $this->addToProperty("class", "vertical"); |
| 106 | 106 | } |
| 107 | 107 | return $itemO; |
@@ -115,8 +115,9 @@ discard block |
||
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | public function addInput($name){ |
| 118 | - if(!isset($name)) |
|
| 119 | - $name="input-".$this->identifier; |
|
| 118 | + if(!isset($name)) { |
|
| 119 | + $name="input-".$this->identifier; |
|
| 120 | + } |
|
| 120 | 121 | $this->setAction("activate"); |
| 121 | 122 | $this->input=new HtmlInput($name,"hidden"); |
| 122 | 123 | } |
@@ -173,7 +174,7 @@ discard block |
||
| 173 | 174 | foreach ($items as $k=>$v){ |
| 174 | 175 | $this->addItem($v)->setData($k); |
| 175 | 176 | } |
| 176 | - }else{ |
|
| 177 | + } else{ |
|
| 177 | 178 | foreach ($items as $item){ |
| 178 | 179 | $this->addItem($item); |
| 179 | 180 | } |
@@ -197,7 +198,7 @@ discard block |
||
| 197 | 198 | if($dropdown===false){ |
| 198 | 199 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
| 199 | 200 | $dropdown="menu"; |
| 200 | - }else{ |
|
| 201 | + } else{ |
|
| 201 | 202 | $dropdown="dropdown"; |
| 202 | 203 | $this->mClass="menu"; |
| 203 | 204 | } |
@@ -218,20 +219,24 @@ discard block |
||
| 218 | 219 | |
| 219 | 220 | public function asButton($floating=false){ |
| 220 | 221 | $this->removeArrow(); |
| 221 | - if($floating) |
|
| 222 | - $this->addToProperty("class", "floating"); |
|
| 222 | + if($floating) { |
|
| 223 | + $this->addToProperty("class", "floating"); |
|
| 224 | + } |
|
| 223 | 225 | $this->removePropertyValue("class", "selection"); |
| 224 | 226 | return $this->addToProperty("class", "button"); |
| 225 | 227 | } |
| 226 | 228 | |
| 227 | 229 | public function asSelect($name=NULL,$multiple=false,$selection=true){ |
| 228 | - if(isset($name)) |
|
| 229 | - $this->addInput($name); |
|
| 230 | - if($multiple) |
|
| 231 | - $this->addToProperty("class", "multiple"); |
|
| 230 | + if(isset($name)) { |
|
| 231 | + $this->addInput($name); |
|
| 232 | + } |
|
| 233 | + if($multiple) { |
|
| 234 | + $this->addToProperty("class", "multiple"); |
|
| 235 | + } |
|
| 232 | 236 | if ($selection){ |
| 233 | - if($this->propertyContains("class", "button")===false) |
|
| 234 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 237 | + if($this->propertyContains("class", "button")===false) { |
|
| 238 | + $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 239 | + } |
|
| 235 | 240 | } |
| 236 | 241 | return $this; |
| 237 | 242 | } |
@@ -242,8 +247,9 @@ discard block |
||
| 242 | 247 | } |
| 243 | 248 | |
| 244 | 249 | public function setSelect($name=NULL,$multiple=false){ |
| 245 | - if(!isset($name)) |
|
| 246 | - $name="select-".$this->identifier; |
|
| 250 | + if(!isset($name)) { |
|
| 251 | + $name="select-".$this->identifier; |
|
| 252 | + } |
|
| 247 | 253 | $this->input=null; |
| 248 | 254 | if($multiple){ |
| 249 | 255 | $this->setProperty("multiple", true); |
@@ -279,12 +285,13 @@ discard block |
||
| 279 | 285 | $value=$this->value; |
| 280 | 286 | if(isset($this->input) && isset($value)){ |
| 281 | 287 | $this->input->setProperty("value", $value); |
| 282 | - }else{ |
|
| 288 | + } else{ |
|
| 283 | 289 | $this->setProperty("value", $value); |
| 284 | 290 | } |
| 285 | 291 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
| 286 | - if(isset($textElement)) |
|
| 287 | - $textElement->setContent($value); |
|
| 292 | + if(isset($textElement)) { |
|
| 293 | + $textElement->setContent($value); |
|
| 294 | + } |
|
| 288 | 295 | return $this; |
| 289 | 296 | } |
| 290 | 297 | |
@@ -17,8 +17,9 @@ discard block |
||
| 17 | 17 | protected $_dropdown; |
| 18 | 18 | public function __construct($identifier, $elements=array(), $asIcons=false) { |
| 19 | 19 | parent::__construct($identifier, "div", "ui buttons"); |
| 20 | - if ($asIcons === true) |
|
| 21 | - $this->asIcons(); |
|
| 20 | + if ($asIcons === true) { |
|
| 21 | + $this->asIcons(); |
|
| 22 | + } |
|
| 22 | 23 | $this->addElements($elements, $asIcons); |
| 23 | 24 | } |
| 24 | 25 | protected function createItem($value){ |
@@ -39,8 +40,9 @@ discard block |
||
| 39 | 40 | |
| 40 | 41 | public function addElement($element, $asIcon=false) { |
| 41 | 42 | $item=$this->addItem($element); |
| 42 | - if($asIcon) |
|
| 43 | - $item->asIcon($element); |
|
| 43 | + if($asIcon) { |
|
| 44 | + $item->asIcon($element); |
|
| 45 | + } |
|
| 44 | 46 | return $item; |
| 45 | 47 | } |
| 46 | 48 | |
@@ -68,8 +70,9 @@ discard block |
||
| 68 | 70 | |
| 69 | 71 | public function asIcons() { |
| 70 | 72 | foreach ( $this->content as $item ) { |
| 71 | - if($item instanceof HtmlButton) |
|
| 72 | - $item->asIcon($item->getContent()); |
|
| 73 | + if($item instanceof HtmlButton) { |
|
| 74 | + $item->asIcon($item->getContent()); |
|
| 75 | + } |
|
| 73 | 76 | } |
| 74 | 77 | return $this->addToProperty("class", "icons"); |
| 75 | 78 | } |
@@ -47,8 +47,9 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | public function setVariations($variations) { |
| 49 | 49 | $this->setProperty("class", $this->_baseClass); |
| 50 | - if (\is_string($variations)) |
|
| 51 | - $variations=\explode(" ", $variations); |
|
| 50 | + if (\is_string($variations)) { |
|
| 51 | + $variations=\explode(" ", $variations); |
|
| 52 | + } |
|
| 52 | 53 | foreach ( $variations as $variation ) { |
| 53 | 54 | $this->addVariation($variation); |
| 54 | 55 | } |
@@ -61,8 +62,9 @@ discard block |
||
| 61 | 62 | } |
| 62 | 63 | |
| 63 | 64 | public function addVariations($variations=array()) { |
| 64 | - if (\is_string($variations)) |
|
| 65 | - $variations=\explode(" ", $variations); |
|
| 65 | + if (\is_string($variations)) { |
|
| 66 | + $variations=\explode(" ", $variations); |
|
| 67 | + } |
|
| 66 | 68 | foreach ( $variations as $variation ) { |
| 67 | 69 | $this->addVariation($variation); |
| 68 | 70 | } |
@@ -70,8 +72,9 @@ discard block |
||
| 70 | 72 | } |
| 71 | 73 | |
| 72 | 74 | public function addStates($states=array()) { |
| 73 | - if (\is_string($states)) |
|
| 74 | - $states=\explode(" ", $states); |
|
| 75 | + if (\is_string($states)) { |
|
| 76 | + $states=\explode(" ", $states); |
|
| 77 | + } |
|
| 75 | 78 | foreach ( $states as $state ) { |
| 76 | 79 | $this->addState($state); |
| 77 | 80 | } |
@@ -80,8 +83,9 @@ discard block |
||
| 80 | 83 | |
| 81 | 84 | public function setStates($states) { |
| 82 | 85 | $this->setProperty("class", $this->_baseClass); |
| 83 | - if (\is_string($states)) |
|
| 84 | - $states=\explode(" ", $states); |
|
| 86 | + if (\is_string($states)) { |
|
| 87 | + $states=\explode(" ", $states); |
|
| 88 | + } |
|
| 85 | 89 | foreach ( $states as $state ) { |
| 86 | 90 | $this->addState($state); |
| 87 | 91 | } |
@@ -113,8 +117,9 @@ discard block |
||
| 113 | 117 | * @return HtmlSemDoubleElement |
| 114 | 118 | */ |
| 115 | 119 | public function setDisabled($disable=true) { |
| 116 | - if($disable) |
|
| 117 | - $this->addToProperty("class", "disabled"); |
|
| 120 | + if($disable) { |
|
| 121 | + $this->addToProperty("class", "disabled"); |
|
| 122 | + } |
|
| 118 | 123 | return $this; |
| 119 | 124 | } |
| 120 | 125 | |
@@ -148,14 +153,16 @@ discard block |
||
| 148 | 153 | * @return HtmlSemDoubleElement |
| 149 | 154 | */ |
| 150 | 155 | public function setActive($value=true){ |
| 151 | - if($value) |
|
| 152 | - $this->addToProperty("class", "active"); |
|
| 156 | + if($value) { |
|
| 157 | + $this->addToProperty("class", "active"); |
|
| 158 | + } |
|
| 153 | 159 | return $this; |
| 154 | 160 | } |
| 155 | 161 | |
| 156 | 162 | public function setAttached($value=true){ |
| 157 | - if($value) |
|
| 158 | - $this->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
| 163 | + if($value) { |
|
| 164 | + $this->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
| 165 | + } |
|
| 159 | 166 | return $this; |
| 160 | 167 | } |
| 161 | 168 | |
@@ -191,9 +198,10 @@ discard block |
||
| 191 | 198 | if(isset($array[$key])){ |
| 192 | 199 | $p=JString::replaceAtFirstAndLast($array[$key], $before, "", $after, ""); |
| 193 | 200 | $array[$key]=$before.$p.$value.$after; |
| 194 | - }else |
|
| 195 | - $array[$key]=$before.$value.$after; |
|
| 196 | - }else{ |
|
| 201 | + } else { |
|
| 202 | + $array[$key]=$before.$value.$after; |
|
| 203 | + } |
|
| 204 | + } else{ |
|
| 197 | 205 | $array[$key]=$value; |
| 198 | 206 | } |
| 199 | 207 | return $this; |