* and is available here: http://www.php-fig.org/psr/psr-0/
*/
spl_autoload_register(function($class){
- $file = INSTALLDIR.'/extlib/'.preg_replace('{\\\\|_(?!.*\\\\)}', DIRECTORY_SEPARATOR, ltrim($class, '\\')).'.php';
+ $class_path = preg_replace('{\\\\|_(?!.*\\\\)}', DIRECTORY_SEPARATOR, ltrim($class, '\\')).'.php';
+ $file = INSTALLDIR.'/extlib/'.$class_path;
if (file_exists($file)) {
require_once $file;
+ return;
+ }
+
+ # Try if the system has this external library
+ $file = '/usr/share/php/'.$class_path;
+ if (file_exists($file)) {
+ require_once $file;
+ return;
}
});