Completed
Push — master ( 172c54...50fc65 )
by Jean-Christophe
04:31 queued 01:31
created
Ajax/semantic/html/base/traits/BaseTrait.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@  discard block
 block discarded – undo
8 8
 use Ajax\semantic\html\elements\HtmlIcon;
9 9
 
10 10
 trait BaseTrait {
11
-	protected $_variations=[ ];
12
-	protected $_states=[ ];
11
+	protected $_variations=[];
12
+	protected $_states=[];
13 13
 	protected $_baseClass;
14 14
 
15 15
 	protected abstract function setPropertyCtrl($name, $value, $typeCtrl);
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		$this->setProperty("class", $this->_baseClass);
38 38
 		if (\is_string($variations))
39 39
 			$variations=\explode(" ", $variations);
40
-		foreach ( $variations as $variation ) {
40
+		foreach ($variations as $variation) {
41 41
 			$this->addVariation($variation);
42 42
 		}
43 43
 		return $this;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	public function addVariations($variations=array()) {
52 52
 		if (\is_string($variations))
53 53
 			$variations=\explode(" ", $variations);
54
-		foreach ( $variations as $variation ) {
54
+		foreach ($variations as $variation) {
55 55
 			$this->addVariation($variation);
56 56
 		}
57 57
 		return $this;
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	public function addStates($states=array()) {
61 61
 		if (\is_string($states))
62 62
 			$states=\explode(" ", $states);
63
-		foreach ( $states as $state ) {
63
+		foreach ($states as $state) {
64 64
 			$this->addState($state);
65 65
 		}
66 66
 		return $this;
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
 		$this->setProperty("class", $this->_baseClass);
71 71
 		if (\is_string($states))
72 72
 			$states=\explode(" ", $states);
73
-		foreach ( $states as $state ) {
73
+		foreach ($states as $state) {
74 74
 			$this->addState($state);
75 75
 		}
76 76
 		return $this;
77 77
 	}
78 78
 
79 79
 	public function addIcon($icon, $before=true) {
80
-		return $this->addContent(new HtmlIcon("icon-" . $this->identifier, $icon), $before);
80
+		return $this->addContent(new HtmlIcon("icon-".$this->identifier, $icon), $before);
81 81
 	}
82 82
 
83 83
 	/**
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @return \Ajax\semantic\html\base\HtmlSemDoubleElement
121 121
 	 */
122
-	public function asHeader(){
122
+	public function asHeader() {
123 123
 		return $this->addToProperty("class", "header");
124 124
 	}
125 125
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 * show it is currently the active user selection
128 128
 	 * @return \Ajax\semantic\html\base\HtmlSemDoubleElement
129 129
 	 */
130
-	public function setActive($value=true){
130
+	public function setActive($value=true) {
131 131
 		return $this->addToProperty("class", "active");
132 132
 	}
133 133
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	}
144 144
 
145 145
 	public function setFloated($direction="right") {
146
-		return $this->addToPropertyCtrl("class", $direction . " floated", Direction::getConstantValues("floated"));
146
+		return $this->addToPropertyCtrl("class", $direction." floated", Direction::getConstantValues("floated"));
147 147
 	}
148 148
 
149 149
 	public function floatRight() {
Please login to merge, or discard this patch.
Ajax/bootstrap/html/HtmlForm.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
 	public function __construct($identifier) {
16 16
 		parent::__construct($identifier, "form");
17 17
 		$this->_template='<form id="%identifier%" name="%identifier%" %properties%>%content%</form>';
18
-		$this->futureElements=array ();
19
-		$this->formGroups=array ();
18
+		$this->futureElements=array();
19
+		$this->formGroups=array();
20 20
 	}
21 21
 
22 22
 	/*
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
27 27
 		if (isset($js)) {
28 28
 			$this->formElementsPrefix=$js->config()->getVar("formElementsPrefix");
29
-			foreach ( $this->futureElements as $futureElement ) {
29
+			foreach ($this->futureElements as $futureElement) {
30 30
 				$futureElementValue=$this->getPrefix($futureElement);
31 31
 				$futureElementValues=explode("_", $futureElementValue);
32
-				switch($futureElementValues [0]) {
32
+				switch ($futureElementValues [0]) {
33 33
 					case "input":
34 34
 						$control=new HtmlInput($futureElement);
35 35
 						$control->setClass("form-control");
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 						$control->setLabel($label, false);
48 48
 						break;
49 49
 					case "select":
50
-						$control=new HtmlSelect($futureElement,"");
50
+						$control=new HtmlSelect($futureElement, "");
51 51
 						$control->setProperty("size", $futureElementValues [1]);
52 52
 						$control->setClass("form-control");
53 53
 						//$control->setLabel($this->getPart($futureElement));
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 				$this->addElement($control);
63 63
 			}
64 64
 		}
65
-		foreach ( $this->formGroups as $group ) {
65
+		foreach ($this->formGroups as $group) {
66 66
 			$this->addContent($group);
67 67
 		}
68 68
 		return parent::compile($js, $view);
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
 	private function getPrefix($element) {
92 92
 		$result="input_text";
93
-		foreach ( $this->formElementsPrefix as $k => $v ) {
93
+		foreach ($this->formElementsPrefix as $k => $v) {
94 94
 			if (Text::startsWith($element, $k)) {
95 95
 				$result=$v;
96 96
 				break;
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
 	public function getElement($name) {
122 122
 		$element=null;
123
-		foreach ( $this->formGroups as $group ) {
123
+		foreach ($this->formGroups as $group) {
124 124
 		}
125 125
 		return $element;
126 126
 	}
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 * @see \Ajax\bootstrap\html\base\HtmlSingleElement::fromArray()
131 131
 	 */
132 132
 	public function fromArray($array) {
133
-		foreach ( $array as $value ) {
133
+		foreach ($array as $value) {
134 134
 			if (is_string($value)) {
135 135
 				$this->futureElements []=$value;
136 136
 			}
Please login to merge, or discard this patch.
Ajax/common/html/html5/HtmlSelect.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	private $default;
14 14
 	private $options;
15 15
 
16
-	public function __construct($identifier, $caption="",$default=NULL) {
16
+	public function __construct($identifier, $caption="", $default=NULL) {
17 17
 		parent::__construct($identifier, "select");
18 18
 		$this->setProperty("name", $identifier);
19 19
 		$this->setProperty("class", "form-control");
@@ -22,21 +22,21 @@  discard block
 block discarded – undo
22 22
 		$this->options=array();
23 23
 	}
24 24
 
25
-	public function addOption($element,$value="",$selected=false){
26
-		if($element instanceof HtmlOption){
25
+	public function addOption($element, $value="", $selected=false) {
26
+		if ($element instanceof HtmlOption) {
27 27
 			$option=$element;
28
-		}else{
29
-			$option=new HtmlOption($this->identifier."-".count($this->options), $element,$value);
28
+		} else {
29
+			$option=new HtmlOption($this->identifier."-".count($this->options), $element, $value);
30 30
 		}
31
-		if($selected || $option->getValue()==$this->getProperty("value")){
31
+		if ($selected || $option->getValue()==$this->getProperty("value")) {
32 32
 			$option->select();
33 33
 		}
34 34
 		$this->options[]=$option;
35 35
 	}
36 36
 
37 37
 	public function setValue($value) {
38
-		foreach ( $this->options as $option ) {
39
-			if (strcasecmp($option->getValue(),$value)===0) {
38
+		foreach ($this->options as $option) {
39
+			if (strcasecmp($option->getValue(), $value)===0) {
40 40
 				$option->setProperty("selected", "");
41 41
 			}
42 42
 		}
@@ -49,23 +49,23 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
51 51
 		$this->content=array();
52
-		if(isset($this->default)){
52
+		if (isset($this->default)) {
53 53
 			$default=new HtmlOption("", $this->default);
54 54
 			$this->content[]=$default;
55 55
 		}
56
-		foreach ($this->options as $option){
56
+		foreach ($this->options as $option) {
57 57
 			$this->content[]=$option;
58 58
 		}
59 59
 		return parent::compile($js, $view);
60 60
 	}
61 61
 
62
-	public function fromArray($array){
63
-		if(JArray::isAssociative($array)){
64
-			foreach ($array as $k=>$v){
62
+	public function fromArray($array) {
63
+		if (JArray::isAssociative($array)) {
64
+			foreach ($array as $k=>$v) {
65 65
 				$this->addOption($v, $k);
66 66
 			}
67
-		}else{
68
-			foreach ($array as $v){
67
+		} else {
68
+			foreach ($array as $v) {
69 69
 				$this->addOption($v, $v);
70 70
 			}
71 71
 		}
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 		$this->addOption($function($object));
99 99
 	}
100 100
 
101
-	public function setSize($size){
101
+	public function setSize($size) {
102 102
 		return $this->setProperty("size", $size);
103 103
 	}
104 104
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/content/HtmlGridCol.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	public function setWidth($width) {
33 33
 		if (\is_int($width)) {
34
-			$width=Wide::getConstants()["W" . $width];
34
+			$width=Wide::getConstants()["W".$width];
35 35
 		}
36 36
 		$this->addToPropertyCtrl("class", $width, Wide::getConstants());
37
-		return $this->addToPropertyCtrl("class", "wide", array ("wide" ));
37
+		return $this->addToPropertyCtrl("class", "wide", array("wide"));
38 38
 	}
39 39
 
40 40
 	public function setValue($value) {
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 			$divider->setVertical();
53 53
 		else
54 54
 			$divider->setHorizontal();
55
-		$this->wrap($divider,"");
55
+		$this->wrap($divider, "");
56 56
 		return $divider;
57 57
 	}
58 58
 }
59 59
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/components/Popup.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
 	 * @return $this
28 28
 	 */
29 29
 	public function setOnShow($jsCode) {
30
-		$jsCode=str_ireplace("\"","%quote%", $jsCode);
30
+		$jsCode=str_ireplace("\"", "%quote%", $jsCode);
31 31
 		return $this->setParam("onShow", "%function(){".$jsCode."}%");
32 32
 	}
33 33
 
34
-	public function setExclusive($value){
34
+	public function setExclusive($value) {
35 35
 		return $this->setParam("exclusive", $value);
36 36
 	}
37 37
 
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
 	 * @param string $popup the css selector of the popup
41 41
 	 * @return \Ajax\semantic\components\Popup
42 42
 	 */
43
-	public function setPopup($popup){
43
+	public function setPopup($popup) {
44 44
 		return $this->setParam("popup", $popup);
45 45
 	}
46 46
 
47
-	public function setInline($value){
47
+	public function setInline($value) {
48 48
 		return $this->setParam("inline", $value);
49 49
 	}
50 50
 
51
-	public function setPosition($value){
51
+	public function setPosition($value) {
52 52
 		return $this->setParam("position", $value);
53 53
 	}
54 54
 	//TODO other events implementation
Please login to merge, or discard this patch.
Ajax/semantic/html/base/traits/MenuItemTrait.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -8,16 +8,16 @@  discard block
 block discarded – undo
8 8
 
9 9
 trait MenuItemTrait {
10 10
 
11
-	public function setContent($content){
12
-		if($content==="-"){
11
+	public function setContent($content) {
12
+		if ($content==="-") {
13 13
 			$this->asDivider();
14
-		}elseif($content==="-search-"){
15
-			$values=\explode(",",$content,-1);
16
-			$this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search"));
17
-		}elseif(JString::startswith($content, "-")){
18
-			$content=\ltrim($content,"-");
14
+		}elseif ($content==="-search-") {
15
+			$values=\explode(",", $content, -1);
16
+			$this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."), JArray::getDefaultValue($values, 1, "search"));
17
+		}elseif (JString::startswith($content, "-")) {
18
+			$content=\ltrim($content, "-");
19 19
 			$this->asHeader($content);
20
-		}else
20
+		} else
21 21
 			parent::setContent($content);
22 22
 		return $this;
23 23
 	}
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
 	 * @param string $icon
28 28
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem
29 29
 	 */
30
-	public function asSearchInput($placeholder=NULL,$icon=NULL){
30
+	public function asSearchInput($placeholder=NULL, $icon=NULL) {
31 31
 		$this->setClass("ui icon search input");
32 32
 		$input=new HtmlInput("search-".$this->identifier);
33
-		if(isset($placeholder))
33
+		if (isset($placeholder))
34 34
 			$input->setProperty("placeholder", $placeholder);
35 35
 			$this->content=$input;
36
-			if(isset($icon))
36
+			if (isset($icon))
37 37
 				$this->addIcon($icon);
38 38
 				return $this;
39 39
 	}
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	/**
42 42
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem
43 43
 	 */
44
-	public function asDivider(){
44
+	public function asDivider() {
45 45
 		$this->content=NULL;
46 46
 		$this->tagName="div";
47 47
 		$this->setClass("divider");
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
 	 * @param string $icon
54 54
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem
55 55
 	 */
56
-	public function asHeader($caption=NULL,$icon=NULL){
56
+	public function asHeader($caption=NULL, $icon=NULL) {
57 57
 		$this->setClass("header");
58 58
 		$this->tagName="div";
59 59
 		$this->content=$caption;
60
-		if(isset($icon))
61
-			$this->addIcon($icon,Direction::LEFT);
60
+		if (isset($icon))
61
+			$this->addIcon($icon, Direction::LEFT);
62 62
 			return $this;
63 63
 	}
64 64
 }
65 65
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/base/traits/IconTrait.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,18 +15,18 @@  discard block
 block discarded – undo
15 15
 	private $_hasIcon=false;
16 16
 
17 17
 	protected abstract function addToPropertyCtrl($name, $value, $typeCtrl);
18
-	public abstract function addContent($content,$before=false);
18
+	public abstract function addContent($content, $before=false);
19 19
 
20
-	public function addIcon($icon,$direction=Direction::LEFT){
21
-		if($this->_hasIcon===false){
20
+	public function addIcon($icon, $direction=Direction::LEFT) {
21
+		if ($this->_hasIcon===false) {
22 22
 			$iconO=$icon;
23
-			if(\is_string($icon)){
23
+			if (\is_string($icon)) {
24 24
 				$iconO=new HtmlIcon("icon-".$this->identifier, $icon);
25 25
 			}
26 26
 			$this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon"));
27
-			$this->addContent($iconO,$direction===Direction::LEFT);
27
+			$this->addContent($iconO, $direction===Direction::LEFT);
28 28
 			$this->_hasIcon=true;
29
-		}else{
29
+		} else {
30 30
 			$iconO=$this->getIcon();
31 31
 			$iconO->setIcon($icon);
32 32
 			$this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon"));
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
 		return $iconO;
35 35
 	}
36 36
 
37
-	public function getIcon(){
38
-		if(\is_array($this->content)){
39
-			foreach ($this->content as $item){
40
-				if($item instanceof HtmlIcon)
37
+	public function getIcon() {
38
+		if (\is_array($this->content)) {
39
+			foreach ($this->content as $item) {
40
+				if ($item instanceof HtmlIcon)
41 41
 					return $item;
42 42
 			}
43 43
 		}
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlDropdown.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
 	}
18 18
 	protected $mClass="menu";
19 19
 	protected $mTagName="div";
20
-	protected $items=array ();
21
-	protected $_params=array("action"=>"nothing","on"=>"hover");
20
+	protected $items=array();
21
+	protected $_params=array("action"=>"nothing", "on"=>"hover");
22 22
 	protected $input;
23 23
 	protected $value;
24 24
 
@@ -26,23 +26,23 @@  discard block
 block discarded – undo
26 26
 		parent::__construct($identifier, "div");
27 27
 		$this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php';
28 28
 		$this->setProperty("class", "ui dropdown");
29
-		$content=new HtmlSemDoubleElement("text-".$this->identifier,"div");
29
+		$content=new HtmlSemDoubleElement("text-".$this->identifier, "div");
30 30
 		$content->setClass("text");
31 31
 		$this->setValue($value);
32
-		$content->wrap("",new HtmlIcon("", "dropdown"));
32
+		$content->wrap("", new HtmlIcon("", "dropdown"));
33 33
 		$this->content=array($content);
34 34
 		$this->tagName="div";
35 35
 		$this->addItems($items);
36 36
 	}
37 37
 
38
-	public function addItem($item,$value=NULL,$image=NULL,$description=NULL){
39
-		$itemO=$this->beforeAddItem($item,$value,$image,$description);
38
+	public function addItem($item, $value=NULL, $image=NULL, $description=NULL) {
39
+		$itemO=$this->beforeAddItem($item, $value, $image, $description);
40 40
 		$this->items[]=$itemO;
41 41
 		return $itemO;
42 42
 	}
43 43
 
44
-	public function addIcon($icon,$before=true,$labeled=false){
45
-		$this->addIconP($icon,$before,$labeled);
44
+	public function addIcon($icon, $before=true, $labeled=false) {
45
+		$this->addIconP($icon, $before, $labeled);
46 46
 		return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter("");
47 47
 	}
48 48
 
@@ -52,26 +52,26 @@  discard block
 block discarded – undo
52 52
 	 * @param number $position
53 53
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown
54 54
 	 */
55
-	public function insertItem($item,$position=0){
55
+	public function insertItem($item, $position=0) {
56 56
 		$itemO=$this->beforeAddItem($item);
57
-		 $start = array_slice($this->items, 0, $position);
58
-		 $end = array_slice($this->items, $position);
59
-		 $start[] = $item;
57
+		 $start=array_slice($this->items, 0, $position);
58
+		 $end=array_slice($this->items, $position);
59
+		 $start[]=$item;
60 60
 		 $this->items=array_merge($start, $end);
61 61
 		 return $itemO;
62 62
 	}
63 63
 
64
-	protected function beforeAddItem($item,$value=NULL,$image=NULL,$description=NULL){
64
+	protected function beforeAddItem($item, $value=NULL, $image=NULL, $description=NULL) {
65 65
 		$itemO=$item;
66
-		if(\is_array($item)){
66
+		if (\is_array($item)) {
67 67
 			$description=JArray::getValue($item, "description", 3);
68 68
 			$value=JArray::getValue($item, "value", 1);
69 69
 			$image=JArray::getValue($item, "image", 2);
70 70
 			$item=JArray::getValue($item, "item", 0);
71 71
 		}
72
-		if(!$item instanceof HtmlDropdownItem){
73
-			$itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description);
74
-		}elseif($itemO instanceof HtmlDropdownItem){
72
+		if (!$item instanceof HtmlDropdownItem) {
73
+			$itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image, $description);
74
+		}elseif ($itemO instanceof HtmlDropdownItem) {
75 75
 			$this->addToProperty("class", "vertical");
76 76
 		}
77 77
 		return $itemO;
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
 		$this->addItem($function($object));
85 85
 	}
86 86
 
87
-	public function addInput($name){
88
-		if(!isset($name))
87
+	public function addInput($name) {
88
+		if (!isset($name))
89 89
 			$name="input-".$this->identifier;
90 90
 		$this->setAction("activate");
91
-		$this->input=new HtmlInput($name,"hidden");
91
+		$this->input=new HtmlInput($name, "hidden");
92 92
 	}
93 93
 
94 94
 	/**
@@ -97,15 +97,15 @@  discard block
 block discarded – undo
97 97
 	 * @param string $icon
98 98
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem
99 99
 	 */
100
-	public function addSearchInputItem($placeHolder=NULL,$icon=NULL){
101
-		return $this->addItem(HtmlDropdownItem::searchInput($placeHolder,$icon));
100
+	public function addSearchInputItem($placeHolder=NULL, $icon=NULL) {
101
+		return $this->addItem(HtmlDropdownItem::searchInput($placeHolder, $icon));
102 102
 	}
103 103
 
104 104
 	/**
105 105
 	 * Adds a divider item
106 106
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem
107 107
 	 */
108
-	public function addDividerItem(){
108
+	public function addDividerItem() {
109 109
 		return $this->addItem(HtmlDropdownItem::divider());
110 110
 	}
111 111
 
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 	 * @param string $icon
116 116
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown
117 117
 	 */
118
-	public function addHeaderItem($caption=NULL,$icon=NULL){
119
-		return $this->addItem(HtmlDropdownItem::header($caption,$icon));
118
+	public function addHeaderItem($caption=NULL, $icon=NULL) {
119
+		return $this->addItem(HtmlDropdownItem::header($caption, $icon));
120 120
 	}
121 121
 
122 122
 	/**
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 * @param string $color
126 126
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown
127 127
 	 */
128
-	public function addCircularLabelItem($caption,$color){
128
+	public function addCircularLabelItem($caption, $color) {
129 129
 		return $this->addItem(HtmlDropdownItem::circular($caption, $color));
130 130
 	}
131 131
 
@@ -134,87 +134,87 @@  discard block
 block discarded – undo
134 134
 	 * @param string $image
135 135
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem
136 136
 	 */
137
-	public function addMiniAvatarImageItem($caption,$image){
137
+	public function addMiniAvatarImageItem($caption, $image) {
138 138
 		return $this->addItem(HtmlDropdownItem::avatar($caption, $image));
139 139
 	}
140 140
 
141
-	public function addItems($items){
142
-		if(JArray::isAssociative($items)){
143
-			foreach ($items as $k=>$v){
141
+	public function addItems($items) {
142
+		if (JArray::isAssociative($items)) {
143
+			foreach ($items as $k=>$v) {
144 144
 				$this->addItem($v)->setData($k);
145 145
 			}
146
-		}else{
147
-			foreach ($items as $item){
146
+		} else {
147
+			foreach ($items as $item) {
148 148
 				$this->addItem($item);
149 149
 			}
150 150
 		}
151 151
 	}
152 152
 
153
-	public function getItem($index){
153
+	public function getItem($index) {
154 154
 		return $this->items[$index];
155 155
 	}
156 156
 
157 157
 	/**
158 158
 	 * @return int
159 159
 	 */
160
-	public function count(){
160
+	public function count() {
161 161
 		return \sizeof($this->items);
162 162
 	}
163 163
 	/**
164 164
 	 * @param boolean $dropdown
165 165
 	 */
166
-	public function asDropdown($dropdown){
167
-		if($dropdown===false){
166
+	public function asDropdown($dropdown) {
167
+		if ($dropdown===false) {
168 168
 			$this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php';
169 169
 			$dropdown="menu";
170
-		}else{
170
+		} else {
171 171
 			$dropdown="dropdown";
172 172
 			$this->mClass="menu";
173 173
 		}
174
-		return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown"));
174
+		return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown"));
175 175
 	}
176 176
 
177
-	public function setVertical(){
178
-		return $this->addToPropertyCtrl("class", "vertical",array("vertical"));
177
+	public function setVertical() {
178
+		return $this->addToPropertyCtrl("class", "vertical", array("vertical"));
179 179
 	}
180 180
 
181
-	public function setInline(){
182
-		return $this->addToPropertyCtrl("class", "inline",["inline"]);
181
+	public function setInline() {
182
+		return $this->addToPropertyCtrl("class", "inline", ["inline"]);
183 183
 	}
184 184
 
185
-	public function setSimple(){
186
-		return $this->addToPropertyCtrl("class", "simple",array("simple"));
185
+	public function setSimple() {
186
+		return $this->addToPropertyCtrl("class", "simple", array("simple"));
187 187
 	}
188 188
 
189
-	public function asButton($floating=false){
190
-		if($floating)
189
+	public function asButton($floating=false) {
190
+		if ($floating)
191 191
 			$this->addToProperty("class", "floating");
192 192
 		$this->removePropertyValue("class", "selection");
193 193
 		return $this->addToProperty("class", "button");
194 194
 	}
195 195
 
196
-	public function asSelect($name=NULL,$multiple=false,$selection=true){
197
-		if(isset($name))
196
+	public function asSelect($name=NULL, $multiple=false, $selection=true) {
197
+		if (isset($name))
198 198
 			$this->addInput($name);
199
-		if($multiple)
199
+		if ($multiple)
200 200
 			$this->addToProperty("class", "multiple");
201
-		if ($selection){
202
-			if($this->propertyContains("class", "button")===false)
203
-				$this->addToPropertyCtrl("class", "selection",array("selection"));
201
+		if ($selection) {
202
+			if ($this->propertyContains("class", "button")===false)
203
+				$this->addToPropertyCtrl("class", "selection", array("selection"));
204 204
 		}
205 205
 		return $this;
206 206
 	}
207 207
 
208
-	public function asSearch($name=NULL,$multiple=false,$selection=true){
209
-		$this->asSelect($name,$multiple,$selection);
208
+	public function asSearch($name=NULL, $multiple=false, $selection=true) {
209
+		$this->asSelect($name, $multiple, $selection);
210 210
 		return $this->addToProperty("class", "search");
211 211
 	}
212 212
 
213
-	public function setSelect($name=NULL,$multiple=false){
214
-		if(!isset($name))
213
+	public function setSelect($name=NULL, $multiple=false) {
214
+		if (!isset($name))
215 215
 			$name="select-".$this->identifier;
216 216
 		$this->input=null;
217
-		if($multiple){
217
+		if ($multiple) {
218 218
 			$this->setProperty("multiple", true);
219 219
 			$this->addToProperty("class", "multiple");
220 220
 		}
@@ -222,37 +222,37 @@  discard block
 block discarded – undo
222 222
 		$this->tagName="select";
223 223
 		$this->setProperty("name", $name);
224 224
 		$this->content=null;
225
-		foreach ($this->items as $item){
225
+		foreach ($this->items as $item) {
226 226
 			$item->asOption();
227 227
 		}
228 228
 		return $this;
229 229
 	}
230 230
 
231
-	public function asSubmenu($pointing=NULL){
231
+	public function asSubmenu($pointing=NULL) {
232 232
 		$this->setClass("ui dropdown link item");
233
-		if(isset($pointing)){
233
+		if (isset($pointing)) {
234 234
 			$this->setPointing($pointing);
235 235
 		}
236 236
 		return $this;
237 237
 	}
238 238
 
239
-	public function setPointing($value=Direction::NONE){
240
-		return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing"));
239
+	public function setPointing($value=Direction::NONE) {
240
+		return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing"));
241 241
 	}
242 242
 
243
-	public function setValue($value){
243
+	public function setValue($value) {
244 244
 		$this->value=$value;
245 245
 		return $this;
246 246
 	}
247
-	private function applyValue(){
247
+	private function applyValue() {
248 248
 		$value=$this->value;
249
-		if(isset($this->input) && isset($value)){
249
+		if (isset($this->input) && isset($value)) {
250 250
 			$this->input->setProperty("value", $value);
251
-		}else{
251
+		} else {
252 252
 			$this->setProperty("value", $value);
253 253
 		}
254 254
 			$textElement=$this->getElementById("text-".$this->identifier, $this->content);
255
-			if(isset($textElement))
255
+			if (isset($textElement))
256 256
 				$textElement->setContent($value);
257 257
 		return $this;
258 258
 	}
@@ -262,28 +262,28 @@  discard block
 block discarded – undo
262 262
 	 * @see BaseHtml::run()
263 263
 	 */
264 264
 	public function run(JsUtils $js) {
265
-		if($this->propertyContains("class", "simple")===false){
266
-			if(isset($this->_bsComponent)===false)
267
-				$this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params);
265
+		if ($this->propertyContains("class", "simple")===false) {
266
+			if (isset($this->_bsComponent)===false)
267
+				$this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params);
268 268
 			$this->addEventsOnRun($js);
269 269
 			return $this->_bsComponent;
270 270
 		}
271 271
 	}
272 272
 
273
-	public function setCompact(){
273
+	public function setCompact() {
274 274
 		return $this->addToPropertyCtrl("class", "compact", array("compact"));
275 275
 	}
276 276
 
277
-	public function setAction($action){
277
+	public function setAction($action) {
278 278
 		$this->_params["action"]=$action;
279 279
 	}
280 280
 
281
-	public function setFullTextSearch($value){
281
+	public function setFullTextSearch($value) {
282 282
 		$this->_params["fullTextSearch"]=$value;
283 283
 	}
284 284
 
285 285
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
286 286
 		$this->applyValue();
287
-		return parent::compile($js,$view);
287
+		return parent::compile($js, $view);
288 288
 	}
289 289
 }
290 290
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/menus/HtmlMenu.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
 	 * @return \Ajax\semantic\html\collections\HtmlMenu
39 39
 	 */
40 40
 	public function setType($type="") {
41
-		return $this->addToPropertyCtrl("class", $type, array ("","item","text" ));
41
+		return $this->addToPropertyCtrl("class", $type, array("", "item", "text"));
42 42
 	}
43 43
 
44 44
 	public function setActiveItem($index) {
45 45
 		$item=$this->getItem($index);
46
-		if ($item !== null) {
46
+		if ($item!==null) {
47 47
 			$item->addToProperty("class", "active");
48 48
 		}
49 49
 		return $this;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
 	private function getItemToInsert($item) {
53 53
 		if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButton || ($item instanceof HtmlDropdown && $this->propertyContains("class", "vertical")===false)) {
54
-			$itemO=new HtmlMenuItem("item-" . $this->identifier, $item);
54
+			$itemO=new HtmlMenuItem("item-".$this->identifier, $item);
55 55
 			$item=$itemO;
56 56
 		}
57 57
 		return $item;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
 	private function afterInsert($item) {
61 61
 		if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false)
62
-			$item->addToPropertyCtrl("class", "item", array ("item" ));
62
+			$item->addToPropertyCtrl("class", "item", array("item"));
63 63
 		else {
64 64
 			$this->setSecondary();
65 65
 		}
@@ -90,15 +90,15 @@  discard block
 block discarded – undo
90 90
 
91 91
 	public function generateMenuAsItem($menu, $header=null) {
92 92
 		$count=$this->count();
93
-		$item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div");
93
+		$item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div");
94 94
 		if (isset($header)) {
95
-			$headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header");
95
+			$headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header");
96 96
 			$headerItem->setContent($header);
97 97
 			$item->addContent($headerItem);
98 98
 			$this->_itemHeader=$headerItem;
99 99
 		}
100
-		if(\is_array($menu)){
101
-			$menu=new HtmlMenu("menu-" . $this->identifier . "-" . $count,$menu);
100
+		if (\is_array($menu)) {
101
+			$menu=new HtmlMenu("menu-".$this->identifier."-".$count, $menu);
102 102
 		}
103 103
 		$menu->setClass("menu");
104 104
 		$item->addContent($menu);
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 		$value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value);
114 114
 		$value->addContent(new HtmlIcon("", "dropdown"));
115 115
 		$value=$this->addItem($value);
116
-		$popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content);
116
+		$popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content);
117 117
 		$popup->setFlowing()->setPosition("bottom left")->setOn("click");
118 118
 		$this->wrap("", $popup);
119 119
 		return $popup;
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	public function addDropdownAsItem($value, $items=NULL) {
123 123
 		$dd=$value;
124 124
 		if (\is_string($value)) {
125
-			$dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items);
125
+			$dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items);
126 126
 		}
127 127
 		$this->addItem($dd);
128 128
 		return $dd;
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 * @see \Ajax\common\html\html5\HtmlCollection::createItem()
136 136
 	 */
137 137
 	protected function createItem($value) {
138
-		$itemO=new HtmlMenuItem($this->identifier."item" . \sizeof($this->content),"");
138
+		$itemO=new HtmlMenuItem($this->identifier."item".\sizeof($this->content), "");
139 139
 		$itemO->setTagName("a");
140 140
 		$itemO->setContent($value);
141 141
 		return $itemO;
@@ -146,35 +146,35 @@  discard block
 block discarded – undo
146 146
 	}
147 147
 
148 148
 	public function setSecondary($value=true) {
149
-		if($value)
149
+		if ($value)
150 150
 			$this->addToProperty("class", "secondary");
151 151
 		else
152 152
 			$this->removePropertyValue("class", "secondary");
153 153
 	}
154 154
 
155 155
 	public function setVertical() {
156
-		return $this->addToPropertyCtrl("class", "vertical", array ("vertical" ));
156
+		return $this->addToPropertyCtrl("class", "vertical", array("vertical"));
157 157
 	}
158 158
 
159 159
 	public function setPosition($value="right") {
160
-		return $this->addToPropertyCtrl("class", $value, array ("right","left" ));
160
+		return $this->addToPropertyCtrl("class", $value, array("right", "left"));
161 161
 	}
162 162
 
163 163
 	public function setPointing($value=Direction::NONE) {
164
-		return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing"));
164
+		return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing"));
165 165
 	}
166 166
 
167 167
 	public function asTab($vertical=false) {
168
-		$this->apply(function (HtmlDoubleElement &$item) {
168
+		$this->apply(function(HtmlDoubleElement&$item) {
169 169
 			$item->setTagName("a");
170 170
 		});
171
-		if ($vertical === true)
171
+		if ($vertical===true)
172 172
 			$this->setVertical();
173 173
 		return $this->addToProperty("class", "tabular");
174 174
 	}
175 175
 
176 176
 	public function asPagination() {
177
-		$this->apply(function (HtmlDoubleElement &$item) {
177
+		$this->apply(function(HtmlDoubleElement&$item) {
178 178
 			$item->setTagName("a");
179 179
 		});
180 180
 		return $this->addToProperty("class", "pagination");
@@ -211,10 +211,10 @@  discard block
 block discarded – undo
211 211
 	 */
212 212
 	public function setWidth($width) {
213 213
 		if (\is_int($width)) {
214
-			$width=Wide::getConstants()["W" . $width];
214
+			$width=Wide::getConstants()["W".$width];
215 215
 		}
216 216
 		$this->addToPropertyCtrl("class", $width, Wide::getConstants());
217
-		return $this->addToPropertyCtrl("class", "item", array ("item" ));
217
+		return $this->addToPropertyCtrl("class", "item", array("item"));
218 218
 	}
219 219
 
220 220
 	public function addImage($identifier, $src="", $alt="") {
Please login to merge, or discard this patch.