Example #1
0
 /**
  * Use templates to output content for objects.
  * 
  * @since 1.3
  */
 public static function generate_object_html()
 {
     global $geo_mashup_options, $geo_mashup_custom, $comments, $users;
     $object_ids = $_GET['object_ids'];
     if (!is_array($object_ids)) {
         $object_ids = split(',', $object_ids);
     }
     $object_name = isset($_GET['object_name']) ? $_GET['object_name'] : 'post';
     $template_base = isset($_GET['template']) ? $_GET['template'] : '';
     switch ($object_name) {
         case 'post':
             $query_vars = array('post__in' => $object_ids, 'post_type' => 'any', 'post_status' => 'publish,future');
             // Don't filter this query through other plugins (e.g. event-calendar)
             $query_vars['suppress_filters'] = true;
             // No sticky posts please
             if (function_exists('get_queried_object')) {
                 $query_vars['ignore_sticky_posts'] = true;
             } else {
                 $query_vars['caller_get_posts'] = true;
             }
             // Necessary only for WP 3.0 support
             // Don't limit the number of results
             $query_vars['posts_per_page'] = -1;
             query_posts($query_vars);
             if (have_posts()) {
                 status_header(200);
             }
             $template_base = empty($template_base) ? 'info-window' : $template_base;
             break;
         case 'comment':
             $comments = GeoMashupDB::get_comment_in(array('comment__in' => $object_ids));
             if (!empty($comments)) {
                 status_header(200);
             }
             $template_base = empty($template_base) ? 'comment' : $template_base;
             break;
         case 'user':
             $users = GeoMashupDB::get_user_in(array('user__in' => $object_ids));
             if (!empty($users)) {
                 status_header(200);
             }
             $template_base = empty($template_base) ? 'user' : $template_base;
             break;
     }
     load_template(GeoMashup::locate_template($template_base));
 }