@@ -6,31 +6,31 @@ discard block |
||
6 | 6 | use Ajax\semantic\html\content\HtmlAccordionItem; |
7 | 7 | use Ajax\JsUtils; |
8 | 8 | |
9 | -class HtmlAccordion extends HtmlSemCollection{ |
|
9 | +class HtmlAccordion extends HtmlSemCollection { |
|
10 | 10 | |
11 | 11 | protected $params=array(); |
12 | 12 | |
13 | - public function __construct( $identifier, $tagName="div", $baseClass="ui"){ |
|
14 | - parent::__construct( $identifier, "div", "ui accordion"); |
|
13 | + public function __construct($identifier, $tagName="div", $baseClass="ui") { |
|
14 | + parent::__construct($identifier, "div", "ui accordion"); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | |
18 | - protected function createItem($value){ |
|
18 | + protected function createItem($value) { |
|
19 | 19 | $count=$this->count(); |
20 | 20 | $title=$value; |
21 | 21 | $content=NULL; |
22 | - if(\is_array($value)){ |
|
23 | - $title=@$value[0];$content=@$value[1]; |
|
22 | + if (\is_array($value)) { |
|
23 | + $title=@$value[0]; $content=@$value[1]; |
|
24 | 24 | } |
25 | - return new HtmlAccordionItem("item-".$this->identifier."-".$count, $title,$content); |
|
25 | + return new HtmlAccordionItem("item-".$this->identifier."-".$count, $title, $content); |
|
26 | 26 | } |
27 | 27 | |
28 | - protected function createCondition($value){ |
|
28 | + protected function createCondition($value) { |
|
29 | 29 | return ($value instanceof HtmlAccordionItem)===false; |
30 | 30 | } |
31 | 31 | |
32 | - public function addPanel($title,$content){ |
|
33 | - return $this->addItem([$title,$content]); |
|
32 | + public function addPanel($title, $content) { |
|
33 | + return $this->addItem([$title, $content]); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param string $controller a Phalcon controller |
42 | 42 | * @param string $action a Phalcon action |
43 | 43 | */ |
44 | - public function forwardPanel(JsUtils $js,$title,$initialController,$controller,$action){ |
|
44 | + public function forwardPanel(JsUtils $js, $title, $initialController, $controller, $action) { |
|
45 | 45 | return $this->addPanel($title, $js->forward($initialController, $controller, $action)); |
46 | 46 | } |
47 | 47 | |
@@ -50,22 +50,22 @@ discard block |
||
50 | 50 | * @see BaseHtml::run() |
51 | 51 | */ |
52 | 52 | public function run(JsUtils $js) { |
53 | - if(isset($this->_bsComponent)===false) |
|
54 | - $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
53 | + if (isset($this->_bsComponent)===false) |
|
54 | + $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier, $this->params); |
|
55 | 55 | $this->addEventsOnRun($js); |
56 | 56 | return $this->_bsComponent; |
57 | 57 | } |
58 | 58 | |
59 | - public function setStyled(){ |
|
59 | + public function setStyled() { |
|
60 | 60 | return $this->addToProperty("class", "styled"); |
61 | 61 | } |
62 | 62 | |
63 | - public function setActive($index){ |
|
63 | + public function setActive($index) { |
|
64 | 64 | $this->getItem($index)->setActive(true); |
65 | 65 | return $this; |
66 | 66 | } |
67 | 67 | |
68 | - public function setExclusive($value){ |
|
68 | + public function setExclusive($value) { |
|
69 | 69 | $this->params["exclusive"]=$value; |
70 | 70 | } |
71 | 71 | } |
72 | 72 | \ No newline at end of file |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $this->startIndex=$startIndex; |
52 | 52 | $this->autoActive=$autoActive; |
53 | 53 | $this->_contentSeparator="<div class='divider'> / </div>"; |
54 | - $this->_hrefFunction=function ($e) { |
|
54 | + $this->_hrefFunction=function($e) { |
|
55 | 55 | return $e->getContent(); |
56 | 56 | }; |
57 | 57 | if (isset($hrefFunction)) { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @return HtmlBreadcrumbs |
69 | 69 | */ |
70 | 70 | public function autoGetOnClick($targetSelector) { |
71 | - return $this->getOnClick($this->root, $targetSelector, array ("attr" => $this->attr )); |
|
71 | + return $this->getOnClick($this->root, $targetSelector, array("attr" => $this->attr)); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | public function contentAsString() { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | public function setActive($index=null) { |
82 | 82 | if (!isset($index)) { |
83 | - $index=sizeof($this->content) - 1; |
|
83 | + $index=sizeof($this->content)-1; |
|
84 | 84 | } |
85 | 85 | $activeItem=$this->content[$index]; |
86 | 86 | $activeItem->addToProperty("class", "active"); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param Dispatcher $dispatcher the request dispatcher |
94 | 94 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
95 | 95 | */ |
96 | - public function fromDispatcher(JsUtils $js,$dispatcher, $startIndex=0) { |
|
96 | + public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) { |
|
97 | 97 | return $this->addItems($js->fromDispatcher($dispatcher)); |
98 | 98 | } |
99 | 99 | |
@@ -107,12 +107,12 @@ discard block |
||
107 | 107 | if (!isset($index)) { |
108 | 108 | $index=sizeof($this->content); |
109 | 109 | } |
110 | - if ($this->absolutePaths === true) { |
|
110 | + if ($this->absolutePaths===true) { |
|
111 | 111 | return $this->_hrefFunction($this->content[$index]); |
112 | - } else { |
|
113 | - return $this->root . implode($separator, array_slice(array_map(function ($e) { |
|
112 | + }else { |
|
113 | + return $this->root.implode($separator, array_slice(array_map(function($e) { |
|
114 | 114 | return $this->_hrefFunction($e); |
115 | - }, $this->content), $this->startIndex, $index + 1)); |
|
115 | + }, $this->content), $this->startIndex, $index+1)); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | $this->setActive(); |
147 | 147 | } |
148 | 148 | $count=$this->count(); |
149 | - for($i=1; $i < $count; $i++) { |
|
150 | - $this->content[$i]->wrap($this->getContentDivider($i - 1)); |
|
149 | + for ($i=1; $i<$count; $i++) { |
|
150 | + $this->content[$i]->wrap($this->getContentDivider($i-1)); |
|
151 | 151 | } |
152 | 152 | return parent::compile($js, $view); |
153 | 153 | } |
@@ -157,15 +157,15 @@ discard block |
||
157 | 157 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
158 | 158 | */ |
159 | 159 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
160 | - foreach ( $this->content as $element ) { |
|
160 | + foreach ($this->content as $element) { |
|
161 | 161 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
162 | 162 | } |
163 | 163 | return $this; |
164 | 164 | } |
165 | 165 | |
166 | 166 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
167 | - foreach ( $this->content as $element ) { |
|
168 | - if ($element->getProperty($this->attr) != NULL) |
|
167 | + foreach ($this->content as $element) { |
|
168 | + if ($element->getProperty($this->attr)!=NULL) |
|
169 | 169 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
170 | 170 | } |
171 | 171 | return $this; |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | protected function createItem($value) { |
181 | 181 | $count=$this->count(); |
182 | - $itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section"); |
|
182 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "a", "section"); |
|
183 | 183 | if (\is_array($value)) |
184 | 184 | $itemO->fromArray($value); |
185 | 185 | else { |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | public function addIconAt($icon, $index) { |
192 | 192 | $item=$this->getItem($index); |
193 | 193 | if (isset($item)) { |
194 | - $icon=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
194 | + $icon=new HtmlIcon("icon-".$this->identifier, $icon); |
|
195 | 195 | $item->wrapContent($icon); |
196 | 196 | } |
197 | 197 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | public function addItem($item) { |
200 | 200 | $count=$this->count(); |
201 | 201 | $itemO=parent::addItem($item); |
202 | - $this->addToPropertyCtrl("class", "section", array ("section" )); |
|
202 | + $this->addToPropertyCtrl("class", "section", array("section")); |
|
203 | 203 | $itemO->setProperty($this->attr, $this->getHref($count)); |
204 | 204 | return $itemO; |
205 | 205 | } |
@@ -5,27 +5,27 @@ discard block |
||
5 | 5 | use Illuminate\Support\Facades\Request; |
6 | 6 | use Illuminate\Support\Facades\App; |
7 | 7 | use Illuminate\Support\Facades\Route; |
8 | -class JsUtils extends \Ajax\JsUtils{ |
|
9 | - public function getUrl($url){ |
|
8 | +class JsUtils extends \Ajax\JsUtils { |
|
9 | + public function getUrl($url) { |
|
10 | 10 | return \url($url); |
11 | 11 | } |
12 | - public function addViewElement($identifier,$content,$view){ |
|
12 | + public function addViewElement($identifier, $content, $view) { |
|
13 | 13 | $controls=$view->__get("q"); |
14 | - if (isset($controls) === false) { |
|
15 | - $controls=array (); |
|
14 | + if (isset($controls)===false) { |
|
15 | + $controls=array(); |
|
16 | 16 | } |
17 | 17 | $controls[$identifier]=$content; |
18 | 18 | $view->__set("q", $controls); |
19 | 19 | } |
20 | 20 | |
21 | - public function createScriptVariable($view,$view_var, $output){ |
|
22 | - $view->__set($view_var,$output); |
|
21 | + public function createScriptVariable($view, $view_var, $output) { |
|
22 | + $view->__set($view_var, $output); |
|
23 | 23 | } |
24 | 24 | |
25 | - public function forward($initialController,$controller,$action){ |
|
25 | + public function forward($initialController, $controller, $action) { |
|
26 | 26 | //\request()->attributes->all() |
27 | - $url=\action($controller.'@'.$action, [],false); |
|
28 | - $request = Request::create($url, 'GET'); |
|
27 | + $url=\action($controller.'@'.$action, [], false); |
|
28 | + $request=Request::create($url, 'GET'); |
|
29 | 29 | // handle the response |
30 | 30 | return Route::dispatch($request)->getContent(); |
31 | 31 | //return App::make($controller)->{$action}(\request()->attributes->all()); |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | public function renderContent($view, $controller, $action, $params=NULL) { |
37 | - $template=$view->getRender($controller, $action, $params, function ($view) { |
|
37 | + $template=$view->getRender($controller, $action, $params, function($view) { |
|
38 | 38 | $view->setRenderLevel(View::LEVEL_ACTION_VIEW); |
39 | 39 | }); |
40 | 40 | return $template; |
41 | 41 | } |
42 | 42 | |
43 | - public function fromDispatcher($dispatcher){ |
|
43 | + public function fromDispatcher($dispatcher) { |
|
44 | 44 | return $dispatcher->segments(); |
45 | 45 | } |
46 | 46 | } |
47 | 47 | \ No newline at end of file |
@@ -4,14 +4,14 @@ discard block |
||
4 | 4 | |
5 | 5 | use yii\helpers\Url; |
6 | 6 | |
7 | -class JsUtils extends \Ajax\JsUtils{ |
|
8 | - public function getUrl($url){ |
|
9 | - if($url==="") |
|
7 | +class JsUtils extends \Ajax\JsUtils { |
|
8 | + public function getUrl($url) { |
|
9 | + if ($url==="") |
|
10 | 10 | $url="/"; |
11 | 11 | return Url::toRoute($url); |
12 | 12 | } |
13 | 13 | |
14 | - public function addViewElement($identifier,$content,$view){ |
|
14 | + public function addViewElement($identifier, $content, $view) { |
|
15 | 15 | $params=$view->params; |
16 | 16 | if (\array_key_exists("q", $params)==false) { |
17 | 17 | $view->params["q"]=array(); |
@@ -19,11 +19,11 @@ discard block |
||
19 | 19 | $view->params["q"][$identifier]=$content; |
20 | 20 | } |
21 | 21 | |
22 | - public function createScriptVariable($view,$view_var, $output){ |
|
22 | + public function createScriptVariable($view, $view_var, $output) { |
|
23 | 23 | $view->params[$view_var]=$output; |
24 | 24 | } |
25 | 25 | |
26 | - public function forward($initialControllerInstance,$controllerName,$actionName,$params=NULL){ |
|
26 | + public function forward($initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
27 | 27 | \ob_start(); |
28 | 28 | $ctrInfo=\yii::$app->createController($controllerName."/".$actionName); |
29 | 29 | $ctrInfo[0]->{$ctrInfo[1]}($params); |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | return $result; |
33 | 33 | } |
34 | 34 | |
35 | - public function renderContent($initialControllerInstance,$viewName, $params=NULL) { |
|
36 | - return \yii::$app->view->render($viewName,$params); |
|
35 | + public function renderContent($initialControllerInstance, $viewName, $params=NULL) { |
|
36 | + return \yii::$app->view->render($viewName, $params); |
|
37 | 37 | } |
38 | 38 | |
39 | - public function fromDispatcher($dispatcher){ |
|
39 | + public function fromDispatcher($dispatcher) { |
|
40 | 40 | $uri=new \Ajax\php\yii\URI(); |
41 | 41 | return $uri->segment_array(); |
42 | 42 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @access public |
11 | 11 | * |
12 | 12 | */ |
13 | - var $keyval=array (); |
|
13 | + var $keyval=array(); |
|
14 | 14 | /** |
15 | 15 | * Current uri string |
16 | 16 | * |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @access public |
27 | 27 | * |
28 | 28 | */ |
29 | - var $segments=array (); |
|
29 | + var $segments=array(); |
|
30 | 30 | /** |
31 | 31 | * Re-indexed list of uri segments |
32 | 32 | * Starts at 1 instead of 0 |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @access public |
36 | 36 | * |
37 | 37 | */ |
38 | - var $rsegments=array (); |
|
38 | + var $rsegments=array(); |
|
39 | 39 | var $permitted_uri_chars="a-z 0-9~%.:_\-"; |
40 | 40 | var $enable_query_strings=false; |
41 | 41 | |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | */ |
76 | 76 | function _fetch_uri_string() { |
77 | 77 | $uri=""; |
78 | - if ($this->uri_protocol == 'AUTO') { |
|
78 | + if ($this->uri_protocol=='AUTO') { |
|
79 | 79 | // Is the request coming from the command line? |
80 | - if (php_sapi_name() == 'cli' or defined('STDIN')) { |
|
80 | + if (php_sapi_name()=='cli' or defined('STDIN')) { |
|
81 | 81 | $this->_set_uri_string($this->_parse_cli_args()); |
82 | 82 | return; |
83 | 83 | } |
@@ -91,20 +91,20 @@ discard block |
||
91 | 91 | // Is there a PATH_INFO variable? |
92 | 92 | // Note: some servers seem to have trouble with getenv() so we'll test it two ways |
93 | 93 | $path=(isset($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : @getenv('PATH_INFO'); |
94 | - if (trim($path, '/') != '' && $path != "/" . SELF) { |
|
94 | + if (trim($path, '/')!='' && $path!="/".SELF) { |
|
95 | 95 | $this->_set_uri_string($path); |
96 | 96 | return; |
97 | 97 | } |
98 | 98 | |
99 | 99 | // No PATH_INFO?... What about QUERY_STRING? |
100 | 100 | $path=(isset($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : @getenv('QUERY_STRING'); |
101 | - if (trim($path, '/') != '') { |
|
101 | + if (trim($path, '/')!='') { |
|
102 | 102 | $this->_set_uri_string($path); |
103 | 103 | return; |
104 | 104 | } |
105 | 105 | |
106 | 106 | // As a last ditch effort lets try using the $_GET array |
107 | - if (is_array($_GET) && count($_GET) == 1 && trim(key($_GET), '/') != '') { |
|
107 | + if (is_array($_GET) && count($_GET)==1 && trim(key($_GET), '/')!='') { |
|
108 | 108 | $this->_set_uri_string(key($_GET)); |
109 | 109 | return; |
110 | 110 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
117 | - if ($uri == 'REQUEST_URI') { |
|
117 | + if ($uri=='REQUEST_URI') { |
|
118 | 118 | $this->_set_uri_string($this->_detect_uri()); |
119 | 119 | return; |
120 | 120 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | // $str = remove_invisible_characters($str, FALSE); |
139 | 139 | |
140 | 140 | // If the URI contains only a slash we'll kill it |
141 | - $this->uri_string=($str == '/') ? '' : $str; |
|
141 | + $this->uri_string=($str=='/') ? '' : $str; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | // -------------------------------------------------------------------- |
@@ -159,15 +159,15 @@ discard block |
||
159 | 159 | } |
160 | 160 | |
161 | 161 | $uri=$_SERVER['REQUEST_URI']; |
162 | - if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0) { |
|
162 | + if (strpos($uri, $_SERVER['SCRIPT_NAME'])===0) { |
|
163 | 163 | $uri=substr($uri, strlen($_SERVER['SCRIPT_NAME'])); |
164 | - } elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0) { |
|
164 | + } elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME']))===0) { |
|
165 | 165 | $uri=substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME']))); |
166 | 166 | } |
167 | 167 | |
168 | 168 | // This section ensures that even on servers that require the URI to be in the query string (Nginx) a correct |
169 | 169 | // URI is found, and also fixes the QUERY_STRING server var and $_GET array. |
170 | - if (strncmp($uri, '?/', 2) === 0) { |
|
170 | + if (strncmp($uri, '?/', 2)===0) { |
|
171 | 171 | $uri=substr($uri, 2); |
172 | 172 | } |
173 | 173 | $parts=preg_split('#\?#i', $uri, 2); |
@@ -175,19 +175,19 @@ discard block |
||
175 | 175 | if (isset($parts[1])) { |
176 | 176 | $_SERVER['QUERY_STRING']=$parts[1]; |
177 | 177 | parse_str($_SERVER['QUERY_STRING'], $_GET); |
178 | - } else { |
|
178 | + }else { |
|
179 | 179 | $_SERVER['QUERY_STRING']=''; |
180 | - $_GET=array (); |
|
180 | + $_GET=array(); |
|
181 | 181 | } |
182 | 182 | |
183 | - if ($uri == '/' || empty($uri)) { |
|
183 | + if ($uri=='/' || empty($uri)) { |
|
184 | 184 | return '/'; |
185 | 185 | } |
186 | 186 | |
187 | 187 | $uri=parse_url($uri, PHP_URL_PATH); |
188 | 188 | |
189 | 189 | // Do some final cleaning of the URI and return it |
190 | - return str_replace(array ('//','../' ), '/', trim($uri, '/')); |
|
190 | + return str_replace(array('//', '../'), '/', trim($uri, '/')); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | // -------------------------------------------------------------------- |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | private function _parse_cli_args() { |
205 | 205 | $args=array_slice($_SERVER['argv'], 1); |
206 | 206 | |
207 | - return $args ? '/' . implode('/', $args) : ''; |
|
207 | + return $args ? '/'.implode('/', $args) : ''; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | // -------------------------------------------------------------------- |
@@ -218,17 +218,17 @@ discard block |
||
218 | 218 | * |
219 | 219 | */ |
220 | 220 | function _filter_uri($str) { |
221 | - if ($str != '' && $this->permitted_uri_chars != '' && $this->enable_query_strings == FALSE) { |
|
221 | + if ($str!='' && $this->permitted_uri_chars!='' && $this->enable_query_strings==FALSE) { |
|
222 | 222 | // preg_quote() in PHP 5.3 escapes -, so the str_replace() and addition of - to preg_quote() is to maintain backwards |
223 | 223 | // compatibility as many are unaware of how characters in the permitted_uri_chars will be parsed as a regex pattern |
224 | - if (!preg_match("|^[" . str_replace(array ('\\-','\-' ), '-', preg_quote($this->permitted_uri_chars, '-')) . "]+$|i", $str)) { |
|
224 | + if (!preg_match("|^[".str_replace(array('\\-', '\-'), '-', preg_quote($this->permitted_uri_chars, '-'))."]+$|i", $str)) { |
|
225 | 225 | show_error('The URI you submitted has disallowed characters.', 400); |
226 | 226 | } |
227 | 227 | } |
228 | 228 | |
229 | 229 | // Convert programatic characters to entities |
230 | - $bad=array ('$','(',')','%28','%29' ); |
|
231 | - $good=array ('$','(',')','(',')' ); |
|
230 | + $bad=array('$', '(', ')', '%28', '%29'); |
|
231 | + $good=array('$', '(', ')', '(', ')'); |
|
232 | 232 | |
233 | 233 | return str_replace($bad, $good, $str); |
234 | 234 | } |
@@ -243,11 +243,11 @@ discard block |
||
243 | 243 | * |
244 | 244 | */ |
245 | 245 | function _explode_segments() { |
246 | - foreach ( explode("/", preg_replace("|/*(.+?)/*$|", "\\1", $this->uri_string)) as $val ) { |
|
246 | + foreach (explode("/", preg_replace("|/*(.+?)/*$|", "\\1", $this->uri_string)) as $val) { |
|
247 | 247 | // Filter segments for security |
248 | 248 | $val=trim($this->_filter_uri($val)); |
249 | 249 | |
250 | - if ($val != '') { |
|
250 | + if ($val!='') { |
|
251 | 251 | $this->segments[]=$val; |
252 | 252 | } |
253 | 253 | } |
@@ -364,10 +364,10 @@ discard block |
||
364 | 364 | * |
365 | 365 | */ |
366 | 366 | function _uri_to_assoc($n=3, $default=array(), $which='segment') { |
367 | - if ($which == 'segment') { |
|
367 | + if ($which=='segment') { |
|
368 | 368 | $total_segments='total_segments'; |
369 | 369 | $segment_array='segment_array'; |
370 | - } else { |
|
370 | + }else { |
|
371 | 371 | $total_segments='total_rsegments'; |
372 | 372 | $segment_array='rsegment_array'; |
373 | 373 | } |
@@ -380,27 +380,27 @@ discard block |
||
380 | 380 | return $this->keyval[$n]; |
381 | 381 | } |
382 | 382 | |
383 | - if ($this->$total_segments() < $n) { |
|
384 | - if (count($default) == 0) { |
|
385 | - return array (); |
|
383 | + if ($this->$total_segments()<$n) { |
|
384 | + if (count($default)==0) { |
|
385 | + return array(); |
|
386 | 386 | } |
387 | 387 | |
388 | - $retval=array (); |
|
389 | - foreach ( $default as $val ) { |
|
388 | + $retval=array(); |
|
389 | + foreach ($default as $val) { |
|
390 | 390 | $retval[$val]=FALSE; |
391 | 391 | } |
392 | 392 | return $retval; |
393 | 393 | } |
394 | 394 | |
395 | - $segments=array_slice($this->$segment_array(), ($n - 1)); |
|
395 | + $segments=array_slice($this->$segment_array(), ($n-1)); |
|
396 | 396 | |
397 | 397 | $i=0; |
398 | 398 | $lastval=''; |
399 | - $retval=array (); |
|
400 | - foreach ( $segments as $seg ) { |
|
399 | + $retval=array(); |
|
400 | + foreach ($segments as $seg) { |
|
401 | 401 | if ($i % 2) { |
402 | 402 | $retval[$lastval]=$seg; |
403 | - } else { |
|
403 | + }else { |
|
404 | 404 | $retval[$seg]=FALSE; |
405 | 405 | $lastval=$seg; |
406 | 406 | } |
@@ -408,8 +408,8 @@ discard block |
||
408 | 408 | $i++; |
409 | 409 | } |
410 | 410 | |
411 | - if (count($default) > 0) { |
|
412 | - foreach ( $default as $val ) { |
|
411 | + if (count($default)>0) { |
|
412 | + foreach ($default as $val) { |
|
413 | 413 | if (!array_key_exists($val, $retval)) { |
414 | 414 | $retval[$val]=FALSE; |
415 | 415 | } |
@@ -433,8 +433,8 @@ discard block |
||
433 | 433 | * |
434 | 434 | */ |
435 | 435 | function assoc_to_uri($array) { |
436 | - $temp=array (); |
|
437 | - foreach ( ( array ) $array as $key => $val ) { |
|
436 | + $temp=array(); |
|
437 | + foreach ((array) $array as $key => $val) { |
|
438 | 438 | $temp[]=$key; |
439 | 439 | $temp[]=$val; |
440 | 440 | } |
@@ -488,13 +488,13 @@ discard block |
||
488 | 488 | $leading='/'; |
489 | 489 | $trailing='/'; |
490 | 490 | |
491 | - if ($where == 'trailing') { |
|
491 | + if ($where=='trailing') { |
|
492 | 492 | $leading=''; |
493 | - } elseif ($where == 'leading') { |
|
493 | + } elseif ($where=='leading') { |
|
494 | 494 | $trailing=''; |
495 | 495 | } |
496 | 496 | |
497 | - return $leading . $this->$which($n) . $trailing; |
|
497 | + return $leading.$this->$which($n).$trailing; |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | // -------------------------------------------------------------------- |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | * |
573 | 573 | */ |
574 | 574 | function ruri_string() { |
575 | - return '/' . implode('/', $this->rsegment_array()); |
|
575 | + return '/'.implode('/', $this->rsegment_array()); |
|
576 | 576 | } |
577 | 577 | } |
578 | 578 | // END URI Class |
579 | 579 | \ No newline at end of file |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * JsUtils Class : Service to be injected |
23 | 23 | */ |
24 | -abstract class JsUtils{ |
|
25 | - use JsUtilsEventsTrait,JsUtilsActionsTrait,JsUtilsAjaxTrait; |
|
24 | +abstract class JsUtils { |
|
25 | + use JsUtilsEventsTrait, JsUtilsActionsTrait, JsUtilsAjaxTrait; |
|
26 | 26 | |
27 | 27 | protected $js; |
28 | 28 | protected $cdns; |
@@ -49,26 +49,26 @@ discard block |
||
49 | 49 | protected $config; |
50 | 50 | |
51 | 51 | protected function _setDi($di) { |
52 | - if ($this->js!=null&&$di!=null) |
|
52 | + if ($this->js!=null && $di!=null) |
|
53 | 53 | $this->js->setDi($di); |
54 | 54 | } |
55 | 55 | |
56 | 56 | public abstract function getUrl($url); |
57 | - public abstract function addViewElement($identifier,$content,$view); |
|
57 | + public abstract function addViewElement($identifier, $content, $view); |
|
58 | 58 | /** |
59 | 59 | * render the content of $controller::$action and set the response to the modal content |
60 | 60 | * @param Controller $initialController |
61 | 61 | * @param string $controller a Phalcon controller |
62 | 62 | * @param string $action a Phalcon action |
63 | 63 | */ |
64 | - public abstract function forward($initialController,$controller,$action); |
|
64 | + public abstract function forward($initialController, $controller, $action); |
|
65 | 65 | /** |
66 | 66 | * render the content of an existing view : $viewName and set the response to the modal content |
67 | 67 | * @param Controller $initialControllerInstance |
68 | 68 | * @param View $viewName |
69 | 69 | * @param $params The parameters to pass to the view |
70 | 70 | */ |
71 | - public abstract function renderContent($initialControllerInstance,$viewName, $params=NULL); |
|
71 | + public abstract function renderContent($initialControllerInstance, $viewName, $params=NULL); |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * Collect url parts from the request dispatcher : controllerName, actionName, parameters |
@@ -160,22 +160,22 @@ discard block |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | public function __construct($params=array()) { |
163 | - $defaults=array ( |
|
163 | + $defaults=array( |
|
164 | 164 | 'driver' => 'Jquery', |
165 | 165 | 'debug' => true |
166 | 166 | ); |
167 | - foreach ( $defaults as $key => $val ) { |
|
168 | - if (isset($params[$key])&&$params[$key]!=="") { |
|
167 | + foreach ($defaults as $key => $val) { |
|
168 | + if (isset($params[$key]) && $params[$key]!=="") { |
|
169 | 169 | $defaults[$key]=$params[$key]; |
170 | 170 | } |
171 | 171 | } |
172 | 172 | extract($defaults); |
173 | - $this->js=new Jquery($defaults,$this); |
|
174 | - $this->cdns=array (); |
|
173 | + $this->js=new Jquery($defaults, $this); |
|
174 | + $this->cdns=array(); |
|
175 | 175 | } |
176 | 176 | |
177 | - public function __set($property, $value){ |
|
178 | - switch ($property){ |
|
177 | + public function __set($property, $value) { |
|
178 | + switch ($property) { |
|
179 | 179 | case "bootstrap": |
180 | 180 | $this->bootstrap($value); |
181 | 181 | break; |
@@ -224,11 +224,11 @@ discard block |
||
224 | 224 | */ |
225 | 225 | public function compile($view=NULL, $view_var='script_foot', $script_tags=TRUE) { |
226 | 226 | $bs=$this->_bootstrap; |
227 | - if (isset($bs)&&isset($view)) { |
|
227 | + if (isset($bs) && isset($view)) { |
|
228 | 228 | $bs->compileHtml($this, $view); |
229 | 229 | } |
230 | 230 | $sem=$this->_semantic; |
231 | - if (isset($sem)&&isset($view)) { |
|
231 | + if (isset($sem) && isset($view)) { |
|
232 | 232 | $sem->compileHtml($this, $view); |
233 | 233 | } |
234 | 234 | return $this->js->_compile($view, $view_var, $script_tags); |
@@ -295,27 +295,27 @@ discard block |
||
295 | 295 | $json_result=$result->result_array(); |
296 | 296 | } elseif (is_array($result)) { |
297 | 297 | $json_result=$result; |
298 | - } else { |
|
298 | + }else { |
|
299 | 299 | return $this->_prep_args($result); |
300 | 300 | } |
301 | - } else { |
|
301 | + }else { |
|
302 | 302 | return 'null'; |
303 | 303 | } |
304 | 304 | return $this->_create_json($json_result, $match_array_type); |
305 | 305 | } |
306 | 306 | |
307 | 307 | private function _create_json($json_result, $match_array_type) { |
308 | - $json=array (); |
|
308 | + $json=array(); |
|
309 | 309 | $_is_assoc=TRUE; |
310 | - if (!is_array($json_result)&&empty($json_result)) { |
|
310 | + if (!is_array($json_result) && empty($json_result)) { |
|
311 | 311 | show_error("Generate JSON Failed - Illegal key, value pair."); |
312 | 312 | } elseif ($match_array_type) { |
313 | 313 | $_is_assoc=$this->_is_associative_array($json_result); |
314 | 314 | } |
315 | - foreach ( $json_result as $k => $v ) { |
|
315 | + foreach ($json_result as $k => $v) { |
|
316 | 316 | if ($_is_assoc) { |
317 | 317 | $json[]=$this->_prep_args($k, TRUE).':'.$this->generate_json($v, $match_array_type); |
318 | - } else { |
|
318 | + }else { |
|
319 | 319 | $json[]=$this->generate_json($v, $match_array_type); |
320 | 320 | } |
321 | 321 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | * @return type |
331 | 331 | */ |
332 | 332 | public function _is_associative_array($arr) { |
333 | - foreach ( array_keys($arr) as $key => $val ) { |
|
333 | + foreach (array_keys($arr) as $key => $val) { |
|
334 | 334 | if ($key!==$val) { |
335 | 335 | return TRUE; |
336 | 336 | } |
@@ -349,11 +349,11 @@ discard block |
||
349 | 349 | return 'null'; |
350 | 350 | } elseif (is_bool($result)) { |
351 | 351 | return ($result===TRUE) ? 'true' : 'false'; |
352 | - } elseif (is_string($result)||$is_key) { |
|
353 | - return '"'.str_replace(array ( |
|
354 | - '\\',"\t","\n","\r",'"','/' |
|
355 | - ), array ( |
|
356 | - '\\\\','\\t','\\n',"\\r",'\"','\/' |
|
352 | + } elseif (is_string($result) || $is_key) { |
|
353 | + return '"'.str_replace(array( |
|
354 | + '\\', "\t", "\n", "\r", '"', '/' |
|
355 | + ), array( |
|
356 | + '\\\\', '\\t', '\\n', "\\r", '\"', '\/' |
|
357 | 357 | ), $result).'"'; |
358 | 358 | } elseif (is_scalar($result)) { |
359 | 359 | return $result; |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | |
367 | 367 | public function setCDNs($cdns) { |
368 | 368 | if (is_array($cdns)===false) { |
369 | - $cdns=array ( |
|
369 | + $cdns=array( |
|
370 | 370 | $cdns |
371 | 371 | ); |
372 | 372 | } |
@@ -378,9 +378,9 @@ discard block |
||
378 | 378 | $hasJQueryUI=false; |
379 | 379 | $hasBootstrap=false; |
380 | 380 | $hasSemantic=false; |
381 | - $result=array (); |
|
382 | - foreach ( $this->cdns as $cdn ) { |
|
383 | - switch(get_class($cdn)) { |
|
381 | + $result=array(); |
|
382 | + foreach ($this->cdns as $cdn) { |
|
383 | + switch (get_class($cdn)) { |
|
384 | 384 | case "Ajax\lib\CDNJQuery": |
385 | 385 | $hasJQuery=true; |
386 | 386 | $result[0]=$cdn; |
@@ -390,11 +390,11 @@ discard block |
||
390 | 390 | $result[1]=$cdn; |
391 | 391 | break; |
392 | 392 | case "Ajax\lib\CDNCoreCss": |
393 | - if($cdn->getFramework()==="Bootstrap") |
|
393 | + if ($cdn->getFramework()==="Bootstrap") |
|
394 | 394 | $hasBootstrap=true; |
395 | - elseif($cdn->getFramework()==="Semantic") |
|
395 | + elseif ($cdn->getFramework()==="Semantic") |
|
396 | 396 | $hasSemantic=true; |
397 | - if($hasSemantic || $hasBootstrap) |
|
397 | + if ($hasSemantic || $hasBootstrap) |
|
398 | 398 | $result[2]=$cdn; |
399 | 399 | break; |
400 | 400 | } |
@@ -402,14 +402,14 @@ discard block |
||
402 | 402 | if ($hasJQuery===false) { |
403 | 403 | $result[0]=new CDNJQuery("x"); |
404 | 404 | } |
405 | - if ($hasJQueryUI===false&&isset($this->_ui)) { |
|
405 | + if ($hasJQueryUI===false && isset($this->_ui)) { |
|
406 | 406 | $result[1]=new CDNGuiGen("x", $template); |
407 | 407 | } |
408 | - if ($hasBootstrap===false&&isset($this->_bootstrap)) { |
|
409 | - $result[2]=new CDNCoreCss("Bootstrap","x"); |
|
408 | + if ($hasBootstrap===false && isset($this->_bootstrap)) { |
|
409 | + $result[2]=new CDNCoreCss("Bootstrap", "x"); |
|
410 | 410 | } |
411 | - if ($hasSemantic===false&&isset($this->_semantic)) { |
|
412 | - $result[2]=new CDNCoreCss("Semantic","x"); |
|
411 | + if ($hasSemantic===false && isset($this->_semantic)) { |
|
412 | + $result[2]=new CDNCoreCss("Semantic", "x"); |
|
413 | 413 | } |
414 | 414 | ksort($result); |
415 | 415 | return implode("\n", $result); |
@@ -9,12 +9,12 @@ discard block |
||
9 | 9 | protected $ajaxLoader='<span></span><span></span><span></span><span></span><span></span>'; |
10 | 10 | |
11 | 11 | public abstract function _prep_value($value); |
12 | - public abstract function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true); |
|
12 | + public abstract function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true); |
|
13 | 13 | protected function addLoading(&$retour, $responseElement) { |
14 | 14 | $loading_notifier='<div class="ajax-loader">'; |
15 | 15 | if ($this->ajaxLoader=='') { |
16 | 16 | $loading_notifier.="Loading..."; |
17 | - } else { |
|
17 | + }else { |
|
18 | 18 | $loading_notifier.=$this->ajaxLoader; |
19 | 19 | } |
20 | 20 | $loading_notifier.='</div>'; |
@@ -22,20 +22,20 @@ discard block |
||
22 | 22 | $retour.="\t\t$({$responseElement}).prepend('{$loading_notifier}');\n"; |
23 | 23 | } |
24 | 24 | |
25 | - public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
26 | - return $this->_ajax("get", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly); |
|
25 | + public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
26 | + return $this->_ajax("get", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $immediatly); |
|
27 | 27 | } |
28 | - public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
29 | - return $this->_ajax("post", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly); |
|
28 | + public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
29 | + return $this->_ajax("post", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $immediatly); |
|
30 | 30 | } |
31 | 31 | |
32 | - protected function _ajax($method,$url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
33 | - if(JString::isNull($params)){$params="{}";} |
|
32 | + protected function _ajax($method, $url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
33 | + if (JString::isNull($params)) {$params="{}"; } |
|
34 | 34 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
35 | 35 | $retour=$this->_getAjaxUrl($url, $attr); |
36 | 36 | $responseElement=$this->_getResponseElement($responseElement); |
37 | 37 | $retour.="var self=this;\n"; |
38 | - if($hasLoader===true){ |
|
38 | + if ($hasLoader===true) { |
|
39 | 39 | $this->addLoading($retour, $responseElement); |
40 | 40 | } |
41 | 41 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
@@ -45,22 +45,22 @@ discard block |
||
45 | 45 | return $retour; |
46 | 46 | } |
47 | 47 | |
48 | - protected function _getAjaxUrl($url,$attr){ |
|
48 | + protected function _getAjaxUrl($url, $attr) { |
|
49 | 49 | $url=$this->_correctAjaxUrl($url); |
50 | 50 | $retour="url='".$url."';\n"; |
51 | 51 | $slash="/"; |
52 | - if(PhalconUtils::endsWith($url, "/")===true) |
|
52 | + if (PhalconUtils::endsWith($url, "/")===true) |
|
53 | 53 | $slash=""; |
54 | - if(JString::isNotNull($attr)){ |
|
54 | + if (JString::isNotNull($attr)) { |
|
55 | 55 | if ($attr=="value") |
56 | 56 | $retour.="url=url+'".$slash."'+$(this).val();\n"; |
57 | - else if($attr!=null && $attr!=="") |
|
57 | + else if ($attr!=null && $attr!=="") |
|
58 | 58 | $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
59 | 59 | } |
60 | 60 | return $retour; |
61 | 61 | } |
62 | 62 | |
63 | - protected function _getOnAjaxDone($responseElement,$jsCallback){ |
|
63 | + protected function _getOnAjaxDone($responseElement, $jsCallback) { |
|
64 | 64 | $retour=""; |
65 | 65 | if ($responseElement!=="") { |
66 | 66 | $retour="\t$({$responseElement}).html( data );\n"; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | return $retour; |
70 | 70 | } |
71 | 71 | |
72 | - protected function _getResponseElement($responseElement){ |
|
72 | + protected function _getResponseElement($responseElement) { |
|
73 | 73 | if ($responseElement!=="") { |
74 | 74 | $responseElement=$this->_prep_value($responseElement); |
75 | 75 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | protected function _correctAjaxUrl($url) { |
80 | 80 | if ($url!=="/" && JString::endsWith($url, "/")===true) |
81 | 81 | $url=substr($url, 0, strlen($url)-1); |
82 | - if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
|
82 | + if (strncmp($url, 'http://', 7)!=0 && strncmp($url, 'https://', 8)!=0) { |
|
83 | 83 | $url=$this->jsUtils->getUrl($url); |
84 | 84 | } |
85 | 85 | return $url; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param string $jsCallback javascript code to execute after the request |
94 | 94 | * @param boolean $immediatly |
95 | 95 | */ |
96 | - public function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) { |
|
96 | + public function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) { |
|
97 | 97 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
98 | 98 | $retour=$this->_getAjaxUrl($url, $attr); |
99 | 99 | $retour.="$.{$method}(url,".$params.").done(function( data ) {\n"; |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @param string $url the request address |
115 | 115 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true) |
116 | 116 | */ |
117 | - public function _jsonOn($event,$element, $url,$parameters=array()) { |
|
117 | + public function _jsonOn($event, $element, $url, $parameters=array()) { |
|
118 | 118 | $preventDefault=true; |
119 | 119 | $stopPropagation=true; |
120 | 120 | $jsCallback=null; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $params="{}"; |
125 | 125 | $immediatly=true; |
126 | 126 | extract($parameters); |
127 | - return $this->_add_event($element, $this->_json($url,$method, $params,$jsCallback, $attr,$context), $event, $preventDefault, $stopPropagation,$immediatly); |
|
127 | + return $this->_add_event($element, $this->_json($url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -136,19 +136,19 @@ discard block |
||
136 | 136 | * @param string $context jquery DOM element, array container. |
137 | 137 | * @param boolean $immediatly |
138 | 138 | */ |
139 | - public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null,$immediatly=false) { |
|
139 | + public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null, $immediatly=false) { |
|
140 | 140 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
141 | 141 | $retour=$this->_getAjaxUrl($url, $attr); |
142 | - if($context===null){ |
|
142 | + if ($context===null) { |
|
143 | 143 | $appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n"; |
144 | - $newElm = "$('#'+newId)"; |
|
145 | - }else{ |
|
144 | + $newElm="$('#'+newId)"; |
|
145 | + }else { |
|
146 | 146 | $appendTo="\t\tnewElm.appendTo(".$context.");\n"; |
147 | - $newElm = $context.".find('#'+newId)"; |
|
147 | + $newElm=$context.".find('#'+newId)"; |
|
148 | 148 | } |
149 | 149 | $retour.="var self = $(this);\n$.{$method}(url,".$params.").done(function( data ) {\n"; |
150 | 150 | $retour.="\tdata=$.parseJSON(data);$.each(data, function(index, value) {\n"."\tvar created=false;var maskElm=$('".$maskSelector."').first();maskElm.hide();"."\tvar newId=(maskElm.attr('id') || 'mask')+'-'+index;"."\tvar newElm=".$newElm.";\n"."\tif(!newElm.length){\n"."\t\tnewElm=maskElm.clone();newElm.attr('id',newId);\n"; |
151 | - $retour.= $appendTo; |
|
151 | + $retour.=$appendTo; |
|
152 | 152 | $retour.="\t}\n"."\tfor(var key in value){\n"."\t\t\tvar html = $('<div />').append($(newElm).clone()).html();\n"."\t\t\tif(html.indexOf('[['+key+']]')>-1){\n"."\t\t\t\tcontent=$(html.split('[['+key+']]').join(value[key]));\n"."\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n"."\t\t\t}\n"."\t\tvar sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n"."\t\t\tvar selElm=$(sel,newElm);\n"."\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n"."\t\t}\n"."}\n"."\t$(newElm).show(true);"."\n"."\t$(newElm).removeClass('hide');"."});\n"; |
153 | 153 | $retour.="\t$(document).trigger('jsonReady',[data]);\n"; |
154 | 154 | $retour.="\t".$jsCallback."\n"."});\n"; |
@@ -163,26 +163,26 @@ discard block |
||
163 | 163 | * @param string $url the request address |
164 | 164 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get", "context"=>null) |
165 | 165 | */ |
166 | - public function _jsonArrayOn($event,$element, $maskSelector,$url,$parameters=array()) { |
|
166 | + public function _jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) { |
|
167 | 167 | $preventDefault=true; |
168 | 168 | $stopPropagation=true; |
169 | 169 | $jsCallback=null; |
170 | 170 | $attr="id"; |
171 | 171 | $method="get"; |
172 | - $context = null; |
|
172 | + $context=null; |
|
173 | 173 | $params="{}"; |
174 | 174 | $immediatly=true; |
175 | 175 | extract($parameters); |
176 | - return $this->_add_event($element, $this->_jsonArray($maskSelector,$url,$method, $params,$jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation,$immediatly); |
|
176 | + return $this->_add_event($element, $this->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly); |
|
177 | 177 | } |
178 | 178 | |
179 | - public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
179 | + public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
180 | 180 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
181 | 181 | $retour=$this->_getAjaxUrl($url, $attr); |
182 | 182 | $retour.="\nvar params=$('#".$form."').serialize();\n"; |
183 | 183 | $responseElement=$this->_getResponseElement($responseElement); |
184 | 184 | $retour.="var self=this;\n"; |
185 | - if($hasLoader===true){ |
|
185 | + if ($hasLoader===true) { |
|
186 | 186 | $this->addLoading($retour, $responseElement); |
187 | 187 | } |
188 | 188 | $retour.="$.post(url,params).done(function( data ) {\n"; |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @param string $responseElement |
210 | 210 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true) |
211 | 211 | */ |
212 | - public function _getOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
212 | + public function _getOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
213 | 213 | $preventDefault=true; |
214 | 214 | $stopPropagation=true; |
215 | 215 | $jsCallback=null; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $hasLoader=true; |
218 | 218 | $immediatly=true; |
219 | 219 | extract($parameters); |
220 | - return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation,$immediatly); |
|
220 | + return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation, $immediatly); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @param string $responseElement |
231 | 231 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true) |
232 | 232 | */ |
233 | - public function _postOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
233 | + public function _postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
234 | 234 | $preventDefault=true; |
235 | 235 | $stopPropagation=true; |
236 | 236 | $jsCallback=null; |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $hasLoader=true; |
239 | 239 | $immediatly=true; |
240 | 240 | extract($parameters); |
241 | - return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation,$immediatly); |
|
241 | + return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation, $immediatly); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * @param string $responseElement |
252 | 252 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true) |
253 | 253 | */ |
254 | - public function _postFormOn($event,$element, $url, $form, $responseElement="", $parameters=array()) { |
|
254 | + public function _postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) { |
|
255 | 255 | $preventDefault=true; |
256 | 256 | $stopPropagation=true; |
257 | 257 | $validation=false; |
@@ -260,6 +260,6 @@ discard block |
||
260 | 260 | $hasLoader=true; |
261 | 261 | $immediatly=true; |
262 | 262 | extract($parameters); |
263 | - return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation,$immediatly); |
|
263 | + return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation, $immediatly); |
|
264 | 264 | } |
265 | 265 | } |
266 | 266 | \ No newline at end of file |