PluginProbe ʕ •ᴥ•ʔ
Premium Addons for Elementor – Powerful Elementor Templates & Widgets / 4.1.0
Premium Addons for Elementor – Powerful Elementor Templates & Widgets v4.1.0
4.11.79 4.11.78 4.11.77 4.11.76 4.11.75 3.20.5 4.11.69 3.20.6 4.11.7 3.20.7 4.11.70 3.20.8 4.11.71 3.20.9 4.11.72 3.21.1 4.11.73 3.21.2 4.11.74 3.21.3 4.11.8 3.21.4 4.11.9 3.21.5 4.2.0 3.21.6 4.2.1 3.3.0 4.2.2 3.3.1 4.2.3 3.3.2 4.2.4 3.3.3 4.2.5 3.3.4 4.2.6 3.3.5 4.2.7 3.3.6 4.2.8 3.3.7 4.2.9 3.3.8 4.3.0 3.3.9 4.3.1 3.4.0 4.3.2 3.4.1 4.3.3 3.4.2 4.3.4 3.4.3 4.3.5 3.4.4 4.3.6 3.4.5 4.3.7 3.4.6 4.3.8 3.4.7 4.3.9 3.4.8 4.4.0 3.4.9 4.4.1 3.5.0 4.4.2 3.5.1 4.4.3 3.5.2 4.4.4 3.5.3 4.4.5 3.5.4 4.4.6 3.5.5 4.4.7 3.5.6 4.4.8 3.5.7 4.4.9 3.5.8 4.5.0 3.5.9 4.5.1 3.6.0 4.5.2 3.6.1 4.5.3 3.6.2 4.5.4 3.6.3 4.5.5 3.6.4 4.5.6 3.6.5 4.5.7 3.6.6 4.5.8 3.6.7 4.5.9 3.6.8 4.6.0 3.6.9 4.6.1 3.7.0 4.7.0 3.7.1 4.7.1 3.7.2 4.7.2 3.7.3 4.7.3 3.7.4 4.7.4 3.7.5 4.7.5 3.7.6 4.7.6 3.7.7 4.7.7 3.7.8 4.7.8 3.7.9 4.7.9 3.8.0 4.8.0 3.8.1 4.8.1 3.8.2 4.8.10 3.8.3 4.8.11 3.8.4 4.8.2 3.8.5 4.8.3 3.8.6 4.8.4 3.8.7 4.8.5 3.8.8 4.8.6 3.8.9 4.8.7 3.9.0 4.8.8 3.9.1 4.8.9 3.9.2 4.9.0 3.9.3 4.9.0-beta1 3.9.4 4.9.0-beta2 3.9.5 4.9.1 3.9.6 4.9.10 3.9.7 4.9.11 3.9.8 4.9.12 3.9.9 4.9.13 4.0.1 4.9.14 4.0.3 4.9.15 4.0.4 4.9.16 4.0.5 4.9.17 4.0.6 4.9.18 4.0.7 4.9.19 4.0.8 4.9.2 4.0.9 4.9.20 4.1.0 4.9.21 4.1.1 4.9.22 4.1.2 4.9.23 4.1.3 4.9.24 trunk 4.1.4 4.9.25 1.0 4.1.5 4.9.26 1.01 4.1.6 4.9.27 1.02 4.1.7 4.9.28 1.03 4.1.8 4.9.29 1.04 4.1.9 4.9.3 1.05 4.10.0 4.9.30 1.06 4.10.1 4.9.31 1.07 4.10.10 4.9.32 1.08 4.10.11 4.9.33 1.09 4.10.12 4.9.34 2.0 4.10.13 4.9.35 2.0.1 4.10.14 4.9.36 2.0.2 4.10.15 4.9.37 2.0.3 4.10.16 4.9.38 2.0.4 4.10.17 4.9.39 2.0.5 4.10.18 4.9.4 2.0.6 4.10.19 4.9.40 2.0.7 4.10.2 4.9.41 2.0.8 4.10.20 4.9.42 2.0.9 4.10.21 4.9.43 2.1.0 4.10.22 4.9.45 2.1.1 4.10.23 4.9.46 2.1.2 4.10.24 4.9.47 2.1.3 4.10.25 4.9.48 2.1.4 4.10.26 4.9.49 2.1.5 4.10.27 4.9.5 2.1.5-beta1 4.10.28 4.9.50 2.1.6 4.10.29 4.9.51 2.1.7 4.10.3 4.9.52 2.1.8 4.10.30 4.9.53 2.1.9 4.10.31 4.9.54 2.2.0 4.10.32 4.9.55 2.2.1 4.10.33 4.9.56 2.2.2 4.10.34 4.9.57 2.2.3 4.10.35 4.9.6 2.2.4 4.10.36 4.9.7 2.2.5 4.10.37 4.9.8 2.2.6 4.10.38 4.9.9 2.2.7 4.10.39 2.2.8 4.10.4 2.2.9 4.10.40 2.3.0 4.10.41 2.3.1 4.10.42 2.3.2 4.10.43 2.3.3 4.10.44 2.3.4 4.10.45 2.3.5 4.10.46 2.3.6 4.10.47 2.3.7 4.10.48 2.3.8 4.10.49 2.3.9 4.10.5 2.4.0 4.10.50 2.4.1 4.10.51 2.5.0 4.10.52 2.5.1 4.10.53 2.5.2 4.10.54 2.5.3 4.10.55 2.5.4 4.10.56 2.5.5 4.10.57 2.5.6 4.10.58 2.5.7 4.10.59 2.5.8 4.10.6 2.5.9 4.10.60 2.6.0 4.10.61 2.6.1 4.10.62 2.6.2 4.10.63 2.6.3 4.10.64 2.6.4 4.10.65 2.6.5 4.10.66 2.6.6 4.10.67 2.6.7 4.10.68 2.6.8 4.10.69 2.6.9 4.10.7 2.7.0 4.10.70 2.7.1 4.10.71 2.7.2 4.10.72 2.7.3 4.10.73 2.7.4 4.10.74 2.7.5 4.10.75 2.7.6 4.10.76 2.7.7 4.10.77 2.7.8 4.10.78 2.7.9 4.10.79 2.8.0 4.10.8 2.8.1 4.10.80 2.8.2 4.10.81 2.8.3 4.10.82 2.8.4 4.10.83 2.8.5 4.10.84 2.8.6 4.10.85 2.8.7 4.10.86 2.8.8 4.10.87 2.8.9 4.10.88 2.9.0 4.10.89 2.9.1 4.10.9 2.9.2 4.10.90 2.9.3 4.11.0 2.9.4 4.11.1 2.9.5 4.11.10 2.9.6 4.11.11 2.9.7 4.11.12 2.9.8 4.11.13 2.9.9 4.11.14 3.0.0 4.11.15 3.0.1 4.11.16 3.0.2 4.11.17 3.0.3 4.11.18 3.0.4 4.11.19 3.0.5 4.11.2 3.0.6 4.11.20 3.0.7 4.11.21 3.0.8 4.11.22 3.0.9 4.11.23 3.1.0 4.11.24 3.1.1 4.11.25 3.1.2 4.11.26 3.1.3 4.11.27 3.1.4 4.11.28 3.1.5 4.11.29 3.1.6 4.11.3 3.1.7 4.11.30 3.1.8 4.11.31 3.1.9 4.11.32 3.10.0 4.11.33 3.10.1 4.11.34 3.10.2 4.11.35 3.10.3 4.11.36 3.10.4 4.11.37 3.10.5 4.11.38 3.10.6 4.11.39 3.10.7 4.11.4 3.10.8 4.11.40 3.10.9 4.11.41 3.11.0 4.11.42 3.11.1 4.11.43 3.11.2 4.11.44 3.11.3 4.11.45 3.11.4 4.11.46 3.11.5 4.11.47 3.11.6 4.11.48 3.11.7 4.11.49 3.11.8 4.11.5 3.11.9 4.11.50 3.12.0 4.11.51 3.12.1 4.11.52 3.12.2 4.11.53 3.12.3 4.11.54 3.2.0 4.11.55 3.2.1 4.11.56 3.2.2 4.11.57 3.2.3 4.11.58 3.2.4 4.11.59 3.2.5 4.11.6 3.2.6 4.11.60 3.2.7 4.11.61 3.2.8 4.11.62 3.2.9 4.11.63 3.20.0 4.11.64 3.20.1 4.11.65 3.20.2 4.11.66 3.20.3 4.11.67 3.20.4 4.11.68
premium-addons-for-elementor / widgets / premium-maps.php
premium-addons-for-elementor / widgets Last commit date
dep 5 years ago premium-banner.php 5 years ago premium-blog.php 5 years ago premium-button.php 5 years ago premium-carousel.php 5 years ago premium-contactform.php 5 years ago premium-countdown.php 5 years ago premium-counter.php 5 years ago premium-dual-header.php 5 years ago premium-fancytext.php 5 years ago premium-grid.php 5 years ago premium-icon-list.php 5 years ago premium-image-button.php 5 years ago premium-image-scroll.php 5 years ago premium-image-separator.php 5 years ago premium-lottie.php 5 years ago premium-maps.php 5 years ago premium-modalbox.php 5 years ago premium-person.php 5 years ago premium-pricing-table.php 5 years ago premium-progressbar.php 5 years ago premium-testimonials.php 5 years ago premium-title.php 5 years ago premium-videobox.php 5 years ago premium-vscroll.php 5 years ago
premium-maps.php
793 lines
1 <?php
2
3 /**
4 * Premium Google Maps.
5 */
6 namespace PremiumAddons\Widgets;
7
8 // Elementor Classes.
9 use Elementor\Widget_Base;
10 use Elementor\Controls_Manager;
11 use Elementor\Repeater;
12 use Elementor\Scheme_Color;
13 use Elementor\Scheme_Typography;
14 use Elementor\Group_Control_Border;
15 use Elementor\Group_Control_Typography;
16 use Elementor\Group_Control_Box_Shadow;
17
18 // PremiumAddons Classes.
19 use PremiumAddons\Admin\Includes\Admin_Helper;
20 use PremiumAddons\Includes\Helper_Functions;
21
22 if ( ! defined( 'ABSPATH' ) ) exit; // If this file is called directly, abort.
23
24 /**
25 * Class Premium_Maps
26 */
27 class Premium_Maps extends Widget_Base {
28
29 public function get_name() {
30 return 'premium-addon-maps';
31 }
32
33 public function is_reload_preview_required() {
34 return true;
35 }
36
37 public function get_title() {
38 return sprintf( '%1$s %2$s', Helper_Functions::get_prefix(), __('Google Maps', 'premium-addons-for-elementor') );
39 }
40
41 public function get_icon() {
42 return 'pa-maps';
43 }
44
45 public function get_categories() {
46 return [ 'premium-elements' ];
47 }
48
49 public function get_style_depends() {
50 return [
51 'premium-addons'
52 ];
53 }
54
55 public function get_script_depends() {
56 return [
57 'google-maps-cluster',
58 'premium-maps-api-js',
59 'premium-maps-js'
60 ];
61 }
62
63 public function get_keywords() {
64 return [ 'google', 'marker', 'pin' ];
65 }
66
67 public function get_custom_help_url() {
68 return 'https://premiumaddons.com/support/';
69 }
70
71 /**
72 * Register Google Maps controls.
73 *
74 * @since 1.0.0
75 * @access protected
76 */
77 protected function _register_controls() {
78
79 $this->start_controls_section('premium_maps_map_settings',
80 [
81 'label' => __('Center Location', 'premium-addons-for-elementor'),
82 ]
83 );
84
85 $settings = Admin_Helper::get_integrations_settings();
86
87 if( empty( $settings['premium-map-api'] ) || '1' == $settings['premium-map-api'] ) {
88 $this->add_control('premium_maps_api_url',
89 [
90 'raw' => 'Premium Maps widget requires an API key. Get your API key from <a target="_blank" href="https://premiumaddons.com/docs/getting-your-api-key-for-google-reviews/">here</a> and add it to Premium Addons admin page. Go to Dashboard -> Premium Addons for Elementor -> Integrations tab',
91 'type' => Controls_Manager::RAW_HTML,
92 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
93 ]
94 );
95 }
96
97 $this->add_control('premium_map_ip_location',
98 [
99 'label' => __( 'Get User Location', 'premium-addons-for-elementor' ),
100 'description' => __('Get center location from visitor\'s location','premium-addons-for-elementor'),
101 'type' => Controls_Manager::SWITCHER,
102 'return_value' => 'true'
103 ]
104 );
105
106 $this->add_control('premium_map_location_finder',
107 [
108 'label' => __( 'Latitude & Longitude Finder', 'premium-addons-for-elementor' ),
109 'type' => Controls_Manager::SWITCHER,
110 'condition' => [
111 'premium_map_ip_location!' => 'true'
112 ]
113 ]
114 );
115
116 $this->add_control('premium_map_notice',
117 [
118 'label' => __( 'Find Latitude & Longitude', 'elementor' ),
119 'type' => Controls_Manager::RAW_HTML,
120 'raw' => '<form onsubmit="getAddress(this);" action="javascript:void(0);"><input type="text" id="premium-map-get-address" class="premium-map-get-address" style="margin-top:10px; margin-bottom:10px;"><input type="submit" value="Search" class="elementor-button elementor-button-default" onclick="getAddress(this)"></form><div class="premium-address-result" style="margin-top:10px; line-height: 1.3; font-size: 12px;"></div>',
121 'label_block' => true,
122 'condition' => [
123 'premium_map_location_finder' => 'yes',
124 'premium_map_ip_location!' => 'true'
125 ]
126 ]
127 );
128
129
130 $this->add_control('premium_maps_center_lat',
131 [
132 'label' => __('Center Latitude', 'premium-addons-for-elementor'),
133 'type' => Controls_Manager::TEXT,
134 'dynamic' => [ 'active' => true ],
135 'description' => __('Center latitude and longitude are required to identify your location', 'premium-addons-for-elementor'),
136 'default' => '18.591212',
137 'label_block' => true,
138 'condition' => [
139 'premium_map_ip_location!' => 'true'
140 ]
141 ]
142 );
143
144 $this->add_control('premium_maps_center_long',
145 [
146 'label' => __('Center Longitude', 'premium-addons-for-elementor'),
147 'type' => Controls_Manager::TEXT,
148 'dynamic' => [ 'active' => true ],
149 'description' => __('Center latitude and longitude are required to identify your location', 'premium-addons-for-elementor'),
150 'default' => '73.741261',
151 'label_block' => true,
152 'condition' => [
153 'premium_map_ip_location!' => 'true'
154 ]
155 ]
156 );
157
158 $this->end_controls_section();
159
160 $this->start_controls_section('premium_maps_map_pins_settings',
161 [
162 'label' => __('Markers', 'premium-addons-for-elementor'),
163 ]
164 );
165
166 $this->add_control('premium_maps_markers_width',
167 [
168 'label' => __('Max Width', 'premium-addons-for-elementor'),
169 'type' => Controls_Manager::NUMBER,
170 'title' => __('Set the Maximum width for markers description box','premium-addons-for-elementor'),
171 ]
172 );
173
174 $repeater = new REPEATER();
175
176 $repeater->add_control('pin_icon',
177 [
178 'label' => __('Custom Icon', 'premium-addons-for-elementor'),
179 'type' => Controls_Manager::MEDIA,
180 'dynamic' => [ 'active' => true ],
181 ]
182 );
183
184 $repeater->add_control('pin_icon_size',
185 [
186 'label' => __( 'Size', 'premium-addons-for-elementor' ),
187 'type' => Controls_Manager::SLIDER,
188 'size_units' => ['px', 'em'],
189 'range' => [
190 'px' => [
191 'min' => 1,
192 'max' => 200,
193 ],
194 'em' => [
195 'min' => 1,
196 'max' => 20,
197 ]
198 ]
199 ]
200 );
201
202 $repeater->add_control('premium_map_pin_location_finder',
203 [
204 'label' => __( 'Latitude & Longitude Finder', 'premium-addons-for-elementor' ),
205 'type' => Controls_Manager::SWITCHER,
206 ]
207 );
208
209 $repeater->add_control('premium_map_pin_notice',
210 [
211 'label' => __( 'Find Latitude & Longitude', 'elementor' ),
212 'type' => Controls_Manager::RAW_HTML,
213 'raw' => '<form onsubmit="getPinAddress(this);" action="javascript:void(0);"><input type="text" id="premium-map-get-address" class="premium-map-get-address" style="margin-top:10px; margin-bottom:10px;"><input type="submit" value="Search" class="elementor-button elementor-button-default" onclick="getPinAddress(this)"></form><div class="premium-address-result" style="margin-top:10px; line-height: 1.3; font-size: 12px;"></div>',
214 'label_block' => true,
215 'condition' => [
216 'premium_map_pin_location_finder' => 'yes'
217 ]
218 ]
219 );
220
221 $repeater->add_control('map_latitude',
222 [
223 'label' => __('Latitude', 'premium-addons-for-elementor'),
224 'type' => Controls_Manager::TEXT,
225 'dynamic' => [ 'active' => true ],
226 'description' => 'Click <a href="https://www.latlong.net/" target="_blank">here</a> to get your location coordinates',
227 'label_block' => true,
228 ]
229 );
230
231 $repeater->add_control('map_longitude',
232 [
233 'name' => 'map_longitude',
234 'label' => __('Longitude', 'premium-addons-for-elementor'),
235 'type' => Controls_Manager::TEXT,
236 'dynamic' => [ 'active' => true ],
237 'description' => 'Click <a href="https://www.latlong.net/" target="_blank">here</a> to get your location coordinates',
238 'label_block' => true,
239 ]
240 );
241
242 $repeater->add_control('pin_title',
243 [
244 'label' => __('Title', 'premium-addons-for-elementor'),
245 'type' => Controls_Manager::TEXT,
246 'dynamic' => [ 'active' => true ],
247 'label_block' => true,
248 ]
249 );
250
251 $repeater->add_control('pin_desc',
252 [
253 'label' => __('Description', 'premium-addons-for-elementor'),
254 'type' => Controls_Manager::WYSIWYG,
255 'dynamic' => [ 'active' => true ],
256 'label_block' => true,
257 ]
258 );
259
260 $this->add_control('premium_maps_map_pins',
261 [
262 'label' => __('Map Pins', 'premium-addons-for-elementor'),
263 'type' => Controls_Manager::REPEATER,
264 'default' => [
265 'map_latitude' => '18.591212',
266 'map_longitude' => '73.741261',
267 'pin_title' => __('Premium Google Maps', 'premium-addons-for-elementor'),
268 'pin_desc' => __('Add an optional description to your map pin', 'premium-addons-for-elementor'),
269 ],
270 'fields' => $repeater->get_controls(),
271 'title_field' => '{{{ pin_title }}}'
272 ]
273 );
274
275 $this->end_controls_section();
276
277 $this->start_controls_section('premium_maps_controls_section',
278 [
279 'label' => __('Controls', 'premium-addons-for-elementor'),
280 ]
281 );
282
283 $this->add_control('premium_maps_map_type',
284 [
285 'label' => __( 'Map Type', 'premium-addons-for-elementor' ),
286 'type' => Controls_Manager::SELECT,
287 'options' => [
288 'roadmap' => __( 'Road Map', 'premium-addons-for-elementor' ),
289 'satellite' => __( 'Satellite', 'premium-addons-for-elementor' ),
290 'terrain' => __( 'Terrain', 'premium-addons-for-elementor' ),
291 'hybrid' => __( 'Hybrid', 'premium-addons-for-elementor' ),
292 ],
293 'default' => 'roadmap',
294 ]
295 );
296
297 $this->add_responsive_control('premium_maps_map_height',
298 [
299 'label' => __( 'Height', 'premium-addons-for-elementor' ),
300 'type' => Controls_Manager::SLIDER,
301 'default' => [
302 'size' => 500,
303 ],
304 'range' => [
305 'px' => [
306 'min' => 80,
307 'max' => 1400,
308 ],
309 ],
310 'selectors' => [
311 '{{WRAPPER}} .premium_maps_map_height' => 'height: {{SIZE}}px;',
312 ],
313 ]
314 );
315
316 $this->add_control('premium_maps_map_zoom',
317 [
318 'label' => __( 'Zoom', 'premium-addons-for-elementor' ),
319 'type' => Controls_Manager::SLIDER,
320 'default' => [
321 'size' => 12,
322 ],
323 'range' => [
324 'px' => [
325 'min' => 0,
326 'max' => 22,
327 ],
328 ],
329 ]
330 );
331
332 $this->add_control('disable_drag',
333 [
334 'label' => __( 'Disable Map Drag', 'premium-addons-for-elementor' ),
335 'type' => Controls_Manager::SWITCHER,
336 ]
337 );
338
339 $this->add_control('premium_maps_map_option_map_type_control',
340 [
341 'label' => __( 'Map Type Controls', 'premium-addons-for-elementor' ),
342 'type' => Controls_Manager::SWITCHER,
343 ]
344 );
345
346 $this->add_control('premium_maps_map_option_zoom_controls',
347 [
348 'label' => __( 'Zoom Controls', 'premium-addons-for-elementor' ),
349 'type' => Controls_Manager::SWITCHER,
350 ]
351 );
352
353 $this->add_control('premium_maps_map_option_streeview',
354 [
355 'label' => __( 'Street View Control', 'premium-addons-for-elementor' ),
356 'type' => Controls_Manager::SWITCHER,
357 ]
358 );
359
360 $this->add_control('premium_maps_map_option_fullscreen_control',
361 [
362 'label' => __( 'Fullscreen Control', 'premium-addons-for-elementor' ),
363 'type' => Controls_Manager::SWITCHER,
364 ]
365 );
366
367 $this->add_control('premium_maps_map_option_mapscroll',
368 [
369 'label' => __( 'Scroll Wheel Zoom', 'premium-addons-for-elementor' ),
370 'type' => Controls_Manager::SWITCHER,
371 ]
372 );
373
374 $this->add_control('premium_maps_marker_open',
375 [
376 'label' => __( 'Info Container Always Opened', 'premium-addons-for-elementor' ),
377 'type' => Controls_Manager::SWITCHER,
378 ]
379 );
380
381 $this->add_control('premium_maps_marker_hover_open',
382 [
383 'label' => __( 'Info Container Opened when Hovered', 'premium-addons-for-elementor' ),
384 'type' => Controls_Manager::SWITCHER,
385 ]
386 );
387
388 $this->add_control('premium_maps_marker_mouse_out',
389 [
390 'label' => __( 'Info Container Closed when Mouse Out', 'premium-addons-for-elementor' ),
391 'type' => Controls_Manager::SWITCHER,
392 'condition' => [
393 'premium_maps_marker_hover_open' => 'yes'
394 ]
395 ]
396 );
397
398 if( $settings['premium-map-cluster'] ) {
399 $this->add_control('premium_maps_map_option_cluster',
400 [
401 'label' => __( 'Marker Clustering', 'premium-addons-for-elementor' ),
402 'type' => Controls_Manager::SWITCHER,
403 ]
404 );
405 }
406
407
408 $this->end_controls_section();
409
410 $this->start_controls_section('premium_maps_custom_styling_section',
411 [
412 'label' => __('Map Style', 'premium-addons-for-elementor'),
413 ]
414 );
415
416 $this->add_control('premium_maps_custom_styling',
417 [
418 'label' => __('JSON Code', 'premium-addons-for-elementor'),
419 'type' => Controls_Manager::TEXTAREA,
420 'description' => 'Get your custom styling from <a href="https://snazzymaps.com/" target="_blank">here</a>',
421 'label_block' => true,
422 ]
423 );
424
425 $this->end_controls_section();
426
427 $this->start_controls_section('section_pa_docs',
428 [
429 'label' => __('Helpful Documentations', 'premium-addons-for-elementor'),
430 ]
431 );
432
433 $doc1_url = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/google-maps-widget-tutorial', 'editor-page', 'wp-editor', 'get-support' );
434
435 $this->add_control('doc_1',
436 [
437 'type' => Controls_Manager::RAW_HTML,
438 'raw' => sprintf( '<a href="%s" target="_blank">%s</a>', $doc1_url ,__( 'Getting started »', 'premium-addons-for-elementor' ) ),
439 'content_classes' => 'editor-pa-doc',
440 ]
441 );
442
443 $doc2_url = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/getting-your-api-key-for-google-reviews', 'editor-page', 'wp-editor', 'get-support' );
444
445 $this->add_control('doc_2',
446 [
447 'type' => Controls_Manager::RAW_HTML,
448 'raw' => sprintf( '<a href="%s" target="_blank">%s</a>', $doc2_url ,__( 'Getting your API key »', 'premium-addons-for-elementor' ) ),
449 'content_classes' => 'editor-pa-doc',
450 ]
451 );
452
453 $this->end_controls_section();
454
455 $this->start_controls_section('premium_maps_pin_title_style',
456 [
457 'label' => __('Title', 'premium-addons-for-elementor'),
458 'tab' => Controls_Manager::TAB_STYLE,
459 ]
460 );
461
462 $this->add_control('premium_maps_pin_title_color',
463 [
464 'label' => __('Color', 'premium-addons-for-elementor'),
465 'type' => Controls_Manager::COLOR,
466 'scheme' => [
467 'type' => Scheme_Color::get_type(),
468 'value' => Scheme_Color::COLOR_1,
469 ],
470 'selectors' => [
471 '{{WRAPPER}} .premium-maps-info-title' => 'color: {{VALUE}};',
472 ]
473 ]
474 );
475
476 $this->add_group_control(
477 Group_Control_Typography::get_type(),
478 [
479 'name' => 'pin_title_typography',
480 'scheme' => Scheme_Typography::TYPOGRAPHY_1,
481 'selector' => '{{WRAPPER}} .premium-maps-info-title',
482 ]
483 );
484
485 $this->add_responsive_control('premium_maps_pin_title_margin',
486 [
487 'label' => __('Margin', 'premium-addons-for-elementor'),
488 'type' => Controls_Manager::DIMENSIONS,
489 'size_units' => ['px', 'em', '%'],
490 'selectors' => [
491 '{{WRAPPER}} .premium-maps-info-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
492 ]
493 ]
494 );
495
496 /*Pin Title Padding*/
497 $this->add_responsive_control('premium_maps_pin_title_padding',
498 [
499 'label' => __('Padding', 'premium-addons-for-elementor'),
500 'type' => Controls_Manager::DIMENSIONS,
501 'size_units' => ['px', 'em', '%'],
502 'selectors' => [
503 '{{WRAPPER}} .premium-maps-info-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
504 ]
505 ]
506 );
507
508 /*Pin Title ALign*/
509 $this->add_responsive_control('premium_maps_pin_title_align',
510 [
511 'label' => __( 'Alignment', 'premium-addons-for-elementor' ),
512 'type' => Controls_Manager::CHOOSE,
513 'options' => [
514 'left' => [
515 'title'=> __( 'Left', 'premium-addons-for-elementor' ),
516 'icon' => 'fa fa-align-left',
517 ],
518 'center' => [
519 'title'=> __( 'Center', 'premium-addons-for-elementor' ),
520 'icon' => 'fa fa-align-center',
521 ],
522 'right' => [
523 'title'=> __( 'Right', 'premium-addons-for-elementor' ),
524 'icon' => 'fa fa-align-right',
525 ],
526 ],
527 'default' => 'center',
528 'selectors' => [
529 '{{WRAPPER}} .premium-maps-info-title' => 'text-align: {{VALUE}};',
530 ],
531 ]
532 );
533
534 /*End Title Style Section*/
535 $this->end_controls_section();
536
537 /*Start Pin Style Section*/
538 $this->start_controls_section('premium_maps_pin_text_style',
539 [
540 'label' => __('Description', 'premium-addons-for-elementor'),
541 'tab' => Controls_Manager::TAB_STYLE,
542 ]
543 );
544
545 $this->add_control('premium_maps_pin_text_color',
546 [
547 'label' => __('Color', 'premium-addons-for-elementor'),
548 'type' => Controls_Manager::COLOR,
549 'scheme' => [
550 'type' => Scheme_Color::get_type(),
551 'value' => Scheme_Color::COLOR_2,
552 ],
553 'selectors' => [
554 '{{WRAPPER}} .premium-maps-info-desc' => 'color: {{VALUE}};',
555 ]
556 ]
557 );
558
559 $this->add_group_control(
560 Group_Control_Typography::get_type(),
561 [
562 'name' => 'pin_text_typo',
563 'scheme' => Scheme_Typography::TYPOGRAPHY_1,
564 'selector' => '{{WRAPPER}} .premium-maps-info-desc',
565 ]
566 );
567
568 $this->add_responsive_control('premium_maps_pin_text_margin',
569 [
570 'label' => __('Margin', 'premium-addons-for-elementor'),
571 'type' => Controls_Manager::DIMENSIONS,
572 'size_units' => ['px', 'em', '%'],
573 'selectors' => [
574 '{{WRAPPER}} .premium-maps-info-desc' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
575 ]
576 ]
577 );
578
579 $this->add_responsive_control('premium_maps_pin_text_padding',
580 [
581 'label' => __('Padding', 'premium-addons-for-elementor'),
582 'type' => Controls_Manager::DIMENSIONS,
583 'size_units' => ['px', 'em', '%'],
584 'selectors' => [
585 '{{WRAPPER}} .premium-maps-info-desc' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
586 ]
587 ]
588 );
589
590 $this->add_responsive_control('premium_maps_pin_description_align',
591 [
592 'label' => __( 'Alignment', 'premium-addons-for-elementor' ),
593 'type' => Controls_Manager::CHOOSE,
594 'options' => [
595 'left' => [
596 'title'=> __( 'Left', 'premium-addons-for-elementor' ),
597 'icon' => 'fa fa-align-left',
598 ],
599 'center' => [
600 'title'=> __( 'Center', 'premium-addons-for-elementor' ),
601 'icon' => 'fa fa-align-center',
602 ],
603 'right' => [
604 'title'=> __( 'Right', 'premium-addons-for-elementor' ),
605 'icon' => 'fa fa-align-right',
606 ],
607 ],
608 'default' => 'center',
609 'selectors' => [
610 '{{WRAPPER}} .premium-maps-info-desc' => 'text-align: {{VALUE}};',
611 ],
612 ]
613 );
614
615 $this->end_controls_section();
616
617 $this->start_controls_section('premium_maps_box_style',
618 [
619 'label' => __('Map', 'premium-addons-for-elementor'),
620 'tab' => Controls_Manager::TAB_STYLE,
621 ]
622 );
623
624 $this->add_group_control(
625 Group_Control_Border::get_type(),
626 [
627 'name' => 'map_border',
628 'selector' => '{{WRAPPER}} .premium-maps-container',
629 ]
630 );
631
632 $this->add_control('premium_maps_box_radius',
633 [
634 'label' => __('Border Radius', 'premium-addons-for-elementor'),
635 'type' => Controls_Manager::SLIDER,
636 'size_units' => ['px', '%', 'em'],
637 'selectors' => [
638 '{{WRAPPER}} .premium-maps-container,{{WRAPPER}} .premium_maps_map_height' => 'border-radius: {{SIZE}}{{UNIT}};'
639 ]
640 ]
641 );
642
643 $this->add_group_control(
644 Group_Control_Box_Shadow::get_type(),
645 [
646 'label' => __('Shadow','premium-addons-for-elementor'),
647 'name' => 'premium_maps_box_shadow',
648 'selector' => '{{WRAPPER}} .premium-maps-container',
649 ]
650 );
651
652 $this->add_responsive_control('premium_maps_box_margin',
653 [
654 'label' => __('Margin', 'premium-addons-for-elementor'),
655 'type' => Controls_Manager::DIMENSIONS,
656 'size_units' => [ 'px', 'em', '%' ],
657 'selectors' => [
658 '{{WRAPPER}} .premium-maps-container' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
659 ]
660 ]
661 );
662
663 $this->add_responsive_control('premium_maps_box_padding',
664 [
665 'label' => __('Padding', 'premium-addons-for-elementor'),
666 'type' => Controls_Manager::DIMENSIONS,
667 'size_units' => [ 'px', 'em', '%' ],
668 'selectors' => [
669 '{{WRAPPER}} .premium-maps-container' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
670 ]
671 ]
672 );
673
674 $this->end_controls_section();
675
676 }
677
678 /**
679 * Render Google Maps widget output on the frontend.
680 *
681 * Written in PHP and used to generate the final HTML.
682 *
683 * @since 1.0.0
684 * @access protected
685 */
686 protected function render() {
687
688 $settings = $this->get_settings_for_display();
689
690 $map_pins = $settings['premium_maps_map_pins'];
691
692 $street_view = 'yes' == $settings['premium_maps_map_option_streeview'] ? 'true' : 'false';
693
694 $scroll_wheel = 'yes' == $settings['premium_maps_map_option_mapscroll'] ? 'true' : 'false';
695
696 $enable_full_screen = 'yes' == $settings['premium_maps_map_option_fullscreen_control'] ? 'true' : 'false';
697
698 $enable_zoom_control = 'yes' == $settings['premium_maps_map_option_zoom_controls'] ? 'true' : 'false';
699
700 $map_type_control = 'yes' == $settings['premium_maps_map_option_map_type_control'] ? 'true' : 'false';
701
702 $automatic_open = 'yes' == $settings['premium_maps_marker_open'] ? 'true' : 'false';
703
704 $hover_open = 'yes' == $settings['premium_maps_marker_hover_open'] ? 'true' : 'false';
705
706 $hover_close = 'yes' == $settings['premium_maps_marker_mouse_out'] ? 'true' : 'false';
707
708 $marker_cluster = false;
709
710 $is_cluster_enabled = Admin_Helper::get_integrations_settings()['premium-map-cluster'];
711
712 if( $is_cluster_enabled ) {
713 $marker_cluster = 'yes' == $settings['premium_maps_map_option_cluster'] ? 'true' : 'false';
714 }
715
716 $centerlat = !empty($settings['premium_maps_center_lat']) ? $settings['premium_maps_center_lat'] : 18.591212;
717
718 $centerlong = !empty($settings['premium_maps_center_long']) ? $settings['premium_maps_center_long'] : 73.741261;
719
720 $marker_width = !empty($settings['premium_maps_markers_width']) ? $settings['premium_maps_markers_width'] : 1000;
721
722 $get_ip_location = $settings['premium_map_ip_location'];
723
724 if( 'true' == $get_ip_location ) {
725
726 if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
727 $http_x_headers = explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] );
728
729 $_SERVER['REMOTE_ADDR'] = $http_x_headers[0];
730 }
731 $ipAddress = $_SERVER['REMOTE_ADDR'];
732
733 $env = unserialize(file_get_contents("http://www.geoplugin.net/php.gp?ip=$ipAddress"));
734
735 $centerlat = isset( $env['geoplugin_latitude'] ) ? $env['geoplugin_latitude'] : $centerlat;
736
737 $centerlong = isset( $env['geoplugin_longitude'] ) ? $env['geoplugin_longitude'] : $centerlong;
738
739 }
740
741 $map_settings = [
742 'zoom' => $settings['premium_maps_map_zoom']['size'],
743 'maptype' => $settings['premium_maps_map_type'],
744 'streetViewControl' => $street_view,
745 'centerlat' => $centerlat,
746 'centerlong' => $centerlong,
747 'scrollwheel' => $scroll_wheel,
748 'fullScreen' => $enable_full_screen,
749 'zoomControl' => $enable_zoom_control,
750 'typeControl' => $map_type_control,
751 'automaticOpen' => $automatic_open,
752 'hoverOpen' => $hover_open,
753 'hoverClose' => $hover_close,
754 'cluster' => $marker_cluster,
755 'drag' => $settings['disable_drag']
756 ];
757
758 $this->add_render_attribute('style_wrapper', 'data-style', $settings['premium_maps_custom_styling']);
759 ?>
760
761 <div class="premium-maps-container" id="premium-maps-container">
762 <?php if( count( $map_pins ) ) { ?>
763 <div class="premium_maps_map_height" data-settings='<?php echo wp_json_encode( $map_settings ); ?>' <?php echo $this->get_render_attribute_string('style_wrapper'); ?>>
764 <?php
765 foreach( $map_pins as $index => $pin ) {
766
767 $key = 'map_marker_' . $index;
768
769 $this->add_render_attribute( $key, [
770 'class' => 'premium-pin',
771 'data-lng' => $pin['map_longitude'],
772 'data-lat' => $pin['map_latitude'],
773 'data-icon' => $pin['pin_icon']['url'],
774 'data-icon-size' => $pin['pin_icon_size']['size'],
775 'data-max-width' => $marker_width
776 ]);
777
778 ?>
779 <div <?php echo $this->get_render_attribute_string( $key ); ?>>
780 <?php if( ! empty( $pin['pin_title'] )|| !empty( $pin['pin_desc'] ) ) : ?>
781 <div class='premium-maps-info-container'><p class='premium-maps-info-title'><?php echo $pin['pin_title']; ?></p><div class='premium-maps-info-desc'><?php echo $pin['pin_desc']; ?></div></div>
782 <?php endif; ?>
783 </div>
784 <?php
785 }
786 ?>
787 </div>
788 <?php
789 } ?>
790 </div>
791 <?php
792 }
793 }