You are here

interface SmartIpLocationInterface in Smart IP 8.3

Same name and namespace in other branches
  1. 8.4 src/SmartIpLocationInterface.php \Drupal\smart_ip\SmartIpLocationInterface
  2. 8.2 src/SmartIpLocationInterface.php \Drupal\smart_ip\SmartIpLocationInterface

Provides an interface for Smart IP's data location.

@package Drupal\smart_ip

Hierarchy

Expanded class hierarchy of SmartIpLocationInterface

All classes that implement SmartIpLocationInterface

2 files declare their use of SmartIpLocationInterface
device_geolocation.module in modules/device_geolocation/device_geolocation.module
Provides visitor's geographical location using client device location source that implements W3C Geolocation API and Google Geocoding service.
smart_ip.module in ./smart_ip.module
Determines country, geo location (longitude/latitude), region, city and postal code of the user, based on IP address

File

src/SmartIpLocationInterface.php, line 15
Contains \Drupal\smart_ip\SmartIpLocationInterface.

Namespace

Drupal\smart_ip
View source
interface SmartIpLocationInterface {

  /**
   * Source ID for pure Smart IP as geolocation source.
   */
  const SMART_IP = 'smart_ip';

  /**
   * Source ID for Google Map Geocoded Smart IP as geolocation source.
   */
  const GEOCODED_SMART_IP = 'geocoded_smart_ip';

  /**
   * Source ID for W3C as geolocation source.
   */
  const W3C = 'w3c';

  /**
   * Sets the Smart IP location data..
   *
   * @param array $location
   *   An array of Smart IP location data.
   * @return \Drupal\smart_ip\SmartIpLocationInterface
   *   Smart IP's data location.
   */
  public function setData(array $location);

  /**
   * Sets an item in Smart IP location data.
   *
   * @param string $key
   *   Name of the item in Smart IP location data.
   * @param mixed $value
   *   Value of the item of interest.
   * @return \Drupal\smart_ip\SmartIpLocationInterface
   *   Smart IP's data location.
   */
  public function set($key, $value);

  /**
   * Gets all the Smart IP location data.
   *
   * @param bool $update
   *   Flag to execute update user's geolocation if it is still empty. Default
   *   to TRUE.
   * @return array
   *   An array of Smart IP location data.
   */
  public function getData($update = TRUE);

  /**
   * Gets an item in Smart IP location data or all the Smart IP location data
   * if supplied no parameter.
   *
   * @param string $key
   *   Name of the item in Smart IP location data.
   * @return mixed
   *   Value of the requested item in Smart IP location data or an array of it.
   */
  public function get($key);

  /**
   * Saves the Smart IP location data to user data and session (for anonymous,
   * saves to session only).
   *
   * @return \Drupal\smart_ip\SmartIpLocationInterface
   *   Smart IP's data location.
   */
  public function save();

  /**
   * Deletes the Smart IP location data in user data and session.
   *
   * @return \Drupal\smart_ip\SmartIpLocationInterface
   *   Smart IP's data location.
   */
  public function delete();

}

Members

Namesort descending Modifiers Type Description Overrides
SmartIpLocationInterface::delete public function Deletes the Smart IP location data in user data and session. 1
SmartIpLocationInterface::GEOCODED_SMART_IP constant Source ID for Google Map Geocoded Smart IP as geolocation source.
SmartIpLocationInterface::get public function Gets an item in Smart IP location data or all the Smart IP location data if supplied no parameter. 1
SmartIpLocationInterface::getData public function Gets all the Smart IP location data. 1
SmartIpLocationInterface::save public function Saves the Smart IP location data to user data and session (for anonymous, saves to session only). 1
SmartIpLocationInterface::set public function Sets an item in Smart IP location data. 1
SmartIpLocationInterface::setData public function Sets the Smart IP location data.. 1
SmartIpLocationInterface::SMART_IP constant Source ID for pure Smart IP as geolocation source.
SmartIpLocationInterface::W3C constant Source ID for W3C as geolocation source.