PluginProbe
MBE eShip / trunk
MBE eShip vtrunk
2.8.1 trunk 1.0.0 1.1.0 1.1.3 1.2.1 1.2.2 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.7.1 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.1.0 2.1.1 2.1.2 2.2.1 All 37 releases
mail-boxes-etc / lib / dompdf / src / Autoloader.php

Autoloader.php in MBE eShip trunk, at lib/dompdf/src/Autoloader.php

42 lines 899 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Dompdf;
3
4 /**
5 * Autoloads Dompdf classes
6 *
7 * @package Dompdf
8 */
9 class Autoloader
10 {
11 const PREFIX = 'Dompdf';
12
13 /**
14 * Register the autoloader
15 */
16 public static function register()
17 {
18 spl_autoload_register([new self, 'autoload']);
19 }
20
21 /**
22 * Autoloader
23 *
24 * @param string
25 */
26 public static function autoload($class)
27 {
28 if ($class === 'Dompdf\Cpdf') {
29 require_once __DIR__ . "/../lib/Cpdf.php";
30 return;
31 }
32
33 $prefixLength = strlen(self::PREFIX);
34 if (0 === strncmp(self::PREFIX, $class, $prefixLength)) {
35 $file = str_replace('\\', '/', substr($class, $prefixLength));
36 $file = realpath(__DIR__ . (empty($file) ? '' : '/') . $file . '.php');
37 if (file_exists($file)) {
38 require_once $file;
39 }
40 }
41 }
42 }