diff --git a/eo-blocks.php b/eo-blocks.php index 6cf1801..28f18b4 100644 --- a/eo-blocks.php +++ b/eo-blocks.php @@ -19,8 +19,8 @@ } define( 'EO_BLOCKS_BASEFILE', __FILE__ ); -define( 'EO_BLOCKS_URL', plugins_url( '/', __FILE__ ) ); -define( 'EO_BLOCKS_PATH', dirname( __FILE__ ) ); +define( 'EO_BLOCKS_URL', plugin_dir_url( __FILE__ ) ); +define( 'EO_BLOCKS_PATH', plugin_dir_path( __FILE__ ) ); define( 'EO_BLOCKS_VERSION', '1.0.0' ); /** @@ -33,7 +33,7 @@ use EoBlocks\Includes\Eoblocks_Helper; $eoblocks_menu = new Eoblocks_Menu(); -$eoblocks_settings = new Eoblocks_Settings(); +//$eoblocks_settings = new Eoblocks_Settings(); /** * Registers the block using the metadata loaded from the `block.json` file. diff --git a/includes/autoload.php b/includes/autoload.php index 1638f19..a48d241 100644 --- a/includes/autoload.php +++ b/includes/autoload.php @@ -26,11 +26,14 @@ $file_name = str_replace('_', '-', $class_name); $file_name = 'class-' . strtolower( $file_name ) . '.php'; $file_path = strtolower( substr($relative_class, 0, $last_slash_pos) ); + $file_path = str_replace('\\', '/', $file_path); + + // Replace the namespace prefix with the base directory, replace namespace // separators with directory separators in the relative class name, append // with .php - $file = EO_BLOCKS_PATH . '\\' . $file_path . '\\' . $file_name; + $file = EO_BLOCKS_PATH . $file_path . DIRECTORY_SEPARATOR . $file_name; // If the file exists, require it if (file_exists($file)) {