db = new DB(); } public function register() { add_action( 'wp_footer', [$this, 'sby_frontend_license_error'], 300 ); add_action( 'wp_ajax_sby_hide_frontend_license_error', [$this, 'hide_frontend_license_error'], 10 ); add_action( 'wp_ajax_sby_recheck_connection', array( $this, 'sby_recheck_connection' ) ); } /** * Hide the frontend license error message for a day * * @since 2.0.3 */ public function hide_frontend_license_error() { check_ajax_referer( 'sby_nonce' , 'nonce'); set_transient( 'sby_license_error_notice', true, DAY_IN_SECONDS ); wp_die(); } public function sby_frontend_license_error() { // Don't do anything for guests. if ( ! is_user_logged_in() ) { return; } if ( ! sby_is_pro() ) { return; } if ( !current_user_can( Util::sby_capability_check() ) ) { return; } // Check that the license exists and the user hasn't already clicked to ignore the message if ( empty( Util::get_license_key() ) ) { $this->sby_frontend_license_error_content( 'inactive' ); return; } // If license not expired then return; if ( !Util::is_license_expired() ) { return; } if ( Util::is_license_grace_period_ended( true ) ) { $this->sby_frontend_license_error_content(); } return; } /** * Output frontend license error HTML content * * @since 2.0.2 */ public function sby_frontend_license_error_content( $license_state = 'expired' ) { $icons = sby_builder_pro()->builder_svg_icons(); $feeds_count = $this->db->feeds_count(); if ( $feeds_count <= 0 ) { return; } $should_display_license_error_notice = get_transient( 'sby_license_error_notice' ); if ( $should_display_license_error_notice ) { return; } ?>