@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | if(is_array($element)){ |
| 68 | 68 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size); |
| 69 | 69 | $elm->fromArray($element); |
| 70 | - }else if($element instanceof HtmlLink){ |
|
| 70 | + } else if($element instanceof HtmlLink){ |
|
| 71 | 71 | $elm=$element; |
| 72 | - }else{ |
|
| 72 | + } else{ |
|
| 73 | 73 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size,$href,$element); |
| 74 | 74 | if(isset($glyph)){ |
| 75 | 75 | $elm->wrapContentWithGlyph($glyph); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | if($this->absolutePaths===true){ |
| 118 | 118 | return $this->_hrefFunction($this->content[$index]); |
| 119 | - }else{ |
|
| 119 | + } else{ |
|
| 120 | 120 | return $this->root.implode($separator, array_slice(array_map(function($e){return $this->_hrefFunction($e);}, $this->content),0,$index+1)); |
| 121 | 121 | } |
| 122 | 122 | } |
@@ -24,14 +24,14 @@ |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public static function getConstantValues($postFix="",$prefixBefore=false) { |
| 27 | - if ($postFix == "") |
|
| 28 | - return \array_values(self::getConstants()); |
|
| 29 | - else { |
|
| 27 | + if ($postFix == "") { |
|
| 28 | + return \array_values(self::getConstants()); |
|
| 29 | + } else { |
|
| 30 | 30 | if($prefixBefore===false){ |
| 31 | 31 | return \array_map(function ($elem) use($postFix) { |
| 32 | 32 | return $elem . " " . $postFix; |
| 33 | 33 | }, \array_values(self::getConstants())); |
| 34 | - }else{ |
|
| 34 | + } else{ |
|
| 35 | 35 | return \array_map(function ($elem) use($postFix) { |
| 36 | 36 | return $postFix." ".$elem; |
| 37 | 37 | }, \array_values(self::getConstants())); |
@@ -16,8 +16,9 @@ discard block |
||
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | public function setValue($value) { |
| 19 | - if(isset($value)) |
|
| 20 | - $this->setProperty("value", $value); |
|
| 19 | + if(isset($value)) { |
|
| 20 | + $this->setProperty("value", $value); |
|
| 21 | + } |
|
| 21 | 22 | return $this; |
| 22 | 23 | } |
| 23 | 24 | |
@@ -27,11 +28,13 @@ discard block |
||
| 27 | 28 | |
| 28 | 29 | public function setPlaceholder($value){ |
| 29 | 30 | if(JString::isNull($value)){ |
| 30 | - if(JString::isNotNull($this->identifier)) |
|
| 31 | - $value=\ucfirst($this->identifier); |
|
| 31 | + if(JString::isNotNull($this->identifier)) { |
|
| 32 | + $value=\ucfirst($this->identifier); |
|
| 33 | + } |
|
| 34 | + } |
|
| 35 | + if(JString::isNotNull($value)) { |
|
| 36 | + $this->setProperty("placeholder", $value); |
|
| 32 | 37 | } |
| 33 | - if(JString::isNotNull($value)) |
|
| 34 | - $this->setProperty("placeholder", $value); |
|
| 35 | 38 | return $this; |
| 36 | 39 | } |
| 37 | 40 | } |
| 38 | 41 | \ No newline at end of file |
@@ -50,8 +50,9 @@ discard block |
||
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | public function getProperty($name) { |
| 53 | - if (array_key_exists($name, $this->properties)) |
|
| 54 | - return $this->properties[$name]; |
|
| 53 | + if (array_key_exists($name, $this->properties)) { |
|
| 54 | + return $this->properties[$name]; |
|
| 55 | + } |
|
| 55 | 56 | } |
| 56 | 57 | |
| 57 | 58 | public function addToProperty($name, $value, $separator=" ") { |
@@ -61,10 +62,11 @@ discard block |
||
| 61 | 62 | } |
| 62 | 63 | } else if ($value !== "" && $this->propertyContains($name, $value) === false) { |
| 63 | 64 | $v=@$this->properties[$name]; |
| 64 | - if (isset($v) && $v !== "") |
|
| 65 | - $v=$v . $separator . $value; |
|
| 66 | - else |
|
| 67 | - $v=$value; |
|
| 65 | + if (isset($v) && $v !== "") { |
|
| 66 | + $v=$v . $separator . $value; |
|
| 67 | + } else { |
|
| 68 | + $v=$value; |
|
| 69 | + } |
|
| 68 | 70 | |
| 69 | 71 | return $this->setProperty($name, $v); |
| 70 | 72 | } |
@@ -119,8 +121,9 @@ discard block |
||
| 119 | 121 | } |
| 120 | 122 | |
| 121 | 123 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
| 122 | - if ($this->ctrl($name, $value, $typeCtrl) === true) |
|
| 123 | - return $this->setProperty($name, $value); |
|
| 124 | + if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 125 | + return $this->setProperty($name, $value); |
|
| 126 | + } |
|
| 124 | 127 | return $this; |
| 125 | 128 | } |
| 126 | 129 | |
@@ -150,8 +153,9 @@ discard block |
||
| 150 | 153 | } |
| 151 | 154 | |
| 152 | 155 | protected function removeProperty($name) { |
| 153 | - if (\array_key_exists($name, $this->properties)) |
|
| 154 | - unset($this->properties[$name]); |
|
| 156 | + if (\array_key_exists($name, $this->properties)) { |
|
| 157 | + unset($this->properties[$name]); |
|
| 158 | + } |
|
| 155 | 159 | return $this; |
| 156 | 160 | } |
| 157 | 161 | |
@@ -171,8 +175,9 @@ discard block |
||
| 171 | 175 | } |
| 172 | 176 | |
| 173 | 177 | protected function addToPropertyUnique($name, $value, $typeCtrl) { |
| 174 | - if (@class_exists($typeCtrl, true)) |
|
| 175 | - $typeCtrl=$typeCtrl::getConstants(); |
|
| 178 | + if (@class_exists($typeCtrl, true)) { |
|
| 179 | + $typeCtrl=$typeCtrl::getConstants(); |
|
| 180 | + } |
|
| 176 | 181 | if (is_array($typeCtrl)) { |
| 177 | 182 | $this->removeOldValues($this->properties[$name], $typeCtrl); |
| 178 | 183 | } |
@@ -358,15 +363,18 @@ discard block |
||
| 358 | 363 | $flag=false; |
| 359 | 364 | $index=0; |
| 360 | 365 | while ( !$flag && $index < sizeof($elements) ) { |
| 361 | - if ($elements[$index] instanceof BaseHtml) |
|
| 362 | - $flag=($elements[$index]->getIdentifier() === $identifier); |
|
| 366 | + if ($elements[$index] instanceof BaseHtml) { |
|
| 367 | + $flag=($elements[$index]->getIdentifier() === $identifier); |
|
| 368 | + } |
|
| 363 | 369 | $index++; |
| 364 | 370 | } |
| 365 | - if ($flag === true) |
|
| 366 | - return $elements[$index - 1]; |
|
| 371 | + if ($flag === true) { |
|
| 372 | + return $elements[$index - 1]; |
|
| 373 | + } |
|
| 367 | 374 | } elseif ($elements instanceof BaseHtml) { |
| 368 | - if ($elements->getIdentifier() === $identifier) |
|
| 369 | - return $elements; |
|
| 375 | + if ($elements->getIdentifier() === $identifier) { |
|
| 376 | + return $elements; |
|
| 377 | + } |
|
| 370 | 378 | } |
| 371 | 379 | return null; |
| 372 | 380 | } |
@@ -376,15 +384,18 @@ discard block |
||
| 376 | 384 | $flag=false; |
| 377 | 385 | $index=0; |
| 378 | 386 | while ( !$flag && $index < sizeof($elements) ) { |
| 379 | - if ($elements[$index] instanceof BaseHtml) |
|
| 380 | - $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
| 387 | + if ($elements[$index] instanceof BaseHtml) { |
|
| 388 | + $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
| 389 | + } |
|
| 381 | 390 | $index++; |
| 382 | 391 | } |
| 383 | - if ($flag === true) |
|
| 384 | - return $elements[$index - 1]; |
|
| 392 | + if ($flag === true) { |
|
| 393 | + return $elements[$index - 1]; |
|
| 394 | + } |
|
| 385 | 395 | } elseif ($elements instanceof BaseHtml) { |
| 386 | - if ($elements->propertyContains($propertyName, $value) === true) |
|
| 387 | - return $elements; |
|
| 396 | + if ($elements->propertyContains($propertyName, $value) === true) { |
|
| 397 | + return $elements; |
|
| 398 | + } |
|
| 388 | 399 | } |
| 389 | 400 | return null; |
| 390 | 401 | } |
@@ -44,8 +44,9 @@ |
||
| 44 | 44 | $actionO=$action; |
| 45 | 45 | if (\is_object($action) === false) { |
| 46 | 46 | $actionO=new HtmlButton("action-" . $this->identifier, $action); |
| 47 | - if (isset($icon)) |
|
| 48 | - $actionO->addIcon($icon, true, $labeled); |
|
| 47 | + if (isset($icon)) { |
|
| 48 | + $actionO->addIcon($icon, true, $labeled); |
|
| 49 | + } |
|
| 49 | 50 | } |
| 50 | 51 | $this->addToProperty("class", $direction . " action"); |
| 51 | 52 | $this->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
@@ -14,8 +14,9 @@ discard block |
||
| 14 | 14 | public function __construct($identifier, $caption="", $icon=NULL, $tagName="div") { |
| 15 | 15 | parent::__construct($identifier, $tagName, "ui label"); |
| 16 | 16 | $this->content=$caption; |
| 17 | - if (isset($icon)===true) |
|
| 18 | - $this->addIcon($icon); |
|
| 17 | + if (isset($icon)===true) { |
|
| 18 | + $this->addIcon($icon); |
|
| 19 | + } |
|
| 19 | 20 | } |
| 20 | 21 | |
| 21 | 22 | /** |
@@ -24,10 +25,11 @@ discard block |
||
| 24 | 25 | * @return \Ajax\semantic\html\elements\HtmlLabel |
| 25 | 26 | */ |
| 26 | 27 | public function setPointing($value=Direction::NONE) { |
| 27 | - if($value==="left" || $value==="right") |
|
| 28 | - return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 29 | - else |
|
| 30 | - return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing",true)); |
|
| 28 | + if($value==="left" || $value==="right") { |
|
| 29 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 30 | + } else { |
|
| 31 | + return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing",true)); |
|
| 32 | + } |
|
| 31 | 33 | } |
| 32 | 34 | |
| 33 | 35 | /** |
@@ -121,10 +123,11 @@ discard block |
||
| 121 | 123 | } |
| 122 | 124 | |
| 123 | 125 | public function setAttached($side=Side::TOP,$direction=Direction::NONE){ |
| 124 | - if($direction!==Direction::NONE) |
|
| 125 | - return $this->addToPropertyCtrl("class", $side." ".$direction." attached",Side::getConstantValues($direction." attached")); |
|
| 126 | - else |
|
| 127 | - return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached")); |
|
| 126 | + if($direction!==Direction::NONE) { |
|
| 127 | + return $this->addToPropertyCtrl("class", $side." ".$direction." attached",Side::getConstantValues($direction." attached")); |
|
| 128 | + } else { |
|
| 129 | + return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached")); |
|
| 130 | + } |
|
| 128 | 131 | } |
| 129 | 132 | |
| 130 | 133 | public static function ribbon($identifier, $caption) { |
@@ -102,8 +102,9 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function setBordered($inverted=false) { |
| 104 | 104 | $invertedStr=""; |
| 105 | - if ($inverted !== false) |
|
| 106 | - $invertedStr=" inverted"; |
|
| 105 | + if ($inverted !== false) { |
|
| 106 | + $invertedStr=" inverted"; |
|
| 107 | + } |
|
| 107 | 108 | return $this->addToProperty("class", "bordered" . $invertedStr); |
| 108 | 109 | } |
| 109 | 110 | |
@@ -116,12 +117,14 @@ discard block |
||
| 116 | 117 | } |
| 117 | 118 | |
| 118 | 119 | public function addLabel($label, $before=false, $icon=NULL) { |
| 119 | - if($before) |
|
| 120 | - $this->wrap($label); |
|
| 121 | - else |
|
| 122 | - $this->wrap("", $label); |
|
| 123 | - if(isset($icon)) |
|
| 124 | - $this->addToIcon($icon); |
|
| 120 | + if($before) { |
|
| 121 | + $this->wrap($label); |
|
| 122 | + } else { |
|
| 123 | + $this->wrap("", $label); |
|
| 124 | + } |
|
| 125 | + if(isset($icon)) { |
|
| 126 | + $this->addToIcon($icon); |
|
| 127 | + } |
|
| 125 | 128 | return $this; |
| 126 | 129 | } |
| 127 | 130 | |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public function setFocusable($value=true) { |
| 58 | - if ($value === true) |
|
| 59 | - $this->setProperty("tabindex", "0"); |
|
| 60 | - else { |
|
| 58 | + if ($value === true) { |
|
| 59 | + $this->setProperty("tabindex", "0"); |
|
| 60 | + } else { |
|
| 61 | 61 | $this->removeProperty("tabindex"); |
| 62 | 62 | } |
| 63 | 63 | return $this; |
@@ -109,8 +109,9 @@ discard block |
||
| 109 | 109 | $this->content=new HtmlButton("button-" . $this->identifier, $this->content); |
| 110 | 110 | $this->content->setTagName("div"); |
| 111 | 111 | $label=new HtmlLabel("label-" . $this->identifier, $label, "a"); |
| 112 | - if(isset($icon)) |
|
| 113 | - $label->addIcon($icon); |
|
| 112 | + if(isset($icon)) { |
|
| 113 | + $label->addIcon($icon); |
|
| 114 | + } |
|
| 114 | 115 | $label->setBasic(); |
| 115 | 116 | $this->addContent($label, $before); |
| 116 | 117 | return $label; |
@@ -185,8 +186,9 @@ discard block |
||
| 185 | 186 | } |
| 186 | 187 | |
| 187 | 188 | public static function social($identifier, $social, $value=NULL) { |
| 188 | - if ($value === NULL) |
|
| 189 | - $value=\ucfirst($social); |
|
| 189 | + if ($value === NULL) { |
|
| 190 | + $value=\ucfirst($social); |
|
| 191 | + } |
|
| 190 | 192 | $return=new HtmlButton($identifier, $value); |
| 191 | 193 | $return->addIcon($social); |
| 192 | 194 | return $return->addToPropertyCtrl("class", $social, Social::getConstants()); |
@@ -14,8 +14,9 @@ |
||
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public function asAvatar($caption=NULL) { |
| 17 | - if (isset($caption)) |
|
| 18 | - $this->wrap("", $caption); |
|
| 17 | + if (isset($caption)) { |
|
| 18 | + $this->wrap("", $caption); |
|
| 19 | + } |
|
| 19 | 20 | return $this->addToProperty("class", "avatar"); |
| 20 | 21 | } |
| 21 | 22 | } |
| 22 | 23 | \ No newline at end of file |