You are here

function getlocations_get_markerfile in Get Locations 7

Same name and namespace in other branches
  1. 6.2 getlocations.module \getlocations_get_markerfile()
  2. 6 getlocations.module \getlocations_get_markerfile()
  3. 7.2 getlocations.module \getlocations_get_markerfile()

Function to find and return the filesystem path and filename of the markers definition javascript file

3 calls to getlocations_get_markerfile()
getlocations_regenerate_markers in ./getlocations.module
Regenerate the markerdata file. adapted from gmap
getlocations_settings_form in ./getlocations.admin.inc
Function to display the getlocations admin settings form
getlocations_setup_js in ./getlocations.module
Function to setup the map scripts

File

./getlocations.module, line 2250
getlocations.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function getlocations_get_markerfile($dir = FALSE, $check = TRUE) {
  if (file_default_scheme() != 'public') {

    // private
    $markerpath = '';
    $markerfile = variable_get('getlocations_private_markerfile', '');
    if ($markerfile && preg_match("~^(.*)/getlocations_markers.js~", $markerfile, $matches)) {
      $markerpath = $matches[1];
    }
  }
  else {
    $markerpath = file_stream_wrapper_get_instance_by_scheme(file_default_scheme())
      ->getDirectoryPath() . '/getlocations';
    $markerfile = '';
    if ($markerpath) {
      $markerfile = $markerpath . '/getlocations_markers.js';
    }
  }
  if ($dir && $markerpath) {
    if ($check) {
      if (file_exists($markerpath)) {
        return $markerpath;
      }
    }
    else {
      return $markerpath;
    }
  }
  elseif ($markerfile) {
    if ($check) {
      if (file_exists($markerfile)) {
        return $markerfile;
      }
    }
    else {
      return $markerfile;
    }
  }
  return FALSE;
}