@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $itemO=$item; |
| 35 | 35 | if(\is_object($item)===false){ |
| 36 | 36 | $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
| 37 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
| 37 | + } elseif($itemO instanceof HtmlDropdownItem){ |
|
| 38 | 38 | $this->addToProperty("class", "vertical"); |
| 39 | 39 | } |
| 40 | 40 | $this->items[]=$itemO; |
@@ -42,8 +42,9 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public function addInput($name){ |
| 45 | - if(!isset($name)) |
|
| 46 | - $name="input-".$this->identifier; |
|
| 45 | + if(!isset($name)) { |
|
| 46 | + $name="input-".$this->identifier; |
|
| 47 | + } |
|
| 47 | 48 | $this->setAction("activate"); |
| 48 | 49 | $this->input=new HtmlInput($name,"hidden"); |
| 49 | 50 | } |
@@ -53,7 +54,7 @@ discard block |
||
| 53 | 54 | foreach ($items as $k=>$v){ |
| 54 | 55 | $this->addItem($v)->setData($k); |
| 55 | 56 | } |
| 56 | - }else{ |
|
| 57 | + } else{ |
|
| 57 | 58 | foreach ($items as $item){ |
| 58 | 59 | $this->addItem($item); |
| 59 | 60 | } |
@@ -67,7 +68,7 @@ discard block |
||
| 67 | 68 | if($dropdown===false){ |
| 68 | 69 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
| 69 | 70 | $dropdown="menu"; |
| 70 | - }else{ |
|
| 71 | + } else{ |
|
| 71 | 72 | $dropdown="dropdown"; |
| 72 | 73 | $this->mClass="menu"; |
| 73 | 74 | } |
@@ -83,18 +84,22 @@ discard block |
||
| 83 | 84 | } |
| 84 | 85 | |
| 85 | 86 | public function asButton($floating=false){ |
| 86 | - if($floating) |
|
| 87 | - $this->addToProperty("class", "floating"); |
|
| 87 | + if($floating) { |
|
| 88 | + $this->addToProperty("class", "floating"); |
|
| 89 | + } |
|
| 88 | 90 | return $this->addToProperty("class", "button"); |
| 89 | 91 | } |
| 90 | 92 | |
| 91 | 93 | public function asSelect($name=NULL,$multiple=false,$selection=true){ |
| 92 | - if(isset($name)) |
|
| 93 | - $this->addInput($name); |
|
| 94 | - if($multiple) |
|
| 95 | - $this->addToProperty("class", "multiple"); |
|
| 96 | - if ($selection) |
|
| 97 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 94 | + if(isset($name)) { |
|
| 95 | + $this->addInput($name); |
|
| 96 | + } |
|
| 97 | + if($multiple) { |
|
| 98 | + $this->addToProperty("class", "multiple"); |
|
| 99 | + } |
|
| 100 | + if ($selection) { |
|
| 101 | + $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 102 | + } |
|
| 98 | 103 | return $this; |
| 99 | 104 | } |
| 100 | 105 | |
@@ -104,8 +109,9 @@ discard block |
||
| 104 | 109 | } |
| 105 | 110 | |
| 106 | 111 | public function setSelect($name=NULL,$multiple=false){ |
| 107 | - if(!isset($name)) |
|
| 108 | - $name="select-".$this->identifier; |
|
| 112 | + if(!isset($name)) { |
|
| 113 | + $name="select-".$this->identifier; |
|
| 114 | + } |
|
| 109 | 115 | $this->input=null; |
| 110 | 116 | if($multiple){ |
| 111 | 117 | $this->setProperty("multiple", true); |
@@ -136,12 +142,13 @@ discard block |
||
| 136 | 142 | public function setValue($value){ |
| 137 | 143 | if(isset($this->input)){ |
| 138 | 144 | $this->input->setProperty("value", $value); |
| 139 | - }else{ |
|
| 145 | + } else{ |
|
| 140 | 146 | $this->setProperty("value", $value); |
| 141 | 147 | } |
| 142 | 148 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
| 143 | - if(isset($textElement)) |
|
| 144 | - $textElement->setContent($value); |
|
| 149 | + if(isset($textElement)) { |
|
| 150 | + $textElement->setContent($value); |
|
| 151 | + } |
|
| 145 | 152 | return $this; |
| 146 | 153 | } |
| 147 | 154 | |
@@ -151,8 +158,9 @@ discard block |
||
| 151 | 158 | */ |
| 152 | 159 | public function run(JsUtils $js) { |
| 153 | 160 | if($this->propertyContains("class", "simple")===false){ |
| 154 | - if(isset($this->_bsComponent)===false) |
|
| 155 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->params); |
|
| 161 | + if(isset($this->_bsComponent)===false) { |
|
| 162 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->params); |
|
| 163 | + } |
|
| 156 | 164 | $this->addEventsOnRun($js); |
| 157 | 165 | return $this->_bsComponent; |
| 158 | 166 | } |
@@ -50,16 +50,18 @@ 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=" ") { |
| 58 | 59 | $v=@$this->properties[$name]; |
| 59 | - if (isset($v)&&$v!=="") |
|
| 60 | - $v=$v.$separator.$value; |
|
| 61 | - else |
|
| 62 | - $v=$value; |
|
| 60 | + if (isset($v)&&$v!=="") { |
|
| 61 | + $v=$v.$separator.$value; |
|
| 62 | + } else { |
|
| 63 | + $v=$value; |
|
| 64 | + } |
|
| 63 | 65 | |
| 64 | 66 | return $this->setProperty($name, $v); |
| 65 | 67 | } |
@@ -117,8 +119,9 @@ discard block |
||
| 117 | 119 | } |
| 118 | 120 | |
| 119 | 121 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
| 120 | - if ($this->ctrl($name, $value, $typeCtrl)===true) |
|
| 121 | - return $this->setProperty($name, $value); |
|
| 122 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 123 | + return $this->setProperty($name, $value); |
|
| 124 | + } |
|
| 122 | 125 | return $this; |
| 123 | 126 | } |
| 124 | 127 | |
@@ -143,8 +146,9 @@ discard block |
||
| 143 | 146 | } |
| 144 | 147 | |
| 145 | 148 | protected function removeProperty($name){ |
| 146 | - if(\array_key_exists($name, $this->properties)) |
|
| 147 | - unset($this->properties[$name]); |
|
| 149 | + if(\array_key_exists($name, $this->properties)) { |
|
| 150 | + unset($this->properties[$name]); |
|
| 151 | + } |
|
| 148 | 152 | return $this; |
| 149 | 153 | } |
| 150 | 154 | |
@@ -164,8 +168,9 @@ discard block |
||
| 164 | 168 | } |
| 165 | 169 | |
| 166 | 170 | protected function addToPropertyUnique($name, $value, $typeCtrl) { |
| 167 | - if (@class_exists($typeCtrl, true)) |
|
| 168 | - $typeCtrl=$typeCtrl::getConstants(); |
|
| 171 | + if (@class_exists($typeCtrl, true)) { |
|
| 172 | + $typeCtrl=$typeCtrl::getConstants(); |
|
| 173 | + } |
|
| 169 | 174 | if (is_array($typeCtrl)) { |
| 170 | 175 | $this->removeOldValues($this->properties [$name], $typeCtrl); |
| 171 | 176 | } |
@@ -348,15 +353,18 @@ discard block |
||
| 348 | 353 | $flag=false; |
| 349 | 354 | $index=0; |
| 350 | 355 | while ( !$flag&&$index<sizeof($elements) ) { |
| 351 | - if ($elements [$index] instanceof BaseHtml) |
|
| 352 | - $flag=($elements [$index]->getIdentifier()===$identifier); |
|
| 356 | + if ($elements [$index] instanceof BaseHtml) { |
|
| 357 | + $flag=($elements [$index]->getIdentifier()===$identifier); |
|
| 358 | + } |
|
| 353 | 359 | $index++; |
| 354 | 360 | } |
| 355 | - if ($flag===true) |
|
| 356 | - return $elements [$index-1]; |
|
| 361 | + if ($flag===true) { |
|
| 362 | + return $elements [$index-1]; |
|
| 363 | + } |
|
| 357 | 364 | } elseif ($elements instanceof BaseHtml) { |
| 358 | - if ($elements->getIdentifier()===$identifier) |
|
| 359 | - return $elements; |
|
| 365 | + if ($elements->getIdentifier()===$identifier) { |
|
| 366 | + return $elements; |
|
| 367 | + } |
|
| 360 | 368 | } |
| 361 | 369 | return null; |
| 362 | 370 | } |
@@ -92,8 +92,9 @@ discard block |
||
| 92 | 92 | if(\sizeof($params)>0 || \strtolower($action)!="index" ){ |
| 93 | 93 | $items[]=$action; |
| 94 | 94 | foreach ($params as $p){ |
| 95 | - if(\is_object($p)===false) |
|
| 96 | - $items[]=$p; |
|
| 95 | + if(\is_object($p)===false) { |
|
| 96 | + $items[]=$p; |
|
| 97 | + } |
|
| 97 | 98 | } |
| 98 | 99 | } |
| 99 | 100 | return $this->addItems($items); |
@@ -111,7 +112,7 @@ discard block |
||
| 111 | 112 | } |
| 112 | 113 | if($this->absolutePaths===true){ |
| 113 | 114 | return $this->_hrefFunction($this->content[$index]); |
| 114 | - }else{ |
|
| 115 | + } else{ |
|
| 115 | 116 | return $this->root.implode($separator, array_slice(array_map(function($e){return $this->_hrefFunction($e);}, $this->content),$this->startIndex,$index+1)); |
| 116 | 117 | } |
| 117 | 118 | } |
@@ -165,8 +166,9 @@ discard block |
||
| 165 | 166 | |
| 166 | 167 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 167 | 168 | foreach ($this->content as $element){ |
| 168 | - if($element->getProperty($this->attr)!=NULL) |
|
| 169 | - $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
|
| 169 | + if($element->getProperty($this->attr)!=NULL) { |
|
| 170 | + $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
|
| 171 | + } |
|
| 170 | 172 | } |
| 171 | 173 | return $this; |
| 172 | 174 | } |
@@ -178,9 +180,9 @@ discard block |
||
| 178 | 180 | protected function createItem($value) { |
| 179 | 181 | $count=$this->count(); |
| 180 | 182 | $itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count,"a","section"); |
| 181 | - if(\is_array($value)) |
|
| 182 | - $itemO->fromArray($value); |
|
| 183 | - else{ |
|
| 183 | + if(\is_array($value)) { |
|
| 184 | + $itemO->fromArray($value); |
|
| 185 | + } else{ |
|
| 184 | 186 | $itemO->setContent($value); |
| 185 | 187 | $itemO->setProperty($this->attr, $this->getHref($count)); |
| 186 | 188 | } |
@@ -32,9 +32,10 @@ discard block |
||
| 32 | 32 | $labelO=$label; |
| 33 | 33 | if(\is_object($label)===false){ |
| 34 | 34 | $labelO=new HtmlLabel("label-".$this->identifier,$label); |
| 35 | - if(isset($icon)) |
|
| 36 | - $labelO->addIcon($icon); |
|
| 37 | - }else{ |
|
| 35 | + if(isset($icon)) { |
|
| 36 | + $labelO->addIcon($icon); |
|
| 37 | + } |
|
| 38 | + } else{ |
|
| 38 | 39 | $labelO->addToPropertyCtrl("class", "label", array("label")); |
| 39 | 40 | } |
| 40 | 41 | $this->addToProperty("class", $direction." labeled"); |
@@ -50,8 +51,9 @@ discard block |
||
| 50 | 51 | $actionO=$action; |
| 51 | 52 | if(\is_object($action)===false){ |
| 52 | 53 | $actionO=new HtmlButton("action-".$this->identifier,$action); |
| 53 | - if(isset($icon)) |
|
| 54 | - $actionO->addIcon($icon,true,$labeled); |
|
| 54 | + if(isset($icon)) { |
|
| 55 | + $actionO->addIcon($icon,true,$labeled); |
|
| 56 | + } |
|
| 55 | 57 | } |
| 56 | 58 | $this->addToProperty("class", $direction." action"); |
| 57 | 59 | $this->addContent($actionO,\strstr($direction,Direction::LEFT)!==false); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
| 17 | 17 | $this->addContent($iconO,false); |
| 18 | 18 | $this->_hasIcon=true; |
| 19 | - }else{ |
|
| 19 | + } else{ |
|
| 20 | 20 | $iconO=$this->getIcon(); |
| 21 | 21 | $iconO->setIcon($icon); |
| 22 | 22 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
@@ -27,8 +27,9 @@ discard block |
||
| 27 | 27 | public function getIcon(){ |
| 28 | 28 | if(\is_array($this->content)){ |
| 29 | 29 | foreach ($this->content as $item){ |
| 30 | - if($item instanceof HtmlIcon) |
|
| 31 | - return $item; |
|
| 30 | + if($item instanceof HtmlIcon) { |
|
| 31 | + return $item; |
|
| 32 | + } |
|
| 32 | 33 | } |
| 33 | 34 | } |
| 34 | 35 | } |
@@ -96,10 +96,11 @@ |
||
| 96 | 96 | |
| 97 | 97 | protected function setDivider($divider,$index){ |
| 98 | 98 | if(isset($index)){ |
| 99 | - if(\is_array($this->_contentSeparator)===false) |
|
| 100 | - $this->_contentSeparator=array_fill (0, $this->count()-1,$this->_contentSeparator); |
|
| 99 | + if(\is_array($this->_contentSeparator)===false) { |
|
| 100 | + $this->_contentSeparator=array_fill (0, $this->count()-1,$this->_contentSeparator); |
|
| 101 | + } |
|
| 101 | 102 | $this->_contentSeparator[$index]=$divider; |
| 102 | - }else{ |
|
| 103 | + } else{ |
|
| 103 | 104 | $this->_contentSeparator=$divider; |
| 104 | 105 | } |
| 105 | 106 | return $this; |
@@ -13,15 +13,17 @@ discard block |
||
| 13 | 13 | return $array [$key]; |
| 14 | 14 | } |
| 15 | 15 | $values=array_values($array); |
| 16 | - if ($pos<sizeof($values)) |
|
| 17 | - return $values [$pos]; |
|
| 16 | + if ($pos<sizeof($values)) { |
|
| 17 | + return $values [$pos]; |
|
| 18 | + } |
|
| 18 | 19 | } |
| 19 | 20 | |
| 20 | 21 | public static function getDefaultValue($array, $key, $default) { |
| 21 | 22 | if (array_key_exists($key, $array)) { |
| 22 | 23 | return $array [$key]; |
| 23 | - } else |
|
| 24 | - return $default; |
|
| 24 | + } else { |
|
| 25 | + return $default; |
|
| 26 | + } |
|
| 25 | 27 | } |
| 26 | 28 | |
| 27 | 29 | public static function implode($glue,$pieces){ |
@@ -34,7 +36,7 @@ discard block |
||
| 34 | 36 | } |
| 35 | 37 | $result.=$pieces[$size-1]; |
| 36 | 38 | } |
| 37 | - }else{ |
|
| 39 | + } else{ |
|
| 38 | 40 | $result=\implode($glue, $pieces); |
| 39 | 41 | } |
| 40 | 42 | return $result; |
@@ -50,8 +50,9 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | protected function _setDi($di) { |
| 52 | 52 | $this->_di=$di; |
| 53 | - if ($this->js!=null&&$di!=null) |
|
| 54 | - $this->js->setDi($di); |
|
| 53 | + if ($this->js!=null&&$di!=null) { |
|
| 54 | + $this->js->setDi($di); |
|
| 55 | + } |
|
| 55 | 56 | } |
| 56 | 57 | |
| 57 | 58 | /** |
@@ -1130,12 +1131,14 @@ discard block |
||
| 1130 | 1131 | $result[1]=$cdn; |
| 1131 | 1132 | break; |
| 1132 | 1133 | case "Ajax\lib\CDNCoreCss": |
| 1133 | - if($cdn->getFramework()==="Bootstrap") |
|
| 1134 | - $hasBootstrap=true; |
|
| 1135 | - elseif($cdn->getFramework()==="Semantic") |
|
| 1136 | - $hasSemantic=true; |
|
| 1137 | - if($hasSemantic || $hasBootstrap) |
|
| 1138 | - $result[2]=$cdn; |
|
| 1134 | + if($cdn->getFramework()==="Bootstrap") { |
|
| 1135 | + $hasBootstrap=true; |
|
| 1136 | + } elseif($cdn->getFramework()==="Semantic") { |
|
| 1137 | + $hasSemantic=true; |
|
| 1138 | + } |
|
| 1139 | + if($hasSemantic || $hasBootstrap) { |
|
| 1140 | + $result[2]=$cdn; |
|
| 1141 | + } |
|
| 1139 | 1142 | break; |
| 1140 | 1143 | } |
| 1141 | 1144 | } |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | public function setFocusable($value=true){ |
| 56 | - if($value===true) |
|
| 57 | - $this->setProperty("tabindex", "0"); |
|
| 58 | - else{ |
|
| 56 | + if($value===true) { |
|
| 57 | + $this->setProperty("tabindex", "0"); |
|
| 58 | + } else{ |
|
| 59 | 59 | $this->removeProperty("tabindex"); |
| 60 | 60 | } |
| 61 | 61 | return $this; |
@@ -172,8 +172,9 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | public static function getSocial($identifier,$social,$value=NULL){ |
| 175 | - if($value===NULL) |
|
| 176 | - $value=\ucfirst($social); |
|
| 175 | + if($value===NULL) { |
|
| 176 | + $value=\ucfirst($social); |
|
| 177 | + } |
|
| 177 | 178 | $return=new HtmlButton($identifier,$value); |
| 178 | 179 | $return->addIcon($social); |
| 179 | 180 | return $return->addToPropertyCtrl("class", $social, Social::getConstants()); |