forked from mappiamo/mapi-geoCMS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mappiamo.php
75 lines (55 loc) · 1.86 KB
/
mappiamo.php
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
<?php
/**
* @package #mappiamo
* @version 0.0.6
* @author Berross s.r.o. <hello@mappiamo.com>
* @copyright Copyright (C) 2015 Berross s.r.o. All rights reserved.
* @license GNU/GPL, see LICENSE
*
* #mappiamo is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT for copyright notices and CREDITS for credits details.
*/
// no direct access to this file
defined( 'DACCESS' ) or die;
class Mappiamo {
public function __construct() {
$SysConf = new MSettings();
if (is_array($SysConf::$coords)) {
global $coords;
$coords['lat'] = $SysConf::$coords['lat'];
$coords['lng'] = $SysConf::$coords['lng'];
} elseif (isset($SysConf::$location)) {
if ( MValidate::address( $SysConf::$location ) ) {
global $geocoder;
global $coords;
try {
$geocode = $geocoder->geocode( $SysConf::$location );
$coords['lat'] = $geocode->getLatitude();
$coords['lng'] = $geocode->getLongitude();
} catch( Exception $e ) {
}
}
} else {
if ( MValidate::address( MSettings::$location ) ) {
global $geocoder;
global $coords;
try {
$geocode = $geocoder->geocode( MSettings::$location );
$coords['lat'] = $geocode->getLatitude();
$coords['lng'] = $geocode->getLongitude();
} catch( Exception $e ) {
}
}
}
$routing = new M_Route();
$module = new M_Module();
$module_instance = $module->instance( $routing->get_module(), $routing->get_task(), $routing->get_object() );
$template = new M_Template();
$template_instance = $template->instance( $module_instance );
}
}
new Mappiamo();
?>