Overview

Namespaces

  • None
  • WPGMZA
    • Integration
    • Selector

Classes

  • AutoLoader
  • Crud
  • DOMDocument
  • DOMElement
  • Factory
  • GDPRCompliance
  • GoogleGeocoder
  • GoogleMap
  • GoogleMapsAPILoader
  • GoogleMapsLoader
  • LatLng
  • Map
  • MapsEngineDialog
  • Marker
  • ModalDialog
  • NominatimGeocodeCache
  • OLLoader
  • Plugin
  • RestAPI
  • ScriptLoader
  • Strings

Functions

  • create_marker_instance_delegate
  • create_plugin_instance
  • query_nominatim_cache
  • store_nominatim_cache
  • Overview
  • Namespace
  • Class

Class GoogleMapsAPILoader

This class handles loading the Google Maps API and the conditional settings associated with that (load API conditions, exclude pages, etc.)

Namespace: WPGMZA
Deprecated: This class will be merged into GoogleLoader, the API conditionality mechanisms will be abstracted to APILoader for use with OpenLayers
Located at class.google-maps-api-loader.php
Methods summary
public
# __construct( )

Constructor

Constructor

protected array
# getGoogleMapsAPIParams( )

Gets the parameters to be sent to the Google Maps API load call

Gets the parameters to be sent to the Google Maps API load call

Returns

array
Key value parameters to be passed to the Google API URL
public
# registerGoogleMaps( )

This function loads the Google API if it hasn't been called already

This function loads the Google API if it hasn't been called already

public
# enqueueGoogleMaps( )

This function will enqueue the Google Maps API, if the conditions to include it are met. Otherwise, this function will do nothing.

This function will enqueue the Google Maps API, if the conditions to include it are met. Otherwise, this function will do nothing.

public boolean
# isPageIncluded( integer $page_id )

Checks whether the specified page ID has been explicitly included in the plugin settings

Checks whether the specified page ID has been explicitly included in the plugin settings

Parameters

$page_id
The page / post ID.

Returns

boolean
Whether or not the user has explicitly stated to include the API on this page.
public boolean
# isPageExcluded( integer $page_id )

Checks whether the specified page ID has been explicitly excluded in the plugin settings

Checks whether the specified page ID has been explicitly excluded in the plugin settings

Parameters

$page_id
The page / post ID.

Returns

boolean
Whether or not the user has explicitly stated to exclude the API on this page.
public boolean
# isIncludeAllowed( string & $status = null )

Checks if including the Google API is allowed, based on all the relevant settings.

Checks if including the Google API is allowed, based on all the relevant settings.

Parameters

$status
$status Reference to a string to store the resulting status in.

Returns

boolean
Whether or not it is permitted to include the API on this page, based on the current settings.
public string
# preventOtherGoogleMapsTag( string $tag, string $handle, string $src )

This function hooks into script_loader_tag. If any other plugin or the theme has enqueued a script containing "maps.google", an empty string will be returned, preventing that script loader tag from being rendered. Only the script with the handle wpgmza_api_call will be allowed through. This can be bound using the "prevent other plugins and theme loading maps API" setting.

This function hooks into script_loader_tag. If any other plugin or the theme has enqueued a script containing "maps.google", an empty string will be returned, preventing that script loader tag from being rendered. Only the script with the handle wpgmza_api_call will be allowed through. This can be bound using the "prevent other plugins and theme loading maps API" setting.

Parameters

$tag
The full script tag
$handle
The handle the script was enqueued with
$src
The URL to the script file

Returns

string
Either $tag where permitted, or an empty string if this function should block
public string
# getSettingsHTML( )

Gets the HTML for the settings panel for this module, which appears in the general settings tab.

Gets the HTML for the settings panel for this module, which appears in the general settings tab.

Returns

string
The HTML string for the settings panel
Constants summary
string REMOVE_API_CHECKED

Const

Status code when the user has selected "Do not load Google Maps API"
# 'REMOVE_API_CHECKED'
string USER_CONSENT_NOT_GIVEN

Const

Status code when the user has not given GDPR consent, where it is required
# 'USER_CONSENT_NOT_GIVEN'
string ENGINE_NOT_GOOGLE_MAPS

Const

Status code when the selected maps engine is not Google Maps
# 'ENGINE_NOT_GOOGLE_MAPS'
string PAGE_EXPLICITLY_INCLUDED

Const

Status code when the current page ID has been explicitly included in the load settings
# 'PAGE_EXPLICITLY_INCLUDED'
string PAGE_EXPLICITLY_EXCLUDED

Const

Status code when the current page ID has been explicitly excluded in the load settings
# 'PAGE_EXPLICITLY_EXCLUDED'
string NEVER_LOAD_API_SELECTED

Const

Status code when the "Never" option has been selected in the load API condition setting
# 'NEVER_LOAD_API_SELECTED'
string ONLY_LOAD_FRONT_END_SELECTED

Const

Status code when the "Front End Only" option has been selected in the load API condition setting
# 'ONLY_LOAD_FRONT_END_SELECTED'
string ONLY_LOAD_BACK_END_SELECTED

Const

Status code when the "Back End Only" option has been selected in the load API condition setting
# 'ONLY_LOAD_BACK_END_SELECTED'
string ENQUEUED

Const

Status code when class has attempted to enqueue the API. Please note that this does not necessarily guarantee it was successful in doing so, just that the conditions to enqueue were met.
# 'ENQUEUED'
API documentation generated by ApiGen