Fix autoload error of Capabilities

This commit is contained in:
weryques 2018-01-24 13:34:40 -02:00
parent 888f924e84
commit fe041b17da
1 changed files with 9 additions and 4 deletions

View File

@ -41,11 +41,16 @@ function tainacan_autoload($class_name){
}
elseif ($class_path[0] == 'Tainacan') {
$sliced = array_slice($class_path, 1, count($class_path) -2);
$lower = $sliced[0];
$sliced[0] = strtolower($lower);
$dir = CLASSES_DIR.implode(DIRECTORY_SEPARATOR, $sliced ) . '/';
$dir = str_replace('_', '-', $dir);
if($sliced) {
$lower = $sliced[0];
$sliced[0] = strtolower( $lower );
$dir = CLASSES_DIR . implode( DIRECTORY_SEPARATOR, $sliced ) . '/';
$dir = str_replace( '_', '-', $dir );
} else {
$dir = CLASSES_DIR;
}
if( in_array('Field_Types', $class_path) ){
$dir.= strtolower(str_replace('_', '-' , $class_name)).'/';