HEX
Server: nginx/1.18.0
System: Linux hqnl0246134.online-vm.com 5.4.0-135-generic #152-Ubuntu SMP Wed Nov 23 20:19:22 UTC 2022 x86_64
User: www-data (33)
PHP: 7.4.33
Disabled: phpinfo,disk_free_space,disk_total_space,diskfreespace,dl,exec,opcache_get_configuration,opcache_get_status,passthru,pclose,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_waitpid,pcntl_wait,pcntl_wexitstatus,pcntl_wifcontinued,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,popen,posix_getpwuid,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,posix_uname,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,show_source,system,exec,passthru,shell_exec,system,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source
Upload Files
File: /var/www/sites/u-port.ua/wp-content/themes/customize/onco.php
<?php
/*
Template Name: Страница Онкоцентров
*/
?>
<?php get_header(); ?>
<div class="side-bar-btn-wrap">
			<div class="side-bar-btn">
			 <span class="top-arrow"></span>
			 <span class="bot-arrow"></span>
			</div>
		</div>
<div class="container-fluid fail-bg footer-down">
	<div class="row">
		<div class="container">
			<div class="row">
				<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 move-bar">
					<?php get_sidebar(); ?>
				</div>
				<div class="col-lg-9 col-md-9 col-sm-8 col-xs-12 inner-pad">
					
						<?php if (function_exists('breadcrumb_trail')) { breadcrumb_trail(); } ?>
					
					<div class="select-wrap">
					<h1><?php the_field("h1"); ?></h1>
					<h3 class="select-title"><?php _e("Виберіть місцезнаходження онкоцентру:", "customize"); ?></h3>
					<select name="event-dropdown" id="map-select">
						
						<?php
						$categories=  get_categories('child_of=20');
						foreach ($categories as $category) {
							$option = '<option value="/category/archives/'.$category->category_nicename.'">';
								$option .= $category->cat_name;
								
							$option .= '</option>';
							echo $option;
						}
						?>
					</select>
					</div>
					<div id="map"></div>
					<h4 class="address-title"><?php _e("Адреси окноцентрів: ", "customize"); ?></h4>
					<div class="row onco-wrap">
						<?php
						if (get_locale() == 'uk') {
							$cn = 20;
						} else {
							$cn = 64;
						}
						?>
						<?php $posts = get_posts ("category=".$cn."&numberposts=900&order=ASC"); ?>
						<?php if ($posts) : ?>
						<?php foreach ($posts as $post) : setup_postdata ($post); ?>
						
						<div class="region col-lg-4 col-md-4 col-sm-6 col-xs-12" data-cent-name="<?php $cat = get_the_category(); echo $cat[0]->cat_name; ?>">
							
								<p class="cent-name"><?php the_title(); ?></p>
								<p class="cent-address" data-cent-address="<?php the_field("centAddress"); ?>" data-cent-lat="<?php the_field("lat"); ?>" data-cent-lng="<?php the_field("lng"); ?>"><?php the_field("centAddress"); ?></p>
								<p class="cent-phone"><?php the_field("centPhone"); ?></p>
								<p class="cent-mail"><?php the_field("centMail"); ?></p>
								<p class="cent-site"><?php the_field("centSite"); ?></p>
							
						</div>
						
						<?php
						endforeach;
						wp_reset_postdata();
						?>
						<?php endif; ?>
						
					</div>
				</div>
				
			</div>
		</div>
	</div>
</div>
</div>

<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false&key=AIzaSyBDYoym_gTJfDRgXj8KdlKCreUL1I1qkuc"></script>
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="<?php bloginfo('template_url');?>/js/gmaps.js"></script>
<script>
$(document).ready(function(){
	$('option:nth-child(10)').attr('selected', 'selected');
	$('.cent-phone:empty').hide()
	$('.cent-mail:empty').hide()
	$('.cent-site:empty').hide()

	var map = new GMaps({
		div: '#map',
		lat: 50.4414339,
		lng: 30.5496378,
		zoom: 9,
	});
		
		GMaps.geocode({
  			address: $('#map-select :selected').text(),
  				callback: function(results, status) {
  	
    				if (status == 'OK') {
      				var latlng = results[0].geometry.location;
      				map.setCenter(latlng.lat(), latlng.lng());
     					map.setZoom(9);
     				}
  				}

			});

var currentRegion = $('.row').find('.region');
		  $(currentRegion).each(function(){
		  	if($(this).attr('data-cent-name') == $('#map-select :selected').text()){
		 	$(this).css({'display':'inline-block'});
		 } else {
		 	$(this).css({'display':'none'});
		 }
})


		var popupTemplate = '<div class="popupText"><h3>%1</h3><p>%2</p></div>';

$(".region").each(function() {
    var title = $(this).find(".cent-name").text();
    var address = $(this).find(".cent-address").text();
    var lat = $(this).find(".cent-address").attr('data-cent-lat');
    var lng = $(this).find(".cent-address").attr('data-cent-lng');

    map.addMarker({
                    lat: lat,
                    lng: lng,
                    
                    infoWindow: {
                        content: popupTemplate.replace('%1',title).replace('%2',address)
                    }
                });
            
        
    
});

		$('#map-select').change(function(){
GMaps.geocode({
  			address: $('#map-select :selected').text(),
  				callback: function(results, status) {
  	
    				if (status == 'OK') {
      				var latlng = results[0].geometry.location;
      				map.setCenter(latlng.lat(), latlng.lng());
     					map.setZoom(9);
     				}
  				}

			});
		})
$('#map-select').change(function(){
		  var currentRegion = $('.row').find('.region');
		  $(currentRegion).each(function(){
		  	if($(this).attr('data-cent-name') == $('#map-select :selected').text()){
		 	$(this).css({'display':'inline-block'});
		 } else {
		 	$(this).css({'display':'none'});
		 }
		  })
		 
				
			
	})
	}) // doc end
		 

$('.cent-address').attr('data-cent-address');	
</script>
<?php get_footer(); ?>