@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | class HtmlOption extends HtmlDoubleElement { |
11 | 11 | protected $value; |
12 | 12 | protected $selected; |
13 | - public function __construct($identifier,$caption,$value="") { |
|
13 | + public function __construct($identifier, $caption, $value="") { |
|
14 | 14 | parent::__construct($identifier, "option"); |
15 | 15 | $this->_template='<option id="%identifier%" value="%value%" %selected% %properties%>%content%</option>'; |
16 | 16 | $this->content=$caption; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $this->selected=""; |
19 | 19 | } |
20 | 20 | |
21 | - public function select(){ |
|
21 | + public function select() { |
|
22 | 22 | $this->selected="selected"; |
23 | 23 | return $this; |
24 | 24 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | return $this->value; |
28 | 28 | } |
29 | 29 | public function setValue($value) { |
30 | - $this->value = $value; |
|
30 | + $this->value=$value; |
|
31 | 31 | return $this; |
32 | 32 | } |
33 | 33 |
@@ -7,7 +7,7 @@ |
||
7 | 7 | |
8 | 8 | class HtmlImg extends HtmlSingleElement { |
9 | 9 | |
10 | - public function __construct($identifier,$src="",$alt="") { |
|
10 | + public function __construct($identifier, $src="", $alt="") { |
|
11 | 11 | parent::__construct($identifier, "img"); |
12 | 12 | $this->setSrc($src); |
13 | 13 | $this->setAlt($alt); |
@@ -7,26 +7,26 @@ |
||
7 | 7 | |
8 | 8 | class HtmlTextarea extends HtmlDoubleElement { |
9 | 9 | |
10 | - public function __construct($identifier,$value=NULL,$placeholder=NULL,$rows=NULL) { |
|
10 | + public function __construct($identifier, $value=NULL, $placeholder=NULL, $rows=NULL) { |
|
11 | 11 | parent::__construct($identifier, "textarea"); |
12 | 12 | $this->setValue($value); |
13 | 13 | $this->setPlaceholder($placeholder); |
14 | - if(isset($rows)) |
|
14 | + if (isset($rows)) |
|
15 | 15 | $this->setRows($rows); |
16 | 16 | } |
17 | 17 | public function setValue($value) { |
18 | - if(isset($value)) |
|
18 | + if (isset($value)) |
|
19 | 19 | $this->setContent($value); |
20 | 20 | return $this; |
21 | 21 | } |
22 | 22 | |
23 | - public function setPlaceholder($value){ |
|
24 | - if(JString::isNotNull($value)) |
|
23 | + public function setPlaceholder($value) { |
|
24 | + if (JString::isNotNull($value)) |
|
25 | 25 | $this->setProperty("placeholder", $value); |
26 | 26 | return $this; |
27 | 27 | } |
28 | 28 | |
29 | - public function setRows($count){ |
|
29 | + public function setRows($count) { |
|
30 | 30 | $this->setProperty("rows", $count); |
31 | 31 | } |
32 | 32 | } |
33 | 33 | \ No newline at end of file |
@@ -14,8 +14,8 @@ |
||
14 | 14 | parent::__construct($identifier, "ul"); |
15 | 15 | $this->addItems($items); |
16 | 16 | } |
17 | - public function setOrdered($ordered=true){ |
|
18 | - $this->tagName=($ordered===true)?"ol":"ul"; |
|
17 | + public function setOrdered($ordered=true) { |
|
18 | + $this->tagName=($ordered===true) ? "ol" : "ul"; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | $output=$input; |
13 | 13 | } |
14 | 14 | if (is_array($input)) { |
15 | - if (sizeof($input) > 0) { |
|
16 | - if (self::containsElement($input) === false) { |
|
15 | + if (sizeof($input)>0) { |
|
16 | + if (self::containsElement($input)===false) { |
|
17 | 17 | $output=self::wrapStrings($input, $js, $separator=' ', $valueQuote='"'); |
18 | 18 | } else { |
19 | 19 | $output=self::wrapObjects($input, $js, $separator, $valueQuote); |
@@ -24,17 +24,17 @@ discard block |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | private static function containsElement($input) { |
27 | - foreach ( $input as $v ) { |
|
28 | - if (\is_object($v) === true || \is_array($v)) |
|
27 | + foreach ($input as $v) { |
|
28 | + if (\is_object($v)===true || \is_array($v)) |
|
29 | 29 | return true; |
30 | 30 | } |
31 | 31 | return false; |
32 | 32 | } |
33 | 33 | |
34 | 34 | public static function wrapStrings($input, $js, $separator=' ', $valueQuote='"') { |
35 | - if (JArray::isAssociative($input) === true) { |
|
36 | - $result=implode($separator, array_map(function ($v, $k) use($valueQuote) { |
|
37 | - return $k . '=' . $valueQuote . $v . $valueQuote; |
|
35 | + if (JArray::isAssociative($input)===true) { |
|
36 | + $result=implode($separator, array_map(function($v, $k) use($valueQuote) { |
|
37 | + return $k.'='.$valueQuote.$v.$valueQuote; |
|
38 | 38 | }, $input, array_keys($input))); |
39 | 39 | } else { |
40 | 40 | $result=implode($separator, array_values($input)); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | public static function wrapObjects($input, $js=NULL, $separator=' ', $valueQuote='"') { |
46 | - return implode($separator, array_map(function ($v) use($js, $separator, $valueQuote) { |
|
46 | + return implode($separator, array_map(function($v) use($js, $separator, $valueQuote) { |
|
47 | 47 | if (is_object($v)) |
48 | 48 | return $v->compile($js); |
49 | 49 | elseif (\is_array($v)) { |
@@ -13,7 +13,7 @@ discard block |
||
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); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function fromArray($array) { |
46 | 46 | $array=parent::fromArray($array); |
47 | - foreach ( $array as $key => $value ) { |
|
47 | + foreach ($array as $key => $value) { |
|
48 | 48 | $this->setProperty($key, $value); |
49 | 49 | } |
50 | 50 | return $array; |
@@ -27,15 +27,15 @@ discard block |
||
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)===false) { |
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 |
||
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 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | if ($stopPropagation===true) { |
31 | 31 | $result.="event.stopPropagation();\n"; |
32 | 32 | } |
33 | - switch($this->method) { |
|
33 | + switch ($this->method) { |
|
34 | 34 | case "get": |
35 | 35 | $result.=$js->getDeferred($url, $responseElement, $params, $callback, $attr); |
36 | 36 | break; |
@@ -4,24 +4,24 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Support\Facades\App; |
6 | 6 | |
7 | -class JsUtils extends \Ajax\JsUtils{ |
|
8 | - public function getUrl($url){ |
|
7 | +class JsUtils extends \Ajax\JsUtils { |
|
8 | + public function getUrl($url) { |
|
9 | 9 | return \url($url); |
10 | 10 | } |
11 | - public function addViewElement($identifier,$content,&$view){ |
|
11 | + public function addViewElement($identifier, $content, &$view) { |
|
12 | 12 | $controls=$view->__get("q"); |
13 | - if (isset($controls) === false) { |
|
14 | - $controls=array (); |
|
13 | + if (isset($controls)===false) { |
|
14 | + $controls=array(); |
|
15 | 15 | } |
16 | 16 | $controls[$identifier]=$content; |
17 | 17 | $view->__set("q", $controls); |
18 | 18 | } |
19 | 19 | |
20 | - public function createScriptVariable(&$view,$view_var, $output){ |
|
21 | - $view->__set($view_var,$output); |
|
20 | + public function createScriptVariable(&$view, $view_var, $output) { |
|
21 | + $view->__set($view_var, $output); |
|
22 | 22 | } |
23 | 23 | |
24 | - public function forward($initialControllerInstance,$controllerName,$actionName,$params=NULL){ |
|
24 | + public function forward($initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
25 | 25 | \ob_start(); |
26 | 26 | App::make($controllerName)->{$actionName}($params); |
27 | 27 | $result=\ob_get_contents(); |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | return $result; |
30 | 30 | } |
31 | 31 | |
32 | - public function renderContent($initialControllerInstance,$viewName, $params=NULL) { |
|
33 | - return \view()->make($viewName,$params)->render(); |
|
32 | + public function renderContent($initialControllerInstance, $viewName, $params=NULL) { |
|
33 | + return \view()->make($viewName, $params)->render(); |
|
34 | 34 | } |
35 | 35 | |
36 | - public function fromDispatcher($dispatcher){ |
|
36 | + public function fromDispatcher($dispatcher) { |
|
37 | 37 | return $dispatcher->segments(); |
38 | 38 | } |
39 | 39 | } |
40 | 40 | \ No newline at end of file |