Skip to content

Commit

Permalink
NEW: User-defined AUTOLOAD function
Browse files Browse the repository at this point in the history
  • Loading branch information
bcosca committed Sep 29, 2014
1 parent 1fbb1e5 commit b114c8c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -1606,9 +1606,13 @@ function rel($url) {
**/
protected function autoload($class) {
$class=$this->fixslashes(ltrim($class,'\\'));
foreach ($this->split($this->hive['PLUGINS'].';'.
$this->hive['AUTOLOAD']) as $auto)
if (is_file($file=$auto.$class.'.php') ||
$func=NULL;
if (is_array($path=$this->hive['AUTOLOAD']) &&
isset($path[1]) && is_callable($path[1]))
list($path,$func)=$path;
foreach ($this->split($this->hive['PLUGINS'].';'.$path) as $auto)
if ($func && is_file($file=$func($auto.$class).'.php') ||
is_file($file=$auto.$class.'.php') ||
is_file($file=$auto.strtolower($class).'.php') ||
is_file($file=strtolower($auto.$class).'.php'))
return require($file);
Expand Down

0 comments on commit b114c8c

Please sign in to comment.