robotstxt-smtp-amazonses/robotstxt-smtp-amazonses.php
2026-09-01 06:17:08 +00:00

101 lines
3 KiB
PHP

<?php
/**
* Plugin Name: SMTP Amazon SES (by ROBOTSTXT)
* Plugin URI: https://www.robotstxt.software/plugins/robotstxt-smtp-amazonses/
* Description: Adds Amazon SES configuration support to the ROBOTSTXT SMTP plugin.
* Update URI: https://www.robotstxt.software/plugins/robotstxt-smtp-amazonses/
* Version: 2.1.9
* Requires at least: 5.7
* Requires PHP: 8.2
* Network: true
* Security: robotstxt@robotstxt.es
* Author: ROBOTSTXT
* Author URI: https://www.robotstxt.software/
* Text Domain: robotstxt-smtp-amazonses
* Requires Plugins: robotstxt-smtp
* Domain Path: /languages
* License: GPL-3.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
*
* @package Robotstxt_SMTP_AmazonSES
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! defined( 'ROBOTSTXT_SMTP_AMAZONSES_VERSION' ) ) {
define( 'ROBOTSTXT_SMTP_AMAZONSES_VERSION', '2.1.9' );
}
if ( ! defined( 'ROBOTSTXT_SMTP_AMAZONSES_FILE' ) ) {
define( 'ROBOTSTXT_SMTP_AMAZONSES_FILE', __FILE__ );
}
if ( ! defined( 'ROBOTSTXT_SMTP_AMAZONSES_PATH' ) ) {
define( 'ROBOTSTXT_SMTP_AMAZONSES_PATH', plugin_dir_path( __FILE__ ) );
}
if ( ! defined( 'ROBOTSTXT_SMTP_AMAZONSES_URL' ) ) {
define( 'ROBOTSTXT_SMTP_AMAZONSES_URL', plugin_dir_url( __FILE__ ) );
}
if ( ! defined( 'ROBOTSTXT_SMTP_AMAZONSES_SLUG' ) ) {
define( 'ROBOTSTXT_SMTP_AMAZONSES_SLUG', 'robotstxt-smtp-amazonses' );
}
if ( ! defined( 'ROBOTSTXT_SMTP_AMAZONSES_BASENAME' ) ) {
define( 'ROBOTSTXT_SMTP_AMAZONSES_BASENAME', plugin_basename( ROBOTSTXT_SMTP_AMAZONSES_FILE ) );
}
$autoload = ROBOTSTXT_SMTP_AMAZONSES_PATH . 'vendor/autoload.php';
if ( \is_readable( $autoload ) ) {
require_once $autoload;
}
/**
* Loads the plugin text domain for translations.
*
* @since 2.1.6
*
* @return void
*/
function robotstxt_smtp_amazonses_load_textdomain(): void {
\load_plugin_textdomain(
'robotstxt-smtp-amazonses',
false,
dirname( ROBOTSTXT_SMTP_AMAZONSES_BASENAME ) . '/languages'
);
}
\add_action( 'init', 'robotstxt_smtp_amazonses_load_textdomain' );
/**
* Displays an admin notice when the parent plugin is missing or inactive.
*
* @since 2.1.6
*
* @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 Amazon SES (by ROBOTSTXT) 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();
}
);