You are here

function _gmap_prepare in GMap Module 5

Same name and namespace in other branches
  1. 6.2 gmap.module \_gmap_prepare()
  2. 6 gmap.module \_gmap_prepare()
  3. 7.2 gmap.module \_gmap_prepare()
  4. 7 gmap.module \_gmap_prepare()

Handle filter preparation.

1 call to _gmap_prepare()
gmap_filter in ./gmap.module
Implementation of hook_filter().

File

./gmap.module, line 378
GMap -- Routines to use the Google Maps API in Drupal.

Code

function _gmap_prepare($intext) {
  $out = FALSE;
  $matches = array();
  preg_match_all('/\\[gmap([^\\[\\]]+ )* \\] /x', $intext, $matches);
  $i = 0;
  while (isset($matches[1][$i])) {
    $out[0][$i] = $matches[0][$i];
    if ($matches[1][$i][0] == '1') {
      $ver = 1;
      $matches[1][$i] = substr($matches[0][$i], 1);
    }
    else {
      $ver = 2;
    }
    $map = array(
      '#settings' => gmap_parse_macro($matches[1][$i], $ver),
    );
    $out[1][$i] = theme('gmap', $map);
    $i++;
  }

  // endwhile process macro
  return $out;
}