You are here

gm3.install in Google Maps API V3 7

File

gm3.install
View source
<?php

/**
 * Implementation of hook_requirements().
 * 
 * Thanks to the geofield module for a large portion (ALL) of this code.
 * 
 * FIXME - This should actually be moved to the gm3_region module, although it
 * should probably be used in this module too.
 */
function gm3_requirements($phase) {
  module_load_include('module', 'gm3');
  $geophp = gm3_load_geophp();
  if ($geophp) {
    try {
      $geophp_version = geoPHP::version();
    } catch (Exception $e) {
      $geophp_version = 0;
    }
    if ($geophp_version >= 0.4) {
      return array(
        'gm3_geophp' => array(
          'title' => t('GeoPHP Library'),
          'severity' => REQUIREMENT_OK,
          'value' => $geophp_version,
        ),
      );
    }
    elseif ($geophp_version >= 0.3) {
      return array(
        'gm3_geophp' => array(
          'title' => t('GeoPHP Library'),
          'severity' => REQUIREMENT_INFO,
          'value' => $geophp_version,
          'description' => t('GeoPHP library was found, but you are running an old version. The version you are running is compatible, but it is not current, possibly leading to problems.'),
        ),
      );
    }
    else {
      return array(
        'gm3_geophp' => array(
          'title' => t('GeoPHP Library'),
          'severity' => REQUIREMENT_ERROR,
          'value' => $geophp_version,
          'description' => t('GeoPHP library was found, but you are running an old version. This will lead to problems when working with GM3. Please download %link and update.', array(
            '%link' => 'https://github.com/downloads/phayes/geoPHP/geoPHP.tar.gz',
          )),
        ),
      );
    }
  }
  else {
    return array(
      'gm3_geophp' => array(
        'title' => t('GeoPHP Library'),
        'severity' => REQUIREMENT_ERROR,
        'description' => t('GeoPHP library was not found. This will lead to problems when working with GM3. Please download from %link and install.', array(
          '%link' => 'https://github.com/downloads/phayes/geoPHP/geoPHP.tar.gz',
        )),
      ),
    );
  }
}

Functions

Namesort descending Description
gm3_requirements Implementation of hook_requirements().