This commit introduces a more reliable and consistent approach to setting up the development environment using backups: - Add setup-from-backup.sh script for environment setup from existing backups - Standardize script naming and organization - Move obsolete scripts to bin/obsolete directory - Update documentation with new workflow instructions - Create migration guide for transitioning to new workflow - Update Memory Bank with workflow improvements The new workflow provides: - More reliable environment setup - Faster setup process - Offline development capability - Consistent development environments across team members Breaking changes: - setup-dev.sh is replaced by setup-from-backup.sh - sync-and-setup.sh is replaced by separate scripts - verify-with-wpcli.sh is no longer used Migration path is documented in MIGRATION_GUIDE.md
37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
|
|
spl_autoload_register(function ($class) {
|
|
// project-specific namespace prefix
|
|
$prefix = 'EssentialBlocks\\';
|
|
|
|
// base directory for the namespace prefix
|
|
$base_dir = __DIR__ . '/includes/';
|
|
|
|
// does the class use the namespace prefix?
|
|
$len = strlen($prefix);
|
|
if (strncmp($prefix, $class, $len) !== 0) {
|
|
// no, move to the next registered autoloader
|
|
return;
|
|
}
|
|
|
|
/**
|
|
* This is for blocks autoloading.
|
|
*/
|
|
// $class_array = explode('\\', $class);
|
|
// if( ! empty( $class_array[1] ) && $class_array[1] === 'blocks' ) {
|
|
// $base_dir = __DIR__ . '/';
|
|
// }
|
|
|
|
// get the relative class name
|
|
$relative_class = substr($class, $len);
|
|
|
|
// replace the namespace prefix with the base directory, replace namespace
|
|
// separators with directory separators in the relative class name, append
|
|
// with .php
|
|
$file = $base_dir . str_replace('\\', DIRECTORY_SEPARATOR, $relative_class) . '.php';
|
|
|
|
// if the file exists, require it
|
|
if (file_exists($file)) {
|
|
require $file;
|
|
}
|
|
});
|