From b497faee27a89ff1a2da07d02dd6f6676183cc98 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sat, 14 May 2016 17:18:51 -0700 Subject: Allow plugins to define autoloaded classes - a class such as Foobar\Class will load addon/foobar/Class.php and also Foobar\Category\Class.php will load addon/foobar/Category/Class.php --- boot.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 9dbd4ead4..d5bde53ac 100755 --- a/boot.php +++ b/boot.php @@ -632,6 +632,17 @@ class ZotlabsAutoloader { return TRUE; } } + $arr = explode('\\',$className); + if($arr && count($arr) > 1) { + $filename = 'addon/' . lcfirst($arr[0]) . '/' . ucfirst($arr[1]) . ((count($arr) === 2) ? '.php' : '/' . ucfirst($arr[2]) . ".php"); + if (file_exists($filename)) { + include($filename); + if (class_exists($className)) { + return TRUE; + } + } + } + return FALSE; } } -- cgit v1.2.3