You are here

function _getlocations_get_marker_titles in Get Locations 7.2

Same name and namespace in other branches
  1. 6.2 getlocations.markerinfo.inc \_getlocations_get_marker_titles()
  2. 6 getlocations.markerinfo.inc \_getlocations_get_marker_titles()
  3. 7 getlocations.markerinfo.inc \_getlocations_get_marker_titles()
1 call to _getlocations_get_marker_titles()
getlocations_get_marker_titles in ./getlocations.module
Get the list of marker titles. adapted from gmap

File

./getlocations.markerinfo.inc, line 227
getlocations.markerinfo.inc @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function _getlocations_get_marker_titles() {

  // The following routines are designed to be easy to comprehend, not fast.
  // This whole process gets cached.
  $inis = array();
  $markerdirs = module_invoke_all('getlocations_markerdir');
  foreach ($markerdirs as $markerdir) {

    // Get the ini files.
    $inifiles = file_scan_directory($markerdir, '/.*\\.ini$/');

    // Parse the ini files and store by path
    foreach ($inifiles as $file) {
      $data = parse_ini_file($file->uri, 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;
}