-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwp-child.php
executable file
·95 lines (79 loc) · 2.95 KB
/
mainwp-child.php
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
/**
* WPDash Child Plugin
*
* @package MainWP\Child
*/
/**
* Plugin Name: WPDash Child
* Description: Integração segura com o WP Dash - A plataforma de gestão de sites WordPress da Apiki
* Plugin URI: https://wpdash.apiki.com/
* Author: Apiki
* Author URI: https://apiki.com
* Text Domain: mainwp-child
* Version: 6.3.1
* Requires at least: 5.4
* Requires PHP: 7.4
*/
require_once ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'version.php'; // NOSONAR - WP compatible. Version information from WordPress.
/**
* Define MainWP Child Plugin Debug Mode.
*
* @const ( bool ) Whether or not MainWP Child is in debug mode. Default: false.
* @source https://code-reference.mainwp.com/classes/MainWP.Child.MainWP_Child.html
*/
if ( ! defined( 'MAINWP_CHILD_DEBUG' ) ) {
define( 'MAINWP_CHILD_DEBUG', false );
}
if ( ! defined( 'MAINWP_CHILD_FILE' ) ) {
/**
* Define MainWP Child Plugin absolute full path and filename of this file.
*
* @const ( string ) Defined MainWP Child file path.
* @source https://github.com/mainwp/mainwp-child/blob/master/mainwp-child.php
*/
define( 'MAINWP_CHILD_FILE', __FILE__ );
}
if ( ! defined( 'MAINWP_CHILD_PLUGIN_DIR' ) ) {
/**
* Define MainWP Child Plugin Directory.
*
* @const ( string ) Defined MainWP Child Plugin Directory.
* @source https://github.com/mainwp/mainwp-child/blob/master/mainwp-child.php
*/
define( 'MAINWP_CHILD_PLUGIN_DIR', plugin_dir_path( MAINWP_CHILD_FILE ) );
}
if ( ! defined( 'MAINWP_CHILD_URL' ) ) {
/**
* Define MainWP Child Plugin URL.
*
* @const ( string ) Defined MainWP Child Plugin URL.
* @source https://github.com/mainwp/mainwp-child/blob/master/mainwp-child.php
*/
define( 'MAINWP_CHILD_URL', plugin_dir_url( MAINWP_CHILD_FILE ) );
}
/**
* MainWP Child Plugin Autoloader to load all other class files.
*
* @param string $class_name Name of the class to load.
*
* @uses \MainWP\Child\MainWP_Child()
*/
function mainwp_child_autoload( $class_name ) {
if ( 0 === strpos( $class_name, 'MainWP\Child' ) ) {
// strip the namespace prefix: MainWP\Child\ .
$class_name = substr( $class_name, 13 );
}
$autoload_dir = \trailingslashit( __DIR__ . '/class' );
$autoload_path = sprintf( '%sclass-%s.php', $autoload_dir, strtolower( str_replace( '_', '-', $class_name ) ) );
if ( file_exists( $autoload_path ) ) {
require_once $autoload_path; // NOSONAR - WP compatible.
}
}
if ( function_exists( 'spl_autoload_register' ) ) {
spl_autoload_register( 'mainwp_child_autoload' );
}
require_once MAINWP_CHILD_PLUGIN_DIR . 'includes' . DIRECTORY_SEPARATOR . 'functions.php'; // NOSONAR - WP compatible.
$mainWPChild = new MainWP\Child\MainWP_Child( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . plugin_basename( __FILE__ ) );
register_activation_hook( __FILE__, array( $mainWPChild, 'activation' ) );
register_deactivation_hook( __FILE__, array( $mainWPChild, 'deactivation' ) );