PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 4.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v4.1
6.2 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 All 153 releases
mainwp / mainwp.php

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

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