| 1 |
<?php
|
| 2 |
|
| 3 |
// $Id: biblio_style_ieee.inc,v 1.19 2009/06/25 18:23:09 rjerome Exp $
|
| 4 |
// by Jeffrey Dwoskin
|
| 5 |
// A style closer to IEEE format
|
| 6 |
// see http://standards.ieee.org/guides/style/section7.html#992
|
| 7 |
/**
|
| 8 |
* Get the style information
|
| 9 |
*
|
| 10 |
* @return
|
| 11 |
* The name of the style
|
| 12 |
*/
|
| 13 |
function biblio_style_ieee_info() {
|
| 14 |
return array (
|
| 15 |
'ieee' => 'Institute of Electrical and Electronics Engineers (IEEE)'
|
| 16 |
);
|
| 17 |
}
|
| 18 |
function biblio_style_ieee_author_options() {
|
| 19 |
$author_options = array(
|
| 20 |
'BetweenAuthorsDelimStandard' => ', ', //4
|
| 21 |
'BetweenAuthorsDelimLastAuthor' => ', and ', //5
|
| 22 |
'AuthorsInitialsDelimFirstAuthor' => ', ', //7
|
| 23 |
'AuthorsInitialsDelimStandard' => ' ', //8
|
| 24 |
'betweenInitialsDelim' => '. ', //9
|
| 25 |
'initialsBeforeAuthorFirstAuthor' => FALSE, //10
|
| 26 |
'initialsBeforeAuthorStandard' => TRUE, //11
|
| 27 |
'shortenGivenNames' => TRUE, //12
|
| 28 |
'numberOfAuthorsTriggeringEtAl' => 10, //13
|
| 29 |
'includeNumberOfAuthors' => 10, //14
|
| 30 |
'customStringAfterFirstAuthors' => ', et al.',//15
|
| 31 |
'encodeHTML' => true
|
| 32 |
);
|
| 33 |
return $author_options;
|
| 34 |
}
|
| 35 |
|
| 36 |
/**
|
| 37 |
* Apply a bibliographic style to the node
|
| 38 |
*
|
| 39 |
*
|
| 40 |
* @param $node
|
| 41 |
* An object containing the node data to render
|
| 42 |
* @param $base
|
| 43 |
* The base URL of the biblio module (defaults to /biblio)
|
| 44 |
* @param $inline
|
| 45 |
* A logical value indicating if this is being rendered within the
|
| 46 |
* Drupal framwork (false) or we are just passing back the html (true)
|
| 47 |
* @return
|
| 48 |
* The styled biblio entry
|
| 49 |
*/
|
| 50 |
function biblio_style_ieee($node, $base = 'biblio', $inline = false) {
|
| 51 |
$author_options = biblio_style_ieee_author_options();
|
| 52 |
$authors = theme('biblio_format_authors', $node->biblio_contributors[1], $author_options, $inline);
|
| 53 |
if (!empty ($node->biblio_citekey)&&(variable_get('biblio_display_citation_key',0))) {
|
| 54 |
$output .= '[' . check_plain($node->biblio_citekey) . '] ';
|
| 55 |
}
|
| 56 |
$output .= '<span class="biblio-authors">' . $authors . ", </span> \n";
|
| 57 |
switch ($node->biblio_type) {
|
| 58 |
default :
|
| 59 |
$url = biblio_get_title_url_info($node);
|
| 60 |
if (!empty ($node->biblio_secondary_title)) {
|
| 61 |
$output .= '<span class="biblio-title">"';
|
| 62 |
$output .= l($node->title, $url['link'], $url['options']);
|
| 63 |
//$output .= $inline ? l("$node->title", "$base/viewinline/$node->nid") : l("$node->title", "node/$node->nid");
|
| 64 |
$output .= "", </span> \n";
|
| 65 |
$output .= '<i>' . check_plain($node->biblio_secondary_title) . '</i>';
|
| 66 |
} else {
|
| 67 |
$output .= '<span class="biblio-title"><i>';
|
| 68 |
$output .= l($node->title, $url['link'], $url['options']);
|
| 69 |
$output .= ", </i></span> \n";
|
| 70 |
}
|
| 71 |
if (!empty ($node->biblio_edition))
|
| 72 |
$output .= ', ' . check_plain($node->biblio_edition);
|
| 73 |
if (!empty ($node->biblio_volume))
|
| 74 |
$output .= ', vol. ' . check_plain($node->biblio_volume);
|
| 75 |
if (!empty ($node->biblio_issue))
|
| 76 |
$output .= ', issue ' . check_plain($node->biblio_issue);
|
| 77 |
if (!empty ($node->biblio_number))
|
| 78 |
$output .= ', no. ' . check_plain($node->biblio_number);
|
| 79 |
if (!empty ($node->biblio_place_published))
|
| 80 |
$output .= ', ' . check_plain($node->biblio_place_published);
|
| 81 |
if (!empty ($node->biblio_publisher)) {
|
| 82 |
$output .= (check_plain($node->biblio_place_published)) ? ', ' : ': ';
|
| 83 |
$output .= check_plain($node->biblio_publisher);
|
| 84 |
}
|
| 85 |
// if a single page instead of a range, should use 'p.' instead of 'pp.' -- ignoring
|
| 86 |
if (!empty ($node->biblio_pages))
|
| 87 |
$output .= ', pp. ' . check_plain($node->biblio_pages);
|
| 88 |
// if it is a book, year should go before pages instead -- ignoring
|
| 89 |
// for non-books, should also include month of publication (e.g. "Mar. 2006") -- use date instead of year if available
|
| 90 |
if (!empty ($node->biblio_date)) {
|
| 91 |
$output .= ', ' . check_plain($node->biblio_date);
|
| 92 |
}
|
| 93 |
if ((!empty ($node->biblio_year) && !empty ($node->biblio_date) && !strstr($node->biblio_date, $node->biblio_year)) || (!empty ($node->biblio_year) && empty ($node->biblio_date))) {
|
| 94 |
$output .= ', ' . check_plain($node->biblio_year);
|
| 95 |
}
|
| 96 |
$output .= ".\n";
|
| 97 |
break; // generic
|
| 98 |
}
|
| 99 |
/* if ($node->biblio_date) $output .= ', '. check_plain($node->biblio_date);
|
| 100 |
|
| 101 |
*/
|
| 102 |
return filter_xss($output, biblio_get_allowed_tags());
|
| 103 |
|
| 104 |
}
|
| 105 |
function _ieee_format_author($author) {
|
| 106 |
$format = $author['prefix'];
|
| 107 |
$format .= !empty ($format) ? ' ' . $author['lastname'] . ' ' : $author['lastname'] . ' ';
|
| 108 |
$format .= !empty ($author['firstname']) ? drupal_substr($author['firstname'], 0, 1) . '.' : '';
|
| 109 |
$format .= !empty ($author['initials']) ? $author['initials'] . '.' : '';
|
| 110 |
return $format;
|
| 111 |
}
|