Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
92.31% covered (success)
92.31%
12 / 13
100.00% covered (success)
100.00%
1 / 1
CRAP
n/a
0 / 0
BrianHenryIE\AWS_SES_Bounce_Handler\instantiate_bh_wp_aws_ses_bounce_handler
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3 * A WordPress plugin to unsubscribe users from email lists when AWS SES sends a bounce or complaint report.
4 *
5 * @link              https://BrianHenry.ie
6 * @since             1.0.0
7 * @package brianhenryie/bh-wp-aws-ses-bounce-handler
8 *
9 * @wordpress-plugin
10 * Plugin Name:       AWS SES Bounce Handler
11 * Plugin URI:        https://github.com/BrianHenryIE/bh-wp-aws-ses-bounce-handler
12 * Description:       When AWS SES sends a bounce or complaint report, users & orders are marked; Newsletter users are unsubscribed.
13 * Version:           1.7.0
14 * Requires PHP:      7.4
15 * Author:            BrianHenryIE
16 * Author URI:        https://BrianHenry.ie
17 * License:           GPL-2.0+
18 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
19 * Text Domain:       bh-wp-aws-ses-bounce-handler
20 * Domain Path:       /languages
21 *
22 * GitHub Plugin URI: https://github.com/BrianHenryIE/bh-wp-aws-ses-bounce-handler
23 * Release Asset:     true
24 */
25
26namespace BrianHenryIE\AWS_SES_Bounce_Handler;
27
28use BrianHenryIE\AWS_SES_Bounce_Handler\API\API;
29use BrianHenryIE\AWS_SES_Bounce_Handler\WP_Includes\Activator;
30use BrianHenryIE\AWS_SES_Bounce_Handler\WP_Includes\Deactivator;
31use BrianHenryIE\AWS_SES_Bounce_Handler\API\Settings;
32use BrianHenryIE\AWS_SES_Bounce_Handler\WP_Logger\Logger;
33
34// If this file is called directly, abort.
35if ( ! defined( 'WPINC' ) ) {
36    throw new \Exception( 'WPINC not defined' );
37}
38
39require_once plugin_dir_path( __FILE__ ) . 'autoload.php';
40
41
42register_activation_hook( __FILE__, array( Activator::class, 'activate' ) );
43register_deactivation_hook( __FILE__, array( Deactivator::class, 'deactivate' ) );
44
45/**
46 * Currently plugin version.
47 */
48define( 'BH_WP_AWS_SES_BOUNCE_HANDLER_VERSION', '1.7.0' );
49define( 'BH_WP_AWS_SES_BOUNCE_HANDLER_BASENAME', plugin_basename( __FILE__ ) );
50
51/**
52 * Function to keep the loader and settings objects out of the namespace.
53 *
54 * @return BH_WP_AWS_SES_Bounce_Handler;
55 */
56function instantiate_bh_wp_aws_ses_bounce_handler() {
57
58    $settings = new Settings();
59    $logger   = Logger::instance( $settings );
60    $api      = new API( $settings, $logger );
61
62    $bh_wp_aws_ses_bounce_handler = new BH_WP_AWS_SES_Bounce_Handler( $api, $settings, $logger );
63
64    return $bh_wp_aws_ses_bounce_handler;
65}
66
67/**
68 * Begins execution of the plugin.
69 *
70 * Since everything within the plugin is registered via hooks,
71 * then kicking off the plugin from this point in the file does
72 * not affect the page life cycle.
73 *
74 * @since    1.0.0
75 */
76$GLOBALS['bh_wp_aws_ses_bounce_handler'] = instantiate_bh_wp_aws_ses_bounce_handler();
77