-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautoloader.php
More file actions
73 lines (62 loc) · 2.13 KB
/
autoloader.php
File metadata and controls
73 lines (62 loc) · 2.13 KB
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
<?php
/*
* This file is part of WBF Framework: https://github.com/wagaweb/wbf
*
* @author WAGA Team <dev@waga.it>
*/
namespace WBF\components\pluginsframework;
require_once dirname(dirname(dirname(dirname(__FILE__))))."/vendor/autoload.php";
/*
* The following autoloader is now deprecated
*/
//spl_autoload_register( 'WBF\includes\pluginsframework\plugin_autoload' );
function plugin_autoload( $class ) {
$wbf_path = defined("WBF_DIRECTORY") ? WBF_DIRECTORY : get_option( "wbf_path" );
if(!is_file($wbf_path."/vendor/autoload.php")){
$wbf_path = WP_CONTENT_DIR."/plugins/wbf";
}
if(!is_file($wbf_path."/vendor/autoload.php")){
throw new \Exception("Plugins framework: WBF Not Found");
}
require_once $wbf_path."/vendor/autoload.php";
if ( $wbf_path ) {
$plugin_main_class_dir = $wbf_path . "/includes/pluginsframework/";
if ( preg_match( "/pluginsframework/", $class ) ) {
$childclass = explode('\\', $class);
$name = end($childclass);
require_once( $plugin_main_class_dir.$name.'.php');
}
switch($class){
case "WBF\admin\Notice_Manager":
require_once($wbf_path . "/admin/notice-manager.php");
break;
case "WBF\includes\pluginsframework\License_Interface":
require_once($wbf_path . "/includes/license-interface.php");
break;
case "WBF\includes\License_Interface":
require_once($wbf_path . "/includes/license-interface.php");
break;
case "WBF\admin\License_Manager":
require_once($wbf_path . "/admin/license-manager.php");
break;
case "WBF\includes\License":
require_once($wbf_path . "/includes/class-license.php");
break;
case "WBF\includes\License_Exception":
require_once($wbf_path . "/includes/class-license-exception.php");
break;
case "WBF\includes\Plugin_Update_Checker":
require_once($wbf_path . "/includes/plugin-update-checker.php");
break;
case "PluginUpdateChecker":
case "PluginUpdate":
case "PluginInfo":
case "PluginUpdateChecker_1_6":
case "PluginInfo_1_6":
case "PluginUpdate_1_6":
case "PucFactory":
require_once($wbf_path . "/vendor/yahnis-elsts/plugin-update-checker/plugin-update-checker.php");
break;
}
}
}