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