@@ -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 { |
@@ -1,39 +1,39 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Ajax\php\ci; |
| 3 | 3 | |
| 4 | -class JsUtils extends \Ajax\JsUtils{ |
|
| 4 | +class JsUtils extends \Ajax\JsUtils { |
|
| 5 | 5 | protected $ci; |
| 6 | - protected $_my_controller_paths= array(); |
|
| 7 | - protected $_my_controllers= array(); |
|
| 6 | + protected $_my_controller_paths=array(); |
|
| 7 | + protected $_my_controllers=array(); |
|
| 8 | 8 | |
| 9 | - public function __construct($params=array(),$injected=NULL){ |
|
| 10 | - parent::__construct($params,$injected); |
|
| 11 | - $this->_my_controller_paths = array(APPPATH); |
|
| 9 | + public function __construct($params=array(), $injected=NULL) { |
|
| 10 | + parent::__construct($params, $injected); |
|
| 11 | + $this->_my_controller_paths=array(APPPATH); |
|
| 12 | 12 | } |
| 13 | - public function getUrl($url){ |
|
| 13 | + public function getUrl($url) { |
|
| 14 | 14 | return site_url($url); |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - public function getCi(){ |
|
| 18 | - if(isset($this->ci)===false){ |
|
| 19 | - $this->ci =& get_instance(); |
|
| 17 | + public function getCi() { |
|
| 18 | + if (isset($this->ci)===false) { |
|
| 19 | + $this->ci=& get_instance(); |
|
| 20 | 20 | $this->ci->load->helper('url'); |
| 21 | 21 | } |
| 22 | 22 | return $this->ci; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function addViewElement($identifier,$content,&$view){ |
|
| 26 | - if(\array_key_exists("q", $view)===false){ |
|
| 25 | + public function addViewElement($identifier, $content, &$view) { |
|
| 26 | + if (\array_key_exists("q", $view)===false) { |
|
| 27 | 27 | $view["q"]=array(); |
| 28 | 28 | } |
| 29 | 29 | $view["q"][$identifier]=$content; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function createScriptVariable(&$view,$view_var, $output){ |
|
| 32 | + public function createScriptVariable(&$view, $view_var, $output) { |
|
| 33 | 33 | $view[$view_var]=$output; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public function forward($initialControllerInstance,$controllerName,$actionName,$params=NULL){ |
|
| 36 | + public function forward($initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
| 37 | 37 | $ci=$this->getCi(); |
| 38 | 38 | $controllerName=strtolower($controllerName); |
| 39 | 39 | $this->controller($controllerName); |
@@ -44,64 +44,64 @@ discard block |
||
| 44 | 44 | return $result; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function renderContent($initialControllerInstance,$viewName, $params=NULL) { |
|
| 47 | + public function renderContent($initialControllerInstance, $viewName, $params=NULL) { |
|
| 48 | 48 | return $initialControllerInstance->load->view($viewName, $params, true); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function fromDispatcher($dispatcher){ |
|
| 51 | + public function fromDispatcher($dispatcher) { |
|
| 52 | 52 | return array_values($dispatcher->uri->segment_array()); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function controller($controller, $name = '', $db_conn = FALSE){ |
|
| 56 | - if (is_array($controller)){ |
|
| 57 | - foreach ($controller as $babe){ |
|
| 55 | + public function controller($controller, $name='', $db_conn=FALSE) { |
|
| 56 | + if (is_array($controller)) { |
|
| 57 | + foreach ($controller as $babe) { |
|
| 58 | 58 | $this->controller($babe); |
| 59 | 59 | } |
| 60 | 60 | return; |
| 61 | 61 | } |
| 62 | - if ($controller == ''){ |
|
| 62 | + if ($controller=='') { |
|
| 63 | 63 | return; |
| 64 | 64 | } |
| 65 | - $path = ''; |
|
| 65 | + $path=''; |
|
| 66 | 66 | // Is the controller in a sub-folder? If so, parse out the filename and path. |
| 67 | - if (($last_slash = strrpos($controller, '/')) !== FALSE){ |
|
| 67 | + if (($last_slash=strrpos($controller, '/'))!==FALSE) { |
|
| 68 | 68 | // The path is in front of the last slash |
| 69 | - $path = substr($controller, 0, $last_slash + 1); |
|
| 69 | + $path=substr($controller, 0, $last_slash+1); |
|
| 70 | 70 | // And the controller name behind it |
| 71 | - $controller = substr($controller, $last_slash + 1); |
|
| 71 | + $controller=substr($controller, $last_slash+1); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if ($name == ''){ |
|
| 75 | - $name = $controller; |
|
| 74 | + if ($name=='') { |
|
| 75 | + $name=$controller; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - if (in_array($name, $this->_my_controllers, TRUE)){ |
|
| 78 | + if (in_array($name, $this->_my_controllers, TRUE)) { |
|
| 79 | 79 | return; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - $CI =$this->getCi(); |
|
| 83 | - if (isset($CI->$name)){ |
|
| 82 | + $CI=$this->getCi(); |
|
| 83 | + if (isset($CI->$name)) { |
|
| 84 | 84 | show_error('The controller name you are loading is the name of a resource that is already being used: '.$name); |
| 85 | 85 | } |
| 86 | - $controller = strtolower($controller); |
|
| 87 | - foreach ($this->_my_controller_paths as $mod_path){ |
|
| 88 | - if ( ! file_exists($mod_path.'controllers/'.$path.$controller.'.php')){ |
|
| 86 | + $controller=strtolower($controller); |
|
| 87 | + foreach ($this->_my_controller_paths as $mod_path) { |
|
| 88 | + if (!file_exists($mod_path.'controllers/'.$path.$controller.'.php')) { |
|
| 89 | 89 | continue; |
| 90 | 90 | } |
| 91 | - if ($db_conn !== FALSE AND ! class_exists('CI_DB')){ |
|
| 92 | - if ($db_conn === TRUE){ |
|
| 93 | - $db_conn = ''; |
|
| 91 | + if ($db_conn!==FALSE AND !class_exists('CI_DB')) { |
|
| 92 | + if ($db_conn===TRUE) { |
|
| 93 | + $db_conn=''; |
|
| 94 | 94 | } |
| 95 | 95 | $CI->load->database($db_conn, FALSE, TRUE); |
| 96 | 96 | } |
| 97 | - if ( ! class_exists('CI_Controller')){ |
|
| 97 | + if (!class_exists('CI_Controller')) { |
|
| 98 | 98 | load_class('Controller', 'core'); |
| 99 | 99 | } |
| 100 | 100 | require_once($mod_path.'controllers/'.$path.$controller.'.php'); |
| 101 | - $controller = ucfirst($controller); |
|
| 102 | - $CI->$name = new $controller(); |
|
| 101 | + $controller=ucfirst($controller); |
|
| 102 | + $CI->$name=new $controller(); |
|
| 103 | 103 | |
| 104 | - $this->_my_controllers[] = $name; |
|
| 104 | + $this->_my_controllers[]=$name; |
|
| 105 | 105 | return; |
| 106 | 106 | } |
| 107 | 107 | show_error('Unable to locate the controller you have specified: '.$controller); |
@@ -11,10 +11,10 @@ |
||
| 11 | 11 | * @var Ajax\php\cakephp\_JsUtils |
| 12 | 12 | */ |
| 13 | 13 | public $jquery; |
| 14 | - public function initialize(array $config){ |
|
| 14 | + public function initialize(array $config) { |
|
| 15 | 15 | \extract($config); |
| 16 | 16 | $this->jquery=new _JsUtils(); |
| 17 | - if(isset($semantic)){ |
|
| 17 | + if (isset($semantic)) { |
|
| 18 | 18 | $this->jquery->semantic(new Semantic()); |
| 19 | 19 | } |
| 20 | 20 | } |
@@ -8,23 +8,23 @@ discard block |
||
| 8 | 8 | use Cake\Network\Response; |
| 9 | 9 | use Cake\Core\App; |
| 10 | 10 | |
| 11 | -class _JsUtils extends \Ajax\JsUtils{ |
|
| 12 | - public function getUrl($url){ |
|
| 11 | +class _JsUtils extends \Ajax\JsUtils { |
|
| 12 | + public function getUrl($url) { |
|
| 13 | 13 | return Router::url($url); |
| 14 | 14 | } |
| 15 | - public function addViewElement($identifier,$content,&$view){ |
|
| 15 | + public function addViewElement($identifier, $content, &$view) { |
|
| 16 | 16 | $viewVars=$view->viewVars; |
| 17 | - if (isset($viewVars["q"]) === false) { |
|
| 18 | - $controls=array (); |
|
| 19 | - }else{ |
|
| 17 | + if (isset($viewVars["q"])===false) { |
|
| 18 | + $controls=array(); |
|
| 19 | + } else { |
|
| 20 | 20 | $controls=$viewVars["q"]; |
| 21 | 21 | } |
| 22 | 22 | $controls[$identifier]=$content; |
| 23 | 23 | $view->set("q", $controls); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function createScriptVariable(&$view,$view_var, $output){ |
|
| 27 | - $view->set($view_var,$output); |
|
| 26 | + public function createScriptVariable(&$view, $view_var, $output) { |
|
| 27 | + $view->set($view_var, $output); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -34,18 +34,18 @@ discard block |
||
| 34 | 34 | * @param array $params |
| 35 | 35 | * @see \Ajax\JsUtils::forward() |
| 36 | 36 | */ |
| 37 | - public function forward($initialControllerInstance,$controllerName,$actionName,$params=array()){ |
|
| 37 | + public function forward($initialControllerInstance, $controllerName, $actionName, $params=array()) { |
|
| 38 | 38 | \ob_start(); |
| 39 | - if(isset($params) && \is_array($params)===false){ |
|
| 39 | + if (isset($params) && \is_array($params)===false) { |
|
| 40 | 40 | $params=[$params]; |
| 41 | 41 | } |
| 42 | 42 | $url=h(Router::url(\array_merge([ |
| 43 | 43 | 'controller' => $controllerName, |
| 44 | - 'action' => $actionName],$params),false |
|
| 44 | + 'action' => $actionName], $params), false |
|
| 45 | 45 | )); |
| 46 | 46 | $base=Router::url("/"); |
| 47 | - if (substr($url, 0, strlen($base)) == $base) { |
|
| 48 | - $url = substr($url, strlen($base)); |
|
| 47 | + if (substr($url, 0, strlen($base))==$base) { |
|
| 48 | + $url=substr($url, strlen($base)); |
|
| 49 | 49 | } |
| 50 | 50 | $initialControllerInstance->requestAction($url); |
| 51 | 51 | $result=\ob_get_contents(); |
@@ -53,17 +53,17 @@ discard block |
||
| 53 | 53 | return $result; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - public function renderContent($initialControllerInstance,$viewName, $params=NULL) { |
|
| 57 | - $view = new View(Router::getRequest(true), new Response()); |
|
| 58 | - if(\is_array($params)){ |
|
| 59 | - foreach ($params as $k=>$v){ |
|
| 56 | + public function renderContent($initialControllerInstance, $viewName, $params=NULL) { |
|
| 57 | + $view=new View(Router::getRequest(true), new Response()); |
|
| 58 | + if (\is_array($params)) { |
|
| 59 | + foreach ($params as $k=>$v) { |
|
| 60 | 60 | $view->set($k, $v); |
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | return $view->render($viewName); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - public function fromDispatcher($dispatcher){ |
|
| 66 | + public function fromDispatcher($dispatcher) { |
|
| 67 | 67 | return \explode("/", Router::getRequest(true)->url); |
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | \ 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 | 112 | } else { |
| 113 | - return $this->root . implode($separator, array_slice(array_map(function ($e) { |
|
| 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 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | protected function createItem($value) { |
| 182 | 182 | $count=$this->count(); |
| 183 | - $itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section"); |
|
| 183 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "a", "section"); |
|
| 184 | 184 | if (\is_array($value)) |
| 185 | 185 | $itemO->fromArray($value); |
| 186 | 186 | else { |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | public function addIconAt($icon, $index) { |
| 193 | 193 | $item=$this->getItem($index); |
| 194 | 194 | if (isset($item)) { |
| 195 | - $icon=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
| 195 | + $icon=new HtmlIcon("icon-".$this->identifier, $icon); |
|
| 196 | 196 | $item->wrapContent($icon); |
| 197 | 197 | } |
| 198 | 198 | } |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | public function addItem($item) { |
| 201 | 201 | $count=$this->count(); |
| 202 | 202 | $itemO=parent::addItem($item); |
| 203 | - $this->addToPropertyCtrl("class", "section", array ("section" )); |
|
| 203 | + $this->addToPropertyCtrl("class", "section", array("section")); |
|
| 204 | 204 | $itemO->setProperty($this->attr, $this->getHref($count)); |
| 205 | 205 | return $itemO; |
| 206 | 206 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | public function setAbsolutePaths($absolutePaths) { |
| 217 | 217 | $this->absolutePaths=$absolutePaths; |
| 218 | 218 | $size=\sizeof($this->content); |
| 219 | - for($i=0;$i<$size;$i++){ |
|
| 219 | + for ($i=0; $i<$size; $i++) { |
|
| 220 | 220 | $this->content[$i]->setProperty($this->attr, $this->getHref($i)); |
| 221 | 221 | } |
| 222 | 222 | return $this; |