forked from hr-it-solutions/DD_J_mod_gmaps_module
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod_dd_gmaps_module.php
More file actions
76 lines (60 loc) · 2.19 KB
/
mod_dd_gmaps_module.php
File metadata and controls
76 lines (60 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
/**
* @package DD_GMaps_Module
*
* @author HR-IT-Solutions GmbH Florian Häusler <info@hr-it-solutions.com>
* @copyright Copyright (C) 2011 - 2019 HR-IT-Solutions GmbH
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
**/
defined('_JEXEC') or die;
JLoader::register('ModDD_GMaps_Module_Helper', __DIR__ . '/helper.php');
$app = JFactory::getApplication();
// Multiload prevention todo J3.8
if (false)
{
$app->enqueueMessage(
JText::_('MOD_DD_GMAPS_MODULE_WARNUNG_MODUL_EXISTS_ALREADY'), 'warning'
);
return false;
}
// Check if plugin geocode is enabled
if (!JPluginHelper::getPlugin('system', 'dd_gmaps_locations_geocode'))
{
$app->enqueueMessage(
JText::_('MOD_DD_GMAPS_MODULE_WARNING_GEOCODE_PLUGIN_MUST_BE_ENABLED'), 'warning'
);
}
// API key (try loading default from component)
if (ModDD_GMaps_Module_Helper::existsDDGMapsLocations())
{
$API_Key = $params->get('google_api_key_js_places', JComponentHelper::getParams('com_dd_gmaps_locations')->get('google_api_key_js_places'));
if (empty($API_Key))
{
$app->enqueueMessage(
JText::_('MOD_DD_GMAPS_MODULE_API_KEY_REQUIRED_COMPONENT'), 'warning'
);
}
}
else
{
$API_Key = $params->get('google_api_key_js_places', '');
if (empty($API_Key))
{
$app->enqueueMessage(
JText::_('MOD_DD_GMAPS_MODULE_API_KEY_REQUIRED'), 'warning'
);
}
}
$Places_API = 'js?&libraries=places&v=3';
$mapsScript = 'https://maps.google.com/maps/api/' . $Places_API . '&key=' . $API_Key;
$doc = JFactory::getDocument();
if (!$params->get('eu_privay_mode') && !ModDD_GMaps_Module_Helper::isset_Script($doc->_scripts, $Places_API))
{
JHTML::_('script', $mapsScript, array('relative' => false));
}
JHTML::_('script', 'mod_dd_gmaps_module/markerclusterer_compiled.min.js', array('version' => 'auto', 'relative' => true));
JHTML::_('script', 'mod_dd_gmaps_module/dd_gmaps_module.min.js', array('version' => 'auto', 'relative' => true));
require_once "modules/mod_dd_gmaps_module/inc/scriptheader.js.php";
// Check for a custom CSS file
JHtml::_('stylesheet', 'mod_dd_gmaps_module/user.css', array('version' => 'auto', 'relative' => true));
require_once JModuleHelper::getLayoutPath('mod_dd_gmaps_module', $params->get('layout', 'default'));