w popup. * Check if the review popup should be shown based on various conditions. * @return bool */ public function maybe_show_review_popup() { if ( $this->check_if_settings_modified() && $this->get_days_since_installed() > 1 ) { $review_data = $this->get_review_data(); // Don't show if user has already submitted feedback when rating is less than 4. if ( isset( $review_data['rating'] ) && (int) $review_data['rating'] < 4 ) { return false; } // Hide if rating is submitted but repo review is not clicked. if ( (int) $review_data['rating'] > 3 && $review_data['repo_review_clicked'] ) { return false; } // Don't show if user has dismissed the popup 3 times. if ( 3 === (int) $review_data['dismissals'] ) { return false; } if ( isset( $review_data['hide_for_days'] ) && $review_data['hide_for_days'] > 0 ) { $hide_for_days = $review_data['hide_for_days']; $last_dismiss = strtotime( $review_data['last_dismiss'] ); $days_since_dismiss = floor( ( time() - $last_dismiss ) / DAY_IN_SECONDS ); if ( $days_since_dismiss < $hide_for_days ) { return false; } } return true; } return false; } public function __construct() { add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] ); add_action( 'admin_init', [ $this, 'register_base_data' ] ); add_action( 'rest_api_init', [ $this, 'register_settings' ] ); $this->register_routes(); } } w popup. * Check if the review popup should be shown based on various conditions. * @return bool */ public function maybe_show_review_popup() { if ( $this->check_if_settings_modified() && $this->get_days_since_installed() > 1 ) { $review_data = $this->get_review_data(); // Don't show if user has already submitted feedback when rating is less than 4. if ( isset( $review_data['rating'] ) && (int) $review_data['rating'] < 4 ) { return false; } // Hide if rating is submitted but repo review is not clicked. if ( (int) $review_data['rating'] > 3 && $review_data['repo_review_clicked'] ) { return false; } // Don't show if user has dismissed the popup 3 times. if ( 3 === (int) $review_data['dismissals'] ) { return false; } if ( isset( $review_data['hide_for_days'] ) && $review_data['hide_for_days'] > 0 ) { $hide_for_days = $review_data['hide_for_days']; $last_dismiss = strtotime( $review_data['last_dismiss'] ); $days_since_dismiss = floor( ( time() - $last_dismiss ) / DAY_IN_SECONDS ); if ( $days_since_dismiss < $hide_for_days ) { return false; } } return true; } return false; } public function __construct() { add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] ); add_action( 'admin_init', [ $this, 'register_base_data' ] ); add_action( 'rest_api_init', [ $this, 'register_settings' ] ); $this->register_routes(); } }