HEX
Server: LiteSpeed
System: Linux eko108.isimtescil.net 4.18.0-477.21.1.lve.1.el8.x86_64 #1 SMP Tue Sep 5 23:08:35 UTC 2023 x86_64
User: uyarreklamcomtr (11202)
PHP: 7.4.33
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/uyarreklam.com.tr/httpdocs/google_map.php.tar
uyarreklam.com.tr/httpdocs/wp-content/themes/vadimarketv4/inc/temapanel/fields/gmap/google_map.php000064400000003201151560361150032352 0ustar00var/www/vhosts<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly.
/**
 *
 * Field: Gmap
 *
 * @since 1.0.0
 * @version 1.0.0
 *
 */ 

require dirname(__FILE__).'/inc/gmap-hook.php';

class CSFramework_Option_gmap extends CSFramework_Options {

  public function __construct( $field, $value = '', $unique = '' ) {
    parent::__construct( $field, $value, $unique );
  }

  public function output(){

    echo $this->element_before();
	
	$defaults_value = array(
      'default'  => '40.9909378,29.0218806',
    );	
	
	$value = wp_parse_args( $this->element_value(), $defaults_value );
	
    echo '<div id="'. $this->field['id'] .'_iframe" style="height:370px;"></div>';
    echo '<input type="hidden" name="'. $this->element_name() .'" value="'. $value['default'] .'" id="'. $this->field['id'] .'" />';
	echo '<script type="text/javascript">function initialize() {
	  var myLatlng = new google.maps.LatLng('.$this->element_value().');
	  var mapOptions = {
	    zoom: 15,
	    center: myLatlng,
	    draggableCursor: "crosshair",
	  }
	  var map = new google.maps.Map(document.getElementById(\''. $this->field['id'] .'_iframe\'), mapOptions);

	  var marker = new google.maps.Marker({
	      position: myLatlng,
	      map: map,
	  });

	  google.maps.event.addListener(map, \'click\', function(location) {

	  	var newLatlng = location.latLng
	    marker.setPosition(newLatlng);
	    $(\'#'. $this->field['id'] .'\').val(newLatlng.lat() + "," + newLatlng.lng());
	  });
	}

	google.maps.event.addDomListener(window, \'load\', initialize);</script>';
    
    echo $this->element_after();

  }

}