=' ) && version_compare( $wp_version, '5.5', '>=' ) && class_exists( 'GFForms' ) ); } /** * Display a notice if requirements are not met. * * @return void */ function notice_for_missing_requirements() { printf( '

%1$s

', esc_html__( 'The "Gravity Forms Sendinblue Add-on" plugin is inactive because the minimal requirements are not met.', 'addon-gravityforms-sendinblue-free' ) ); } /** * Trigger a custom action when activating the plugin. * * @param string $plugin * @param boolean $network * @return void */ function on_plugin_activation( $plugin, $network ) { if ( $plugin !== DKGFSIB_FREE_BASENAME ) { return; } init(); do_action( 'dk-gf-sib-free/plugin-activated', (bool) $network ); } add_action( 'activate_plugin', __NAMESPACE__ . '\\on_plugin_activation', 10, 2 ); /** * Trigger a custom action when de-activating the plugin. * * @return void */ function on_plugin_deactivation( $plugin, $network ) { if ( $plugin !== DKGFSIB_FREE_BASENAME ) { return; } init(); do_action( 'dk-gf-sib-free/plugin-deactivated', (bool) $network ); } add_action( 'deactivate_plugin', __NAMESPACE__ . '\\on_plugin_deactivation', 10, 2 ); /** * Register our add-on. * * @return void */ function register_addon() { if ( ! method_exists( 'GFForms', 'include_addon_framework' ) ) { return; } // Stop here if the pro version is enabled if ( is_pro_enabled() ) { return; } init(); GFAddOn::register( 'DK_GF_SIB_FREE\GF_Addon' ); } add_action( 'gform_loaded', __NAMESPACE__ . '\\register_addon', 5 ); /** * Translations. * * @return void */ function load_translations() { load_plugin_textdomain( 'addon-gravityforms-sendinblue-free', false, DKGFSIB_FREE_PLUGIN_DIRNAME . '/languages/' ); } add_action( 'plugins_loaded', __NAMESPACE__ . '\\load_translations' ); /** * Settings Link. * * @param array $links The array of plugin settings links. * @return array */ function add_settings_link( $links ) { $settings_link[] = "" . esc_html( __( 'Upgrade to PRO', 'addon-gravityforms-sendinblue-free' ) ) . ''; $links = array_merge( $settings_link, $links ); return $links; } add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), __NAMESPACE__ . '\\add_settings_link' ); /** * Return true if the pro version of the add-on is enabled. * * @return bool */ function is_pro_enabled() { return defined( 'DKGFSIB_VERSION' ) || defined( 'WPCONNECT_GF_SIB_VERSION' ); }