| 1 |
<?php
|
| 2 |
// Original File: ./cite/styles/cite_Harvard_3.php
|
| 3 |
// Original Author(s): Matthias Steffens <mailto:refbase@extracts.de>
|
| 4 |
//
|
| 5 |
|
| 6 |
// This is a variant of the Harvard author/date style, modeled after these resources:
|
| 7 |
// <http://library.curtin.edu.au/referencing/harvard.html> (not available anymore?)
|
| 8 |
// <http://www.usq.edu.au/library/help/ehelp/ref_guides/harvard.htm>
|
| 9 |
// <http://www.library.uwa.edu.au/education_training_and_support/guides/harvard_citation_style>
|
| 10 |
// <http://www.lib.unimelb.edu.au/cite/harvard_dis/>
|
| 11 |
|
| 12 |
|
| 13 |
// TODO: - patents & reports?
|
| 14 |
// - should we shorten ending page numbers if necessary (e.g. "pp. 10-8" or "pp. 51-5", but "pp. 19-26"), or only if numbers are >=3 digits?
|
| 15 |
// - where to put (and how to format) series info & editors of whole books that also have an author?
|
| 16 |
|
| 17 |
// --------------------------------------------------------------------
|
| 18 |
|
| 19 |
// --- BEGIN CITATION STYLE ---
|
| 20 |
function biblio_style_harvard3_info() {
|
| 21 |
return array (
|
| 22 |
'harvard3' => 'Harvard - 3'
|
| 23 |
);
|
| 24 |
}
|
| 25 |
|
| 26 |
function biblio_style_harvard3_author_options() {
|
| 27 |
$author_options = array(
|
| 28 |
'oldAuthorsInitialsDelim' => ',',
|
| 29 |
'BetweenAuthorsDelimStandard' =>', ', //4 for all authors except the last author: new delimiter that separates different authors
|
| 30 |
'BetweenAuthorsDelimLastAuthor' => ' & ', //5 for the last author: new delimiter that separates the last author from all other authors
|
| 31 |
'AuthorsInitialsDelimFirstAuthor' => ', ', //7 for the first author: new delimiter that separates author name & initials (within one author)
|
| 32 |
'AuthorsInitialsDelimStandard'=> ', ', //8 for all authors except the first author: new delimiter that separates author name & initials (within one author)
|
| 33 |
'betweenInitialsDelim' => '', //9 new delimiter that separates multiple initials (within one author)
|
| 34 |
'initialsBeforeAuthorFirstAuthor' => false, //10 for the first author: boolean value that specifies if initials go *before* the author's name ['true'], or *after* the author's name ['false'] (which is the default in the db)
|
| 35 |
'initialsBeforeAuthorStandard' => false, //11 for all authors except the first author: boolean value that specifies if initials go *before* the author's name ['true'], or *after* the author's name ['false'] (which is the default in the db)
|
| 36 |
'shortenGivenNames' => TRUE, //12 boolean value that specifies whether an author's full given name(s) shall be shortened to initial(s)
|
| 37 |
'numberOfAuthorsTriggeringEtAl' => 10, //13 if the total number of authors is greater than the given number (integer >= 1), only the number of authors given in (14) will be included in the citation along with the string given in (15); keep empty if all authors shall be returned
|
| 38 |
'includeNumberOfAuthors' => 10, //14 number of authors (integer >= 1) that is included in the citation if the total number of authors is greater than the number given in (13); keep empty if not applicable
|
| 39 |
'customStringAfterFirstAuthors' => ' et al', //15 string that's appended to the number of authors given in (14) if the total number of authors is greater than the number given in (13); the actual number of authors can be printed by including '__NUMBER_OF_AUTHORS__' (without quotes) within the string
|
| 40 |
'encodeHTML' => true
|
| 41 |
);
|
| 42 |
|
| 43 |
return $author_options;
|
| 44 |
}
|
| 45 |
|
| 46 |
function biblio_style_harvard3($node, $base = 'biblio', $inline = false) {
|
| 47 |
|
| 48 |
$output = ""; // make sure that our buffer variable is empty
|
| 49 |
|
| 50 |
$author_options = biblio_style_harvard3_author_options();
|
| 51 |
$authors = theme('biblio_format_authors', $node->biblio_authors, $author_options, $inline);
|
| 52 |
|
| 53 |
if (!empty ($node->biblio_citekey)&&(variable_get('biblio_display_citation_key',0))) {
|
| 54 |
$output .= '[' . check_plain($node->biblio_citekey) . '] ';
|
| 55 |
}
|
| 56 |
// --- BEGIN TYPE = JOURNAL ARTICLE / MAGAZINE ARTICLE / NEWSPAPER ARTICLE --------------------------------------------------------------
|
| 57 |
switch ($node->biblio_type) {
|
| 58 |
case 102: //Journal Article
|
| 59 |
case 105: //Newspaper Article
|
| 60 |
case 106: //Magazine Article
|
| 61 |
|
| 62 |
if (!empty($authors)) $output .= $authors;
|
| 63 |
|
| 64 |
if (!empty($node->biblio_year)) // year
|
| 65 |
{
|
| 66 |
if (!empty($authors))
|
| 67 |
$output .= " ";
|
| 68 |
|
| 69 |
if (!empty($node->biblio_year))
|
| 70 |
$output .= $node->biblio_year;
|
| 71 |
}
|
| 72 |
|
| 73 |
if (!empty($node->title)) // title
|
| 74 |
{
|
| 75 |
if (!empty($authors) || !empty($node->biblio_year))
|
| 76 |
$output .= ", ";
|
| 77 |
|
| 78 |
$output .= $markupPatternsArray["single-quote-left"] . $node->title . $markupPatternsArray["single-quote-right"];
|
| 79 |
$output .= ",";
|
| 80 |
}
|
| 81 |
|
| 82 |
// From here on we'll assume that at least one of the fields 'author', 'year' or 'title' did contain some contents
|
| 83 |
|
| 84 |
if (!empty($node->biblio_secondary_title)) // publication (= journal) name
|
| 85 |
$output .= ' <i>' . $node->biblio_secondary_title . '</i>';
|
| 86 |
|
| 87 |
// if there's no full journal name, we'll use the abbreviated journal name instead:
|
| 88 |
elseif (!empty($node->biblio_alternate_title)) // abbreviated journal name
|
| 89 |
$output .= ' <i>' . $node->biblio_alternate_title . '</i>';
|
| 90 |
|
| 91 |
if ((!empty($node->biblio_alternate_title) || !empty($node->biblio_secondary_title)) && (!empty($node->biblio_volume) || !empty($node->biblio_issue)))
|
| 92 |
$output .= ",";
|
| 93 |
|
| 94 |
if ($node->biblio_type == 102) // for journal articles, volume (or issue) information is printed with a "vol." (or "no.") prefix
|
| 95 |
{
|
| 96 |
if (!empty($node->biblio_volume)) // volume
|
| 97 |
$output .= " vol. " . $node->biblio_volume;
|
| 98 |
|
| 99 |
if (!empty($node->biblio_issue)) // issue
|
| 100 |
{
|
| 101 |
if (!empty($node->biblio_volume))
|
| 102 |
$output .= ",";
|
| 103 |
|
| 104 |
$output .= " no. " . $node->biblio_issue;
|
| 105 |
}
|
| 106 |
}
|
| 107 |
|
| 108 |
elseif ($node->biblio_type == 105 || $node->biblio_type == 106) // for newspaper and magazine articles, volume (=month) and issue (=day) information is printed without prefix
|
| 109 |
{
|
| 110 |
if (!empty($node->biblio_issue)) // issue (=day)
|
| 111 |
$output .= " " . $node->biblio_issue;
|
| 112 |
|
| 113 |
if (!empty($node->biblio_volume)) // volume (=month)
|
| 114 |
$output .= " " . $node->biblio_volume;
|
| 115 |
}
|
| 116 |
|
| 117 |
if (!empty($node->biblio_pages)) // pages
|
| 118 |
{
|
| 119 |
if (!empty($node->biblio_volume) || !empty($node->biblio_issue) || !empty($node->biblio_alternate_title) || !empty($node->biblio_secondary_title)) // only add ", " if either volume, issue, abbrev_journal or publication isn't empty
|
| 120 |
$output .= ", ";
|
| 121 |
|
| 122 |
$output .= theme_biblio_page_number($node->biblio_pages, '-', "p. ", "pp. "); // function 'formatPageInfo()' is defined in 'cite.inc.php'
|
| 123 |
}
|
| 124 |
|
| 125 |
if ($row['online_publication'] == "yes") // this record refers to an online article
|
| 126 |
{
|
| 127 |
// append an optional string (given in 'online_citation') plus the current date and the DOI (or URL):
|
| 128 |
|
| 129 |
if (!empty($row['online_citation'])) // online_citation
|
| 130 |
{
|
| 131 |
if (!empty($node->biblio_volume) || !empty($node->biblio_issue) || !empty($node->biblio_alternate_title) || !empty($node->biblio_secondary_title)) // only add "," if either volume, issue, abbrev_journal or publication isn't empty
|
| 132 |
$output .= ",";
|
| 133 |
|
| 134 |
$output .= " " . $row['online_citation'];
|
| 135 |
}
|
| 136 |
|
| 137 |
if (!empty($node->biblio_doi) || !empty($node->biblio_url)) // doi OR url
|
| 138 |
{
|
| 139 |
if (!empty($row['online_citation']) OR (empty($row['online_citation']) AND (!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 volume, issue, abbrev_journal or publication isn't empty
|
| 140 |
$output .= ".";
|
| 141 |
|
| 142 |
$today = date("j F Y");
|
| 143 |
|
| 144 |
$output .= " Available from: "; // NOTE: some of the above mentioned resources use ", accessed 26 February 2004, from <http://...>." (or ", viewed on ...") instead
|
| 145 |
|
| 146 |
if (!empty($node->biblio_doi)) // doi
|
| 147 |
$uri = "http://dx.doi.org/" . $node->biblio_doi;
|
| 148 |
else // url
|
| 149 |
$uri = $node->biblio_url;
|
| 150 |
|
| 151 |
if ($encodeHTML)
|
| 152 |
$output .= encodeHTML('<' . $uri . '>');
|
| 153 |
else
|
| 154 |
$output .= '<' . $uri . '>';
|
| 155 |
|
| 156 |
$output .= " [" . $today . "]";
|
| 157 |
}
|
| 158 |
}
|
| 159 |
|
| 160 |
if (!ereg("\. *$", $output)) // if the string doesn't end with a period
|
| 161 |
$output .= ".";
|
| 162 |
break;
|
| 163 |
|
| 164 |
// --- BEGIN TYPE = ABSTRACT / BOOK CHAPTER / CONFERENCE ARTICLE ------------------------------------------------------------------------
|
| 165 |
case 101: //Book Chapter
|
| 166 |
case 103: //Conference Paper
|
| 167 |
|
| 168 |
if (!empty($authors)) $output .= $authors;
|
| 169 |
|
| 170 |
if (!empty($node->biblio_year)) // year
|
| 171 |
{
|
| 172 |
if (!empty($authors)) $output .= " ";
|
| 173 |
|
| 174 |
$output .= $node->biblio_year;
|
| 175 |
}
|
| 176 |
|
| 177 |
if (!empty($node->title)) // title
|
| 178 |
{
|
| 179 |
if (!empty($authors) || !empty($node->biblio_year))
|
| 180 |
$output .= ", ";
|
| 181 |
|
| 182 |
$output .= $markupPatternsArray["single-quote-left"] . $node->title . $markupPatternsArray["single-quote-right"];
|
| 183 |
$output .= ",";
|
| 184 |
}
|
| 185 |
|
| 186 |
// From here on we'll assume that at least one of the fields 'author', 'year' or 'title' did contain some contents
|
| 187 |
// 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)
|
| 188 |
|
| 189 |
if (!empty($node->biblio_secondary_authors)) // editor
|
| 190 |
{
|
| 191 |
// Call the 'reArrangeAuthorContents()' function (defined in 'include.inc.php') in order to re-order contents of the author field. Required Parameters:
|
| 192 |
// 1. input: contents of the author field
|
| 193 |
// 2. input: boolean value that specifies whether the author's family name comes first (within one author) in the source string
|
| 194 |
// ('true' means that the family name is followed by the given name (or initials), 'false' if it's the other way around)
|
| 195 |
//
|
| 196 |
// 3. input: pattern describing old delimiter that separates different authors
|
| 197 |
// 4. output: for all authors except the last author: new delimiter that separates different authors
|
| 198 |
// 5. output: for the last author: new delimiter that separates the last author from all other authors
|
| 199 |
//
|
| 200 |
// 6. input: pattern describing old delimiter that separates author name & initials (within one author)
|
| 201 |
// 7. output: for the first author: new delimiter that separates author name & initials (within one author)
|
| 202 |
// 8. output: for all authors except the first author: new delimiter that separates author name & initials (within one author)
|
| 203 |
// 9. output: new delimiter that separates multiple initials (within one author)
|
| 204 |
// 10. output: for the first author: boolean value that specifies if initials go *before* the author's name ['true'], or *after* the author's name ['false'] (which is the default in the db)
|
| 205 |
// 11. output: for all authors except the first author: boolean value that specifies if initials go *before* the author's name ['true'], or *after* the author's name ['false'] (which is the default in the db)
|
| 206 |
// 12. output: boolean value that specifies whether an author's full given name(s) shall be shortened to initial(s)
|
| 207 |
//
|
| 208 |
// 13. output: if the total number of authors is greater than the given number (integer >= 1), only the number of authors given in (14) will be included in the citation along with the string given in (15); keep empty if all authors shall be returned
|
| 209 |
// 14. output: number of authors (integer >= 1) that is included in the citation if the total number of authors is greater than the number given in (13); keep empty if not applicable
|
| 210 |
// 15. output: string that's appended to the number of authors given in (14) if the total number of authors is greater than the number given in (13); the actual number of authors can be printed by including '__NUMBER_OF_AUTHORS__' (without quotes) within the string
|
| 211 |
//
|
| 212 |
// 16. output: boolean value that specifies whether the re-ordered string shall be returned with higher ASCII chars HTML encoded
|
| 213 |
$editor = reArrangeAuthorContents($node->biblio_secondary_authors, // 1.
|
| 214 |
true, // 2.
|
| 215 |
" *; *", // 3.
|
| 216 |
", ", // 4.
|
| 217 |
" " . $markupPatternsArray["ampersand"] . " ", // 5.
|
| 218 |
" *, *", // 6.
|
| 219 |
" ", // 7.
|
| 220 |
" ", // 8.
|
| 221 |
"", // 9.
|
| 222 |
true, // 10.
|
| 223 |
true, // 11.
|
| 224 |
true, // 12.
|
| 225 |
"", // 13.
|
| 226 |
"", // 14.
|
| 227 |
" et al", // 15.
|
| 228 |
$encodeHTML); // 16.
|
| 229 |
|
| 230 |
$output .= " in " . $editor . " (";
|
| 231 |
if (ereg("^[^;\r\n]+(;[^;\r\n]+)+$", $node->biblio_secondary_authors)) // there are at least two editors (separated by ';')
|
| 232 |
$output .= "eds.";
|
| 233 |
else // there's only one editor (or the editor field is malformed with multiple editors but missing ';' separator[s])
|
| 234 |
$output .= "ed.";
|
| 235 |
$output .= "),";
|
| 236 |
}
|
| 237 |
|
| 238 |
$publication = ereg_replace("[ \r\n]*\(Eds?:[^\)\r\n]*\)", "", $node->biblio_secondary_title);
|
| 239 |
if (!empty($publication)) // publication
|
| 240 |
{
|
| 241 |
if (empty($node->biblio_secondary_authors))
|
| 242 |
$output .= " in";
|
| 243 |
|
| 244 |
$output .= " " . '<i>' . $publication . '</i>';
|
| 245 |
}
|
| 246 |
|
| 247 |
if (!empty($node->biblio_edition) && !preg_match("/^(1|1st|first|one)( ed\.?| edition)?$/i", $node->biblio_edition) || !empty($node->biblio_volume))
|
| 248 |
{
|
| 249 |
$output .= ", ";
|
| 250 |
|
| 251 |
if (!empty($node->biblio_edition) && !preg_match("/^(1|1st|first|one)( ed\.?| edition)?$/i", $node->biblio_edition)) // edition
|
| 252 |
{
|
| 253 |
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 edn")
|
| 254 |
{
|
| 255 |
if ($node->biblio_edition == "2")
|
| 256 |
$editionSuffix = "nd";
|
| 257 |
elseif ($node->biblio_edition == "3")
|
| 258 |
$editionSuffix = "rd";
|
| 259 |
else
|
| 260 |
$editionSuffix = "th";
|
| 261 |
}
|
| 262 |
else
|
| 263 |
$editionSuffix = "";
|
| 264 |
|
| 265 |
if (!empty($node->biblio_edition) && !preg_match("/( ed\.?| edition)$/i", $node->biblio_edition))
|
| 266 |
$editionSuffix .= " edn";
|
| 267 |
|
| 268 |
$output .= $node->biblio_edition . $editionSuffix;
|
| 269 |
}
|
| 270 |
|
| 271 |
if (!empty($node->biblio_volume)) // volume
|
| 272 |
{
|
| 273 |
if (!empty($node->biblio_edition) && !preg_match("/^(1|1st|first|one)( ed\.?| edition)?$/i", $node->biblio_edition))
|
| 274 |
$output .= ", ";
|
| 275 |
|
| 276 |
$output .= "vol. " . $node->biblio_volume;
|
| 277 |
}
|
| 278 |
}
|
| 279 |
|
| 280 |
if (!empty($node->biblio_alternate_title) OR !empty($node->biblio_tertiary_title)) // if there's either a full or an abbreviated series title
|
| 281 |
{
|
| 282 |
$output .= ", ";
|
| 283 |
|
| 284 |
if (!empty($node->biblio_tertiary_title))
|
| 285 |
$output .= $node->biblio_tertiary_title; // full series title
|
| 286 |
|
| 287 |
// if there's no full series title, we'll use the abbreviated series title instead:
|
| 288 |
elseif (!empty($node->biblio_alternate_title))
|
| 289 |
$output .= $node->biblio_alternate_title; // abbreviated series title
|
| 290 |
|
| 291 |
if (!empty($node->biblio_volume)||!empty($node->biblio_issue))
|
| 292 |
$output .= ", ";
|
| 293 |
|
| 294 |
if (!empty($node->biblio_volume)) // series volume (I'm not really sure if -- for this cite style -- the series volume & issue should be rather omitted here)
|
| 295 |
$output .= "vol. " . $node->biblio_volume;
|
| 296 |
|
| 297 |
if (!empty($node->biblio_issue)) // series issue (see note for series volume)
|
| 298 |
{
|
| 299 |
if (!empty($node->biblio_volume))
|
| 300 |
$output .= ", ";
|
| 301 |
|
| 302 |
$output .= "no. " . $node->biblio_issue;
|
| 303 |
}
|
| 304 |
}
|
| 305 |
|
| 306 |
$output .= ",";
|
| 307 |
|
| 308 |
if (!empty($node->biblio_publisher)) // publisher
|
| 309 |
$output .= " " . $node->biblio_publisher;
|
| 310 |
|
| 311 |
if (!empty($node->biblio_place_published)) // place
|
| 312 |
{
|
| 313 |
if (!empty($node->biblio_publisher))
|
| 314 |
$output .= ",";
|
| 315 |
|
| 316 |
$output .= " " . $node->biblio_place_published;
|
| 317 |
}
|
| 318 |
|
| 319 |
if (!empty($node->biblio_pages)) // pages
|
| 320 |
{
|
| 321 |
if (!empty($node->biblio_publisher) || !empty($node->biblio_place_published))
|
| 322 |
$output .= ", ";
|
| 323 |
|
| 324 |
$output .= formatPageInfo($node->biblio_pages, $markupPatternsArray["endash"], "p. ", "pp. "); // function 'formatPageInfo()' is defined in 'cite.inc.php'
|
| 325 |
}
|
| 326 |
|
| 327 |
if (!ereg("\. *$", $output))
|
| 328 |
$output .= ".";
|
| 329 |
|
| 330 |
break;
|
| 331 |
|
| 332 |
|
| 333 |
|
| 334 |
// --- BEGIN TYPE = BOOK WHOLE / CONFERENCE VOLUME / JOURNAL / MANUAL / MANUSCRIPT / MAP / MISCELLANEOUS / PATENT / REPORT / SOFTWARE ---
|
| 335 |
default : // all other types
|
| 336 |
if (!empty($authors)) // author
|
| 337 |
{
|
| 338 |
$author = ereg_replace("[ \r\n]*\(eds?\)", "", $authors);
|
| 339 |
|
| 340 |
// Call the 'reArrangeAuthorContents()' function (defined in 'include.inc.php') in order to re-order contents of the author field. Required Parameters:
|
| 341 |
// 1. input: contents of the author field
|
| 342 |
// 2. input: boolean value that specifies whether the author's family name comes first (within one author) in the source string
|
| 343 |
// ('true' means that the family name is followed by the given name (or initials), 'false' if it's the other way around)
|
| 344 |
//
|
| 345 |
// 3. input: pattern describing old delimiter that separates different authors
|
| 346 |
// 4. output: for all authors except the last author: new delimiter that separates different authors
|
| 347 |
// 5. output: for the last author: new delimiter that separates the last author from all other authors
|
| 348 |
//
|
| 349 |
// 6. input: pattern describing old delimiter that separates author name & initials (within one author)
|
| 350 |
// 7. output: for the first author: new delimiter that separates author name & initials (within one author)
|
| 351 |
// 8. output: for all authors except the first author: new delimiter that separates author name & initials (within one author)
|
| 352 |
// 9. output: new delimiter that separates multiple initials (within one author)
|
| 353 |
// 10. output: for the first author: boolean value that specifies if initials go *before* the author's name ['true'], or *after* the author's name ['false'] (which is the default in the db)
|
| 354 |
// 11. output: for all authors except the first author: boolean value that specifies if initials go *before* the author's name ['true'], or *after* the author's name ['false'] (which is the default in the db)
|
| 355 |
// 12. output: boolean value that specifies whether an author's full given name(s) shall be shortened to initial(s)
|
| 356 |
//
|
| 357 |
// 13. output: if the total number of authors is greater than the given number (integer >= 1), only the number of authors given in (14) will be included in the citation along with the string given in (15); keep empty if all authors shall be returned
|
| 358 |
// 14. output: number of authors (integer >= 1) that is included in the citation if the total number of authors is greater than the number given in (13); keep empty if not applicable
|
| 359 |
// 15. output: string that's appended to the number of authors given in (14) if the total number of authors is greater than the number given in (13); the actual number of authors can be printed by including '__NUMBER_OF_AUTHORS__' (without quotes) within the string
|
| 360 |
//
|
| 361 |
// 16. output: boolean value that specifies whether the re-ordered string shall be returned with higher ASCII chars HTML encoded
|
| 362 |
$author = reArrangeAuthorContents($author, // 1.
|
| 363 |
true, // 2.
|
| 364 |
" *; *", // 3.
|
| 365 |
", ", // 4.
|
| 366 |
" " . $markupPatternsArray["ampersand"] . " ", // 5.
|
| 367 |
" *, *", // 6.
|
| 368 |
", ", // 7.
|
| 369 |
", ", // 8.
|
| 370 |
"", // 9.
|
| 371 |
false, // 10.
|
| 372 |
false, // 11.
|
| 373 |
true, // 12.
|
| 374 |
"", // 13.
|
| 375 |
"", // 14.
|
| 376 |
" et al", // 15.
|
| 377 |
$encodeHTML); // 16.
|
| 378 |
|
| 379 |
// if the author is actually the editor of the resource we'll append ', ed' (or ', eds') to the author string:
|
| 380 |
// [to distinguish editors from authors in the 'author' field, the 'modify.php' script does append ' (ed)' or ' (eds)' if appropriate,
|
| 381 |
// so we're just checking for these identifier strings here. Alternatively, we could check whether the editor field matches the author field]
|
| 382 |
if (ereg("[ \r\n]*\(ed\)", $authors)) // single editor
|
| 383 |
$author = $author . " (ed.)";
|
| 384 |
elseif (ereg("[ \r\n]*\(eds\)", $authors)) // multiple editors
|
| 385 |
$author = $author . " (eds.)";
|
| 386 |
|
| 387 |
$output .= $author;
|
| 388 |
}
|
| 389 |
|
| 390 |
if (!empty($node->biblio_year)) // year
|
| 391 |
{
|
| 392 |
if (!empty($authors))
|
| 393 |
$output .= " ";
|
| 394 |
|
| 395 |
$output .= $node->biblio_year;
|
| 396 |
}
|
| 397 |
|
| 398 |
if (!empty($node->title)) // title
|
| 399 |
{
|
| 400 |
if (!empty($authors) || !empty($node->biblio_year))
|
| 401 |
$output .= ", ";
|
| 402 |
|
| 403 |
if (!empty($row['thesis'])) // for theses, the title is printed in roman type and in quotation marks
|
| 404 |
$output .= $markupPatternsArray["single-quote-left"] . $node->title . $markupPatternsArray["single-quote-right"];
|
| 405 |
else // otherwise, the title is printed in italics
|
| 406 |
$output .= '<i>' . $node->title . '</i>';
|
| 407 |
}
|
| 408 |
|
| 409 |
if (!empty($node->biblio_secondary_authors) && !ereg("[ \r\n]*\(eds?\)", $authors)) // editor (if different from author, see note above regarding the check for ' (ed)' or ' (eds)')
|
| 410 |
{
|
| 411 |
// Call the 'reArrangeAuthorContents()' function (defined in 'include.inc.php') in order to re-order contents of the author field. Required Parameters:
|
| 412 |
// 1. input: contents of the author field
|
| 413 |
// 2. input: boolean value that specifies whether the author's family name comes first (within one author) in the source string
|
| 414 |
// ('true' means that the family name is followed by the given name (or initials), 'false' if it's the other way around)
|
| 415 |
//
|
| 416 |
// 3. input: pattern describing old delimiter that separates different authors
|
| 417 |
// 4. output: for all authors except the last author: new delimiter that separates different authors
|
| 418 |
// 5. output: for the last author: new delimiter that separates the last author from all other authors
|
| 419 |
//
|
| 420 |
// 6. input: pattern describing old delimiter that separates author name & initials (within one author)
|
| 421 |
// 7. output: for the first author: new delimiter that separates author name & initials (within one author)
|
| 422 |
// 8. output: for all authors except the first author: new delimiter that separates author name & initials (within one author)
|
| 423 |
// 9. output: new delimiter that separates multiple initials (within one author)
|
| 424 |
// 10. output: for the first author: boolean value that specifies if initials go *before* the author's name ['true'], or *after* the author's name ['false'] (which is the default in the db)
|
| 425 |
// 11. output: for all authors except the first author: boolean value that specifies if initials go *before* the author's name ['true'], or *after* the author's name ['false'] (which is the default in the db)
|
| 426 |
// 12. output: boolean value that specifies whether an author's full given name(s) shall be shortened to initial(s)
|
| 427 |
//
|
| 428 |
// 13. output: if the total number of authors is greater than the given number (integer >= 1), only the number of authors given in (14) will be included in the citation along with the string given in (15); keep empty if all authors shall be returned
|
| 429 |
// 14. output: number of authors (integer >= 1) that is included in the citation if the total number of authors is greater than the number given in (13); keep empty if not applicable
|
| 430 |
// 15. output: string that's appended to the number of authors given in (14) if the total number of authors is greater than the number given in (13); the actual number of authors can be printed by including '__NUMBER_OF_AUTHORS__' (without quotes) within the string
|
| 431 |
//
|
| 432 |
// 16. output: boolean value that specifies whether the re-ordered string shall be returned with higher ASCII chars HTML encoded
|
| 433 |
$editor = reArrangeAuthorContents($node->biblio_secondary_authors, // 1.
|
| 434 |
true, // 2.
|
| 435 |
" *; *", // 3.
|
| 436 |
", ", // 4.
|
| 437 |
" " . $markupPatternsArray["ampersand"] . " ", // 5.
|
| 438 |
" *, *", // 6.
|
| 439 |
" ", // 7.
|
| 440 |
" ", // 8.
|
| 441 |
"", // 9.
|
| 442 |
true, // 10.
|
| 443 |
true, // 11.
|
| 444 |
true, // 12.
|
| 445 |
"", // 13.
|
| 446 |
"", // 14.
|
| 447 |
" et al", // 15.
|
| 448 |
$encodeHTML); // 16.
|
| 449 |
|
| 450 |
if (!empty($authors) || !empty($node->biblio_year) || !empty($node->title))
|
| 451 |
$output .= " ";
|
| 452 |
|
| 453 |
$output .= " (" . $editor . ", ";
|
| 454 |
if (ereg("^[^;\r\n]+(;[^;\r\n]+)+$", $node->biblio_secondary_authors)) // there are at least two editors (separated by ';')
|
| 455 |
$output .= "eds.";
|
| 456 |
else // there's only one editor (or the editor field is malformed with multiple editors but missing ';' separator[s])
|
| 457 |
$output .= "ed.";
|
| 458 |
$output .= ")";
|
| 459 |
}
|
| 460 |
|
| 461 |
if (!empty($node->biblio_edition) || !empty($node->biblio_volume))
|
| 462 |
{
|
| 463 |
if (!empty($authors) || !empty($node->biblio_year) || !empty($node->title) || (!empty($node->biblio_secondary_authors) && !ereg("[ \r\n]*\(eds?\)", $authors)))
|
| 464 |
$output .= ", ";
|
| 465 |
|
| 466 |
if ($row['type'] == "Software") // software edition (=version)
|
| 467 |
{
|
| 468 |
if (!empty($node->biblio_edition))
|
| 469 |
{
|
| 470 |
$output .= "version " . $node->biblio_edition;
|
| 471 |
|
| 472 |
if (!empty($node->biblio_volume) || !empty($node->biblio_issue))
|
| 473 |
$output .= ", ";
|
| 474 |
}
|
| 475 |
|
| 476 |
if (!empty($node->biblio_issue)) // issue (=day)
|
| 477 |
$output .= " " . $node->biblio_issue;
|
| 478 |
|
| 479 |
if (!empty($node->biblio_volume)) // volume (=month)
|
| 480 |
$output .= " " . $node->biblio_volume;
|
| 481 |
}
|
| 482 |
elseif (!preg_match("/^(1|1st|first|one)( ed\.?| edition)?$/i", $node->biblio_edition)) // regular edition (other than the first)
|
| 483 |
{
|
| 484 |
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 edn")
|
| 485 |
{
|
| 486 |
if ($node->biblio_edition == "2")
|
| 487 |
$editionSuffix = "nd";
|
| 488 |
elseif ($node->biblio_edition == "3")
|
| 489 |
$editionSuffix = "rd";
|
| 490 |
else
|
| 491 |
$editionSuffix = "th";
|
| 492 |
}
|
| 493 |
else
|
| 494 |
$editionSuffix = "";
|
| 495 |
|
| 496 |
if (!empty($node->biblio_edition) && !preg_match("/( ed\.?| edition)$/i", $node->biblio_edition))
|
| 497 |
$editionSuffix .= " edn";
|
| 498 |
|
| 499 |
$output .= $node->biblio_edition . $editionSuffix;
|
| 500 |
|
| 501 |
if (!empty($node->biblio_volume)) // volume
|
| 502 |
{
|
| 503 |
if (!empty($node->biblio_edition) && !preg_match("/^(1|1st|first|one)( ed\.?| edition)?$/i", $node->biblio_edition))
|
| 504 |
$output .= ", ";
|
| 505 |
|
| 506 |
$output .= "vol. " . $node->biblio_volume;
|
| 507 |
}
|
| 508 |
}
|
| 509 |
}
|
| 510 |
|
| 511 |
if ($row['type'] == "Software") // for software, add software label
|
| 512 |
{
|
| 513 |
$output .= ", computer software";
|
| 514 |
}
|
| 515 |
else // add series info
|
| 516 |
{
|
| 517 |
if (!empty($node->biblio_alternate_title) OR !empty($node->biblio_tertiary_title)) // if there's either a full or an abbreviated series title
|
| 518 |
{
|
| 519 |
if ((!empty($node->title) && !ereg("[?!.]$", $node->title)) || (!empty($node->biblio_secondary_authors) && !ereg("[ \r\n]*\(eds?\)", $authors)) || !empty($node->biblio_edition) || !empty($node->biblio_volume))
|
| 520 |
$output .= ",";
|
| 521 |
|
| 522 |
$output .= " ";
|
| 523 |
|
| 524 |
if (!empty($node->biblio_tertiary_title))
|
| 525 |
$output .= $node->biblio_tertiary_title; // full series title
|
| 526 |
|
| 527 |
// if there's no full series title, we'll use the abbreviated series title instead:
|
| 528 |
elseif (!empty($node->biblio_alternate_title))
|
| 529 |
$output .= $node->biblio_alternate_title; // abbreviated series title
|
| 530 |
|
| 531 |
if (!empty($node->biblio_volume)||!empty($node->biblio_issue))
|
| 532 |
$output .= ", ";
|
| 533 |
|
| 534 |
if (!empty($node->biblio_volume)) // series volume (I'm not really sure if -- for this cite style -- the series volume & issue should be rather omitted here)
|
| 535 |
$output .= "vol. " . $node->biblio_volume;
|
| 536 |
|
| 537 |
if (!empty($node->biblio_issue)) // series issue (see note for series volume)
|
| 538 |
{
|
| 539 |
if (!empty($node->biblio_volume))
|
| 540 |
$output .= ", ";
|
| 541 |
|
| 542 |
$output .= "no. " . $node->biblio_issue;
|
| 543 |
}
|
| 544 |
}
|
| 545 |
}
|
| 546 |
|
| 547 |
if (!empty($row['thesis'])) // thesis
|
| 548 |
{
|
| 549 |
$output .= ", " . $row['thesis'];
|
| 550 |
$output .= ", " . $node->biblio_publisher;
|
| 551 |
$output .= ", " . $node->biblio_place_published; // NOTE: should we omit the place of publication for theses?
|
| 552 |
}
|
| 553 |
else // not a thesis
|
| 554 |
{
|
| 555 |
if (!empty($node->biblio_publisher)) // publisher
|
| 556 |
$output .= ", " . $node->biblio_publisher;
|
| 557 |
|
| 558 |
if (!empty($node->biblio_place_published)) // place
|
| 559 |
{
|
| 560 |
if (!empty($node->biblio_publisher))
|
| 561 |
$output .= ",";
|
| 562 |
|
| 563 |
$output .= " " . $node->biblio_place_published;
|
| 564 |
}
|
| 565 |
}
|
| 566 |
|
| 567 |
if ($row['online_publication'] == "yes" || $row['type'] == "Software") // this record refers to an online article, or a computer program/software
|
| 568 |
{
|
| 569 |
if (!empty($row['online_citation'])) // online_citation
|
| 570 |
{
|
| 571 |
if (!ereg("\. *$", $output))
|
| 572 |
$output .= ".";
|
| 573 |
|
| 574 |
$output .= " " . $row['online_citation'];
|
| 575 |
}
|
| 576 |
|
| 577 |
if (!empty($node->biblio_doi) || !empty($node->biblio_url)) // doi OR url
|
| 578 |
{
|
| 579 |
if (!ereg("\. *$", $output))
|
| 580 |
$output .= ".";
|
| 581 |
|
| 582 |
$today = date("j F Y");
|
| 583 |
|
| 584 |
$output .= " Available from: "; // NOTE: some of the above mentioned resources use ", accessed 26 February 2004, from <http://...>." (or ", viewed on ...") instead
|
| 585 |
|
| 586 |
if (!empty($node->biblio_doi)) // doi
|
| 587 |
$uri = "http://dx.doi.org/" . $node->biblio_doi;
|
| 588 |
else // url
|
| 589 |
$uri = $node->biblio_url;
|
| 590 |
|
| 591 |
if ($encodeHTML)
|
| 592 |
$output .= encodeHTML($markupPatternsArray["less-than"] . $uri . $markupPatternsArray["greater-than"]);
|
| 593 |
else
|
| 594 |
$output .= $markupPatternsArray["less-than"] . $uri . $markupPatternsArray["greater-than"];
|
| 595 |
|
| 596 |
$output .= " [" . $today . "]";
|
| 597 |
}
|
| 598 |
}
|
| 599 |
|
| 600 |
}
|
| 601 |
|
| 602 |
// --- BEGIN POST-PROCESSING -----------------------------------------------------------------------------------------------------------
|
| 603 |
if (!ereg("\. *$", $output)) // if the string doesn't end with a period
|
| 604 |
$output .= ".";
|
| 605 |
|
| 606 |
// do some further cleanup:
|
| 607 |
$output = trim($output); // remove any preceding or trailing whitespace
|
| 608 |
|
| 609 |
|
| 610 |
return $output;
|
| 611 |
}
|
| 612 |
|
| 613 |
// --- END CITATION STYLE ---
|
| 614 |
?>
|