| 1 |
<?php
|
| 2 |
// Original File: ./cite/styles/cite_Vancouver.php
|
| 3 |
// Original Author(s): Matthias Steffens <mailto:refbase@extracts.de>
|
| 4 |
|
| 5 |
// This Vancouver style was modeled after these resources:
|
| 6 |
// <http://www.library.uq.edu.au/training/citation/vancouv.pdf>
|
| 7 |
// <http://library.curtin.edu.au/research_and_information_skills/referencing/vancouver.pdf>
|
| 8 |
// <http://www.icmje.org/index.html> citing: <http://www.nlm.nih.gov/citingmedicine/>
|
| 9 |
// <http://www.nlm.nih.gov/bsd/uniform_requirements.html>
|
| 10 |
// <http://library.sun.ac.za//eng/help/infolit2002/bibvancouver.htm>
|
| 11 |
|
| 12 |
// based on 'cite_AMA.php'
|
| 13 |
|
| 14 |
// NOTES: - In the Vancouver style, the reference list is arranged numerically in the order in which references are cited in the text.
|
| 15 |
// This isn't currently handled by this style
|
| 16 |
// - For conference proceedings, you'll currently need to add the place & date of the conference in the proceedings title field
|
| 17 |
// (e.g. "Proceedings of the 5th Germ Cell Tumour Conference; 2001 Sep 13-15; Leeds, UK").
|
| 18 |
|
| 19 |
// TODO: - abstracts, newspaper/magazine articles, patents & reports?
|
| 20 |
// - arrange references numerically
|
| 21 |
// - for newspaper articles, only the beginning page number of an article should be included (see: <http://www.ncbi.nlm.nih.gov/books/bv.fcgi?rid=citmed.section.41496#41607>)
|
| 22 |
// - where to put (and how to format) editors of whole books that also have an author?
|
| 23 |
// - see also inline comments labeled with TODO (and NOTE)
|
| 24 |
|
| 25 |
|
| 26 |
// Modified for use in biblio by Ron Jerome
|
| 27 |
//
|
| 28 |
// $Id: biblio_style_vancouver.inc,v 1.1.2.13 2009/10/22 18:17:34 rjerome Exp $
|
| 29 |
/**
|
| 30 |
* Get the style information
|
| 31 |
*
|
| 32 |
* @return
|
| 33 |
* The name of the style
|
| 34 |
*/
|
| 35 |
function biblio_style_vancouver_info() {
|
| 36 |
return array (
|
| 37 |
'vancouver' => 'Vancouver'
|
| 38 |
);
|
| 39 |
}
|
| 40 |
function biblio_style_vancouver_author_options() {
|
| 41 |
$author_options = array(
|
| 42 |
'BetweenAuthorsDelimStandard' => ', ',
|
| 43 |
'BetweenAuthorsDelimLastAuthor' => ', ',
|
| 44 |
'AuthorsInitialsDelimFirstAuthor' => ' ',
|
| 45 |
'AuthorsInitialsDelimStandard' => ' ',
|
| 46 |
'betweenInitialsDelim' => '',
|
| 47 |
'initialsBeforeAuthorFirstAuthor' => FALSE,
|
| 48 |
'initialsBeforeAuthorStandard' => FALSE,
|
| 49 |
'numberOfInitialsToKeep' => 2,
|
| 50 |
'shortenGivenNames' => TRUE,
|
| 51 |
'numberOfAuthorsTriggeringEtAl' => 6,
|
| 52 |
'includeNumberOfAuthors' => 6,
|
| 53 |
'customStringAfterFirstAuthors' => ', et al.',
|
| 54 |
'encodeHTML' => true
|
| 55 |
);
|
| 56 |
|
| 57 |
return $author_options;
|
| 58 |
}
|
| 59 |
|
| 60 |
function biblio_style_vancouver($node, $base = 'biblio', $inline = false) {
|
| 61 |
$markupPatternsArray = array("italic-prefix" => '<i>',
|
| 62 |
"italic-suffix" => '<\/i>',
|
| 63 |
"endash" => '-');
|
| 64 |
$author_options = biblio_style_vancouver_author_options();
|
| 65 |
$authors = theme('biblio_format_authors', $node->biblio_contributors[1], $author_options, $inline);
|
| 66 |
//$editors = theme('biblio_format_authors', $node->biblio_contributors[2], $author_options, $inline);
|
| 67 |
//if (empty($authors)) $authors = theme('biblio_authors', $node->biblio_contributors[5], 'mla', 5, $inline); // if no authors substitute corp author if available
|
| 68 |
//if (empty($authors)) $authors = '[' . t('Anonymous') . ']'; // use anonymous if we still have nothing.
|
| 69 |
//$output .= '<span class="biblio-authors">' . $authors . "</span>. \n";
|
| 70 |
if (!empty ($node->biblio_citekey)&&(variable_get('biblio_display_citation_key',0))) {
|
| 71 |
$output .= '[' . check_plain($node->biblio_citekey) . '] ';
|
| 72 |
}
|
| 73 |
|
| 74 |
switch ($node->biblio_type) {
|
| 75 |
case 102: //Journal Article
|
| 76 |
case 105: //Newspaper Article
|
| 77 |
case 106: //Magazine Article
|
| 78 |
if(!empty($authors)) {
|
| 79 |
$output .= '<span class="biblio-authors">';
|
| 80 |
if (!preg_match("/\.*$/", $authors)) {
|
| 81 |
$output .= $authors . ".";
|
| 82 |
}
|
| 83 |
else {
|
| 84 |
$output .= $authors;
|
| 85 |
}
|
| 86 |
$output .= "</span>";
|
| 87 |
}
|
| 88 |
|
| 89 |
if (!empty($node->title)) // title
|
| 90 |
{
|
| 91 |
$output .= '<span class="biblio-title-vancouver">';
|
| 92 |
if (!empty($authors)) $output .= " ";
|
| 93 |
$output .= '<span class="biblio-title-vancouver">';
|
| 94 |
$url = biblio_get_title_url_info($node);
|
| 95 |
$output .= l($node->title, $url['link'], $url['options']);
|
| 96 |
$output .= "</span>";
|
| 97 |
if (!preg_match("/[?!.]$/", $node->title)) $output .= ".";
|
| 98 |
$output .= '</span>';
|
| 99 |
}
|
| 100 |
|
| 101 |
// From here on we'll assume that at least either the 'author' or the 'title' field did contain some contents
|
| 102 |
// if this is not the case, the output string will begin with a space. However, any preceding/trailing whitespace will be removed at the cleanup stage (see below)
|
| 103 |
|
| 104 |
if (!empty($node->biblio_alternate_title)) // abbreviated journal name
|
| 105 |
$output .= " " . preg_replace("/\./", "", $node->biblio_alternate_title); // no punctuation marks are used in the abbreviated journal name, just spaces (TODO: smarten regex pattern)
|
| 106 |
|
| 107 |
// if there's no abbreviated journal name, we'll use the full journal name instead:
|
| 108 |
elseif (!empty($node->biblio_secondary_title)) // publication (= journal) name
|
| 109 |
$output .= " " . $node->biblio_secondary_title;
|
| 110 |
|
| 111 |
if ($row['online_publication'] == "yes") // this record refers to an online publication
|
| 112 |
$output .= " [Internet]"; // NOTE: some of the above mentioned resources use "[serial online]", "[serial on the Internet]" or just "[online]" instead
|
| 113 |
|
| 114 |
// NOTE: the formatting of year/volume/issue is meant for journal articles (TODO: newspaper/magazine articles)
|
| 115 |
if (!empty($node->biblio_year)) // year
|
| 116 |
$output .= ". " . $node->biblio_year;
|
| 117 |
|
| 118 |
if ($row['online_publication'] == "yes") // append the current date if this record refers to an online publication
|
| 119 |
$output .= " [cited " . date("Y M j") . "]";
|
| 120 |
|
| 121 |
if (!empty($node->biblio_volume) || !empty($node->biblio_issue))
|
| 122 |
$output .= ";";
|
| 123 |
|
| 124 |
if (!empty($node->biblio_volume)) // volume (=month)
|
| 125 |
$output .= $node->biblio_volume;
|
| 126 |
|
| 127 |
if (!empty($node->biblio_issue)) // issue (=day)
|
| 128 |
$output .= "(" . $node->biblio_issue . ")";
|
| 129 |
|
| 130 |
if (!empty($node->biblio_pages)) // pages
|
| 131 |
{
|
| 132 |
if (!empty($node->biblio_year) || !empty($node->biblio_volume) || !empty($node->biblio_issue) || !empty($node->biblio_alternate_title) || !empty($node->biblio_secondary_title)) // only add ": " if either year, volume, issue, abbrev_journal or publication isn't empty
|
| 133 |
$output .= ":";
|
| 134 |
|
| 135 |
$output .= theme_biblio_page_number($node->biblio_pages, $markupPatternsArray["endash"], "", "", "", "", "", "", true); // function 'formatPageInfo()' is defined in 'cite.inc.php'
|
| 136 |
}
|
| 137 |
|
| 138 |
if ($row['online_publication'] == "yes") // this record refers to an online publication
|
| 139 |
{
|
| 140 |
// append an optional string (given in 'online_citation') plus the DOI (or URL):
|
| 141 |
|
| 142 |
if (!empty($row['online_citation'])) // online_citation
|
| 143 |
{
|
| 144 |
if (!empty($node->biblio_year) || !empty($node->biblio_volume) || !empty($node->biblio_issue) || !empty($node->biblio_alternate_title) || !empty($node->biblio_secondary_title)) // only add ":" or "," if either year, volume, issue, abbrev_journal or publication isn't empty
|
| 145 |
{
|
| 146 |
if (empty($node->biblio_pages))
|
| 147 |
$output .= ":"; // print instead of pages
|
| 148 |
else
|
| 149 |
$output .= ";"; // append to pages (TODO: not sure whether this is correct)
|
| 150 |
}
|
| 151 |
|
| 152 |
$output .= $row['online_citation'];
|
| 153 |
}
|
| 154 |
|
| 155 |
if (!empty($row['doi']) || !empty($row['url'])) // doi OR url
|
| 156 |
{
|
| 157 |
if (!empty($row['online_citation']) OR (empty($row['online_citation']) AND (!empty($node->biblio_year) || !empty($node->biblio_volume) || !empty($node->biblio_issue) || !empty($node->biblio_alternate_title) || !empty($node->biblio_secondary_title)))) // only add "." if online_citation isn't empty, or else if either year, volume, issue, abbrev_journal or publication isn't empty
|
| 158 |
$output .= ".";
|
| 159 |
|
| 160 |
$output .= " Available from: " . $markupPatternsArray["underline-prefix"]; // NOTE: some of the above mentioned resources use "Available from: URL:http://..." instead
|
| 161 |
|
| 162 |
if (!empty($row['doi'])) // doi
|
| 163 |
$uri = "http://dx.doi.org/" . $row['doi'];
|
| 164 |
else // url
|
| 165 |
$uri = $row['url'];
|
| 166 |
|
| 167 |
if ($encodeHTML)
|
| 168 |
$output .= encodeHTML($uri);
|
| 169 |
else
|
| 170 |
$output .= $uri;
|
| 171 |
|
| 172 |
$output .= $markupPatternsArray["underline-suffix"];
|
| 173 |
}
|
| 174 |
}
|
| 175 |
|
| 176 |
if (!preg_match("/\. *$/", $output) AND ($row['online_publication'] != "yes"))
|
| 177 |
$output .= "."; // NOTE: the examples in the above mentioned resources differ wildly w.r.t. whether the closing period should be omitted for online publications
|
| 178 |
break;
|
| 179 |
case 101: //Book Chapter
|
| 180 |
case 103: //Conference Paper
|
| 181 |
if(!empty($authors)) {
|
| 182 |
$output .= '<span class="biblio-authors">';
|
| 183 |
if (!preg_match("/\.*$/", $authors)) {
|
| 184 |
$output .= $authors . ".";
|
| 185 |
}
|
| 186 |
else {
|
| 187 |
$output .= $authors;
|
| 188 |
}
|
| 189 |
$output .= '</span>';
|
| 190 |
}
|
| 191 |
if (!empty($node->title)) // title
|
| 192 |
{
|
| 193 |
if (!empty($authors)) $output .= " ";
|
| 194 |
$output .= '<span class="biblio-title-vancouver">';
|
| 195 |
$url = biblio_get_title_url_info($node);
|
| 196 |
$output .= l($node->title, $url['link'], $url['options']);
|
| 197 |
$output .= "</span>";
|
| 198 |
if (!preg_match("/[?!.]$/", $node->title)) $output .= ".";
|
| 199 |
}
|
| 200 |
|
| 201 |
|
| 202 |
if (!empty($node->biblio_contributors[2])) // editor
|
| 203 |
{
|
| 204 |
$editor_options = array(
|
| 205 |
'BetweenAuthorsDelimStandard' => ', ',
|
| 206 |
'BetweenAuthorsDelimLastAuthor' => ', ',
|
| 207 |
'AuthorsInitialsDelimFirstAuthor' => ' ',
|
| 208 |
'AuthorsInitialsDelimStandard' => ' ',
|
| 209 |
'betweenInitialsDelim' => '',
|
| 210 |
'initialsBeforeAuthorFirstAuthor' => FALSE,
|
| 211 |
'initialsBeforeAuthorStandard' => FALSE,
|
| 212 |
'shortenGivenNames' => TRUE,
|
| 213 |
'numberOfAuthorsTriggeringEtAl' => 6,
|
| 214 |
'includeNumberOfAuthors' => 6,
|
| 215 |
'customStringAfterFirstAuthors' => ' et al.',
|
| 216 |
'encodeHTML' => true
|
| 217 |
);
|
| 218 |
|
| 219 |
$editor = theme('biblio_format_authors', $node->biblio_contributors[2], $editor_options, $inline);
|
| 220 |
|
| 221 |
$output .= " In: " . $editor . ", ";
|
| 222 |
if (count ($node->biblio_contributors[2]) > 1) // there are at least two editors (separated by ';')
|
| 223 |
$output .= "editors";
|
| 224 |
else // there's only one editor (or the editor field is malformed with multiple editors but missing ';' separator[s])
|
| 225 |
$output .= "editor";
|
| 226 |
}
|
| 227 |
|
| 228 |
$publication = preg_replace("/[ \r\n]*\(Eds?:[^\)\r\n]*\)/", "", $node->biblio_secondary_title);
|
| 229 |
if (!empty($publication)) // publication
|
| 230 |
{
|
| 231 |
if (!preg_match("/[?!.] *$/", $output)) $output .= ".";
|
| 232 |
|
| 233 |
if (empty($editor)) $output .= " In:";
|
| 234 |
|
| 235 |
$output .= " " . $publication;
|
| 236 |
}
|
| 237 |
|
| 238 |
if (!empty($node->biblio_volume)) // volume
|
| 239 |
{
|
| 240 |
if (!preg_match("/[?!.][ \"" . $markupPatternsArray["italic-suffix"] . "]*$/", $output)) $output .= ".";
|
| 241 |
|
| 242 |
$output .= " Vol " . $node->biblio_volume; // TODO: not sure whether this is correct
|
| 243 |
}
|
| 244 |
|
| 245 |
if (!empty($node->biblio_edition) && !preg_match("/^(1|1st|first|one)( ed\.?| edition)?$/i", $node->biblio_edition)) // edition
|
| 246 |
{
|
| 247 |
if (!preg_match("/[?!.][ \"" . $markupPatternsArray["italic-suffix"] . "]*$/", $output)) $output .= ".";
|
| 248 |
|
| 249 |
if (preg_match("/^\d{1,3}$/", $node->biblio_edition)) // if the edition field contains a number of up to three digits, we assume it's an edition number (such as "2nd ed.")
|
| 250 |
{
|
| 251 |
if ($node->biblio_edition == "2")
|
| 252 |
$editionSuffix = "nd";
|
| 253 |
elseif ($node->biblio_edition == "3")
|
| 254 |
$editionSuffix = "rd";
|
| 255 |
else
|
| 256 |
$editionSuffix = "th";
|
| 257 |
}
|
| 258 |
else
|
| 259 |
$editionSuffix = "";
|
| 260 |
|
| 261 |
if (!preg_match("/( ed\.?| edition)$/i", $node->biblio_edition))
|
| 262 |
$editionSuffix .= " ed.";
|
| 263 |
|
| 264 |
$output .= " " . $node->biblio_edition . $editionSuffix;
|
| 265 |
}
|
| 266 |
|
| 267 |
if (!preg_match("/[?!.][ \"" . $markupPatternsArray["italic-suffix"] . "]*$/", $output)) $output .= ".";
|
| 268 |
|
| 269 |
if (!empty($node->biblio_place_published)) // place
|
| 270 |
{
|
| 271 |
// // for places in the USA, format any two-letter postal code for the state (i.e. ensure upper case & wrap in parens, eg. "Boca Raton (FL)"):
|
| 272 |
// if (preg_match("/(.+?)[$punct$space]+($uspsStateAbbreviations)[$punct$space]*$/i$patternModifiers", $node->biblio_place_published))
|
| 273 |
// $output .= " " . preg_replace("/(.+?)[$punct$space]+($uspsStateAbbreviations)[$punct$space]*$/ie$patternModifiers", "'\\1 ('.strtoupper('\\2').')'", $node->biblio_place_published);
|
| 274 |
// else
|
| 275 |
$output .= " " . $node->biblio_place_published;
|
| 276 |
}
|
| 277 |
|
| 278 |
if (!empty($node->biblio_publisher)) // publisher
|
| 279 |
{
|
| 280 |
if (!empty($node->biblio_place_published))
|
| 281 |
$output .= ":";
|
| 282 |
|
| 283 |
$output .= " " . $node->biblio_publisher;
|
| 284 |
}
|
| 285 |
|
| 286 |
if (!empty($node->biblio_year)) // year
|
| 287 |
$output .= "; " . $node->biblio_year;
|
| 288 |
|
| 289 |
if (!empty($node->biblio_pages)) // pages
|
| 290 |
$output .= ". " . theme_biblio_page_number($node->biblio_pages, $markupPatternsArray["endash"], "p. ", "p. ", "", "", "", "", true); // function 'formatPageInfo()' is defined in 'cite.inc.php'
|
| 291 |
|
| 292 |
if (!empty($node->biblio_alternate_title) OR !empty($node->biblio_tertiary_title)) // if there's either a full or an abbreviated series title
|
| 293 |
{
|
| 294 |
if (!preg_match("/[?!.][ \"" . $markupPatternsArray["italic-suffix"] . "]*$/", $output)) $output .= ".";
|
| 295 |
|
| 296 |
$output .= " (";
|
| 297 |
|
| 298 |
if (!empty($node->biblio_alternate_title)) // abbreviated series title
|
| 299 |
$output .= preg_replace("/\./", "", $node->biblio_alternate_title); // no punctuation marks are used in the abbreviated series title, just spaces (TODO: smarten regex pattern)
|
| 300 |
|
| 301 |
// if there's no abbreviated series title, we'll use the full series title instead:
|
| 302 |
elseif (!empty($node->biblio_tertiary_title)) // full series title
|
| 303 |
$output .= $node->biblio_tertiary_title;
|
| 304 |
|
| 305 |
if (!empty($node->biblio_volume)||!empty($node->biblio_issue))
|
| 306 |
$output .= "; ";
|
| 307 |
|
| 308 |
if (!empty($node->biblio_volume)) // series volume
|
| 309 |
$output .= "vol " . $node->biblio_volume;
|
| 310 |
|
| 311 |
if (!empty($node->biblio_volume) && !empty($node->biblio_issue))
|
| 312 |
$output .= "; "; // TODO: not sure whether this is correct
|
| 313 |
|
| 314 |
if (!empty($node->biblio_issue)) // series issue (I'm not really sure if -- for this cite style -- the series issue should be rather omitted here)
|
| 315 |
$output .= "no " . $node->biblio_issue; // since a series volume should be prefixed with "vol", is it correct to prefix series issues with "no"?
|
| 316 |
|
| 317 |
$output .= ")";
|
| 318 |
}
|
| 319 |
|
| 320 |
if (!preg_match("/\. *$/", $output)) $output .= ".";
|
| 321 |
|
| 322 |
break;
|
| 323 |
|
| 324 |
default : // all other types
|
| 325 |
//TODO
|
| 326 |
// if (preg_match("[ \r\n]*\(ed\)", $node->author)) // single editor
|
| 327 |
// $author = $author . ", ed";
|
| 328 |
// elseif (preg_match("[ \r\n]*\(eds\)", $node->author)) // multiple editors
|
| 329 |
// $author = $author . ", eds";
|
| 330 |
|
| 331 |
if (!empty($authors)) // author
|
| 332 |
{
|
| 333 |
$output .= '<span class="biblio-authors">';
|
| 334 |
if (!preg_match("/\.*$/", $authors)) {
|
| 335 |
$output .= $authors . ".";
|
| 336 |
}
|
| 337 |
else{
|
| 338 |
$output .= $authors;
|
| 339 |
}
|
| 340 |
$output .= '</span>';
|
| 341 |
}
|
| 342 |
|
| 343 |
if (!empty($node->title)) // title
|
| 344 |
{
|
| 345 |
if (!empty($authors))
|
| 346 |
$output .= " ";
|
| 347 |
|
| 348 |
// TODO: book/volume/report/etc titles should be formatted in heading caps, however, this doesn't yet work correctly if the publication title contains HTML entities
|
| 349 |
$output .= '<span class="biblio-title-vancouver">';
|
| 350 |
$url = biblio_get_title_url_info($node);
|
| 351 |
$output .= l($node->title, $url['link'], $url['options']);
|
| 352 |
$output .= "</span>";
|
| 353 |
}
|
| 354 |
if ($row['type'] == "Software") // for software, add software label
|
| 355 |
$output .= " [computer program]";
|
| 356 |
|
| 357 |
if (($row['online_publication'] == "yes") AND empty($row['thesis'])) // this record refers to an online publication (online theses will be handled further down below)
|
| 358 |
$output .= " [Internet]"; // NOTE: some of the above mentioned resources use "[monograph online]", "[monograph on the Internet]" or just "[online]" instead
|
| 359 |
|
| 360 |
if (!empty($node->biblio_volume) AND ($row['type'] != "Software")) // volume
|
| 361 |
{
|
| 362 |
if (!preg_match("/[?!.][ \"" . $markupPatternsArray["italic-suffix"] . "]*$/", $output)) $output .= ".";
|
| 363 |
|
| 364 |
$output .= " Vol " . $node->biblio_volume; // TODO: not sure whether this is correct
|
| 365 |
}
|
| 366 |
|
| 367 |
if (!empty($node->biblio_edition)) // edition
|
| 368 |
{
|
| 369 |
if (!preg_match("/[?!.][ \"" . $markupPatternsArray["italic-suffix"] . "]*$/", $output)) $output .= ".";
|
| 370 |
|
| 371 |
if ($row['type'] == "Software") // software edition (=version)
|
| 372 |
{
|
| 373 |
$output .= " Version " . $node->biblio_edition;
|
| 374 |
}
|
| 375 |
elseif (!preg_match("/^(1|1st|first|one)( ed\.?| edition)?$/i", $node->biblio_edition)) // edition
|
| 376 |
{
|
| 377 |
if (preg_match("/^\d{1,3}$/", $node->biblio_edition)) // if the edition field contains a number of up to three digits, we assume it's an edition number (such as "2nd ed.")
|
| 378 |
{
|
| 379 |
if ($node->biblio_edition == "2")
|
| 380 |
$editionSuffix = "nd";
|
| 381 |
elseif ($node->biblio_edition == "3")
|
| 382 |
$editionSuffix = "rd";
|
| 383 |
else
|
| 384 |
$editionSuffix = "th";
|
| 385 |
}
|
| 386 |
else
|
| 387 |
$editionSuffix = "";
|
| 388 |
|
| 389 |
if (!preg_match("/( ed\.?| edition)$/i", $node->biblio_edition))
|
| 390 |
$editionSuffix .= " ed.";
|
| 391 |
|
| 392 |
$output .= " " . $node->biblio_edition . $editionSuffix;
|
| 393 |
}
|
| 394 |
}
|
| 395 |
|
| 396 |
if (count($node->biblio_contributors[2])) // editor (if different from author, see note above regarding the check for ' (ed)' or ' (eds)')
|
| 397 |
{
|
| 398 |
|
| 399 |
$editor_options = array(
|
| 400 |
'BetweenAuthorsDelimStandard' => ', ',
|
| 401 |
'BetweenAuthorsDelimLastAuthor' => ', ',
|
| 402 |
'AuthorsInitialsDelimFirstAuthor' => ' ',
|
| 403 |
'AuthorsInitialsDelimStandard' => ' ',
|
| 404 |
'betweenInitialsDelim' => '',
|
| 405 |
'initialsBeforeAuthorFirstAuthor' => FALSE,
|
| 406 |
'initialsBeforeAuthorStandard' => FALSE,
|
| 407 |
'shortenGivenNames' => TRUE,
|
| 408 |
'numberOfAuthorsTriggeringEtAl' => 6,
|
| 409 |
'includeNumberOfAuthors' => 3,
|
| 410 |
'customStringAfterFirstAuthors' => ' et al.',
|
| 411 |
'encodeHTML' => true
|
| 412 |
);
|
| 413 |
|
| 414 |
$editor = theme('biblio_format_authors', $node->biblio_contributors[2], $editor_options, $inline);
|
| 415 |
if (!preg_match("[?!.][ \"" . $markupPatternsArray["italic-suffix"] . "]*$", $output))
|
| 416 |
$output .= ".";
|
| 417 |
|
| 418 |
$output .= " " . $editor;
|
| 419 |
if (count($node->biblio_contributors[2]) > 1) // there are at least two editors (separated by ';')
|
| 420 |
$output .= ", editors";
|
| 421 |
else // there's only one editor (or the editor field is malformed with multiple editors but missing ';' separator[s])
|
| 422 |
$output .= ", editor";
|
| 423 |
}
|
| 424 |
|
| 425 |
if (!empty($row['thesis'])) // thesis
|
| 426 |
{
|
| 427 |
// TODO: do we need to use the term "[dissertation]" instead of "[Ph.D. thesis]", etc? What about other thesis types then?
|
| 428 |
$output .= " [" . $row['thesis'];
|
| 429 |
|
| 430 |
if ($row['online_publication'] == "yes") // this record refers to an online thesis
|
| 431 |
$output .= " on the Internet]";
|
| 432 |
else
|
| 433 |
$output .= "]";
|
| 434 |
}
|
| 435 |
|
| 436 |
if (!preg_match("/[?!.][ \"" . $markupPatternsArray["italic-suffix"] . "]*$/", $output)) $output .= ".";
|
| 437 |
|
| 438 |
if (!empty($node->biblio_place_published)) // place
|
| 439 |
{
|
| 440 |
// // for places in the USA, format any two-letter postal code for the state (i.e. ensure upper case & wrap in parentheses, eg. "Boca Raton (FL)"):
|
| 441 |
// if (preg_match("/(.+?)[$punct$space]+($uspsStateAbbreviations)[$punct$space]*$/i$patternModifiers", $node->biblio_place_published))
|
| 442 |
// $output .= " " . preg_replace("/(.+?)[$punct$space]+($uspsStateAbbreviations)[$punct$space]*$/ie$patternModifiers", "'\\1 ('.strtoupper('\\2').')'", $node->biblio_place_published);
|
| 443 |
// else
|
| 444 |
$output .= " " . $node->biblio_place_published;
|
| 445 |
}
|
| 446 |
|
| 447 |
if (!empty($node->biblio_publisher)) // publisher
|
| 448 |
{
|
| 449 |
if (!empty($node->biblio_place_published))
|
| 450 |
$output .= ":";
|
| 451 |
|
| 452 |
$output .= " " . $node->biblio_publisher;
|
| 453 |
}
|
| 454 |
|
| 455 |
$output .= ";";
|
| 456 |
|
| 457 |
if (!empty($node->biblio_year)) // year
|
| 458 |
$output .= " " . $node->biblio_year;
|
| 459 |
|
| 460 |
if ($row['type'] == "Software") // for software, volume (=month) and issue (=day) information is printed after the year (TODO: not sure whether this is correct)
|
| 461 |
{
|
| 462 |
if (!empty($node->biblio_volume)) // volume (=month)
|
| 463 |
$output .= " " . $node->biblio_volume;
|
| 464 |
|
| 465 |
if (!empty($node->biblio_issue)) // issue (=day)
|
| 466 |
$output .= " " . $node->biblio_issue;
|
| 467 |
}
|
| 468 |
|
| 469 |
if ($row['online_publication'] == "yes") // append the current date if this record refers to an online publication
|
| 470 |
$output .= " [cited " . date("Y M j") . "]";
|
| 471 |
|
| 472 |
if (!empty($node->biblio_alternate_title) OR !empty($node->biblio_tertiary_title)) // if there's either a full or an abbreviated series title
|
| 473 |
{
|
| 474 |
if (!preg_match("/[?!.][ \"" . $markupPatternsArray["italic-suffix"] . "]*$/", $output)) $output .= ".";
|
| 475 |
|
| 476 |
$output .= " (";
|
| 477 |
|
| 478 |
if (!empty($node->biblio_alternate_title)) // abbreviated series title
|
| 479 |
$output .= preg_replace("/\./", "", $node->biblio_alternate_title); // no punctuation marks are used in the abbreviated series title, just spaces (TODO: smarten regex pattern)
|
| 480 |
|
| 481 |
// if there's no abbreviated series title, we'll use the full series title instead:
|
| 482 |
elseif (!empty($node->biblio_tertiary_title)) // full series title
|
| 483 |
$output .= $node->biblio_tertiary_title;
|
| 484 |
|
| 485 |
if (!empty($node->biblio_volume)||!empty($node->biblio_issue))
|
| 486 |
$output .= "; ";
|
| 487 |
|
| 488 |
if (!empty($node->biblio_volume)) // series volume
|
| 489 |
$output .= "vol " . $node->biblio_volume;
|
| 490 |
|
| 491 |
if (!empty($node->biblio_volume) && !empty($node->biblio_issue))
|
| 492 |
$output .= "; "; // TODO: not sure whether this is correct
|
| 493 |
|
| 494 |
if (!empty($node->biblio_issue)) // series issue (I'm not really sure if -- for this cite style -- the series issue should be rather omitted here)
|
| 495 |
$output .= "no " . $node->biblio_issue; // since a series volume should be prefixed with "vol", is it correct to prefix series issues with "no"?
|
| 496 |
|
| 497 |
$output .= ")";
|
| 498 |
}
|
| 499 |
|
| 500 |
if ($row['online_publication'] == "yes" || $row['type'] == "Software") // this record refers to an online publication, or a computer program/software
|
| 501 |
{
|
| 502 |
// append an optional string (given in 'online_citation') plus the DOI (or URL):
|
| 503 |
|
| 504 |
if (!empty($row['online_citation'])) // online_citation
|
| 505 |
{
|
| 506 |
if (!preg_match("/\. *$/", $output)) $output .= ".";
|
| 507 |
|
| 508 |
$output .= $row['online_citation'];
|
| 509 |
}
|
| 510 |
|
| 511 |
if (!empty($row['doi']) || !empty($row['url'])) // doi OR url
|
| 512 |
{
|
| 513 |
if (!preg_match("/\. *$/", $output)) $output .= ".";
|
| 514 |
|
| 515 |
$output .= " Available from: " . $markupPatternsArray["underline-prefix"]; // NOTE: some of the above mentioned resources use "Available from: URL:http://..." instead
|
| 516 |
|
| 517 |
if (!empty($row['doi'])) // doi
|
| 518 |
$uri = "http://dx.doi.org/" . $row['doi'];
|
| 519 |
else // url
|
| 520 |
$uri = $row['url'];
|
| 521 |
|
| 522 |
if ($encodeHTML)
|
| 523 |
$output .= encodeHTML($uri);
|
| 524 |
else
|
| 525 |
$output .= $uri;
|
| 526 |
|
| 527 |
$output .= $markupPatternsArray["underline-suffix"];
|
| 528 |
}
|
| 529 |
}
|
| 530 |
|
| 531 |
if (!preg_match("/\. *$/", $output) AND ($row['online_publication'] != "yes") AND ($row['type'] != "Software"))
|
| 532 |
$output .= "."; // NOTE: the examples in the above mentioned resources differ wildly w.r.t. whether the closing period should be omitted for online publications
|
| 533 |
break;
|
| 534 |
}
|
| 535 |
|
| 536 |
return filter_xss($output, biblio_get_allowed_tags());
|
| 537 |
}
|
| 538 |
|