Skip to content

Commit

Permalink
Fix loading utility classes
Browse files Browse the repository at this point in the history
  • Loading branch information
stickz committed Jan 10, 2022
1 parent 795bd19 commit d12228d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions php/util.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@
require_once( $rootPath.'/conf/config.php' );

// Automatically include only the used utility classes
spl_autoload_register(function ($class) {
require_once 'utility/'. strtolower($class). '.php';
spl_autoload_register(function ($class)
{
// Remove namespaces from the classname string
// Important for compatibility with 3rd party plugins
if (preg_match('@\\\\([\w]+)$@', $class, $matches)) {
$class = $matches[1];
}

require_once 'utility/'. strtolower($class). '.php';
});

// Fixes quotations if php verison is less than 5.4
Expand Down

0 comments on commit d12228d

Please sign in to comment.