2014-09-15 22:24:06 +02:00
|
|
|
<?php
|
|
|
|
// autoloader
|
|
|
|
spl_autoload_register(array(new HTML5PHP_Autoloader(), 'autoload'));
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Autoloader class
|
|
|
|
*/
|
|
|
|
class HTML5PHP_Autoloader
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this->path = dirname(__FILE__);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Autoloader
|
|
|
|
*
|
|
|
|
* @param string $class The name of the class to attempt to load.
|
|
|
|
*/
|
|
|
|
public function autoload($class)
|
|
|
|
{
|
|
|
|
// Only load the class if it starts with "HTML5"
|
2015-06-14 02:03:20 +02:00
|
|
|
if (strpos($class, 'Masterminds\HTML5') !== 0)
|
2014-09-15 22:24:06 +02:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2015-06-14 02:03:20 +02:00
|
|
|
$class = substr($class, 12);
|
2014-09-15 22:24:06 +02:00
|
|
|
//die($class);
|
|
|
|
|
|
|
|
$filename = $this->path . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php';
|
|
|
|
include $filename;
|
|
|
|
}
|
|
|
|
}
|