Skip to content

Commit

Permalink
Fix logic
Browse files Browse the repository at this point in the history
  • Loading branch information
arnas committed Feb 5, 2024
1 parent 6d5b59b commit e833777
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
16 changes: 8 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions omnisend-for-gravity-forms/class-omnisendaddon.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ public function minimum_requirements() {
'plugins' => array(
'omnisend/class-omnisend-core-bootstrap.php' => 'Email Marketing by Omnisend',
),
array( $this, 'omnisend_connected' ),
array( $this, 'omnisend_custom_requirement_callback' ),
);
}

public function omnisend_connected( $meets_requirements ) {
public function omnisend_custom_requirement_callback( $meets_requirements ) {

if ( ! is_plugin_active( 'omnisend/class-omnisend-core-bootstrap.php' ) ) {
return array( 'meets_requirements' => true ); // Covered with "minimum_requirements" function, no plugin - no need to check more.
return $meets_requirements;
}

if ( ! class_exists( 'Omnisend\Public\V1\Omnisend' ) ) {
Expand Down Expand Up @@ -351,7 +352,13 @@ public function after_submission( $entry, $form ) {
$this->mapCustomProperties( $form, $entry, $settings, $contact );

$response = \Omnisend\Public\V1\Omnisend::get_client( OMNISEND_GRAVITY_ADDON_NAME, OMNISEND_GRAVITY_ADDON_VERSION )->create_contact( $contact );
if ( is_wp_error( $response ) ) {
error_log( 'Error in after_submission: ' . $response->get_error_message()); // phpcs:ignore
return;
}

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

Expand Down Expand Up @@ -398,7 +405,7 @@ private function mapCustomProperties( $form, $entry, $settings, Contact $contact
}

public function get_menu_icon() {
return wp_remote_get( $this->get_base_path() . '/images/menu-icon.svg' );
return file_get_contents( $this->get_base_path() . '/images/menu-icon.svg' ); // phpcs:ignore
}

private function enableWebTracking( $email, $phone ) {
Expand Down

0 comments on commit e833777

Please sign in to comment.