ealio Posted October 5, 2013 Share Posted October 5, 2013 Is it a bug for the method of addJqueryPlugin method in /class/controller/Controller.php? public function addJqueryPlugin($name, $folder = null) { $plugin_path = array(); if (is_array($name)) { foreach ($name as $plugin) { $plugin_path = Media::getJqueryPluginPath($plugin, $folder); if(!empty($plugin_path['js'])) $this->addJS($plugin_path['js']); if(!empty($plugin_path['css'])) $this->addCSS($plugin_path['css']); } } else $plugin_path = Media::getJqueryPluginPath($name, $folder); if(!empty($plugin_path['css'])) $this->addCSS($plugin_path['css']); if(!empty($plugin_path['js'])) $this->addJS($plugin_path['js']); } If the parameter of $name is an array, the last if(!empty($plugin_path['css'])) $this->addCSS($plugin_path['css']); if(!empty($plugin_path['js'])) $this->addJS($plugin_path['js']); should not be executed. I think it should be changed to public function addJqueryPlugin($name, $folder = null) { $plugin_path = array(); if (is_array($name)) { foreach ($name as $plugin) { $plugin_path = Media::getJqueryPluginPath($plugin, $folder); if(!empty($plugin_path['js'])) $this->addJS($plugin_path['js']); if(!empty($plugin_path['css'])) $this->addCSS($plugin_path['css']); } } else{ $plugin_path = Media::getJqueryPluginPath($name, $folder); if(!empty($plugin_path['css'])) $this->addCSS($plugin_path['css']); if(!empty($plugin_path['js'])) $this->addJS($plugin_path['js']); } } What do you think? Link to comment Share on other sites More sharing options...
PascalVG Posted October 5, 2013 Share Posted October 5, 2013 ealio, think you have a point there. it twice adds the css and js of the last $plugin, one inside the foreach, one at the end. your expansion of the else-reach eliminates it :-) pascal Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now