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.php 0000644 00000003201 15156036115 0032352 0 ustar 00 var/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();
}
}