$plugin_id, 'slug' => 'funnelfork', 'type' => 'plugin', 'public_key' => $public_key, 'is_premium' => false, 'has_addons' => true, 'has_paid_plans' => false, 'menu' => array( 'slug' => 'edit.php?post_type=funnelfork_scan', // Show the opt-in only on its own page. Without this, the SDK replaces // the whole FunnelFork menu until the site owner opts in or skips, and // the editor page answers "Sorry, you are not allowed to access this page". 'override_exact' => true, 'account' => false, 'contact' => false, // Support runs through the WordPress.org forum. 'support' => false, ), ) ); // The opt-in screen: our own icon and texts (in our text domain, so they are translated with the plugin). $funnelfork_fs->add_filter( 'plugin_icon', static function () { return FUNNELFORK_DIR . 'assets/icon.png'; } ); $funnelfork_fs->add_filter( 'connect-header', static function () { return '

' . esc_html__( 'Optional', 'funnelfork' ) . '

' . '

' . esc_html__( 'Stay up to date with FunnelFork', 'funnelfork' ) . '

'; } ); $funnelfork_fs->add_filter( 'connect_message', static function () { return esc_html__( 'Opt in to get emails about security and feature updates, tips for better quickscans and occasional offers, and share some basic, non-sensitive information about your WordPress setup. That helps us keep FunnelFork compatible with your site. You can also skip this: FunnelFork works just as well.', 'funnelfork' ); } ); // The Freemius screens in the FunnelFork style: the opt-in, the license box (FunnelFork Pro page), // the add-ons page and the FunnelFork Pro details dialog (plugin-install.php in an iframe). add_action( 'admin_enqueue_scripts', static function ( $hook_suffix ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only decides which stylesheet to load. $is_dialog = 'plugin-install.php' === $hook_suffix && isset( $_GET['tab'], $_GET['parent_plugin_id'] ) && 'plugin-information' === $_GET['tab'] && '42169' === $_GET['parent_plugin_id']; if ( in_array( $hook_suffix, array( 'toplevel_page_funnelfork', 'funnelfork_scan_page_funnelfork-pro' ), true ) ) { $sheet = 'optin'; } elseif ( 'funnelfork_scan_page_funnelfork-addons' === $hook_suffix || $is_dialog ) { $sheet = 'addons'; } else { return; } wp_enqueue_style( 'funnelfork-fonts', FUNNELFORK_URL . 'assets/fonts/fonts.css', array(), FUNNELFORK_VERSION ); wp_enqueue_style( 'funnelfork-' . $sheet, FUNNELFORK_URL . 'assets/' . $sheet . '.css', array( 'funnelfork-fonts' ), FUNNELFORK_VERSION ); } ); // Freemius builds the trial texts in the FunnelFork Pro dialog from English pieces ("14 days", // "/ year"), which ends up as "Start mijn gratis 14 days". Whole sentences of our own instead. add_action( 'admin_init', static function () { $texts = array( 'start-free-x' => __( 'Start 14-day free trial', 'funnelfork' ), 'no-commitment-x' => __( 'Card required. Cancel before day 14 and you pay nothing.', 'funnelfork' ), 'after-x-pay-as-little-y' => __( 'After 14 days your yearly license starts.', 'funnelfork' ), ); // The dialog uses the add-on's slug in Freemius. foreach ( array( 'funnelfork', 'funnelfork-pro' ) as $slug ) { fs_override_i18n( $texts, $slug ); } } ); do_action( 'funnelfork_fs_loaded' ); return $funnelfork_fs; } funnelfork_fs(); }