forked from mainwp/mainwp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwp.php
More file actions
79 lines (63 loc) · 2.88 KB
/
mainwp.php
File metadata and controls
79 lines (63 loc) · 2.88 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
79
<?php
/*
Plugin Name: MainWP Dashboard
Plugin URI: https://mainwp.com/
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.
Author: MainWP
Author URI: https://mainwp.com
Text Domain: mainwp
Version: 3.5.4
*/
if ( ! defined( 'MAINWP_PLUGIN_FILE' ) ) {
define( 'MAINWP_PLUGIN_FILE', __FILE__ );
}
if ( ! defined( 'MAINWP_PLUGIN_DIR' ) ) {
define( 'MAINWP_PLUGIN_DIR', plugin_dir_path( MAINWP_PLUGIN_FILE ) );
}
if ( ! defined( 'MAINWP_PLUGIN_URL' ) ) {
define( 'MAINWP_PLUGIN_URL', plugin_dir_url( MAINWP_PLUGIN_FILE ) );
}
include_once( ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'version.php' ); //Version information from wordpress
if ( ! function_exists( 'mainwp_autoload' ) ) {
function mainwp_autoload( $class_name ) {
$autoload_types = array( 'class', 'page', 'view', 'widget', 'table' );
foreach ( $autoload_types as $type ) {
$autoload_dir = \trailingslashit( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . $type );
$autoload_path = sprintf( '%s%s-%s.php', $autoload_dir, $type, strtolower( str_replace( '_', '-', $class_name ) ) );
if ( file_exists( $autoload_path ) ) {
require_once( $autoload_path );
}
}
}
}
spl_autoload_register( 'mainwp_autoload' );
if ( ! function_exists( 'mainwpdir' ) ) {
function mainwpdir() {
return WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . dirname( plugin_basename( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'libs' . DIRECTORY_SEPARATOR;
}
}
if ( file_exists( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . plugin_basename( __DIR__ ).DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class-mainwp-creport.php' ) ) {
include_once WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . plugin_basename( __DIR__ ).DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class-mainwp-creport.php';
}
if ( ! function_exists( 'mainwp_do_not_have_permissions' ) ) {
function mainwp_do_not_have_permissions( $where = '', $echo = true ) {
$msg = sprintf( __( 'You do not have sufficient permissions to access this page (%s).', 'mainwp' ), ucwords( $where ) );
if ( $echo ) {
echo '<div class="mainwp-permission-error"><p>' . esc_html( $msg ) . '</p>If you need access to this page please contact the dashboard administrator.</div>';
} else {
return $msg;
}
return false;
}
}
$mainwp_is_secupress_scanning = false;
if (!empty($_GET) && isset($_GET['test']) && isset($_GET['action']) && $_GET['action'] == 'secupress_scanner') {
$mainwp_is_secupress_scanning = true;
}
//to fix conflict with SecuPress plugin
if ( !$mainwp_is_secupress_scanning ) {
$mainWP = new MainWP_System( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . plugin_basename( __FILE__ ) );
register_activation_hook( __FILE__, array( $mainWP, 'activation' ) );
register_deactivation_hook( __FILE__, array( $mainWP, 'deactivation' ) );
add_action( 'plugins_loaded', array( $mainWP, 'update' ) );
}