A collection of PHP classes to manage bibliographic formatting for OS bibliography software using the OSBib standard. Taken from and originally developed in WIKINDX (http://wikindx.sourceforge.net).
Released through http://bibliophile.sourceforge.net under the GPL licence.
If you make improvements, please consider contacting the administrators at bibliophile.sourceforge.net so that your improvements can be added to the release package.
May 2005
Mark Grimshaw (WIKINDX)
Andrea Rossato (Uniwakka)
Guillaume Gardey (BibOrb)
Christian Boulanger (Bibliograph)
Use BIBFORMAT::loadStyle()
to load and parse the XML file into usable arrays. The XML file is logically divided into four areas, info (general information about the formatting style), citation (see citation_xml), styleCommon (common styling for bibliographic lists) and styleTypes (specific formatting depending on the type of resource).
The info array as returned by BIBFORMAT::loadStyle()
will look something like:
Array ( [name] => APA [description] => American Psychological Association (APA) [language] => English [version] => 1.0 )
The styleCommon array, as returned by BIBFORMAT::loadStyle()
and after being further parsed by BIBFORMAT::getStyle()
will look something like:
Array ( [titleCapitalization] => 0 [primaryCreatorFirstStyle] => 1 [primaryCreatorOtherStyle] => 1 [primaryCreatorInitials] => 0 [primaryCreatorFirstName] => 1 [otherCreatorFirstStyle] => 0 [otherCreatorOtherStyle] => 0 [otherCreatorInitials] => 0 [dayFormat] => 0 [otherCreatorFirstName] => 1 [primaryCreatorList] => 1 [otherCreatorList] => 0 [monthFormat] => 1 [editionFormat] => 1 [primaryCreatorListMore] => 7 [primaryCreatorListLimit] => 6 [dateFormat] => 1 [primaryCreatorListAbbreviation] => , et al. [otherCreatorListMore] => [runningTimeFormat] => 1 [primaryCreatorRepeatString] => [primaryCreatorRepeat] => 0 [otherCreatorListLimit] => [otherCreatorListAbbreviation] => [pageFormat] => 2 [editorSwitch] => 1 [editorSwitchIfYes] => editor (^Ed.^Eds.^). [primaryCreatorSepFirstBetween] => , [primaryCreatorSepNextBetween] => , [primaryCreatorSepNextLast] => , & [otherCreatorSepFirstBetween] => , [otherCreatorSepNextBetween] => & [otherCreatorSepNextLast] => & [primaryTwoCreatorsSep] => , & [otherTwoCreatorsSep] => & )
Not all elements need be present so you should always test with PHP's array_key_exists()
function.
Because OSBib uses numeric indexing from 0 upwards, you should be careful to use something like:
if($styleCommon['primaryCreatorListAbbreviation'] === FALSE)
...
to test for a FALSE value of an array element.
The styleTypes array for a book (each type of resource has its own definition array), as returned by BIBFORMAT::loadStyle()
and after being further parsed by BIBFORMAT::getStyle()
will look something like (array elements will depend on the type's template definition):
Array ( [author] => Array ( [dependentPre] => [dependentPreAlternative] => [dependentPostAlternative] => [singular] => [plural] => [pre] => [post] => . ) [publicationYear] => Array ( [dependentPre] => [dependentPreAlternative] => [dependentPostAlternative] => [singular] => [plural] => [pre] => ( [post] => ). ) [title] => Array ( [dependentPre] => [dependentPreAlternative] => [dependentPostAlternative] => [singular] => [plural] => [pre] => [i] [post] => [/i] ) [translator] => Array ( [dependentPre] => [dependentPost] => [dependentPreAlternative] => [dependentPostAlternative] => [singular] => [plural] => [pre] => [post] => , Trans.__DEPENDENT_ON_NEXT_FIELD__ ) [edition] => Array ( [dependentPre] => [dependentPost] => [dependentPreAlternative] => [dependentPostAlternative] => [singular] => [plural] => [pre] => [post] => ed.__DEPENDENT_ON_NEXT_FIELD__ ) [volumeNumber] => Array ( [dependentPre] => [dependentPreAlternative] => [dependentPostAlternative] => [singular] => [plural] => [pre] => Vol. [post] => ) [publisherLocation] => Array ( [dependentPre] => [dependentPreAlternative] => [dependentPostAlternative] => [singular] => [plural] => [pre] => . [post] => : ) [publisherName] => Array ( [dependentPre] => [dependentPreAlternative] => [dependentPostAlternative] => [singular] => [plural] => [pre] => __DEPENDENT_ON_PREVIOUS_FIELD__ [post] => ) [ultimate] => . [independent] => Array ( [3] => ( [5] => ) ) )
The description here relates to the various elements of the styleCommon array. Each element will have either an INTEGER value or a STRING value.
Creator formatting:Primary creators:
0 => 'Joe Bloggs' 1 => 'Bloggs, Joe' 2 => 'Bloggs Joe' 3 => Last name only
0 => 'T. U. ' 1 => 'T.U.' 2 => 'T U ' 3 => 'TU'
0 => Print the full first name(s) 1 => Print initial(s) only
0 => Print the full creator list 1 => Limit the creator list
0 => Print the creator list 1 => Do not print the creator list 2 => Replace the creator list with string below
Other creators:
|
|