Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/login-customizer/autoload.php

Keine Baseline-Datei – Diff nur gegen leer.
Zur Liste
1 -
1 + <?php
2 + /**
3 + * Plugin autoload.
4 + *
5 + * @package LoginCustomizer
6 + * @author WPBrigade
7 + * @copyright Copyright (c) 2021, WPBrigade
8 + * @link https://loginpress.pro/
9 + * @license https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10 + */
11 +
12 + /**
13 + * Use to autoload needed classes without Composer.
14 + *
15 + * @param string $class The fully-qualified class name.
16 + * @return void
17 + */
18 +
19 + spl_autoload_register( function( $class ) {
20 +
21 + $namespace = 'LoginCustomizer\\';
22 + $path = 'src';
23 +
24 + // Bail if the class is not in our namespace.
25 + if ( 0 !== strpos( $class, $namespace ) ) {
26 + return;
27 + }
28 +
29 + // Remove the namespace.
30 + $class = str_replace( $namespace, '', $class );
31 +
32 + // Build the filename.
33 + $file = realpath( __DIR__ . "/{$path}" );
34 + $file = $file . DIRECTORY_SEPARATOR . str_replace( '\\', DIRECTORY_SEPARATOR, $class ) . '.php';
35 +
36 + // If the file exists for the class name, load it.
37 + if ( file_exists( $file ) ) {
38 + include( $file );
39 + }
40 + } );