You are here

function _gmap_parse_style in GMap Module 6.2

Same name and namespace in other branches
  1. 5 gmap_parse_macro.inc \_gmap_parse_style()
  2. 6 gmap_parse_macro.inc \_gmap_parse_style()
  3. 7.2 gmap_parse_macro.inc \_gmap_parse_style()
  4. 7 gmap_parse_macro.inc \_gmap_parse_style()

Parse a macro style definition. Example: #111111/1/100/#111111/1 @internal

1 call to _gmap_parse_style()
_gmap_parse_macro in ./gmap_parse_macro.inc

File

./gmap_parse_macro.inc, line 14
GMap macro parsing routines.

Code

function _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;
}