Completed
Push — master ( 751bb4...735cac )
by Jean-Christophe
04:44
created
Ajax/semantic/html/modules/HtmlSearch.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
 use Ajax\semantic\html\base\constants\Direction;
9 9
 
10 10
 class HtmlSearch extends HtmlSemDoubleElement {
11
-	private $_elements=array ();
12
-	private $_params=array ();
13
-	private $_searchFields=array ("title" );
11
+	private $_elements=array();
12
+	private $_params=array();
13
+	private $_searchFields=array("title");
14 14
 
15 15
 	public function __construct($identifier, $placeholder=NULL, $icon=NULL) {
16
-		parent::__construct("search-" . $identifier, "div", "ui search", array ());
16
+		parent::__construct("search-".$identifier, "div", "ui search", array());
17 17
 		$this->createField($placeholder, $icon);
18 18
 		$this->createResult();
19 19
 		$this->_params["type"]="standard";
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 
22 22
 	private function createField($placeholder=NULL, $icon=NULL) {
23 23
 		$field=new HtmlInput($this->identifier);
24
-		if (isset($placeholder) === true)
24
+		if (isset($placeholder)===true)
25 25
 			$field->setPlaceholder($placeholder);
26
-		if (isset($icon) === true)
26
+		if (isset($icon)===true)
27 27
 			$field->addIcon($icon, Direction::RIGHT);
28 28
 		$field->getField()->setClass("prompt");
29 29
 		$this->content["field"]=$field;
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	}
32 32
 
33 33
 	private function createResult() {
34
-		$this->content["result"]=new HtmlSemDoubleElement("results-" . $this->identifier, "div", "results");
34
+		$this->content["result"]=new HtmlSemDoubleElement("results-".$this->identifier, "div", "results");
35 35
 		return $this->content["result"];
36 36
 	}
37 37
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	}
47 47
 
48 48
 	public function setUrl($url) {
49
-		$this->_params["apiSettings"]="%{url: %quote%" . $url . "%quote%}%";
49
+		$this->_params["apiSettings"]="%{url: %quote%".$url."%quote%}%";
50 50
 		return $this;
51 51
 	}
52 52
 
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
 	public function run(JsUtils $js) {
68 68
 		$searchFields=\json_encode($this->_searchFields);
69 69
 		$searchFields=str_ireplace("\"", "%quote%", $searchFields);
70
-		$this->_params["searchFields"]="%" . $searchFields . "%";
71
-		if ($this->getType() === "standard")
70
+		$this->_params["searchFields"]="%".$searchFields."%";
71
+		if ($this->getType()==="standard")
72 72
 			$this->_params["source"]="%content%";
73
-		$this->addEvent("beforeExecute", "var content=" . $this->resultsToJson() . ";");
74
-		if (isset($this->_bsComponent) === false) {
75
-			$this->_bsComponent=$js->semantic()->search("#" . $this->identifier, $this->_params);
73
+		$this->addEvent("beforeExecute", "var content=".$this->resultsToJson().";");
74
+		if (isset($this->_bsComponent)===false) {
75
+			$this->_bsComponent=$js->semantic()->search("#".$this->identifier, $this->_params);
76 76
 		}
77 77
 		$this->addEventsOnRun($js);
78 78
 		return $this->_bsComponent;
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,10 +21,12 @@  discard block
 block discarded – undo
21 21
 
22 22
 	private function createField($placeholder=NULL, $icon=NULL) {
23 23
 		$field=new HtmlInput($this->identifier);
24
-		if (isset($placeholder) === true)
25
-			$field->setPlaceholder($placeholder);
26
-		if (isset($icon) === true)
27
-			$field->addIcon($icon, Direction::RIGHT);
24
+		if (isset($placeholder) === true) {
25
+					$field->setPlaceholder($placeholder);
26
+		}
27
+		if (isset($icon) === true) {
28
+					$field->addIcon($icon, Direction::RIGHT);
29
+		}
28 30
 		$field->getField()->setClass("prompt");
29 31
 		$this->content["field"]=$field;
30 32
 		return $field;
@@ -68,8 +70,9 @@  discard block
 block discarded – undo
68 70
 		$searchFields=\json_encode($this->_searchFields);
69 71
 		$searchFields=str_ireplace("\"", "%quote%", $searchFields);
70 72
 		$this->_params["searchFields"]="%" . $searchFields . "%";
71
-		if ($this->getType() === "standard")
72
-			$this->_params["source"]="%content%";
73
+		if ($this->getType() === "standard") {
74
+					$this->_params["source"]="%content%";
75
+		}
73 76
 		$this->addEvent("beforeExecute", "var content=" . $this->resultsToJson() . ";");
74 77
 		if (isset($this->_bsComponent) === false) {
75 78
 			$this->_bsComponent=$js->semantic()->search("#" . $this->identifier, $this->_params);
Please login to merge, or discard this patch.