function geophp_load in geoPHP 8
Same name and namespace in other branches
- 7 geophp.module \geophp_load()
Loads the geoPHP library.
Return value
Returns the filename of the included geoPHP library when successful, FALSE otherwise.
1 call to geophp_load()
- geophp_requirements in ./
geophp.module - Implementation of hook_requirements().
File
- ./
geophp.module, line 14
Code
function geophp_load() {
static $static_cache = FALSE;
$already_found = FALSE;
if (!$static_cache) {
// Edge case: Another module (likely Geofield) has already loaded the class from somewhere else.
if (class_exists('geoPHP')) {
$static_cache = TRUE;
$already_found = TRUE;
}
if (\Drupal::moduleHandler()
->moduleExists('libraries')) {
$path = libraries_get_path('geoPHP');
$file = $path . '/geoPHP.inc';
if (file_exists($file) && $static_cache !== TRUE) {
include_once $file;
$already_found = TRUE;
}
$static_cache = $file;
}
// If other options don't exist, load module's copy of geoPHP.
if (!$already_found) {
$path = drupal_get_path('module', 'geophp');
$file = $path . '/geoPHP/geoPHP.inc';
if (file_exists($file)) {
include_once $file;
$static_cache = $file;
}
}
}
return $static_cache;
}