-
Notifications
You must be signed in to change notification settings - Fork 0
/
ninja-forms-mail-chimp.php
77 lines (70 loc) · 2.09 KB
/
ninja-forms-mail-chimp.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
<?php
/**
* Plugin Name: Ninja Forms - Mailchimp
* Plugin URI: https://ninjaforms.com/extensions/mail-chimp/
* Description: Sign up users for your Mailchimp newsletter when submitting Ninja Forms
* Version: 3.3.6
* Author: Saturday Drive
* Author URI: https://ninjaforms.com/
* Text Domain: ninja-forms-mail-chimp
*
* Release Description: releaseTagMessage
* Copyright 2016 The WP Ninjas.
*/
/** IMPORTANT: This file MUST be PHP 5.2 compatible */
add_action('plugins_loaded', 'nf_mailchimp_init', 0);
/**
* Load plugin if possible
*
* @since 3.2.0
*/
function nf_mailchimp_init() {
// Load deprecated version is NF < 3.0
if (version_compare(get_option('ninja_forms_version', '0.0.0'), '3', '<') || get_option('ninja_forms_load_deprecated', FALSE)) {
include 'src/deprecated/ninja-forms-mailchimp.php';
return;
}
if (version_compare(PHP_VERSION, '7.1.0', '>=')) {
if (class_exists('Ninja_Forms')) {
include_once __DIR__ . '/bootstrap.php';
} else {
//Ninja Forms is not active
}
} else {
add_action('admin_notices', 'nf_mailchimp_php_nag');
}
}
/**
* Callback for admin notice shown when PHP version is not correct.
*
* @since 3.2.0
*/
function nf_mailchimp_php_nag() {
?>
<div class="notice notice-error">
<p>
<?php
echo esc_html(
'Your version of PHP is incompatible with Ninja Forms Mailchimp and can not be used.',
'nf-mailchimp'
);
printf(
' <a href="https://wordpress.org/php" target="__blank">%s</a>',
esc_html__('Learn More', 'nf-mailchimp')
)
?>
</p>
</div>
<?php
}
add_action('admin_init', 'nf_mailchimp_setupLicense');
function nf_mailchimp_setupLicense() {
if (!class_exists('NF_Extension_Updater'))
return;
$name = 'MailChimp';
$version = '3.3.6';
$author = 'The WP Ninjas';
$file = __FILE__;
$slug = 'mail-chimp';
new NF_Extension_Updater($name, $version, $author, $file, $slug);
}