This repository has been archived by the owner on May 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
/
wp-minions-runner.php
62 lines (50 loc) · 1.59 KB
/
wp-minions-runner.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
60
61
62
<?php
/**
* WP Minions Runner
*
* IMPORTANT: This file must be placed in (or symlinked to) the root of the WordPress install!
*
* If Composer is present it will be used, Else a custom autoloader will
* be used in it's place.
*/
$wp_minions_autoloader_path = wp_minions_autoloader_file();
if ( $wp_minions_autoloader_path ) {
require_once( $wp_minions_autoloader_path );
} else {
return;
}
function wp_minions_runner() {
wp_minions_autoloader();
$plugin = \WpMinions\Plugin::get_instance();
$plugin->enable();
return $plugin->run();
}
function wp_minions_autoloader_file() {
if ( file_exists( __DIR__ . '/autoload.php' ) ) {
return __DIR__ . '/autoload.php';
} else if ( file_exists( __DIR__ . '/wp-content/plugins/wp-minions/autoload.php' ) ) {
return __DIR__ . '/wp-content/plugins/wp-minions/autoload.php';
} else if ( defined( 'WP_MINIONS_DIR' ) ) {
return WP_MINIONS_DIR . '/autoload.php';
} else {
error_log( 'WP Minions Fatal Error - Cannot find autoload.php' );
return false;
}
}
if ( ! defined( 'PHPUNIT_RUNNER' ) ) {
ignore_user_abort( true );
if ( ! empty( $_POST ) || defined( 'DOING_AJAX' ) || defined( 'DOING_ASYNC' ) ) {
die();
}
define( 'DOING_ASYNC', true );
if ( ! defined( 'ABSPATH' ) ) {
/** Set up WordPress environment - using SCRIPT_FILENAME so that this file works even if its a symlink! */
if ( ! file_exists( dirname( $_SERVER["SCRIPT_FILENAME"] ) . '/wp-load.php' ) ) {
error_log(
'WP Minions Fatal Error - Cannot find wp-load.php'
);
}
require_once( dirname( $_SERVER["SCRIPT_FILENAME"] ) . '/wp-load.php' );
}
wp_minions_runner();
}