Example #1
0
</div>
</div>
<div class='frontpage_tab2'>
<div class='tab_padding'>
<?php 
$papers = get_top_papers($safe_category, $last_fortnight);
if ($config['collect_papers'] && sizeof($papers)) {
    print "<div class='tab_title'>Popular books &amp; papers this week</div>";
    foreach ($papers as $paper) {
        print_paper($paper, array("display" => "minimal", "show_byline" => true));
    }
    print "<div class='read_more'><a href='" . linkto("papers.php", $page_vars, array("order_by" => "cited", "timeframe" => "1m")) . "'>read more recently popular papers...</a></div>";
    print "</div>";
} else {
    print "<div class='tab_title'>Popular posts this month</div>";
    $posts = get_top_posts($safe_category, $last_month, 5);
    print "<div class='popular'>";
    foreach ($posts as $post) {
        print_post($post, array("image" => true));
    }
    print "<div class='read_more'><a href='" . linkto("posts.php", $page_vars, array("order_by" => "cited", "timeframe" => "1w")) . "'>read more recently popular posts...</a></div>";
    print "</div>";
}
?>
</div>
</div>
</div>	
<div class='frontpage_footer'>&nbsp;</div>
</div>
<?php 
include "footer.php";
Example #2
0
        $posts = $term_posts[$term];
        print "<div class='newspage_tab_container'>\n";
        print "<div class='newspage_tab'>\n";
        print "<div class='tab_title'>" . $terms[$i] . "</div>";
        if ($posts) {
            $counter = 0;
            foreach ($posts as $post) {
                $counter++;
                $filters = array();
                # first story should have an image and the summary - further stories just have a title
                if ($counter >= 2) {
                    $filters['short'] = true;
                } else {
                    $filters['image'] = true;
                }
                print_post($post, $filters);
                if ($counter == 1) {
                    print "<div class='postbox_postboxes'>";
                }
            }
            if ($counter) {
                print "</div>";
                # ends the postbox_postboxes div
            }
        }
        printf("<a href='%s'>read more posts on this topic...</a>", linkto("posts.php", $page_vars, array("term" => $terms[$i])));
        print "</div>\n";
        print "</div>";
    }
}
print "<div class='frontpage_footer'>&nbsp;</div>";
Example #3
0
function get_search_posts()
{
    $current_date = $_POST['current_date'];
    $query_string = $_POST['query_string'];
    $args = array('s' => $query_string, 'date_query' => array(array('before' => $current_date)), 'posts_per_page' => 6, 'orderby' => 'date', 'order' => 'DESC');
    //var_dump($args);
    $the_query = new WP_Query($args);
    if ($the_query->have_posts()) {
        while ($the_query->have_posts()) {
            $the_query->the_post();
            $para_print_post = array('id' => get_the_ID(), 'title' => get_the_title(), 'link' => esc_url(get_permalink()), 'date' => get_the_date('d/m/Y  H:i'), 'except' => get_the_excerpt(), 'image_link' => get_bg_image(get_the_ID()));
            $lastDate = get_the_date('Y-m-d H:i:s');
            print_post($para_print_post, $category->slug);
        }
        echo '<input type="hidden" class="lastpost_date" value="' . $lastDate . '">';
    } else {
        echo '<div id="no_news" class="pager pager-padding" style="background-color: #fff;"> 
				    <a class="btn-block btn-md btn"><span>Không còn tin để hiển thị</span></a>
                </div>';
    }
    die;
}
Example #4
0
if ($posts) {
    if ($every_category_rows > $this_category_rows) {
        # if we got rid of the category restriction then we could show more posts...
        if ($every_category_rows >= 2) {
            $all_posts_end = "<b>" . $every_category_rows . "</b> posts";
        } else {
            $all_posts_end = "<b>one</b> post";
        }
        if ($this_category_rows >= 2) {
            $posts_end = "are <b>" . $this_category_rows . "</b> posts";
        } else {
            $posts_end = "is <b>one</b> post";
        }
        printf("\n<div class='message'>\nThere %s in the %s category containing this term and %s in all categories - <a href='%s'>click here</a> to see them too.\n</div>", $posts_end, $safe_category, $all_posts_end, linkto("posts.php", $page_vars, array("category" => false)));
    }
    print_pagination($posts, $safe_skip, "posts.php", $GLOBALS["config"]['posts_per_page']);
    foreach ($posts as $post) {
        $display_filters = array("image" => true);
        if ($filters['conference']) {
            $display_filters["display_geotags"] = true;
        }
        print_post($post, $display_filters);
    }
    print_pagination($posts, $safe_skip, "posts.php", $GLOBALS["config"]['posts_per_page']);
} else {
    print "No posts found.";
}
?>
</div>
<?php 
include "footer.php";
Example #5
0
            print_post($post);
        }
        print "</div>";
    }
    $posts = get_posts("cited", array("blog_id" => $safe_blog_id, "limit" => 3));
    if ($posts) {
        print "<div class='blogbox_postboxes'>";
        print "<h3>Most popular posts</h3>";
        foreach ($posts as $post) {
            print_post($post);
        }
        print "</div>";
    }
    $posts = array();
    $post_ids = get_posts_linking_to(false, $safe_blog_id);
    if ($post_ids) {
        print "<div class='blogbox_postboxes'>";
        print "<h3>Latest posts linking here</h3>";
        $posts = get_posts("published_on", array("post_id" => $post_ids, "limit" => 3));
        foreach ($posts as $post) {
            print_post($post);
        }
        print "</div>";
    }
} else {
    print_error("No blog specified", "Sorry, I'm not sure which blog you're looking for.");
}
?>
</div>
<?php 
include "footer.php";
Example #6
0
    $id = filter_input(INPUT_GET, "id");
    $post = find_post($id);
} else {
    //post not found
    //redirect to index with error message
}
error_reporting(0);
include "includes/header.inc";
?>
<div id="content">
  <ul id="subnav">
    <li><a href="post_index.php">Post Index</a></li>
    <li><a href="post_new.php">New Post</a></li>
  </ul>
  <?php 
