| @@ -11,8 +11,9 @@ | ||
| 11 | 11 | namespace Forge12\DoubleOptIn\Admin; |
| 12 | 12 | |
| 13 | 13 | use Forge12\DoubleOptIn\FollowUp\FollowUpAttempt; |
| 14 | 14 | use Forge12\DoubleOptIn\FollowUp\FollowUpCoordinator; |
| 15 | +use Forge12\DoubleOptIn\Setup\FormPluginDetector; | |
| 15 | 16 | use forge12\contactform7\CF7DoubleOptIn\OptIn; |
| 16 | 17 | |
| 17 | 18 | if ( ! defined( 'ABSPATH' ) ) { |
| 18 | 19 | exit; |
| @@ -203,19 +204,16 @@ | ||
| 203 | 204 | if ( defined( $constant ) ) { |
| 204 | 205 | $versions[ 'addon_' . $key ] = (string) constant( $constant ); |
| 205 | 206 | } |
| 206 | 207 | } |
| 207 | - foreach ( array( | |
| 208 | - 'elementor_pro' => 'ELEMENTOR_PRO_VERSION', | |
| 209 | - 'cf7' => 'WPCF7_VERSION', | |
| 210 | - 'wpforms' => 'WPFORMS_VERSION', | |
| 211 | - ) as $key => $constant ) { | |
| 212 | - if ( defined( $constant ) ) { | |
| 213 | - $versions[ $key ] = (string) constant( $constant ); | |
| 208 | + if ( defined( 'WPCF7_VERSION' ) ) { | |
| 209 | + $versions['cf7'] = (string) constant( 'WPCF7_VERSION' ); | |
| 210 | + } | |
| 211 | + foreach ( array( 'elementor_pro', 'wpforms', 'gravityforms' ) as $key ) { | |
| 212 | + $version = FormPluginDetector::detectVersion( $key ); | |
| 213 | + if ( $version !== null && $version !== '' ) { | |
| 214 | + $versions[ $key ] = $version; | |
| 214 | 215 | } |
| 215 | - } | |
| 216 | - if ( class_exists( 'GFForms' ) && isset( \GFForms::$version ) ) { | |
| 217 | - $versions['gravityforms'] = (string) \GFForms::$version; | |
| 218 | 216 | } |
| 219 | 217 | return $versions; |
| 220 | 218 | } |
| 221 | 219 | } |