View source
<?php
function biblio_style_ieee_info() {
return array(
'ieee' => 'Institute of Electrical and Electronics Engineers (IEEE)',
);
}
function biblio_style_ieee_author_options() {
$author_options = array(
'BetweenAuthorsDelimStandard' => ', ',
'BetweenAuthorsDelimLastAuthor' => ', and ',
'AuthorsInitialsDelimFirstAuthor' => ', ',
'AuthorsInitialsDelimStandard' => ' ',
'betweenInitialsDelim' => '. ',
'initialsBeforeAuthorFirstAuthor' => FALSE,
'initialsBeforeAuthorStandard' => TRUE,
'shortenGivenNames' => TRUE,
'numberOfAuthorsTriggeringEtAl' => 10,
'includeNumberOfAuthors' => 10,
'customStringAfterFirstAuthors' => ', et al.',
'encodeHTML' => TRUE,
);
return $author_options;
}
function biblio_style_ieee($node, $base = 'biblio', $inline = FALSE) {
$output = '';
$author_options = biblio_style_ieee_author_options();
if (isset($node->biblio_contributors[1])) {
$authors = theme('biblio_format_authors', $node->biblio_contributors[1], $author_options, $inline);
}
if (!empty($node->biblio_citekey) && variable_get('biblio_display_citation_key', 0)) {
$output .= '[' . check_plain($node->biblio_citekey) . '] ';
}
$output .= '<span class="biblio-authors">' . $authors . ", </span> \n";
switch ($node->biblio_type) {
default:
$url = biblio_get_title_url_info($node, $base, $inline);
if (!empty($node->biblio_secondary_title)) {
$output .= '<span class="biblio-title">"';
$output .= l($node->title, $url['link'], $url['options']);
$output .= "", </span> \n";
$output .= '<i>' . check_plain($node->biblio_secondary_title) . '</i>';
}
else {
$output .= '<span class="biblio-title"><i>';
$output .= l($node->title, $url['link'], $url['options']);
$output .= ", </i></span> \n";
}
if (!empty($node->biblio_edition)) {
$output .= ', ' . check_plain($node->biblio_edition);
}
if (!empty($node->biblio_volume)) {
$output .= ', vol. ' . check_plain($node->biblio_volume);
}
if (!empty($node->biblio_issue)) {
$output .= ', issue ' . check_plain($node->biblio_issue);
}
if (!empty($node->biblio_number)) {
$output .= ', no. ' . check_plain($node->biblio_number);
}
if (!empty($node->biblio_place_published)) {
$output .= ', ' . check_plain($node->biblio_place_published);
}
if (!empty($node->biblio_publisher)) {
$output .= check_plain($node->biblio_place_published) ? ', ' : ': ';
$output .= check_plain($node->biblio_publisher);
}
if (!empty($node->biblio_pages)) {
$output .= ', pp. ' . check_plain($node->biblio_pages);
}
if (!empty($node->biblio_date)) {
$output .= ', ' . check_plain($node->biblio_date);
}
if (!empty($node->biblio_year) && !empty($node->biblio_date) && !strstr($node->biblio_date, $node->biblio_year) || !empty($node->biblio_year) && empty($node->biblio_date)) {
$output .= ', ' . check_plain($node->biblio_year);
}
$output .= ".\n";
break;
}
return filter_xss($output, biblio_get_allowed_tags());
}
function _ieee_format_author($author) {
$format = $author['prefix'];
$format .= !empty($format) ? ' ' . $author['lastname'] . ' ' : $author['lastname'] . ' ';
$format .= !empty($author['firstname']) ? drupal_substr($author['firstname'], 0, 1) . '.' : '';
$format .= !empty($author['initials']) ? $author['initials'] . '.' : '';
return $format;
}