@@ -15,11 +15,11 @@ discard block |
||
| 15 | 15 | * @version 1.3 |
| 16 | 16 | */ |
| 17 | 17 | abstract class BaseHtml extends BaseWidget { |
| 18 | - use BaseHtmlEventsTrait,BaseHtmlPropertiesTrait; |
|
| 18 | + use BaseHtmlEventsTrait, BaseHtmlPropertiesTrait; |
|
| 19 | 19 | protected $_template; |
| 20 | 20 | protected $tagName; |
| 21 | - protected $_wrapBefore=array (); |
|
| 22 | - protected $_wrapAfter=array (); |
|
| 21 | + protected $_wrapBefore=array(); |
|
| 22 | + protected $_wrapAfter=array(); |
|
| 23 | 23 | protected $_bsComponent; |
| 24 | 24 | protected $_compiled=false; |
| 25 | 25 | protected $_postCompile; |
@@ -32,14 +32,14 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | abstract public function run(JsUtils $js); |
| 34 | 34 | |
| 35 | - private function _callSetter($setter,$key,$value,&$array){ |
|
| 35 | + private function _callSetter($setter, $key, $value, &$array) { |
|
| 36 | 36 | $result=false; |
| 37 | - if (method_exists($this, $setter) && substr($setter, 0, 1) !== "_") { |
|
| 37 | + if (method_exists($this, $setter) && substr($setter, 0, 1)!=="_") { |
|
| 38 | 38 | try { |
| 39 | 39 | $this->$setter($value); |
| 40 | 40 | unset($array[$key]); |
| 41 | 41 | $result=true; |
| 42 | - } catch ( \Exception $e ) { |
|
| 42 | + }catch (\Exception $e) { |
|
| 43 | 43 | $result=false; |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -47,17 +47,17 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | protected function getTemplate(JsUtils $js=NULL) { |
| 50 | - return PropertyWrapper::wrap($this->_wrapBefore, $js) . $this->_template . PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
| 50 | + return PropertyWrapper::wrap($this->_wrapBefore, $js).$this->_template.PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | protected function ctrl($name, $value, $typeCtrl) { |
| 54 | 54 | if (\is_array($typeCtrl)) { |
| 55 | - if (array_search($value, $typeCtrl) === false) { |
|
| 56 | - throw new \Exception("La valeur passée `" . $value . "` à la propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}"); |
|
| 55 | + if (array_search($value, $typeCtrl)===false) { |
|
| 56 | + throw new \Exception("La valeur passée `".$value."` à la propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
| 57 | 57 | } |
| 58 | 58 | } else { |
| 59 | 59 | if (!$typeCtrl($value)) { |
| 60 | - throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name); |
|
| 60 | + throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name); |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | return true; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | protected function setMemberCtrl(&$name, $value, $typeCtrl) { |
| 69 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 69 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 70 | 70 | return $name=$value; |
| 71 | 71 | } |
| 72 | 72 | return $this; |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") { |
| 76 | 76 | if (\is_array($typeCtrl)) { |
| 77 | 77 | $this->removeOldValues($name, $typeCtrl); |
| 78 | - $name.=$separator . $value; |
|
| 78 | + $name.=$separator.$value; |
|
| 79 | 79 | } |
| 80 | 80 | return $this; |
| 81 | 81 | } |
@@ -83,17 +83,17 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | |
| 85 | 85 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
| 86 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 86 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 87 | 87 | if (\is_array($typeCtrl)) { |
| 88 | 88 | $this->removeOldValues($name, $typeCtrl); |
| 89 | 89 | } |
| 90 | - $name.=$separator . $value; |
|
| 90 | + $name.=$separator.$value; |
|
| 91 | 91 | } |
| 92 | 92 | return $this; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | protected function addToMember(&$name, $value, $separator=" ") { |
| 96 | - $name=str_ireplace($value, "", $name) . $separator . $value; |
|
| 96 | + $name=str_ireplace($value, "", $name).$separator.$value; |
|
| 97 | 97 | return $this; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -104,18 +104,18 @@ discard block |
||
| 104 | 104 | $oldValue=trim($oldValue); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - protected function _getElementBy($callback,$elements){ |
|
| 107 | + protected function _getElementBy($callback, $elements) { |
|
| 108 | 108 | if (\is_array($elements)) { |
| 109 | 109 | $elements=\array_values($elements); |
| 110 | 110 | $flag=false; |
| 111 | 111 | $index=0; |
| 112 | - while ( !$flag && $index < sizeof($elements) ) { |
|
| 112 | + while (!$flag && $index<sizeof($elements)) { |
|
| 113 | 113 | if ($elements[$index] instanceof BaseHtml) |
| 114 | 114 | $flag=($callback($elements[$index])); |
| 115 | 115 | $index++; |
| 116 | 116 | } |
| 117 | - if ($flag === true) |
|
| 118 | - return $elements[$index - 1]; |
|
| 117 | + if ($flag===true) |
|
| 118 | + return $elements[$index-1]; |
|
| 119 | 119 | } elseif ($elements instanceof BaseHtml) { |
| 120 | 120 | if ($callback($elements)) |
| 121 | 121 | return $elements; |
@@ -143,13 +143,13 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | public function fromArray($array) { |
| 146 | - foreach ( $this as $key => $value ) { |
|
| 147 | - if(array_key_exists($key, $array)===true) |
|
| 148 | - $this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array); |
|
| 146 | + foreach ($this as $key => $value) { |
|
| 147 | + if (array_key_exists($key, $array)===true) |
|
| 148 | + $this->_callSetter("set".ucfirst($key), $key, $array[$key], $array); |
|
| 149 | 149 | } |
| 150 | - foreach ( $array as $key => $value ) { |
|
| 151 | - if($this->_callSetter($key, $key, $value, $array)===false){ |
|
| 152 | - $this->_callSetter("set" . ucfirst($key), $key, $value, $array); |
|
| 150 | + foreach ($array as $key => $value) { |
|
| 151 | + if ($this->_callSetter($key, $key, $value, $array)===false) { |
|
| 152 | + $this->_callSetter("set".ucfirst($key), $key, $value, $array); |
|
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | return $array; |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | public function fromDatabaseObjects($objects, $function) { |
| 159 | 159 | if (isset($objects)) { |
| 160 | - foreach ( $objects as $object ) { |
|
| 160 | + foreach ($objects as $object) { |
|
| 161 | 161 | $this->fromDatabaseObject($object, $function); |
| 162 | 162 | } |
| 163 | 163 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | |
| 180 | 180 | public function getElementById($identifier, $elements) { |
| 181 | - return $this->_getElementBy(function(BaseWidget $element) use ($identifier){return $element->getIdentifier()===$identifier;}, $elements); |
|
| 181 | + return $this->_getElementBy(function(BaseWidget $element) use ($identifier){return $element->getIdentifier()===$identifier; }, $elements); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | public function getBsComponent() { |
@@ -191,14 +191,14 @@ discard block |
||
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | protected function compile_once(JsUtils $js=NULL, &$view=NULL) { |
| 194 | - if(!$this->_compiled){ |
|
| 195 | - if(isset($js)){ |
|
| 194 | + if (!$this->_compiled) { |
|
| 195 | + if (isset($js)) { |
|
| 196 | 196 | $beforeCompile=$js->getParam("beforeCompileHtml"); |
| 197 | - if(\is_callable($beforeCompile)){ |
|
| 198 | - $beforeCompile($this,$js,$view); |
|
| 197 | + if (\is_callable($beforeCompile)) { |
|
| 198 | + $beforeCompile($this, $js, $view); |
|
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | - if(\is_callable($this->_preCompile)){ |
|
| 201 | + if (\is_callable($this->_preCompile)) { |
|
| 202 | 202 | $pc=$this->_preCompile; |
| 203 | 203 | $pc($this); |
| 204 | 204 | } |
@@ -208,15 +208,15 @@ discard block |
||
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 211 | - $this->compile_once($js,$view); |
|
| 211 | + $this->compile_once($js, $view); |
|
| 212 | 212 | $result=$this->getTemplate($js); |
| 213 | - foreach ( $this as $key => $value ) { |
|
| 214 | - if(\strstr($result, "%{$key}%")!==false){ |
|
| 213 | + foreach ($this as $key => $value) { |
|
| 214 | + if (\strstr($result, "%{$key}%")!==false) { |
|
| 215 | 215 | if (\is_array($value)) { |
| 216 | 216 | $v=PropertyWrapper::wrap($value, $js); |
| 217 | - }elseif($value instanceof \stdClass){ |
|
| 218 | - $v=\print_r($value,true); |
|
| 219 | - }else{ |
|
| 217 | + }elseif ($value instanceof \stdClass) { |
|
| 218 | + $v=\print_r($value, true); |
|
| 219 | + } else { |
|
| 220 | 220 | $v=$value; |
| 221 | 221 | } |
| 222 | 222 | $result=str_replace("%{$key}%", $v, $result); |
@@ -224,12 +224,12 @@ discard block |
||
| 224 | 224 | } |
| 225 | 225 | if (isset($js)===true) { |
| 226 | 226 | $this->run($js); |
| 227 | - if (isset($view) === true) { |
|
| 227 | + if (isset($view)===true) { |
|
| 228 | 228 | $js->addViewElement($this->_identifier, $result, $view); |
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - if(\is_callable($this->_postCompile)){ |
|
| 232 | + if (\is_callable($this->_postCompile)) { |
|
| 233 | 233 | $pc=$this->_postCompile; |
| 234 | 234 | $pc($this); |
| 235 | 235 | } |
@@ -243,13 +243,13 @@ discard block |
||
| 243 | 243 | * @param array $parameters default: ["jsCallback"=>"","jqueryDone"=>"append"] |
| 244 | 244 | * @return \Ajax\common\html\BaseHtml |
| 245 | 245 | */ |
| 246 | - public function setDraggable($attr="id",$dropZone=null,$parameters=[]){ |
|
| 246 | + public function setDraggable($attr="id", $dropZone=null, $parameters=[]) { |
|
| 247 | 247 | $this->setProperty("draggable", "true"); |
| 248 | - $this->addEvent("dragstart",Javascript::draggable($attr)); |
|
| 249 | - if(isset($dropZone)&& $dropZone instanceof BaseHtml){ |
|
| 250 | - $jqueryDone="append";$jsCallback=""; |
|
| 248 | + $this->addEvent("dragstart", Javascript::draggable($attr)); |
|
| 249 | + if (isset($dropZone) && $dropZone instanceof BaseHtml) { |
|
| 250 | + $jqueryDone="append"; $jsCallback=""; |
|
| 251 | 251 | extract($parameters); |
| 252 | - $dropZone->asDropZone($jsCallback,$jqueryDone,$parameters); |
|
| 252 | + $dropZone->asDropZone($jsCallback, $jqueryDone, $parameters); |
|
| 253 | 253 | } |
| 254 | 254 | return $this; |
| 255 | 255 | } |
@@ -261,11 +261,11 @@ discard block |
||
| 261 | 261 | * @param array $parameters |
| 262 | 262 | * @return \Ajax\common\html\BaseHtml |
| 263 | 263 | */ |
| 264 | - public function asDropZone($jsCallback="",$jqueryDone="append",$parameters=[]){ |
|
| 264 | + public function asDropZone($jsCallback="", $jqueryDone="append", $parameters=[]) { |
|
| 265 | 265 | $stopPropagation=false; |
| 266 | - $script=$this->addEvent("dragover", '', $stopPropagation,true); |
|
| 266 | + $script=$this->addEvent("dragover", '', $stopPropagation, true); |
|
| 267 | 267 | extract($parameters); |
| 268 | - $this->addEvent("drop",Javascript::dropZone($jqueryDone,$jsCallback),$stopPropagation,true); |
|
| 268 | + $this->addEvent("drop", Javascript::dropZone($jqueryDone, $jsCallback), $stopPropagation, true); |
|
| 269 | 269 | return $this; |
| 270 | 270 | } |
| 271 | 271 | |
@@ -273,11 +273,11 @@ discard block |
||
| 273 | 273 | return $this->compile(); |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | - public function onPostCompile($callback){ |
|
| 276 | + public function onPostCompile($callback) { |
|
| 277 | 277 | $this->_postCompile=$callback; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - public function onPreCompile($callback){ |
|
| 280 | + public function onPreCompile($callback) { |
|
| 281 | 281 | $this->_preCompile=$callback; |
| 282 | 282 | } |
| 283 | 283 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | trait JsUtilsActionsTrait { |
| 13 | 13 | |
| 14 | - abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true); |
|
| 14 | + abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true); |
|
| 15 | 15 | /** |
| 16 | 16 | * show or hide with effect |
| 17 | 17 | * |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * @param boolean $immediatly defers the execution if set to false |
| 23 | 23 | * @return string |
| 24 | 24 | */ |
| 25 | - protected function _showHideWithEffect($action,$element='this', $speed='', $callback='', $immediatly=false) { |
|
| 25 | + protected function _showHideWithEffect($action, $element='this', $speed='', $callback='', $immediatly=false) { |
|
| 26 | 26 | $element=Javascript::prep_element($element); |
| 27 | 27 | $speed=$this->_validate_speed($speed); |
| 28 | 28 | if ($callback!='') { |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | * @return string |
| 40 | 40 | */ |
| 41 | 41 | private function _validate_speed($speed) { |
| 42 | - if (in_array($speed, array ( |
|
| 43 | - 'slow','normal','fast' |
|
| 42 | + if (in_array($speed, array( |
|
| 43 | + 'slow', 'normal', 'fast' |
|
| 44 | 44 | ))) { |
| 45 | 45 | $speed='"'.$speed.'"'; |
| 46 | 46 | } elseif (preg_match("/[^0-9]/", $speed)) { |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * @param string $param |
| 58 | 58 | * @param boolean $immediatly delayed if false |
| 59 | 59 | */ |
| 60 | - public function _genericCallValue($jQueryCall,$element='this', $param="", $immediatly=false) { |
|
| 60 | + public function _genericCallValue($jQueryCall, $element='this', $param="", $immediatly=false) { |
|
| 61 | 61 | $element=Javascript::prep_element($element); |
| 62 | 62 | if (isset($param)) { |
| 63 | 63 | $param=Javascript::prep_value($param); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * @param boolean $immediatly delayed if false |
| 78 | 78 | * @return string |
| 79 | 79 | */ |
| 80 | - public function _genericCallElement($jQueryCall,$to='this', $element, $immediatly=false) { |
|
| 80 | + public function _genericCallElement($jQueryCall, $to='this', $element, $immediatly=false) { |
|
| 81 | 81 | $to=Javascript::prep_element($to); |
| 82 | 82 | $element=Javascript::prep_element($element); |
| 83 | 83 | $str="$({$to}).{$jQueryCall}({$element});"; |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * @return string |
| 95 | 95 | */ |
| 96 | 96 | public function addClass($element='this', $class='', $immediatly=false) { |
| 97 | - return $this->_genericCallValue('addClass',$element, $class, $immediatly); |
|
| 97 | + return $this->_genericCallValue('addClass', $element, $class, $immediatly); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | * @param boolean $immediatly defers the execution if set to false |
| 105 | 105 | * @return string |
| 106 | 106 | */ |
| 107 | - public function after($to, $element, $immediatly=false){ |
|
| 108 | - return $this->_genericCallElement('after',$to, $element, $immediatly); |
|
| 107 | + public function after($to, $element, $immediatly=false) { |
|
| 108 | + return $this->_genericCallElement('after', $to, $element, $immediatly); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | * @param boolean $immediatly defers the execution if set to false |
| 116 | 116 | * @return string |
| 117 | 117 | */ |
| 118 | - public function before($to, $element, $immediatly=false){ |
|
| 119 | - return $this->_genericCallElement('before',$to, $element, $immediatly); |
|
| 118 | + public function before($to, $element, $immediatly=false) { |
|
| 119 | + return $this->_genericCallElement('before', $to, $element, $immediatly); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | * @param string $value |
| 145 | 145 | * @param boolean $immediatly defers the execution if set to false |
| 146 | 146 | */ |
| 147 | - public function val($element='this',$value='',$immediatly=false){ |
|
| 148 | - return $this->_genericCallValue('val',$element,$value,$immediatly); |
|
| 147 | + public function val($element='this', $value='', $immediatly=false) { |
|
| 148 | + return $this->_genericCallValue('val', $element, $value, $immediatly); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /** |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * @param boolean $immediatly defers the execution if set to false |
| 156 | 156 | */ |
| 157 | 157 | public function html($element='this', $value='', $immediatly=false) { |
| 158 | - return $this->_genericCallValue('html',$element, $value, $immediatly); |
|
| 158 | + return $this->_genericCallValue('html', $element, $value, $immediatly); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | /** |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | $animations="\t\t\t"; |
| 176 | 176 | if (\is_array($params)) { |
| 177 | - foreach ( $params as $param => $value ) { |
|
| 177 | + foreach ($params as $param => $value) { |
|
| 178 | 178 | $animations.=$param.': \''.$value.'\', '; |
| 179 | 179 | } |
| 180 | 180 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | * @return string |
| 204 | 204 | */ |
| 205 | 205 | public function append($to, $element, $immediatly=false) { |
| 206 | - return $this->_genericCallElement('append',$to, $element, $immediatly); |
|
| 206 | + return $this->_genericCallElement('append', $to, $element, $immediatly); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | /** |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | * @return string |
| 215 | 215 | */ |
| 216 | 216 | public function prepend($to, $element, $immediatly=false) { |
| 217 | - return $this->_genericCallElement('prepend',$to, $element, $immediatly); |
|
| 217 | + return $this->_genericCallElement('prepend', $to, $element, $immediatly); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | * @return string |
| 228 | 228 | */ |
| 229 | 229 | public function fadeIn($element='this', $speed='', $callback='', $immediatly=false) { |
| 230 | - return $this->_showHideWithEffect("fadeIn",$element,$speed,$callback,$immediatly); |
|
| 230 | + return $this->_showHideWithEffect("fadeIn", $element, $speed, $callback, $immediatly); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | /** |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | * @return string |
| 241 | 241 | */ |
| 242 | 242 | public function fadeOut($element='this', $speed='', $callback='', $immediatly=false) { |
| 243 | - return $this->_showHideWithEffect("fadeOut",$element,$speed,$callback,$immediatly); |
|
| 243 | + return $this->_showHideWithEffect("fadeOut", $element, $speed, $callback, $immediatly); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | * @return string |
| 254 | 254 | */ |
| 255 | 255 | public function slideUp($element='this', $speed='', $callback='', $immediatly=false) { |
| 256 | - return $this->_showHideWithEffect("slideUp",$element,$speed,$callback,$immediatly); |
|
| 256 | + return $this->_showHideWithEffect("slideUp", $element, $speed, $callback, $immediatly); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | /** |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | * @return string |
| 266 | 266 | */ |
| 267 | 267 | public function removeClass($element='this', $class='', $immediatly=false) { |
| 268 | - return $this->_genericCall('removeClass',$element, $class, $immediatly); |
|
| 268 | + return $this->_genericCall('removeClass', $element, $class, $immediatly); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | /** |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | * @return string |
| 279 | 279 | */ |
| 280 | 280 | public function slideDown($element='this', $speed='', $callback='', $immediatly=false) { |
| 281 | - return $this->_showHideWithEffect("slideDown",$element,$speed,$callback,$immediatly); |
|
| 281 | + return $this->_showHideWithEffect("slideDown", $element, $speed, $callback, $immediatly); |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | /** |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | * @return string |
| 292 | 292 | */ |
| 293 | 293 | public function slideToggle($element='this', $speed='', $callback='', $immediatly=false) { |
| 294 | - return $this->_showHideWithEffect("slideToggle",$element,$speed,$callback,$immediatly); |
|
| 294 | + return $this->_showHideWithEffect("slideToggle", $element, $speed, $callback, $immediatly); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | * @return string |
| 305 | 305 | */ |
| 306 | 306 | public function hide($element='this', $speed='', $callback='', $immediatly=false) { |
| 307 | - return $this->_showHideWithEffect("hide",$element,$speed,$callback,$immediatly); |
|
| 307 | + return $this->_showHideWithEffect("hide", $element, $speed, $callback, $immediatly); |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | /** |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | * @return string |
| 318 | 318 | */ |
| 319 | 319 | public function toggle($element='this', $speed='', $callback='', $immediatly=false) { |
| 320 | - return $this->_showHideWithEffect("toggle",$element,$speed,$callback,$immediatly); |
|
| 320 | + return $this->_showHideWithEffect("toggle", $element, $speed, $callback, $immediatly); |
|
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | /** |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | * @return string |
| 329 | 329 | */ |
| 330 | 330 | public function toggleClass($element='this', $class='', $immediatly=false) { |
| 331 | - return $this->_genericCallValue('toggleClass',$element, $class, $immediatly); |
|
| 331 | + return $this->_genericCallValue('toggleClass', $element, $class, $immediatly); |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | /** |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | * @return string |
| 357 | 357 | */ |
| 358 | 358 | public function show($element='this', $speed='', $callback='', $immediatly=false) { |
| 359 | - return $this->_showHideWithEffect("show",$element,$speed,$callback,$immediatly); |
|
| 359 | + return $this->_showHideWithEffect("show", $element, $speed, $callback, $immediatly); |
|
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | /** |
@@ -368,8 +368,8 @@ discard block |
||
| 368 | 368 | */ |
| 369 | 369 | public function sortable($element, $options=array()) { |
| 370 | 370 | if (count($options)>0) { |
| 371 | - $sort_options=array (); |
|
| 372 | - foreach ( $options as $k => $v ) { |
|
| 371 | + $sort_options=array(); |
|
| 372 | + foreach ($options as $k => $v) { |
|
| 373 | 373 | $sort_options[]="\n\t\t".$k.': '.$v.""; |
| 374 | 374 | } |
| 375 | 375 | $sort_options=implode(",", $sort_options); |
@@ -466,8 +466,8 @@ discard block |
||
| 466 | 466 | * @param boolean $immediatly |
| 467 | 467 | * @return string |
| 468 | 468 | */ |
| 469 | - private function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="",$immediatly=true) { |
|
| 470 | - return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation,$immediatly); |
|
| 469 | + private function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="", $immediatly=true) { |
|
| 470 | + return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | /** |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | $preventDefault=false; |
| 486 | 486 | $immediatly=true; |
| 487 | 487 | extract($parameters); |
| 488 | - return $this->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback,$immediatly); |
|
| 488 | + return $this->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback, $immediatly); |
|
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | /** |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | $preventDefault=false; |
| 527 | 527 | $immediatly=true; |
| 528 | 528 | extract($parameters); |
| 529 | - $script=$this->_add_event($element, $this->exec($js), $event, $preventDefault, $stopPropagation,$immediatly); |
|
| 529 | + $script=$this->_add_event($element, $this->exec($js), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 530 | 530 | return $script; |
| 531 | 531 | } |
| 532 | 532 | |
@@ -535,13 +535,13 @@ discard block |
||
| 535 | 535 | * @param string $element The element selector |
| 536 | 536 | * @param array $parameters default : array("attr"=>"id","preventDefault"=>false,"stopPropagation"=>false,"immediatly"=>true) |
| 537 | 537 | */ |
| 538 | - public function setDraggable($element,$parameters=[]){ |
|
| 538 | + public function setDraggable($element, $parameters=[]) { |
|
| 539 | 539 | $stopPropagation=false; |
| 540 | 540 | $preventDefault=false; |
| 541 | 541 | $immediatly=true; |
| 542 | 542 | $attr="id"; |
| 543 | 543 | extract($parameters); |
| 544 | - $script=$this->_add_event($element, Javascript::draggable($attr), "dragstart",$parameters); |
|
| 544 | + $script=$this->_add_event($element, Javascript::draggable($attr), "dragstart", $parameters); |
|
| 545 | 545 | return $script; |
| 546 | 546 | } |
| 547 | 547 | |
@@ -551,14 +551,14 @@ discard block |
||
| 551 | 551 | * @param array $parameters default : array("attr"=>"id","stopPropagation"=>false,"immediatly"=>true,"jqueryDone"=>"append") |
| 552 | 552 | * @param string $jsCallback the js script to call when element is dropped |
| 553 | 553 | */ |
| 554 | - public function asDropZone($element,$jsCallback="",$parameters=[]){ |
|
| 554 | + public function asDropZone($element, $jsCallback="", $parameters=[]) { |
|
| 555 | 555 | $stopPropagation=false; |
| 556 | 556 | $preventDefault=true; |
| 557 | 557 | $immediatly=true; |
| 558 | 558 | $jqueryDone="append"; |
| 559 | - $script=$this->_add_event($element, '', "dragover",true,$stopPropagation,$immediatly); |
|
| 559 | + $script=$this->_add_event($element, '', "dragover", true, $stopPropagation, $immediatly); |
|
| 560 | 560 | extract($parameters); |
| 561 | - $script.=$this->_add_event($element, Javascript::dropZone($jqueryDone,$jsCallback), "drop",true,$stopPropagation,$immediatly); |
|
| 561 | + $script.=$this->_add_event($element, Javascript::dropZone($jqueryDone, $jsCallback), "drop", true, $stopPropagation, $immediatly); |
|
| 562 | 562 | return $script; |
| 563 | 563 | } |
| 564 | 564 | } |
@@ -6,16 +6,16 @@ discard block |
||
| 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 draggable($attr="id"){ |
|
| 9 | + public static function draggable($attr="id") { |
|
| 10 | 10 | return 'var dt=event.dataTransfer || event.originalEvent.dataTransfer;dt.setData("Text",$(event.target).attr("'.$attr.'"));'; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | - public static function dropZone($jqueryDone,$jsCallback=""){ |
|
| 13 | + public static function dropZone($jqueryDone, $jsCallback="") { |
|
| 14 | 14 | return 'var dt=event.dataTransfer || event.originalEvent.dataTransfer;var data=dt.getData("Text");$(event.target).'.$jqueryDone.'($("#"+data));'.$jsCallback; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - public static function containsCode($expression){ |
|
| 18 | - return strrpos($expression, 'this')!==false||strrpos($expression, 'event')!==false||strrpos($expression, 'self')!==false; |
|
| 17 | + public static function containsCode($expression) { |
|
| 18 | + return strrpos($expression, 'this')!==false || strrpos($expression, 'event')!==false || strrpos($expression, 'self')!==false; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -46,14 +46,14 @@ discard block |
||
| 46 | 46 | $value=implode(",", $value); |
| 47 | 47 | } |
| 48 | 48 | if (self::containsCode($value)===false) { |
| 49 | - $value=\str_replace(["\\","\""], ["\\\\","\\\""], $value); |
|
| 49 | + $value=\str_replace(["\\", "\""], ["\\\\", "\\\""], $value); |
|
| 50 | 50 | $value='"'.$value.'"'; |
| 51 | 51 | } |
| 52 | 52 | return $value; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public static function prep_jquery_selector($value){ |
|
| 56 | - if(JString::startswith($value, '$(')===false){ |
|
| 55 | + public static function prep_jquery_selector($value) { |
|
| 56 | + if (JString::startswith($value, '$(')===false) { |
|
| 57 | 57 | return '$('.$value.')'; |
| 58 | 58 | } |
| 59 | 59 | return $value; |