upskill-event-manager/wordpress-dev/wordpress/wp-content/plugins/wp-mail-smtp/wp-mail-smtp.php
bengizmo d1509b3d60 feat(dev-env): implement backup-based development workflow
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
2025-03-26 11:26:18 -03:00

64 lines
1.4 KiB
PHP

<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Autoloader. We need it being separate and not using Composer autoloader because of the Gmail libs,
* which are huge and not needed for most users.
* Inspired by PSR-4 examples: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader-examples.md
*
* @since 1.0.0
*
* @param string $class The fully-qualified class name.
*/
spl_autoload_register( function ( $class ) {
list( $plugin_space ) = explode( '\\', $class );
if ( $plugin_space !== 'WPMailSMTP' ) {
return;
}
/*
* This folder can be both "wp-mail-smtp" and "wp-mail-smtp-pro".
*/
$plugin_dir = basename( __DIR__ );
// Default directory for all code is plugin's /src/.
$base_dir = plugin_dir_path( __DIR__ ) . '/' . $plugin_dir . '/src/';
// Get the relative class name.
$relative_class = substr( $class, strlen( $plugin_space ) + 1 );
// Prepare a path to a file.
$file = wp_normalize_path( $base_dir . $relative_class . '.php' );
// If the file exists, require it.
if ( is_readable( $file ) ) {
/** @noinspection PhpIncludeInspection */
require_once $file;
}
} );
/**
* Global function-holder. Works similar to a singleton's instance().
*
* @since 1.0.0
*
* @return WPMailSMTP\Core
*/
function wp_mail_smtp() {
/**
* @var \WPMailSMTP\Core
*/
static $core;
if ( ! isset( $core ) ) {
$core = new \WPMailSMTP\Core();
}
return $core;
}
wp_mail_smtp();