View source
<?php
function biblio_style_cse_info() {
return array(
'cse' => 'Council of Science Editors (CSE)',
);
}
function biblio_style_cse_author_options() {
$author_options = array(
'BetweenAuthorsDelimStandard' => ', ',
'BetweenAuthorsDelimLastAuthor' => ', ',
'AuthorsInitialsDelimFirstAuthor' => ' ',
'AuthorsInitialsDelimStandard' => ' ',
'betweenInitialsDelim' => '',
'initialsBeforeAuthorFirstAuthor' => FALSE,
'initialsBeforeAuthorStandard' => FALSE,
'shortenGivenNames' => TRUE,
'numberOfAuthorsTriggeringEtAl' => 10,
'includeNumberOfAuthors' => 10,
'customStringAfterFirstAuthors' => ' et al.',
'encodeHTML' => TRUE,
);
return $author_options;
}
function biblio_style_cse($node, $base = 'biblio', $inline = FALSE) {
$output = '';
$author_options = biblio_style_cse_author_options();
$authors = theme('biblio_format_authors', $node->biblio_contributors[1], $author_options, $inline);
if (empty($authors) && count($node->biblio_contributors[5])) {
foreach ($node->biblio_contributors[5] as $rank => $author) {
$authors .= empty($authors) ? '' : ', ';
$authors .= variable_get('biblio_author_links', 1) ? theme('biblio_author_link', $author) : $author['name'];
}
}
if (empty($authors)) {
$authors = '[' . t('Anonymous') . ']';
}
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:
if (isset($node->biblio_year)) {
$output .= check_plain($node->biblio_year) . ". ";
}
$output .= '<span class="biblio-title">';
$url = biblio_get_title_url_info($node, $base, $inline);
$output .= l($node->title, $url['link'], $url['options']);
$output .= strpos($node->title, '?') ? " </span>" : ". </span>";
$output .= !empty($node->biblio_secondary_title) ? check_plain($node->biblio_secondary_title) . '. ' : '';
$output .= !empty($node->biblio_volume) ? check_plain($node->biblio_volume) : '';
$output .= !empty($node->biblio_issue) ? '(' . check_plain($node->biblio_issue) . ')' : '';
$output .= !empty($node->biblio_pages) ? ':' . str_replace(" ", "", check_plain($node->biblio_pages)) . '.' : '';
break;
}
return filter_xss($output, biblio_get_allowed_tags());
}
function _cse_format_author($author) {
$format = $author['prefix'] . ' ' . $author['lastname'] . ' ';
$format .= !empty($author['firstname']) ? ' ' . drupal_substr($author['firstname'], 0, 1) : '';
$format .= !empty($author['initials']) ? str_replace(' ', '', $author['initials']) : '';
return $format;
}