This repository was archived by the owner on Nov 14, 2024. It is now read-only.
File tree 1 file changed +30
-3
lines changed
1 file changed +30
-3
lines changed Original file line number Diff line number Diff line change 4
4
Plugin Name: tonik/gin
5
5
Plugin URI: http://tonik.pl
6
6
Description: Foundation of the Tonik WordPress Starter Theme. Provides all custom functionalities which it offers.
7
+ <<<<<<< HEAD
7
8
Version: 3.0.0
9
+ =======
10
+ Version: 3.1.0
11
+ >>>>>>> release-3.1.0
8
12
Author: Tonik
9
13
Author URI: http://tonik.pl
10
14
License: GPL-2.0+
13
17
Text Domain: tonik.gin
14
18
*/
15
19
16
- if ( file_exists ( $ composer = __DIR__ . ' /vendor/autoload.php ' ) ) {
17
- require $ composer ;
18
- }
20
+ spl_autoload_register ( function ( $ class ) {
21
+ // Namespace prefix
22
+ $ prefix = ' Tonik \\' ;
19
23
24
+ // Base directory for the namespace prefix
25
+ $ base_dir = __DIR__ . '/src/ ' ;
26
+
27
+ // Does the class use the namespace prefix?
28
+ $ len = strlen ($ prefix );
29
+ if (strncmp ($ prefix , $ class , $ len ) !== 0 ) {
30
+ // No, move to the next registered autoloader
31
+ return ;
32
+ }
33
+
34
+ // Get the relative class name
35
+ $ relative_class = substr ($ class , $ len );
36
+
37
+ // Replace the namespace prefix with the base
38
+ // directory, replace namespace separators with directory
39
+ // separators in the relative class name, append with .php
40
+ $ file = $ base_dir . str_replace ('\\' , '/ ' , $ relative_class ) . '.php ' ;
41
+
42
+ // If the file exists, require it
43
+ if (file_exists ($ file )) {
44
+ require $ file ;
45
+ }
46
+ });
You can’t perform that action at this time.
0 commit comments