Format a bibliographic resource for output.

package wikindx4\core\bibcitation
author Mark Grimshaw

 Methods

BIBFORMAT

__construct(string $output) 

Parameters

$output

string

'html', plain', 'rtf'. Default is 'html'

Add all remaining items to $this->item array

addAllOtherItems(array $row) 
author Mark Grimshaw
version 1

Parameters

$row

array

The items to be added.

Add an item to $this->item array

addItem(string $item, string $fieldName) 
author Mark Grimshaw
version 1

Parameters

$item

string

The item to be added.

$fieldName

string

The database fieldName of the item to be added

Handle initials.

checkInitials(array $creator, int $initialsStyle, boolean $firstNameInitial) : string
see \formatNames()
author Mark Grimshaw
version 1

Parameters

$creator

array

Associative array of creator name e.g.

array(['surname'] => 'Grimshaw', ['firstname'] => Mark, ['initials'] => 'M N G', ['prefix'] => ))

Initials must be space-delimited.

$initialsStyle

int

$firstNameInitial

boolean

Returns

stringFormatted string of initials.

Format date

formatDate(int $startDay, int $startMonth, int $endDay, int $endMonth, boolean $webArticle) 
author Mark Grimshaw
version 2

Parameters

$startDay

int

$startMonth

int

$endDay

int

$endMonth

int

$webArticle

boolean

Default is FALSE. for 'web_article', $startDay and $startMonth represent the publication date

Format edition

formatEdition(int $edition) 
author Mark Grimshaw
version 1

Parameters

$edition

int

Format creator name lists (authors, editors, etc.)

formatNames(array $creators, string $nameType, boolean $shortFootnote) : string
author Mark Grimshaw
version 1

Parameters

$creators

array

Multi-associative array of creator names e.g. this array might be of the primary authors:

array([0] => array(['surname'] => 'Grimshaw', ['firstname'] => Mark, ['initials'] => 'N', ['prefix'] => ),
   [1] => array(['surname'] => 'Witt', ['firstname'] => Jan, ['initials'] => , ['prefix'] => 'de'))

$nameType

string

'creator1', 'creator2' etc.

$shortFootnote

boolean

If TRUE, this is being used for just the primary creator names in a footnote style citation using Ibid, Idem, op cit. etc. Default is FALSE.

Returns

stringOptional if $nameType == 'citation': formatted string of all creator names in the input array.

Format pages.

formatPages(string $start, string $end, mixed $citation) : string

$this->style['pageFormat']: 0 == 132-9 1 == 132-39 2 == 132-139

author Mark Grimshaw
version 1

Parameters

$start

string

Page start.

$end

string

Page end. Default is FALSE.

$citation

mixed

If called from CITEFORMAT, this is the array of citation stylings. Default is FALSE.

Returns

stringPages.

Format runningTime for film/broadcast

formatRunningTime(int $minutes, int $hours) 
author Mark Grimshaw
version 1

Parameters

$minutes

int

$hours

int

Format a shortTitle.

formatShortTitle(string $pString, string $delimitLeft, string $delimitRight) : void

Anything enclosed in $delimitLeft...$delimitRight is to be left unchanged

author Mark Grimshaw
version 1

Parameters

$pString

string

Raw title string.

$delimitLeft

string

Default is FALSE.

$delimitRight

string

Default is FALSE.

Format a title.

formatTitle(string $pString, string $delimitLeft, string $delimitRight) : void

Anything enclosed in $delimitLeft...$delimitRight is to be left unchanged

author Mark Grimshaw
version 1

Parameters

$pString

string

Raw title string.

$delimitLeft

string

Default is FALSE.

$delimitRight

string

Default is FALSE.

Format a title of the original work from which a translation has been made.

formatTransTitle(string $pString, string $delimitLeft, string $delimitRight) : void

Anything enclosed in $delimitLeft...$delimitRight is to be left unchanged

author Mark Grimshaw
version 1

Parameters

$pString

string

Raw title string.

$delimitLeft

string

Default is FALSE.

$delimitRight

string

Default is FALSE.

Transform the raw data from the XML file into usable arrays and load some data arrays

getStyle(array $common, array $types, array $footnote) 
author Mark Grimshaw
version 1

Parameters

$common

array

Array of global formatting data

$types

array

Array of style definitions for each resource type

$footnote

array

Array of style definitions for footnote creators

Initialise bibformat system

initialise() 

Map the $item array against the style array ($this->$type) for this resource type and produce a string ready to be formatted for bold, italics etc.

map(mixed $template) : string
author Mark Grimshaw
version 1

Parameters

$template

mixed

If called from CITEFORMAT, this is the array of template elements. Default is FALSE.

Returns

stringFor printing to the output medium.

Perform pre-processing on the raw SQL array

preProcess(string $type, array $row) : array
author Mark Grimshaw
version 1

Parameters

$type

string

The resource type

$row

array

Associate array of raw SQL data

Returns

arrayProcessed row of raw SQL data

Create ordinal number from cardinal

cardinalToOrdinal(string $cardinal, string $field) : string
author Mark Grimshaw
version 1

Parameters

$cardinal

string

Input number.

$field

string

Default is FALSE.

Returns

string

Check that the first field of $this->$type exists in $this->item and has a value.

checkPartial(string $type) 

If it does not and $this->$type has a partial template array, rearrange $this->$type

author Mark Grimshaw
version 1

Parameters

$type

string

Resource type

Find alternate fields dependent on previous or following fields and deal with accordingly.

findAlternates(array $typeArray) 
author Mark Grimshaw
version 1

Parameters

$typeArray

array

Set-up localisations etc.

loadArrays() 
author Mark Grimshaw
version 1

Preprocess BibTeX-type entries

preProcessBibtex(array $row, string $type) : string | array
author Mark Grimshaw
version 1

Parameters

$row

array

assoc. array of elements for one bibtex entry

$type

string

resource type

Returns

stringarrayresource type|resource assoc. array of elements for one bibtex entry

Restore each $this->type array from $this->backup

restoreTypes() 
author Mark Grimshaw
version 1

Do title capitalization

titleCapitalization(string $pString, string $delimitLeft, string $delimitRight) : string
author Mark Grimshaw
version 1

Parameters

$pString

string

Raw title string.

$delimitLeft

string

$delimitRight

string

Returns

stringFormatted title string.

 Properties

 

$citationFootnote 
 

$footnotePages 

Setting this to TRUE (set externally in CITEFORMAT) loads a different set of templates and settings for footnotes. The default FALSE is for full bibliography.

 

$footnoteStyle 
 

$output 
 

$patternHighlight 
 

$patterns 
 

$styleMap 
 

$type 
 

$wikindx 
 

$bibtex 
 

$bibtexParsePath 
 

$countRecords 
 

$creators 
 

$dateMonthNoDay 
 

$dir 
 

$editorSwitch 
 

$footnoteType 
 

$parsestyle 
 

$partialDone 
 

$preview 
 

$previousCreator 
 

$utf8