class autoloader {
public static $loader;
public static function init()
{
if (self::$loader == NULL)
self::$loader = new self();
return self::$loader;
}
public function __construct()
{
spl_autoload_register( array($this,'commands') );
}
public function commands( $class ) {
set_include_path( plugin_dir_path( __FILE__ ).'commands/');
spl_autoload_extensions('.command.php');
spl_autoload($class);
}
}
//call
autoloader::init();