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/gmap.tar
google_map.php000064400000003201151555215730007373 0ustar00<?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();

  }

}inc/gmap-hook.php000064400000001145151555215730007722 0ustar00<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly.
/**
 *
 * Field: Gmap
 *
 * @since 1.0.0
 * @version 1.0.0
 *
 */ 

if( ! function_exists( 'cs_google_map_scripts' ) ) {  
  function cs_google_map_scripts(){
      wp_enqueue_script( "gmap-api", "//maps.googleapis.com/maps/api/js?key=AIzaSyBEFScZFRjMnP_DFu-Ptfp0WtfyhDRl4DA&libraries=geometry" );
      wp_enqueue_script( "gmap-script", "//cdn.jsdelivr.net/jquery.geocomplete/1.6.5/jquery.geocomplete.min.js", array("jquery"), "1.6.5", false );
    }
  add_action( "admin_enqueue_scripts", "cs_google_map_scripts" );
}