PluginProbe ʕ •ᴥ•ʔ
Omnisend for Contact Form 7 Add-On / 1.1.7
Omnisend for Contact Form 7 Add-On v1.1.7
trunk 1.0.1 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7
omnisend-for-contact-form-7 / class-wpcf7-omnisend-bootstrap.php
omnisend-for-contact-form-7 Last commit date
fonts 2 years ago img 2 years ago module 1 year ago styles 2 years ago class-wpcf7-omnisend-bootstrap.php 21 hours ago readme.txt 21 hours ago
class-wpcf7-omnisend-bootstrap.php
82 lines
1 <?php
2 /**
3 * Omnisend Contact form 7 plugin
4 *
5 * Plugin Name: Omnisend for Contact Form 7 Add-On
6 * Description: A Contact Form 7 add-on to sync contacts with Omnisend. In collaboration with Omnisend for WooCommerce plugin it enables better customer tracking
7 * Version: 1.1.7
8 * Requires PHP: 7.4
9 * Author: Omnisend
10 * Author URI: https://www.omnisend.com
11 * Developer: Omnisend
12 * Developer URI: https://developers.omnisend.com
13 * Text Domain: omnisend-for-contact-form-7
14 * ------------------------------------------------------------------------
15 * Copyright 2023 Omnisend
16 * License: GNU General Public License v3.0
17 * License URI: http://www.gnu.org/licenses/gpl-3.0.html
18 *
19 * @package OmnisendContactFrom7Plugin
20 */
21
22 if ( ! defined( 'ABSPATH' ) ) {
23 exit;
24 }
25
26 add_action( 'wpcf7_init', array( 'WPCF7_Omnisend_Bootstrap', 'load' ), 5 );
27
28 const WPCP7_OMNISEND_PLUGIN_NAME = 'Omnisend for Contact Form 7';
29 const WPCP7_OMNISEND_PLUGIN_VERSION = '1.1.7';
30 const WPCP7_OMNISEND_SUPPORT_ARTICLE_LINK = 'https://support.omnisend.com/en/articles/8672359-integration-with-contact-form-7';
31 const WPCP7_OMNISEND_WELCOME_AUTOMATION_ARTICLE_LINK = 'https://support.omnisend.com/en/articles/1061818-welcome-email-automation';
32
33 class WPCF7_Omnisend_Bootstrap {
34 public static function load(): void {
35 if ( self::has_breaking_changes() ) {
36 return;
37 }
38
39 require_once 'module/class-wpcf7-omnisend-service.php';
40 require_once 'module/class-wpcf7-omnisend.php';
41 require_once 'module/class-wpcf7-omnisend-form-meta-data.php';
42
43 WPCF7_Integration::get_instance()->add_service(
44 'omnisend',
45 WPCF7_Omnisend_Service::get_instance()
46 );
47
48 WPCF7_Omnisend::get_instance()->load();
49 }
50
51 public static function has_breaking_changes(): bool {
52 if ( ! method_exists( 'WPCF7_Integration', 'add_service' ) ) {
53 return true;
54 }
55
56 if ( ! method_exists( 'WPCF7_ContactForm', 'scan_form_tags' ) ) {
57 return true;
58 }
59
60 if ( ! method_exists( 'WPCF7_ContactForm', 'id' ) ) {
61 return true;
62 }
63
64 if ( ! method_exists( 'WPCF7_Submission', 'get_posted_data' ) ) {
65 return true;
66 }
67
68 return false;
69 }
70 }
71
72 add_action(
73 'admin_notices',
74 function () {
75 if ( ! is_plugin_active( 'contact-form-7/wp-contact-form-7.php' ) ) {
76 echo '<div class="notice notice-error"><strong>' . esc_html( WPCP7_OMNISEND_PLUGIN_NAME ) . '</strong> requires <strong>Contact form 7</strong> to be installed and active.</p></div>';
77 } elseif ( WPCF7_Omnisend_Bootstrap::has_breaking_changes() ) {
78 echo '<div class="notice notice-error"><strong>' . esc_html( WPCP7_OMNISEND_PLUGIN_NAME ) . '</strong> plugin is not loaded due compatibility issue with <strong>Contact Form 7</strong> plugin. Please update <strong>' . esc_html( WPCP7_OMNISEND_PLUGIN_NAME ) . '</strong> plugin to latest version.</p></div>';
79 }
80 }
81 );
82