This commit is contained in:
Javier Casares 2026-06-09 12:55:04 +00:00
commit 6269b77f13
11 changed files with 741 additions and 469 deletions

View file

@ -3,7 +3,7 @@
* Plugin Name: SMTP (by ROBOTSTXT) Amazon SES
* Plugin URI: https://git.robotstxt.es/ROBOTSTXT/robotstxt-smtp-amazonses
* Description: Adds Amazon SES configuration support to the ROBOTSTXT SMTP plugin.
* Version: 2.1.4
* Version: 2.1.5
* Requires at least: 5.7
* Requires PHP: 8.2
* Network: true
@ -26,7 +26,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
if ( ! defined( 'ROBOTSTXT_SMTP_AMAZONSES_VERSION' ) ) {
define( 'ROBOTSTXT_SMTP_AMAZONSES_VERSION', '2.1.4' );
define( 'ROBOTSTXT_SMTP_AMAZONSES_VERSION', '2.1.5' );
}
if ( ! defined( 'ROBOTSTXT_SMTP_AMAZONSES_FILE' ) ) {
@ -55,12 +55,52 @@ if ( \is_readable( $autoload ) ) {
require_once $autoload;
}
require_once ROBOTSTXT_SMTP_AMAZONSES_PATH . 'includes/class-plugin.php';
/**
* Loads the plugin text domain for translations.
*
* @since 2.1.5
*
* @return void
*/
function robotstxt_smtp_amazonses_load_textdomain(): void {
\load_plugin_textdomain(
'robotstxt-smtp-amazonses',
false,
dirname( ROBOTSTXT_SMTP_AMAZONSES_BASENAME ) . '/languages'
);
}
// Initialize the plugin.
// Dependency checking is handled by the "Requires Plugins" header in WordPress 6.5+.
\Robotstxt_SMTP_AmazonSES\Plugin::get_instance()->run();
\add_action( 'init', 'robotstxt_smtp_amazonses_load_textdomain' );
// Initialize ROBOTSTXT updater (auto-configures from plugin headers).
/**
* Displays an admin notice when the parent plugin is missing or inactive.
*
* @since 2.1.5
*
* @return void
*/
function robotstxt_smtp_amazonses_missing_parent_notice(): void {
printf(
'<div class="notice notice-error is-dismissible"><p>%s</p></div>',
\esc_html__( 'SMTP (by ROBOTSTXT) Amazon SES requires the SMTP (by ROBOTSTXT) plugin to be installed and active.', 'robotstxt-smtp-amazonses' )
);
}
// Defer initialization to plugins_loaded so all plugins are available for the dependency check.
\add_action(
'plugins_loaded',
static function () {
if ( ! \class_exists( 'Robotstxt_SMTP\Plugin' ) ) {
\add_action( 'admin_notices', 'robotstxt_smtp_amazonses_missing_parent_notice' );
\add_action( 'network_admin_notices', 'robotstxt_smtp_amazonses_missing_parent_notice' );
return;
}
require_once ROBOTSTXT_SMTP_AMAZONSES_PATH . 'includes/class-plugin.php';
\Robotstxt_SMTP_AmazonSES\Plugin::get_instance()->run();
}
);
// Initialize ROBOTSTXT updater (does not depend on the parent plugin).
require_once __DIR__ . '/class-robotstxt-updater.php';
Robotstxt_Updater::init( __FILE__ );