106 lines
3.2 KiB
PHP
106 lines
3.2 KiB
PHP
<?php
|
|
/**
|
|
* 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.5
|
|
* Requires at least: 5.7
|
|
* Requires PHP: 8.2
|
|
* Network: true
|
|
* Security: robotstxt@robotstxt.es
|
|
* Author: ROBOTSTXT
|
|
* Author URI: https://www.robotstxt.es/
|
|
* 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
|
|
* Gitea Plugin URI: https://git.robotstxt.es/ROBOTSTXT/robotstxt-smtp-amazonses
|
|
* Primary Branch: main
|
|
*
|
|
* @package Robotstxt_SMTP_AmazonSES
|
|
*/
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
if ( ! defined( 'ROBOTSTXT_SMTP_AMAZONSES_VERSION' ) ) {
|
|
define( 'ROBOTSTXT_SMTP_AMAZONSES_VERSION', '2.1.5' );
|
|
}
|
|
|
|
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.5
|
|
*
|
|
* @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.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__ );
|