-
Notifications
You must be signed in to change notification settings - Fork 0
/
pods.php
52 lines (41 loc) · 1.31 KB
/
pods.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
<?php
/**
* Plugin Name: ImportWP - Pods Importer Addon
* Plugin URI: https://www.importwp.com
* Description: Allow ImportWP to import Pods.
* Author: James Collings <james@jclabs.co.uk>
* Version: _2.0.2_
* Author URI: https://www.importwp.com
* Network: True
*/
add_action('admin_init', 'iwp_pods_check');
function iwp_pods_requirements_met()
{
return false === (is_admin() && current_user_can('activate_plugins') && (!function_exists('pods_is_plugin_active') || version_compare(IWP_VERSION, '2.0.23', '<')));
}
function iwp_pods_check()
{
if (!iwp_pods_requirements_met()) {
add_action('admin_notices', 'iwp_pods_notice');
deactivate_plugins(plugin_basename(__FILE__));
if (isset($_GET['activate'])) {
unset($_GET['activate']);
}
}
}
function iwp_pods_setup()
{
if (!iwp_pods_requirements_met()) {
return;
}
$base_path = dirname(__FILE__);
require_once $base_path . '/class/autoload.php';
require_once $base_path . '/setup.php';
}
add_action('plugins_loaded', 'iwp_pods_setup', 9);
function iwp_pods_notice()
{
echo '<div class="error">';
echo '<p><strong>ImportWP - Pods Importer Addon</strong> requires that you have <strong>ImportWP PRO v2.0.23 or newer</strong>, and <strong>Pods</strong> installed.</p>';
echo '</div>';
}