You are here

function openlayers_ui_version_check in Openlayers 7.2

Callback endpoint for sending in OL version from client JS.

4 string references to 'openlayers_ui_version_check'
openlayers_requirements in ./openlayers.install
Implements hook_requirements().
openlayers_ui_admin_settings in modules/openlayers_ui/includes/openlayers_ui.admin.inc
Menu callback; displays the openlayers module settings page.
openlayers_ui_init in modules/openlayers_ui/openlayers_ui.module
Implements hook_init().
openlayers_ui_menu in modules/openlayers_ui/openlayers_ui.module
Implements hook_menu

File

modules/openlayers_ui/includes/openlayers_ui.admin.inc, line 139
This file holds the functions for the main openlayers Admin settings.

Code

function openlayers_ui_version_check($version = 0) {
  $version = check_plain($version);

  // Set variable with version for hook_requirements
  // and so we dont do this on every page load.
  variable_set('openlayers_ui_version_check', $version);

  // Do a basic check
  if (strpos($version, (string) OPENLAYERS_SUGGESTED_LIBRARY) !== FALSE) {
    $status = 'valid';
    $message = t('Valid library found with a Javascript client check; version: %version', array(
      '%version' => $version,
    ));
  }
  else {
    $status = 'invalid';
    $message = t('Could not find a valid library with a Javascript client-side check;  Value found: %version.  Please visit the !settings for more details.', array(
      '%version' => $version,
      '!settings' => l(t('OpenLayers settings page'), 'admin/structure/openlayers'),
    ));
  }

  // Kind of a hack, but since we are using messages for this, let's clear the
  // messages queue out.
  $messages = drupal_get_messages();

  // We just want to send some markup back.
  drupal_json_output(array(
    'status' => $status,
    'response' => $message,
  ));
}