generated from alleyinteractive/create-wordpress-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin.php
59 lines (51 loc) · 1.65 KB
/
plugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* Plugin Name: WP New Relic Transactions
* Plugin URI: https://github.com/alleyinteractive/wp-new-relic-transactions
* Description: A companion plugin when using New Relic with WordPress, to improve the recorded transaction data.
* Version: 0.1.0
* Author: Matthew Boynes
* Author URI: https://github.com/alleyinteractive/wp-new-relic-transactions
* Requires at least: 5.9
* Tested up to: 6.1.1
*
* Text Domain: wp-new-relic-transactions
* Domain Path: /languages/
*
* @package wp-new-relic-transactions
*/
namespace Alley\WP_New_Relic_Transactions;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Root directory to this plugin.
*
* @var string
*/
define( 'WP_NEW_RELIC_TRANSACTIONS_DIR', __DIR__ );
// Load the plugin's main files.
require_once WP_NEW_RELIC_TRANSACTIONS_DIR . '/src/interface-with-new-relic.php';
require_once WP_NEW_RELIC_TRANSACTIONS_DIR . '/src/class-new-relic.php';
require_once WP_NEW_RELIC_TRANSACTIONS_DIR . '/src/class-wp-new-relic-transactions.php';
/**
* Instantiate the plugin.
*/
function main(): void {
/**
* Create the NR wrapper. Filter this to allow the dependency to be swapped.
*
* @param With_New_Relic $new_relic New Relic wrapper.
*/
$new_relic = apply_filters( 'wp_new_relic_transactions_wrapper', new New_Relic() );
// Create the core plugin object.
$plugin = new WP_New_Relic_Transactions( $new_relic );
/**
* Announce that the plugin has been initialized and share the instance.
*
* @param WP_New_Relic_Transactions $plugin Plugin class instance.
*/
do_action( 'wp_new_relic_transactions_init', $plugin );
$plugin->boot();
}
add_action( 'after_setup_theme', __NAMESPACE__ . '\main' );