File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * I fully recommend to use this library with composer.
4
+ * Use this autoloader only if you don't want to install composer.
5
+ */
6
+
7
+ spl_autoload_register (function ($ class ) {
8
+ // project-specific namespace prefix
9
+ $ prefix = 'Screen \\' ;
10
+
11
+ // base directory for the namespace prefix
12
+ $ base_dir = __DIR__ . '/src/ ' ;
13
+
14
+ // does the class use the namespace prefix?
15
+ $ len = strlen ($ prefix );
16
+ if (strncmp ($ prefix , $ class , $ len ) !== 0 ) {
17
+ // no, move to the next registered autoloader
18
+ return ;
19
+ }
20
+
21
+ // get the relative class name
22
+ $ relative_class = substr ($ class , $ len );
23
+
24
+ // replace the namespace prefix with the base directory, replace namespace
25
+ // separators with directory separators in the relative class name, append
26
+ // with .php
27
+ $ file = $ base_dir . str_replace ('\\' , '/ ' , $ relative_class ) . '.php ' ;
28
+
29
+ // if the file exists, require it
30
+ if (file_exists ($ file )) {
31
+ require $ file ;
32
+ }
33
+ });
Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
+ // Use the first autoload instead if you don't want to install composer
4
+ //require_once '../autoload.php';
3
5
require_once '../vendor/autoload.php ' ;
4
6
5
7
if (!isset ($ _GET ['url ' ])) {
You can’t perform that action at this time.
0 commit comments