Huymada

Plugin

Apr 30th, 2017
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.23 KB | None | 0 0
  1. <?php
  2. # Plugin - Gerenciamento de Extensões
  3. # Última Atualização: 2017-04-30
  4. class Plugin {
  5.  
  6.     # Biblioteca de extensões
  7.        public $library = [
  8.             'pastebin' => ['http://pastebin.com/raw/', 'remote', 0],
  9.             'local' => ['local.php', 'local', 0]
  10.         ];
  11.  
  12.     # Autoload
  13.        public function __construct() {
  14.             foreach($this->library as $this->key => $this->value) {
  15.                 if($this->value[2]) {
  16.                     if($this->value[1] == 'remote') {
  17.                         require_once($this->value[0]);
  18.                     }
  19.                     else if($this->value[1] == 'local' && file_exists($this->value[0])) {
  20.                         require_once($this->value[0]);
  21.                     }
  22.                 }
  23.             }
  24.         }
  25.  
  26.     # Manual Load
  27.        public function load($key) {
  28.             if(array_key_exists($key, $this->library)) {
  29.                 if($this->library[$key][1] == 'remote') {
  30.                     require_once($this->library[$key][0]);
  31.                 }
  32.                 else if($this->library[$key][1] == 'local' && file_exists($this->value[0])) {
  33.                     require_once($this->value[0]);
  34.                 }
  35.             }
  36.         }
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment