Huymada icon

Plugin

Huymada | PRO | 04/30/17 07:53:16 PM UTC | 0 ⭐ | 268 👁️ | Never ⏰ | []
PHP |

1.23 KB

|

None

|

0 👍

/

0 👎

<?php
# Plugin - Gerenciamento de Extensões
# Última Atualização: 2017-04-30
class Plugin {
 
    # Biblioteca de extensões
        public $library = [
            'pastebin' => ['http://pastebin.com/raw/', 'remote', 0],
            'local' => ['local.php', 'local', 0]
        ];
 
    # Autoload
        public function __construct() {
            foreach($this->library as $this->key => $this->value) {
                if($this->value[2]) {
                    if($this->value[1] == 'remote') {
                        require_once($this->value[0]);
                    }
                    else if($this->value[1] == 'local' && file_exists($this->value[0])) {
                        require_once($this->value[0]);
                    }
                }
            }
        }
 
    # Manual Load
        public function load($key) {
            if(array_key_exists($key, $this->library)) {
                if($this->library[$key][1] == 'remote') {
                    require_once($this->library[$key][0]);
                }
                else if($this->library[$key][1] == 'local' && file_exists($this->value[0])) {
                    require_once($this->value[0]);
                }
            }
        }
 
}

Comments