Skip to content

Commit

Permalink
Merge pull request #5 from WordImpress/issue/4
Browse files Browse the repository at this point in the history
Added Give core dependencies
  • Loading branch information
Devin Walker authored Nov 29, 2016
2 parents 764e3f9 + 6386f1c commit c7abfdc
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 37 deletions.
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Issue Overview

<!--- This is a brief overview of the issue. --->

## Expected Behavior
<!--- If you're describing a bug, tell us what should happen -->
<!--- If you're suggesting a change/improvement, tell us how it should work -->

## Current Behavior
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
<!--- If suggesting a change/improvement, explain the difference from current behavior -->

## Possible Solution
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
<!--- or ideas how to implement the addition or change -->

## Steps to Reproduce (for bugs)
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
<!--- reproduce this bug. Include code to reproduce, if relevant -->
1.
2.
3.
4.

## Related PRs
List related PRs against other branches:

## Todos
- [ ] Tests
- [ ] Documentation
20 changes: 20 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Description
<!--- Please describe your changes -->

## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, tests ran to see how -->
<!--- your change affects other areas of the code, etc. -->

## Screenshots (jpeg or gifs if applicable):

## Types of changes
<!--- What types of changes does your code introduce? -->
<!--- Bug fix (non-breaking change which fixes an issue) -->
<!--- New feature (non-breaking change which adds functionality) -->
<!--- Breaking change (fix or feature that would cause existing functionality to not work as expected) -->

## Checklist:
- [ ] My code is tested.
- [ ] My code follows the WordPress code style.
- [ ] My code follows has proper inline documentation.
15 changes: 12 additions & 3 deletions give-convertkit.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
<?php
/**
* Plugin Name: Give - ConvertKit
* Plugin URL: https://givewp.com/addons/convertkit/
* Plugin URI: https://givewp.com/addons/convertkit/
* Description: Easily integrate ConvertKit opt-ins within your Give donation forms.
* Version: 1.0
* Version: 1.0.1
* Author: WordImpress
* Author URI: https://wordimpress.com
* Text Domain: give-convertkit
*/

//Define constants.
if ( ! defined( 'GIVE_CONVERTKIT_VERSION' ) ) {
define( 'GIVE_CONVERTKIT_VERSION', '1.0' );
define( 'GIVE_CONVERTKIT_VERSION', '1.0.1' );
}

if ( ! defined( 'GIVE_CONVERTKIT_MIN_GIVE_VERSION' ) ) {
define( 'GIVE_CONVERTKIT_MIN_GIVE_VERSION', '1.7' );
}

