Created
January 8, 2015 12:52
-
-
Save mapkyca/f00a0f3ac9879b77d8c7 to your computer and use it in GitHub Desktop.
Plugin autoloader for Known plugin repos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Support loading of direct checkout. | |
*/ | |
spl_autoload_register(function($class) { | |
$class = str_replace('\\', DIRECTORY_SEPARATOR, $class); | |
$segments = explode(DIRECTORY_SEPARATOR, $class); | |
$PLUGIN_NAME = $segments[1]; | |
$basedir = dirname(dirname(dirname(__FILE__))) . '/'; | |
$file = str_replace($PLUGIN_NAME, basename(dirname(__FILE__)) . "/$PLUGIN_NAME", $class); | |
\Idno\Core\site()->plugins()->plugins[basename(dirname(__FILE__))] = \Idno\Core\site()->plugins()->plugins[$PLUGIN_NAME]; | |
unset(\Idno\Core\site()->plugins()->plugins[$PLUGIN_NAME]); | |
if (file_exists($basedir . $file . '.php')) { | |
include_once($basedir . $file . '.php'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment