| 1 |
<?PHP
|
| 2 |
|
| 3 |
// $Id: biblio_style_classic.inc,v 1.19 2009/06/25 18:23:09 rjerome Exp $
|
| 4 |
/**
|
| 5 |
* Get the style information
|
| 6 |
*
|
| 7 |
* @return
|
| 8 |
* The name of the style
|
| 9 |
*/
|
| 10 |
function biblio_style_classic_info() {
|
| 11 |
return array (
|
| 12 |
'classic' => 'Classic - This is the original biblio style'
|
| 13 |
);
|
| 14 |
}
|
| 15 |
function biblio_style_classic_author_options() {
|
| 16 |
$author_options = array(
|
| 17 |
'BetweenAuthorsDelimStandard' => ', ', //4
|
| 18 |
'BetweenAuthorsDelimLastAuthor' => ', and ', //5
|
| 19 |
'AuthorsInitialsDelimFirstAuthor' => ', ', //7
|
| 20 |
'AuthorsInitialsDelimStandard' => ' ', //8
|
| 21 |
'betweenInitialsDelim' => '. ', //9
|
| 22 |
'initialsBeforeAuthorFirstAuthor' => FALSE, //10
|
| 23 |
'initialsBeforeAuthorStandard' => FALSE, //11
|
| 24 |
'shortenGivenNames' => FALSE, //12
|
| 25 |
'numberOfAuthorsTriggeringEtAl' => 10, //13
|
| 26 |
'includeNumberOfAuthors' => 10, //14
|
| 27 |
'customStringAfterFirstAuthors' => ', et al.',//15
|
| 28 |
'encodeHTML' => true
|
| 29 |
);
|
| 30 |
return $author_options;
|
| 31 |
}
|
| 32 |
|
| 33 |
/**
|
| 34 |
* Apply a bibliographic style to the node
|
| 35 |
*
|
| 36 |
*
|
| 37 |
* @param $node
|
| 38 |
* An object containing the node data to render
|
| 39 |
* @param $base
|
| 40 |
* The base URL of the biblio module (defaults to /biblio)
|
| 41 |
* @param $inline
|
| 42 |
* A logical value indicating if this is being rendered within the
|
| 43 |
* Drupal framwork (false) or we are just passing back the html (true)
|
| 44 |
* @return
|
| 45 |
* The styled biblio entry
|
| 46 |
*/
|
| 47 |
function biblio_style_classic($node, $base = 'biblio', $inline = false) {
|
| 48 |
$author_options = biblio_style_classic_author_options();
|
| 49 |
$authors = theme('biblio_format_authors', $node->biblio_contributors[1], $author_options, $inline);
|
| 50 |
if (!empty ($node->biblio_citekey)&&(variable_get('biblio_display_citation_key',0))) {
|
| 51 |
$output .= '[' . check_plain($node->biblio_citekey) . '] ';
|
| 52 |
}
|
| 53 |
$output .= '<span class="biblio-title">';
|
| 54 |
$url = biblio_get_title_url_info($node);
|
| 55 |
$output .= l($node->title, $url['link'], $url['options']);
|
| 56 |
$output .= "</span>, \n";
|
| 57 |
$output .= '<span class="biblio-authors">' . $authors . "</span> \n";
|
| 58 |
if ($node->biblio_secondary_title) {
|
| 59 |
$output .= ', ' . check_plain($node->biblio_secondary_title);
|
| 60 |
}
|
| 61 |
if ($node->biblio_date)
|
| 62 |
$output .= ', ' . check_plain($node->biblio_date);
|
| 63 |
if ($node->biblio_volume)
|
| 64 |
$output .= ', Volume ' . check_plain($node->biblio_volume);
|
| 65 |
if ($node->biblio_issue)
|
| 66 |
$output .= ', Issue ' . check_plain($node->biblio_issue);
|
| 67 |
if ($node->biblio_number)
|
| 68 |
$output .= ', Number ' . check_plain($node->biblio_number);
|
| 69 |
if ($node->biblio_place_published)
|
| 70 |
$output .= ', ' . check_plain($node->biblio_place_published);
|
| 71 |
if ($node->biblio_pages)
|
| 72 |
$output .= ', p.' . check_plain($node->biblio_pages);
|
| 73 |
if (isset ($node->biblio_year)) {
|
| 74 |
$output .= ', (' . check_plain($node->biblio_year) . ")\n";
|
| 75 |
}
|
| 76 |
return filter_xss($output, biblio_get_allowed_tags());
|
| 77 |
|
| 78 |
}
|
| 79 |
|
| 80 |
function _classic_format_author($author) {
|
| 81 |
$format = $author['prefix'] . ' ' . $author['lastname'] . ' ';
|
| 82 |
$format .= !empty ($author['firstname']) ? ' ' . drupal_substr($author['firstname'], 0, 1) : '';
|
| 83 |
$format .= !empty ($author['initials']) ? str_replace(' ', '', $author['initials']) : '';
|
| 84 |
return $format;
|
| 85 |
}
|