PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 4.0.3
MainWP Dashboard: Self-hosted WordPress Management for Agencies v4.0.3
6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 5.2.2 5.3 5.3.1 All 152 releases
mainwp / mainwp.php

mainwp.php in MainWP Dashboard: Self-hosted WordPress Management for Agencies 4.0.3, at mainwp.php

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