You are here

function legacy__gmap_parse_style in GMap Module 7.2

Parse a macro style definition.

Example: #111111/1/100/#111111/1 @internal

1 call to legacy__gmap_parse_style()
legacy__gmap_parse_macro in tests/inc/gmap_parse_macro.inc

File

tests/inc/gmap_parse_macro.inc, line 19
GMap macro parsing routines.

Namespace

tests\inc

Code

function legacy__gmap_parse_style($style) {
  if (strpos($style, '/') === FALSE) {

    // Style ref.
    return $style;
  }
  $styles = explode('/', $style);

  // @@@ Todo: Fix up old xmaps stuff.
  // Possibly detect by looking for array length 7?
  // Strip off # signs, they get added by code.
  if (isset($styles[0]) && substr($styles[0], 0, 1) == '#') {
    $styles[0] = substr($styles[0], 1);
  }
  if (isset($styles[3]) && substr($styles[3], 0, 1) == '#') {
    $styles[3] = substr($styles[3], 1);
  }

  // Assume anything > 0 and < 1.1 was an old representation.
  if ($styles[2] > 0 && $styles[2] < 1.1) {
    $styles[2] = $styles[2] * 100;
  }
  if (isset($styles[4])) {
    if ($styles[4] > 0 && $styles[4] < 1.1) {
      $styles[4] = $styles[4] * 100;
    }
  }
  return $styles;
}