File: /var/www/vhosts/uyarreklam.com.tr/httpdocs/gmap.tar
google_map.php 0000644 00000003201 15155521573 0007373 0 ustar 00 <?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.php 0000644 00000001145 15155521573 0007722 0 ustar 00 <?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" );
}