<?php
spl_autoload_register(
	function( $class_name ) {
		$path           = __DIR__  . DIRECTORY_SEPARATOR;
		$class_name     = str_replace( '\\', DIRECTORY_SEPARATOR, $class_name );
		$class          = basename( $class_name );
		$dir            = strtolower( dirname( $class_name ) );
		$filename       = realpath( $path . $dir . '/' . $class . '.php' );
		$filename_class = $path . ( strtolower(  '/class-' . str_replace( '_', '-', $class ) . '.php' ) ) . '';
		if ( ! empty( $filename_class ) && file_exists( $filename_class ) ) {
			require_once $filename_class;
			return;
		}
		if ( ! empty( $filename ) && file_exists( $filename ) ) {
			require_once $filename;
			return;
		}
	}
);


