| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: MainWP Dashboard |
| 4 |
* |
| 5 |
* Description: Manage all of your WP sites, even those on different servers, from one central dashboard that runs off of your own self-hosted WordPress install. |
| 6 |
* |
| 7 |
* Author: MainWP |
| 8 |
* Author URI: https://mainwp.com |
| 9 |
* Plugin URI: https://mainwp.com/ |
| 10 |
* Text Domain: mainwp |
| 11 |
* Version: 4.4.3.2 |
| 12 |
* |
| 13 |
* @package MainWP/Dashboard |
| 14 |
* |
| 15 |
* @uses \MainWP\Dashboard\MainWP_System |
| 16 |
*/ |
| 17 |
|
| 18 |
if ( ! defined( 'MAINWP_PLUGIN_FILE' ) ) { |
| 19 |
|
| 20 |
/** |
| 21 |
* Define MainWP Dashboard Plugin absolute full path and filename of this file. |
| 22 |
* |
| 23 |
* @const ( string ) Defined MainWP dashboard file path. |
| 24 |
* @source https://github.com/mainwp/mainwp/blob/master/mainwp.php |
| 25 |
*/ |
| 26 |
define( 'MAINWP_PLUGIN_FILE', __FILE__ ); |
| 27 |
} |
| 28 |
|
| 29 |
if ( ! defined( 'MAINWP_PLUGIN_DIR' ) ) { |
| 30 |
/** |
| 31 |
* Define MainWP Dashboard Plugin Directory. |
| 32 |
* |
| 33 |
* @const ( string ) Defined MainWP Dashboard Plugin Directory. |
| 34 |
* @source https://github.com/mainwp/mainwp/blob/master/mainwp.php |
| 35 |
*/ |
| 36 |
define( 'MAINWP_PLUGIN_DIR', plugin_dir_path( MAINWP_PLUGIN_FILE ) ); |
| 37 |
} |
| 38 |
|
| 39 |
if ( ! defined( 'MAINWP_PLUGIN_URL' ) ) { |
| 40 |
/** |
| 41 |
* Define MainWP Child Dashboard URL. |
| 42 |
* |
| 43 |
* @const ( string ) Defined MainWP Dashboard Plugin URL. |
| 44 |
* @source https://github.com/mainwp/mainwp/blob/master/mainwp.php |
| 45 |
*/ |
| 46 |
define( 'MAINWP_PLUGIN_URL', plugin_dir_url( MAINWP_PLUGIN_FILE ) ); |
| 47 |
} |
| 48 |
|
| 49 |
// Version information from WordPress. |
| 50 |
require_once ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'version.php'; |
| 51 |
|
| 52 |
if ( ! function_exists( 'mainwp_autoload' ) ) { |
| 53 |
|
| 54 |
/** |
| 55 |
* Autoloader for all classes, pages & widgets |
| 56 |
* |
| 57 |
* @param string $class_name Folder name class|pages|widgets. |
| 58 |
* @return require_once $autoload_path; |
| 59 |
*/ |
| 60 |
function mainwp_autoload( $class_name ) { |
| 61 |
|
| 62 |
if ( 0 === strpos( $class_name, 'MainWP\Dashboard' ) ) { |
| 63 |
// trip the namespace prefix: MainWP\Dashboard\ . |
| 64 |
$class_name = substr( $class_name, 17 ); |
| 65 |
} |
| 66 |
|
| 67 |
if ( 0 !== strpos( $class_name, 'MainWP_' ) ) { |
| 68 |
return; |
| 69 |
} |
| 70 |
|
| 71 |
$autoload_types = array( |
| 72 |
'class' => 'class', |
| 73 |
'pages' => 'page', |
| 74 |
'widgets' => 'widget', |
| 75 |
); |
| 76 |
|
| 77 |
foreach ( $autoload_types as $type => $prefix ) { |
| 78 |
$autoload_dir = \trailingslashit( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . $type ); |
| 79 |
$autoload_path = sprintf( '%s%s-%s.php', $autoload_dir, $prefix, strtolower( str_replace( '_', '-', $class_name ) ) ); |
| 80 |
|
| 81 |
if ( file_exists( $autoload_path ) ) { |
| 82 |
require_once $autoload_path; |
| 83 |
break; |
| 84 |
} |
| 85 |
} |
| 86 |
} |
| 87 |
} |
| 88 |
|
| 89 |
spl_autoload_register( 'mainwp_autoload' ); |
| 90 |
|
| 91 |
require_once MAINWP_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'functions.php'; |
| 92 |
require_once MAINWP_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'compatible.php'; |
| 93 |
|
| 94 |
// Detect if secupress_scanner is running. |
| 95 |
$mainwp_is_secupress_scanning = false; |
| 96 |
if ( ! empty( $_GET ) && isset( $_GET['test'] ) && isset( $_GET['action'] ) && 'secupress_scanner' === $_GET['action'] ) { |
| 97 |
$mainwp_is_secupress_scanning = true; |
| 98 |
} |
| 99 |
|
| 100 |
// Fix a conflict with SecuPress plugin. |
| 101 |
if ( ! $mainwp_is_secupress_scanning ) { |
| 102 |
$mainWP = new MainWP\Dashboard\MainWP_System( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . plugin_basename( __FILE__ ) ); |
| 103 |
register_activation_hook( __FILE__, array( $mainWP, 'activation' ) ); |
| 104 |
register_deactivation_hook( __FILE__, array( $mainWP, 'deactivation' ) ); |
| 105 |
add_action( 'plugins_loaded', array( $mainWP, 'update_install' ) ); |
| 106 |
} |
| 107 |
|