|
1
|
|
|
<?php |
|
2
|
|
|
namespace Clubdeuce\WPLib\Components; |
|
3
|
|
|
|
|
4
|
|
|
use Clubdeuce\WPLib\Components\GoogleMaps\Map; |
|
5
|
|
|
use Clubdeuce\WPLib\Components\GoogleMaps\Marker; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Class Google_Maps |
|
9
|
|
|
* @package Clubdeuce\WPLib\Components |
|
10
|
|
|
* |
|
11
|
|
|
* @mixin \Clubdeuce\WPGoogleMaps\Google_Maps |
|
12
|
|
|
*/ |
|
13
|
|
|
class Google_Maps extends \WPLib_Module_Base { |
|
14
|
|
|
|
|
15
|
|
|
const INSTANCE_CLASS = 'Clubdeuce\WPLib\Components\GoogleMaps\Map'; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* @var string |
|
19
|
|
|
*/ |
|
20
|
|
|
protected static $_version = '0.1.7'; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* |
|
24
|
|
|
*/ |
|
25
|
1 |
|
static function on_load() { |
|
26
|
|
|
|
|
27
|
1 |
|
require_once 'vendor/autoload.php'; |
|
28
|
1 |
|
require_once 'includes/class-model-base.php'; |
|
29
|
1 |
|
self::register_helper( '\Clubdeuce\WPGoogleMaps\Google_Maps', __CLASS__ ); |
|
30
|
1 |
|
\Clubdeuce\WPGoogleMaps\Google_Maps::initialize(); |
|
31
|
|
|
|
|
32
|
1 |
|
} |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @param array $args |
|
36
|
|
|
* @return Map |
|
37
|
|
|
*/ |
|
38
|
1 |
|
static function make_new_map( $args = array() ) { |
|
39
|
|
|
|
|
40
|
1 |
|
$class = static::INSTANCE_CLASS; |
|
41
|
1 |
|
return new $class( $args ); |
|
42
|
|
|
|
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @param $address |
|
47
|
|
|
* @param array $args |
|
48
|
|
|
* |
|
49
|
|
|
* @return Marker |
|
50
|
|
|
*/ |
|
51
|
2 |
|
static function make_marker_by_address( $address, $args = array() ) { |
|
52
|
|
|
|
|
53
|
2 |
|
$marker = \Clubdeuce\WPGoogleMaps\Google_Maps::make_marker_by_address( $address, $args ); |
|
54
|
2 |
|
return new Marker( array_merge( array( 'marker' => $marker ), $args ) ); |
|
55
|
|
|
|
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @param float $lat |
|
60
|
|
|
* @param float $lng |
|
61
|
|
|
* @param array $args |
|
62
|
|
|
* |
|
63
|
|
|
* @return Marker |
|
64
|
|
|
*/ |
|
65
|
2 |
|
static function make_marker_by_position( $lat, $lng, $args = array() ) { |
|
66
|
|
|
|
|
67
|
2 |
|
$marker = \Clubdeuce\WPGoogleMaps\Google_Maps::make_marker_by_position( $lat, $lng, $args ); |
|
68
|
2 |
|
return new Marker( array_merge( array( 'marker' => $marker ), $args ) ); |
|
69
|
|
|
|
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
Google_Maps::on_load(); |
|
74
|
|
|
|