-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautoloader.php
76 lines (64 loc) · 2.36 KB
/
autoloader.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
namespace IO4;
/**
* Please set your scope!!!
* See: https://github.com/frdlweb/webfat/blob/7b1fe168cc9328a65d66d5d147ffd39064e4cbf1/public/index.php#L4351
* recommended for production:
* putenv('IO4_WORKSPACE_SCOPE="@www@parent"');
* recommended for global:
* putenv('IO4_WORKSPACE_SCOPE="@global"');
*/
//putenv('IO4_WORKSPACE_SCOPE="@www@parent"');
//putenv('IO4_WORKSPACE_SCOPE="@cwd"');
/**
* Usage:
require_once __DIR__.\DIRECTORY_SEPARATOR.'autoloader.php';
$webfatFile =__DIR__.\DIRECTORY_SEPARATOR.'webfat.php';
// OE e.g..: $webfatFile =getcwd().\DIRECTORY_SEPARATOR.'webfat.php';
$StubRunner = (new \IO4\Webfat)->getWebfat($webfatFile,
true, //register autoloaders
false //runAsIndex / run as "main app"
);
*/
//$dir = '@global';
//$dir = __DIR__.\DIRECTORY_SEPARATOR.'.frdl';
//putenv('IO4_WORKSPACE_SCOPE="'.$dir.'"');
//$_ENV['IO4_WORKSPACE_SCOPE'] = $dir;
function _installClass($class){
$plugin_root = __DIR__;
$p = explode('\\', $class);
$_f = implode(\DIRECTORY_SEPARATOR, $p);
$classFile = "{$plugin_root}/.classes/{$_f}.php";
if (!file_exists($classFile) || filemtime($classFile)<30*24*60*60) {
// check if composer dependencies are distributed with the plugin
if(!is_dir(dirname($classFile))){
mkdir(dirname($classFile), 0755, true);
}
file_put_contents(
$classFile,
file_get_contents('https://webfan.de/install/?source='.urlencode($class))
);
}
if ( !class_exists($class ) ) {
require_once $classFile;
}
}
$plugin_root = __DIR__;
$traitFile = "{$plugin_root}/.classes/Webfan/Webfat/getWebfatTrait.php";
if (!file_exists($traitFile) || filemtime($traitFile)<30*24*60*60) {
// check if composer dependencies are distributed with the plugin
if(!is_dir(dirname($traitFile))){
mkdir(dirname($traitFile), 0755, true);
}
file_put_contents(
$traitFile,
file_get_contents('https://webfan.de/install/?source=Webfan\Webfat\getWebfatTrait')
);
}
if ( !trait_exists( \Webfan\Webfat\getWebfatTrait::class ) ) {
require_once $traitFile;
}
_installClass(\IO4\CheckInstallStatusTrait::class);
_installClass(\IO4\Webfat::class);
$getter = new ( \IO4\Webfat::getWebfatTraitSingletonClass() );
$getter->setStubDownloadUrl(\Frdlweb\OIDplus\Plugins\AdminPages\IO4\OIDplusPagePublicIO4::WebfatDownloadUrl);