public function Start($path)
    {
        if(!is_dir($path))
            return;

        $path = rtrim($path, "/\\") . "/";

        $elements = scandir($path);

        foreach($elements as $file_name)
        {
            if(is_file($path . $file_name))
            {
                $file_parts = explode(".", $file_name, 2);

                if(count($file_parts) < 2)
                    continue;

                $class_name = $file_parts[0];
                $class_name_ns = "Peg\Lib\\Plugins\\$class_name";
                $file_extension = $file_parts[1];

                if($file_extension == "php")
                {
                    include($path . $file_name);

                    if(in_array($class_name_ns, get_declared_classes()))
                    {
                        $this->plugins[$class_name] = new $class_name_ns;

                        $this->plugins[$class_name]->name = $class_name;

                        $this->plugins[$class_name]->path = $path . $file_name;

                        $this->plugins[$class_name]->OnInit();
                    }
                }
            }
        }
    }
public function Start($path)
    {
        if(!is_dir($path))
            return;

        $path = rtrim($path, "/\\") . "/";

        $elements = scandir($path);

        foreach($elements as $file_name)
        {
            if(is_file($path . $file_name))
            {
                $file_parts = explode(".", $file_name, 2);

                if(count($file_parts) < 2)
                    continue;

                $class_name = $file_parts[0];
                $class_name_ns = "Peg\Lib\\Plugins\\$class_name";
                $file_extension = $file_parts[1];

                if($file_extension == "php")
                {
                    include($path . $file_name);

                    if(in_array($class_name_ns, get_declared_classes()))
                    {
                        $this->plugins[$class_name] = new $class_name_ns;

                        $this->plugins[$class_name]->name = $class_name;

                        $this->plugins[$class_name]->path = $path . $file_name;

                        $this->plugins[$class_name]->OnInit();
                    }
                }
            }
        }
    }
public function Start ( $ path ) { if ( ! is_dir ( $ path ) ) return ; $ path = rtrim ( $ path , "/\\" ) . "/" ; $ elements = scandir ( $ path ) ; foreach ( $ elements as $ file_name ) { if ( is_file ( $ path . $ file_name ) ) { $ file_parts = explode ( "." , $ file_name , 2 ) ; if ( count ( $ file_parts ) < 2 ) continue ; $ class_name = $ file_parts [ 0 ] ; $ class_name_ns = "Peg\Lib\\Plugins\\$class_name" ; $ file_extension = $ file_parts [ 1 ] ; if ( $ file_extension == "php" ) { include ( $ path . $ file_name ) ; if ( in_array ( $ class_name_ns , get_declared_classes ( ) ) ) { $ this -> plugins [ $ class_name ] = new $ class_name_ns ; $ this -> plugins [ $ class_name ] -> name = $ class_name ; $ this -> plugins [ $ class_name ] -> path = $ path . $ file_name ; $ this -> plugins [ $ class_name ] -> OnInit ( ) ; } } } } }
Scans a given path for valid plugin files and load them if possible.
This method should be called after everything else in the application
has been properly initialized.
@param string $path
Scans a given path for valid plugin files and load them if possible . This method should be called after everything else in the application has been properly initialized .