@@ -11,7 +11,7 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class Animation extends BaseComponent { |
| 13 | 13 | |
| 14 | - public function __construct($duration = 400, $easing = "swing", $queue = false) { |
|
| 14 | + public function __construct($duration=400, $easing="swing", $queue=false) { |
|
| 15 | 15 | $this->setDuration($duration); |
| 16 | 16 | $this->setEasing($easing); |
| 17 | 17 | $this->setQueue($queue); |
@@ -23,22 +23,22 @@ discard block |
||
| 23 | 23 | class HtmlSemDoubleElement extends HtmlDoubleElement { |
| 24 | 24 | use BaseTrait; |
| 25 | 25 | |
| 26 | - protected $_popup = NULL; |
|
| 26 | + protected $_popup=NULL; |
|
| 27 | 27 | |
| 28 | - protected $_dimmer = NULL; |
|
| 28 | + protected $_dimmer=NULL; |
|
| 29 | 29 | |
| 30 | - protected $_toast = NULL; |
|
| 30 | + protected $_toast=NULL; |
|
| 31 | 31 | |
| 32 | - protected $_sidebar = NULL; |
|
| 32 | + protected $_sidebar=NULL; |
|
| 33 | 33 | |
| 34 | - protected $_params = array(); |
|
| 34 | + protected $_params=array(); |
|
| 35 | 35 | |
| 36 | - public function __construct($identifier, $tagName = "p", $baseClass = "ui", $content = NULL) { |
|
| 36 | + public function __construct($identifier, $tagName="p", $baseClass="ui", $content=NULL) { |
|
| 37 | 37 | parent::__construct($identifier, $tagName); |
| 38 | - $this->_baseClass = $baseClass; |
|
| 38 | + $this->_baseClass=$baseClass; |
|
| 39 | 39 | $this->setClass($baseClass); |
| 40 | 40 | if (isset($content)) { |
| 41 | - $this->content = $content; |
|
| 41 | + $this->content=$content; |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param string $variation |
| 49 | 49 | * @param string $popupEvent |
| 50 | 50 | */ |
| 51 | - public function setPopupAttributes($variation = NULL, $popupEvent = NULL) { |
|
| 51 | + public function setPopupAttributes($variation=NULL, $popupEvent=NULL) { |
|
| 52 | 52 | if (isset($this->_popup)) |
| 53 | 53 | $this->_popup->setAttributes($variation, $popupEvent); |
| 54 | 54 | } |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | * @param array $params |
| 63 | 63 | * @return HtmlSemDoubleElement |
| 64 | 64 | */ |
| 65 | - public function addPopup($title = "", $content = "", $variation = NULL, $params = array()) { |
|
| 66 | - $this->_popup = new InternalPopup($this, $title, $content, $variation, $params); |
|
| 65 | + public function addPopup($title="", $content="", $variation=NULL, $params=array()) { |
|
| 66 | + $this->_popup=new InternalPopup($this, $title, $content, $variation, $params); |
|
| 67 | 67 | return $this; |
| 68 | 68 | } |
| 69 | 69 | |
@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | * @param array $params |
| 76 | 76 | * @return HtmlSemDoubleElement |
| 77 | 77 | */ |
| 78 | - public function addPopupHtml($html = "", $variation = NULL, $params = array()) { |
|
| 79 | - $this->_popup = new InternalPopup($this); |
|
| 78 | + public function addPopupHtml($html="", $variation=NULL, $params=array()) { |
|
| 79 | + $this->_popup=new InternalPopup($this); |
|
| 80 | 80 | $this->_popup->setHtml($html); |
| 81 | 81 | $this->_popup->setAttributes($variation, $params); |
| 82 | 82 | return $this; |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | * @param mixed $content |
| 90 | 90 | * @return HtmlDimmer |
| 91 | 91 | */ |
| 92 | - public function addDimmer($params = array(), $content = NULL) { |
|
| 93 | - $dimmer = new HtmlDimmer("dimmer-" . $this->identifier, $content); |
|
| 92 | + public function addDimmer($params=array(), $content=NULL) { |
|
| 93 | + $dimmer=new HtmlDimmer("dimmer-".$this->identifier, $content); |
|
| 94 | 94 | $dimmer->setParams($params); |
| 95 | 95 | $dimmer->setContainer($this); |
| 96 | 96 | $this->addContent($dimmer); |
@@ -105,10 +105,10 @@ discard block |
||
| 105 | 105 | * @param string $icon |
| 106 | 106 | * @return mixed|HtmlLabel |
| 107 | 107 | */ |
| 108 | - public function addLabel($label, $before = false, $icon = NULL) { |
|
| 109 | - $labelO = $label; |
|
| 110 | - if (\is_object($label) === false) { |
|
| 111 | - $labelO = new HtmlLabel("label-" . $this->identifier, $label); |
|
| 108 | + public function addLabel($label, $before=false, $icon=NULL) { |
|
| 109 | + $labelO=$label; |
|
| 110 | + if (\is_object($label)===false) { |
|
| 111 | + $labelO=new HtmlLabel("label-".$this->identifier, $label); |
|
| 112 | 112 | if (isset($icon)) |
| 113 | 113 | $labelO->addIcon($icon); |
| 114 | 114 | } else { |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | * @param string $icon |
| 130 | 130 | * @return HtmlSemDoubleElement |
| 131 | 131 | */ |
| 132 | - public function attachLabel($label, $side = Side::TOP, $direction = Direction::NONE, $icon = NULL) { |
|
| 133 | - $label = $this->addLabel($label, true, $icon); |
|
| 132 | + public function attachLabel($label, $side=Side::TOP, $direction=Direction::NONE, $icon=NULL) { |
|
| 133 | + $label=$this->addLabel($label, true, $icon); |
|
| 134 | 134 | $label->setAttached($side, $direction); |
| 135 | 135 | return $this; |
| 136 | 136 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * |
| 141 | 141 | * @return HtmlSemDoubleElement |
| 142 | 142 | */ |
| 143 | - public function asLink($href = NULL, $target = NULL) { |
|
| 143 | + public function asLink($href=NULL, $target=NULL) { |
|
| 144 | 144 | if (isset($href)) |
| 145 | 145 | $this->setProperty("href", $href); |
| 146 | 146 | if (isset($target)) |
@@ -154,11 +154,11 @@ discard block |
||
| 154 | 154 | * @param boolean $show |
| 155 | 155 | * @return string |
| 156 | 156 | */ |
| 157 | - public function jsShowDimmer($show = true) { |
|
| 158 | - $status = "hide"; |
|
| 159 | - if ($show === true) |
|
| 160 | - $status = "show"; |
|
| 161 | - return '$("#.' . $this->identifier . ').dimmer("' . $status . '");'; |
|
| 157 | + public function jsShowDimmer($show=true) { |
|
| 158 | + $status="hide"; |
|
| 159 | + if ($show===true) |
|
| 160 | + $status="show"; |
|
| 161 | + return '$("#.'.$this->identifier.').dimmer("'.$status.'");'; |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * {@inheritdoc} |
| 167 | 167 | * @see BaseHtml::compile() |
| 168 | 168 | */ |
| 169 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
| 169 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 170 | 170 | if (isset($this->_popup)) { |
| 171 | 171 | $this->_popup->compile($js); |
| 172 | 172 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | * @see HtmlDoubleElement::run() |
| 180 | 180 | */ |
| 181 | 181 | public function run(JsUtils $js) { |
| 182 | - $this->_bsComponent = $js->semantic()->generic("#" . $this->identifier); |
|
| 182 | + $this->_bsComponent=$js->semantic()->generic("#".$this->identifier); |
|
| 183 | 183 | parent::run($js); |
| 184 | 184 | $this->addEventsOnRun($js); |
| 185 | 185 | if (isset($this->_popup)) { |
@@ -197,8 +197,8 @@ discard block |
||
| 197 | 197 | * @param boolean $ordered |
| 198 | 198 | * @return \Ajax\common\html\html5\HtmlList |
| 199 | 199 | */ |
| 200 | - public function addList($items, $ordered = false) { |
|
| 201 | - $list = new HtmlList("list-" . $this->identifier, $items); |
|
| 200 | + public function addList($items, $ordered=false) { |
|
| 201 | + $list=new HtmlList("list-".$this->identifier, $items); |
|
| 202 | 202 | $list->setOrdered($ordered); |
| 203 | 203 | $list->setClass("ui list"); |
| 204 | 204 | $this->addContent($list); |
@@ -210,9 +210,9 @@ discard block |
||
| 210 | 210 | * @param ?array $params |
| 211 | 211 | * @return \Ajax\semantic\components\Toast |
| 212 | 212 | */ |
| 213 | - public function asToast($params = NULL) { |
|
| 214 | - $this->_toast = new Toast(); |
|
| 215 | - $this->_toast->attach('#' . $this->_identifier); |
|
| 213 | + public function asToast($params=NULL) { |
|
| 214 | + $this->_toast=new Toast(); |
|
| 215 | + $this->_toast->attach('#'.$this->_identifier); |
|
| 216 | 216 | $this->setProperty('style', 'display:none;'); |
| 217 | 217 | if (isset($params)) { |
| 218 | 218 | $this->_toast->setParams($params); |
@@ -226,8 +226,8 @@ discard block |
||
| 226 | 226 | * @param string $classes |
| 227 | 227 | * @return \Ajax\semantic\components\Sidebar |
| 228 | 228 | */ |
| 229 | - public function asSideBar($classes = '') { |
|
| 230 | - $this->_sidebar = new Sidebar(); |
|
| 229 | + public function asSideBar($classes='') { |
|
| 230 | + $this->_sidebar=new Sidebar(); |
|
| 231 | 231 | $this->addToProperty('class', 'sidebar'); |
| 232 | 232 | return $this->_sidebar; |
| 233 | 233 | } |
@@ -14,9 +14,9 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | class Sidebar extends SimpleSemExtComponent { |
| 16 | 16 | |
| 17 | - public function __construct(JsUtils $js = NULL) { |
|
| 17 | + public function __construct(JsUtils $js=NULL) { |
|
| 18 | 18 | parent::__construct($js); |
| 19 | - $this->uiName = 'sidebar'; |
|
| 19 | + $this->uiName='sidebar'; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | public function show() { |
@@ -46,32 +46,32 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | public function setContext($value) { |
| 49 | - $this->params['context'] = $value; |
|
| 49 | + $this->params['context']=$value; |
|
| 50 | 50 | return $this; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - public function setExclusive($value = true) { |
|
| 54 | - $this->params['exclusive'] = true; |
|
| 53 | + public function setExclusive($value=true) { |
|
| 54 | + $this->params['exclusive']=true; |
|
| 55 | 55 | return $this; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - public function setClosable($value = true) { |
|
| 59 | - $this->params['closable'] = $value; |
|
| 58 | + public function setClosable($value=true) { |
|
| 59 | + $this->params['closable']=$value; |
|
| 60 | 60 | return $this; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - public function setDimPage($value = true) { |
|
| 64 | - $this->params['dimPage'] = $value; |
|
| 63 | + public function setDimPage($value=true) { |
|
| 64 | + $this->params['dimPage']=$value; |
|
| 65 | 65 | return $this; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - public function setScrollLock($value = false) { |
|
| 69 | - $this->params['scrollLock'] = $value; |
|
| 68 | + public function setScrollLock($value=false) { |
|
| 69 | + $this->params['scrollLock']=$value; |
|
| 70 | 70 | return $this; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - public function setReturnScroll($value = false) { |
|
| 74 | - $this->params['returnScroll'] = $value; |
|
| 73 | + public function setReturnScroll($value=false) { |
|
| 74 | + $this->params['returnScroll']=$value; |
|
| 75 | 75 | return $this; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | protected $js; |
| 31 | 31 | |
| 32 | - public function __construct($autoCompile = true) { |
|
| 33 | - $this->autoCompile = $autoCompile; |
|
| 34 | - $this->components = array(); |
|
| 35 | - $this->htmlComponents = array(); |
|
| 32 | + public function __construct($autoCompile=true) { |
|
| 33 | + $this->autoCompile=$autoCompile; |
|
| 34 | + $this->components=array(); |
|
| 35 | + $this->htmlComponents=array(); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function isAutoCompile() { |
@@ -40,12 +40,12 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function setAutoCompile($autoCompile) { |
| 43 | - $this->autoCompile = $autoCompile; |
|
| 43 | + $this->autoCompile=$autoCompile; |
|
| 44 | 44 | return $this; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function compile($internal = false) { |
|
| 48 | - if ($internal === false && $this->autoCompile === true) |
|
| 47 | + public function compile($internal=false) { |
|
| 48 | + if ($internal===false && $this->autoCompile===true) |
|
| 49 | 49 | throw new \Exception("Impossible to compile if autoCompile is set to 'true'"); |
| 50 | 50 | foreach ($this->components as $component) { |
| 51 | 51 | $component->compile(); |
@@ -53,20 +53,20 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | public function setJs(JsUtils $js) { |
| 56 | - $this->js = $js; |
|
| 56 | + $this->js=$js; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | public function addComponent(SimpleComponent $component, $attachTo, $params) { |
| 60 | 60 | if ($this->autoCompile) { |
| 61 | - if ($attachTo != null) { |
|
| 62 | - if (! isset($this->components[$attachTo])) { |
|
| 63 | - $this->components[$attachTo] = $component; |
|
| 61 | + if ($attachTo!=null) { |
|
| 62 | + if (!isset($this->components[$attachTo])) { |
|
| 63 | + $this->components[$attachTo]=$component; |
|
| 64 | 64 | } else { |
| 65 | - $this->components[] = $component; |
|
| 65 | + $this->components[]=$component; |
|
| 66 | 66 | } |
| 67 | 67 | $component->attach($attachTo); |
| 68 | 68 | } else { |
| 69 | - $this->components[] = $component; |
|
| 69 | + $this->components[]=$component; |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | if (isset($params)) |
@@ -76,11 +76,11 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | public function addHtmlComponent(BaseHtml $htmlComponent) { |
| 79 | - $this->htmlComponents[$htmlComponent->getIdentifier()] = $htmlComponent; |
|
| 79 | + $this->htmlComponents[$htmlComponent->getIdentifier()]=$htmlComponent; |
|
| 80 | 80 | return $htmlComponent; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - public function compileHtml(JsUtils $js = NULL, &$view = NULL) { |
|
| 83 | + public function compileHtml(JsUtils $js=NULL, &$view=NULL) { |
|
| 84 | 84 | foreach ($this->htmlComponents as $htmlComponent) { |
| 85 | 85 | $htmlComponent->compile($js, $view); |
| 86 | 86 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | return array_filter($this->htmlComponents, $callback); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - public function getHtmlComponent($identifier){ |
|
| 94 | - return $this->htmlComponents[$identifier]??''; |
|
| 93 | + public function getHtmlComponent($identifier) { |
|
| 94 | + return $this->htmlComponents[$identifier] ?? ''; |
|
| 95 | 95 | } |
| 96 | 96 | } |
@@ -3,28 +3,28 @@ discard block |
||
| 3 | 3 | |
| 4 | 4 | class Javascript { |
| 5 | 5 | |
| 6 | - public static $preventDefault = "\nif(event && event.preventDefault) event.preventDefault();\n"; |
|
| 6 | + public static $preventDefault="\nif(event && event.preventDefault) event.preventDefault();\n"; |
|
| 7 | 7 | |
| 8 | - public static $stopPropagation = "\nif(event && event.stopPropagation) event.stopPropagation();\n"; |
|
| 8 | + public static $stopPropagation="\nif(event && event.stopPropagation) event.stopPropagation();\n"; |
|
| 9 | 9 | |
| 10 | - public static function draggable($attr = "id") { |
|
| 11 | - return 'var dt=event.dataTransfer || event.originalEvent.dataTransfer;dt.setData("text/plain",JSON.stringify({id:$(event.target).attr("id"),data:$(event.target).attr("' . $attr . '")}));'; |
|
| 10 | + public static function draggable($attr="id") { |
|
| 11 | + return 'var dt=event.dataTransfer || event.originalEvent.dataTransfer;dt.setData("text/plain",JSON.stringify({id:$(event.target).attr("id"),data:$(event.target).attr("'.$attr.'")}));'; |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | - public static function dropZone($jqueryDone, $jsCallback = "") { |
|
| 15 | - $done = ($jqueryDone != null) ? '$(event.target).' . $jqueryDone . '($("#"+_data.id));' : ''; |
|
| 16 | - return 'var dt=event.dataTransfer || event.originalEvent.dataTransfer;var _data=JSON.parse(dt.getData("text/plain"));' . $done . 'var data=_data.data;' . $jsCallback; |
|
| 14 | + public static function dropZone($jqueryDone, $jsCallback="") { |
|
| 15 | + $done=($jqueryDone!=null) ? '$(event.target).'.$jqueryDone.'($("#"+_data.id));' : ''; |
|
| 16 | + return 'var dt=event.dataTransfer || event.originalEvent.dataTransfer;var _data=JSON.parse(dt.getData("text/plain"));'.$done.'var data=_data.data;'.$jsCallback; |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | public static function containsCode($expression) { |
| 20 | - return strrpos($expression, 'this') !== false || strrpos($expression, 'event') !== false || strrpos($expression, 'self') !== false; |
|
| 20 | + return strrpos($expression, 'this')!==false || strrpos($expression, 'event')!==false || strrpos($expression, 'self')!==false; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | public static function isFunction($jsCode) { |
| 24 | 24 | return JString::startswith($jsCode, "function"); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public static function fileUploadBehavior($id = '') { |
|
| 27 | + public static function fileUploadBehavior($id='') { |
|
| 28 | 28 | return "$('input:text, .ui.button', '#{$id}').on('click', function (e) {e.preventDefault();\$('input:file', '#{$id}').click();}); |
| 29 | 29 | $('input:file', '#{$id}').on('change', function (e) {if(e.target.files.length){var name = e.target.files[0].name;$('input:text', $(e.target).parent()).val(name);}});"; |
| 30 | 30 | } |
@@ -38,8 +38,8 @@ discard block |
||
| 38 | 38 | * @return string |
| 39 | 39 | */ |
| 40 | 40 | public static function prep_element($element) { |
| 41 | - if (self::containsCode($element) === false) { |
|
| 42 | - $element = '"' . addslashes($element) . '"'; |
|
| 41 | + if (self::containsCode($element)===false) { |
|
| 42 | + $element='"'.addslashes($element).'"'; |
|
| 43 | 43 | } |
| 44 | 44 | return $element; |
| 45 | 45 | } |
@@ -54,24 +54,24 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public static function prep_value($value) { |
| 56 | 56 | if (\is_array($value)) { |
| 57 | - $value = implode(",", $value); |
|
| 57 | + $value=implode(",", $value); |
|
| 58 | 58 | } |
| 59 | - if (self::containsCode($value) === false) { |
|
| 60 | - $value = \str_replace([ |
|
| 59 | + if (self::containsCode($value)===false) { |
|
| 60 | + $value=\str_replace([ |
|
| 61 | 61 | "\\", |
| 62 | 62 | "\"" |
| 63 | 63 | ], [ |
| 64 | 64 | "\\\\", |
| 65 | 65 | "\\\"" |
| 66 | 66 | ], $value); |
| 67 | - $value = '"' . $value . '"'; |
|
| 67 | + $value='"'.$value.'"'; |
|
| 68 | 68 | } |
| 69 | 69 | return trim($value, "%"); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | public static function prep_jquery_selector($value) { |
| 73 | - if (JString::startswith($value, '$(') === false) { |
|
| 74 | - return '$(' . self::prep_value($value) . ')'; |
|
| 73 | + if (JString::startswith($value, '$(')===false) { |
|
| 74 | + return '$('.self::prep_value($value).')'; |
|
| 75 | 75 | } |
| 76 | 76 | return $value; |
| 77 | 77 | } |
@@ -16,15 +16,15 @@ discard block |
||
| 16 | 16 | * @version 1.001 |
| 17 | 17 | */ |
| 18 | 18 | class HtmlMessage extends HtmlSemDoubleElement { |
| 19 | - use AttachedTrait,HasTimeoutTrait; |
|
| 19 | + use AttachedTrait, HasTimeoutTrait; |
|
| 20 | 20 | |
| 21 | 21 | protected $icon; |
| 22 | 22 | |
| 23 | 23 | protected $close; |
| 24 | 24 | |
| 25 | - public function __construct($identifier, $content = "") { |
|
| 25 | + public function __construct($identifier, $content="") { |
|
| 26 | 26 | parent::__construct($identifier, "div"); |
| 27 | - $this->_template = '<%tagName% id="%identifier%" %properties%>%close%%icon%%wrapContentBefore%%content%%wrapContentAfter%</%tagName%>'; |
|
| 27 | + $this->_template='<%tagName% id="%identifier%" %properties%>%close%%icon%%wrapContentBefore%%content%%wrapContentAfter%</%tagName%>'; |
|
| 28 | 28 | $this->setClass("ui message"); |
| 29 | 29 | $this->setContent($content); |
| 30 | 30 | } |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | * @return \Ajax\semantic\html\collections\HtmlMessage |
| 37 | 37 | */ |
| 38 | 38 | public function addHeader($header) { |
| 39 | - $headerO = $header; |
|
| 39 | + $headerO=$header; |
|
| 40 | 40 | if (\is_string($header)) { |
| 41 | - $headerO = new HtmlSemDoubleElement("header-" . $this->identifier, "div"); |
|
| 41 | + $headerO=new HtmlSemDoubleElement("header-".$this->identifier, "div"); |
|
| 42 | 42 | $headerO->setClass("header"); |
| 43 | 43 | $headerO->setContent($header); |
| 44 | 44 | } |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | $this->addToProperty("class", "icon"); |
| 54 | 54 | $this->wrapContent("<div class='content'>", "</div>"); |
| 55 | 55 | if (\is_string($icon)) { |
| 56 | - $this->icon = new HtmlIcon("icon-" . $this->identifier, $icon); |
|
| 56 | + $this->icon=new HtmlIcon("icon-".$this->identifier, $icon); |
|
| 57 | 57 | } else { |
| 58 | - $this->icon = $icon; |
|
| 58 | + $this->icon=$icon; |
|
| 59 | 59 | } |
| 60 | 60 | return $this; |
| 61 | 61 | } |
@@ -72,23 +72,23 @@ discard block |
||
| 72 | 72 | * default : array("preventDefault"=>true,"stopPropagation"=>true,"params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>null,"headers"=>null,"historize"=>false) |
| 73 | 73 | * @return $this |
| 74 | 74 | */ |
| 75 | - public function getOnClose($url, $responseElement = "", $parameters = array()) { |
|
| 75 | + public function getOnClose($url, $responseElement="", $parameters=array()) { |
|
| 76 | 76 | if (isset($this->close)) { |
| 77 | 77 | $this->close->getOnClick($url, $responseElement, $parameters); |
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - public function addLoader($loaderIcon = "notched circle") { |
|
| 81 | + public function addLoader($loaderIcon="notched circle") { |
|
| 82 | 82 | $this->setIcon($loaderIcon); |
| 83 | 83 | $this->icon->addToIcon("loading"); |
| 84 | 84 | return $this; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - public function setDismissable($dismiss = true) { |
|
| 88 | - if ($dismiss === true) |
|
| 89 | - $this->close = new HtmlIcon("close-" . $this->identifier, "close"); |
|
| 87 | + public function setDismissable($dismiss=true) { |
|
| 88 | + if ($dismiss===true) |
|
| 89 | + $this->close=new HtmlIcon("close-".$this->identifier, "close"); |
|
| 90 | 90 | else |
| 91 | - $this->close = NULL; |
|
| 91 | + $this->close=NULL; |
|
| 92 | 92 | return $this; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -98,9 +98,9 @@ discard block |
||
| 98 | 98 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
| 99 | 99 | */ |
| 100 | 100 | public function run(JsUtils $js) { |
| 101 | - if (! isset($this->_bsComponent)) { |
|
| 101 | + if (!isset($this->_bsComponent)) { |
|
| 102 | 102 | if (isset($this->close)) { |
| 103 | - $js->execOn("click", "#" . $this->identifier . " .close", "$(this).closest('.message').transition({$this->_closeTransition}).trigger('close-message');"); |
|
| 103 | + $js->execOn("click", "#".$this->identifier." .close", "$(this).closest('.message').transition({$this->_closeTransition}).trigger('close-message');"); |
|
| 104 | 104 | } |
| 105 | 105 | if (isset($this->_timeout)) { |
| 106 | 106 | $js->exec("setTimeout(function() { $('#{$this->identifier}').transition({$this->_closeTransition}).trigger('close-message'); }, {$this->_timeout});", true); |
@@ -109,15 +109,15 @@ discard block |
||
| 109 | 109 | return parent::run($js); |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - public function setState($visible = true) { |
|
| 113 | - $visible = ($visible === true) ? "visible" : "hidden"; |
|
| 112 | + public function setState($visible=true) { |
|
| 113 | + $visible=($visible===true) ? "visible" : "hidden"; |
|
| 114 | 114 | return $this->addToPropertyCtrl("class", $visible, array( |
| 115 | 115 | "visible", |
| 116 | 116 | "hidden" |
| 117 | 117 | )); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - public function setVariation($value = "floating") { |
|
| 120 | + public function setVariation($value="floating") { |
|
| 121 | 121 | return $this->addToPropertyCtrl("class", $value, array( |
| 122 | 122 | "floating", |
| 123 | 123 | "compact" |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | public function setMessage($message) { |
| 140 | 140 | if (\is_array($this->content)) { |
| 141 | - $this->content[\sizeof($this->content) - 1] = $message; |
|
| 141 | + $this->content[\sizeof($this->content)-1]=$message; |
|
| 142 | 142 | } else |
| 143 | 143 | $this->setContent($message); |
| 144 | 144 | } |
@@ -10,50 +10,50 @@ discard block |
||
| 10 | 10 | private $parameters; |
| 11 | 11 | |
| 12 | 12 | public function __construct($method, $parameters) { |
| 13 | - $this->method = $method; |
|
| 14 | - $this->parameters = $parameters; |
|
| 13 | + $this->method=$method; |
|
| 14 | + $this->parameters=$parameters; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - public function compile(JsUtils $js = null) { |
|
| 18 | - if ($js === null) |
|
| 17 | + public function compile(JsUtils $js=null) { |
|
| 18 | + if ($js===null) |
|
| 19 | 19 | return; |
| 20 | - $params = "{}"; |
|
| 21 | - $stopPropagation = true; |
|
| 22 | - $preventDefault = true; |
|
| 23 | - $method = "get"; |
|
| 24 | - $this->parameters["immediatly"] = false; |
|
| 20 | + $params="{}"; |
|
| 21 | + $stopPropagation=true; |
|
| 22 | + $preventDefault=true; |
|
| 23 | + $method="get"; |
|
| 24 | + $this->parameters["immediatly"]=false; |
|
| 25 | 25 | extract($this->parameters); |
| 26 | - $result = $this->_eventPreparing($preventDefault, $stopPropagation); |
|
| 26 | + $result=$this->_eventPreparing($preventDefault, $stopPropagation); |
|
| 27 | 27 | switch ($this->method) { |
| 28 | 28 | case "get": |
| 29 | - $result .= $js->getDeferred($url, $responseElement, $this->parameters); |
|
| 29 | + $result.=$js->getDeferred($url, $responseElement, $this->parameters); |
|
| 30 | 30 | break; |
| 31 | 31 | case "post": |
| 32 | - $result .= $js->postDeferred($url, $params, $responseElement, $this->parameters); |
|
| 32 | + $result.=$js->postDeferred($url, $params, $responseElement, $this->parameters); |
|
| 33 | 33 | break; |
| 34 | 34 | case "postForm": |
| 35 | - $result .= $js->postFormDeferred($url, $form, $responseElement, $this->parameters); |
|
| 35 | + $result.=$js->postFormDeferred($url, $form, $responseElement, $this->parameters); |
|
| 36 | 36 | break; |
| 37 | 37 | case "json": |
| 38 | - $result .= $js->jsonDeferred($url, $method, $this->parameters); |
|
| 38 | + $result.=$js->jsonDeferred($url, $method, $this->parameters); |
|
| 39 | 39 | break; |
| 40 | 40 | case "jsonArray": |
| 41 | - $result .= $js->jsonArrayDeferred($modelSelector, $url, $method, $this->parameters); |
|
| 41 | + $result.=$js->jsonArrayDeferred($modelSelector, $url, $method, $this->parameters); |
|
| 42 | 42 | break; |
| 43 | 43 | default: |
| 44 | - $result .= $js->ajaxDeferred($this->method, $url, $responseElement, $this->parameters); |
|
| 44 | + $result.=$js->ajaxDeferred($this->method, $url, $responseElement, $this->parameters); |
|
| 45 | 45 | break; |
| 46 | 46 | } |
| 47 | 47 | return $result; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | protected function _eventPreparing($preventDefault, $stopPropagation) { |
| 51 | - $result = ""; |
|
| 52 | - if ($preventDefault === true) { |
|
| 53 | - $result .= Javascript::$preventDefault; |
|
| 51 | + $result=""; |
|
| 52 | + if ($preventDefault===true) { |
|
| 53 | + $result.=Javascript::$preventDefault; |
|
| 54 | 54 | } |
| 55 | - if ($stopPropagation === true) { |
|
| 56 | - $result .= Javascript::$stopPropagation; |
|
| 55 | + if ($stopPropagation===true) { |
|
| 56 | + $result.=Javascript::$stopPropagation; |
|
| 57 | 57 | } |
| 58 | 58 | return $result; |
| 59 | 59 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | public function setMethod($method) { |
| 66 | - $this->method = $method; |
|
| 66 | + $this->method=$method; |
|
| 67 | 67 | return $this; |
| 68 | 68 | } |
| 69 | 69 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public function setParameters($parameters) { |
| 75 | - $this->parameters = $parameters; |
|
| 75 | + $this->parameters=$parameters; |
|
| 76 | 76 | return $this; |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -13,17 +13,17 @@ discard block |
||
| 13 | 13 | use Ajax\service\JArray; |
| 14 | 14 | |
| 15 | 15 | class HtmlDropdown extends HtmlSemDoubleElement { |
| 16 | - use FieldTrait,LabeledIconTrait { |
|
| 16 | + use FieldTrait, LabeledIconTrait { |
|
| 17 | 17 | addIcon as addIconP; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - protected $mClass = "menu"; |
|
| 20 | + protected $mClass="menu"; |
|
| 21 | 21 | |
| 22 | - protected $mTagName = "div"; |
|
| 22 | + protected $mTagName="div"; |
|
| 23 | 23 | |
| 24 | - protected $items = array(); |
|
| 24 | + protected $items=array(); |
|
| 25 | 25 | |
| 26 | - protected $_params = array( |
|
| 26 | + protected $_params=array( |
|
| 27 | 27 | "action" => "nothing", |
| 28 | 28 | "on" => "hover", |
| 29 | 29 | "showOnFocus" => true |
@@ -37,29 +37,29 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | protected $_multiple; |
| 39 | 39 | |
| 40 | - public function __construct($identifier, $value = "", $items = array(), $associative = true) { |
|
| 40 | + public function __construct($identifier, $value="", $items=array(), $associative=true) { |
|
| 41 | 41 | parent::__construct($identifier, "div"); |
| 42 | - $this->_template = include dirname(__FILE__) . '/../templates/tplDropdown.php'; |
|
| 42 | + $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
|
| 43 | 43 | $this->setProperty("class", "ui dropdown"); |
| 44 | - $this->_multiple = false; |
|
| 45 | - $content = []; |
|
| 46 | - $text = ''; |
|
| 44 | + $this->_multiple=false; |
|
| 45 | + $content=[]; |
|
| 46 | + $text=''; |
|
| 47 | 47 | if ($value instanceof HtmlSemDoubleElement) { |
| 48 | - $text = $value; |
|
| 49 | - } elseif ($value !== null) { |
|
| 50 | - $text = new HtmlSemDoubleElement("text-" . $this->identifier, "div"); |
|
| 48 | + $text=$value; |
|
| 49 | + } elseif ($value!==null) { |
|
| 50 | + $text=new HtmlSemDoubleElement("text-".$this->identifier, "div"); |
|
| 51 | 51 | $text->setClass("text"); |
| 52 | 52 | $this->setValue($value); |
| 53 | 53 | } |
| 54 | - if ($text != null) { |
|
| 55 | - $content = [ |
|
| 54 | + if ($text!=null) { |
|
| 55 | + $content=[ |
|
| 56 | 56 | "text" => $text |
| 57 | 57 | ]; |
| 58 | 58 | } |
| 59 | - $content["arrow"] = new HtmlIcon($identifier . "-icon", "dropdown"); |
|
| 60 | - $this->content = $content; |
|
| 61 | - $this->tagName = "div"; |
|
| 62 | - $this->_associative = $associative; |
|
| 59 | + $content["arrow"]=new HtmlIcon($identifier."-icon", "dropdown"); |
|
| 60 | + $this->content=$content; |
|
| 61 | + $this->tagName="div"; |
|
| 62 | + $this->_associative=$associative; |
|
| 63 | 63 | $this->addItems($items); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -71,16 +71,16 @@ discard block |
||
| 71 | 71 | return $this->input; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - public function addItem($item, $value = NULL, $image = NULL, $description = NULL) { |
|
| 75 | - $itemO = $this->beforeAddItem($item, $value, $image, $description); |
|
| 76 | - $this->items[] = $itemO; |
|
| 74 | + public function addItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
| 75 | + $itemO=$this->beforeAddItem($item, $value, $image, $description); |
|
| 76 | + $this->items[]=$itemO; |
|
| 77 | 77 | return $itemO; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public function addIcon($icon, $before = true, $labeled = false) { |
|
| 80 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
| 81 | 81 | $this->removeArrow(); |
| 82 | 82 | $this->addIconP($icon, $before, $labeled); |
| 83 | - $elm = $this->getElementById("text-" . $this->identifier, $this->content); |
|
| 83 | + $elm=$this->getElementById("text-".$this->identifier, $this->content); |
|
| 84 | 84 | if (isset($elm)) { |
| 85 | 85 | $elm->setWrapAfter(""); |
| 86 | 86 | } |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | public function addIcons($icons) { |
| 91 | - $count = $this->count(); |
|
| 92 | - for ($i = 0; $i < \sizeof($icons) && $i < $count; $i ++) { |
|
| 91 | + $count=$this->count(); |
|
| 92 | + for ($i=0; $i<\sizeof($icons) && $i<$count; $i++) { |
|
| 93 | 93 | $this->getItem($i)->addIcon($icons[$i]); |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -101,32 +101,32 @@ discard block |
||
| 101 | 101 | * @param int $position |
| 102 | 102 | * @return HtmlDropdownItem |
| 103 | 103 | */ |
| 104 | - public function insertItem($item, $position = 0) { |
|
| 105 | - $itemO = $this->beforeAddItem($item); |
|
| 106 | - $start = array_slice($this->items, 0, $position); |
|
| 107 | - $end = array_slice($this->items, $position); |
|
| 108 | - $start[] = $item; |
|
| 109 | - $this->items = array_merge($start, $end); |
|
| 104 | + public function insertItem($item, $position=0) { |
|
| 105 | + $itemO=$this->beforeAddItem($item); |
|
| 106 | + $start=array_slice($this->items, 0, $position); |
|
| 107 | + $end=array_slice($this->items, $position); |
|
| 108 | + $start[]=$item; |
|
| 109 | + $this->items=array_merge($start, $end); |
|
| 110 | 110 | return $itemO; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | protected function removeArrow() { |
| 114 | - if (\sizeof($this->content) > 1) { |
|
| 114 | + if (\sizeof($this->content)>1) { |
|
| 115 | 115 | unset($this->content["arrow"]); |
| 116 | - $this->content = \array_values($this->content); |
|
| 116 | + $this->content=\array_values($this->content); |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - protected function beforeAddItem($item, $value = NULL, $image = NULL, $description = NULL) { |
|
| 121 | - $itemO = $item; |
|
| 120 | + protected function beforeAddItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
| 121 | + $itemO=$item; |
|
| 122 | 122 | if (\is_array($item)) { |
| 123 | - $description = JArray::getValue($item, "description", 3); |
|
| 124 | - $value = JArray::getValue($item, "value", 1); |
|
| 125 | - $image = JArray::getValue($item, "image", 2); |
|
| 126 | - $item = JArray::getValue($item, "item", 0); |
|
| 123 | + $description=JArray::getValue($item, "description", 3); |
|
| 124 | + $value=JArray::getValue($item, "value", 1); |
|
| 125 | + $image=JArray::getValue($item, "image", 2); |
|
| 126 | + $item=JArray::getValue($item, "item", 0); |
|
| 127 | 127 | } |
| 128 | - if (! $item instanceof HtmlDropdownItem) { |
|
| 129 | - $itemO = new HtmlDropdownItem("dd-item-" . $this->identifier . "-" . \sizeof($this->items), $item, $value, $image, $description); |
|
| 128 | + if (!$item instanceof HtmlDropdownItem) { |
|
| 129 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image, $description); |
|
| 130 | 130 | } elseif ($itemO instanceof HtmlDropdownItem) { |
| 131 | 131 | $this->addToProperty("class", "vertical"); |
| 132 | 132 | } |
@@ -142,11 +142,11 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | public function addInput($name) { |
| 145 | - if (! isset($name)) |
|
| 146 | - $name = "input-" . $this->identifier; |
|
| 145 | + if (!isset($name)) |
|
| 146 | + $name="input-".$this->identifier; |
|
| 147 | 147 | $this->setAction("activate"); |
| 148 | - $this->input = new HtmlInput($name, "hidden"); |
|
| 149 | - $this->input->setIdentifier("input-" . $this->identifier); |
|
| 148 | + $this->input=new HtmlInput($name, "hidden"); |
|
| 149 | + $this->input->setIdentifier("input-".$this->identifier); |
|
| 150 | 150 | return $this->input; |
| 151 | 151 | } |
| 152 | 152 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @param string $icon |
| 158 | 158 | * @return HtmlDropdownItem |
| 159 | 159 | */ |
| 160 | - public function addSearchInputItem($placeHolder = NULL, $icon = NULL) { |
|
| 160 | + public function addSearchInputItem($placeHolder=NULL, $icon=NULL) { |
|
| 161 | 161 | return $this->addItem(HtmlDropdownItem::searchInput($placeHolder, $icon)); |
| 162 | 162 | } |
| 163 | 163 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | * @param string $icon |
| 178 | 178 | * @return HtmlDropdownItem |
| 179 | 179 | */ |
| 180 | - public function addHeaderItem($caption = NULL, $icon = NULL) { |
|
| 180 | + public function addHeaderItem($caption=NULL, $icon=NULL) { |
|
| 181 | 181 | return $this->addItem(HtmlDropdownItem::header($caption, $icon)); |
| 182 | 182 | } |
| 183 | 183 | |
@@ -222,12 +222,12 @@ discard block |
||
| 222 | 222 | * @return $this |
| 223 | 223 | */ |
| 224 | 224 | public function setPropertyValues($property, $values) { |
| 225 | - $i = 0; |
|
| 226 | - if (\is_array($values) === false) { |
|
| 227 | - $values = \array_fill(0, $this->count(), $values); |
|
| 225 | + $i=0; |
|
| 226 | + if (\is_array($values)===false) { |
|
| 227 | + $values=\array_fill(0, $this->count(), $values); |
|
| 228 | 228 | } |
| 229 | 229 | foreach ($values as $value) { |
| 230 | - $c = $this->items[$i ++]; |
|
| 230 | + $c=$this->items[$i++]; |
|
| 231 | 231 | if (isset($c)) { |
| 232 | 232 | $c->setProperty($property, $value); |
| 233 | 233 | } else { |
@@ -261,12 +261,12 @@ discard block |
||
| 261 | 261 | * @param boolean $dropdown |
| 262 | 262 | */ |
| 263 | 263 | public function asDropdown($dropdown) { |
| 264 | - if ($dropdown === false) { |
|
| 265 | - $this->_template = include dirname(__FILE__) . '/../templates/tplDropdownMenu.php'; |
|
| 266 | - $dropdown = "menu"; |
|
| 264 | + if ($dropdown===false) { |
|
| 265 | + $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
|
| 266 | + $dropdown="menu"; |
|
| 267 | 267 | } else { |
| 268 | - $dropdown = "dropdown"; |
|
| 269 | - $this->mClass = "menu"; |
|
| 268 | + $dropdown="dropdown"; |
|
| 269 | + $this->mClass="menu"; |
|
| 270 | 270 | } |
| 271 | 271 | return $this->addToPropertyCtrl("class", $dropdown, array( |
| 272 | 272 | "menu", |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | )); |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - public function asButton($floating = false) { |
|
| 295 | + public function asButton($floating=false) { |
|
| 296 | 296 | $this->removeArrow(); |
| 297 | 297 | if ($floating) |
| 298 | 298 | $this->addToProperty("class", "floating"); |
@@ -300,15 +300,15 @@ discard block |
||
| 300 | 300 | return $this->addToProperty("class", "button"); |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | - public function asSelect($name = NULL, $multiple = false, $selection = true) { |
|
| 304 | - $this->_multiple = $multiple; |
|
| 303 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
| 304 | + $this->_multiple=$multiple; |
|
| 305 | 305 | if (isset($name)) |
| 306 | 306 | $this->addInput($name); |
| 307 | 307 | if ($multiple) { |
| 308 | 308 | $this->addToProperty("class", "multiple"); |
| 309 | 309 | } |
| 310 | 310 | if ($selection) { |
| 311 | - if ($this->propertyContains("class", "button") === false) |
|
| 311 | + if ($this->propertyContains("class", "button")===false) |
|
| 312 | 312 | $this->addToPropertyCtrl("class", "selection", array( |
| 313 | 313 | "selection" |
| 314 | 314 | )); |
@@ -316,31 +316,31 @@ discard block |
||
| 316 | 316 | return $this; |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - public function asSearch($name = NULL, $multiple = false, $selection = true) { |
|
| 319 | + public function asSearch($name=NULL, $multiple=false, $selection=true) { |
|
| 320 | 320 | $this->asSelect($name, $multiple, $selection); |
| 321 | 321 | return $this->addToProperty("class", "search"); |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - public function setSelect($name = NULL, $multiple = false) { |
|
| 325 | - $this->_template = '<%tagName% id="%identifier%" %properties%>%items%</%tagName%>'; |
|
| 326 | - if (! isset($name)) |
|
| 327 | - $name = "select-" . $this->identifier; |
|
| 328 | - $this->input = null; |
|
| 324 | + public function setSelect($name=NULL, $multiple=false) { |
|
| 325 | + $this->_template='<%tagName% id="%identifier%" %properties%>%items%</%tagName%>'; |
|
| 326 | + if (!isset($name)) |
|
| 327 | + $name="select-".$this->identifier; |
|
| 328 | + $this->input=null; |
|
| 329 | 329 | if ($multiple) { |
| 330 | 330 | $this->setProperty("multiple", true); |
| 331 | 331 | $this->addToProperty("class", "multiple"); |
| 332 | 332 | } |
| 333 | 333 | $this->setAction("activate"); |
| 334 | - $this->tagName = "select"; |
|
| 334 | + $this->tagName="select"; |
|
| 335 | 335 | $this->setProperty("name", $name); |
| 336 | - $this->content = null; |
|
| 336 | + $this->content=null; |
|
| 337 | 337 | foreach ($this->items as $item) { |
| 338 | 338 | $item->asOption(); |
| 339 | 339 | } |
| 340 | 340 | return $this; |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - public function asSubmenu($pointing = NULL) { |
|
| 343 | + public function asSubmenu($pointing=NULL) { |
|
| 344 | 344 | $this->setClass("ui dropdown link item"); |
| 345 | 345 | if (isset($pointing)) { |
| 346 | 346 | $this->setPointing($pointing); |
@@ -348,29 +348,29 @@ discard block |
||
| 348 | 348 | return $this; |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | - public function setPointing($value = Direction::NONE) { |
|
| 352 | - return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing")); |
|
| 351 | + public function setPointing($value=Direction::NONE) { |
|
| 352 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | public function setValue($value) { |
| 356 | - $this->value = $value; |
|
| 356 | + $this->value=$value; |
|
| 357 | 357 | return $this; |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | public function setDefaultText($text) { |
| 361 | - $this->content["text"] = new HtmlSemDoubleElement("", "div", "default text", $text); |
|
| 361 | + $this->content["text"]=new HtmlSemDoubleElement("", "div", "default text", $text); |
|
| 362 | 362 | return $this; |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | private function applyValue() { |
| 366 | - $value = $this->value; |
|
| 366 | + $value=$this->value; |
|
| 367 | 367 | if (isset($this->input) && isset($value)) { |
| 368 | 368 | $this->input->setProperty("value", $value); |
| 369 | 369 | } else { |
| 370 | 370 | $this->setProperty("value", $value); |
| 371 | 371 | } |
| 372 | - $textElement = $this->getElementById("text-" . $this->identifier, $this->content); |
|
| 373 | - if (isset($textElement) && ($textElement instanceof HtmlDoubleElement) && ! $this->_multiple) |
|
| 372 | + $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
|
| 373 | + if (isset($textElement) && ($textElement instanceof HtmlDoubleElement) && !$this->_multiple) |
|
| 374 | 374 | $textElement->setContent($value); |
| 375 | 375 | return $this; |
| 376 | 376 | } |
@@ -380,9 +380,9 @@ discard block |
||
| 380 | 380 | * @see BaseHtml::run() |
| 381 | 381 | */ |
| 382 | 382 | public function run(JsUtils $js) { |
| 383 | - if ($this->propertyContains("class", "simple") === false) { |
|
| 384 | - if (isset($this->_bsComponent) === false) { |
|
| 385 | - $this->_bsComponent = $js->semantic()->dropdown("#" . $this->identifier, $this->_params); |
|
| 383 | + if ($this->propertyContains("class", "simple")===false) { |
|
| 384 | + if (isset($this->_bsComponent)===false) { |
|
| 385 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params); |
|
| 386 | 386 | $this->_bsComponent->setItemSelector(".item"); |
| 387 | 387 | } |
| 388 | 388 | $this->addEventsOnRun($js); |
@@ -397,31 +397,31 @@ discard block |
||
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | public function setAction($action) { |
| 400 | - $this->_params["action"] = $action; |
|
| 400 | + $this->_params["action"]=$action; |
|
| 401 | 401 | return $this; |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | public function setOn($on) { |
| 405 | - $this->_params["on"] = $on; |
|
| 405 | + $this->_params["on"]=$on; |
|
| 406 | 406 | return $this; |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | public function setShowOnFocus($value) { |
| 410 | - $this->_params["showOnFocus"] = $value; |
|
| 410 | + $this->_params["showOnFocus"]=$value; |
|
| 411 | 411 | return $this; |
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | public function setAllowAdditions($value) { |
| 415 | - $this->_params["allowAdditions"] = $value; |
|
| 415 | + $this->_params["allowAdditions"]=$value; |
|
| 416 | 416 | return $this; |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | public function setFullTextSearch($value) { |
| 420 | - $this->_params["fullTextSearch"] = $value; |
|
| 420 | + $this->_params["fullTextSearch"]=$value; |
|
| 421 | 421 | return $this; |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
| 424 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 425 | 425 | $this->applyValue(); |
| 426 | 426 | return parent::compile($js, $view); |
| 427 | 427 | } |
@@ -430,19 +430,19 @@ discard block |
||
| 430 | 430 | return $this->input; |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | - public function setIcon($icon = "dropdown") { |
|
| 434 | - $this->content["arrow"] = new HtmlIcon($this->identifier . "-icon", $icon); |
|
| 433 | + public function setIcon($icon="dropdown") { |
|
| 434 | + $this->content["arrow"]=new HtmlIcon($this->identifier."-icon", $icon); |
|
| 435 | 435 | return $this; |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | - public function jsAddItem($caption, $value = null) { |
|
| 439 | - $value = $value ?? $caption; |
|
| 440 | - $js = "var first=$('#{$this->identifier} .item').first();if(first!=undefined){var newItem =first.clone();first.parent().append(newItem);newItem.html({$caption});newItem.attr('data-value',{$value}).removeClass('active filtered');}"; |
|
| 438 | + public function jsAddItem($caption, $value=null) { |
|
| 439 | + $value=$value ?? $caption; |
|
| 440 | + $js="var first=$('#{$this->identifier} .item').first();if(first!=undefined){var newItem =first.clone();first.parent().append(newItem);newItem.html({$caption});newItem.attr('data-value',{$value}).removeClass('active filtered');}"; |
|
| 441 | 441 | return $js; |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | public function setClearable($value) { |
| 445 | - $this->_params["clearable"] = $value; |
|
| 445 | + $this->_params["clearable"]=$value; |
|
| 446 | 446 | return $this; |
| 447 | 447 | } |
| 448 | 448 | |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | * Parameters addedValue, addedText, $addedChoice |
| 452 | 452 | */ |
| 453 | 453 | public function setOnAdd($jsCode) { |
| 454 | - $this->_params["onAdd"] = $jsCode; |
|
| 454 | + $this->_params["onAdd"]=$jsCode; |
|
| 455 | 455 | return $this; |
| 456 | 456 | } |
| 457 | 457 | |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | * Parameters removedValue, removedText, $removedChoice |
| 461 | 461 | */ |
| 462 | 462 | public function setOnRemove($jsCode) { |
| 463 | - $this->_params["onRemove"] = $jsCode; |
|
| 463 | + $this->_params["onRemove"]=$jsCode; |
|
| 464 | 464 | return $this; |
| 465 | 465 | } |
| 466 | 466 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | trait JsUtilsActionsTrait { |
| 14 | 14 | |
| 15 | - abstract public function _add_event($element, $js, $event, $preventDefault = false, $stopPropagation = false, $immediatly = true, $listenerOn=false); |
|
| 15 | + abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true, $listenerOn=false); |
|
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * show or hide with effect |
@@ -28,15 +28,15 @@ discard block |
||
| 28 | 28 | * defers the execution if set to false |
| 29 | 29 | * @return string |
| 30 | 30 | */ |
| 31 | - protected function _showHideWithEffect($action, $element = 'this', $speed = '', $callback = '', $immediatly = false) { |
|
| 32 | - $element = Javascript::prep_element ( $element ); |
|
| 33 | - $speed = $this->_validate_speed ( $speed ); |
|
| 34 | - if ($callback != '') { |
|
| 35 | - $callback = ", function(){\n{$callback}\n}"; |
|
| 31 | + protected function _showHideWithEffect($action, $element='this', $speed='', $callback='', $immediatly=false) { |
|
| 32 | + $element=Javascript::prep_element($element); |
|
| 33 | + $speed=$this->_validate_speed($speed); |
|
| 34 | + if ($callback!='') { |
|
| 35 | + $callback=", function(){\n{$callback}\n}"; |
|
| 36 | 36 | } |
| 37 | - $str = "$({$element}).{$action}({$speed}{$callback});"; |
|
| 37 | + $str="$({$element}).{$action}({$speed}{$callback});"; |
|
| 38 | 38 | if ($immediatly) |
| 39 | - $this->jquery_code_for_compile [] = $str; |
|
| 39 | + $this->jquery_code_for_compile []=$str; |
|
| 40 | 40 | return $str; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -47,14 +47,14 @@ discard block |
||
| 47 | 47 | * @return string |
| 48 | 48 | */ |
| 49 | 49 | private function _validate_speed($speed) { |
| 50 | - if (in_array ( $speed, array ( |
|
| 50 | + if (in_array($speed, array( |
|
| 51 | 51 | 'slow', |
| 52 | 52 | 'normal', |
| 53 | 53 | 'fast' |
| 54 | - ) )) { |
|
| 55 | - $speed = '"' . $speed . '"'; |
|
| 56 | - } elseif (preg_match ( "/[^0-9]/", $speed )) { |
|
| 57 | - $speed = ''; |
|
| 54 | + ))) { |
|
| 55 | + $speed='"'.$speed.'"'; |
|
| 56 | + } elseif (preg_match("/[^0-9]/", $speed)) { |
|
| 57 | + $speed=''; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | return $speed; |
@@ -69,15 +69,15 @@ discard block |
||
| 69 | 69 | * @param boolean $immediatly |
| 70 | 70 | * delayed if false |
| 71 | 71 | */ |
| 72 | - public function _genericCallValue($jQueryCall, $element = 'this', $param = "", $immediatly = false) { |
|
| 73 | - $element = Javascript::prep_element ( $element ); |
|
| 74 | - if (isset ( $param )) { |
|
| 75 | - $param = Javascript::prep_value ( $param ); |
|
| 76 | - $str = "$({$element}).{$jQueryCall}({$param});"; |
|
| 72 | + public function _genericCallValue($jQueryCall, $element='this', $param="", $immediatly=false) { |
|
| 73 | + $element=Javascript::prep_element($element); |
|
| 74 | + if (isset ($param)) { |
|
| 75 | + $param=Javascript::prep_value($param); |
|
| 76 | + $str="$({$element}).{$jQueryCall}({$param});"; |
|
| 77 | 77 | } else |
| 78 | - $str = "$({$element}).{$jQueryCall}();"; |
|
| 78 | + $str="$({$element}).{$jQueryCall}();"; |
|
| 79 | 79 | if ($immediatly) |
| 80 | - $this->jquery_code_for_compile [] = $str; |
|
| 80 | + $this->jquery_code_for_compile []=$str; |
|
| 81 | 81 | return $str; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -91,12 +91,12 @@ discard block |
||
| 91 | 91 | * delayed if false |
| 92 | 92 | * @return string |
| 93 | 93 | */ |
| 94 | - public function _genericCallElement($jQueryCall, $to = 'this', $element = '', $immediatly = false) { |
|
| 95 | - $to = Javascript::prep_element ( $to ); |
|
| 96 | - $element = Javascript::prep_element ( $element ); |
|
| 97 | - $str = "$({$to}).{$jQueryCall}({$element});"; |
|
| 94 | + public function _genericCallElement($jQueryCall, $to='this', $element='', $immediatly=false) { |
|
| 95 | + $to=Javascript::prep_element($to); |
|
| 96 | + $element=Javascript::prep_element($element); |
|
| 97 | + $str="$({$to}).{$jQueryCall}({$element});"; |
|
| 98 | 98 | if ($immediatly) |
| 99 | - $this->jquery_code_for_compile [] = $str; |
|
| 99 | + $this->jquery_code_for_compile []=$str; |
|
| 100 | 100 | return $str; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -110,8 +110,8 @@ discard block |
||
| 110 | 110 | * defers the execution if set to false |
| 111 | 111 | * @return string |
| 112 | 112 | */ |
| 113 | - public function addClass($element = 'this', $class = '', $immediatly = false) { |
|
| 114 | - return $this->_genericCallValue ( 'addClass', $element, $class, $immediatly ); |
|
| 113 | + public function addClass($element='this', $class='', $immediatly=false) { |
|
| 114 | + return $this->_genericCallValue('addClass', $element, $class, $immediatly); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -123,8 +123,8 @@ discard block |
||
| 123 | 123 | * defers the execution if set to false |
| 124 | 124 | * @return string |
| 125 | 125 | */ |
| 126 | - public function after($to, $element, $immediatly = false) { |
|
| 127 | - return $this->_genericCallElement ( 'after', $to, $element, $immediatly ); |
|
| 126 | + public function after($to, $element, $immediatly=false) { |
|
| 127 | + return $this->_genericCallElement('after', $to, $element, $immediatly); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -136,8 +136,8 @@ discard block |
||
| 136 | 136 | * defers the execution if set to false |
| 137 | 137 | * @return string |
| 138 | 138 | */ |
| 139 | - public function before($to, $element, $immediatly = false) { |
|
| 140 | - return $this->_genericCallElement ( 'before', $to, $element, $immediatly ); |
|
| 139 | + public function before($to, $element, $immediatly=false) { |
|
| 140 | + return $this->_genericCallElement('before', $to, $element, $immediatly); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | /** |
@@ -149,15 +149,15 @@ discard block |
||
| 149 | 149 | * @param boolean $immediatly |
| 150 | 150 | * delayed if false |
| 151 | 151 | */ |
| 152 | - public function attr($element = 'this', $attributeName = 'id', $value = "", $immediatly = false) { |
|
| 153 | - $element = Javascript::prep_element ( $element ); |
|
| 154 | - if (isset ( $value )) { |
|
| 155 | - $value = Javascript::prep_value ( $value ); |
|
| 156 | - $str = "$({$element}).attr(\"$attributeName\",{$value});"; |
|
| 152 | + public function attr($element='this', $attributeName='id', $value="", $immediatly=false) { |
|
| 153 | + $element=Javascript::prep_element($element); |
|
| 154 | + if (isset ($value)) { |
|
| 155 | + $value=Javascript::prep_value($value); |
|
| 156 | + $str="$({$element}).attr(\"$attributeName\",{$value});"; |
|
| 157 | 157 | } else |
| 158 | - $str = "$({$element}).attr(\"$attributeName\");"; |
|
| 158 | + $str="$({$element}).attr(\"$attributeName\");"; |
|
| 159 | 159 | if ($immediatly) |
| 160 | - $this->jquery_code_for_compile [] = $str; |
|
| 160 | + $this->jquery_code_for_compile []=$str; |
|
| 161 | 161 | return $str; |
| 162 | 162 | } |
| 163 | 163 | |
@@ -169,8 +169,8 @@ discard block |
||
| 169 | 169 | * @param boolean $immediatly |
| 170 | 170 | * defers the execution if set to false |
| 171 | 171 | */ |
| 172 | - public function val($element = 'this', $value = '', $immediatly = false) { |
|
| 173 | - return $this->_genericCallValue ( 'val', $element, $value, $immediatly ); |
|
| 172 | + public function val($element='this', $value='', $immediatly=false) { |
|
| 173 | + return $this->_genericCallValue('val', $element, $value, $immediatly); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | /** |
@@ -181,8 +181,8 @@ discard block |
||
| 181 | 181 | * @param boolean $immediatly |
| 182 | 182 | * defers the execution if set to false |
| 183 | 183 | */ |
| 184 | - public function html($element = 'this', $value = '', $immediatly = false) { |
|
| 185 | - return $this->_genericCallValue ( 'html', $element, $value, $immediatly ); |
|
| 184 | + public function html($element='this', $value='', $immediatly=false) { |
|
| 185 | + return $this->_genericCallValue('html', $element, $value, $immediatly); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
@@ -198,30 +198,30 @@ discard block |
||
| 198 | 198 | * defers the execution if set to false |
| 199 | 199 | * @return string |
| 200 | 200 | */ |
| 201 | - public function animate($element = 'this', $params = array (), $speed = '', $extra = '', $immediatly = false) { |
|
| 202 | - $element = Javascript::prep_element ( $element ); |
|
| 203 | - $speed = $this->_validate_speed ( $speed ); |
|
| 201 | + public function animate($element='this', $params=array(), $speed='', $extra='', $immediatly=false) { |
|
| 202 | + $element=Javascript::prep_element($element); |
|
| 203 | + $speed=$this->_validate_speed($speed); |
|
| 204 | 204 | |
| 205 | - $animations = "\t\t\t"; |
|
| 206 | - if (\is_array ( $params )) { |
|
| 207 | - foreach ( $params as $param => $value ) { |
|
| 208 | - $animations .= $param . ': \'' . $value . '\', '; |
|
| 205 | + $animations="\t\t\t"; |
|
| 206 | + if (\is_array($params)) { |
|
| 207 | + foreach ($params as $param => $value) { |
|
| 208 | + $animations.=$param.': \''.$value.'\', '; |
|
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | - $animations = substr ( $animations, 0, - 2 ); // remove the last ", " |
|
| 211 | + $animations=substr($animations, 0, - 2); // remove the last ", " |
|
| 212 | 212 | |
| 213 | - if ($speed != '') { |
|
| 214 | - $speed = ', ' . $speed; |
|
| 213 | + if ($speed!='') { |
|
| 214 | + $speed=', '.$speed; |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | - if ($extra != '') { |
|
| 218 | - $extra = ', ' . $extra; |
|
| 217 | + if ($extra!='') { |
|
| 218 | + $extra=', '.$extra; |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - $str = "$({$element}).animate({\n$animations\n\t\t}" . $speed . $extra . ");"; |
|
| 221 | + $str="$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");"; |
|
| 222 | 222 | |
| 223 | 223 | if ($immediatly) |
| 224 | - $this->jquery_code_for_compile [] = $str; |
|
| 224 | + $this->jquery_code_for_compile []=$str; |
|
| 225 | 225 | return $str; |
| 226 | 226 | } |
| 227 | 227 | |
@@ -234,8 +234,8 @@ discard block |
||
| 234 | 234 | * defers the execution if set to false |
| 235 | 235 | * @return string |
| 236 | 236 | */ |
| 237 | - public function append($to, $element, $immediatly = false) { |
|
| 238 | - return $this->_genericCallElement ( 'append', $to, $element, $immediatly ); |
|
| 237 | + public function append($to, $element, $immediatly=false) { |
|
| 238 | + return $this->_genericCallElement('append', $to, $element, $immediatly); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | /** |
@@ -247,8 +247,8 @@ discard block |
||
| 247 | 247 | * defers the execution if set to false |
| 248 | 248 | * @return string |
| 249 | 249 | */ |
| 250 | - public function prepend($to, $element, $immediatly = false) { |
|
| 251 | - return $this->_genericCallElement ( 'prepend', $to, $element, $immediatly ); |
|
| 250 | + public function prepend($to, $element, $immediatly=false) { |
|
| 251 | + return $this->_genericCallElement('prepend', $to, $element, $immediatly); |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | /** |
@@ -264,8 +264,8 @@ discard block |
||
| 264 | 264 | * defers the execution if set to false |
| 265 | 265 | * @return string |
| 266 | 266 | */ |
| 267 | - public function fadeIn($element = 'this', $speed = '', $callback = '', $immediatly = false) { |
|
| 268 | - return $this->_showHideWithEffect ( "fadeIn", $element, $speed, $callback, $immediatly ); |
|
| 267 | + public function fadeIn($element='this', $speed='', $callback='', $immediatly=false) { |
|
| 268 | + return $this->_showHideWithEffect("fadeIn", $element, $speed, $callback, $immediatly); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | /** |
@@ -281,8 +281,8 @@ discard block |
||
| 281 | 281 | * defers the execution if set to false |
| 282 | 282 | * @return string |
| 283 | 283 | */ |
| 284 | - public function fadeOut($element = 'this', $speed = '', $callback = '', $immediatly = false) { |
|
| 285 | - return $this->_showHideWithEffect ( "fadeOut", $element, $speed, $callback, $immediatly ); |
|
| 284 | + public function fadeOut($element='this', $speed='', $callback='', $immediatly=false) { |
|
| 285 | + return $this->_showHideWithEffect("fadeOut", $element, $speed, $callback, $immediatly); |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | /** |
@@ -298,8 +298,8 @@ discard block |
||
| 298 | 298 | * defers the execution if set to false |
| 299 | 299 | * @return string |
| 300 | 300 | */ |
| 301 | - public function slideUp($element = 'this', $speed = '', $callback = '', $immediatly = false) { |
|
| 302 | - return $this->_showHideWithEffect ( "slideUp", $element, $speed, $callback, $immediatly ); |
|
| 301 | + public function slideUp($element='this', $speed='', $callback='', $immediatly=false) { |
|
| 302 | + return $this->_showHideWithEffect("slideUp", $element, $speed, $callback, $immediatly); |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | /** |
@@ -313,8 +313,8 @@ discard block |
||
| 313 | 313 | * defers the execution if set to false |
| 314 | 314 | * @return string |
| 315 | 315 | */ |
| 316 | - public function removeClass($element = 'this', $class = '', $immediatly = false) { |
|
| 317 | - return $this->_genericCallValue ( 'removeClass', $element, $class, $immediatly ); |
|
| 316 | + public function removeClass($element='this', $class='', $immediatly=false) { |
|
| 317 | + return $this->_genericCallValue('removeClass', $element, $class, $immediatly); |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | /** |
@@ -330,8 +330,8 @@ discard block |
||
| 330 | 330 | * defers the execution if set to false |
| 331 | 331 | * @return string |
| 332 | 332 | */ |
| 333 | - public function slideDown($element = 'this', $speed = '', $callback = '', $immediatly = false) { |
|
| 334 | - return $this->_showHideWithEffect ( "slideDown", $element, $speed, $callback, $immediatly ); |
|
| 333 | + public function slideDown($element='this', $speed='', $callback='', $immediatly=false) { |
|
| 334 | + return $this->_showHideWithEffect("slideDown", $element, $speed, $callback, $immediatly); |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | /** |
@@ -347,8 +347,8 @@ discard block |
||
| 347 | 347 | * defers the execution if set to false |
| 348 | 348 | * @return string |
| 349 | 349 | */ |
| 350 | - public function slideToggle($element = 'this', $speed = '', $callback = '', $immediatly = false) { |
|
| 351 | - return $this->_showHideWithEffect ( "slideToggle", $element, $speed, $callback, $immediatly ); |
|
| 350 | + public function slideToggle($element='this', $speed='', $callback='', $immediatly=false) { |
|
| 351 | + return $this->_showHideWithEffect("slideToggle", $element, $speed, $callback, $immediatly); |
|
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | /** |
@@ -364,8 +364,8 @@ discard block |
||
| 364 | 364 | * defers the execution if set to false |
| 365 | 365 | * @return string |
| 366 | 366 | */ |
| 367 | - public function hide($element = 'this', $speed = '', $callback = '', $immediatly = false) { |
|
| 368 | - return $this->_showHideWithEffect ( "hide", $element, $speed, $callback, $immediatly ); |
|
| 367 | + public function hide($element='this', $speed='', $callback='', $immediatly=false) { |
|
| 368 | + return $this->_showHideWithEffect("hide", $element, $speed, $callback, $immediatly); |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | /** |
@@ -381,8 +381,8 @@ discard block |
||
| 381 | 381 | * defers the execution if set to false |
| 382 | 382 | * @return string |
| 383 | 383 | */ |
| 384 | - public function toggle($element = 'this', $speed = '', $callback = '', $immediatly = false) { |
|
| 385 | - return $this->_showHideWithEffect ( "toggle", $element, $speed, $callback, $immediatly ); |
|
| 384 | + public function toggle($element='this', $speed='', $callback='', $immediatly=false) { |
|
| 385 | + return $this->_showHideWithEffect("toggle", $element, $speed, $callback, $immediatly); |
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | /** |
@@ -395,8 +395,8 @@ discard block |
||
| 395 | 395 | * defers the execution if set to false |
| 396 | 396 | * @return string |
| 397 | 397 | */ |
| 398 | - public function toggleClass($element = 'this', $class = '', $immediatly = false) { |
|
| 399 | - return $this->_genericCallValue ( 'toggleClass', $element, $class, $immediatly ); |
|
| 398 | + public function toggleClass($element='this', $class='', $immediatly=false) { |
|
| 399 | + return $this->_genericCallValue('toggleClass', $element, $class, $immediatly); |
|
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | /** |
@@ -407,12 +407,12 @@ discard block |
||
| 407 | 407 | * @param boolean $immediatly |
| 408 | 408 | * defers the execution if set to false |
| 409 | 409 | */ |
| 410 | - public function trigger($element = 'this', $event = 'click', $immediatly = false) { |
|
| 411 | - $element = Javascript::prep_element ( $element ); |
|
| 412 | - $str = "$({$element}).trigger(\"$event\");"; |
|
| 410 | + public function trigger($element='this', $event='click', $immediatly=false) { |
|
| 411 | + $element=Javascript::prep_element($element); |
|
| 412 | + $str="$({$element}).trigger(\"$event\");"; |
|
| 413 | 413 | |
| 414 | 414 | if ($immediatly) |
| 415 | - $this->jquery_code_for_compile [] = $str; |
|
| 415 | + $this->jquery_code_for_compile []=$str; |
|
| 416 | 416 | return $str; |
| 417 | 417 | } |
| 418 | 418 | |
@@ -429,8 +429,8 @@ discard block |
||
| 429 | 429 | * defers the execution if set to false |
| 430 | 430 | * @return string |
| 431 | 431 | */ |
| 432 | - public function show($element = 'this', $speed = '', $callback = '', $immediatly = false) { |
|
| 433 | - return $this->_showHideWithEffect ( "show", $element, $speed, $callback, $immediatly ); |
|
| 432 | + public function show($element='this', $speed='', $callback='', $immediatly=false) { |
|
| 433 | + return $this->_showHideWithEffect("show", $element, $speed, $callback, $immediatly); |
|
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | /** |
@@ -440,18 +440,18 @@ discard block |
||
| 440 | 440 | * @param array $options |
| 441 | 441 | * @return string |
| 442 | 442 | */ |
| 443 | - public function sortable($element, $options = array ()) { |
|
| 444 | - if (count ( $options ) > 0) { |
|
| 445 | - $sort_options = array (); |
|
| 446 | - foreach ( $options as $k => $v ) { |
|
| 447 | - $sort_options [] = "\n\t\t" . $k . ': ' . $v . ""; |
|
| 443 | + public function sortable($element, $options=array()) { |
|
| 444 | + if (count($options)>0) { |
|
| 445 | + $sort_options=array(); |
|
| 446 | + foreach ($options as $k => $v) { |
|
| 447 | + $sort_options []="\n\t\t".$k.': '.$v.""; |
|
| 448 | 448 | } |
| 449 | - $sort_options = implode ( ",", $sort_options ); |
|
| 449 | + $sort_options=implode(",", $sort_options); |
|
| 450 | 450 | } else { |
| 451 | - $sort_options = ''; |
|
| 451 | + $sort_options=''; |
|
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - return "$(" . Javascript::prep_element ( $element ) . ").sortable({" . $sort_options . "\n\t});"; |
|
| 454 | + return "$(".Javascript::prep_element($element).").sortable({".$sort_options."\n\t});"; |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | /** |
@@ -463,8 +463,8 @@ discard block |
||
| 463 | 463 | * plugin location |
| 464 | 464 | * @return string |
| 465 | 465 | */ |
| 466 | - public function tablesorter($table = '', $options = '') { |
|
| 467 | - $this->jquery_code_for_compile [] = "\t$(" . Javascript::prep_element ( $table ) . ").tablesorter($options);\n"; |
|
| 466 | + public function tablesorter($table='', $options='') { |
|
| 467 | + $this->jquery_code_for_compile []="\t$(".Javascript::prep_element($table).").tablesorter($options);\n"; |
|
| 468 | 468 | } |
| 469 | 469 | |
| 470 | 470 | /** |
@@ -476,14 +476,14 @@ discard block |
||
| 476 | 476 | * @param boolean $immediatly |
| 477 | 477 | * defers the execution if set to false |
| 478 | 478 | */ |
| 479 | - public function condition($condition, $jsCodeIfTrue, $jsCodeIfFalse = null, $immediatly = false) { |
|
| 480 | - $str = "if(" . $condition . "){" . $jsCodeIfTrue . "}"; |
|
| 481 | - if (isset ( $jsCodeIfFalse )) { |
|
| 482 | - $str .= "else{" . $jsCodeIfFalse . "}"; |
|
| 479 | + public function condition($condition, $jsCodeIfTrue, $jsCodeIfFalse=null, $immediatly=false) { |
|
| 480 | + $str="if(".$condition."){".$jsCodeIfTrue."}"; |
|
| 481 | + if (isset ($jsCodeIfFalse)) { |
|
| 482 | + $str.="else{".$jsCodeIfFalse."}"; |
|
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | if ($immediatly) |
| 486 | - $this->jquery_code_for_compile [] = $str; |
|
| 486 | + $this->jquery_code_for_compile []=$str; |
|
| 487 | 487 | return $str; |
| 488 | 488 | } |
| 489 | 489 | |
@@ -498,14 +498,14 @@ discard block |
||
| 498 | 498 | * @param boolean $immediatly |
| 499 | 499 | * @return string |
| 500 | 500 | */ |
| 501 | - private function _doJQuery($element, $jqueryCall, $param = "", $jsCallback = "", $immediatly = false) { |
|
| 502 | - $param = Javascript::prep_value ( $param ); |
|
| 503 | - $callback = ""; |
|
| 504 | - if ($jsCallback != "") |
|
| 505 | - $callback = ", function(event){\n{$jsCallback}\n}"; |
|
| 506 | - $script = "$(" . Javascript::prep_element ( $element ) . ")." . $jqueryCall . "(" . $param . $callback . ");\n"; |
|
| 501 | + private function _doJQuery($element, $jqueryCall, $param="", $jsCallback="", $immediatly=false) { |
|
| 502 | + $param=Javascript::prep_value($param); |
|
| 503 | + $callback=""; |
|
| 504 | + if ($jsCallback!="") |
|
| 505 | + $callback=", function(event){\n{$jsCallback}\n}"; |
|
| 506 | + $script="$(".Javascript::prep_element($element).").".$jqueryCall."(".$param.$callback.");\n"; |
|
| 507 | 507 | if ($immediatly) |
| 508 | - $this->jquery_code_for_compile [] = $script; |
|
| 508 | + $this->jquery_code_for_compile []=$script; |
|
| 509 | 509 | return $script; |
| 510 | 510 | } |
| 511 | 511 | |
@@ -522,8 +522,8 @@ discard block |
||
| 522 | 522 | * javascript code to execute after the jquery call |
| 523 | 523 | * @return mixed |
| 524 | 524 | */ |
| 525 | - public function doJQuery($element, $jqueryCall, $param = "", $jsCallback = "") { |
|
| 526 | - return $this->_doJQuery ( $element, $jqueryCall, $param, $jsCallback, true ); |
|
| 525 | + public function doJQuery($element, $jqueryCall, $param="", $jsCallback="") { |
|
| 526 | + return $this->_doJQuery($element, $jqueryCall, $param, $jsCallback, true); |
|
| 527 | 527 | } |
| 528 | 528 | |
| 529 | 529 | /** |
@@ -539,8 +539,8 @@ discard block |
||
| 539 | 539 | * javascript code to execute after the jquery call |
| 540 | 540 | * @return mixed |
| 541 | 541 | */ |
| 542 | - public function doJQueryDeferred($element, $jqueryCall, $param = "", $jsCallback = "") { |
|
| 543 | - return $this->_doJQuery ( $element, $jqueryCall, $param, $jsCallback, false ); |
|
| 542 | + public function doJQueryDeferred($element, $jqueryCall, $param="", $jsCallback="") { |
|
| 543 | + return $this->_doJQuery($element, $jqueryCall, $param, $jsCallback, false); |
|
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | /** |
@@ -557,8 +557,8 @@ discard block |
||
| 557 | 557 | * @param boolean $immediatly |
| 558 | 558 | * @return string |
| 559 | 559 | */ |
| 560 | - private function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param = "", $preventDefault = false, $stopPropagation = false, $jsCallback = "", $immediatly = true) { |
|
| 561 | - return $this->_add_event ( $element, $this->_doJQuery ( $elementToModify, $jqueryCall, $param, $jsCallback ), $event, $preventDefault, $stopPropagation, $immediatly ); |
|
| 560 | + private function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="", $immediatly=true) { |
|
| 561 | + return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 562 | 562 | } |
| 563 | 563 | |
| 564 | 564 | /** |
@@ -572,13 +572,13 @@ discard block |
||
| 572 | 572 | * @param array $parameters |
| 573 | 573 | * default : array("preventDefault"=>false,"stopPropagation"=>false,"jsCallback"=>'',"immediatly"=>true) |
| 574 | 574 | */ |
| 575 | - public function doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param = "", $parameters = array ()) { |
|
| 576 | - $jsCallback = ""; |
|
| 577 | - $stopPropagation = false; |
|
| 578 | - $preventDefault = false; |
|
| 579 | - $immediatly = true; |
|
| 580 | - extract ( $parameters ); |
|
| 581 | - return $this->_doJQueryOn ( $event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback, $immediatly ); |
|
| 575 | + public function doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $parameters=array()) { |
|
| 576 | + $jsCallback=""; |
|
| 577 | + $stopPropagation=false; |
|
| 578 | + $preventDefault=false; |
|
| 579 | + $immediatly=true; |
|
| 580 | + extract($parameters); |
|
| 581 | + return $this->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback, $immediatly); |
|
| 582 | 582 | } |
| 583 | 583 | |
| 584 | 584 | /** |
@@ -590,10 +590,10 @@ discard block |
||
| 590 | 590 | * delayed if false |
| 591 | 591 | * @return String |
| 592 | 592 | */ |
| 593 | - public function exec($js, $immediatly = false) { |
|
| 594 | - $script = $js . "\n"; |
|
| 593 | + public function exec($js, $immediatly=false) { |
|
| 594 | + $script=$js."\n"; |
|
| 595 | 595 | if ($immediatly) |
| 596 | - $this->jquery_code_for_compile [] = $script; |
|
| 596 | + $this->jquery_code_for_compile []=$script; |
|
| 597 | 597 | return $script; |
| 598 | 598 | } |
| 599 | 599 | |
@@ -607,8 +607,8 @@ discard block |
||
| 607 | 607 | * @return String |
| 608 | 608 | */ |
| 609 | 609 | public function execAtLast($js) { |
| 610 | - $script = $js . "\n"; |
|
| 611 | - $this->jquery_code_for_compile_at_last [] = $script; |
|
| 610 | + $script=$js."\n"; |
|
| 611 | + $this->jquery_code_for_compile_at_last []=$script; |
|
| 612 | 612 | return $script; |
| 613 | 613 | } |
| 614 | 614 | |
@@ -623,18 +623,18 @@ discard block |
||
| 623 | 623 | * default : array("preventDefault"=>false,"stopPropagation"=>false,"immediatly"=>true) |
| 624 | 624 | * @return String |
| 625 | 625 | */ |
| 626 | - public function execOn($event, $element, $js, $parameters = array ()) { |
|
| 627 | - $stopPropagation = false; |
|
| 628 | - $preventDefault = false; |
|
| 629 | - $immediatly = true; |
|
| 630 | - extract ( $parameters ); |
|
| 631 | - $script = $this->_add_event ( $element, $this->exec ( $js ), $event, $preventDefault, $stopPropagation, $immediatly ); |
|
| 626 | + public function execOn($event, $element, $js, $parameters=array()) { |
|
| 627 | + $stopPropagation=false; |
|
| 628 | + $preventDefault=false; |
|
| 629 | + $immediatly=true; |
|
| 630 | + extract($parameters); |
|
| 631 | + $script=$this->_add_event($element, $this->exec($js), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 632 | 632 | return $script; |
| 633 | 633 | } |
| 634 | - public function setJsonToElement($json, $elementClass = "_element", $immediatly = true) { |
|
| 635 | - $retour = "var data={$json};" . "\n\tdata=($.isPlainObject(data))?data:JSON.parse(data);" . "\n\tvar pk=data['pk'];var object=data['object'];" . "\n\tfor(var field in object){" . "\n\tif($('[data-field='+field+']',$('._element[data-ajax='+pk+']')).length){" . "\n\t\t$('[data-field='+field+']',$('._element[data-ajax='+pk+']')).each(function(){" . "\n\t\t\tif($(this).is('[value]')) { $(this).val(object[field]);} else { $(this).html(object[field]); }" . "\n\t});" . "\n}};\n"; |
|
| 636 | - $retour .= "\t$(document).trigger('jsonReady',[data]);\n"; |
|
| 637 | - return $this->exec ( $retour, $immediatly ); |
|
| 634 | + public function setJsonToElement($json, $elementClass="_element", $immediatly=true) { |
|
| 635 | + $retour="var data={$json};"."\n\tdata=($.isPlainObject(data))?data:JSON.parse(data);"."\n\tvar pk=data['pk'];var object=data['object'];"."\n\tfor(var field in object){"."\n\tif($('[data-field='+field+']',$('._element[data-ajax='+pk+']')).length){"."\n\t\t$('[data-field='+field+']',$('._element[data-ajax='+pk+']')).each(function(){"."\n\t\t\tif($(this).is('[value]')) { $(this).val(object[field]);} else { $(this).html(object[field]); }"."\n\t});"."\n}};\n"; |
|
| 636 | + $retour.="\t$(document).trigger('jsonReady',[data]);\n"; |
|
| 637 | + return $this->exec($retour, $immediatly); |
|
| 638 | 638 | } |
| 639 | 639 | |
| 640 | 640 | /** |
@@ -645,13 +645,13 @@ discard block |
||
| 645 | 645 | * @param array $parameters |
| 646 | 646 | * default : array("attr"=>"id","preventDefault"=>false,"stopPropagation"=>false,"immediatly"=>true) |
| 647 | 647 | */ |
| 648 | - public function setDraggable($element, $parameters = [ ]) { |
|
| 649 | - $attr = "id"; |
|
| 650 | - $preventDefault = false; |
|
| 651 | - $stopPropagation = false; |
|
| 652 | - $immediatly = true; |
|
| 653 | - extract ( $parameters ); |
|
| 654 | - $script = $this->_add_event ( $element, Javascript::draggable ( $attr ), "dragstart", $preventDefault, $stopPropagation, $immediatly ); |
|
| 648 | + public function setDraggable($element, $parameters=[]) { |
|
| 649 | + $attr="id"; |
|
| 650 | + $preventDefault=false; |
|
| 651 | + $stopPropagation=false; |
|
| 652 | + $immediatly=true; |
|
| 653 | + extract($parameters); |
|
| 654 | + $script=$this->_add_event($element, Javascript::draggable($attr), "dragstart", $preventDefault, $stopPropagation, $immediatly); |
|
| 655 | 655 | return $script; |
| 656 | 656 | } |
| 657 | 657 | |
@@ -665,13 +665,13 @@ discard block |
||
| 665 | 665 | * @param string $jsCallback |
| 666 | 666 | * the js script to call when element is dropped |
| 667 | 667 | */ |
| 668 | - public function asDropZone($element, $jsCallback = "", $parameters = [ ]) { |
|
| 669 | - $stopPropagation = false; |
|
| 670 | - $immediatly = true; |
|
| 671 | - $jqueryDone = "append"; |
|
| 672 | - $script = $this->_add_event ( $element, '', "dragover", true, $stopPropagation, $immediatly ); |
|
| 673 | - extract ( $parameters ); |
|
| 674 | - $script .= $this->_add_event ( $element, Javascript::dropZone ( $jqueryDone, $jsCallback ), "drop", true, $stopPropagation, $immediatly ); |
|
| 668 | + public function asDropZone($element, $jsCallback="", $parameters=[]) { |
|
| 669 | + $stopPropagation=false; |
|
| 670 | + $immediatly=true; |
|
| 671 | + $jqueryDone="append"; |
|
| 672 | + $script=$this->_add_event($element, '', "dragover", true, $stopPropagation, $immediatly); |
|
| 673 | + extract($parameters); |
|
| 674 | + $script.=$this->_add_event($element, Javascript::dropZone($jqueryDone, $jsCallback), "drop", true, $stopPropagation, $immediatly); |
|
| 675 | 675 | return $script; |
| 676 | 676 | } |
| 677 | 677 | |
@@ -688,16 +688,16 @@ discard block |
||
| 688 | 688 | * delayed if false |
| 689 | 689 | * @return string |
| 690 | 690 | */ |
| 691 | - public function interval($jsCode, $time, $globalName = null, $immediatly = true) { |
|
| 692 | - if (! Javascript::isFunction ( $jsCode )) { |
|
| 693 | - $jsCode = "function(){\n" . $jsCode . "\n}"; |
|
| 691 | + public function interval($jsCode, $time, $globalName=null, $immediatly=true) { |
|
| 692 | + if (!Javascript::isFunction($jsCode)) { |
|
| 693 | + $jsCode="function(){\n".$jsCode."\n}"; |
|
| 694 | 694 | } |
| 695 | - if (isset ( $globalName )) { |
|
| 696 | - $script = "if(window.{$globalName}){clearInterval(window.{$globalName});}\nwindow.{$globalName}=setInterval({$jsCode},{$time});"; |
|
| 695 | + if (isset ($globalName)) { |
|
| 696 | + $script="if(window.{$globalName}){clearInterval(window.{$globalName});}\nwindow.{$globalName}=setInterval({$jsCode},{$time});"; |
|
| 697 | 697 | } else { |
| 698 | - $script = "setInterval({$jsCode},{$time});"; |
|
| 698 | + $script="setInterval({$jsCode},{$time});"; |
|
| 699 | 699 | } |
| 700 | - return $this->exec ( $script, $immediatly ); |
|
| 700 | + return $this->exec($script, $immediatly); |
|
| 701 | 701 | } |
| 702 | 702 | |
| 703 | 703 | /** |
@@ -709,8 +709,8 @@ discard block |
||
| 709 | 709 | * delayed if false |
| 710 | 710 | * @return string |
| 711 | 711 | */ |
| 712 | - public function clearInterval($globalName, $immediatly = true) { |
|
| 713 | - return $this->exec ( "if(window.{$globalName}){clearInterval(window.{$globalName});}", $immediatly ); |
|
| 712 | + public function clearInterval($globalName, $immediatly=true) { |
|
| 713 | + return $this->exec("if(window.{$globalName}){clearInterval(window.{$globalName});}", $immediatly); |
|
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | /** |
@@ -731,20 +731,20 @@ discard block |
||
| 731 | 731 | * delayed if false |
| 732 | 732 | * @return string |
| 733 | 733 | */ |
| 734 | - public function counter($counterSelector, $value = 0, $limit = 0, $globalName = null, $countDown = true, $immediatly = true) { |
|
| 735 | - $stop = ""; |
|
| 734 | + public function counter($counterSelector, $value=0, $limit=0, $globalName=null, $countDown=true, $immediatly=true) { |
|
| 735 | + $stop=""; |
|
| 736 | 736 | if ($countDown) { |
| 737 | - $stop = "if (--timer < " . $limit . ") {clearInterval(interval);display.trigger({type:'counter-end',value: timer,limit:" . $limit . "});}"; |
|
| 737 | + $stop="if (--timer < ".$limit.") {clearInterval(interval);display.trigger({type:'counter-end',value: timer,limit:".$limit."});}"; |
|
| 738 | 738 | } else { |
| 739 | - if ($limit != 0) { |
|
| 740 | - $stop = "if (++timer > " . $limit . ") {clearInterval(interval);display.trigger({type:'counter-end',value: timer,limit:" . $limit . "});}"; |
|
| 739 | + if ($limit!=0) { |
|
| 740 | + $stop="if (++timer > ".$limit.") {clearInterval(interval);display.trigger({type:'counter-end',value: timer,limit:".$limit."});}"; |
|
| 741 | 741 | } |
| 742 | 742 | } |
| 743 | - $global = ""; |
|
| 744 | - if (isset ( $globalName )) { |
|
| 745 | - $global = "\nwindow.{$globalName}=interval;"; |
|
| 743 | + $global=""; |
|
| 744 | + if (isset ($globalName)) { |
|
| 745 | + $global="\nwindow.{$globalName}=interval;"; |
|
| 746 | 746 | } |
| 747 | - $timer = "var startTimer=function(duration, display) {var timer = duration, days, hours, minutes, seconds; |
|
| 747 | + $timer="var startTimer=function(duration, display) {var timer = duration, days, hours, minutes, seconds; |
|
| 748 | 748 | var sh=function(disp,v){if(disp.is('[value]')){disp.val(v);} else {disp.html(v);};}; |
| 749 | 749 | var shHide=function(v,k,kBefore){if(v==0 && display.find(k).closest('.timer').is(':visible') && (!kBefore || !display.find(kBefore).closest('.timer').is(':visible'))){display.find(k).closest('.timer').hide();}else{sh(display.find(k),v);}}; |
| 750 | 750 | var pl=function(v,text){return (v>1)?v+' '+text+'s':(v>0)?v+' '+text:'';}; |
@@ -760,12 +760,12 @@ discard block |
||
| 760 | 760 | minutes = d0(parseInt((timer%3600) / 60, 10)); |
| 761 | 761 | seconds = d0(parseInt(timer%60, 10)); |
| 762 | 762 | mainSh(days,hours,minutes,seconds); |
| 763 | - " . $stop . " |
|
| 763 | + " . $stop." |
|
| 764 | 764 | }, 1000); |
| 765 | - " . $global . " |
|
| 765 | + " . $global." |
|
| 766 | 766 | }"; |
| 767 | - $element = '$("' . $counterSelector . '")'; |
|
| 768 | - return $this->exec ( $timer . "\nstartTimer(" . $value . "," . $element . ");", $immediatly ); |
|
| 767 | + $element='$("'.$counterSelector.'")'; |
|
| 768 | + return $this->exec($timer."\nstartTimer(".$value.",".$element.");", $immediatly); |
|
| 769 | 769 | } |
| 770 | 770 | |
| 771 | 771 | /** |
@@ -787,8 +787,8 @@ discard block |
||
| 787 | 787 | * count down if true or elapse if false |
| 788 | 788 | * @return string |
| 789 | 789 | */ |
| 790 | - public function counterOn($element, $event, $counterSelector, $value = 0, $limit = 0, $globalName = null, $countDown = true) { |
|
| 791 | - return $this->execOn ( $event, $element, $this->counter ( $counterSelector, $value, $limit, $globalName, $countDown, false ) ); |
|
| 790 | + public function counterOn($element, $event, $counterSelector, $value=0, $limit=0, $globalName=null, $countDown=true) { |
|
| 791 | + return $this->execOn($event, $element, $this->counter($counterSelector, $value, $limit, $globalName, $countDown, false)); |
|
| 792 | 792 | } |
| 793 | 793 | |
| 794 | 794 | /** |
@@ -802,8 +802,8 @@ discard block |
||
| 802 | 802 | * the active href (if null, window.location.href is used) |
| 803 | 803 | * @return string |
| 804 | 804 | */ |
| 805 | - public function activateLink($target, $property = 'href', $href = null) { |
|
| 806 | - return $this->execAtLast ( $this->_activateLink ( $target, $property, $href ) ); |
|
| 805 | + public function activateLink($target, $property='href', $href=null) { |
|
| 806 | + return $this->execAtLast($this->_activateLink($target, $property, $href)); |
|
| 807 | 807 | } |
| 808 | 808 | |
| 809 | 809 | /** |
@@ -817,14 +817,14 @@ discard block |
||
| 817 | 817 | * the active href (if null, window.location.href is used) |
| 818 | 818 | * @return string |
| 819 | 819 | */ |
| 820 | - public function _activateLink($target, $property = 'href', $href = null) { |
|
| 821 | - $js = '$("' . $target . ' [' . $property . ']").removeClass("active");'; |
|
| 822 | - if (isset ( $href )) { |
|
| 823 | - $js .= 'var href="' . $href . '";'; |
|
| 820 | + public function _activateLink($target, $property='href', $href=null) { |
|
| 821 | + $js='$("'.$target.' ['.$property.']").removeClass("active");'; |
|
| 822 | + if (isset ($href)) { |
|
| 823 | + $js.='var href="'.$href.'";'; |
|
| 824 | 824 | } else { |
| 825 | - $js .= 'var href=window.location.href;'; |
|
| 825 | + $js.='var href=window.location.href;'; |
|
| 826 | 826 | } |
| 827 | - $js .= '$("' . $target . ' [' . $property . ']").each(function(){if(href.includes($(this).attr("' . $property . '"))) $(this).addClass("active");});'; |
|
| 827 | + $js.='$("'.$target.' ['.$property.']").each(function(){if(href.includes($(this).attr("'.$property.'"))) $(this).addClass("active");});'; |
|
| 828 | 828 | return $js; |
| 829 | 829 | } |
| 830 | 830 | } |