| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: MainWP Dashboard |
| 4 |
Plugin URI: https://mainwp.com/ |
| 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 |
Author: MainWP |
| 7 |
Author URI: https://mainwp.com |
| 8 |
Text Domain: mainwp |
| 9 |
Version: 3.5.7.1 |
| 10 |
*/ |
| 11 |
|
| 12 |
if ( ! defined( 'MAINWP_PLUGIN_FILE' ) ) { |
| 13 |
define( 'MAINWP_PLUGIN_FILE', __FILE__ ); |
| 14 |
} |
| 15 |
|
| 16 |
if ( ! defined( 'MAINWP_PLUGIN_DIR' ) ) { |
| 17 |
define( 'MAINWP_PLUGIN_DIR', plugin_dir_path( MAINWP_PLUGIN_FILE ) ); |
| 18 |
} |
| 19 |
|
| 20 |
if ( ! defined( 'MAINWP_PLUGIN_URL' ) ) { |
| 21 |
define( 'MAINWP_PLUGIN_URL', plugin_dir_url( MAINWP_PLUGIN_FILE ) ); |
| 22 |
} |
| 23 |
|
| 24 |
include_once( ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'version.php' ); //Version information from wordpress |
| 25 |
|
| 26 |
if ( ! function_exists( 'mainwp_autoload' ) ) { |
| 27 |
function mainwp_autoload( $class_name ) { |
| 28 |
$autoload_types = array( 'class', 'page', 'view', 'widget', 'table' ); |
| 29 |
|
| 30 |
foreach ( $autoload_types as $type ) { |
| 31 |
$autoload_dir = \trailingslashit( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . $type ); |
| 32 |
|
| 33 |
$autoload_path = sprintf( '%s%s-%s.php', $autoload_dir, $type, strtolower( str_replace( '_', '-', $class_name ) ) ); |
| 34 |
|
| 35 |
if ( file_exists( $autoload_path ) ) { |
| 36 |
require_once( $autoload_path ); |
| 37 |
} |
| 38 |
} |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
|
| 43 |
spl_autoload_register( 'mainwp_autoload' ); |
| 44 |
|
| 45 |
if ( ! function_exists( 'mainwpdir' ) ) { |
| 46 |
function mainwpdir() { |
| 47 |
return WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . dirname( plugin_basename( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'libs' . DIRECTORY_SEPARATOR; |
| 48 |
} |
| 49 |
} |
| 50 |
|
| 51 |
if ( file_exists( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . plugin_basename( __DIR__ ).DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class-mainwp-creport.php' ) ) { |
| 52 |
include_once WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . plugin_basename( __DIR__ ).DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class-mainwp-creport.php'; |
| 53 |
} |
| 54 |
|
| 55 |
if ( ! function_exists( 'mainwp_do_not_have_permissions' ) ) { |
| 56 |
function mainwp_do_not_have_permissions( $where = '', $echo = true ) { |
| 57 |
$msg = sprintf( __( 'You do not have sufficient permissions to access this page (%s).', 'mainwp' ), ucwords( $where ) ); |
| 58 |
if ( $echo ) { |
| 59 |
echo '<div class="mainwp-permission-error"><p>' . esc_html( $msg ) . '</p>If you need access to this page please contact the dashboard administrator.</div>'; |
| 60 |
} else { |
| 61 |
return $msg; |
| 62 |
} |
| 63 |
|
| 64 |
return false; |
| 65 |
} |
| 66 |
} |
| 67 |
|
| 68 |
$mainwp_is_secupress_scanning = false; |
| 69 |
if (!empty($_GET) && isset($_GET['test']) && isset($_GET['action']) && $_GET['action'] == 'secupress_scanner') { |
| 70 |
$mainwp_is_secupress_scanning = true; |
| 71 |
} |
| 72 |
|
| 73 |
//to fix conflict with SecuPress plugin |
| 74 |
if ( !$mainwp_is_secupress_scanning ) { |
| 75 |
$mainWP = new MainWP_System( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . plugin_basename( __FILE__ ) ); |
| 76 |
register_activation_hook( __FILE__, array( $mainWP, 'activation' ) ); |
| 77 |
register_deactivation_hook( __FILE__, array( $mainWP, 'deactivation' ) ); |
| 78 |
add_action( 'plugins_loaded', array( $mainWP, 'update' ) ); |
| 79 |
} |
| 80 |
|