auth; $token = get_option('adflipr_auth_token', false); if ($token) { $auth->notify_adflipr_disconnect($token); } $auth->soft_disconnect('local'); delete_user_meta(get_current_user_id(), 'adflipr_connect_notice_dismissed'); wp_safe_redirect( add_query_arg( array( 'page' => 'adflipr-settings', 'adflipr_reset' => '1', ), admin_url('admin.php') ) ); exit; } } /** * Dismiss "not connected" admin notice (per user). */ public function handle_connect_notice_dismiss() { if (! isset($_GET['adflipr_dismiss_connect'], $_GET['_wpnonce'])) { return; } if (! current_user_can('manage_options')) { return; } if (! wp_verify_nonce(sanitize_text_field(wp_unslash($_GET['_wpnonce'])), 'adflipr_dismiss_connect_notice')) { return; } update_user_meta(get_current_user_id(), 'adflipr_connect_notice_dismissed', '1'); $redirect = wp_get_referer(); if (! is_string($redirect) || $redirect === '') { $redirect = admin_url(); } wp_safe_redirect(remove_query_arg(array('adflipr_dismiss_connect', '_wpnonce'), $redirect)); exit; } /** * Prompt administrators to connect when WooCommerce is active but Adflipr token is missing. */ public function adflipr_not_connected_notice() { if (! current_user_can('manage_options')) { return; } if (! class_exists('WooCommerce')) { return; } if (! function_exists('AdFlipr_Core')) { return; } $core = AdFlipr_Core(); if (! isset($core->auth) || ! is_object($core->auth)) { return; } if ($core->auth->valid_token()) { return; } if (get_user_meta(get_current_user_id(), 'adflipr_connect_notice_dismissed', true) === '1') { return; } $settings_url = admin_url('admin.php?page=adflipr-settings'); $dismiss_url = wp_nonce_url( add_query_arg('adflipr_dismiss_connect', '1', admin_url('index.php')), 'adflipr_dismiss_connect_notice' ); ?>
' . esc_html__('Adflipr integration disconnected successfully. Tracking and synchronization are paused until reconnect.', 'adflipr-for-woocommerce') . '
'; } $notice_reason = get_transient(ADFLIPR_DISCONNECT_NOTICE_TRANSIENT); if ($notice_reason === 'remote') { echo '' . esc_html__('Adflipr integration was disconnected from the Adflipr dashboard. Tracking and synchronization are paused until reconnect.', 'adflipr-for-woocommerce') . '
%s
%s
', esc_html__( 'This site uses the Adflipr plugin to connect WooCommerce with Adflipr (hosted service). Depending on your settings and store activity, data may be transmitted to Adflipr servers over HTTPS.', 'adflipr-for-woocommerce' ), esc_html__( 'Product, coupon, order, and (where applicable) subscription data for synchronization and automation.', 'adflipr-for-woocommerce' ), esc_html__( 'Checkout-related events (for example cart recovery or purchase notifications) when the shopper interacts with checkout.', 'adflipr-for-woocommerce' ), esc_html__( 'Authentication tokens stored locally after you sign in to Adflipr from WordPress admin.', 'adflipr-for-woocommerce' ), esc_html__( 'Optional marketing attribution cookies (utm_* keys from the URL) when that feature is enabled for your site.', 'adflipr-for-woocommerce' ), esc_html__( 'Optional storefront popups from your Adflipr account when connected and popup embed is enabled. The script may store a first-party visitor identifier in the browser (localStorage) for frequency rules and analytics. Email fields in popups collect personal data under your privacy policy.', 'adflipr-for-woocommerce' ), esc_html__( 'Data is sent so Adflipr can provide email marketing and automation features you configure in your Adflipr account. See Adflipr’s own privacy policy for how they process data.', 'adflipr-for-woocommerce' ) ); wp_add_privacy_policy_content(__('Adflipr', 'adflipr-for-woocommerce'), wp_kses_post($body)); } /** * Display notice if WooCommerce is not active */ public function woocommerce_missing_notice() { ?>' . esc_html__( 'The Adflipr app is available to site administrators after you sign in.', 'adflipr-for-woocommerce' ) . '
'; } if (! class_exists('AdFlipr_Assets') || ! AdFlipr_Assets::has_admin_bundle()) { return '' . esc_html__( 'Adflipr assets are missing. Run npm run build in the plugin directory or reinstall the plugin package.', 'adflipr-for-woocommerce' ) . '
'; } $this->enqueue_scripts(); return ''; } } if (class_exists('AdFlipr_Core')) { AdFlipr_Core::register('admin', 'AdFlipr_Admin'); } }