-
Notifications
You must be signed in to change notification settings - Fork 0
/
tgmpa-engine.php
85 lines (65 loc) · 2.42 KB
/
tgmpa-engine.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
<?php
namespace OxibugTGMPA;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
*
* @author Oxibug
* @version 1.0.0
*/
class TGMPA_Engine {
/**
* An instance of the class
*
* @var TGMPA_Engine
* @since 1.0.0
*
*/
private static $_instance = null;
/**
* Instantiate Class
*
* @return TGMPA_Engine
*
* @since 1.0.0
*
*/
public static function instance() {
if( is_null( self::$_instance ) ) {
self::$_instance = new self;
}
return self::$_instance;
}
/**
* Helper function to register a collection of required plugins.
*
* @since 2.0.0
* @api
*
* @param array $plugins An array of plugin arrays.
* @param array $config Optional. An array of configuration values.
*/
public function tgmpa( $plugins, $config = array() ) {
$instance = call_user_func( array( get_class( $GLOBALS[ TGMPA_Includes::TGMPA_MAIN_PREFIX ] ), 'get_instance' ) );
foreach ( $plugins as $plugin ) {
call_user_func( array( $instance, 'register' ), $plugin );
}
if ( ! empty( $config ) && is_array( $config ) ) {
// Send out notices for deprecated arguments passed.
if ( isset( $config['notices'] ) ) {
_deprecated_argument( __FUNCTION__, '2.2.0', 'The `notices` config parameter was renamed to `has_notices` in TGMPA 2.2.0. Please adjust your configuration.' );
if ( ! isset( $config['has_notices'] ) ) {
$config['has_notices'] = $config['notices'];
}
}
if ( isset( $config['parent_menu_slug'] ) ) {
_deprecated_argument( __FUNCTION__, '2.4.0', 'The `parent_menu_slug` config parameter was removed in TGMPA 2.4.0. In TGMPA 2.5.0 an alternative was (re-)introduced. Please adjust your configuration. For more information visit the website: http://tgmpluginactivation.com/configuration/#h-configuration-options.' );
}
if ( isset( $config['parent_url_slug'] ) ) {
_deprecated_argument( __FUNCTION__, '2.4.0', 'The `parent_url_slug` config parameter was removed in TGMPA 2.4.0. In TGMPA 2.5.0 an alternative was (re-)introduced. Please adjust your configuration. For more information visit the website: http://tgmpluginactivation.com/configuration/#h-configuration-options.' );
}
call_user_func( array( $instance, 'config' ), $config );
}
}
}