if ( ! defined( 'GIVE_CONVERTKIT_PATH' ) ) {
Expand Down Expand Up @@ -50,6 +54,11 @@ function give_add_convertkit_licensing() {
function give_convertkit_includes() {

include( GIVE_CONVERTKIT_PATH . '/includes/give-convertkit-activation.php' );

if ( ! class_exists( 'Give' ) ) {
return false;
}

include( GIVE_CONVERTKIT_PATH . '/includes/class-give-convertkit.php' );

new Give_ConvertKit( 'convertkit', 'ConvertKit' );
Expand Down
49 changes: 25 additions & 24 deletions includes/give-convertkit-activation.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
*/
function give_convertkit_activation_banner() {

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

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

add_action( 'admin_notices', 'give_convertkit_activation_notice' );

//Don't let this plugin activate
deactivate_plugins( plugin_basename( __FILE__ ) );
deactivate_plugins( GIVE_CONVERTKIT_BASENAME );

if ( isset( $_GET['activate'] ) ) {
unset( $_GET['activate'] );
Expand All @@ -42,12 +42,12 @@ function give_convertkit_activation_banner() {
}

//Check minimum Give version
if ( defined( 'GIVE_VERSION' ) && version_compare( GIVE_VERSION, '1.6', '<' ) ) {
if ( defined( 'GIVE_VERSION' ) && version_compare( GIVE_VERSION, GIVE_CONVERTKIT_MIN_GIVE_VERSION, '<' ) ) {

add_action( 'admin_notices', 'give_convertkit_min_version_notice' );

//Don't let this plugin activate
deactivate_plugins( plugin_basename( __FILE__ ) );
deactivate_plugins( GIVE_CONVERTKIT_BASENAME );

if ( isset( $_GET['activate'] ) ) {
unset( $_GET['activate'] );
Expand All @@ -58,24 +58,25 @@ function give_convertkit_activation_banner() {
}

//Check for activation banner inclusion
$activation_banner_file = GIVE_PLUGIN_DIR . 'includes/admin/class-addon-activation-banner.php';
if ( ! class_exists( 'Give_Addon_Activation_Banner' ) && file_exists( $activation_banner_file ) ) {
include $activation_banner_file;
if ( ! class_exists( 'Give_Addon_Activation_Banner' )
&& file_exists( GIVE_PLUGIN_DIR . 'includes/admin/class-addon-activation-banner.php' )
) {
include GIVE_PLUGIN_DIR . 'includes/admin/class-addon-activation-banner.php';

//Only runs on admin
$args = array(
'file' => __FILE__,
'name' => esc_html__( 'ConvertKit', 'give-convertkit' ),
'version' => GIVE_CONVERTKIT_VERSION,
'settings_url' => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=addons' ),
'documentation_url' => 'https://givewp.com/documentation/add-ons/convertkit/',
'support_url' => 'https://givewp.com/support/',
'testing' => false
);

new Give_Addon_Activation_Banner( $args );
}

//Only runs on admin
$args = array(
'file' => __FILE__,
'name' => esc_html__( 'ConvertKit', 'give-convertkit' ),
'version' => GIVE_CONVERTKIT_VERSION,
'settings_url' => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=addons' ),
'documentation_url' => 'https://givewp.com/documentation/add-ons/convertkit/',
'support_url' => 'https://givewp.com/support/',
'testing' => false
);

new Give_Addon_Activation_Banner( $args );

return false;

}
Expand All @@ -88,7 +89,7 @@ function give_convertkit_activation_banner() {
* @since 1.0
*/
function give_convertkit_activation_notice() {
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>';
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>';
}

/**
Expand All @@ -97,7 +98,7 @@ function give_convertkit_activation_notice() {
* @since 1.0
*/
function give_convertkit_min_version_notice() {
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>';
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>';
}


Expand Down Expand Up @@ -130,7 +131,7 @@ function give_convertkit_plugin_action_links( $actions ) {
*
* @since 1.0
*
* @param array $plugin_meta An array of the plugin's metadata.
* @param array $plugin_meta An array of the plugin's metadata.
* @param string $plugin_file Path to the plugin file, relative to the plugins directory.
*
* @return array
Expand Down
14 changes: 7 additions & 7 deletions languages/give-convertkit.pot
Original file line number Diff line number Diff line change
Expand Up @@ -160,22 +160,22 @@ msgstr ""
msgid "ConvertKit"
msgstr ""

#: includes/give-convertkit-activation.php:91
msgid "<strong>Activation Error:</strong> We noticed Give is not active. Please activate Give in order to use ConvertKit."
#: includes/give-convertkit-activation.php:92
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."
msgstr ""

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

#: includes/give-convertkit-activation.php:118
#: includes/give-convertkit-activation.php:119
msgid "Settings"
msgstr ""

#: includes/give-convertkit-activation.php:152
#: includes/give-convertkit-activation.php:153
msgid "Documentation"
msgstr ""

#: includes/give-convertkit-activation.php:162
#: includes/give-convertkit-activation.php:163
msgid "Add-ons"
msgstr ""
10 changes: 7 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Contributors: wordimpress
Tags: give, convertkit, newsletter, email marketing
Requires at least: 4.2
Tested up to: 4.6.1
Stable tag: 1.0
Tested up to: 4.7
Stable tag: 1.0.1
License: GPLv3
License URI: https://opensource.org/licenses/GPL-3.0

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

= Minimum Requirements =

* WordPress 4.0 or greater
* WordPress 4.2 or greater
* PHP version 5.3 or greater
* MySQL version 5.0 or greater

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

== Changelog ==

= 1.0.1 =
* 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
* Tweak: Plugin updated to use new hooks names found in Give 1.7

= 1.0 =
* Initial plugin release. Yippee!

0 comments on commit c7abfdc

Please sign in to comment.