print_post($post['title'], $post['body']);
?>
</div>
<?php 
include "includes/footer.inc";
?>

<?php 
function print_post($title, $body)
{
    ?>
<div class="blog">
  <h2><?php 
    echo $title;
    ?>
</h3>
function print_paper($paper, $filters = array())
{
    global $logged_on;
    global $page_vars;
    $paper_id = $paper['paper_id'];
    print "<div class='paperbox'>";
    # some shortcuts:
    if ($filters['display'] == "minimal") {
        if (!isset($filters['show_byline'])) {
            $filters['show_byline'] = true;
        }
        if (!isset($filters['show_tags'])) {
            $filters['show_tags'] = true;
        }
        if (!isset($filters['show_posts'])) {
            $filters['show_posts'] = false;
        }
        if (!isset($filters['show_abstract'])) {
            $filters['show_abstract'] = false;
        }
        if (!isset($filters['show_comments'])) {
            $filters['show_comments'] = false;
        }
        if (!isset($filters['show_teaser'])) {
            $filters['show_teaser'] = false;
        }
        if (!isset($filters['show_scorebox'])) {
            $filters['show_scorebox'] = true;
        }
        if (!isset($filters['add_comment'])) {
            $filters['add_comment'] = false;
        }
    } else {
        # set some defaults
        if (!isset($filters['show_byline'])) {
            $filters['show_byline'] = true;
        }
        if (!isset($filters['show_tags'])) {
            $filters['show_tags'] = true;
        }
        if (!isset($filters['show_posts'])) {
            $filters['show_posts'] = true;
        }
        if (!isset($filters['show_abstract'])) {
            $filters['show_abstract'] = true;
        }
        if (!isset($filters['show_comments'])) {
            $filters['show_comments'] = true;
        }
        if (!isset($filters['show_teaser'])) {
            $filters['show_teaser'] = false;
        }
        if (!isset($filters['show_scorebox'])) {
            $filters['show_scorebox'] = true;
        }
        if (!isset($filters['add_comment'])) {
            $filters['add_comment'] = true;
        }
    }
    $tags = array();
    if ($filters['show_tags'] == true) {
        $tags = get_tags_for_paper($paper_id, true);
    }
    # print title of paper
    if (!$paper['title']) {
        $paper['title'] = "Unknown title";
    }
    print "<div class='paperbox_title'>";
    $title_link = linkto("paper.php", $GLOBALS['page_vars'], array("paper_id" => $paper['paper_id']));
    if ($filters['link_through']) {
        $title_link = $paper['url'];
    }
    print "<a href='{$title_link}'>" . $paper['title'] . "</a>";
    print "</div>";
    if ($filters['show_byline'] == true) {
        print "<div class='paperbox_byline'>";
        print connotea_link($paper['url']);
        if ($filters['show_scorebox'] == true && $paper['cited_by']) {
            print print_rating($paper['cited_by'], linkto("paper.php", $page_vars, array("paper_id" => $paper['paper_id'])));
        }
        print " published by <a href='" . linkto("journal_search.php", $GLOBALS['page_vars'], array("journal_id" => $paper['journal'])) . "'>" . $paper['journal'] . "</a> on <span class='date'>" . date("D jS M y", strtotime($paper['pubdate'])) . "</span>";
        if ($filters['show_abstract'] == true) {
            print "<br/><span class='author'>" . $paper['authors'] . "</span>";
        }
        print "</div>";
    }
    if ($tags) {
        print "<div class='tagbox'>";
        foreach ($tags as $tag) {
            print "<a href='" . linkto("tag_search.php", $GLOBALS['page_vars'], array("tag" => $tag)) . "'>{$tag}</a> ";
        }
        print "</div>";
    }
    if ($filters['show_abstract'] && $paper['abstract']) {
        print "<div class='paperbox_identifiers'>";
        if ($paper['doi_id']) {
            printf("DOI <a href='%s'>%s</a> ", "http://dx.doi.org/" . $paper['doi_id'], $paper['doi_id']);
        }
        if ($paper['isbn_id']) {
            printf("ISBN <a href='%s'>%s</a> ", "http://isbndb.com/search-all.html?kw=" . $paper['isbn_id'], $paper['isbn_id']);
        }
        if ($paper['pubmed_id']) {
            printf("PMID <a href='%s'>%s</a> ", "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=pubmed&cmd=Retrieve&list_uids=" . $paper['pubmed_id'], $paper['pubmed_id']);
        }
        if ($paper['arxiv_id']) {
            printf("OAI <a href='%s'>%s</a> ", "http://www.citebase.org/abstract?id=" . urlencode($paper['arxiv_id']), $paper['arxiv_id']);
        }
        print "</div>";
        print "<div class='paperbox_abstract'>";
        if ($paper['image']) {
            print "<div class='paperbox_thumbnail'><img src='" . $paper['image'] . "'/></div>";
        }
        print $paper['abstract'];
        print "<div class='paperbox_footer'>&nbsp;</div>";
        print "</div>";
    }
    print "</div>";
    if ($filters['add_comment']) {
        if ($logged_on) {
            #print_comment_prompt();
        }
    }
    if ($filters['show_posts'] == true) {
        $posts = get_posts_for_paper($paper_id);
        if ($posts) {
            print "<div class='paperbox_posts'>";
            print "<h3>Posts</h3>";
            foreach ($posts as $post) {
                print_post($post, array("image" => true));
            }
            print "</div>";
        }
    }
    if ($filters['show_comments'] == true) {
        $comments = get_comments_for_paper($paper_id);
        if ($comments) {
            print "<div class='paperbox_comments'>";
            print "<h3>Comments</h3>";
            foreach ($comments as $comment) {
                print_comment($comment);
            }
            print "</div>";
        }
    }
}
Example #8
0
    echo single_cat_title('');
    ?>
"</span></h2>
							</div><!-- end navMainCt-->
							<div id="contentBox">
								<div id="nang-tabs_hot_newest" class="activeBox nang_wtt"> 
                                <input class="query-str" id="query-str" type="hidden" value="<?php 
    echo single_cat_title('');
    ?>
"> 
                                <?php 
    while (have_posts()) {
        the_post();
        $para_print_post = array('id' => get_the_ID(), 'title' => get_the_title(), 'link' => esc_url(get_permalink()), 'date' => get_the_date('d/m/Y  H:i'), 'except' => get_the_excerpt(), 'image_link' => get_bg_image(get_the_ID()));
        $last_post_date = get_the_date('Y-m-d H:i');
        print_post($para_print_post, 'tam-su');
    }
    ?>
									
									
								<input type="hidden" class="lastpost_date" value="<?php 
    echo $last_post_date;
    ?>
">
							</div>
							</div>
						</div><!-- end gotoCenter-->
						<div class="pager pager-padding"> 
							<a class="btn-block btn-md btn-danger btn" id="s-view-more"> 
								<span class="hidden-xs">
									<span class="glyphicon glyphicon glyphicon-heart-empty"></span> 
Example #9
0
<?php

function print_post()
{
    $postString = 'POST variables are:  ';
    foreach ($_POST as $key => $value) {
        $postString .= $key . "\t" . $value . "\n";
    }
    return $postString;
}
print <<<HTML
<html><head><title>POST variable</title></head>
<body><p>
HTML;
print "\n" . print_post() . "\n";
print <<<HTML
</p></body></html>
HTML
;