@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | use Phalcon\Mvc\View; |
8 | 8 | use Phalcon\Mvc\Controller; |
9 | 9 | |
10 | -class JsUtils extends \Ajax\JsUtils implements InjectionAwareInterface{ |
|
10 | +class JsUtils extends \Ajax\JsUtils implements InjectionAwareInterface { |
|
11 | 11 | protected $_di; |
12 | 12 | public function setDi(DiInterface $di) { |
13 | 13 | $this->_di=$di; |
@@ -18,50 +18,50 @@ discard block |
||
18 | 18 | return $this->_di; |
19 | 19 | } |
20 | 20 | |
21 | - public function getUrl($url){ |
|
21 | + public function getUrl($url) { |
|
22 | 22 | return $this->_di->get("url")->get($url); |
23 | 23 | } |
24 | 24 | |
25 | - public function addViewElement($identifier,$content,&$view){ |
|
25 | + public function addViewElement($identifier, $content, &$view) { |
|
26 | 26 | $controls=$view->getVar("q"); |
27 | - if (isset($controls) === false) { |
|
28 | - $controls=array (); |
|
27 | + if (isset($controls)===false) { |
|
28 | + $controls=array(); |
|
29 | 29 | } |
30 | 30 | $controls[$identifier]=$content; |
31 | 31 | $view->setVar("q", $controls); |
32 | 32 | } |
33 | 33 | |
34 | - public function createScriptVariable(&$view,$view_var, $output){ |
|
35 | - $view->setVar($view_var,$output); |
|
34 | + public function createScriptVariable(&$view, $view_var, $output) { |
|
35 | + $view->setVar($view_var, $output); |
|
36 | 36 | } |
37 | 37 | |
38 | - public function forward($initialController,$controller,$action,$params=array()){ |
|
39 | - $dispatcher = $initialController->dispatcher; |
|
38 | + public function forward($initialController, $controller, $action, $params=array()) { |
|
39 | + $dispatcher=$initialController->dispatcher; |
|
40 | 40 | $dispatcher->setControllerName($controller); |
41 | 41 | $dispatcher->setActionName($action); |
42 | 42 | $dispatcher->dispatch(); |
43 | - $template=$initialController->view->getRender($dispatcher->getControllerName(), $dispatcher->getActionName(),$dispatcher->getParams(), function ($view) { |
|
43 | + $template=$initialController->view->getRender($dispatcher->getControllerName(), $dispatcher->getActionName(), $dispatcher->getParams(), function($view) { |
|
44 | 44 | $view->setRenderLevel(View::LEVEL_ACTION_VIEW); |
45 | 45 | }); |
46 | 46 | return $template; |
47 | 47 | } |
48 | 48 | |
49 | - public function renderContent($initialControllerInstance,$viewName, $params=NULL) { |
|
50 | - list($controller,$action)=\explode("@", $viewName); |
|
51 | - $template=$initialControllerInstance->view->getRender($controller, $action, $params, function ($view) { |
|
49 | + public function renderContent($initialControllerInstance, $viewName, $params=NULL) { |
|
50 | + list($controller, $action)=\explode("@", $viewName); |
|
51 | + $template=$initialControllerInstance->view->getRender($controller, $action, $params, function($view) { |
|
52 | 52 | $view->setRenderLevel(View::LEVEL_ACTION_VIEW); |
53 | 53 | }); |
54 | 54 | return $template; |
55 | 55 | } |
56 | 56 | |
57 | - public function fromDispatcher($dispatcher){ |
|
57 | + public function fromDispatcher($dispatcher) { |
|
58 | 58 | $params=$dispatcher->getParams(); |
59 | 59 | $action=$dispatcher->getActionName(); |
60 | 60 | $items=array($dispatcher->getControllerName()); |
61 | - if(\sizeof($params)>0 || \strtolower($action)!="index" ){ |
|
61 | + if (\sizeof($params)>0 || \strtolower($action)!="index") { |
|
62 | 62 | $items[]=$action; |
63 | - foreach ($params as $p){ |
|
64 | - if(\is_object($p)===false) |
|
63 | + foreach ($params as $p) { |
|
64 | + if (\is_object($p)===false) |
|
65 | 65 | $items[]=$p; |
66 | 66 | } |
67 | 67 | } |
@@ -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); |
@@ -177,17 +177,17 @@ discard block |
||
177 | 177 | parse_str($_SERVER['QUERY_STRING'], $_GET); |
178 | 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,7 +364,7 @@ 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 | 370 | } else { |
@@ -380,25 +380,25 @@ 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 ) { |
|
401 | - if ($i % 2) { |
|
399 | + $retval=array(); |
|
400 | + foreach ($segments as $seg) { |
|
401 | + if ($i%2) { |
|
402 | 402 | $retval[$lastval]=$seg; |
403 | 403 | } else { |
404 | 404 | $retval[$seg]=FALSE; |
@@ -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 |
@@ -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=array()){ |
|
26 | + public function forward($initialControllerInstance, $controllerName, $actionName, $params=array()) { |
|
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 | } |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | -return array ( |
|
3 | - "JQuery" => array ( |
|
4 | - "MaxCDN" => array ( |
|
2 | +return array( |
|
3 | + "JQuery" => array( |
|
4 | + "MaxCDN" => array( |
|
5 | 5 | "url" => "http://code.jquery.com/jquery-%version%.min.js", |
6 | - "versions" => array ( |
|
6 | + "versions" => array( |
|
7 | 7 | "2.2.3", |
8 | 8 | "2.2.1", |
9 | 9 | "2.1.4", |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | "1.11.2" |
12 | 12 | ) |
13 | 13 | ), |
14 | - "Google" => array ( |
|
14 | + "Google" => array( |
|
15 | 15 | "url" => "https://ajax.googleapis.com/ajax/libs/jquery/%version%/jquery.min.js", |
16 | - "versions" => array ( |
|
16 | + "versions" => array( |
|
17 | 17 | "2.2.2", |
18 | 18 | "2.2.1", |
19 | 19 | "2.2.0", |
@@ -25,17 +25,17 @@ discard block |
||
25 | 25 | ) |
26 | 26 | ) |
27 | 27 | ), |
28 | - "JQueryUI" => array ( |
|
29 | - "MaxCDN" => array ( |
|
28 | + "JQueryUI" => array( |
|
29 | + "MaxCDN" => array( |
|
30 | 30 | "core" => "http://code.jquery.com/ui/%version%/jquery-ui.min.js", |
31 | 31 | "css" => "http://code.jquery.com/ui/%version%/themes/%theme%/jquery-ui.css", |
32 | - "versions" => array ( |
|
32 | + "versions" => array( |
|
33 | 33 | "1.11.4", |
34 | 34 | "1.11.3", |
35 | 35 | "1.11.2", |
36 | 36 | "1.10.4" |
37 | 37 | ), |
38 | - "themes" => array ( |
|
38 | + "themes" => array( |
|
39 | 39 | "black-tie", |
40 | 40 | "blitzer", |
41 | 41 | "cupertino", |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | "vader" |
63 | 63 | ) |
64 | 64 | ), |
65 | - "Google" => array ( |
|
65 | + "Google" => array( |
|
66 | 66 | "core" => "https://ajax.googleapis.com/ajax/libs/jqueryui/%version%/jquery-ui.min.js", |
67 | 67 | "css" => "https://ajax.googleapis.com/ajax/libs/jqueryui/%version%/themes/%theme%/jquery-ui.css", |
68 | - "versions" => array ( |
|
68 | + "versions" => array( |
|
69 | 69 | "1.11.4", |
70 | 70 | "1.11.3", |
71 | 71 | "1.11.2", |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | "1.10.4", |
75 | 75 | "1.10.0" |
76 | 76 | ), |
77 | - "themes" => array ( |
|
77 | + "themes" => array( |
|
78 | 78 | "black-tie", |
79 | 79 | "blitzer", |
80 | 80 | "cupertino", |
@@ -102,25 +102,25 @@ discard block |
||
102 | 102 | ) |
103 | 103 | ) |
104 | 104 | ), |
105 | - "Bootstrap" => array ( |
|
106 | - "MaxCDN" => array ( |
|
105 | + "Bootstrap" => array( |
|
106 | + "MaxCDN" => array( |
|
107 | 107 | "core" => "http://maxcdn.bootstrapcdn.com/bootstrap/%version%/js/bootstrap.min.js", |
108 | 108 | "css" => "http://maxcdn.bootstrapcdn.com/bootstrap/%version%/css/bootstrap.min.css", |
109 | - "versions" => array ( |
|
109 | + "versions" => array( |
|
110 | 110 | "3.3.6", |
111 | 111 | "3.3.5" |
112 | 112 | ), |
113 | - "themes" => array () |
|
113 | + "themes" => array() |
|
114 | 114 | ) |
115 | 115 | ), |
116 | - "Semantic" => array ( |
|
117 | - "cdnjs" => array ( |
|
116 | + "Semantic" => array( |
|
117 | + "cdnjs" => array( |
|
118 | 118 | "core" => "https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/%version%/semantic.min.js", |
119 | 119 | "css" => "https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/%version%/semantic.min.css", |
120 | - "versions" => array ( |
|
120 | + "versions" => array( |
|
121 | 121 | "2.1.8" |
122 | 122 | ), |
123 | - "themes" => array () |
|
123 | + "themes" => array() |
|
124 | 124 | ) |
125 | 125 | ) |
126 | 126 | ); |
127 | 127 | \ No newline at end of file |
@@ -9,7 +9,7 @@ |
||
9 | 9 | protected $localCss; |
10 | 10 | protected $framework; |
11 | 11 | |
12 | - public function __construct($framework,$version, $provider="MaxCDN") { |
|
12 | + public function __construct($framework, $version, $provider="MaxCDN") { |
|
13 | 13 | parent::__construct($version, $provider); |
14 | 14 | $this->framework=$framework; |
15 | 15 | $this->data=$this->data [$framework]; |
@@ -60,10 +60,10 @@ |
||
60 | 60 | |
61 | 61 | protected function replaceVersionAndTheme($url, $version, $theme) { |
62 | 62 | if (isset($theme)) |
63 | - return str_ireplace(array ( |
|
63 | + return str_ireplace(array( |
|
64 | 64 | "%theme%", |
65 | 65 | "%version%" |
66 | - ), array ( |
|
66 | + ), array( |
|
67 | 67 | $theme, |
68 | 68 | $version |
69 | 69 | ), $url); |
@@ -17,21 +17,21 @@ discard block |
||
17 | 17 | * jQuery Class |
18 | 18 | */ |
19 | 19 | class Jquery { |
20 | - use JqueryEventsTrait,JqueryAjaxTrait,JqueryActionsTrait; |
|
20 | + use JqueryEventsTrait, JqueryAjaxTrait, JqueryActionsTrait; |
|
21 | 21 | protected $_ui; |
22 | 22 | protected $_bootstrap; |
23 | 23 | protected $_semantic; |
24 | 24 | protected $libraryFile; |
25 | 25 | protected $_javascript_folder='js'; |
26 | - protected $jquery_code_for_load=array (); |
|
27 | - protected $jquery_code_for_compile=array (); |
|
26 | + protected $jquery_code_for_load=array(); |
|
27 | + protected $jquery_code_for_compile=array(); |
|
28 | 28 | protected $jquery_corner_active=FALSE; |
29 | 29 | protected $jquery_table_sorter_active=FALSE; |
30 | 30 | protected $jquery_table_sorter_pager_active=FALSE; |
31 | 31 | protected $jsUtils; |
32 | 32 | |
33 | - protected $jquery_events=array ( |
|
34 | - "bind","blur","change","click","dblclick","delegate","die","error","focus","focusin","focusout","hover","keydown","keypress","keyup","live","load","mousedown","mousseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","off","on","one","ready","resize","scroll","select","submit","toggle","trigger","triggerHandler","undind","undelegate","unload" |
|
33 | + protected $jquery_events=array( |
|
34 | + "bind", "blur", "change", "click", "dblclick", "delegate", "die", "error", "focus", "focusin", "focusout", "hover", "keydown", "keypress", "keyup", "live", "load", "mousedown", "mousseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "off", "on", "one", "ready", "resize", "scroll", "select", "submit", "toggle", "trigger", "triggerHandler", "undind", "undelegate", "unload" |
|
35 | 35 | ); |
36 | 36 | |
37 | 37 | public function ui($ui=NULL) { |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | return $this->_semantic; |
56 | 56 | } |
57 | 57 | |
58 | - public function __construct($params,$jsUtils) { |
|
58 | + public function __construct($params, $jsUtils) { |
|
59 | 59 | $this->params=array(); |
60 | - foreach ( $params as $key => $val ) { |
|
60 | + foreach ($params as $key => $val) { |
|
61 | 61 | $this->params[$key]=$params[$key]; |
62 | 62 | } |
63 | 63 | $this->jsUtils=$jsUtils; |
@@ -125,12 +125,12 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function _output($array_js='') { |
127 | 127 | if (!is_array($array_js)) { |
128 | - $array_js=array ( |
|
128 | + $array_js=array( |
|
129 | 129 | $array_js |
130 | 130 | ); |
131 | 131 | } |
132 | 132 | |
133 | - foreach ( $array_js as $js ) { |
|
133 | + foreach ($array_js as $js) { |
|
134 | 134 | $this->jquery_code_for_compile[]="\t$js\n"; |
135 | 135 | } |
136 | 136 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @param string $param |
143 | 143 | * @param boolean $immediatly delayed if false |
144 | 144 | */ |
145 | - public function _genericCallValue($jQueryCall,$element='this', $param="", $immediatly=false) { |
|
145 | + public function _genericCallValue($jQueryCall, $element='this', $param="", $immediatly=false) { |
|
146 | 146 | $element=$this->_prep_element($element); |
147 | 147 | if (isset($param)) { |
148 | 148 | $param=$this->_prep_value($param); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * @param boolean $immediatly delayed if false |
162 | 162 | * @return string |
163 | 163 | */ |
164 | - public function _genericCallElement($jQueryCall,$to='this', $element, $immediatly=false) { |
|
164 | + public function _genericCallElement($jQueryCall, $to='this', $element, $immediatly=false) { |
|
165 | 165 | $to=$this->_prep_element($to); |
166 | 166 | $element=$this->_prep_element($element); |
167 | 167 | $str="$({$to}).{$jQueryCall}({$element});"; |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function sortable($element, $options=array()) { |
181 | 181 | if (count($options)>0) { |
182 | - $sort_options=array (); |
|
183 | - foreach ( $options as $k => $v ) { |
|
182 | + $sort_options=array(); |
|
183 | + foreach ($options as $k => $v) { |
|
184 | 184 | $sort_options[]="\n\t\t".$k.': '.$v.""; |
185 | 185 | } |
186 | 186 | $sort_options=implode(",", $sort_options); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * @param boolean $stopPropagation Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. |
213 | 213 | * @return string |
214 | 214 | */ |
215 | - public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true) { |
|
215 | + public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true) { |
|
216 | 216 | if (is_array($js)) { |
217 | 217 | $js=implode("\n\t\t", $js); |
218 | 218 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
227 | 227 | else |
228 | 228 | $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
229 | - if($immediatly) |
|
229 | + if ($immediatly) |
|
230 | 230 | $this->jquery_code_for_compile[]=$event; |
231 | 231 | return $event; |
232 | 232 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | |
267 | 267 | // External references |
268 | 268 | $external_scripts=implode('', $this->jquery_code_for_load); |
269 | - extract(array ( |
|
269 | + extract(array( |
|
270 | 270 | 'library_src' => $external_scripts |
271 | 271 | )); |
272 | 272 | |
@@ -281,13 +281,13 @@ discard block |
||
281 | 281 | $script.='});'; |
282 | 282 | |
283 | 283 | $this->jquery_code_for_compile=array(); |
284 | - if($this->params["debug"]==false){ |
|
284 | + if ($this->params["debug"]==false) { |
|
285 | 285 | $script=$this->minify($script); |
286 | 286 | } |
287 | 287 | $output=($script_tags===FALSE) ? $script : $this->inline($script); |
288 | 288 | |
289 | - if ($view!==NULL){ |
|
290 | - $this->jsUtils->createScriptVariable($view,$view_var, $output); |
|
289 | + if ($view!==NULL) { |
|
290 | + $this->jsUtils->createScriptVariable($view, $view_var, $output); |
|
291 | 291 | } |
292 | 292 | return $output; |
293 | 293 | } |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | * @return void |
303 | 303 | */ |
304 | 304 | public function _clear_compile() { |
305 | - $this->jquery_code_for_compile=array (); |
|
305 | + $this->jquery_code_for_compile=array(); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | /** |
@@ -311,12 +311,12 @@ discard block |
||
311 | 311 | */ |
312 | 312 | public function _document_ready($js) { |
313 | 313 | if (!is_array($js)) { |
314 | - $js=array ( |
|
314 | + $js=array( |
|
315 | 315 | $js |
316 | 316 | ); |
317 | 317 | } |
318 | 318 | |
319 | - foreach ( $js as $script ) { |
|
319 | + foreach ($js as $script) { |
|
320 | 320 | $this->jquery_code_for_compile[]=$script; |
321 | 321 | } |
322 | 322 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | * @return string |
331 | 331 | */ |
332 | 332 | public function _prep_element($element) { |
333 | - if (strrpos($element, 'this')===false&&strrpos($element, 'event')===false&&strrpos($element, 'self')===false) { |
|
333 | + if (strrpos($element, 'this')===false && strrpos($element, 'event')===false && strrpos($element, 'self')===false) { |
|
334 | 334 | $element='"'.addslashes($element).'"'; |
335 | 335 | } |
336 | 336 | return $element; |
@@ -348,14 +348,14 @@ discard block |
||
348 | 348 | if (is_array($value)) { |
349 | 349 | $value=implode(",", $value); |
350 | 350 | } |
351 | - if (strrpos($value, 'this')===false&&strrpos($value, 'event')===false&&strrpos($value, 'self')===false) { |
|
351 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false && strrpos($value, 'self')===false) { |
|
352 | 352 | $value='"'.$value.'"'; |
353 | 353 | } |
354 | 354 | return $value; |
355 | 355 | } |
356 | 356 | |
357 | 357 | private function minify($input) { |
358 | - if(trim($input) === "") return $input; |
|
358 | + if (trim($input)==="") return $input; |
|
359 | 359 | return preg_replace( |
360 | 360 | array( |
361 | 361 | // Remove comment(s) |
@@ -9,7 +9,7 @@ |
||
9 | 9 | * @see \Ajax\common\SimpleComponent::compileEvents() |
10 | 10 | */ |
11 | 11 | protected function compileEvents() { |
12 | - foreach ( $this->events as $event => $jsCode ) { |
|
12 | + foreach ($this->events as $event => $jsCode) { |
|
13 | 13 | if ($event==="buttonClick") { |
14 | 14 | $this->jquery_code_for_compile []="$( \"#split-".preg_replace('/[^a-zA-Z0-9\-.]/s', '', $this->attachTo)."\" ).on(\"click\" , function( event, data ) {".$jsCode."});"; |
15 | 15 | } else { |