Example #1
0
function amp_badge_most_emailed($options = array())
{
    $limit = isset($options['limit']) && is_numeric($options['limit']) ? $options['limit'] : 5;
    $section = isset($options['section']) && is_numeric($options['section']) ? $options['section'] : 0;
    $emailed = AMP_lookup('most_emailed_articles', $section);
    if (!$emailed) {
        return false;
    }
    $display = array_chunk($emailed, $limit, $keep_keys = true);
    if ($display && !empty($display[0])) {
        $options['id'] = array_keys($display[0]);
        $options['morelink'] = false;
        unset($options['section']);
        return amp_badge_articles($options);
    }
}
Example #2
0
function amp_badge_articles_by_author($options)
{
    $author = isset($options['author']) && $options['author'] ? $options['author'] : false;
    if (!$author) {
        $page = AMPContent_Page::instance();
        $article = $page->getArticle();
        if (!$article) {
            return false;
        }
        $options['not_id'] = $article->id;
        $author = $article->getAuthor();
        if (!$author) {
            return false;
        }
    }
    unset($options['section']);
    unset($options['class']);
    $options['author'] = $author;
    return amp_badge_articles($options);
}