Completed
Push — master ( 7ebf5f...c286d3 )
by Jean-Christophe
02:51
created
Ajax/semantic/html/collections/form/traits/FieldTrait.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 	abstract public function addToProperty($name, $value, $separator=" ");
18 18
 	abstract public function addLabel($caption, $style="label-default", $leftSeparator=" ");
19
-	abstract public function addContent($content,$before=false);
19
+	abstract public function addContent($content, $before=false);
20 20
 	abstract public function getField();
21 21
 	abstract public function getDataField();
22 22
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	}
26 26
 
27 27
 	public function addLoading() {
28
-		if ($this->_hasIcon === false) {
28
+		if ($this->_hasIcon===false) {
29 29
 			throw new \Exception("Input must have an icon for showing a loader, use addIcon before");
30 30
 		}
31 31
 		return $this->addToProperty("class", State::LOADING);
@@ -33,56 +33,56 @@  discard block
 block discarded – undo
33 33
 
34 34
 	public function labeled($label, $direction=Direction::LEFT, $icon=NULL) {
35 35
 		$field=$this->getField();
36
-		$labelO=$field->addLabel($label,$direction===Direction::LEFT,$icon);
37
-		$field->addToProperty("class", $direction . " labeled");
36
+		$labelO=$field->addLabel($label, $direction===Direction::LEFT, $icon);
37
+		$field->addToProperty("class", $direction." labeled");
38 38
 		return $labelO;
39 39
 	}
40 40
 
41 41
 	public function labeledToCorner($icon, $direction=Direction::LEFT) {
42
-		return $this->labeled("", $direction . " corner", $icon)->toCorner($direction);
42
+		return $this->labeled("", $direction." corner", $icon)->toCorner($direction);
43 43
 	}
44 44
 
45 45
 	public function addAction($action, $direction=Direction::RIGHT, $icon=NULL, $labeled=false) {
46 46
 		$field=$this->getField();
47 47
 		$actionO=$action;
48
-		if (\is_object($action) === false) {
49
-			$actionO=new HtmlButton("action-" . $this->identifier, $action);
48
+		if (\is_object($action)===false) {
49
+			$actionO=new HtmlButton("action-".$this->identifier, $action);
50 50
 			if (isset($icon))
51 51
 				$actionO->addIcon($icon, true, $labeled);
52 52
 		}
53
-		$field->addToProperty("class", $direction . " action");
54
-		$field->addContent($actionO, \strstr($direction, Direction::LEFT) !== false);
53
+		$field->addToProperty("class", $direction." action");
54
+		$field->addContent($actionO, \strstr($direction, Direction::LEFT)!==false);
55 55
 		return $actionO;
56 56
 	}
57 57
 
58
-	public function addDropdown($label="", $items=array(),$direction=Direction::RIGHT){
59
-		$labelO=new HtmlDropdown("dd-".$this->identifier,$label,$items);
60
-		$labelO->asSelect("select-".$this->identifier,false,true);
61
-		return $this->labeled($labelO,$direction);
58
+	public function addDropdown($label="", $items=array(), $direction=Direction::RIGHT) {
59
+		$labelO=new HtmlDropdown("dd-".$this->identifier, $label, $items);
60
+		$labelO->asSelect("select-".$this->identifier, false, true);
61
+		return $this->labeled($labelO, $direction);
62 62
 	}
63 63
 
64 64
 	public function setTransparent() {
65 65
 		return $this->getField()->addToProperty("class", "transparent");
66 66
 	}
67 67
 
68
-	public function setReadonly(){
68
+	public function setReadonly() {
69 69
 		$this->getDataField()->setProperty("readonly", "");
70 70
 		return $this;
71 71
 	}
72 72
 
73
-	public function setName($name){
74
-		$this->getDataField()->setProperty("name",$name);
73
+	public function setName($name) {
74
+		$this->getDataField()->setProperty("name", $name);
75 75
 		return $this;
76 76
 	}
77 77
 
78
-	public function setFluid(){
79
-		$this->getField()->addToProperty("class","fluid");
78
+	public function setFluid() {
79
+		$this->getField()->addToProperty("class", "fluid");
80 80
 		return $this;
81 81
 	}
82 82
 
83 83
 	public function setDisabled($disable=true) {
84 84
 		$field=$this->getField();
85
-		if($disable)
85
+		if ($disable)
86 86
 			$field->addToProperty("class", "disabled");
87 87
 		return $this;
88 88
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlPopup.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 class HtmlPopup extends HtmlSemDoubleElement {
13 13
 	private $_container;
14
-	public function __construct(BaseHtml $container,$identifier, $content="") {
14
+	public function __construct(BaseHtml $container, $identifier, $content="") {
15 15
 		parent::__construct($identifier, "div");
16 16
 		$this->_container=$container;
17 17
 		$this->setClass("ui popup");
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 		$this->_params=array("on"=>"hover");
20 20
 	}
21 21
 
22
-	public function addList($items=array(),$header=NULL){
23
-		if(!$this->content instanceof HtmlGrid){
24
-			$this->content=new HtmlGrid("Grid-".$this->identifier,0);
22
+	public function addList($items=array(), $header=NULL) {
23
+		if (!$this->content instanceof HtmlGrid) {
24
+			$this->content=new HtmlGrid("Grid-".$this->identifier, 0);
25 25
 		}
26 26
 		$grid=$this->content;
27 27
 
@@ -29,12 +29,12 @@  discard block
 block discarded – undo
29 29
 		$colCount++;
30 30
 		$grid->setColsCount($colCount);
31 31
 
32
-		$list=new HtmlList("",$items);
32
+		$list=new HtmlList("", $items);
33 33
 		$list->asLink();
34
-		if(isset($header)){
35
-			$list->addHeader(4,$header);
34
+		if (isset($header)) {
35
+			$list->addHeader(4, $header);
36 36
 		}
37
-		$grid->getCell(0,$colCount-1)->setContent($list);
37
+		$grid->getCell(0, $colCount-1)->setContent($list);
38 38
 		$grid->setDivided()->setRelaxed(true);
39 39
 		return $list;
40 40
 	}
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
 	/**
43 43
 	 * A popup can have no maximum width and continue to flow to fit its content
44 44
 	 */
45
-	public function setFlowing(){
45
+	public function setFlowing() {
46 46
 		return $this->addToProperty("class", "flowing");
47 47
 	}
48 48
 
49 49
 	/**
50 50
 	 * A popup can provide more basic formatting
51 51
 	 */
52
-	public function setBasic(){
52
+	public function setBasic() {
53 53
 		return $this->addToProperty("class", "basic");
54 54
 	}
55 55
 
@@ -57,22 +57,22 @@  discard block
 block discarded – undo
57 57
 	 * {@inheritDoc}
58 58
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run()
59 59
 	 */
60
-	public function run(JsUtils $js){
60
+	public function run(JsUtils $js) {
61 61
 		$this->_params["popup"]="#".$this->identifier;
62
-		$js->semantic()->popup("#".$this->_container->getIdentifier(),$this->_params);
62
+		$js->semantic()->popup("#".$this->_container->getIdentifier(), $this->_params);
63 63
 	}
64 64
 
65
-	public function setOn($event="click"){
65
+	public function setOn($event="click") {
66 66
 		$this->_params["on"]=$event;
67 67
 		return $this;
68 68
 	}
69 69
 
70
-	public function setInline($value=true){
70
+	public function setInline($value=true) {
71 71
 		$this->_params["inline"]=$value;
72 72
 		return $this;
73 73
 	}
74 74
 
75
-	public function setPosition($position){
75
+	public function setPosition($position) {
76 76
 		$this->_params["position"]=$position;
77 77
 		return $this;
78 78
 	}
Please login to merge, or discard this patch.
Ajax/Semantic.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
 use Ajax\semantic\traits\SemanticWidgetsTrait;
12 12
 
13 13
 class Semantic extends BaseGui {
14
-	use SemanticComponentsTrait,SemanticHtmlElementsTrait,SemanticHtmlCollectionsTrait,
15
-	SemanticHtmlModulesTrait,SemanticHtmlViewsTrait,SemanticWidgetsTrait;
14
+	use SemanticComponentsTrait, SemanticHtmlElementsTrait, SemanticHtmlCollectionsTrait,
15
+	SemanticHtmlModulesTrait, SemanticHtmlViewsTrait, SemanticWidgetsTrait;
16 16
 
17 17
 	private $language;
18 18
 
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
 	}
22 22
 
23 23
 
24
-	public function setLanguage($language){
25
-		if($language!==$this->language){
24
+	public function setLanguage($language) {
25
+		if ($language!==$this->language) {
26 26
 			$file=\realpath(dirname(__FILE__)."/semantic/components/validation/languages/".$language.".js");
27
-			if(\file_exists($file)){
27
+			if (\file_exists($file)) {
28 28
 				$script=\file_get_contents($file);
29
-				$this->js->exec($script,true);
29
+				$this->js->exec($script, true);
30 30
 				$this->language=$language;
31 31
 			}
32 32
 		}
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlSegmentGroups.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -7,20 +7,20 @@  discard block
 block discarded – undo
7 7
 use Ajax\semantic\html\base\constants\Sens;
8 8
 use Ajax\JsUtils;
9 9
 
10
-class HtmlSegmentGroups extends HtmlSemCollection{
10
+class HtmlSegmentGroups extends HtmlSemCollection {
11 11
 
12 12
 
13
-	public function __construct( $identifier, $items=array()){
14
-		parent::__construct( $identifier, "div","ui segments");
13
+	public function __construct($identifier, $items=array()) {
14
+		parent::__construct($identifier, "div", "ui segments");
15 15
 		$this->addItems($items);
16 16
 	}
17 17
 
18 18
 
19
-	protected function createItem($value){
20
-		return new HtmlSegment("segment-".$this->count(),$value);
19
+	protected function createItem($value) {
20
+		return new HtmlSegment("segment-".$this->count(), $value);
21 21
 	}
22 22
 
23
-	protected function createCondition($value){
23
+	protected function createCondition($value) {
24 24
 		return !($value instanceof HtmlSegment);
25 25
 	}
26 26
 
@@ -29,21 +29,21 @@  discard block
 block discarded – undo
29 29
 	 * @param string $type one of "raised","stacked","piled" default : ""
30 30
 	 * @return \Ajax\semantic\html\elements\HtmlSegmentGroups
31 31
 	 */
32
-	public function setType($type){
32
+	public function setType($type) {
33 33
 		return $this->addToPropertyCtrl("class", $type, SegmentType::getConstants());
34 34
 	}
35 35
 
36
-	public function setSens($sens=Sens::VERTICAL){
36
+	public function setSens($sens=Sens::VERTICAL) {
37 37
 		return $this->addToPropertyCtrl("class", $sens, Sens::getConstants());
38 38
 	}
39 39
 
40
-	public function run(JsUtils $js){
41
-		$result= parent::run($js);
40
+	public function run(JsUtils $js) {
41
+		$result=parent::run($js);
42 42
 		return $result->setItemSelector(".ui.segment");
43 43
 	}
44 44
 
45
-	public static function group($identifier,$items=array(),$type="",$sens=Sens::VERTICAL){
46
-		$group=new HtmlSegmentGroups($identifier,$items);
45
+	public static function group($identifier, $items=array(), $type="", $sens=Sens::VERTICAL) {
46
+		$group=new HtmlSegmentGroups($identifier, $items);
47 47
 		$group->setSens($sens);
48 48
 		return $group->setType($type);
49 49
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlIconGroups.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 			$icon=JArray::getValue($value, "icon", 0);
27 27
 			$size=JArray::getValue($value, "size", 1);
28 28
 		}
29
-		$iconO=new HtmlIcon("icon-" . $this->identifier, $icon);
29
+		$iconO=new HtmlIcon("icon-".$this->identifier, $icon);
30 30
 		if (isset($size)) {
31 31
 			$iconO->setSize($size);
32 32
 		}
@@ -34,15 +34,15 @@  discard block
 block discarded – undo
34 34
 	}
35 35
 
36 36
 	protected function createCondition($value) {
37
-		return ($value instanceof HtmlIcon) === false;
37
+		return ($value instanceof HtmlIcon)===false;
38 38
 	}
39 39
 
40 40
 	public function getIcon($index) {
41 41
 		return $this->content[$index];
42 42
 	}
43 43
 
44
-	public function run(JsUtils $js){
45
-		$result= parent::run($js);
44
+	public function run(JsUtils $js) {
45
+		$result=parent::run($js);
46 46
 		return $result->setItemSelector("i");
47 47
 	}
48 48
 
Please login to merge, or discard this patch.
Ajax/common/html/HtmlDoubleElement.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
 		return $this->content;
28 28
 	}
29 29
 
30
-	public function addContent($content,$before=false) {
30
+	public function addContent($content, $before=false) {
31 31
 		if (!\is_array($this->content)) {
32
-			if(isset($this->content))
33
-				$this->content=array ($this->content);
32
+			if (isset($this->content))
33
+				$this->content=array($this->content);
34 34
 			else
35 35
 				$this->content=array();
36 36
 		}
37
-		if($before)
38
-			array_unshift($this->content,$content);
37
+		if ($before)
38
+			array_unshift($this->content, $content);
39 39
 		else
40 40
 			$this->content []=$content;
41 41
 		return $this;
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		if ($this->content instanceof HtmlDoubleElement) {
51 51
 			$this->content->run($js);
52 52
 		} else if (\is_array($this->content)) {
53
-			foreach ( $this->content as $itemContent ) {
53
+			foreach ($this->content as $itemContent) {
54 54
 				if ($itemContent instanceof HtmlDoubleElement) {
55 55
 					$itemContent->run($js);
56 56
 				}
@@ -67,19 +67,19 @@  discard block
 block discarded – undo
67 67
 		return $this;
68 68
 	}
69 69
 
70
-	public function getContentInstances($class){
71
-		return $this->_getContentInstances($class,$this->content);
70
+	public function getContentInstances($class) {
71
+		return $this->_getContentInstances($class, $this->content);
72 72
 	}
73 73
 
74
-	protected function _getContentInstances($class,$content){
74
+	protected function _getContentInstances($class, $content) {
75 75
 		$instances=[];
76
-		if($content instanceof $class){
76
+		if ($content instanceof $class) {
77 77
 			$instances[]=$content;
78
-		}elseif($content instanceof HtmlDoubleElement){
79
-			$instances=\array_merge($instances,$content->getContentInstances($class));
80
-		}elseif (\is_array($content)){
81
-			foreach ($content as $element){
82
-				$instances=\array_merge($instances,$this->_getContentInstances($class, $element));
78
+		}elseif ($content instanceof HtmlDoubleElement) {
79
+			$instances=\array_merge($instances, $content->getContentInstances($class));
80
+		}elseif (\is_array($content)) {
81
+			foreach ($content as $element) {
82
+				$instances=\array_merge($instances, $this->_getContentInstances($class, $element));
83 83
 			}
84 84
 		}
85 85
 		return $instances;
Please login to merge, or discard this patch.
Ajax/service/Javascript.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
 	public static $preventDefault="\nif(event && event.preventDefault) event.preventDefault();\n";
7 7
 	public static $stopPropagation="\nif(event && event.stopPropagation) event.stopPropagation();\n";
8 8
 
9
-	public static function containsCode($expression){
10
-		return strrpos($expression, 'this')!==false||strrpos($expression, 'event')!==false||strrpos($expression, 'self')!==false;
9
+	public static function containsCode($expression) {
10
+		return strrpos($expression, 'this')!==false || strrpos($expression, 'event')!==false || strrpos($expression, 'self')!==false;
11 11
 	}
12 12
 
13 13
 	/**
Please login to merge, or discard this patch.
Ajax/common/html/HtmlSingleElement.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	public function setClass($classNames) {
16
-		if(\is_array($classNames)){
16
+		if (\is_array($classNames)) {
17 17
 			$classNames=implode(" ", $classNames);
18 18
 		}
19 19
 		$this->setProperty("class", $classNames);
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	}
22 22
 
23 23
 	public function addClass($classNames) {
24
-		if(\is_array($classNames)){
24
+		if (\is_array($classNames)) {
25 25
 			$classNames=implode(" ", $classNames);
26 26
 		}
27 27
 		$this->addToProperty("class", $classNames);
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function fromArray($array) {
54 54
 		$array=parent::fromArray($array);
55
-		foreach ( $array as $key => $value ) {
55
+		foreach ($array as $key => $value) {
56 56
 			$this->setProperty($key, $value);
57 57
 		}
58 58
 		return $array;
Please login to merge, or discard this patch.
Ajax/bootstrap/html/HtmlButtongroups.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @return HtmlButtongroups default : ""
40 40
 	 */
41 41
 	public function setSize($size) {
42
-		foreach ( $this->elements as $element ) {
42
+		foreach ($this->elements as $element) {
43 43
 			$element->setSize($size);
44 44
 		}
45 45
 		if (is_int($size)) {
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	}
50 50
 
51 51
 	public function setStyle($value) {
52
-		foreach ( $this->elements as $element )
52
+		foreach ($this->elements as $element)
53 53
 			$element->setStyle($value);
54 54
 	}
55 55
 
@@ -69,29 +69,29 @@  discard block
 block discarded – undo
69 69
 	public function addElement($element) {
70 70
 		$result=$element;
71 71
 		$iid=sizeof($this->elements)+1;
72
-		if (($element instanceof HtmlDropdown)||($element instanceof HtmlSplitbutton)) {
72
+		if (($element instanceof HtmlDropdown) || ($element instanceof HtmlSplitbutton)) {
73 73
 			$this->addExistingDropDown($element);
74 74
 		} elseif (\is_array($element)) {
75
-			$result=$this->_addArrayElement($element,$iid);
75
+			$result=$this->_addArrayElement($element, $iid);
76 76
 		} elseif (is_string($element)) {
77
-			$result=new HtmlButton($this->identifier."-button-".$iid,$element);
77
+			$result=new HtmlButton($this->identifier."-button-".$iid, $element);
78 78
 		}
79
-		if($result instanceof HtmlButton)
79
+		if ($result instanceof HtmlButton)
80 80
 			$this->elements[]=$result;
81 81
 		return $result;
82 82
 	}
83 83
 
84
-	private function _addArrayElement(array $element,$iid){
84
+	private function _addArrayElement(array $element, $iid) {
85 85
 		if (array_key_exists("glyph", $element))
86 86
 			$bt=new HtmlGlyphButton($this->identifier."-button-".$iid);
87 87
 		elseif (array_key_exists("btnCaption", $element)) {
88 88
 			if (array_key_exists("split", $element))
89 89
 				$bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid);
90
-			else{
90
+			else {
91 91
 				$bt=new HtmlDropdown($this->identifier."-dropdown-".$iid);
92 92
 				$this->dropdownAsButton($bt);
93 93
 			}
94
-		} else{
94
+		} else {
95 95
 			$bt=new HtmlButton($this->identifier."-button-".$iid);
96 96
 			$bt->fromArray($element);
97 97
 		}
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	}
100 100
 
101 101
 	public function addElements($elements) {
102
-		foreach ( $elements as $element ) {
102
+		foreach ($elements as $element) {
103 103
 			$this->addElement($element);
104 104
 		}
105 105
 		return $this;
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		} else
120 120
 			$value="btn-group-".$value;
121 121
 		if (strstr($value, "justified")) {
122
-			foreach ( $this->elements as $element ) {
122
+			foreach ($this->elements as $element) {
123 123
 				$element->wrap('<div class="btn-group" role="group">', '</div>');
124 124
 			}
125 125
 		}
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	 * @see \Ajax\bootstrap\html\base\BaseHtml::on()
151 151
 	 */
152 152
 	public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) {
153
-		foreach ( $this->elements as $element ) {
153
+		foreach ($this->elements as $element) {
154 154
 			$element->on($event, $jsCode, $stopPropagation, $preventDefault);
155 155
 		}
156 156
 		return $this;
Please login to merge, or discard this patch.