Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
91.67% covered (success)
91.67%
11 / 12
100.00% covered (success)
100.00%
1 / 1
CRAP
n/a
0 / 0
BH_WP_Autologin_URLs\instantiate_bh_wp_autologin_urls
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3 * The plugin bootstrap file
4 *
5 * @link              https://BrianHenry.ie
6 * @since             1.0.0
7 * @package           brianhenryie/bh-wp-autologin-urls
8 *
9 * @wordpress-plugin
10 * Plugin Name:       Magic Emails & Autologin URLs
11 * Plugin URI:        https://wordpress.org/BrianHenryIE/bh-wp-autologin-urls
12 * Description:       Log in users via emails sent from WordPress.
13 * Version:           2.4.2
14 * Tested up to:      6.4
15 * Requires PHP:      7.4
16 * Author:            BrianHenryIE
17 * Author URI:        https://BrianHenry.ie
18 * License:           GPL-2.0+
19 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
20 * Text Domain:       bh-wp-autologin-urls
21 * Domain Path:       /languages
22 *
23 * GitHub Plugin URI: https://github.com/BrianHenryIE/bh-wp-autologin-urls
24 * Release Asset:     true
25 */
26
27namespace BH_WP_Autologin_URLs;
28
29use BrianHenryIE\WP_Autologin_URLs\API\API;
30use BrianHenryIE\WP_Autologin_URLs\API\Data_Stores\DB_Data_Store;
31use BrianHenryIE\WP_Autologin_URLs\BH_WP_Autologin_URLs;
32use BrianHenryIE\WP_Autologin_URLs\API\Settings;
33use BrianHenryIE\WP_Autologin_URLs\WP_Logger\Logger;
34use Exception;
35
36// If this file is called directly, abort.
37if ( ! defined( 'ABSPATH' ) ) {
38    throw new Exception();
39}
40
41require_once plugin_dir_path( __FILE__ ) . 'autoload.php';
42
43/**
44 * Currently plugin version.
45 */
46define( 'BH_WP_AUTOLOGIN_URLS_VERSION', '2.4.2' );
47define( 'BH_WP_AUTOLOGIN_URLS_BASENAME', plugin_basename( __FILE__ ) );
48
49/**
50 * Function to keep the loader and settings objects out of the namespace.
51 *
52 * @return API
53 */
54function instantiate_bh_wp_autologin_urls(): API {
55
56    $settings  = new Settings();
57    $logger    = Logger::instance( $settings );
58    $datastore = new DB_Data_Store( $logger );
59    $api       = new API( $settings, $logger, $datastore );
60
61    new BH_WP_Autologin_URLs( $api, $settings, $logger );
62
63    return $api;
64}
65
66/**
67 * Begins execution of the plugin.
68 *
69 * Since everything within the plugin is registered via hooks,
70 * then kicking off the plugin from this point in the file does
71 * not affect the page life cycle.
72 *
73 * @since    1.0.0
74 */
75$GLOBALS['bh-wp-autologin-urls'] = instantiate_bh_wp_autologin_urls();