Completed
Pull Request — develop (#689)
by
unknown
01:46
created

TGMPA_Utils   A

Complexity

Total Complexity 17

Size/Duplication

Total Lines 112
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 112
rs 10
c 0
b 0
f 0
wmc 17
lcom 1
cbo 0
1
<?php
2
/**
3
 * Plugin installation and activation for WordPress themes.
4
 *
5
 * Please note that this is a drop-in library for a theme or plugin.
6
 * The authors of this library (Thomas, Gary and Juliette) are NOT responsible
7
 * for the support of your plugin or theme. Please contact the plugin
8
 * or theme author for support.
9
 *
10
 * @package   TGM-Plugin-Activation
11
 * @version   2.6.2
12
 * @link      http://tgmpluginactivation.com/
13
 * @author    Thomas Griffin, Gary Jones, Juliette Reinders Folmer
14
 * @copyright Copyright (c) 2011, Thomas Griffin
15
 * @license   GPL-2.0+
16
 */
17
18
/*
19
	Copyright 2011 Thomas Griffin (thomasgriffinmedia.com)
20
21
	This program is free software; you can redistribute it and/or modify
22
	it under the terms of the GNU General Public License, version 2, as
23
	published by the Free Software Foundation.
24
25
	This program is distributed in the hope that it will be useful,
26
	but WITHOUT ANY WARRANTY; without even the implied warranty of
27
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28
	GNU General Public License for more details.
29
30
	You should have received a copy of the GNU General Public License
31
	along with this program; if not, write to the Free Software
32
	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
33
*/
34
35
if ( ! defined( 'ABSPATH' ) ) {
36
	return;
37
}	
38
39
if ( ! function_exists( 'load_tgm_plugin_activation' ) ) {
40
	/**
41
	 * Ensure only one instance of the class is ever invoked.
42
	 *
43
	 * @since 2.5.0
44
	 */
45
	function load_tgm_plugin_activation() {
46
		$GLOBALS['tgmpa'] = TGM\TGM_Plugin_Activation::get_instance();
47
	}
48
}
49
50
if ( function_exists( 'did_action' ) && function_exists( 'add_action' ) ) {
51
	
52
	if ( did_action( 'plugins_loaded' ) ) {
53
		
54
		load_tgm_plugin_activation();
55
		
56
	} else {
57
		
58
		add_action( 'plugins_loaded', 'load_tgm_plugin_activation' );
59
		
60
	}
61
	
62
}
63
64
if ( ! function_exists( 'tgmpa' ) ) {
65
	/**
66
	 * Helper function to register a collection of required plugins.
67
	 *
68
	 * @since 2.0.0
69
	 * @api
70
	 *
71
	 * @param array $plugins An array of plugin arrays.
72
	 * @param array $config  Optional. An array of configuration values.
73
	 */
74
	function tgmpa( $plugins, $config = array() ) {
75
		$instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) );
76
77
		foreach ( $plugins as $plugin ) {
78
			call_user_func( array( $instance, 'register' ), $plugin );
79
		}
80
81
		if ( ! empty( $config ) && is_array( $config ) ) {
82
			// Send out notices for deprecated arguments passed.
83
			if ( isset( $config['notices'] ) ) {
84
				_deprecated_argument( __FUNCTION__, '2.2.0', 'The `notices` config parameter was renamed to `has_notices` in TGMPA 2.2.0. Please adjust your configuration.' );
85
				if ( ! isset( $config['has_notices'] ) ) {
86
					$config['has_notices'] = $config['notices'];
87
				}
88
			}
89
90
			if ( isset( $config['parent_menu_slug'] ) ) {
91
				_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.' );
92
			}
93
			if ( isset( $config['parent_url_slug'] ) ) {
94
				_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.' );
95
			}
96
97
			call_user_func( array( $instance, 'config' ), $config );
98
		}
99
	}
100
}
101