Skip to content

Commit

Permalink
Use updated core plugin version
Browse files Browse the repository at this point in the history
  • Loading branch information
nerijuszaniauskas committed Feb 13, 2024
1 parent 92ab905 commit 3f49293
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package OmnisendContactFrom7Plugin
*/

use Omnisend\Public\V1\Omnisend;
use Omnisend\SDK\V1\Omnisend;

if ( ! defined( 'ABSPATH' ) ) {
exit;
Expand Down Expand Up @@ -91,7 +91,7 @@ public function is_required_plugin_active(): bool {

public function is_required_plugin_updated(): bool {

return class_exists( 'Omnisend\Public\V1\Omnisend' );
return class_exists( 'Omnisend\SDK\V1\Omnisend' );
}

private function display_setup() {
Expand Down
20 changes: 0 additions & 20 deletions omnisend-for-contact-form-7/module/class-wpcf7-omnisend-utils.php

This file was deleted.

22 changes: 6 additions & 16 deletions omnisend-for-contact-form-7/module/class-wpcf7-omnisend.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* @package OmnisendContactFrom7Plugin
*/

use Omnisend\Public\V1\Contact;
use Omnisend\Public\V1\Omnisend;
use Omnisend\SDK\V1\Contact;
use Omnisend\SDK\V1\Omnisend;

if ( ! defined( 'ABSPATH' ) ) {
exit;
Expand Down Expand Up @@ -44,7 +44,7 @@ public function on_wpcf7_before_send_mail( $contact_form ) {
return; // service is not active, no need for other hooks.
}

if ( ! class_exists( 'Omnisend\Public\V1\Omnisend' ) ) {
if ( ! class_exists( 'Omnisend\SDK\V1\Omnisend' ) ) {
return;
}

Expand Down Expand Up @@ -164,22 +164,12 @@ public function on_wpcf7_before_send_mail( $contact_form ) {
}

$response = Omnisend::get_client( WPCP7_OMNISEND_PLUGIN_NAME, WPCP7_OMNISEND_PLUGIN_VERSION )->create_contact( $contact );
if ( is_wp_error( $response ) ) {
error_log('Error in after_submission: ' . $response->get_error_message()); // phpcs:ignore
if ( $response->get_wp_error()->has_errors() ) {
error_log( 'Error in after_submission: ' . $response->get_wp_error()->get_error_message()); // phpcs:ignore
return;
}

if ( ! is_string( $response ) ) {
error_log('Unexpected error. Please contact Omnisend support.'); // phpcs:ignore
return;
}

if ( ! $response ) {
error_log('Empty response'); // phpcs:ignore
return;
}

$this->enable_web_tracking( $response );
$this->enable_web_tracking( $response->get_contact_id() );
}

/**
Expand Down

0 comments on commit 3f49293

Please sign in to comment.