add_filter( 'show_admin_notice', array( $this, 'show_notice' ), 10, 2 ); $fs->add_filter( 'plugin_icon', array( $this, 'icon' ) ); $fs->add_filter( 'show_deactivation_feedback_form', '__return_false' ); $fs->add_filter( 'show_trial', '__return_false' ); $fs->add_filter( 'show_affiliate_program_notice', '__return_false' ); if ( method_exists( $fs, 'is_premium' ) && method_exists( $fs, 'get_ajax_action' ) && ! $fs->is_premium() ) { // Ahead of the SDK's own handler (priority 10), which does not ask. add_action( 'wp_ajax_' . $fs->get_ajax_action( self::INSTALL ), array( $this, 'refuse_install' ), 0 ); } } /** * Answers the free version's install request without installing * anything. The SDK only sends it after a purchase, from its install * dialog; this answer makes the dialog reload the account page, which in * the free version offers the download instead. */ public function refuse_install() { wp_send_json( array( 'success' => false, 'error' => array( 'code' => 'premium_installed', 'message' => '', ), ) ); } /** * Freemius' notices show only on EU Check's pages. * * @param bool $show Whether Freemius would show it. * @param array $notice The notice. * @return bool */ public function show_notice( $show, $notice = array() ) { unset( $notice ); return (bool) $show && self::on_our_page(); } /** * Whether the current admin page is one of EU Check's. * * @return bool */ public static function on_our_page() { global $plugin_page; return is_admin() && is_string( $plugin_page ) && in_array( $plugin_page, self::PAGES, true ); } /** * The icon on the opt-in screen, from the plugin's own files. * * @return string Absolute path. */ public function icon() { return EUCHECK_DIR . 'assets/images/icon.svg'; } }