Пример #1
0
function post_atom_entry($post, $filters = array())
{
    global $config;
    $summary = $post['summary'];
    $summary .= "...";
    $summary = make_var_atom_safe($summary);
    $summary = sprintf("<![CDATA[%s]]>", $summary);
    if ($filters['fulltext']) {
        $flatfile = $GLOBALS['config']['path_to_pipeline'] . $post['filename'];
        $xml = process_post_xml($flatfile, false);
        $summary = $xml['description'];
    }
    if ($config['local_alternates']) {
        $post['url'] = slinkto("post.php", array(), array("post_id" => $post['post_id']));
    }
    $post = make_array_atom_safe($post);
    $image = "";
    $default_image_pattern = "/default\\.png/i";
    if ($post['blog_image'] && !preg_match($default_image_pattern, $post['blog_image'])) {
        $image = sprintf("<link rel='related' title='portrait' type='%s' href='%s%s'/>", get_content_type($post['blog_image']), $config['base_url'], $post['blog_image']);
    }
    $geopt = "";
    if ($post['post_request_type'] == "conference") {
        # get geoterms for this post
        $tags = get_geotags_for_post($post['post_id']);
        if ($tags) {
            for ($i = 0; $i < sizeof($tags); $i += 3) {
                $geopt .= sprintf("<gd:geoPt lat='%s' lng='%s' label='%s' />", $tags[$i], $tags[$i + 1], make_var_atom_safe($tags[$i + 2]));
            }
        }
    }
    $return .= "\n<entry>\n\t<title><![CDATA[" . $post['title'] . "]]></title>\n\t<author>" . $post['blog_name'] . "</author>\n\t<link rel='alternate' href=\"" . $post['url'] . "\"/>\n\t{$image}\n\t<id>" . slinkto("post.php", array(), array("post_id" => $post['post_id'])) . "</id>\n\t<updated>" . atom_date($post['added_on']) . "</updated>\n\t<summary type='html'>{$summary}</summary>\n\t{$geopt}\n\t<contributor>\n\t\t<name>" . $post['blog_name'] . "</name>\n\t\t<uri>" . slinkto("blog_search.php", array(), array("blog_id" => $post['blog_id'])) . "</uri>\n\t</contributor>\n\t<gd:rating value='" . $post['linked_by'] . "' min='0' max='100'/>\n</entry>\n";
    return $return;
}
Пример #2
0
function print_post($post, $filters = array())
{
    global $config;
    global $page_vars;
    if ($post['type'] == "review") {
        print "<div class='review'>";
    }
    print "<div class='postbox'>";
    print "<div class='postbox_title'>";
    if ($filters['magnify']) {
        print "<div class='magnify'>";
    }
    if ($post['type'] == "review") {
        print "Review: ";
    }
    print "<a href='" . $post['url'] . "'>" . $post['title'] . "</a>";
    if ($filters['magnify']) {
        print "</div>";
    }
    print "<div class='postbox_footer'>&nbsp;</div>";
    print "</div>";
    if ($post['blog_image'] && $filters['image']) {
        print "<div class='postbox_thumbnail'><img src='" . $post['blog_image'] . "'/></div>";
    }
    print "<div class='postbox_byline'>";
    print connotea_link($post['url']);
    if ($post['linked_by']) {
        # use different rating icons based on the number of posts linking here.
        print print_rating($post['linked_by'], linkto("post.php", $page_vars, array("post_id" => $post['post_id'])));
    }
    print " posted to <a href='" . linkto("blog_search.php", $GLOBALS['page_vars'], array("blog_id" => $post['blog_id'])) . "'>" . $post['blog_name'] . "</a> on <span class='date'>" . date("D jS M y", strtotime($post['pubdate'])) . "</span>";
    if ($filters['display_geotags']) {
        $geotags = get_geotags_for_post($post['post_id']);
        if ($geotags) {
            for ($i = 0; $i < sizeof($geotags); $i += 3) {
                $lat = $geotags[$i];
                $lng = $geotags[$i + 1];
                $term = $geotags[$i + 2];
                print "<a href='http://maps.google.com/maps?f=q&hl=en&q=&ie=UTF8&ll={$lat},{$lng}&om=1&spn=1.793919,3.955078'><img align='absmiddle' hspace='5' src='images/world_link.png' border='0'/> {$term}</a>";
            }
        }
    }
    print "</div>";
    if (!$filters['short']) {
        print "<div class='postbox_content'>";
        if ($filters['fulltext']) {
            $flatfile = $GLOBALS['config']['path_to_pipeline'] . $post['filename'];
            $xml = process_post_xml($flatfile);
            print $xml['description'];
        } else {
            print $post['summary'] . "...";
        }
        print "</div>";
    }
    print "<div class='postbox_footer'>&nbsp;</div>";
    print "</div>";
    if ($post['type'] == "review") {
        print "</div>";
    }
}