jomarkosabel (March 12th, 2012)
$location_heading = "This is not a location within Canada";
Miami, FL, United States or Washington State, United States or United States
<?php if (isset($_GET['resume_search']) && $_GET['resume_search']) : get_template_part('search-resume'); exit; endif; ?>
<?php if (isset($_GET['location'])) $_GET['location'] = urldecode(utf8_uri_encode($_GET['location'])); ?>
<?php get_header('search'); ?>
<?php do_action('jobs_will_display'); ?>
<div class="section">
<?php
// Global so we can pass it on to the filter-process.php file
global $find_posts_in, $search_result_ids, $wp_query, $query_string;
query_posts($query_string . '&posts_per_page=-1');
$term_heading = '';
$location_heading = '';
$search = get_search_query();
$location = isset( $_GET['location'] ) ? trim($_GET['location']) : '';
$radius = isset( $_GET['radius'] ) ? absint( $_GET['radius'] ) : 0;
if ( !$radius )
$radius = 50;
if ($search) :
$search_result_ids[] = 0;
if ($wp_query->posts) foreach ($wp_query->posts as $p) : $search_result_ids[] = $p->ID.''; endforeach;
$term_heading = __('Searching for ','appthemes').'“'.$search.'” ';
endif;
if ($location) :
// Get address from post data
$address_array = '';
if (isset($_REQUEST['latitude']) && $_REQUEST['latitude'] && $_REQUEST['longitude'] && $_REQUEST['full_address']) :
$address_array = array(
'north_east_lng' => trim(stripslashes( $_REQUEST['north_east_lng'] )),
'south_west_lng' => trim(stripslashes( $_REQUEST['south_west_lng'] )),
'north_east_lat' => trim(stripslashes( $_REQUEST['north_east_lat'] )),
'south_west_lat' => trim(stripslashes( $_REQUEST['south_west_lat'] )),
'longitude' => trim(stripslashes( $_REQUEST['longitude'] )),
'latitude' => trim(stripslashes( $_REQUEST['latitude'] )),
'full_address' => trim(stripslashes( $_REQUEST['full_address'] ))
);
endif;
// Do radial search
$radial_result = jr_radial_search($location, $radius, $address_array);
//ECODE Disabled
/*if (is_array($radial_result)) :
if ($radial_result['address']) $location = $radial_result['address'];
$find_posts_in = $radial_result['posts'];
endif;*/
//ECODE On
if (is_array($radial_result)) :
if ($radial_result['address']){
//$location = $radial_result['address'];
$notwithin = strrpos($radial_result['address'], "Canada");
if ($notwithin === false) {
// not found...
$location = "howdy do";
}else if($notwithin === true){
$location = $radial_result['address'];
}
}
$find_posts_in = $radial_result['posts'];
endif;
/*
if ( get_option('jr_distance_unit') == 'km' )
//ECODE off
$format = __( 'Jobs within %s kilometers of %s', 'appthemes' );
//ECODE on
//$format = __( 'Jobs within '.$radius.' kilometers of '.$radial_result['address'], 'appthemes' );
else
$format = __( 'Jobs within %s miles of %s', 'appthemes' );
*/
if ( get_option('jr_distance_unit') == 'km' ){
//ECODE off
$format = __( 'Jobs within %s kilometers of %s', 'appthemes' );
//ECODE on
//$format = __( 'Jobs within '.$radius.' kilometers of '.$radial_result['address'], 'appthemes' );
}else{
$format = __( 'Jobs within %s miles of %s', 'appthemes' );
}
//$location_heading = sprintf( $format, $radius, $location );
//ECODE
$location_heading = sprintf( $format, $radius, $location );
$withinl = strrpos(sprintf( $format, $radius, $location ), "Canada");
if ($withinl === true) {
//$location_heading = sprintf( $format, $radius, $location ); //as is
$location_heading = sprintf( $format, $radius, $location );
$legit = "yes";
}else if($notwithin === false){
// not found...
$location_heading = "This is not a location within Canada";
$legit = "no";
}
//ECODE
echo "<h1>".$location_heading."</h1>";
//echo $location_heading." loc head 1<br />";
//echo $radial_result['posts']." loc head 2<br />";
//echo $radial_result['address']." loc head 3<br />";
//echo $location." loc head 4<br />";
//echo $find_posts_in." loc head 5<br />";
/*echo $format." loc head 6<br />";
echo $term_heading." loc head 7<br />";
echo " loc head <br />";
echo " loc head <br />";
echo " loc head <br />";
echo "code prime loc head z<br />";*/
endif;
if ( !$term_heading && !$location_heading )
$term_heading = __('Search Results', 'appthemes');
?>
<?php /*
<h1 class="pagetitle"><?php echo $term_heading.$location_heading; ?> <?php if ( $paged>1 ) : ?>(<?php _e('page','appthemes'); ?> <?php echo number_format_i18n( $paged ); ?>)<?php endif; ?></h1>
*/ ?>
<h1 class="pagetitle"><?php
if($legit == "no"){
//echo $term_heading.$location_heading;
}else if($legit == "yes"){
//echo $format;
////echo $term_heading.$location_heading;
//echo $location_heading;
}
?> <?php if ( $paged>1 ) : ?>(<?php _e('page','appthemes'); ?> <?php echo number_format_i18n( $paged ); ?>)<?php endif; ?></h1>
<?php
$args = jr_filter_form();
query_posts($args);
?>
<?php get_template_part( 'loop', 'job' ); ?>
<?php jr_paging(); ?>
<div class="clear"></div>
</div><!-- end section -->
<?php do_action('after_search_results'); ?>
<div class="clear"></div>
</div><!-- end main content -->
<?php if (get_option('jr_show_sidebar')!=='no') get_sidebar(); ?>
<?php get_footer(); ?>
jomarkosabel (March 12th, 2012)
There are currently 1 users browsing this thread. (0 members and 1 guests)