PluginProbe ʕ •ᴥ•ʔ
Premium Addons for Elementor – Powerful Elementor Templates & Widgets / 4.11.77
Premium Addons for Elementor – Powerful Elementor Templates & Widgets v4.11.77
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 1 month ago premium-banner.php 3 weeks ago premium-blog.php 3 weeks ago premium-button.php 3 weeks ago premium-carousel.php 3 weeks ago premium-contactform.php 3 weeks ago premium-countdown.php 3 weeks ago premium-counter.php 3 weeks ago premium-dual-header.php 3 weeks ago premium-fancytext.php 3 weeks ago premium-grid.php 3 weeks ago premium-icon-list.php 3 weeks ago premium-image-button.php 3 weeks ago premium-image-scroll.php 3 weeks ago premium-image-separator.php 3 weeks ago premium-lottie.php 3 weeks ago premium-maps.php 3 weeks ago premium-media-wheel.php 3 weeks ago premium-mobile-menu.php 3 weeks ago premium-modalbox.php 3 weeks ago premium-nav-menu.php 3 weeks ago premium-notifications.php 3 weeks ago premium-person.php 3 weeks ago premium-pinterest-feed.php 3 weeks ago premium-post-ticker.php 3 weeks ago premium-pricing-table.php 3 weeks ago premium-progressbar.php 3 weeks ago premium-search-form.php 3 weeks ago premium-svg-drawer.php 3 weeks ago premium-tcloud.php 3 weeks ago premium-testimonials.php 3 weeks ago premium-textual-showcase.php 3 weeks ago premium-tiktok-feed.php 3 weeks ago premium-title.php 3 weeks ago premium-videobox.php 3 weeks ago premium-vscroll.php 3 weeks ago premium-weather.php 3 weeks ago premium-world-clock.php 3 weeks ago
premium-maps.php
1486 lines
1 <?php
2 /**
3 * Premium Google Maps.
4 */
5
6 namespace PremiumAddons\Widgets;
7
8 // Elementor Classes.
9 use Elementor\Plugin;
10 use Elementor\Icons_Manager;
11 use Elementor\Widget_Base;
12 use Elementor\Controls_Manager;
13 use Elementor\Repeater;
14 use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
15 use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
16 use Elementor\Group_Control_Border;
17 use Elementor\Group_Control_Typography;
18 use Elementor\Group_Control_Box_Shadow;
19
20 // PremiumAddons Classes.
21 use PremiumAddons\Admin\Includes\Admin_Helper;
22 use PremiumAddons\Includes\Helper_Functions;
23
24 if ( ! defined( 'ABSPATH' ) ) {
25 exit; // If this file is called directly, abort.
26 }
27
28 /**
29 * Class Premium_Maps
30 */
31 class Premium_Maps extends Widget_Base {
32
33 /**
34 * Retrieve Widget Name.
35 *
36 * @since 1.0.0
37 * @access public
38 */
39 public function get_name() {
40 return 'premium-addon-maps';
41 }
42
43 /**
44 * Widget preview refresh button.
45 *
46 * @since 1.0.0
47 * @access public
48 */
49 public function is_reload_preview_required() {
50 return true;
51 }
52
53 /**
54 * Retrieve Widget Title.
55 *
56 * @since 1.0.0
57 * @access public
58 */
59 public function get_title() {
60 return __( 'Google Maps', 'premium-addons-for-elementor' );
61 }
62
63 /**
64 * Retrieve Widget Icon.
65 *
66 * @since 1.0.0
67 * @access public
68 *
69 * @return string widget icon.
70 */
71 public function get_icon() {
72 return 'pa-maps';
73 }
74
75 /**
76 * Retrieve Widget Categories.
77 *
78 * @since 1.5.1
79 * @access public
80 *
81 * @return array Widget categories.
82 */
83 public function get_categories() {
84 return array( 'premium-elements' );
85 }
86
87 /**
88 * Retrieve Widget Dependent CSS.
89 *
90 * @since 1.0.0
91 * @access public
92 *
93 * @return array CSS style handles.
94 */
95 public function get_style_depends() {
96
97 $icons_css = Helper_Functions::check_papro_version() ? array( 'elementor-icons' ) : array();
98
99 return array_merge(
100 $icons_css,
101 array(
102 'premium-addons',
103 )
104 );
105 }
106
107 /**
108 * Retrieve Widget Dependent JS.
109 *
110 * @since 1.0.0
111 * @access public
112 *
113 * @return array JS script handles.
114 */
115 public function get_script_depends() {
116 return array(
117 'pa-maps-cluster',
118 'pa-maps',
119 'pa-maps-api',
120 );
121 }
122
123 /**
124 * Retrieve Widget Keywords.
125 *
126 * @since 1.0.0
127 * @access public
128 *
129 * @return string Widget keywords.
130 */
131 public function get_keywords() {
132 return array( 'pa', 'premium', 'premium google maps', 'marker', 'pin', 'tooltip', 'location' );
133 }
134
135 /**
136 * Retrieve Widget Support URL.
137 *
138 * @access public
139 *
140 * @return string support URL.
141 */
142 public function get_custom_help_url() {
143 return 'https://premiumaddons.com/support/';
144 }
145
146 public function has_widget_inner_wrapper(): bool {
147 return ! Helper_Functions::check_elementor_experiment( 'e_optimized_markup' );
148 }
149
150 /**
151 * Register Google Maps controls.
152 *
153 * @since 1.0.0
154 * @access protected
155 */
156 protected function register_controls() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
157
158 $this->start_controls_section(
159 'premium_maps_map_settings',
160 array(
161 'label' => __( 'Center Location', 'premium-addons-for-elementor' ),
162 )
163 );
164
165 $demo = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/google-maps-widget-for-elementor-page-builder/', 'maps', 'wp-editor', 'demo' );
166 Helper_Functions::add_templates_controls( $this, 'google-maps', $demo );
167
168 $settings = Admin_Helper::get_integrations_settings();
169
170 if ( empty( $settings['premium-map-api'] ) || '1' == $settings['premium-map-api'] ) { // phpcs:ignore WordPress.PHP.StrictComparisons
171 $this->add_control(
172 'premium_maps_api_url',
173 array(
174 'raw' => 'Premium Maps widget requires an API key. Get your API key from <a target="_blank" href="https://premiumaddons.com/docs/google-api-key-for-elementor-widgets/">here</a> and add it to Premium Addons admin page. Go to Dashboard -> Premium Addons for Elementor -> Integrations tab',
175 'type' => Controls_Manager::RAW_HTML,
176 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
177 )
178 );
179 }
180
181 $this->add_control(
182 'premium_map_ip_location',
183 array(
184 'label' => __( 'Get User Location', 'premium-addons-for-elementor' ),
185 'description' => __( 'Get center location from visitor\'s location', 'premium-addons-for-elementor' ),
186 'type' => Controls_Manager::SWITCHER,
187 'return_value' => 'true',
188 )
189 );
190
191 $this->add_control(
192 'premium_map_location_finder',
193 array(
194 'label' => __( 'Latitude & Longitude Finder', 'premium-addons-for-elementor' ),
195 'type' => Controls_Manager::SWITCHER,
196 'condition' => array(
197 'premium_map_ip_location!' => 'true',
198 ),
199 )
200 );
201
202 $this->add_control(
203 'premium_map_notice',
204 array(
205 'label' => __( 'Find Latitude & Longitude', 'premium-addons-for-elementor' ),
206 'type' => Controls_Manager::RAW_HTML,
207 '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>',
208 'label_block' => true,
209 'condition' => array(
210 'premium_map_location_finder' => 'yes',
211 'premium_map_ip_location!' => 'true',
212 ),
213 )
214 );
215
216 $this->add_control(
217 'premium_maps_center_lat',
218 array(
219 'label' => __( 'Center Latitude', 'premium-addons-for-elementor' ),
220 'type' => Controls_Manager::TEXT,
221 'dynamic' => array( 'active' => true ),
222 'description' => __( 'Center latitude and longitude are required to identify your location', 'premium-addons-for-elementor' ),
223 'default' => '59.3347981',
224 'label_block' => true,
225 'condition' => array(
226 'premium_map_ip_location!' => 'true',
227 ),
228 'ai' => array(
229 'active' => false,
230 ),
231 )
232 );
233
234 $this->add_control(
235 'premium_maps_center_long',
236 array(
237 'label' => __( 'Center Longitude', 'premium-addons-for-elementor' ),
238 'type' => Controls_Manager::TEXT,
239 'dynamic' => array( 'active' => true ),
240 'description' => __( 'Center latitude and longitude are required to identify your location', 'premium-addons-for-elementor' ),
241 'default' => '18.0601028',
242 'label_block' => true,
243 'condition' => array(
244 'premium_map_ip_location!' => 'true',
245 ),
246 'ai' => array(
247 'active' => false,
248 ),
249 )
250 );
251
252 $this->end_controls_section();
253
254 $this->start_controls_section(
255 'premium_maps_map_pins_settings',
256 array(
257 'label' => __( 'Markers', 'premium-addons-for-elementor' ),
258 )
259 );
260
261 $this->add_control(
262 'premium_maps_markers_width',
263 array(
264 'label' => __( 'Max Width', 'premium-addons-for-elementor' ),
265 'type' => Controls_Manager::NUMBER,
266 'title' => __( 'Set the Maximum width for markers description box', 'premium-addons-for-elementor' ),
267 )
268 );
269
270 $repeater = new REPEATER();
271
272 $repeater->start_controls_tabs( 'marker_tabs' );
273
274 $repeater->start_controls_tab(
275 'marker_content_tab',
276 array(
277 'label' => esc_html__( 'Content', 'premium-addons-for-elementor' ),
278 )
279 );
280
281 $repeater->add_control(
282 'premium_map_pin_location_finder',
283 array(
284 'label' => __( 'Location Finder', 'premium-addons-for-elementor' ),
285 'type' => Controls_Manager::SWITCHER,
286 )
287 );
288
289 $repeater->add_control(
290 'premium_map_pin_notice',
291 array(
292 'label' => __( 'Find Location', 'premium-addons-for-elementor' ),
293 'type' => Controls_Manager::RAW_HTML,
294 '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>',
295 'label_block' => true,
296 'condition' => array(
297 'premium_map_pin_location_finder' => 'yes',
298 ),
299 )
300 );
301
302 $repeater->add_control(
303 'map_latitude',
304 array(
305 'label' => __( 'Latitude', 'premium-addons-for-elementor' ),
306 'type' => Controls_Manager::TEXT,
307 'dynamic' => array( 'active' => true ),
308 'description' => 'Click <a href="https://www.latlong.net/" target="_blank">here</a> to get your location coordinates',
309 'label_block' => true,
310 )
311 );
312
313 $repeater->add_control(
314 'map_longitude',
315 array(
316 'name' => 'map_longitude',
317 'label' => __( 'Longitude', 'premium-addons-for-elementor' ),
318 'type' => Controls_Manager::TEXT,
319 'dynamic' => array( 'active' => true ),
320 'description' => 'Click <a href="https://www.latlong.net/" target="_blank">here</a> to get your location coordinates',
321 'label_block' => true,
322 )
323 );
324
325 $repeater->add_control(
326 'pin_title',
327 array(
328 'label' => __( 'Location Title', 'premium-addons-for-elementor' ),
329 'type' => Controls_Manager::TEXT,
330 'dynamic' => array( 'active' => true ),
331 'label_block' => true,
332 )
333 );
334
335 $repeater->add_control(
336 'pin_desc',
337 array(
338 'label' => __( 'Description', 'premium-addons-for-elementor' ),
339 'type' => Controls_Manager::WYSIWYG,
340 'dynamic' => array( 'active' => true ),
341 'label_block' => true,
342 )
343 );
344
345 $repeater->add_control(
346 'advanced_view',
347 array(
348 'label' => __( 'Advanced Info', 'premium-addons-for-elementor' ),
349 'type' => Controls_Manager::SWITCHER,
350 )
351 );
352
353 $get_pro = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/pro', 'maps-widget', 'wp-editor', 'get-pro' );
354
355 $papro_activated = Helper_Functions::check_papro_version();
356
357 if ( ! $papro_activated ) {
358 $repeater->add_control(
359 'marker_notice',
360 array(
361 'type' => Controls_Manager::RAW_HTML,
362 'raw' => __( 'Advanced Marker option is available in Premium Addons Pro.', 'premium-addons-for-elementor' ) . '<a href="' . esc_url( $get_pro ) . '" target="_blank">' . __( 'Upgrade now!', 'premium-addons-for-elementor' ) . '</a>',
363 'content_classes' => 'papro-upgrade-notice',
364 'condition' => array(
365 'advanced_view' => 'yes',
366 ),
367 )
368 );
369 }
370
371 do_action( 'pa_maps_marker_controls', $repeater );
372
373 $repeater->add_control(
374 'open_by_default',
375 array(
376 'label' => __( 'Opened By Default', 'premium-addons-for-elementor' ),
377 'type' => Controls_Manager::SWITCHER,
378 'separator' => 'before',
379 'conditions' => array(
380 'relation' => 'or',
381 'terms' => array(
382 array(
383 'name' => 'pin_title',
384 'operator' => '!==',
385 'value' => '',
386 ),
387 array(
388 'name' => 'pin_desc',
389 'operator' => '!==',
390 'value' => '',
391 ),
392 ),
393 ),
394 )
395 );
396
397 $repeater->add_control(
398 'custom_id',
399 array(
400 'label' => __( 'Custom ID', 'premium-addons-for-elementor' ),
401 'type' => Controls_Manager::TEXT,
402 'description' => __( 'Use this with Premium Carousel widget ', 'premium-addons-for-elementor' ) . '<a href="https://premiumaddons.com/docs/how-to-use-elementor-widgets-to-navigate-through-carousel-widget-slides/" target="_blank">Custom Navigation option</a>',
403 'dynamic' => array( 'active' => true ),
404 'label_block' => true,
405 )
406 );
407
408 $repeater->end_controls_tab();
409
410 $repeater->start_controls_tab(
411 'marker_style_tab',
412 array(
413 'label' => esc_html__( 'Style', 'premium-addons-for-elementor' ),
414 )
415 );
416
417 $repeater->add_control(
418 'pin_icon',
419 array(
420 'label' => __( 'Custom Icon', 'premium-addons-for-elementor' ),
421 'type' => Controls_Manager::MEDIA,
422 )
423 );
424
425 $repeater->add_control(
426 'pin_icon_size',
427 array(
428 'label' => __( 'Size', 'premium-addons-for-elementor' ),
429 'type' => Controls_Manager::SLIDER,
430 'size_units' => array( 'px', 'em' ),
431 'range' => array(
432 'px' => array(
433 'min' => 1,
434 'max' => 200,
435 ),
436 'em' => array(
437 'min' => 1,
438 'max' => 20,
439 ),
440 ),
441 )
442 );
443
444 $repeater->end_controls_tab();
445
446 $repeater->end_controls_tabs();
447
448 $this->add_control(
449 'premium_maps_map_pins',
450 array(
451 'label' => __( 'Map Pins', 'premium-addons-for-elementor' ),
452 'type' => Controls_Manager::REPEATER,
453 'default' => array(
454 'map_latitude' => '59.3347981',
455 'map_longitude' => '18.0601028',
456 'pin_title' => __( 'Barbeque Steakhouse & Bar', 'premium-addons-for-elementor' ),
457 'pin_desc' => __( 'Add an optional description to your map pin', 'premium-addons-for-elementor' ),
458 'pin_address' => 'Kungsgatan 54, 111 35 Stockholm, Sweden',
459 'pin_website' => 'https://bbqsteakhouse.se/',
460 'pin_phone' => '+468100026',
461 'pin_hours' => '10AM-11PM',
462 ),
463 'fields' => $repeater->get_controls(),
464 'title_field' => '{{{ pin_title }}}',
465 )
466 );
467
468 $this->end_controls_section();
469
470 $this->start_controls_section(
471 'premium_maps_controls_section',
472 array(
473 'label' => __( 'Controls', 'premium-addons-for-elementor' ),
474 )
475 );
476
477 $this->add_control(
478 'premium_map_id',
479 array(
480 'label' => __( 'Map ID', 'premium-addons-for-elementor' ),
481 'type' => Controls_Manager::TEXT,
482 'description' => sprintf(
483 esc_html__( 'Get the Google Map ID from %s. You can leave it empty, but this will use the old Google Maps API.', 'premium-addons-for-elementor' ),
484 '<a href="https://developers.google.com/maps/documentation/javascript/map-ids/get-map-id" target="_blank">' . esc_html__( 'here', 'premium-addons-for-elementor' ) . '</a>'
485 ),
486 'ai' => array(
487 'active' => false,
488 ),
489 )
490 );
491
492 $this->add_control(
493 'premium_maps_map_type',
494 array(
495 'label' => __( 'Map Type', 'premium-addons-for-elementor' ),
496 'type' => Controls_Manager::SELECT,
497 'options' => array(
498 'roadmap' => __( 'Road Map', 'premium-addons-for-elementor' ),
499 'satellite' => __( 'Satellite', 'premium-addons-for-elementor' ),
500 'terrain' => __( 'Terrain', 'premium-addons-for-elementor' ),
501 'hybrid' => __( 'Hybrid', 'premium-addons-for-elementor' ),
502 ),
503 'default' => 'roadmap',
504 )
505 );
506
507 $this->add_responsive_control(
508 'premium_maps_map_height',
509 array(
510 'label' => __( 'Height', 'premium-addons-for-elementor' ),
511 'type' => Controls_Manager::SLIDER,
512 'size_units' => array( 'px', 'vh' ),
513 'default' => array(
514 'size' => 500,
515 'unit' => 'px',
516 ),
517 'range' => array(
518 'px' => array(
519 'min' => 80,
520 'max' => 1400,
521 ),
522 ),
523 'selectors' => array(
524 '{{WRAPPER}} .premium_maps_map_height' => 'height: {{SIZE}}{{UNIT}};',
525 ),
526 )
527 );
528
529 $this->add_responsive_control(
530 'premium_maps_map_zoom',
531 array(
532 'label' => __( 'Zoom', 'premium-addons-for-elementor' ),
533 'type' => Controls_Manager::SLIDER,
534 'default' => array(
535 'size' => 12,
536 ),
537 'range' => array(
538 'px' => array(
539 'min' => 0,
540 'max' => 22,
541 ),
542 ),
543 'selectors' => array(
544 '{{WRAPPER}}' => '--pa-map-zoom: {{SIZE}}',
545 ),
546 )
547 );
548
549 $this->add_control(
550 'disable_drag',
551 array(
552 'label' => __( 'Disable Map Drag', 'premium-addons-for-elementor' ),
553 'type' => Controls_Manager::SWITCHER,
554 )
555 );
556
557 $this->add_control(
558 'premium_maps_map_option_map_type_control',
559 array(
560 'label' => __( 'Map Type Controls', 'premium-addons-for-elementor' ),
561 'type' => Controls_Manager::SWITCHER,
562 )
563 );
564
565 $this->add_control(
566 'premium_maps_map_option_zoom_controls',
567 array(
568 'label' => __( 'Zoom Controls', 'premium-addons-for-elementor' ),
569 'type' => Controls_Manager::SWITCHER,
570 )
571 );
572
573 $this->add_control(
574 'premium_maps_map_option_streeview',
575 array(
576 'label' => __( 'Street View Control', 'premium-addons-for-elementor' ),
577 'type' => Controls_Manager::SWITCHER,
578 )
579 );
580
581 $this->add_control(
582 'premium_maps_map_option_fullscreen_control',
583 array(
584 'label' => __( 'Fullscreen Control', 'premium-addons-for-elementor' ),
585 'type' => Controls_Manager::SWITCHER,
586 )
587 );
588
589 $this->add_control(
590 'premium_maps_map_option_mapscroll',
591 array(
592 'label' => __( 'Scroll Wheel Zoom', 'premium-addons-for-elementor' ),
593 'type' => Controls_Manager::SWITCHER,
594 )
595 );
596
597 $this->add_control(
598 'premium_maps_marker_open',
599 array(
600 'label' => __( 'Info Container Always Opened', 'premium-addons-for-elementor' ),
601 'type' => Controls_Manager::SWITCHER,
602 )
603 );
604
605 $this->add_control(
606 'premium_maps_marker_hover_open',
607 array(
608 'label' => __( 'Open Info Container on Hover', 'premium-addons-for-elementor' ),
609 'type' => Controls_Manager::SWITCHER,
610 )
611 );
612
613 $this->add_control(
614 'premium_maps_marker_mouse_out',
615 array(
616 'label' => __( 'Close Info Container on Mouse Out', 'premium-addons-for-elementor' ),
617 'type' => Controls_Manager::SWITCHER,
618 'condition' => array(
619 'premium_maps_marker_hover_open' => 'yes',
620 ),
621 )
622 );
623
624 if ( $settings['premium-map-cluster'] ) {
625 $this->add_control(
626 'premium_maps_map_option_cluster',
627 array(
628 'label' => __( 'Marker Clustering', 'premium-addons-for-elementor' ),
629 'type' => Controls_Manager::SWITCHER,
630 'condition' => array(
631 'premium_map_id!' => '',
632 ),
633 )
634 );
635
636 $this->add_control(
637 'cluster_icon',
638 array(
639 'label' => __( 'Cluster Icon', 'premium-addons-for-elementor' ),
640 'type' => Controls_Manager::MEDIA,
641 'condition' => array(
642 'premium_maps_map_option_cluster' => 'yes',
643 'premium_map_id!' => '',
644 ),
645 )
646 );
647
648 $this->add_control(
649 'cluster_icon_size',
650 array(
651 'label' => __( 'Icon Size (PX)', 'premium-addons-for-elementor' ),
652 'type' => Controls_Manager::SLIDER,
653 'range' => array(
654 'px' => array(
655 'min' => 1,
656 'max' => 200,
657 ),
658 ),
659 'condition' => array(
660 'premium_maps_map_option_cluster' => 'yes',
661 'premium_map_id!' => '',
662 ),
663 )
664 );
665
666 }
667
668 $this->add_control(
669 'load_on_visible',
670 array(
671 'label' => __( 'Load Map On Scroll', 'premium-addons-for-elementor' ),
672 'type' => Controls_Manager::SWITCHER,
673 'description' => __( 'This option will load the map while scrolling to improve page loading speed', 'premium-addons-for-elementor' ),
674 'return_value' => 'true',
675 )
676 );
677
678 $this->add_control(
679 'linked_carousel_id',
680 array(
681 'label' => __( 'Connected Carousel Widget ID', 'premium-addons-for-elementor' ),
682 'type' => Controls_Manager::TEXT,
683 'description' => __( 'Add the CSS ID given to Premium Carousel to link carousel slides with the maps marker. ', 'premium-addons-for-elementor' ) .
684 '<a href="https://premiumaddons.com/docs/how-to-link-google-maps-markers-carousel/" target="_blank">' . __( 'Learn more', 'premium-addons-for-elementor' ) . '</a>',
685 'label_block' => true,
686 'ai' => array(
687 'active' => false,
688 ),
689 )
690 );
691
692 $this->end_controls_section();
693
694 $this->start_controls_section(
695 'premium_maps_custom_styling_section',
696 array(
697 'label' => __( 'Map Style', 'premium-addons-for-elementor' ),
698 )
699 );
700
701 $this->add_control(
702 'premium_maps_custom_styling',
703 array(
704 'label' => __( 'JSON Code', 'premium-addons-for-elementor' ),
705 'type' => Controls_Manager::TEXTAREA,
706 'description' => 'Get your custom styling from <a href="https://snazzymaps.com/" target="_blank">here</a>',
707 'label_block' => true,
708 'ai' => array(
709 'active' => false,
710 ),
711 )
712 );
713
714 $this->end_controls_section();
715
716 $this->start_controls_section(
717 'section_pa_docs',
718 array(
719 'label' => __( 'Help & Docs', 'premium-addons-for-elementor' ),
720 )
721 );
722
723 $doc1_url = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/google-maps-widget-tutorial', 'maps-widget', 'wp-editor', 'get-support' );
724
725 $this->add_control(
726 'doc_1',
727 array(
728 'type' => Controls_Manager::RAW_HTML,
729 'raw' => sprintf( '<a href="%s" target="_blank">%s</a>', $doc1_url, __( 'Getting started »', 'premium-addons-for-elementor' ) ),
730 'content_classes' => 'editor-pa-doc',
731 )
732 );
733
734 $doc2_url = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/google-api-key-for-elementor-widgets/', 'maps-widget', 'wp-editor', 'get-support' );
735
736 $this->add_control(
737 'doc_2',
738 array(
739 'type' => Controls_Manager::RAW_HTML,
740 'raw' => sprintf( '<a href="%s" target="_blank">%s</a>', $doc2_url, __( 'Getting your API key »', 'premium-addons-for-elementor' ) ),
741 'content_classes' => 'editor-pa-doc',
742 )
743 );
744
745 Helper_Functions::register_element_feedback_controls( $this );
746
747 $this->end_controls_section();
748
749 Helper_Functions::register_papro_promotion_controls( $this, 'maps' );
750
751 $this->start_controls_section(
752 'premium_maps_box_style',
753 array(
754 'label' => __( 'Map', 'premium-addons-for-elementor' ),
755 'tab' => Controls_Manager::TAB_STYLE,
756 )
757 );
758
759 $this->add_group_control(
760 Group_Control_Border::get_type(),
761 array(
762 'name' => 'map_border',
763 'selector' => '{{WRAPPER}} .premium-maps-container',
764 )
765 );
766
767 $this->add_control(
768 'premium_maps_box_radius',
769 array(
770 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
771 'type' => Controls_Manager::SLIDER,
772 'size_units' => array( 'px', '%', 'em' ),
773 'selectors' => array(
774 '{{WRAPPER}} .premium-maps-container,{{WRAPPER}} .premium_maps_map_height' => 'border-radius: {{SIZE}}{{UNIT}};',
775 ),
776 )
777 );
778
779 $this->add_group_control(
780 Group_Control_Box_Shadow::get_type(),
781 array(
782 'label' => __( 'Shadow', 'premium-addons-for-elementor' ),
783 'name' => 'premium_maps_box_shadow',
784 'selector' => '{{WRAPPER}} .premium-maps-container',
785 )
786 );
787
788 $this->add_responsive_control(
789 'premium_maps_box_margin',
790 array(
791 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
792 'type' => Controls_Manager::DIMENSIONS,
793 'size_units' => array( 'px', 'em', '%' ),
794 'selectors' => array(
795 '{{WRAPPER}} .premium-maps-container' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
796 ),
797 )
798 );
799
800 $this->add_responsive_control(
801 'premium_maps_box_padding',
802 array(
803 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
804 'type' => Controls_Manager::DIMENSIONS,
805 'size_units' => array( 'px', 'em', '%' ),
806 'selectors' => array(
807 '{{WRAPPER}} .premium-maps-container' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
808 ),
809 )
810 );
811
812 $this->end_controls_section();
813
814 $this->start_controls_section(
815 'marker_window',
816 array(
817 'label' => __( 'Marker Info', 'premium-addons-for-elementor' ),
818 'tab' => Controls_Manager::TAB_STYLE,
819 )
820 );
821
822 $this->add_responsive_control(
823 'marker_window_width',
824 array(
825 'label' => __( 'Minimum Width', 'premium-addons-for-elementor' ),
826 'type' => Controls_Manager::SLIDER,
827 'size_units' => array( 'px', 'em', '%' ),
828 'range' => array(
829 'px' => array(
830 'min' => 300,
831 'max' => 1000,
832 ),
833 'em' => array(
834 'min' => 20,
835 'max' => 50,
836 ),
837 ),
838 'selectors' => array(
839 '{{WRAPPER}} .premium-maps-info-container' => 'min-width: {{SIZE}}{{UNIT}} !important',
840 ),
841 )
842 );
843
844 $this->add_control(
845 'marker_window_background',
846 array(
847 'label' => __( 'Background Color', 'premium-addons-for-elementor' ),
848 'type' => Controls_Manager::COLOR,
849 'default' => '#fff',
850 'selectors' => array(
851 '{{WRAPPER}} .gm-style-iw, {{WRAPPER}} .premium-maps-location-info, {{WRAPPER}} .gm-style .gm-style-iw-tc::after' => 'background-color: {{VALUE}};',
852 ),
853 )
854 );
855
856 $this->add_group_control(
857 Group_Control_Border::get_type(),
858 array(
859 'name' => 'marker_window_border',
860 'selector' => '{{WRAPPER}} .gm-style-iw',
861 )
862 );
863
864 $this->add_control(
865 'marker_window_border_rad',
866 array(
867 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ),
868 'type' => Controls_Manager::SLIDER,
869 'size_units' => array( 'px', '%', 'em' ),
870 'selectors' => array(
871 '{{WRAPPER}} .gm-style-iw' => 'border-radius: {{SIZE}}{{UNIT}}',
872 ),
873 )
874 );
875
876 $this->add_group_control(
877 Group_Control_Box_Shadow::get_type(),
878 array(
879 'name' => 'marker_window_shadow',
880 'selector' => '{{WRAPPER}} .gm-style-iw',
881 )
882 );
883
884 $this->add_responsive_control(
885 'marker_window_padding',
886 array(
887 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
888 'type' => Controls_Manager::DIMENSIONS,
889 'size_units' => array( 'px', 'em', '%' ),
890 'selectors' => array(
891 '{{WRAPPER}} .premium-maps-info-container' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
892 ),
893 )
894 );
895
896 $this->add_control(
897 'title_heading',
898 array(
899 'label' => __( 'Location Title', 'premium-addons-for-elementor' ),
900 'type' => Controls_Manager::HEADING,
901 'separator' => 'before',
902 )
903 );
904
905 $this->add_control(
906 'premium_maps_pin_title_color',
907 array(
908 'label' => __( 'Text Color', 'premium-addons-for-elementor' ),
909 'type' => Controls_Manager::COLOR,
910 'global' => array(
911 'default' => Global_Colors::COLOR_PRIMARY,
912 ),
913 'selectors' => array(
914 '{{WRAPPER}} .premium-maps-info-title' => 'color: {{VALUE}};',
915 ),
916 )
917 );
918
919 $this->add_control(
920 'title_background',
921 array(
922 'label' => __( 'Background Color', 'premium-addons-for-elementor' ),
923 'type' => Controls_Manager::COLOR,
924 'selectors' => array(
925 '{{WRAPPER}} .premium-maps-title-wrap' => 'background-color: {{VALUE}};',
926 '{{WRAPPER}} .maps-skin1 .premium-maps-location-direction' => 'color: {{VALUE}};',
927 ),
928 )
929 );
930
931 $this->add_group_control(
932 Group_Control_Typography::get_type(),
933 array(
934 'name' => 'pin_title_typography',
935 'selector' => '{{WRAPPER}} .premium-maps-info-title',
936 )
937 );
938
939 $this->add_responsive_control(
940 'premium_maps_pin_title_margin',
941 array(
942 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
943 'type' => Controls_Manager::DIMENSIONS,
944 'size_units' => array( 'px', 'em', '%' ),
945 'selectors' => array(
946 '{{WRAPPER}} .premium-maps-title-wrap' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
947 ),
948 )
949 );
950
951 $this->add_responsive_control(
952 'premium_maps_pin_title_padding',
953 array(
954 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
955 'type' => Controls_Manager::DIMENSIONS,
956 'size_units' => array( 'px', 'em', '%' ),
957 'selectors' => array(
958 '{{WRAPPER}} .premium-maps-title-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
959 ),
960 )
961 );
962
963 $this->add_responsive_control(
964 'premium_maps_pin_title_align',
965 array(
966 'label' => __( 'Alignment', 'premium-addons-for-elementor' ),
967 'type' => Controls_Manager::CHOOSE,
968 'options' => array(
969 'left' => array(
970 'title' => __( 'Left', 'premium-addons-for-elementor' ),
971 'icon' => 'eicon-text-align-left',
972 ),
973 'center' => array(
974 'title' => __( 'Center', 'premium-addons-for-elementor' ),
975 'icon' => 'eicon-text-align-center',
976 ),
977 'right' => array(
978 'title' => __( 'Right', 'premium-addons-for-elementor' ),
979 'icon' => 'eicon-text-align-right',
980 ),
981 ),
982 'default' => 'center',
983 'toggle' => false,
984 'selectors' => array(
985 '{{WRAPPER}} .premium-maps-title-wrap' => 'text-align: {{VALUE}};',
986 ),
987 )
988 );
989
990 $this->add_control(
991 'description_heading',
992 array(
993 'label' => __( 'Description', 'premium-addons-for-elementor' ),
994 'type' => Controls_Manager::HEADING,
995 'separator' => 'before',
996 )
997 );
998
999 $this->add_control(
1000 'premium_maps_pin_text_color',
1001 array(
1002 'label' => __( 'Text Color', 'premium-addons-for-elementor' ),
1003 'type' => Controls_Manager::COLOR,
1004 'global' => array(
1005 'default' => Global_Colors::COLOR_SECONDARY,
1006 ),
1007 'selectors' => array(
1008 '{{WRAPPER}} .premium-maps-info-desc, {{WRAPPER}} .premium-maps-info-desc a' => 'color: {{VALUE}};',
1009 ),
1010 )
1011 );
1012
1013 $this->add_group_control(
1014 Group_Control_Typography::get_type(),
1015 array(
1016 'name' => 'pin_text_typo',
1017 'selector' => '{{WRAPPER}} .premium-maps-info-desc',
1018 )
1019 );
1020
1021 $this->add_responsive_control(
1022 'premium_maps_pin_text_margin',
1023 array(
1024 'label' => __( 'Margin', 'premium-addons-for-elementor' ),
1025 'type' => Controls_Manager::DIMENSIONS,
1026 'size_units' => array( 'px', 'em', '%' ),
1027 'selectors' => array(
1028 '{{WRAPPER}} .premium-maps-info-desc' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1029 ),
1030 )
1031 );
1032
1033 $this->add_responsive_control(
1034 'premium_maps_pin_text_padding',
1035 array(
1036 'label' => __( 'Padding', 'premium-addons-for-elementor' ),
1037 'type' => Controls_Manager::DIMENSIONS,
1038 'size_units' => array( 'px', 'em', '%' ),
1039 'selectors' => array(
1040 '{{WRAPPER}} .premium-maps-info-desc' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1041 ),
1042 )
1043 );
1044
1045 $this->add_responsive_control(
1046 'premium_maps_pin_description_align',
1047 array(
1048 'label' => __( 'Alignment', 'premium-addons-for-elementor' ),
1049 'type' => Controls_Manager::CHOOSE,
1050 'options' => array(
1051 'left' => array(
1052 'title' => __( 'Left', 'premium-addons-for-elementor' ),
1053 'icon' => 'eicon-text-align-left',
1054 ),
1055 'center' => array(
1056 'title' => __( 'Center', 'premium-addons-for-elementor' ),
1057 'icon' => 'eicon-text-align-center',
1058 ),
1059 'right' => array(
1060 'title' => __( 'Right', 'premium-addons-for-elementor' ),
1061 'icon' => 'eicon-text-align-right',
1062 ),
1063 ),
1064 'default' => 'center',
1065 'toggle' => false,
1066 'selectors' => array(
1067 '{{WRAPPER}} .premium-maps-info-desc' => 'text-align: {{VALUE}};',
1068 ),
1069 )
1070 );
1071
1072 $this->end_controls_section();
1073
1074 if ( $papro_activated ) {
1075
1076 $this->start_controls_section(
1077 'advanced_pins_style',
1078 array(
1079 'label' => __( 'Advanced Info', 'premium-addons-for-elementor' ),
1080 'tab' => Controls_Manager::TAB_STYLE,
1081 )
1082 );
1083
1084 $this->add_control(
1085 'info_icons_color',
1086 array(
1087 'label' => __( 'Icons Color', 'premium-addons-for-elementor' ),
1088 'type' => Controls_Manager::COLOR,
1089 'selectors' => array(
1090 '{{WRAPPER}} .maps-info-item i' => 'color: {{VALUE}};',
1091 ),
1092 )
1093 );
1094
1095 $this->add_control(
1096 'info_text_color',
1097 array(
1098 'label' => __( 'Text Color', 'premium-addons-for-elementor' ),
1099 'type' => Controls_Manager::COLOR,
1100 'selectors' => array(
1101 '{{WRAPPER}} .maps-info-item p, {{WRAPPER}} .maps-info-item a' => 'color: {{VALUE}};',
1102 ),
1103 )
1104 );
1105
1106 $this->add_group_control(
1107 Group_Control_Typography::get_type(),
1108 array(
1109 'name' => 'info_text_typography',
1110 'selector' => '{{WRAPPER}} .maps-info-item p',
1111 )
1112 );
1113
1114 $this->add_control(
1115 'skin1_heading',
1116 array(
1117 'label' => __( 'Get Directions Icon (Skin 1 only)', 'premium-addons-for-elementor' ),
1118 'type' => Controls_Manager::HEADING,
1119 'separator' => 'before',
1120 )
1121 );
1122
1123 $this->add_control(
1124 'directions_icon_color',
1125 array(
1126 'label' => __( 'Icon Color', 'premium-addons-for-elementor' ),
1127 'type' => Controls_Manager::COLOR,
1128 'selectors' => array(
1129 '{{WRAPPER}} .maps-skin1 .eicon-share-arrow' => 'color: {{VALUE}};',
1130 ),
1131 )
1132 );
1133
1134 $this->add_control(
1135 'skin2_heading',
1136 array(
1137 'label' => __( 'Get Directions Link (Skin 2, 3 only)', 'premium-addons-for-elementor' ),
1138 'type' => Controls_Manager::HEADING,
1139 'separator' => 'before',
1140 )
1141 );
1142
1143 $this->add_control(
1144 'directions_link_color',
1145 array(
1146 'label' => __( 'Text Color', 'premium-addons-for-elementor' ),
1147 'type' => Controls_Manager::COLOR,
1148 'selectors' => array(
1149 '{{WRAPPER}} .advanced-pin:not(.maps-skin1) .premium-maps-location-direction' => 'color: {{VALUE}};',
1150 ),
1151 )
1152 );
1153
1154 $this->add_group_control(
1155 Group_Control_Typography::get_type(),
1156 array(
1157 'name' => 'directions_link_typography',
1158 'selector' => '{{WRAPPER}} .advanced-pin:not(.maps-skin1) .premium-maps-location-direction',
1159 )
1160 );
1161
1162 $this->end_controls_section();
1163
1164 }
1165 }
1166
1167 /**
1168 * Render Google Maps widget output on the frontend.
1169 *
1170 * Written in PHP and used to generate the final HTML.
1171 *
1172 * @since 1.0.0
1173 * @access protected
1174 */
1175 protected function render() {
1176
1177 $papro_activated = Helper_Functions::check_papro_version();
1178
1179 $settings = $this->get_settings_for_display();
1180
1181 $map_pins = $settings['premium_maps_map_pins'];
1182
1183 $street_view = 'yes' === $settings['premium_maps_map_option_streeview'];
1184
1185 $scroll_wheel = 'yes' === $settings['premium_maps_map_option_mapscroll'];
1186
1187 $full_screen = 'yes' === $settings['premium_maps_map_option_fullscreen_control'];
1188
1189 $zoom_control = 'yes' === $settings['premium_maps_map_option_zoom_controls'];
1190
1191 $type_control = 'yes' === $settings['premium_maps_map_option_map_type_control'];
1192
1193 $automatic_open = 'yes' === $settings['premium_maps_marker_open'];
1194
1195 $hover_open = 'yes' === $settings['premium_maps_marker_hover_open'];
1196
1197 $hover_close = 'yes' === $settings['premium_maps_marker_mouse_out'];
1198
1199 $marker_cluster = false;
1200 $cluster_icon = '';
1201 $cluster_icon_size = '';
1202
1203 $cluster_enabled = Admin_Helper::get_integrations_settings()['premium-map-cluster'];
1204
1205 if ( ! empty( $settings['premium_map_id'] ) && $cluster_enabled ) {
1206 $marker_cluster = 'yes' === $settings['premium_maps_map_option_cluster'];
1207
1208 if ( $marker_cluster ) {
1209 $cluster_icon = $settings['cluster_icon']['url'];
1210 $cluster_icon_size = $settings['cluster_icon_size']['size'];
1211 }
1212 }
1213
1214 $centerlat = ! empty( $settings['premium_maps_center_lat'] ) ? $settings['premium_maps_center_lat'] : 18.591212;
1215
1216 $centerlong = ! empty( $settings['premium_maps_center_long'] ) ? $settings['premium_maps_center_long'] : 73.741261;
1217
1218 $marker_width = ! empty( $settings['premium_maps_markers_width'] ) ? $settings['premium_maps_markers_width'] : 1000;
1219
1220 $ip_location = $settings['premium_map_ip_location'];
1221
1222 if ( 'true' === $ip_location ) {
1223
1224 $ip_address = Helper_Functions::get_user_ip_address();
1225
1226 $env = Helper_Functions::get_ip_location_data( $ip_address );
1227
1228 if ( ! $env ) {
1229 return;
1230 }
1231
1232 $centerlat = isset( $env['location']['latitude'] ) ? $env['location']['latitude'] : $centerlat;
1233
1234 $centerlong = isset( $env['location']['longitude'] ) ? $env['location']['longitude'] : $centerlong;
1235 }
1236
1237 $map_settings = array(
1238 'mapId' => $settings['premium_map_id'],
1239 'maptype' => $settings['premium_maps_map_type'],
1240 'streetViewControl' => $street_view,
1241 'centerlat' => $centerlat,
1242 'centerlong' => $centerlong,
1243 'scrollwheel' => $scroll_wheel,
1244 'fullScreen' => $full_screen,
1245 'zoomControl' => $zoom_control,
1246 'typeControl' => $type_control,
1247 'automaticOpen' => $automatic_open,
1248 'hoverOpen' => $hover_open,
1249 'hoverClose' => $hover_close,
1250 'cluster' => $marker_cluster,
1251 'cluster_icon' => $cluster_icon,
1252 'cluster_icon_size' => $cluster_icon_size,
1253 'drag' => $settings['disable_drag'],
1254 'loadScroll' => $settings['load_on_visible'],
1255 'linkedCarouselId' => $settings['linked_carousel_id'],
1256 );
1257
1258 $this->add_render_attribute(
1259 'style_wrapper',
1260 array(
1261 'class' => array( 'premium_maps_map_height', 'premium-addons__v-hidden' ),
1262 'data-settings' => wp_json_encode( $map_settings ),
1263 'data-style' => $settings['premium_maps_custom_styling'],
1264 )
1265 );
1266
1267 ?>
1268
1269 <div class="premium-maps-container" id="premium-maps-container">
1270
1271 <?php if ( count( $map_pins ) ) { ?>
1272
1273 <div <?php $this->print_render_attribute_string( 'style_wrapper' ); ?>>
1274 <?php
1275 foreach ( $map_pins as $index => $pin ) {
1276
1277 $key = 'map_marker_' . $index;
1278
1279 $pin_longitude = $pin['map_longitude'];
1280 $pin_latitude = $pin['map_latitude'];
1281
1282 $this->add_render_attribute(
1283 $key,
1284 array(
1285 'class' => array( 'premium-pin', 'elementor-invisible' ),
1286 'data-lng' => $pin_longitude,
1287 'data-lat' => $pin_latitude,
1288 'data-icon' => $pin['pin_icon']['url'],
1289 'data-icon-size' => $pin['pin_icon_size']['size'],
1290 'data-max-width' => $marker_width,
1291 'data-activated' => 'yes' === $pin['open_by_default'],
1292 )
1293 );
1294
1295 if ( ! empty( $pin['custom_id'] ) ) {
1296 $this->add_render_attribute( $key, 'data-id', esc_attr( $pin['custom_id'] ) );
1297 }
1298
1299 $info_key = 'marker_info_' . $index;
1300
1301 $this->add_render_attribute( $info_key, 'class', 'premium-maps-info-container' );
1302
1303 if ( $papro_activated && 'yes' === $pin['advanced_view'] ) {
1304 $this->add_render_attribute(
1305 $info_key,
1306 'class',
1307 array(
1308 'advanced-pin',
1309 'maps-' . $pin['marker_skin'],
1310 )
1311 );
1312
1313 $this->render_advanced_pin_view( $pin, $key, $info_key );
1314
1315 } else {
1316
1317 $this->render_classic_pin_view( $pin, $key );
1318 }
1319
1320 ?>
1321
1322 <?php
1323 }
1324 ?>
1325
1326 </div>
1327
1328 <?php } ?>
1329
1330 </div>
1331
1332 <?php
1333 }
1334
1335 /**
1336 * Render Classic Pin View
1337 *
1338 * Renders the HTML markup of the classic view.
1339 *
1340 * @since 4.9.47
1341 * @access protected
1342 *
1343 * @param object $pin pin object.
1344 * @param string $key pin key.
1345 */
1346 protected function render_classic_pin_view( $pin, $key ) {
1347
1348 ?>
1349
1350 <div <?php $this->print_render_attribute_string( $key ); ?>>
1351 <?php if ( ! empty( $pin['pin_title'] ) || ! empty( $pin['pin_desc'] ) ) : ?>
1352 <div class='premium-maps-info-container'>
1353
1354 <div class='premium-maps-title-wrap'>
1355 <p class='premium-maps-info-title'><?php echo wp_kses_post( $pin['pin_title'] ); ?></p>
1356 </div>
1357
1358 <div class='premium-maps-info-desc'>
1359 <?php echo $this->parse_text_editor( $pin['pin_desc'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
1360 </div>
1361
1362 </div>
1363 <?php endif; ?>
1364 </div>
1365
1366 <?php
1367 }
1368
1369 /**
1370 * Render Advanced Pin View
1371 *
1372 * Renders the HTML markup of the advanced view.
1373 *
1374 * @since 4.9.47
1375 * @access protected
1376 *
1377 * @param object $pin pin object.
1378 * @param string $key pin key.
1379 * @param string $info_key pin info key.
1380 */
1381 protected function render_advanced_pin_view( $pin, $key, $info_key ) {
1382
1383 $pin_longitude = $pin['map_longitude'];
1384 $pin_latitude = $pin['map_latitude'];
1385
1386 $direction_link = sprintf( 'https://www.google.com/maps/dir/?api=1&destination=%s,%s', $pin_latitude, $pin_longitude );
1387
1388 ?>
1389
1390 <div <?php $this->print_render_attribute_string( $key ); ?>>
1391 <?php if ( ! empty( $pin['pin_title'] ) || ! empty( $pin['pin_desc'] ) ) : ?>
1392 <div <?php $this->print_render_attribute_string( $info_key ); ?>>
1393
1394 <div class='premium-maps-info-close'>
1395 <i class='eicon-close' aria-hidden='true'></i>
1396 </div>
1397
1398 <?php if ( 'skin3' === $pin['marker_skin'] ) : ?>
1399 <div class='premium-maps-skin3-wrap'>
1400 <?php endif; ?>
1401
1402 <div class='premium-maps-info-img'>
1403 <img src='<?php echo esc_attr( $pin['pin_img']['url'] ); ?>' alt='<?php echo esc_attr( isset( $pin['pin_img']['alt'] ) ? $pin['pin_img']['alt'] : '' ); ?>'>
1404 </div>
1405
1406
1407 <div class='premium-maps-title-wrap'>
1408 <p class='premium-maps-info-title'><?php echo wp_kses_post( $pin['pin_title'] ); ?></p>
1409
1410 <?php if ( in_array( $pin['marker_skin'], array( 'skin1', 'skin3' ) ) ) : ?>
1411 <?php if ( 'skin1' === $pin['marker_skin'] ) : ?>
1412 <div class='premium-maps-location-directions'>
1413 <?php endif; ?>
1414 <a class='premium-maps-location-direction' title='<?php echo esc_attr( __( 'Directions', 'premium-addons-for-elementor' ) ); ?>' ref='nofollow' target='_blank' href='<?php echo esc_url( $direction_link ); ?>'>
1415 <i class='eicon-share-arrow' aria-hidden='true'></i>
1416 <span><?php echo wp_kses_post( __( 'Get Directions', 'premium-addons-for-elementor' ) ); ?></span>
1417 </a>
1418 <?php if ( 'skin1' === $pin['marker_skin'] ) : ?>
1419 </div>
1420 <?php endif; ?>
1421 <?php endif; ?>
1422
1423 </div>
1424
1425 <?php if ( 'skin3' === $pin['marker_skin'] ) : ?>
1426 </div>
1427 <?php endif; ?>
1428
1429 <div class='premium-maps-location-info'>
1430
1431 <?php if ( ! empty( $pin['pin_address'] ) ) : ?>
1432 <div class='premium-maps-info-location maps-info-item'>
1433 <i class='eicon-map-pin' aria-hidden='true'></i>
1434 <p><?php echo wp_kses_post( $pin['pin_address'] ); ?></p>
1435 </div>
1436 <?php endif; ?>
1437
1438 <?php if ( ! empty( $pin['pin_website'] ) ) : ?>
1439 <div class='premium-maps-info-website maps-info-item'>
1440 <i class='eicon-globe' aria-hidden='true'></i>
1441 <p>
1442 <a href='<?php echo esc_url( $pin['pin_website'] ); ?>' target='_blank'>
1443 <?php echo esc_url( $pin['pin_website'] ); ?>
1444 </a>
1445 </p>
1446 </div>
1447 <?php endif; ?>
1448
1449 <?php if ( ! empty( $pin['pin_phone'] ) ) : ?>
1450 <div class='premium-maps-info-number maps-info-item'>
1451 <i class='eicon-headphones' aria-hidden='true'></i>
1452 <p>
1453 <a href='tel:<?php echo esc_attr( $pin['pin_phone'] ); ?>' target='_blank' rel='nofollow'>
1454 <?php echo wp_kses_post( $pin['pin_phone'] ); ?>
1455 </a>
1456 </p>
1457 </div>
1458 <?php endif; ?>
1459
1460 <?php if ( ! empty( $pin['pin_hours'] ) ) : ?>
1461 <div class='premium-maps-info-hours maps-info-item'>
1462 <i class='eicon-clock-o' aria-hidden='true'></i>
1463 <p><?php echo wp_kses_post( $pin['pin_hours'] ); ?></p>
1464 </div>
1465 <?php endif; ?>
1466
1467 <div class='premium-maps-info-desc'>
1468 <?php echo $this->parse_text_editor( $pin['pin_desc'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
1469 </div>
1470
1471 <?php if ( 'skin2' === $pin['marker_skin'] ) : ?>
1472 <a class='premium-maps-location-direction' title='<?php echo esc_attr( __( 'Directions', 'premium-addons-for-elementor' ) ); ?>' ref='nofollow' target='_blank' href='<?php echo esc_url( $direction_link ); ?>'>
1473 <?php echo wp_kses_post( __( 'Get Directions', 'premium-addons-for-elementor' ) ); ?>
1474 </a>
1475 <?php endif; ?>
1476
1477 </div>
1478
1479 </div>
1480 <?php endif; ?>
1481 </div>
1482
1483 <?php
1484 }
1485 }
1486