HEX
Server: Apache
System: Linux webm013.cluster123.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: lesanew (165608)
PHP: 8.3.31
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/lesanew/www/wp-content/plugins/neobeat-core/inc/maps/maps.php
<?php

if ( ! class_exists( 'NeoBeatCoreMaps' ) ) {
	class NeoBeatCoreMaps {
		private static $instance;
		
		function __construct() {
			
			// Include google map scripts
			add_action( 'wp_enqueue_scripts', array( $this, 'include_google_scripts' ) );
			
			// Load global maps variables
			add_action( 'wp_enqueue_scripts', array( $this, 'set_global_map_variables' ), 20 );
			
			$maps_in_admin = apply_filters( 'materds_core_filter_google_maps_in_admin', false );
			if ( $maps_in_admin ) {
				add_action( 'admin_enqueue_scripts', array( $this, 'include_google_scripts' ) );
			}
		}
		
		public static function get_instance() {
			if (null == self::$instance) {
				self::$instance = new self;
			}
			
			return self::$instance;
		}
		
		public function include_google_scripts() {
			$google_maps_api_key          = neobeat_core_get_option_value( 'admin', 'qodef_maps_api_key' );
			$google_maps_extensions       = '';
			$google_maps_extensions_array = apply_filters( 'neobeat_core_filter_google_maps_extensions', array() );
			
			if ( ! empty( $google_maps_extensions_array ) ) {
				$google_maps_extensions .= '&libraries=';
				$google_maps_extensions .= implode( ',', $google_maps_extensions_array );
			}
			
			if ( ! empty( $google_maps_api_key ) ) {
				wp_register_script( 'google-map-api', '//maps.googleapis.com/maps/api/js?key=' . esc_attr( $google_maps_api_key ) . $google_maps_extensions, array(), false, true );
				wp_register_script( 'neobeat-core-google-map', NEOBEAT_CORE_INC_URL_PATH . '/maps/assets/js/google-map.js', array( 'google-map-api', 'jquery' ), false, true );
			}
		}
		
		public function set_global_map_variables() {
			$map_zoom = neobeat_core_get_post_value_through_levels( 'qodef_map_zoom' );
			$map_style = json_decode( neobeat_core_get_post_value_through_levels( 'qodef_map_style' ) );
			
			$js_map_variables['mapStyle']          = ! empty ( $map_style ) ? $map_style : '';
			$js_map_variables['mapZoom']           = ! empty ( $map_zoom ) ? $map_zoom : 12;
			$js_map_variables['mapScrollable']     = neobeat_core_get_post_value_through_levels( 'qodef_enable_map_scroll' ) == 'yes' ? true : false;
			$js_map_variables['mapDraggable']      = neobeat_core_get_post_value_through_levels( 'qodef_enable_map_drag' ) == 'yes' ? true : false;
			$js_map_variables['streetViewControl'] = neobeat_core_get_post_value_through_levels( 'qodef_enable_map_street_view_control' ) == 'yes' ? true : false;
			$js_map_variables['zoomControl']       = neobeat_core_get_post_value_through_levels( 'qodef_enable_map_zoom_control' ) == 'yes' ? true : false;
			$js_map_variables['mapTypeControl']    = neobeat_core_get_post_value_through_levels( 'qodef_enable_map_type_control' ) == 'yes' ? true : false;
			$js_map_variables['fullscreenControl'] = neobeat_core_get_post_value_through_levels( 'qodef_enable_map_full_screen_control' ) == 'yes' ? true : false;
			
			$js_map_variables = apply_filters( 'neobeat_core_filter_js_map_variables', $js_map_variables );
			
			wp_localize_script( 'neobeat-core-google-map', 'qodefMapsVariables', array(
				'global' => $js_map_variables
			) );
		}
	}
}

NeoBeatCoreMaps::get_instance();