@@ -11,7 +11,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -11,8 +11,8 @@ discard block |
||
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 |
||
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 | } |
@@ -7,20 +7,20 @@ discard block |
||
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 |
||
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 | } |
@@ -26,7 +26,7 @@ discard block |
||
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 |
||
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 |
@@ -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)) { |
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 | } |
@@ -67,19 +67,19 @@ discard block |
||
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; |
@@ -6,8 +6,8 @@ |
||
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 | /** |
@@ -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); |
@@ -21,7 +21,7 @@ discard block |
||
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 |
||
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; |
@@ -39,7 +39,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -3,26 +3,26 @@ |
||
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); |