-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_plugin.php
More file actions
executable file
·35 lines (29 loc) · 1.31 KB
/
test_plugin.php
File metadata and controls
executable file
·35 lines (29 loc) · 1.31 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
<?php
/*
Plugin Name: Test Plugin
Plugin URI:
Description: A test example plugin
Author: R. W. Duerr
Version: 1.0.0
Author URI:
*/
$loader = require __DIR__.'/vendor/autoload.php';
use TestPlugin\TestPlugin_Class;
use TestPlugin\UtilityFunctions;
use TestPlugin\WPDataSource;
//disable external access
if (!defined('ABSPATH')) {
die('Invalid Usage. Use through the wordpress plugin API.');
}
//init the plugin variables (inside this namespace)
define('TestPlugin\\TestPlugin_DIR', dirname(__FILE__));
define('TestPlugin\\TestPlugin_URL', plugins_url('', __FILE__));
define('TestPlugin\\TestPlugin_SRC_DIR', TestPlugin\TestPlugin_DIR.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR.'TestPlugin');
$allFilesPresent = TestPlugin_Class::do_incomplete_plugin_check();
if (!$allFilesPresent) {
// Warn if the plugin install is incomplete - can happen if WP crashes (e.g. out of disk space) when upgrading the plugin
add_action('all_admin_notices', array('TestPlugin\\TestPlugin_Class', 'incomplete_install_warning'));
} else {
//pass in this file, as some hook require the SOURCE entry point file for this plugin to work
$test_plugin_class = new TestPlugin_Class(__FILE__);
}