-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathwp-module-data-plugin.php
More file actions
78 lines (69 loc) · 2.05 KB
/
wp-module-data-plugin.php
File metadata and controls
78 lines (69 loc) · 2.05 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
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* Data Module Plugin
*
* @package NewfoldLabs\WP\Module\Data
* @author Newfold Digital
* @copyright Copyright 2025 by Newfold Digital - All rights reserved.
* @license GPL-2.0-or-later
*
* @wordpress-plugin
* Plugin Name: Data Module Test Plugin
* Description: Minimal plugin to activate and test module functionality.
* Requires PHP: 7.4
* Author: Bluehost
* Author URI: https://bluehost.com
* Text Domain: wp-module-data
* Domain Path: /languages
* License: GPL 2.0 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/
namespace NewfoldLabs\WP\Module\Data;
use NewfoldLabs\WP\ModuleLoader\Container;
use NewfoldLabs\WP\ModuleLoader\Plugin;
use function NewfoldLabs\WP\ModuleLoader\container as setContainer;
use function NewfoldLabs\WP\Context\setContext;
require __DIR__ . '/vendor/autoload.php';
/**
* Because `bootstrap.php` is in the `files` autoloader, when (integration) tests are run it is immediately loaded and
* quickly returns because ABSPATH is not defined. Then later when WordPress is loaded for the tests, the autoloader
* does not run again, so the code in bootstrap.php is not run and the module is not loaded.
*/
if ( ! defined( 'NFD_DATA_MODULE_VERSION' ) ) {
require 'bootstrap.php';
foreach ( glob( __DIR__ . '/vendor/newfold-labs/*/bootstrap.php' ) as $bootstrap ) {
require $bootstrap;
}
}
/*
* Initialize module settings via container
*/
$nfd_module_container = new Container();
/**
* Context setup
*
* @see vendor/newfold-labs/wp-module-context/bootstrap.php
*/
add_action(
'newfold/context/set',
function () {
// set brand
setContext( 'brand.name', 'wp-module-data' );
}
);
// Set plugin to container
$nfd_module_container->set(
'plugin',
$nfd_module_container->service(
function () {
return new Plugin(
array(
'id' => 'bluehost',
'file' => __FILE__,
'brand' => get_option( 'mm_brand', 'bluehost' ),
)
);
}
)
);
setContainer( $nfd_module_container );