HEX
Server: Apache
System: Linux c119.dattaweb.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: c1190199 (57165)
PHP: 7.4.33
Disabled: mail, system, shell, exec, system_exec, shell_exec, mysql_pconnect, passthru, popen, proc_open, proc_close, proc_nice, proc_terminate, proc_get_status, escapeshellarg, escapeshellcmd, eval, dl, imap_mail, libvirt_connect, gnupg_init, unsetenv, apache_setenv, pcntl_exec, pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_get_handler, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_getpriority, pcntl_setpriority, pcntl_async_signals, opcache_get_status, opcache_reset, opcache_get_configuration
Upload Files
File: /home/c1190199/public_html/wp-content/themes/directory/AIT/Framework/Shortcodes/gMaps/ait-gmap.php
<?php

// back compatibility with older AIT themes. Removes script enqueued in functions.php
add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );
function my_deregister_javascript() { wp_dequeue_script('JS_googleMaps'); wp_deregister_script( 'JS_googleMaps' ); }

function theme_shortcode_googlemap($atts, $content = null, $code) {

	$folder = basename(dirname(__FILE__));

	// directory themes already include gmaps
	$list = $GLOBALS['wp_scripts']->queue;
	if (!in_array('ait-googlemaps-api', $list)) {
		wp_enqueue_script('googlemap-api', "http://maps.google.com/maps/api/js?sensor=false&amp;language=en");
	}
	if (!in_array('ait-jquery-gmap3', $list)) {
		wp_enqueue_script('ait-gmap', AIT_FRAMEWORK_URL . "/Shortcodes/{$folder}/gmap3.min.js",  array('jquery', 'googlemap-api'), '1.0');
	}

	extract(shortcode_atts(array(
		"width" => false,
		"height" => '400',
		"address" => '',
		"latitude" => 0,
		"longitude" => 0,
		"zoom" => 3,
		"text" => '',
		"popup" => 'false',
		"controls" => '[]',
		"scrollwheel" => 'true',
		"type" => 'ROADMAP',
		"marker" => 'true',
		'align' => false,
		'border' => 'no'
	), $atts));

	if($width && is_numeric($width)){
		$width = 'width:'.$width.'px;';
	}else{
		$width = '';
	}
	if($height && is_numeric($height)){
		$height = 'height:'.$height.'px';
	}else{
		$height = '';
	}

	if($border == "yes"){
		$borderStyle = ' border';
	} else {
		$borderStyle = "";
	}


	$align = $align?' align'.$align:'';
	$id = rand(100,1000);

	$centerCode = ($latitude == 0 && $latitude == 0 && trim($address) != '') ? "" : "center:[{$latitude}, {$longitude}],";
	$latLngCode = ($latitude == 0 && $latitude == 0 && trim($address) != '') ? "" : "latLng:[{$latitude}, {$longitude}],";
	$addressCode = ($centerCode == "") ? "address: '{$address}'," : "";

	if($marker != 'false'){
		return <<<HTML
<style type="text/css" scoped="scoped">
/* map style fix */
.sc-map img{ max-width: inherit !important; }
</style>
<div class="sc-map{$borderStyle}"><div class="wrap">
<div id="google_map_{$id}" class="google_map google_map{$align}" style="{$width}{$height}"></div>
<script type="text/javascript">
jQuery(document).ready(function($) {

	jQuery("#google_map_{$id}").bind('initGmap',function(){
		jQuery(this).gmap3({
			map:{
				{$addressCode}
				options:{
					{$centerCode}
					mapTypeId: google.maps.MapTypeId.{$type},
					zoom: {$zoom},
					scrollwheel:{$scrollwheel}
				}
			},
			marker:{
				{$addressCode}
			    {$latLngCode}
			    content: "{$text}"
			}
		});
		jQuery(this).data("gMapInited",true);
	}).data("gMapInited",false);
	// in tabs shortcode
	var tabs = jQuery("#google_map_{$id}").parents('.ait-tabs');
	if(tabs.size()!=0){
		tabs.bind('tabsshow', function(event, ui) {
			jQuery(ui.panel).find('.google_map').each(function(){
				if(jQuery(this).data("gMapInited")==false){
					jQuery(this).trigger('initGmap');
				}
			});
		});
	}else{
		jQuery("#google_map_{$id}").trigger('initGmap');
	}
});
</script>
</div></div>
HTML;
	}else{
return <<<HTML
<style type="text/css" scoped="scoped">
/* map style fix */
.sc-map img{ max-width: inherit !important; }
</style>
<div class="sc-map{$borderStyle}"><div class="wrap">
<div id="google_map_{$id}" class="google_map google_map{$align}" style="{$width}{$height}"></div>
<script type="text/javascript">
jQuery(document).ready(function($) {

	jQuery("#google_map_{$id}").bind('initGmap',function(){
		jQuery(this).gmap3({
			map:{
				{$addressCode}
				options:{
					{$centerCode}
					mapTypeId: google.maps.MapTypeId.{$type},
					zoom: {$zoom},
					scrollwheel:{$scrollwheel}
				}
			},
			marker:{
				{$addressCode}
			    {$latLngCode}
			    content: "{$text}"
			}
		});
		jQuery(this).data("gMapInited",true);
	}).data("gMapInited",false);

	// in tabs shortcode
	var tabs = jQuery("#google_map_{$id}").parents('.ait-tabs');
	if(tabs.size()!=0){
		tabs.bind('tabsshow', function(event, ui) {
			jQuery(ui.panel).find('.google_map').each(function(){
				if(jQuery(this).data("gMapInited")==false){
					jQuery(this).trigger('initGmap');
				}
			});
		});
	}else{
		jQuery("#google_map_{$id}").trigger('initGmap');
	}
});
</script>
</div></div>
HTML;
	}
}

add_shortcode('googlemap','theme_shortcode_googlemap');