# Module: WPGMZA

### Members

#### <static, constant> events :EventDispatcher

  Global EventDispatcher used to listen for global plugin events

  ##### Type:

  - EventDispatcher

#### <static, constant> latLngRegexp :RegExp

  A regular expression that matches a latitude / longitude coordinate pair

  ##### Type:

  - RegExp

#### <static, constant> localized_strings :object

  Key and value pairs of localized strings passed from the server

  ##### Type:

  - object

#### <static, constant> maps :array

  Indexed array of map instances

  ##### Type:

  - array

#### <static, constant> restAPI :RestAPI

  Instance of the restAPI. Not to be confused with WPGMZA.RestAPI, which is the instances constructor

  ##### Type:

  - RestAPI

#### <static, constant> settings :object

  Settings, passed from the server

  ##### Type:

  - object

#### <inner> imageDimensionsCache

  Cache of image dimensions by URL, for internal use only
  See:
    - WPGMZA.getImageDimensions

### Methods

#### <static> animateScroll(element [, milliseconds])

  Animated scroll, accounts for animation settings and fixed header height

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `element` | HTMLElement |  | The element to scroll to
  `milliseconds` | number | <optional> | The time in milliseconds to scroll over. Defaults to 500 if no value is specified.

  ##### Returns:

  void

#### <static> assertInstanceOf(instance, instanceName)

  This function is for checking inheritence has been setup correctly. For objects that have engine and Pro specific classes, it will automatically add the engine and pro prefix to the supplied string and if such an object exists it will test against that name rather than the un-prefix argument supplied. For example, if we are running the Pro addon with Google maps as the engine, if you supply Marker as the instance name the function will check to see if instance is an instance of GoogleProMarker

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `instance` | object | The object to check
  `instanceName` | string | The class name as a string which this object should be an instance of

  ##### Returns:

  Type
    void

#### <static> getCurrentPosition()

This function will get the users position, it first attempts to get high accuracy position (mobile with GPS sensors etc.), if that fails (desktops will time out) then it tries again without high accuracy enabled

  ##### Returns:

  The users position as a LatLng literal
  Type
    object

#### <static> getImageDimensions(src, callback)

  Utility function to get the dimensions of an image, caches results for best performance

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `src` | string | Image source URL
  `callback` | function | Callback to recieve image dimensions

  ##### Returns:

  Type
    void

#### <static> getMapByID(id)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `id` | mixed | The ID of the map to retrieve

  ##### Returns:

  The map object, or null if no such map exists
  Type
    object

#### <static> getScrollAnimationOffset()

  Override this method to add a scroll offset when using animated scroll, useful for sites with fixed headers.

  ##### Returns:

  The scroll offset
  Type
    number

#### <static> guid()

  Generates and returns a GUID

  ##### Returns:

  The GUID
  Type
    string

#### <static> hexOpacityToRGBA(colour, opacity)

  Takes a hex string and opacity value and converts it to Openlayers RGBA format

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `colour` | string | The hex color string
  `opacity` | number | The opacity from 0.0 - 1.0

  ##### Returns:

  RGBA array where color components are 0 - 255 and opacity is 0.0 - 1.0
  Type
    array

#### <static> hexToRgba(hex)

  Takes a hex color string and converts it to an RGBA object.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `hex` | string | The hex color string

  ##### Returns:

  Object with r, g, b and a properties, or 0 if the input is invalid.
  Type
    object

#### <static> isDeveloperMode()

  Returns true if developer mode is set or if developer mode cookie is set

  ##### Returns:

  True if developer mode is on
  Type
    boolean

#### <static> isDeviceiOS()

  Makes an educated guess whether the browser is running on an iOS device

  ##### Returns:

  True if it's likely the browser is running on an iOS device
  Type
    boolean

#### <static> isGoogleAutocompleteSupported()

  Shorthand function to determine if the Places Autocomplete is available

  ##### Returns:

  True if the places autocomplete is available
  Type
    boolean

#### <static> isLatLngString(str)

  Utility function returns true is string is a latitude and longitude

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `str` | string | The string to attempt to parse as coordinates

  Deprecated:
    - Moved to WPGMZA.LatLng.isLatLngString

  ##### Returns:

  the matched latitude and longitude or null if no match
  Type
    array

#### <static> isModernComponentStyleAllowed()

  This function prevents modern style components being used with new UI styles (8.0.0)

  ##### Returns:

  True if modern or legacy style is selected, or no UI style is selected
  Type
    boolean

#### <static> isProVersion()

  Returns true if the Pro add-on is active

  ##### Returns:

  True if the Pro add-on is active
  Type
    boolean

#### <static> isSafari()

  Makes an educated guess as to whether the browser is Safari

  ##### Returns:

  True if it's likely the browser is Safari
  Type
    boolean

#### <static> isTouchDevice()

  Makes an educated guess as to whether the browser is running on a touch device

  ##### Returns:

  True if it's likely the browser is running on a touch device
  Type
    boolean

#### <static> openMediaDialog(callback)

  Opens the WP media dialog and returns the result to a callback

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | function | Callback to recieve the attachment ID as the first parameter and URL as the second

  ##### Returns:

  Type
    void

#### <static> rgbaToString(rgba)

  Takes an object with r, g, b and a properties and returns a CSS rgba color string

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `rgba` | string | The input object

  ##### Returns:

  The CSS rgba color string
  Type
    string

#### <static> runCatchableTask(callback, friendlyErrorContainer)

  Runs a catchable task and displays a friendly error if the function throws an error

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | function | The function to run
  `friendlyErrorContainer` | HTMLElement | The container element to hold the error

  See:
    - WPGMZA.FriendlyError

  ##### Returns:

  Type
    void

#### <static> stringToLatLng(str)

  Utility function returns a latLng literal given a valid latLng string

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `str` | string | The string to attempt to parse as coordinates

  ##### Returns:

  LatLng literal
  Type
    object

#### <static> stringToLatLng(str)

  Utility function returns a latLng literal given a valid latLng string

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `str` | string | The string to attempt to parse as coordinates

  ##### Returns:

  LatLng literal
  Type
    object

#### Search results