Skip to content

Commit

Permalink
#19 [Bug] fix: autoload.php
Browse files Browse the repository at this point in the history
  • Loading branch information
eoxia-amandine committed Oct 30, 2024
1 parent 32a7b71 commit 410f028
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions eo-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' );

/**
Expand All @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion includes/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 410f028

Please sign in to comment.