Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.16.50.1
<?php
namespace Dompdf;
/**
* Autoloads Dompdf classes
*
* @package Dompdf
*/
class Autoloader
{
const PREFIX = 'Dompdf';
/**
* Register the autoloader
*/
public static function register()
{
spl_autoload_register(array(new self, 'autoload'));
}
/**
* Autoloader
*
* @param string
*/
public static function autoload($class)
{
if ($class === 'Cpdf') {
require_once __DIR__ . "/../lib/Cpdf.php";
return;
}
$prefixLength = strlen(self::PREFIX);
if (0 === strncmp(self::PREFIX, $class, $prefixLength)) {
$file = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, $prefixLength));
$file = realpath(__DIR__ . (empty($file) ? '' : DIRECTORY_SEPARATOR) . $file . '.php');
if (file_exists($file)) {
require_once $file;
}
}
}
}
|