Passed
Push — master ( 92726b...d75a73 )
by Jean-Christophe
02:08
created
Ajax/semantic/html/collections/HtmlMessage.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * @version 1.001
16 16
  */
17 17
 class HtmlMessage extends HtmlSemDoubleElement {
18
-	use AttachedTrait,HasTimeoutTrait;
18
+	use AttachedTrait, HasTimeoutTrait;
19 19
 	protected $icon;
20 20
 	protected $close;
21 21
 
@@ -32,39 +32,39 @@  discard block
 block discarded – undo
32 32
 	 * @param string|HtmlSemDoubleElement $header
33 33
 	 * @return \Ajax\semantic\html\collections\HtmlMessage
34 34
 	 */
35
-	public function addHeader($header){
35
+	public function addHeader($header) {
36 36
 		$headerO=$header;
37
-		if(\is_string($header)){
38
-			$headerO=new HtmlSemDoubleElement("header-".$this->identifier,"div");
37
+		if (\is_string($header)) {
38
+			$headerO=new HtmlSemDoubleElement("header-".$this->identifier, "div");
39 39
 			$headerO->setClass("header");
40 40
 			$headerO->setContent($header);
41 41
 		}
42
-		return $this->addContent($headerO,true);
42
+		return $this->addContent($headerO, true);
43 43
 	}
44 44
 
45
-	public function setHeader($header){
45
+	public function setHeader($header) {
46 46
 		return $this->addHeader($header);
47 47
 	}
48 48
 
49
-	public function setIcon($icon){
49
+	public function setIcon($icon) {
50 50
 		$this->addToProperty("class", "icon");
51
-		$this->wrapContent("<div class='content'>","</div>");
52
-		if(\is_string($icon)){
51
+		$this->wrapContent("<div class='content'>", "</div>");
52
+		if (\is_string($icon)) {
53 53
 			$this->icon=new HtmlIcon("icon-".$this->identifier, $icon);
54
-		}else{
54
+		} else {
55 55
 			$this->icon=$icon;
56 56
 		}
57 57
 		return $this;
58 58
 	}
59 59
 
60
-	public function addLoader($loaderIcon="notched circle"){
60
+	public function addLoader($loaderIcon="notched circle") {
61 61
 		$this->setIcon($loaderIcon);
62 62
 		$this->icon->addToIcon("loading");
63 63
 		return $this;
64 64
 	}
65 65
 
66
-	public function setDismissable($dismiss=true){
67
-		if($dismiss===true)
66
+	public function setDismissable($dismiss=true) {
67
+		if ($dismiss===true)
68 68
 			$this->close=new HtmlIcon("close-".$this->identifier, "close");
69 69
 		else
70 70
 			$this->close=NULL;
@@ -75,43 +75,43 @@  discard block
 block discarded – undo
75 75
 	 * {@inheritDoc}
76 76
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run()
77 77
 	 */
78
-	public function run(JsUtils $js){
79
-		if(!isset($this->_bsComponent)){
80
-			if(isset($this->close)){
78
+	public function run(JsUtils $js) {
79
+		if (!isset($this->_bsComponent)) {
80
+			if (isset($this->close)) {
81 81
 				$js->execOn("click", "#".$this->identifier." .close", "$(this).closest('.message').transition({$this->_closeTransition})");
82 82
 			}
83
-			if(isset($this->_timeout)){
84
-				$js->exec("setTimeout(function() { $('#{$this->identifier}').transition({$this->_closeTransition}); }, {$this->_timeout});",true);
83
+			if (isset($this->_timeout)) {
84
+				$js->exec("setTimeout(function() { $('#{$this->identifier}').transition({$this->_closeTransition}); }, {$this->_timeout});", true);
85 85
 			}
86 86
 		}
87 87
 		return parent::run($js);
88 88
 	}
89 89
 
90
-	public function setState($visible=true){
91
-		$visible=($visible===true)?"visible":"hidden";
92
-		return $this->addToPropertyCtrl("class", $visible, array("visible","hidden"));
90
+	public function setState($visible=true) {
91
+		$visible=($visible===true) ? "visible" : "hidden";
92
+		return $this->addToPropertyCtrl("class", $visible, array("visible", "hidden"));
93 93
 	}
94 94
 
95
-	public function setVariation($value="floating"){
96
-		return $this->addToPropertyCtrl("class", $value, array("floating","compact"));
95
+	public function setVariation($value="floating") {
96
+		return $this->addToPropertyCtrl("class", $value, array("floating", "compact"));
97 97
 	}
98 98
 
99
-	public function setStyle($style){
99
+	public function setStyle($style) {
100 100
 		return $this->addToPropertyCtrl("class", $style, Style::getConstants());
101 101
 	}
102 102
 
103
-	public function setError(){
103
+	public function setError() {
104 104
 		return $this->setStyle("error");
105 105
 	}
106 106
 
107
-	public function setWarning(){
107
+	public function setWarning() {
108 108
 		return $this->setStyle("warning");
109 109
 	}
110 110
 
111
-	public function setMessage($message){
112
-		if(\is_array($this->content)){
111
+	public function setMessage($message) {
112
+		if (\is_array($this->content)) {
113 113
 			$this->content[\sizeof($this->content)-1]=$message;
114
-		}else
114
+		} else
115 115
 			$this->setContent($message);
116 116
 	}
117 117
 
Please login to merge, or discard this patch.
Ajax/service/AjaxTransition.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -3,26 +3,26 @@
 block discarded – undo
3 3
 use Ajax\semantic\html\base\constants\Transition;
4 4
 
5 5
 class AjaxTransition {
6
-	public static function none($responseElement,$jqueryDone="html"){
6
+	public static function none($responseElement, $jqueryDone="html") {
7 7
 		return $responseElement.".".$jqueryDone."( data )";
8 8
 	}
9 9
 
10
-	public static function jqFade($responseElement,$jqueryDone="html"){
10
+	public static function jqFade($responseElement, $jqueryDone="html") {
11 11
 		return $responseElement.".hide().{$jqueryDone}( data ).fadeIn()";
12 12
 	}
13 13
 
14
-	public static function jqSlide($responseElement,$jqueryDone="html"){
14
+	public static function jqSlide($responseElement, $jqueryDone="html") {
15 15
 		return $responseElement.".hide().{$jqueryDone}( data ).slideDown()";
16 16
 	}
17 17
 
18
-	public static function random($responseElement,$jqueryDone="html"){
18
+	public static function random($responseElement, $jqueryDone="html") {
19 19
 		$transitions=Transition::getConstantValues();
20
-		$transition=$transitions[\rand(0,\sizeof($transitions)-1)];
21
-		return self::__callStatic($transition, [$responseElement,$jqueryDone]);
20
+		$transition=$transitions[\rand(0, \sizeof($transitions)-1)];
21
+		return self::__callStatic($transition, [$responseElement, $jqueryDone]);
22 22
 	}
23 23
 
24
-	public static function __callStatic($name, $arguments){
25
-		if(\sizeof($arguments)==2){
24
+	public static function __callStatic($name, $arguments) {
25
+		if (\sizeof($arguments)==2) {
26 26
 			$responseElement=$arguments[0];
27 27
 			$jqueryDone=$arguments[1];
28 28
 			$name=JString::camelCaseToSeparated($name);
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlForm.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  */
21 21
 class HtmlForm extends HtmlSemCollection {
22 22
 
23
-	use FieldsTrait,FormTrait;
23
+	use FieldsTrait, FormTrait;
24 24
 	/**
25 25
 	 * @var array
26 26
 	 */
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
 
34 34
 	public function __construct($identifier, $elements=array()) {
35 35
 		parent::__construct($identifier, "form", "ui form");
36
-		$this->_states=[ State::ERROR,State::SUCCESS,State::WARNING,State::DISABLED ];
36
+		$this->_states=[State::ERROR, State::SUCCESS, State::WARNING, State::DISABLED];
37 37
 		$this->setProperty("name", $this->identifier);
38
-		$this->_fields=array ();
38
+		$this->_fields=array();
39 39
 		$this->addItems($elements);
40 40
 		$this->_validationParams=[];
41 41
 	}
42 42
 
43
-	protected function getForm(){
43
+	protected function getForm() {
44 44
 		return $this;
45 45
 	}
46 46
 
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	 * @param string $caption
63 63
 	 * @return HtmlForm
64 64
 	 */
65
-	public function addDivider($caption=NULL){
66
-		return $this->addContent(new HtmlDivider("",$caption));
65
+	public function addDivider($caption=NULL) {
66
+		return $this->addContent(new HtmlDivider("", $caption));
67 67
 	}
68 68
 
69 69
 	/**
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
 						$label=NULL;
86 86
 				}
87 87
 				$this->_fields=\array_merge($this->_fields, $fields);
88
-				$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields);
88
+				$fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(), $fields);
89 89
 			}
90
-			if (isset($label)){
91
-				$fields->wrap("<div class='field'><label>{$label}</label>","</div>");
90
+			if (isset($label)) {
91
+				$fields->wrap("<div class='field'><label>{$label}</label>", "</div>");
92 92
 			}
93 93
 		} else {
94
-			$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count());
94
+			$fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count());
95 95
 		}
96 96
 		$this->addItem($fields);
97 97
 		return $fields;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
 	public function addItem($item) {
101 101
 		$item=parent::addItem($item);
102
-		if (\is_subclass_of($item, HtmlFormField::class) === true) {
102
+		if (\is_subclass_of($item, HtmlFormField::class)===true) {
103 103
 			$this->_fields[]=$item;
104 104
 		}
105 105
 		return $item;
@@ -157,39 +157,39 @@  discard block
 block discarded – undo
157 157
 
158 158
 
159 159
 
160
-	public function compile(JsUtils $js=NULL,&$view=NULL){
161
-		if(\sizeof($this->_validationParams)>0)
160
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
161
+		if (\sizeof($this->_validationParams)>0)
162 162
 			$this->setProperty("novalidate", "");
163
-		return parent::compile($js,$view);
163
+		return parent::compile($js, $view);
164 164
 	}
165 165
 
166 166
 	public function run(JsUtils $js) {
167
-		if(isset($js)){
167
+		if (isset($js)) {
168 168
 			$compo=$js->semantic()->form("#".$this->identifier);
169
-		}else{
169
+		} else {
170 170
 			$compo=new Form();
171 171
 			$compo->attach("#".$this->identifier);
172 172
 		}
173
-		foreach ($this->_fields as $field){
174
-			if($field instanceof HtmlFormField){
173
+		foreach ($this->_fields as $field) {
174
+			if ($field instanceof HtmlFormField) {
175 175
 				$compo=$this->addCompoValidation($compo, $field);
176 176
 			}
177 177
 		}
178
-		foreach ($this->content as $field){
179
-			if($field instanceof HtmlFormFields){
178
+		foreach ($this->content as $field) {
179
+			if ($field instanceof HtmlFormFields) {
180 180
 				$items=$field->getItems();
181
-				foreach ($items as $_field){
182
-					if($_field instanceof HtmlFormField)
181
+				foreach ($items as $_field) {
182
+					if ($_field instanceof HtmlFormField)
183 183
 						$compo=$this->addCompoValidation($compo, $_field);
184 184
 				}
185 185
 			}
186 186
 		}
187
-		$this->_runValidationParams($compo,$js);
187
+		$this->_runValidationParams($compo, $js);
188 188
 		return $this->_bsComponent;
189 189
 	}
190 190
 
191
-	public function addValidationParam($paramName,$paramValue,$before="",$after=""){
192
-		$this->addBehavior($this->_validationParams, $paramName, $paramValue,$before,$after);
191
+	public function addValidationParam($paramName, $paramValue, $before="", $after="") {
192
+		$this->addBehavior($this->_validationParams, $paramName, $paramValue, $before, $after);
193 193
 		return $this;
194 194
 	}
195 195
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 		return $this->_validationParams;
203 203
 	}
204 204
 
205
-	public function removeValidationParam($param){
205
+	public function removeValidationParam($param) {
206 206
 		unset($this->_validationParams[$param]);
207 207
 		return $this;
208 208
 	}
Please login to merge, or discard this patch.
Ajax/semantic/components/validation/FieldValidation.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @version 1.001
8 8
  * Generates a JSON field validator
9 9
  */
10
-class FieldValidation implements \JsonSerializable{
10
+class FieldValidation implements \JsonSerializable {
11 11
 	/**
12 12
 	 * @var string
13 13
 	 */
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 	protected $optional;
26 26
 
27
-	public function __construct($identifier){
27
+	public function __construct($identifier) {
28 28
 		$this->identifier=$identifier;
29 29
 		$this->rules=[];
30 30
 	}
@@ -48,22 +48,22 @@  discard block
 block discarded – undo
48 48
 	 * @param string $value
49 49
 	 * @return Rule
50 50
 	 */
51
-	public function addRule($type,$prompt=NULL,$value=NULL){
52
-		if($type instanceof  Rule)
51
+	public function addRule($type, $prompt=NULL, $value=NULL) {
52
+		if ($type instanceof  Rule)
53 53
 			$rule=$type;
54
-		else if(\is_array($type)){
54
+		else if (\is_array($type)) {
55 55
 			$value=JArray::getValue($type, "value", 2);
56 56
 			$prompt=JArray::getValue($type, "prompt", 1);
57 57
 			$type=JArray::getValue($type, "type", 0);
58
-			$rule=new Rule($type,$prompt,$value);
59
-		}else
60
-			$rule=new Rule($type,$prompt,$value);
58
+			$rule=new Rule($type, $prompt, $value);
59
+		} else
60
+			$rule=new Rule($type, $prompt, $value);
61 61
 		$this->rules[]=$rule;
62 62
 		return $rule;
63 63
 	}
64 64
 
65
-	public function jsonSerialize(){
66
-		return ["identifier"=>$this->identifier,"rules"=>$this->rules];
65
+	public function jsonSerialize() {
66
+		return ["identifier"=>$this->identifier, "rules"=>$this->rules];
67 67
 	}
68 68
 
69 69
 	public function setDepends($depends) {
Please login to merge, or discard this patch.
Ajax/semantic/components/Dropdown.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
 	 * @param string $action one of "select","auto","activate","combo","nothing","hide"
18 18
 	 * @return \Ajax\semantic\components\Dropdown
19 19
 	 */
20
-	public function setAction($action){
21
-		return $this->setParamCtrl("action", $action,array("select","auto","activate","combo","nothing","hide"));
20
+	public function setAction($action) {
21
+		return $this->setParamCtrl("action", $action, array("select", "auto", "activate", "combo", "nothing", "hide"));
22 22
 	}
23 23
 
24 24
 	/**
@@ -26,15 +26,15 @@  discard block
 block discarded – undo
26 26
 	 * @param string $event Event used to trigger dropdown (Hover, Click, Custom Event)
27 27
 	 * @return \Ajax\semantic\components\Dropdown
28 28
 	 */
29
-	public function setOn($event){
29
+	public function setOn($event) {
30 30
 		return $this->setParam("on", $event);
31 31
 	}
32 32
 
33
-	public function setFullTextSearch($value){
33
+	public function setFullTextSearch($value) {
34 34
 		return $this->setParam("fullTextSearch", $value);
35 35
 	}
36 36
 
37
-	public function setShowOnFocus($value){
37
+	public function setShowOnFocus($value) {
38 38
 		return $this->setParam("showOnFocus", $value);
39 39
 	}
40 40
 }
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsEventsTrait.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
 trait JsUtilsEventsTrait {
12 12
 
13 13
 
14
-	protected $jquery_events=array (
15
-			"bind","blur","change","click","dblclick","delegate","die","error","focus","focusin","focusout","hover","keydown","keypress","keyup","live","load","mousedown","mousseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","off","on","one","ready","resize","scroll","select","submit","toggle","trigger","triggerHandler","undind","undelegate","unload"
14
+	protected $jquery_events=array(
15
+			"bind", "blur", "change", "click", "dblclick", "delegate", "die", "error", "focus", "focusin", "focusout", "hover", "keydown", "keypress", "keyup", "live", "load", "mousedown", "mousseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "off", "on", "one", "ready", "resize", "scroll", "select", "submit", "toggle", "trigger", "triggerHandler", "undind", "undelegate", "unload"
16 16
 	);
17 17
 
18
-	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true);
18
+	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true);
19 19
 
20 20
 	/**
21 21
 	 * Outputs a javascript library blur event
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 	 * @param boolean $stopPropagation
38 38
 	 * @return string
39 39
 	 */
40
-	public function change($element='this', $js='',$preventDefault=false,$stopPropagation=false) {
41
-		return $this->_add_event($element, $js, 'change',$preventDefault,$stopPropagation);
40
+	public function change($element='this', $js='', $preventDefault=false, $stopPropagation=false) {
41
+		return $this->_add_event($element, $js, 'change', $preventDefault, $stopPropagation);
42 42
 	}
43 43
 
44 44
 	/**
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
 	 * @param boolean $stopPropagation
52 52
 	 * @return string
53 53
 	 */
54
-	public function click($element='this', $js='', $ret_false=TRUE,$preventDefault=false,$stopPropagation=false) {
54
+	public function click($element='this', $js='', $ret_false=TRUE, $preventDefault=false, $stopPropagation=false) {
55 55
 		if (!is_array($js)) {
56
-			$js=array (
56
+			$js=array(
57 57
 					$js
58 58
 			);
59 59
 		}
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 			$js[]="return false;";
63 63
 		}
64 64
 
65
-		return $this->_add_event($element, $js, 'click',$preventDefault,$stopPropagation);
65
+		return $this->_add_event($element, $js, 'click', $preventDefault, $stopPropagation);
66 66
 	}
67 67
 
68 68
 	/**
Please login to merge, or discard this patch.
Ajax/semantic/components/validation/Rule.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @version 1.001
9 9
  * Generates a JSON Rule for the validation of a field
10 10
  */
11
-class Rule implements \JsonSerializable{
11
+class Rule implements \JsonSerializable {
12 12
 	/**
13 13
 	 * @var string
14 14
 	 */
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	private $value;
25 25
 
26
-	public function __construct($type,$prompt=NULL,$value=NULL){
26
+	public function __construct($type, $prompt=NULL, $value=NULL) {
27 27
 		$this->type=$type;
28 28
 		$this->prompt=$prompt;
29 29
 		$this->value=$value;
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
 	}
58 58
 
59 59
 	public function jsonSerialize() {
60
-		$result= ["type"=>$this->type];
61
-		if(isset($this->prompt))
60
+		$result=["type"=>$this->type];
61
+		if (isset($this->prompt))
62 62
 			$result["prompt"]=$this->prompt;
63
-		if(isset($this->value))
63
+		if (isset($this->value))
64 64
 			$result["value"]=$this->value;
65 65
 		return $result;
66 66
 	}
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 	 * @param string $prompt
72 72
 	 * @return \Ajax\semantic\components\validation\Rule
73 73
 	 */
74
-	public static function match($name,$prompt=NULL){
75
-		return new Rule("match[".$name."]",$prompt);
74
+	public static function match($name, $prompt=NULL) {
75
+		return new Rule("match[".$name."]", $prompt);
76 76
 	}
77 77
 
78 78
 	/**
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 	 * @param string $prompt
82 82
 	 * @return \Ajax\semantic\components\validation\Rule
83 83
 	 */
84
-	public static function different($name,$prompt=NULL){
85
-		return new Rule("different[".$name."]",$prompt);
84
+	public static function different($name, $prompt=NULL) {
85
+		return new Rule("different[".$name."]", $prompt);
86 86
 	}
87 87
 
88 88
 	/**
@@ -92,82 +92,82 @@  discard block
 block discarded – undo
92 92
 	 * @param string $prompt
93 93
 	 * @return \Ajax\semantic\components\validation\Rule
94 94
 	 */
95
-	public static function integer($min=NULL,$max=NULL,$prompt=NULL){
96
-		if(\is_int($min) && \is_int($max))
97
-			return new Rule("integer[{$min}..{$max}]",$prompt);
98
-		return new Rule("integer",$prompt);
95
+	public static function integer($min=NULL, $max=NULL, $prompt=NULL) {
96
+		if (\is_int($min) && \is_int($max))
97
+			return new Rule("integer[{$min}..{$max}]", $prompt);
98
+		return new Rule("integer", $prompt);
99 99
 	}
100 100
 
101
-	public static function decimal($prompt=NULL){
102
-		return new Rule("decimal",$prompt);
101
+	public static function decimal($prompt=NULL) {
102
+		return new Rule("decimal", $prompt);
103 103
 	}
104 104
 
105
-	public static function number($prompt=NULL){
106
-		return new Rule("number",$prompt);
105
+	public static function number($prompt=NULL) {
106
+		return new Rule("number", $prompt);
107 107
 	}
108 108
 
109
-	public static function is($value,$prompt=NULL){
110
-		return new Rule("is[".$value."]",$prompt);
109
+	public static function is($value, $prompt=NULL) {
110
+		return new Rule("is[".$value."]", $prompt);
111 111
 	}
112 112
 
113
-	public static function isExactly($value,$prompt=NULL){
114
-		return new Rule("isExactly[".$value."]",$prompt);
113
+	public static function isExactly($value, $prompt=NULL) {
114
+		return new Rule("isExactly[".$value."]", $prompt);
115 115
 	}
116 116
 
117
-	public static function not($value,$prompt=NULL){
118
-		return new Rule("not[".$value."]",$prompt);
117
+	public static function not($value, $prompt=NULL) {
118
+		return new Rule("not[".$value."]", $prompt);
119 119
 	}
120 120
 
121
-	public static function notExactly($value,$prompt=NULL){
122
-		return new Rule("notExactly[".$value."]",$prompt);
121
+	public static function notExactly($value, $prompt=NULL) {
122
+		return new Rule("notExactly[".$value."]", $prompt);
123 123
 	}
124 124
 
125
-	public static function contains($value,$prompt=NULL){
126
-		return new Rule("contains[".$value."]",$prompt);
125
+	public static function contains($value, $prompt=NULL) {
126
+		return new Rule("contains[".$value."]", $prompt);
127 127
 	}
128 128
 
129
-	public static function containsExactly($value,$prompt=NULL){
130
-		return new Rule("containsExactly[".$value."]",$prompt);
129
+	public static function containsExactly($value, $prompt=NULL) {
130
+		return new Rule("containsExactly[".$value."]", $prompt);
131 131
 	}
132 132
 
133
-	public static function doesntContain($value,$prompt=NULL){
134
-		return new Rule("doesntContain[".$value."]",$prompt);
133
+	public static function doesntContain($value, $prompt=NULL) {
134
+		return new Rule("doesntContain[".$value."]", $prompt);
135 135
 	}
136 136
 
137
-	public static function doesntContainExactly($value,$prompt=NULL){
138
-		return new Rule("doesntContainExactly[".$value."]",$prompt);
137
+	public static function doesntContainExactly($value, $prompt=NULL) {
138
+		return new Rule("doesntContainExactly[".$value."]", $prompt);
139 139
 	}
140 140
 
141
-	public static function minCount($value,$prompt=NULL){
142
-		return new Rule("minCount[".$value."]",$prompt);
141
+	public static function minCount($value, $prompt=NULL) {
142
+		return new Rule("minCount[".$value."]", $prompt);
143 143
 	}
144 144
 
145
-	public static function maxCount($value,$prompt=NULL){
146
-		return new Rule("maxCount[".$value."]",$prompt);
145
+	public static function maxCount($value, $prompt=NULL) {
146
+		return new Rule("maxCount[".$value."]", $prompt);
147 147
 	}
148 148
 
149
-	public static function exactCount($value,$prompt=NULL){
150
-		return new Rule("exactCount[".$value."]",$prompt);
149
+	public static function exactCount($value, $prompt=NULL) {
150
+		return new Rule("exactCount[".$value."]", $prompt);
151 151
 	}
152 152
 
153
-	public static function email($prompt=NULL){
154
-		return new Rule("email",$prompt);
153
+	public static function email($prompt=NULL) {
154
+		return new Rule("email", $prompt);
155 155
 	}
156 156
 
157
-	public static function url($prompt=NULL){
158
-		return new Rule("url",$prompt);
157
+	public static function url($prompt=NULL) {
158
+		return new Rule("url", $prompt);
159 159
 	}
160 160
 
161
-	public static function regExp($value,$prompt=NULL){
162
-		return new Rule("regExp",$prompt,$value);
161
+	public static function regExp($value, $prompt=NULL) {
162
+		return new Rule("regExp", $prompt, $value);
163 163
 	}
164 164
 
165
-	public static function custom($name,$jsFunction){
166
-		return "$.fn.form.settings.rules.".$name." =".$jsFunction ;
165
+	public static function custom($name, $jsFunction) {
166
+		return "$.fn.form.settings.rules.".$name." =".$jsFunction;
167 167
 	}
168 168
 
169
-	public static function ajax(JsUtils $js,$name,$url,$params,$jsCallback,$method="post",$parameters=[]){
170
-		$parameters=\array_merge(["async"=>false,"url"=>$url,"params"=>$params,"hasLoader"=>false,"jsCallback"=>$jsCallback,"dataType"=>"json","stopPropagation"=>false,"preventDefault"=>false,"responseElement"=>null],$parameters);
169
+	public static function ajax(JsUtils $js, $name, $url, $params, $jsCallback, $method="post", $parameters=[]) {
170
+		$parameters=\array_merge(["async"=>false, "url"=>$url, "params"=>$params, "hasLoader"=>false, "jsCallback"=>$jsCallback, "dataType"=>"json", "stopPropagation"=>false, "preventDefault"=>false, "responseElement"=>null], $parameters);
171 171
 		$ajax=new AjaxCall($method, $parameters);
172 172
 		return self::custom($name, "function(value){var result=true;".$ajax->compile($js)."return result;}");
173 173
 	}
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsInternalTrait.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@  discard block
 block discarded – undo
2 2
 namespace Ajax\common\traits;
3 3
 use Ajax\common\BaseGui;
4 4
 
5
-trait JsUtilsInternalTrait{
5
+trait JsUtilsInternalTrait {
6 6
 
7
-	protected $jquery_code_for_compile=array ();
8
-	protected $jquery_code_for_compile_at_last=array ();
7
+	protected $jquery_code_for_compile=array();
8
+	protected $jquery_code_for_compile_at_last=array();
9 9
 
10 10
 	protected function _addToCompile($jsScript) {
11 11
 		$this->jquery_code_for_compile[]=$jsScript;
@@ -15,28 +15,28 @@  discard block
 block discarded – undo
15 15
 	 * @param BaseGui $library
16 16
 	 * @param mixed $view
17 17
 	 */
18
-	protected function _compileLibrary(BaseGui $library=NULL, &$view=NULL){
19
-		if(isset($view))
18
+	protected function _compileLibrary(BaseGui $library=NULL, &$view=NULL) {
19
+		if (isset($view))
20 20
 			$library->compileHtml($this, $view);
21 21
 		if ($library->isAutoCompile()) {
22 22
 			$library->compile(true);
23 23
 		}
24 24
 	}
25 25
 
26
-	protected function defer($script){
26
+	protected function defer($script) {
27 27
 		$result="window.defer=function (method) {if (window.jQuery) method(); else setTimeout(function() { defer(method) }, 50);};";
28 28
 		$result.="window.defer(function(){".$script."})";
29 29
 		return $result;
30 30
 	}
31 31
 
32
-	protected function ready($script){
32
+	protected function ready($script) {
33 33
 		$result='$(document).ready(function() {'."\n";
34 34
 		$result.=$script.'})';
35 35
 		return $result;
36 36
 	}
37 37
 
38 38
 	protected function minify($input) {
39
-		if(trim($input) === "") return $input;
39
+		if (trim($input)==="") return $input;
40 40
 		return preg_replace(
41 41
 				array(
42 42
 						// Remove comment(s)
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/traits/FormTrait.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -14,27 +14,27 @@  discard block
 block discarded – undo
14 14
  * @author jc
15 15
  *
16 16
  */
17
-trait FormTrait{
17
+trait FormTrait {
18 18
 
19 19
 	/**
20 20
 	 * @return HtmlForm
21 21
 	 */
22 22
 	abstract protected function getForm();
23 23
 
24
-	protected function addCompoValidation(Form $compo,HtmlFormField $field){
24
+	protected function addCompoValidation(Form $compo, HtmlFormField $field) {
25 25
 		$validation=$field->getValidation();
26
-		if(isset($validation)){
26
+		if (isset($validation)) {
27 27
 			$validation->setIdentifier($field->getDataField()->getIdentifier());
28 28
 			$compo->addFieldValidation($validation);
29 29
 		}
30 30
 		return $compo;
31 31
 	}
32 32
 
33
-	protected function _runValidationParams(Form &$compo,JsUtils $js=NULL){
33
+	protected function _runValidationParams(Form &$compo, JsUtils $js=NULL) {
34 34
 		$form=$this->getForm();
35 35
 		$params=$form->getValidationParams();
36
-		if(isset($params["_ajaxSubmit"])){
37
-			$compilation=$this->_compileAjaxSubmit($params["_ajaxSubmit"],$js);
36
+		if (isset($params["_ajaxSubmit"])) {
37
+			$compilation=$this->_compileAjaxSubmit($params["_ajaxSubmit"], $js);
38 38
 			$this->onSuccess($compilation);
39 39
 			$form->removeValidationParam("_ajaxSubmit");
40 40
 		}
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 		$form->addEventsOnRun($js);
44 44
 	}
45 45
 
46
-	protected function _compileAjaxSubmit($ajaxSubmit,JsUtils $js=null){
46
+	protected function _compileAjaxSubmit($ajaxSubmit, JsUtils $js=null) {
47 47
 		$compilation="";
48
-		if(\is_array($ajaxSubmit)){
49
-			foreach ($ajaxSubmit as $ajaxSubmitItem){
48
+		if (\is_array($ajaxSubmit)) {
49
+			foreach ($ajaxSubmit as $ajaxSubmitItem) {
50 50
 				$compilation.=$ajaxSubmitItem->compile($js);
51 51
 			}
52
-		}elseif($ajaxSubmit instanceof AjaxCall){
52
+		}elseif ($ajaxSubmit instanceof AjaxCall) {
53 53
 			$compilation=$ajaxSubmit->compile($js);
54 54
 		}
55
-		$compilation=str_ireplace("\"","%quote%", $compilation);
55
+		$compilation=str_ireplace("\"", "%quote%", $compilation);
56 56
 		return $compilation;
57 57
 	}
58 58
 
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
 		return $this;
66 66
 	}
67 67
 
68
-	public function setAttached($value=true){
68
+	public function setAttached($value=true) {
69 69
 		$form=$this->getForm();
70
-		if($value)
71
-			$form->addToPropertyCtrl("class", "attached", array ("attached" ));
70
+		if ($value)
71
+			$form->addToPropertyCtrl("class", "attached", array("attached"));
72 72
 		return $form;
73 73
 	}
74 74
 
75
-	public function addErrorMessage(){
75
+	public function addErrorMessage() {
76 76
 		return $this->getForm()->addContent((new HtmlMessage(""))->setError());
77 77
 	}
78 78
 
@@ -88,47 +88,47 @@  discard block
 block discarded – undo
88 88
 	 * @param array $parameters
89 89
 	 * @return HtmlForm
90 90
 	 */
91
-	public function submitOn($event,$identifierOrElement,$url,$responseElement,$parameters=NULL){
91
+	public function submitOn($event, $identifierOrElement, $url, $responseElement, $parameters=NULL) {
92 92
 		$form=$this->getForm();
93
-		if($identifierOrElement  instanceof BaseHtml)
93
+		if ($identifierOrElement  instanceof BaseHtml)
94 94
 			$elem=$identifierOrElement;
95 95
 		else
96 96
 			$elem=$form->getElementById($identifierOrElement, $form->getContent());
97
-		if(isset($elem)){
98
-			$this->_buttonAsSubmit($elem, $event,$url,$responseElement,$parameters);
97
+		if (isset($elem)) {
98
+			$this->_buttonAsSubmit($elem, $event, $url, $responseElement, $parameters);
99 99
 		}
100 100
 		return $form;
101 101
 	}
102 102
 
103
-	public function submitOnClick($identifier,$url,$responseElement,$parameters=NULL){
104
-		return $this->submitOn("click", $identifier, $url, $responseElement,$parameters);
103
+	public function submitOnClick($identifier, $url, $responseElement, $parameters=NULL) {
104
+		return $this->submitOn("click", $identifier, $url, $responseElement, $parameters);
105 105
 	}
106 106
 
107
-	public function addSubmit($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$parameters=NULL){
108
-		$bt=$this->getForm()->addButton($identifier, $value,$cssStyle);
109
-		return $this->_buttonAsSubmit($bt, "click",$url,$responseElement,$parameters);
107
+	public function addSubmit($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) {
108
+		$bt=$this->getForm()->addButton($identifier, $value, $cssStyle);
109
+		return $this->_buttonAsSubmit($bt, "click", $url, $responseElement, $parameters);
110 110
 	}
111 111
 
112
-	protected function _buttonAsSubmit(BaseHtml &$button,$event,$url,$responseElement=NULL,$parameters=NULL){
112
+	protected function _buttonAsSubmit(BaseHtml &$button, $event, $url, $responseElement=NULL, $parameters=NULL) {
113 113
 		$form=$this->getForm();
114
-		if(isset($url) && isset($responseElement)){
115
-			$button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');",true,true);
116
-			$this->setSubmitParams($url,$responseElement,$parameters);
114
+		if (isset($url) && isset($responseElement)) {
115
+			$button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');", true, true);
116
+			$this->setSubmitParams($url, $responseElement, $parameters);
117 117
 		}
118 118
 		return $button;
119 119
 	}
120 120
 
121
-	public function setSubmitParams($url,$responseElement=NULL,$parameters=NULL){
121
+	public function setSubmitParams($url, $responseElement=NULL, $parameters=NULL) {
122 122
 		$form=$this->getForm();
123
-		$params=["form"=>$form->getIdentifier(),"responseElement"=>$responseElement,"url"=>$url,"stopPropagation"=>true];
124
-		if(\is_array($parameters))
125
-			$params=\array_merge($params,$parameters);
123
+		$params=["form"=>$form->getIdentifier(), "responseElement"=>$responseElement, "url"=>$url, "stopPropagation"=>true];
124
+		if (\is_array($parameters))
125
+			$params=\array_merge($params, $parameters);
126 126
 		$form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", $params));
127 127
 		return $this;
128 128
 	}
129 129
 
130
-	public function addReset($identifier,$value,$cssStyle=NULL){
131
-		$bt=$this->getForm()->addButton($identifier, $value,$cssStyle);
130
+	public function addReset($identifier, $value, $cssStyle=NULL) {
131
+		$bt=$this->getForm()->addButton($identifier, $value, $cssStyle);
132 132
 		$bt->setProperty("type", "reset");
133 133
 		return $bt;
134 134
 	}
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 * @param string $jsCode
139 139
 	 * @return \Ajax\semantic\html\collections\form\HtmlForm
140 140
 	 */
141
-	public function onValid($jsCode){
141
+	public function onValid($jsCode) {
142 142
 		$form=$this->getForm();
143 143
 		$form->addValidationParam("onValid", "%function(){".$jsCode."}%");
144 144
 		return $form;
@@ -149,9 +149,9 @@  discard block
 block discarded – undo
149 149
 	 * @param string $jsCode can use event and fields parameters
150 150
 	 * @return HtmlForm
151 151
 	 */
152
-	public function onSuccess($jsCode){
152
+	public function onSuccess($jsCode) {
153 153
 		$form=$this->getForm();
154
-		$form->addValidationParam("onSuccess", $jsCode,"%function(event,fields){","}%");
154
+		$form->addValidationParam("onSuccess", $jsCode, "%function(event,fields){", "}%");
155 155
 		return $form;
156 156
 	}
157 157
 }
Please login to merge, or discard this patch.