@@ -11,58 +11,58 @@ discard block |
||
| 11 | 11 | protected $headers; |
| 12 | 12 | protected $wrappers; |
| 13 | 13 | |
| 14 | - public function __construct($identifier,$instance=NULL, $captions=NULL) { |
|
| 15 | - parent::__construct($identifier,$instance, $captions); |
|
| 14 | + public function __construct($identifier, $instance=NULL, $captions=NULL) { |
|
| 15 | + parent::__construct($identifier, $instance, $captions); |
|
| 16 | 16 | $this->separators=[-1]; |
| 17 | 17 | $this->headers=[]; |
| 18 | 18 | $this->wrappers=[]; |
| 19 | - $this->defaultValueFunction=function($name,$value,$index){ |
|
| 19 | + $this->defaultValueFunction=function($name, $value, $index) { |
|
| 20 | 20 | $caption=$this->getCaption($index); |
| 21 | - $input=new HtmlFormInput($this->widgetIdentifier."-".$name,$caption,"text",$value); |
|
| 21 | + $input=new HtmlFormInput($this->widgetIdentifier."-".$name, $caption, "text", $value); |
|
| 22 | 22 | $input->setName($name); |
| 23 | 23 | return $input; |
| 24 | 24 | }; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - protected function _beforeAddProperty($index,&$field){ |
|
| 28 | - if(JString::endswith($field, "\n")===true){ |
|
| 27 | + protected function _beforeAddProperty($index, &$field) { |
|
| 28 | + if (JString::endswith($field, "\n")===true) { |
|
| 29 | 29 | $this->addSeparatorAfter($index); |
| 30 | 30 | } |
| 31 | - if($index>1 && JString::startswith($field, "\n")===true){ |
|
| 31 | + if ($index>1 && JString::startswith($field, "\n")===true) { |
|
| 32 | 32 | $this->addSeparatorAfter($index-1); |
| 33 | 33 | } |
| 34 | 34 | $field=\str_replace("\n", "", $field); |
| 35 | - if(($header=$this->hasHeader($field))!==false){ |
|
| 35 | + if (($header=$this->hasHeader($field))!==false) { |
|
| 36 | 36 | $this->addHeaderDividerBefore($index, $header); |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - protected function hasHeader(&$field){ |
|
| 41 | - $matches=[];$result=false; |
|
| 42 | - if(\preg_match('/\{(.*?)\}/s', $field, $matches)===1){ |
|
| 40 | + protected function hasHeader(&$field) { |
|
| 41 | + $matches=[]; $result=false; |
|
| 42 | + if (\preg_match('/\{(.*?)\}/s', $field, $matches)===1) { |
|
| 43 | 43 | $result=$matches[1]; |
| 44 | - $field=\str_replace("{".$result."}","", $field); |
|
| 44 | + $field=\str_replace("{".$result."}", "", $field); |
|
| 45 | 45 | } |
| 46 | 46 | return $result; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | |
| 51 | - public function addSeparatorAfter($fieldNum){ |
|
| 52 | - if(\array_search($fieldNum, $this->separators)===false) |
|
| 51 | + public function addSeparatorAfter($fieldNum) { |
|
| 52 | + if (\array_search($fieldNum, $this->separators)===false) |
|
| 53 | 53 | $this->separators[]=$fieldNum; |
| 54 | 54 | return $this; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - public function addHeaderDividerBefore($fieldNum,$header){ |
|
| 57 | + public function addHeaderDividerBefore($fieldNum, $header) { |
|
| 58 | 58 | $this->headers[$fieldNum]=$header; |
| 59 | - if($fieldNum>0) |
|
| 59 | + if ($fieldNum>0) |
|
| 60 | 60 | $this->addSeparatorAfter($fieldNum-1); |
| 61 | 61 | return $this; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - public function addWrapper($fieldNum,$contentBefore,$contentAfter=null){ |
|
| 65 | - $this->wrappers[$fieldNum]=[$contentBefore,$contentAfter]; |
|
| 64 | + public function addWrapper($fieldNum, $contentBefore, $contentAfter=null) { |
|
| 65 | + $this->wrappers[$fieldNum]=[$contentBefore, $contentAfter]; |
|
| 66 | 66 | return $this; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -70,16 +70,16 @@ discard block |
||
| 70 | 70 | return $this->separators; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - public function removeSeparator($index){ |
|
| 74 | - \array_splice($this->separators,$index,1); |
|
| 73 | + public function removeSeparator($index) { |
|
| 74 | + \array_splice($this->separators, $index, 1); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - public function removeField($index){ |
|
| 77 | + public function removeField($index) { |
|
| 78 | 78 | parent::removeField($index); |
| 79 | 79 | $pos=\array_search($index, $this->separators); |
| 80 | - if($pos!==false){ |
|
| 80 | + if ($pos!==false) { |
|
| 81 | 81 | $sepCount=\sizeof($this->separators); |
| 82 | - for($i=$pos+1;$i<$sepCount;$i++){ |
|
| 82 | + for ($i=$pos+1; $i<$sepCount; $i++) { |
|
| 83 | 83 | $this->separators[$i]--; |
| 84 | 84 | } |
| 85 | 85 | \array_splice($this->separators, $pos, 1); |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | return $this->setParam("context", $value); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function setOffset($offset=0){ |
|
| 24 | + public function setOffset($offset=0) { |
|
| 25 | 25 | return $this->setParam("offset", $offset); |
| 26 | 26 | } |
| 27 | 27 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | $this->params["onUnchecked"]="%function(){".$value."}%"; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function setOnChange($value){ |
|
| 23 | + public function setOnChange($value) { |
|
| 24 | 24 | $this->params["onChange"]="%function(){".$value."}%"; |
| 25 | 25 | } |
| 26 | 26 | } |
@@ -8,16 +8,16 @@ |
||
| 8 | 8 | class HtmlFormInput extends HtmlFormField { |
| 9 | 9 | use TextFieldsTrait; |
| 10 | 10 | |
| 11 | - public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) { |
|
| 12 | - if(!isset($placeholder) && $type==="text") |
|
| 11 | + public function __construct($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) { |
|
| 12 | + if (!isset($placeholder) && $type==="text") |
|
| 13 | 13 | $placeholder=$label; |
| 14 | - parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label); |
|
| 14 | + parent::__construct("field-".$identifier, new HtmlInput($identifier, $type, $value, $placeholder), $label); |
|
| 15 | 15 | $this->_identifier=$identifier; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - public function getDataField(){ |
|
| 19 | - $field= $this->getField(); |
|
| 20 | - if($field instanceof HtmlInput) |
|
| 18 | + public function getDataField() { |
|
| 19 | + $field=$this->getField(); |
|
| 20 | + if ($field instanceof HtmlInput) |
|
| 21 | 21 | $field=$field->getDataField(); |
| 22 | 22 | return $field; |
| 23 | 23 | } |
@@ -42,15 +42,15 @@ discard block |
||
| 42 | 42 | * @param boolean $autoActive sets the last element's class to <b>active</b> if true |
| 43 | 43 | * @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
| 44 | 44 | */ |
| 45 | - public function __construct($identifier,$elements=array(),$autoActive=true,$startIndex=0,$hrefFunction=NULL){ |
|
| 46 | - parent::__construct($identifier,"ol"); |
|
| 45 | + public function __construct($identifier, $elements=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { |
|
| 46 | + parent::__construct($identifier, "ol"); |
|
| 47 | 47 | $this->startIndex=$startIndex; |
| 48 | 48 | $this->setProperty("class", "breadcrumb"); |
| 49 | 49 | $this->content=array(); |
| 50 | 50 | $this->autoActive=$autoActive; |
| 51 | 51 | $this->absolutePaths; |
| 52 | - $this->_hrefFunction=function (HtmlDoubleElement $e){return $e->getContent();}; |
|
| 53 | - if(isset($hrefFunction)){ |
|
| 52 | + $this->_hrefFunction=function(HtmlDoubleElement $e) {return $e->getContent(); }; |
|
| 53 | + if (isset($hrefFunction)) { |
|
| 54 | 54 | $this->_hrefFunction=$hrefFunction; |
| 55 | 55 | } |
| 56 | 56 | $this->addElements($elements); |
@@ -61,43 +61,43 @@ discard block |
||
| 61 | 61 | * @param string $href |
| 62 | 62 | * @return \Ajax\bootstrap\html\HtmlLink |
| 63 | 63 | */ |
| 64 | - public function addElement($element,$href="",$glyph=NULL){ |
|
| 64 | + public function addElement($element, $href="", $glyph=NULL) { |
|
| 65 | 65 | $size=sizeof($this->content); |
| 66 | - if(\is_array($element)){ |
|
| 66 | + if (\is_array($element)) { |
|
| 67 | 67 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size); |
| 68 | 68 | $elm->fromArray($element); |
| 69 | - }else if($element instanceof HtmlLink){ |
|
| 69 | + } else if ($element instanceof HtmlLink) { |
|
| 70 | 70 | $elm=$element; |
| 71 | - }else{ |
|
| 72 | - $elm=new HtmlLink("lnk-".$this->identifier."-".$size,$href,$element); |
|
| 73 | - if(isset($glyph)){ |
|
| 71 | + } else { |
|
| 72 | + $elm=new HtmlLink("lnk-".$this->identifier."-".$size, $href, $element); |
|
| 73 | + if (isset($glyph)) { |
|
| 74 | 74 | $elm->wrapContentWithGlyph($glyph); |
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | - $elm->wrap("<li>","</li>"); |
|
| 77 | + $elm->wrap("<li>", "</li>"); |
|
| 78 | 78 | $this->content[]=$elm; |
| 79 | 79 | $elm->setProperty($this->attr, $this->getHref($size)); |
| 80 | 80 | return $elm; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - public function setActive($index=null){ |
|
| 84 | - if(!isset($index)){ |
|
| 83 | + public function setActive($index=null) { |
|
| 84 | + if (!isset($index)) { |
|
| 85 | 85 | $index=sizeof($this->content)-1; |
| 86 | 86 | } |
| 87 | - $li=new HtmlBsDoubleElement("","li"); |
|
| 87 | + $li=new HtmlBsDoubleElement("", "li"); |
|
| 88 | 88 | $li->setClass("active"); |
| 89 | 89 | $li->setContent($this->content[$index]->getContent()); |
| 90 | 90 | $this->content[$index]=$li; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - public function addElements($elements){ |
|
| 94 | - foreach ( $elements as $element ) { |
|
| 93 | + public function addElements($elements) { |
|
| 94 | + foreach ($elements as $element) { |
|
| 95 | 95 | $this->addElement($element); |
| 96 | 96 | } |
| 97 | 97 | return $this; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - public function fromArray($array){ |
|
| 100 | + public function fromArray($array) { |
|
| 101 | 101 | $array=parent::fromArray($array); |
| 102 | 102 | $this->addElements($array); |
| 103 | 103 | return $array; |
@@ -109,14 +109,14 @@ discard block |
||
| 109 | 109 | * @param string $separator |
| 110 | 110 | * @return string |
| 111 | 111 | */ |
| 112 | - public function getHref($index=null,$separator="/"){ |
|
| 113 | - if(!isset($index)){ |
|
| 112 | + public function getHref($index=null, $separator="/") { |
|
| 113 | + if (!isset($index)) { |
|
| 114 | 114 | $index=sizeof($this->content); |
| 115 | 115 | } |
| 116 | - if($this->absolutePaths===true){ |
|
| 116 | + if ($this->absolutePaths===true) { |
|
| 117 | 117 | return $this->_hrefFunction($this->content[$index]); |
| 118 | - }else{ |
|
| 119 | - return $this->root.implode($separator, array_slice(array_map(function($e){return $this->_hrefFunction($e);}, $this->content),$this->startIndex,$index+1)); |
|
| 118 | + } else { |
|
| 119 | + return $this->root.implode($separator, array_slice(array_map(function($e) {return $this->_hrefFunction($e); }, $this->content), $this->startIndex, $index+1)); |
|
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * @see \Ajax\bootstrap\html\BaseHtml::compile() |
| 126 | 126 | */ |
| 127 | 127 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 128 | - if($this->autoActive){ |
|
| 128 | + if ($this->autoActive) { |
|
| 129 | 129 | $this->setActive(); |
| 130 | 130 | } |
| 131 | 131 | return parent::compile($js, $view); |
@@ -143,19 +143,19 @@ discard block |
||
| 143 | 143 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
| 144 | 144 | */ |
| 145 | 145 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 146 | - foreach ($this->content as $element){ |
|
| 147 | - $element->on($event,$jsCode,$stopPropagation,$preventDefault); |
|
| 146 | + foreach ($this->content as $element) { |
|
| 147 | + $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
|
| 148 | 148 | } |
| 149 | 149 | return $this; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | public function setAutoActive($autoActive) { |
| 153 | - $this->autoActive = $autoActive; |
|
| 153 | + $this->autoActive=$autoActive; |
|
| 154 | 154 | return $this; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 158 | - foreach ($this->content as $element){ |
|
| 158 | + foreach ($this->content as $element) { |
|
| 159 | 159 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
| 160 | 160 | } |
| 161 | 161 | return $this; |
@@ -167,18 +167,18 @@ discard block |
||
| 167 | 167 | * @param string $targetSelector the target of the get |
| 168 | 168 | * @return HtmlBreadcrumbs |
| 169 | 169 | */ |
| 170 | - public function autoGetOnClick($targetSelector){ |
|
| 171 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
| 170 | + public function autoGetOnClick($targetSelector) { |
|
| 171 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - public function contentAsString(){ |
|
| 175 | - if($this->autoActive){ |
|
| 174 | + public function contentAsString() { |
|
| 175 | + if ($this->autoActive) { |
|
| 176 | 176 | $this->setActive(); |
| 177 | 177 | } |
| 178 | 178 | return parent::contentAsString(); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - public function getElement($index){ |
|
| 181 | + public function getElement($index) { |
|
| 182 | 182 | return $this->content[$index]; |
| 183 | 183 | } |
| 184 | 184 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * @param mixed $glyph |
| 188 | 188 | * @param int $index |
| 189 | 189 | */ |
| 190 | - public function addGlyph($glyph,$index=0){ |
|
| 190 | + public function addGlyph($glyph, $index=0) { |
|
| 191 | 191 | $elm=$this->getElement($index); |
| 192 | 192 | return $elm->wrapContentWithGlyph($glyph); |
| 193 | 193 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * @param Dispatcher $dispatcher the request dispatcher |
| 199 | 199 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
| 200 | 200 | */ |
| 201 | - public function fromDispatcher(JsUtils $js,$dispatcher,$startIndex=0){ |
|
| 201 | + public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) { |
|
| 202 | 202 | $this->startIndex=$startIndex; |
| 203 | 203 | return $this->addElements($js->fromDispatcher($dispatcher)); |
| 204 | 204 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
| 211 | 211 | */ |
| 212 | 212 | public function setHrefFunction($_hrefFunction) { |
| 213 | - $this->_hrefFunction = $_hrefFunction; |
|
| 213 | + $this->_hrefFunction=$_hrefFunction; |
|
| 214 | 214 | return $this; |
| 215 | 215 | } |
| 216 | 216 | |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | * @return $this |
| 51 | 51 | */ |
| 52 | 52 | public function setSource($source) { |
| 53 | - $source=str_ireplace(array ( |
|
| 53 | + $source=str_ireplace(array( |
|
| 54 | 54 | "\"", |
| 55 | 55 | "'" |
| 56 | 56 | ), "%quote%", $source); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $this->startIndex=$startIndex; |
| 53 | 53 | $this->autoActive=$autoActive; |
| 54 | 54 | $this->_contentSeparator="<div class='divider'> / </div>"; |
| 55 | - $this->_hrefFunction=function (HtmlSemDoubleElement $e) { |
|
| 55 | + $this->_hrefFunction=function(HtmlSemDoubleElement $e) { |
|
| 56 | 56 | return $e->getContent(); |
| 57 | 57 | }; |
| 58 | 58 | if (isset($hrefFunction)) { |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @return HtmlBreadcrumbs |
| 69 | 69 | */ |
| 70 | 70 | public function autoGetOnClick($targetSelector) { |
| 71 | - return $this->getOnClick($this->root, $targetSelector, array ("attr" => $this->attr )); |
|
| 71 | + return $this->getOnClick($this->root, $targetSelector, array("attr" => $this->attr)); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public function contentAsString() { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function setActive($index=null) { |
| 85 | 85 | if (!isset($index)) { |
| 86 | - $index=sizeof($this->content) - 1; |
|
| 86 | + $index=sizeof($this->content)-1; |
|
| 87 | 87 | } |
| 88 | 88 | $activeItem=$this->content[$index]; |
| 89 | 89 | $activeItem->addToProperty("class", "active"); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @param Dispatcher $dispatcher the request dispatcher |
| 97 | 97 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
| 98 | 98 | */ |
| 99 | - public function fromDispatcher(JsUtils $js,$dispatcher, $startIndex=0) { |
|
| 99 | + public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) { |
|
| 100 | 100 | return $this->addItems($js->fromDispatcher($dispatcher)); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -110,12 +110,12 @@ discard block |
||
| 110 | 110 | if (!isset($index)) { |
| 111 | 111 | $index=sizeof($this->content); |
| 112 | 112 | } |
| 113 | - if ($this->absolutePaths === true) { |
|
| 113 | + if ($this->absolutePaths===true) { |
|
| 114 | 114 | return $this->_hrefFunction($this->content[$index]); |
| 115 | 115 | } else { |
| 116 | - return $this->root . implode($separator, array_slice(array_map(function ($e) { |
|
| 116 | + return $this->root.implode($separator, array_slice(array_map(function($e) { |
|
| 117 | 117 | return $this->_hrefFunction($e); |
| 118 | - }, $this->content), $this->startIndex, $index + 1)); |
|
| 118 | + }, $this->content), $this->startIndex, $index+1)); |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
@@ -149,8 +149,8 @@ discard block |
||
| 149 | 149 | $this->setActive(); |
| 150 | 150 | } |
| 151 | 151 | $count=$this->count(); |
| 152 | - for($i=1; $i < $count; $i++) { |
|
| 153 | - $this->content[$i]->wrap($this->getContentDivider($i - 1)); |
|
| 152 | + for ($i=1; $i<$count; $i++) { |
|
| 153 | + $this->content[$i]->wrap($this->getContentDivider($i-1)); |
|
| 154 | 154 | } |
| 155 | 155 | return parent::compile($js, $view); |
| 156 | 156 | } |
@@ -160,15 +160,15 @@ discard block |
||
| 160 | 160 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
| 161 | 161 | */ |
| 162 | 162 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 163 | - foreach ( $this->content as $element ) { |
|
| 163 | + foreach ($this->content as $element) { |
|
| 164 | 164 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
| 165 | 165 | } |
| 166 | 166 | return $this; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 170 | - foreach ( $this->content as $element ) { |
|
| 171 | - if ($element->getProperty($this->attr) != NULL){ |
|
| 170 | + foreach ($this->content as $element) { |
|
| 171 | + if ($element->getProperty($this->attr)!=NULL) { |
|
| 172 | 172 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
| 173 | 173 | } |
| 174 | 174 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | protected function createItem($value) { |
| 185 | 185 | $count=$this->count(); |
| 186 | - $itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section"); |
|
| 186 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "a", "section"); |
|
| 187 | 187 | if (\is_array($value)) |
| 188 | 188 | $itemO->fromArray($value); |
| 189 | 189 | else { |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | public function addIconAt($icon, $index) { |
| 196 | 196 | $item=$this->getItem($index); |
| 197 | 197 | if (isset($item)) { |
| 198 | - $icon=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
| 198 | + $icon=new HtmlIcon("icon-".$this->identifier, $icon); |
|
| 199 | 199 | $item->wrapContent($icon); |
| 200 | 200 | } |
| 201 | 201 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | public function addItem($item) { |
| 204 | 204 | $count=$this->count(); |
| 205 | 205 | $itemO=parent::addItem($item); |
| 206 | - $this->addToPropertyCtrl("class", "section", array ("section" )); |
|
| 206 | + $this->addToPropertyCtrl("class", "section", array("section")); |
|
| 207 | 207 | $itemO->setProperty($this->attr, $this->getHref($count)); |
| 208 | 208 | return $itemO; |
| 209 | 209 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | public function setAbsolutePaths($absolutePaths) { |
| 220 | 220 | $this->absolutePaths=$absolutePaths; |
| 221 | 221 | $size=\sizeof($this->content); |
| 222 | - for($i=0;$i<$size;$i++){ |
|
| 222 | + for ($i=0; $i<$size; $i++) { |
|
| 223 | 223 | $this->content[$i]->setProperty($this->attr, $this->getHref($i)); |
| 224 | 224 | } |
| 225 | 225 | return $this; |
@@ -15,8 +15,8 @@ discard block |
||
| 15 | 15 | * @property HtmlSemDoubleElement $_self |
| 16 | 16 | */ |
| 17 | 17 | trait BaseTrait { |
| 18 | - protected $_variations=[ ]; |
|
| 19 | - protected $_states=[ ]; |
|
| 18 | + protected $_variations=[]; |
|
| 19 | + protected $_states=[]; |
|
| 20 | 20 | protected $_baseClass; |
| 21 | 21 | |
| 22 | 22 | abstract protected function setPropertyCtrl($name, $value, $typeCtrl); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | abstract public function setProperty($name, $value); |
| 31 | 31 | |
| 32 | - abstract public function addContent($content,$before=false); |
|
| 32 | + abstract public function addContent($content, $before=false); |
|
| 33 | 33 | |
| 34 | 34 | abstract public function onCreate($jsCode); |
| 35 | 35 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $this->_self->setProperty("class", $this->_self->getBaseClass()); |
| 51 | 51 | if (\is_string($variations)) |
| 52 | 52 | $variations=\explode(" ", $variations); |
| 53 | - foreach ( $variations as $variation ) { |
|
| 53 | + foreach ($variations as $variation) { |
|
| 54 | 54 | $this->_self->addVariation($variation); |
| 55 | 55 | } |
| 56 | 56 | return $this; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | public function addVariations($variations=array()) { |
| 65 | 65 | if (\is_string($variations)) |
| 66 | 66 | $variations=\explode(" ", $variations); |
| 67 | - foreach ( $variations as $variation ) { |
|
| 67 | + foreach ($variations as $variation) { |
|
| 68 | 68 | $this->_self->addVariation($variation); |
| 69 | 69 | } |
| 70 | 70 | return $this; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | public function addStates($states=array()) { |
| 74 | 74 | if (\is_string($states)) |
| 75 | 75 | $states=\explode(" ", $states); |
| 76 | - foreach ( $states as $state ) { |
|
| 76 | + foreach ($states as $state) { |
|
| 77 | 77 | $this->_self->addState($state); |
| 78 | 78 | } |
| 79 | 79 | return $this; |
@@ -83,17 +83,17 @@ discard block |
||
| 83 | 83 | $this->_self->setProperty("class", $this->_self->getBaseClass()); |
| 84 | 84 | if (\is_string($states)) |
| 85 | 85 | $states=\explode(" ", $states); |
| 86 | - foreach ( $states as $state ) { |
|
| 86 | + foreach ($states as $state) { |
|
| 87 | 87 | $this->_self->addState($state); |
| 88 | 88 | } |
| 89 | 89 | return $this; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | public function addIcon($icon, $before=true) { |
| 93 | - return $this->_self->addContent(new HtmlIcon("icon-" . $this->_self->getIdentifier(), $icon), $before); |
|
| 93 | + return $this->_self->addContent(new HtmlIcon("icon-".$this->_self->getIdentifier(), $icon), $before); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - public function addSticky($context="body"){ |
|
| 96 | + public function addSticky($context="body") { |
|
| 97 | 97 | $this->_self->onCreate("$('#".$this->_self->getIdentifier()."').sticky({ context: '".$context."'});"); |
| 98 | 98 | return $this; |
| 99 | 99 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * @return HtmlSemDoubleElement |
| 115 | 115 | */ |
| 116 | 116 | public function setDisabled($disable=true) { |
| 117 | - if($disable) |
|
| 117 | + if ($disable) |
|
| 118 | 118 | $this->_self->addToProperty("class", "disabled"); |
| 119 | 119 | return $this; |
| 120 | 120 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * |
| 141 | 141 | * @return HtmlSemDoubleElement |
| 142 | 142 | */ |
| 143 | - public function asHeader(){ |
|
| 143 | + public function asHeader() { |
|
| 144 | 144 | return $this->_self->addToProperty("class", "header"); |
| 145 | 145 | } |
| 146 | 146 | |
@@ -148,15 +148,15 @@ discard block |
||
| 148 | 148 | * show it is currently the active user selection |
| 149 | 149 | * @return HtmlSemDoubleElement |
| 150 | 150 | */ |
| 151 | - public function setActive($value=true){ |
|
| 152 | - if($value) |
|
| 151 | + public function setActive($value=true) { |
|
| 152 | + if ($value) |
|
| 153 | 153 | $this->_self->addToProperty("class", "active"); |
| 154 | 154 | return $this; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - public function setAttached($value=true){ |
|
| 158 | - if($value) |
|
| 159 | - $this->_self->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
| 157 | + public function setAttached($value=true) { |
|
| 158 | + if ($value) |
|
| 159 | + $this->_self->addToPropertyCtrl("class", "attached", array("attached")); |
|
| 160 | 160 | return $this; |
| 161 | 161 | } |
| 162 | 162 | |
@@ -164,13 +164,13 @@ discard block |
||
| 164 | 164 | * can be formatted to appear on dark backgrounds |
| 165 | 165 | */ |
| 166 | 166 | public function setInverted($recursive=true) { |
| 167 | - if($recursive===true){ |
|
| 167 | + if ($recursive===true) { |
|
| 168 | 168 | $content=$this->_self->getContent(); |
| 169 | - if($content instanceof HtmlSemDoubleElement) |
|
| 169 | + if ($content instanceof HtmlSemDoubleElement) |
|
| 170 | 170 | $content->setInverted($recursive); |
| 171 | - elseif(\is_array($content) || $content instanceof \Traversable){ |
|
| 172 | - foreach ($content as $elm){ |
|
| 173 | - if($elm instanceof HtmlSemDoubleElement){ |
|
| 171 | + elseif (\is_array($content) || $content instanceof \Traversable) { |
|
| 172 | + foreach ($content as $elm) { |
|
| 173 | + if ($elm instanceof HtmlSemDoubleElement) { |
|
| 174 | 174 | $elm->setInverted($recursive); |
| 175 | 175 | } |
| 176 | 176 | } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | public function setFloated($direction="right") { |
| 187 | - return $this->_self->addToPropertyCtrl("class", $direction . " floated", Direction::getConstantValues("floated")); |
|
| 187 | + return $this->_self->addToPropertyCtrl("class", $direction." floated", Direction::getConstantValues("floated")); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | public function floatRight() { |
@@ -199,14 +199,14 @@ discard block |
||
| 199 | 199 | return $this->_baseClass; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - protected function addBehavior(&$array,$key,$value,$before="",$after=""){ |
|
| 203 | - if(\is_string($value)){ |
|
| 204 | - if(isset($array[$key])){ |
|
| 202 | + protected function addBehavior(&$array, $key, $value, $before="", $after="") { |
|
| 203 | + if (\is_string($value)) { |
|
| 204 | + if (isset($array[$key])) { |
|
| 205 | 205 | $p=JString::replaceAtFirstAndLast($array[$key], $before, "", $after, ""); |
| 206 | 206 | $array[$key]=$before.$p.$value.$after; |
| 207 | - }else |
|
| 207 | + } else |
|
| 208 | 208 | $array[$key]=$before.$value.$after; |
| 209 | - }else{ |
|
| 209 | + } else { |
|
| 210 | 210 | $array[$key]=$value; |
| 211 | 211 | } |
| 212 | 212 | return $this; |
@@ -9,12 +9,12 @@ discard block |
||
| 9 | 9 | * @author jc |
| 10 | 10 | * @property BaseWidget $_self |
| 11 | 11 | */ |
| 12 | -trait BaseHtmlPropertiesTrait{ |
|
| 12 | +trait BaseHtmlPropertiesTrait { |
|
| 13 | 13 | |
| 14 | - protected $properties=array (); |
|
| 14 | + protected $properties=array(); |
|
| 15 | 15 | abstract protected function ctrl($name, $value, $typeCtrl); |
| 16 | 16 | abstract protected function removeOldValues(&$oldValue, $allValues); |
| 17 | - abstract protected function _getElementBy($callback,$elements); |
|
| 17 | + abstract protected function _getElementBy($callback, $elements); |
|
| 18 | 18 | public function getProperties() { |
| 19 | 19 | return $this->_self->properties; |
| 20 | 20 | } |
@@ -40,13 +40,13 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | public function addToProperty($name, $value, $separator=" ") { |
| 42 | 42 | if (\is_array($value)) { |
| 43 | - foreach ( $value as $v ) { |
|
| 43 | + foreach ($value as $v) { |
|
| 44 | 44 | $this->_self->addToProperty($name, $v, $separator); |
| 45 | 45 | } |
| 46 | - } else if ($value !== "" && $this->_self->propertyContains($name, $value) === false) { |
|
| 46 | + } else if ($value!=="" && $this->_self->propertyContains($name, $value)===false) { |
|
| 47 | 47 | $v=@$this->_self->properties[$name]; |
| 48 | - if (isset($v) && $v !== "") |
|
| 49 | - $v=$v . $separator . $value; |
|
| 48 | + if (isset($v) && $v!=="") |
|
| 49 | + $v=$v.$separator.$value; |
|
| 50 | 50 | else |
| 51 | 51 | $v=$value; |
| 52 | 52 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | public function addToPropertyCtrlCheck($name, $value, $typeCtrl) { |
| 87 | - if ($this->_self->ctrl($name, $value, $typeCtrl) === true) { |
|
| 87 | + if ($this->_self->ctrl($name, $value, $typeCtrl)===true) { |
|
| 88 | 88 | return $this->_self->addToProperty($name, $value); |
| 89 | 89 | } |
| 90 | 90 | return $this; |
@@ -105,12 +105,12 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
| 108 | - if ($this->_self->ctrl($name, $value, $typeCtrl) === true) |
|
| 108 | + if ($this->_self->ctrl($name, $value, $typeCtrl)===true) |
|
| 109 | 109 | return $this->_self->setProperty($name, $value); |
| 110 | 110 | return $this; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - protected function getElementByPropertyValue($propertyName,$value, $elements) { |
|
| 114 | - return $this->_self->_getElementBy(function(BaseHtml $element) use ($propertyName,$value){return $element->propertyContains($propertyName, $value) === true;}, $elements); |
|
| 113 | + protected function getElementByPropertyValue($propertyName, $value, $elements) { |
|
| 114 | + return $this->_self->_getElementBy(function(BaseHtml $element) use ($propertyName, $value){return $element->propertyContains($propertyName, $value)===true; }, $elements); |
|
| 115 | 115 | } |
| 116 | 116 | } |