Ejemplo n.º 1
0
 /**
  * Run a query for object locations from GET parameters and print JSON results.
  * 
  * @since 1.2
  */
 public static function generate_location_json()
 {
     /* TODO: Try to track modification?
     		if ( !empty( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) {
     			$http_time = strtotime( $_SERVER['HTTP_IF_MODIFIED_SINCE'] );
     			$mod_time = strtotime( $post->post_modified_gmt . ' GMT' );
     			if ($mod_time <= $http_time) {
     				return status_header(304); // Not modified
     			}
     		}
     
     		status_header(200);
     		header( 'Last-Modified: ' . mysql2date( 'D, d M Y H:i:s', $post->post_modified_gmt, false ) . ' GMT' );
     		header( 'Content-type: text/xml; charset='.get_settings('blog_charset'), true);
     		header( 'Cache-control: max-age=300, must-revalidate', true);
     		header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + 300 ) . " GMT" );
     		header( 'Pragma:' );
     		 */
     status_header(200);
     header('Content-type: application/json; charset=' . get_option('blog_charset'), true);
     header('Cache-Control: no-cache;', true);
     header('Expires: -1;', true);
     $json = GeoMashup::get_locations_json($_REQUEST);
     if (isset($_REQUEST['callback'])) {
         $json = $_REQUEST['callback'] . '(' . $json . ')';
     }
     echo $json;
 }