Skip to content

Commit c7abfdc

Browse files
author
Devin Walker
authored
Merge pull request #5 from WordImpress/issue/4
Added Give core dependencies
2 parents 764e3f9 + 6386f1c commit c7abfdc

File tree

6 files changed

+101
-37
lines changed

6 files changed

+101
-37
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
## Issue Overview
2+
3+
<!--- This is a brief overview of the issue. --->
4+
5+
## Expected Behavior
6+
<!--- If you're describing a bug, tell us what should happen -->
7+
<!--- If you're suggesting a change/improvement, tell us how it should work -->
8+
9+
## Current Behavior
10+
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
11+
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
12+
13+
## Possible Solution
14+
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
15+
<!--- or ideas how to implement the addition or change -->
16+
17+
## Steps to Reproduce (for bugs)
18+
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
19+
<!--- reproduce this bug. Include code to reproduce, if relevant -->
20+
1.
21+
2.
22+
3.
23+
4.
24+
25+
## Related PRs
26+
List related PRs against other branches:
27+
28+
## Todos
29+
- [ ] Tests
30+
- [ ] Documentation

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## Description
2+
<!--- Please describe your changes -->
3+
4+
## How Has This Been Tested?
5+
<!--- Please describe in detail how you tested your changes. -->
6+
<!--- Include details of your testing environment, tests ran to see how -->
7+
<!--- your change affects other areas of the code, etc. -->
8+
9+
## Screenshots (jpeg or gifs if applicable):
10+
11+
## Types of changes
12+
<!--- What types of changes does your code introduce? -->
13+
<!--- Bug fix (non-breaking change which fixes an issue) -->
14+
<!--- New feature (non-breaking change which adds functionality) -->
15+
<!--- Breaking change (fix or feature that would cause existing functionality to not work as expected) -->
16+
17+
## Checklist:
18+
- [ ] My code is tested.
19+
- [ ] My code follows the WordPress code style.
20+
- [ ] My code follows has proper inline documentation.

give-convertkit.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
<?php
22
/**
33
* Plugin Name: Give - ConvertKit
4-
* Plugin URL: https://givewp.com/addons/convertkit/
4+
* Plugin URI: https://givewp.com/addons/convertkit/
55
* Description: Easily integrate ConvertKit opt-ins within your Give donation forms.
6-
* Version: 1.0
6+
* Version: 1.0.1
77
* Author: WordImpress
88
* Author URI: https://wordimpress.com
99
* Text Domain: give-convertkit
1010
*/
1111

1212
//Define constants.
1313
if ( ! defined( 'GIVE_CONVERTKIT_VERSION' ) ) {
14-
define( 'GIVE_CONVERTKIT_VERSION', '1.0' );
14+
define( 'GIVE_CONVERTKIT_VERSION', '1.0.1' );
15+
}
16+
17+
if ( ! defined( 'GIVE_CONVERTKIT_MIN_GIVE_VERSION' ) ) {
18+
define( 'GIVE_CONVERTKIT_MIN_GIVE_VERSION', '1.7' );
1519
}
1620

