This repository was archived by the owner on Feb 15, 2020. It is now read-only.
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
72 lines (59 loc) · 2.41 KB
/
mainwp.php
File metadata and controls
72 lines (59 loc) · 2.41 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
<?php
/*
Plugin Name: MainWP Dashboard
Plugin URI: http://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: http://mainwp.com
Text Domain: mainwp
Version: 3.0.1
*/
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 );
}
}
}
}
if ( function_exists( 'spl_autoload_register' ) ) {
spl_autoload_register( 'mainwp_autoload' );
} else {
function __autoload( $class_name ) {
mainwp_autoload( $class_name );
}
}
if ( ! function_exists( 'mainwpdir' ) ) {
function mainwpdir() {
return WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . dirname( plugin_basename( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'libs' . DIRECTORY_SEPARATOR;
}
}
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 = 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' ) );