Example #1
0
/**
 * Make a citation for an item.
 * <p>
 * The item type is used to determine what sort of citation should be generated.
 *
 * @param Item $item The item
 * @param boolean $html Use html formatting
 * @param boolean $full Full citation
 * @return string
 */
function make_citation($item, $html = true, $full = true)
{
    $type = $item->getItemType();
    $type = $type ? $type->name : 'Unknown';
    if ($type == get_theme_option_with_default('Article Item Type', 'Article')) {
        return make_article_citation($item, $html, $full);
    }
    if ($type == get_theme_option_with_default('Conference Paper Type', 'Conference Paper')) {
        return make_paper_citation($item, $html, $full);
    }
    if ($type == get_theme_option_with_default('Book Item Type', 'Book')) {
        return make_book_citation($item, $html, $full);
    }
    if ($type == get_theme_option_with_default('Manual Item Type', 'Manual')) {
        return make_manual_citation($item, $html, $full);
    }
    if ($type == get_theme_option_with_default('Thesis Item Type', 'Thesis')) {
        return make_thesis_citation($item, $html, $full);
    }
    if ($type == get_theme_option_with_default('Report Item Type', 'Report')) {
        return make_book_citation($item, $html, $full);
    }
    if ($type == get_theme_option_with_default('Text Item Type', 'Text')) {
        return make_book_citation($item, $html, $full);
    }
    if ($type == get_theme_option_with_default('Website Item Type', 'Website')) {
        return make_website_citation($item, $html, $full);
    }
    if ($type == get_theme_option_with_default('Hyperlink Item Type', 'Hyperlink')) {
        return make_hyperlink_citation($item, $html, $full);
    }
    if ($type == get_theme_option_with_default('Moving Image Item Type', 'Moving Image')) {
        return make_moving_image_citation($item, $html, $full);
    }
    if ($type == get_theme_option_with_default('Still Image Item Type', 'Still Image')) {
        return make_still_image_citation($item, $html, $full);
    }
    return make_default_citation($item, $html, $full);
}