SHARE
TWEET

Geo Data store

a guest Jul 31st, 2012 565 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.             // Only do a map search if user submitted one
  2.             if( 2 == $_SESSION['s_doing_property_search'] )
  3.             {
  4.                 // Only generate map search results if we don't have any yet or if they are a day out of date
  5.                 if( empty( $_SESSION['homes_for_' . $type . '_map_search_results'] ) || $_SESSION['homes_for_' . $type . '_map_search_timestamp'] < strtotime( "-1 Day" ) )
  6.                 {
  7.                     // Load instance of GeoDataStore
  8.                     if ( ! isset( $sc_gds ) )
  9.                         $sc_gds = new sc_GeoDataStore();
  10.  
  11.                     // Just get the ID's of posts in range
  12.                     $_SESSION['homes_for_' . $type . '_map_search_results'] = (array) $sc_gds->getPostIDsOfInRange( "homes-for-" . $type, $_SESSION['s_property_radius'], $_SESSION['s_property_address_lat'], $_SESSION['s_property_address_lng'] );
  13.  
  14.                     // Set a timestamp so we don't do this expensive get each page load.
  15.                     $_SESSION['homes_for_' . $type . '_map_search_timestamp'] = time();
  16.                 }
  17.  
  18.                 // We we have no results then set an array just one that will trigger no posts found.
  19.                 if( empty( $_SESSION['homes_for_' . $type . '_map_search_results'] ) )
  20.                     $query->set( 'post__in', array(1) );
  21.                 else
  22.                     $query->set( 'post__in', $_SESSION['homes_for_' . $type . '_map_search_results'] );
  23.             }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top