Advertisement
Guest User

Untitled

a guest
Jan 25th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. <?php defined('DIRECT') OR exit('No direct script access allowed');
  2.  
  3. class Controller extends Loader
  4. {
  5. protected $load;
  6. protected $autoload;
  7.  
  8. public function __construct()
  9. {
  10. require APP_DIR . 'config/autoload.php';
  11. $this->autoload = $autoload;
  12.  
  13. $this->load = $this;
  14. $this->autoload_helpers();
  15. $this->autoload_plugins();
  16. }
  17.  
  18. public function autoload_helpers()
  19. {
  20. if(count($this->autoload['helpers']) > 0) {
  21. foreach($this->autoload['helpers'] as $helper) {
  22. $helper_name = ucfirst($helper);
  23. $this->load->helper($helper_name);
  24. }
  25. }
  26. }
  27.  
  28. public function autoload_plugins()
  29. {
  30. if(count($this->autoload['plugins']) > 0) {
  31. foreach($this->autoload['plugins'] as $plugin) {
  32. $plugin_name = ucfirst($plugin);
  33. $this->load->plugin($plugin_name);
  34. $this->$plugin = new $plugin;
  35. }
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement