Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/wp-rocket/vendor/berlindb/core/autoloader.php
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
<?php
2
+
/**
3
+
* Autoloader.
4
+
*
5
+
* @package Database
6
+
* @copyright Copyright (c) 2021
7
+
* @license https://opensource.org/licenses/MIT MIT
8
+
* @since 2.0.0
9
+
*/
10
+
11
+
// Exit if accessed directly.
12
+
defined( 'ABSPATH' ) || exit;
13
+
14
+
// Register a closure to autoload BerlinDB.
15
+
spl_autoload_register(
16
+
17
+
/**
18
+
* Closure of the autoloader.
19
+
*
20
+
* @param string $class_name The fully-qualified class name.
21
+
* @return void
22
+
*/
23
+
static function ( $class_name = '' ) {
24
+
25
+
// Project namespace & length.
26
+
$project_namespace = 'BerlinDB\\Database\\';
27
+
$length = strlen( $project_namespace );
28
+
29
+
// Bail if class is not in this namespace.
30
+
if ( 0 !== strncmp( $project_namespace, $class_name, $length ) ) {
31
+
return;
32
+
}
33
+
34
+
// Setup file parts.
35
+
$format = '%1$s/src/%2$s.php';
36
+
$path = __DIR__;
37
+
$name = str_replace( '\\', '/', substr( $class_name, $length ) );
38
+
39
+
// Parse class and namespace to file.
40
+
$file = sprintf( $format, $path, $name );
41
+
42
+
// Bail if file does not exist.
43
+
if ( ! is_file( $file ) ) {
44
+
return;
45
+
}
46
+
47
+
// Require the file.
48
+
require_once $file;
49
+
}
50
+
);
51
+