You are here

function _gmap_get_marker_titles in GMap Module 5

Same name and namespace in other branches
  1. 6.2 gmap_markerinfo.inc \_gmap_get_marker_titles()
  2. 6 gmap_markerinfo.inc \_gmap_get_marker_titles()
  3. 7.2 gmap_markerinfo.inc \_gmap_get_marker_titles()
  4. 7 gmap_markerinfo.inc \_gmap_get_marker_titles()
1 call to _gmap_get_marker_titles()
gmap_get_marker_titles in ./gmap.module
Get the list of marker titles.

File

./gmap_markerinfo.inc, line 217
GMap marker information routines.

Code

function _gmap_get_marker_titles() {
  $markerdir = variable_get('gmap_markerfiles', drupal_get_path('module', 'gmap') . '/markers');

  // The following routines are designed to be easy to comprehend, not fast.
  // This whole process gets cached.
  // Get the ini files.
  $inifiles = file_scan_directory($markerdir, '.*\\.ini$');

  // Parse the ini files and store by path
  $inis = array();
  foreach ($inifiles as $file) {
    $data = parse_ini_file($file->filename, TRUE);
    if (isset($data['defaults'])) {

      // Ignore defaults
      unset($data['defaults']);
    }
    foreach ($data as $k => $v) {
      if (strpos($k, '.') !== FALSE) {

        // Ignore files
        unset($data[$k]);
      }
    }
    $inis[] = $data;
  }
  unset($inifiles);
  $titles = array();
  foreach ($inis as $ini => $inidata) {
    foreach ($inidata as $k => $v) {
      $titles[$k] = t($inis[$ini][$k]['name']);
    }
  }
  return $titles;
}