芝麻web文件管理V1.00
编辑当前文件:/home/royashxg/www/wp-content/plugins/elementor/includes/widgets/google-maps.php
start_controls_section( 'section_map', [ 'label' => esc_html__( 'Google Maps', 'elementor' ), ] ); if ( Plugin::$instance->editor->is_edit_mode() ) { $api_key = get_option( 'elementor_google_maps_api_key' ); if ( ! $api_key ) { $this->add_control( 'api_key_notification', [ 'type' => Controls_Manager::ALERT, 'alert_type' => 'info', 'content' => sprintf( /* translators: 1: Integration settings link open tag, 2: Create API key link open tag, 3: Link close tag. */ esc_html__( 'Set your Google Maps API Key in Elementor\'s %1$sIntegrations Settings%3$s page. Create your key %2$shere.%3$s', 'elementor' ), '
', '
', '
' ), ] ); } } $default_address = esc_html__( 'London Eye, London, United Kingdom', 'elementor' ); $this->add_control( 'address', [ 'label' => esc_html__( 'Location', 'elementor' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true, 'categories' => [ TagsModule::POST_META_CATEGORY, ], ], 'ai' => [ 'active' => false, ], 'placeholder' => $default_address, 'default' => $default_address, 'label_block' => true, ] ); $this->add_control( 'zoom', [ 'label' => esc_html__( 'Zoom', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 10, ], 'range' => [ 'px' => [ 'min' => 1, 'max' => 20, ], ], 'separator' => 'before', ] ); $this->add_responsive_control( 'height', [ 'label' => esc_html__( 'Height', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 40, 'max' => 1440, ], ], 'size_units' => [ 'px', 'em', 'rem', 'vh', 'custom' ], 'selectors' => [ '{{WRAPPER}} iframe' => 'height: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_map_style', [ 'label' => esc_html__( 'Google Maps', 'elementor' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->start_controls_tabs( 'map_filter' ); $this->start_controls_tab( 'normal', [ 'label' => esc_html__( 'Normal', 'elementor' ), ] ); $this->add_group_control( Group_Control_Css_Filter::get_type(), [ 'name' => 'css_filters', 'selector' => '{{WRAPPER}} iframe', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'hover', [ 'label' => esc_html__( 'Hover', 'elementor' ), ] ); $this->add_group_control( Group_Control_Css_Filter::get_type(), [ 'name' => 'css_filters_hover', 'selector' => '{{WRAPPER}}:hover iframe', ] ); $this->add_control( 'hover_transition', [ 'label' => esc_html__( 'Transition Duration', 'elementor' ) . ' (s)', 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 3, 'step' => 0.1, ], ], 'selectors' => [ '{{WRAPPER}} iframe' => 'transition-duration: {{SIZE}}s', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Render google maps widget output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.0.0 * @access protected */ protected function render() { $settings = $this->get_settings_for_display(); if ( empty( $settings['address'] ) ) { return; } if ( 0 === absint( $settings['zoom']['size'] ) ) { $settings['zoom']['size'] = 10; } $api_key = esc_html( get_option( 'elementor_google_maps_api_key' ) ); $params = [ rawurlencode( $settings['address'] ), absint( $settings['zoom']['size'] ), ]; if ( $api_key ) { $params[] = $api_key; $url = 'https://www.google.com/maps/embed/v1/place?key=%3$s&q=%1$s&zoom=%2$d'; } else { $url = 'https://maps.google.com/maps?q=%1$s&t=m&z=%2$d&output=embed&iwloc=near'; } ?>