Pico::loadPlugins PHP Method

loadPlugins() protected method

Plugin files MAY be prefixed by a number (e.g. 00-PicoDeprecated.php) to indicate their processing order. Plugins without a prefix will be loaded last. If you want to use a prefix, you MUST consider the following directives: - 00 to 19: Reserved - 20 to 39: Low level code helper plugins - 40 to 59: Plugins manipulating routing or the pages array - 60 to 79: Plugins hooking into template or markdown parsing - 80 to 99: Plugins using the onPageRendered event
See also: Pico::getPlugin()
See also: Pico::getPlugins()
protected loadPlugins ( ) : void
return void
    protected function loadPlugins()
    {
        $this->plugins = array();
        $pluginFiles = $this->getFiles($this->getPluginsDir(), '.php');
        foreach ($pluginFiles as $pluginFile) {
            require_once $pluginFile;
            $className = preg_replace('/^[0-9]+-/', '', basename($pluginFile, '.php'));
            if (class_exists($className)) {
                // class name and file name can differ regarding case sensitivity
                $plugin = new $className($this);
                $className = get_class($plugin);
                $this->plugins[$className] = $plugin;
            } else {
                // TODO: breaks backward compatibility
                //throw new RuntimeException("Unable to load plugin '".$className."'");
            }
        }
    }