-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.php
More file actions
66 lines (56 loc) · 1.81 KB
/
plugin.php
File metadata and controls
66 lines (56 loc) · 1.81 KB
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
60
61
62
63
64
65
66
<?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.2.1
* Author: Matthew Boynes
* Author URI: https://github.com/alleyinteractive/wp-new-relic-transactions
* Requires at least: 5.9
* Tested up to: 6.8
*
* @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() );
if ( ! $new_relic instanceof With_New_Relic ) {
_doing_it_wrong(
__NAMESPACE__ . '\main',
esc_html__( 'The New Relic wrapper must implement the With_New_Relic interface.', 'wp-new-relic-transactions' ),
'0.2.0',
);
return;
}
// 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' );