1721
if ( ! defined( 'GIVE_CONVERTKIT_PATH' ) ) {
@@ -50,6 +54,11 @@ function give_add_convertkit_licensing() {
5054
function give_convertkit_includes() {
5155

5256
include( GIVE_CONVERTKIT_PATH . '/includes/give-convertkit-activation.php' );
57+
58+
if ( ! class_exists( 'Give' ) ) {
59+
return false;
60+
}
61+
5362
include( GIVE_CONVERTKIT_PATH . '/includes/class-give-convertkit.php' );
5463

5564
new Give_ConvertKit( 'convertkit', 'ConvertKit' );

includes/give-convertkit-activation.php

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@
2222
*/
2323
function give_convertkit_activation_banner() {
2424

25-
// Check for if give plugin activate or not.
26-
$is_give_active = defined( 'GIVE_PLUGIN_BASENAME' ) ? is_plugin_active( GIVE_PLUGIN_BASENAME ) : false ;
25+
// Check for if give plugin activate or not.
26+
$is_give_active = defined( 'GIVE_PLUGIN_BASENAME' ) ? is_plugin_active( GIVE_PLUGIN_BASENAME ) : false;
2727

2828
//Check to see if Give is activated, if it isn't deactivate and show a banner
2929
if ( is_admin() && current_user_can( 'activate_plugins' ) && ! $is_give_active ) {
3030

3131
add_action( 'admin_notices', 'give_convertkit_activation_notice' );
3232

3333
//Don't let this plugin activate
34-
deactivate_plugins( plugin_basename( __FILE__ ) );
34+
deactivate_plugins( GIVE_CONVERTKIT_BASENAME );
3535

3636
if ( isset( $_GET['activate'] ) ) {
3737
unset( $_GET['activate'] );
@@ -42,12 +42,12 @@ function give_convertkit_activation_banner() {
4242
}
4343

4444
//Check minimum Give version
45-
if ( defined( 'GIVE_VERSION' ) && version_compare( GIVE_VERSION, '1.6', '<' ) ) {
45+
if ( defined( 'GIVE_VERSION' ) && version_compare( GIVE_VERSION, GIVE_CONVERTKIT_MIN_GIVE_VERSION, '<' ) ) {
4646

4747
add_action( 'admin_notices', 'give_convertkit_min_version_notice' );
4848

4949
//Don't let this plugin activate
50-
deactivate_plugins( plugin_basename( __FILE__ ) );
50+
deactivate_plugins( GIVE_CONVERTKIT_BASENAME );
5151

5252
if ( isset( $_GET['activate'] ) ) {
5353
unset( $_GET['activate'] );
@@ -58,24 +58,25 @@ function give_convertkit_activation_banner() {
5858
}
5959

6060
//Check for activation banner inclusion
61-
$activation_banner_file = GIVE_PLUGIN_DIR . 'includes/admin/class-addon-activation-banner.php';
62-
if ( ! class_exists( 'Give_Addon_Activation_Banner' ) && file_exists( $activation_banner_file ) ) {
63-
include $activation_banner_file;
61+
if ( ! class_exists( 'Give_Addon_Activation_Banner' )
62+
&& file_exists( GIVE_PLUGIN_DIR . 'includes/admin/class-addon-activation-banner.php' )
63+
) {
64+
include GIVE_PLUGIN_DIR . 'includes/admin/class-addon-activation-banner.php';
65+
66+
//Only runs on admin
67+
$args = array(
68+
'file' => __FILE__,
69+
'name' => esc_html__( 'ConvertKit', 'give-convertkit' ),
70+
'version' => GIVE_CONVERTKIT_VERSION,
71+
'settings_url' => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=addons' ),
72+
'documentation_url' => 'https://givewp.com/documentation/add-ons/convertkit/',
73+
'support_url' => 'https://givewp.com/support/',
74+
'testing' => false
75+
);
76+
77+
new Give_Addon_Activation_Banner( $args );
6478
}
6579

66-
//Only runs on admin
67-
$args = array(
68-
'file' => __FILE__,
69-
'name' => esc_html__( 'ConvertKit', 'give-convertkit' ),
70-
'version' => GIVE_CONVERTKIT_VERSION,
71-
'settings_url' => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=addons' ),
72-
'documentation_url' => 'https://givewp.com/documentation/add-ons/convertkit/',
73-
'support_url' => 'https://givewp.com/support/',
74-
'testing' => false
75-
);
76-
77-
new Give_Addon_Activation_Banner( $args );
78-
7980
return false;
8081

8182
}
@@ -88,7 +89,7 @@ function give_convertkit_activation_banner() {
8889
* @since 1.0
8990
*/
9091
function give_convertkit_activation_notice() {
91-
echo '<div class="error"><p>' . __( '<strong>Activation Error:</strong> We noticed Give is not active. Please activate Give in order to use ConvertKit.', 'give-convertkit' ) . '</p></div>';
92+
echo '<div class="error"><p>' . __( '<strong>Activation Error:</strong> You must have the <a href="https://givewp.com/" target="_blank">Give</a> plugin installed and activated for the ConvertKit add-on to activate.', 'give-convertkit' ) . '</p></div>';
9293
}
9394

9495
/**
@@ -97,7 +98,7 @@ function give_convertkit_activation_notice() {
9798
* @since 1.0
9899
*/
99100
function give_convertkit_min_version_notice() {
100-
echo '<div class="error"><p>' . __( '<strong>Activation Error:</strong> We noticed Give is not up to date. Please update Give in order to use ConvertKit.', 'give-convertkit' ) . '</p></div>';
101+
echo '<div class="error"><p>' . sprintf( __( '<strong>Activation Error:</strong> You must have <a href="%s" target="_blank">Give</a> version %s+ for the ConvertKit add-on to activate.', 'give-convertkit' ), 'https://givewp.com', GIVE_CONVERTKIT_MIN_GIVE_VERSION ) . '</p></div>';
101102
}
102103

103104

@@ -130,7 +131,7 @@ function give_convertkit_plugin_action_links( $actions ) {
130131
*
131132
* @since 1.0
132133
*
133-
* @param array $plugin_meta An array of the plugin's metadata.
134+
* @param array $plugin_meta An array of the plugin's metadata.
134135
* @param string $plugin_file Path to the plugin file, relative to the plugins directory.
135136
*
136137
* @return array

languages/give-convertkit.pot

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,22 +160,22 @@ msgstr ""
160160
msgid "ConvertKit"
161161
msgstr ""
162162

163-
#: includes/give-convertkit-activation.php:91
164-
msgid "<strong>Activation Error:</strong> We noticed Give is not active. Please activate Give in order to use ConvertKit."
163+
#: includes/give-convertkit-activation.php:92
164+
msgid "<strong>Activation Error:</strong> You must have the <a href=\"https://givewp.com/\" target=\"_blank\">Give</a> plugin installed and activated for the ConvertKit add-on to activate."
165165
msgstr ""
166166

167-
#: includes/give-convertkit-activation.php:100
168-
msgid "<strong>Activation Error:</strong> We noticed Give is not up to date. Please update Give in order to use ConvertKit."
167+
#: includes/give-convertkit-activation.php:101
168+
msgid "<strong>Activation Error:</strong> You must have <a href=\"%s\" target=\"_blank\">Give</a> version %s+ for the ConvertKit add-on to activate."
169169
msgstr ""
170170

171-
#: includes/give-convertkit-activation.php:118
171+
#: includes/give-convertkit-activation.php:119
172172
msgid "Settings"
173173
msgstr ""
174174

175-
#: includes/give-convertkit-activation.php:152
175+
#: includes/give-convertkit-activation.php:153
176176
msgid "Documentation"
177177
msgstr ""
178178

179-
#: includes/give-convertkit-activation.php:162
179+
#: includes/give-convertkit-activation.php:163
180180
msgid "Add-ons"
181181
msgstr ""

readme.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
Contributors: wordimpress
33
Tags: give, convertkit, newsletter, email marketing
44
Requires at least: 4.2
5-
Tested up to: 4.6.1
6-
Stable tag: 1.0
5+
Tested up to: 4.7
6+
Stable tag: 1.0.1
77
License: GPLv3
88
License URI: https://opensource.org/licenses/GPL-3.0
99

@@ -17,7 +17,7 @@ This plugin requires the Give plugin activated to function properly. When activa
1717

1818
= Minimum Requirements =
1919

20-
* WordPress 4.0 or greater
20+
* WordPress 4.2 or greater
2121
* PHP version 5.3 or greater
2222
* MySQL version 5.0 or greater
2323

@@ -35,5 +35,9 @@ Automatic updates should work like a charm; as always though, ensure you backup
3535

3636
== Changelog ==
3737

38+
= 1.0.1 =
39+
* New: The plugin now checks to see if Give is active and up to the minimum version required to run the plugin - https://github.com/WordImpress/Give-Constant-Contact/issues/4
40+
* Tweak: Plugin updated to use new hooks names found in Give 1.7
41+
3842
= 1.0 =
3943
* Initial plugin release. Yippee!

0 commit comments

Comments
 (0)