| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Active Campaign & Contact Form 7 |
| 4 |
* Description: Add Contact Form 7 Data to Active Campiagn Contact lists. |
| 5 |
* Author: WPoperation |
| 6 |
* Plugin URI: https://wordpress.org/plugins/wpop-accf |
| 7 |
* Author URI: https://wpoperation.com |
| 8 |
* Version: 1.2.5 |
| 9 |
* Tested up to: 7.1 |
| 10 |
* Text Domain: wpop-accf |
| 11 |
* Domain Path: /languages/ |
| 12 |
**/ |
| 13 |
// Exit if accessed directly |
| 14 |
if (!defined('ABSPATH')) |
| 15 |
exit; |
| 16 |
if (!class_exists('ACCF7_Integration')) { |
| 17 |
class ACCF7_Integration |
| 18 |
{ |
| 19 |
public function __construct(){ |
| 20 |
|
| 21 |
/** |
| 22 |
* check for contact form 7 |
| 23 |
*/ |
| 24 |
add_action('init', array($this,'accf7_plugin_dependencies')); |
| 25 |
add_action( 'admin_enqueue_scripts',array($this,'accf7_register_backend_assets') ); |
| 26 |
add_action('init', array(&$this,'init')); |
| 27 |
add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array($this,'accf7_pro_plugin_action_links') ); |
| 28 |
add_action( 'admin_notices', array($this,'accf7_upgrade_notice') ); |
| 29 |
} |
| 30 |
public function init(){ |
| 31 |
load_plugin_textdomain('wpop-accf', false, dirname(plugin_basename(__FILE__)) . '/languages/'); |
| 32 |
} |
| 33 |
public function accf7_plugin_dependencies() { |
| 34 |
define("ACCF7_PATH", plugin_dir_path(__FILE__)); |
| 35 |
define("ACCF7_URL", plugin_dir_url(__FILE__)); |
| 36 |
if (!class_exists('WPCF7')) { |
| 37 |
add_action('admin_notices', array($this, 'cf7s_admin_notices')); |
| 38 |
} else { |
| 39 |
/** |
| 40 |
* include settings |
| 41 |
*/ |
| 42 |
require_once( ACCF7_PATH . 'includes/accf7-settings.php' ); |
| 43 |
|
| 44 |
/** |
| 45 |
* contact form 7 Subscribe class |
| 46 |
*/ |
| 47 |
require_once( ACCF7_PATH . 'includes/accf7-subscribe.php' ); |
| 48 |
} |
| 49 |
} |
| 50 |
//Registering of backend js and css |
| 51 |
public function accf7_register_backend_assets() { |
| 52 |
wp_enqueue_script( 'accf7-admin-js', ACCF7_URL.'assets/admin.js', array( 'jquery' ), '1.0', true ); |
| 53 |
wp_enqueue_style( 'accf7-admin-css', ACCF7_URL.'assets/admin.css'); |
| 54 |
} |
| 55 |
|
| 56 |
public function cf7s_admin_notices() { |
| 57 |
$class = 'notice notice-error'; |
| 58 |
$message = __('Active Campaign & Contact Form 7 requires Contact form 7 to be installed and active.', 'wpop-accf'); |
| 59 |
printf('<div class="%1$s"><p>%2$s</p></div>', $class, $message); |
| 60 |
} |
| 61 |
|
| 62 |
public function accf7_upgrade_notice() { |
| 63 |
if ( ! current_user_can( 'manage_options' ) ) { |
| 64 |
return; |
| 65 |
} |
| 66 |
$message = __( 'Upgrade to premium version of ActiveCampaign & Contact Form 7 to unlock powerful features. Get up to 30% off for limited time.', 'wpop-accf' ); |
| 67 |
$cta_url = 'https://wpoperation.com/plugins/active-campaign-contact-form-7-pro/'; |
| 68 |
$cta_label = __( 'Upgrade Now', 'wpop-accf' ); |
| 69 |
?> |
| 70 |
<div class="notice accf7-upgrade-notice is-dismissible"> |
| 71 |
<div class="accf7-upgrade-notice__icon" aria-hidden="true"> |
| 72 |
<span class="dashicons dashicons-star-filled"></span> |
| 73 |
</div> |
| 74 |
<div class="accf7-upgrade-notice__body"> |
| 75 |
<p><?php echo esc_html( $message ); ?></p> |
| 76 |
</div> |
| 77 |
<a href="<?php echo esc_url( $cta_url ); ?>" target="_blank" rel="noopener noreferrer" class="accf7-upgrade-notice__cta"> |
| 78 |
<?php echo esc_html( $cta_label ); ?> → |
| 79 |
</a> |
| 80 |
</div> |
| 81 |
<?php |
| 82 |
} |
| 83 |
|
| 84 |
function accf7_pro_plugin_action_links( $links ) { |
| 85 |
|
| 86 |
$links[] = '<a href="https://wpoperation.com/plugins/active-campaign-contact-form-7-pro/" target="_blank" style="color:#05c305; font-weight:bold;">'.esc_html__('Go Pro','wpop-accf').'</a>'; |
| 87 |
return $links; |
| 88 |
} |
| 89 |
} |
| 90 |
new ACCF7_Integration(); |
| 91 |
} |