/**
  * Checks if the users IP address belongs to a certain country.
  *
  * @since  4.6
  * @return bool
  */
 protected function get_user_country()
 {
     // Grab the users IP address
     $ip = $this->get_users_ip();
     $country = false;
     // See if an add-on provides the country for us.
     $country = apply_filters('popup-get-country', $country, $ip);
     if (empty($country)) {
         // Next check the local caching-table.
         $country = IncPopupDatabase::get_country($ip);
     }
     if (empty($country)) {
         $service = $this->get_service();
         // Finally use the external API to find the country.
         $country = $this->country_from_api($ip, $service);
         // Locally cache the API result.
         if (!empty($country)) {
             IncPopupDatabase::add_ip($ip, $country);
         }
     }
     if (empty($country)) {
         $country = 'XX';
     }
     return $country;
 }