BIBCITEGATEWAY
in package
BIBCITEGATEWAY class.
Gateway to all bibliographic and citation formatting.
Steps:
- Load the class and set any flags (see below).
- a) For citations, call $this->parseCitations() that takes text to be marked up as the single parameter and returns the marked-up text along with appended bibliography/endnotes.
Table of Contents
- $allConditions : mixed
- array
- $allJoins : mixed
- array
- $browserTabID : mixed
- bool|string
- $compiledCitationTemplates : mixed
- array
- $customFields : mixed
- array
- $customTypes : mixed
- array
- $db : mixed
- object
- $fallback : mixed
- array
- $hyperlinkBase : mixed
- bool
- $messages : mixed
- object
- $replaceInTextCitationTemplates : mixed
- array
- $session : mixed
- object
- $styleMap : mixed
- object
- $templateEndnote : mixed
- array
- $templateEndnoteInText : mixed
- array
- $templateIbid : mixed
- array
- $templateIdem : mixed
- array
- $templateOpCit : mixed
- array
- cleanText() : string
- Clean the input text by ensuring we have valid cite and footnote tags (remove invalid tags)
- getBibEndnotesInc() : array<string|int, mixed>
- Get items and other data for incrementing endnotes
- getBibEndnotesSameId() : array<string|int, mixed>
- Get items and other data for endnotes using same ID for same resource
- getBibFootnotes() : array<string|int, mixed>
- Get items and other data for footnotes
- getBibInText() : array<string|int, mixed>
- Get items and other data for in-text bibliographies
- getBibliographyFromCitations() : string
- Produce the bibliography from cited text.
- getPreviewBibOrder() : array<string|int, mixed>
- Return ordered $resIds for inText and endSameIdOrdered preview bibliography/endnotes.
- getResourceData() : array<string|int, mixed>
- Get resource data
- getResourcesCollection() : array<string|int, mixed>
- Get collection resource data for each sentence
- getResourcesCreators() : array<string|int, mixed>
- Get creator resource data for each sentence and creatorIdStrings
- getResourcesCustom() : array<string|int, mixed>
- Get custom resource data for each sentence
- getResourcesPublisher() : array<string|int, mixed>
- Get publisher resource data for each sentence
- getResourceSubquery() : string
- Return a subQuery providing 'creatorSurname' as an order
- getResourcesUrl() : array<string|int, mixed>
- Get URL resource data for each sentence
- getSentenceResources() : array<string|int, mixed>
- Get resource data for each sentence
- getSentenceResourcesPreview() : array<string|int, mixed>
- Get resource data for each sentence—for style previewing only.
- getStyle() : mixed
- Transform the raw data from the XML file into usable arrays and load some data arrays.
- grabCustomFields() : mixed
- Grab any custom fields
- printBibliography() : string
- Print the bibliography/endnotes
- removeSlashes() : string
- Remove slashes (callback)
- setCitationOrder() : array<string|int, mixed>
- Set ordering as per the bibliographic ordering set for the style when parsing cited text
- setListOrder() : mixed
- Set ordering for list and search operations (not for cited text)
- setOrderCreator() : string
- Set SQL ordering for creator
- setOrderYear() : string
- Set SQL ordering for year
- setResourceConditions() : string
- Set the order resources should be returned in, join tables, and return resource fields for a list of resources.
- setResourceOrder() : mixed
- Set the resource order.
- setSingleResourceConditions() : string
- Join tables, and return resource fields when getting data for a single ressource.
Properties
$allConditions
array
private
mixed
$allConditions
= []
$allJoins
array
private
mixed
$allJoins
= []
$browserTabID
bool|string
private
mixed
$browserTabID
= \FALSE
$compiledCitationTemplates
array
private
mixed
$compiledCitationTemplates
= []
$customFields
array
private
mixed
$customFields
= []
$customTypes
array
private
mixed
$customTypes
= []
$db
object
private
mixed
$db
$fallback
array
private
mixed
$fallback
$hyperlinkBase
bool
private
mixed
$hyperlinkBase
= \WIKINDX_URL_BASE . "/index.php?action=resource_RESOURCEVIEW_CORE&id="
$messages
object
private
mixed
$messages
$replaceInTextCitationTemplates
array
private
mixed
$replaceInTextCitationTemplates
= []
$session
object
private
mixed
$session
$styleMap
object
private
mixed
$styleMap
$templateEndnote
array
private
mixed
$templateEndnote
= []
$templateEndnoteInText
array
private
mixed
$templateEndnoteInText
= []
$templateIbid
array
private
mixed
$templateIbid
= []
$templateIdem
array
private
mixed
$templateIdem
= []
$templateOpCit
array
private
mixed
$templateOpCit
= []
Methods
cleanText()
Clean the input text by ensuring we have valid cite and footnote tags (remove invalid tags)
private
cleanText(string $text) : string
Parameters
- $text : string
-
Input text
Return values
string —getBibEndnotesInc()
Get items and other data for incrementing endnotes
private
getBibEndnotesInc(array<string|int, mixed> $footnotes, array<string|int, mixed> $footnotePages, array<string|int, mixed> $resourceData, array<string|int, mixed> $citationData, string $citeLocalisation, string $allPuncPattern, string $shortPuncsPatternStripped, string $space) : array<string|int, mixed>
Parameters
- $footnotes : array<string|int, mixed>
- $footnotePages : array<string|int, mixed>
- $resourceData : array<string|int, mixed>
- $citationData : array<string|int, mixed>
- $citeLocalisation : string
- $allPuncPattern : string
- $shortPuncsPatternStripped : string
- $space : string
Return values
array<string|int, mixed> —getBibEndnotesSameId()
Get items and other data for endnotes using same ID for same resource
private
getBibEndnotesSameId(array<string|int, mixed> $resourceData, array<string|int, mixed> $citationData, string $citeLocalisation, string $allPuncPattern, string $shortPuncsPatternStripped, string $space) : array<string|int, mixed>
Parameters
- $resourceData : array<string|int, mixed>
- $citationData : array<string|int, mixed>
- $citeLocalisation : string
- $allPuncPattern : string
- $shortPuncsPatternStripped : string
- $space : string
Return values
array<string|int, mixed> —getBibFootnotes()
Get items and other data for footnotes
private
getBibFootnotes(array<string|int, mixed> $footnotes, array<string|int, mixed> $footnotePages, array<string|int, mixed> $resourceData, array<string|int, mixed> $citationData, string $citeLocalisation, string $allPuncPattern, string $shortPuncsPatternStripped, string $space) : array<string|int, mixed>
Parameters
- $footnotes : array<string|int, mixed>
- $footnotePages : array<string|int, mixed>
- $resourceData : array<string|int, mixed>
- $citationData : array<string|int, mixed>
- $citeLocalisation : string
- $allPuncPattern : string
- $shortPuncsPatternStripped : string
- $space : string
Return values
array<string|int, mixed> —getBibInText()
Get items and other data for in-text bibliographies
private
getBibInText(array<string|int, mixed> $resourceData, array<string|int, mixed> $citationData, array<string|int, mixed> $footnotes, string $citeLocalisation, string $allPuncPattern, string $shortPuncsPatternStripped, string $space) : array<string|int, mixed>
Parameters
- $resourceData : array<string|int, mixed>
- $citationData : array<string|int, mixed>
- $footnotes : array<string|int, mixed>
- $citeLocalisation : string
- $allPuncPattern : string
- $shortPuncsPatternStripped : string
- $space : string
Return values
array<string|int, mixed> —getBibliographyFromCitations()
Produce the bibliography from cited text.
private
getBibliographyFromCitations(array<string|int, mixed> $citationData, array<string|int, mixed> $resourceData, array<string|int, mixed> $bibFootnoteIds, array<string|int, mixed> $footnoteOrder, array<string|int, mixed> $footnotes, mixed $footnotePages, array<string|int, mixed> $endSameIds) : string
Template and creators arrays are dynamic and might be modified by various functions so be careful how you pass them to functions.
NB While the parsing of citations uses $this->info['citeLocalisation'], formatting bibliographies uses $this->info['styleLocalisation']
Parameters
- $citationData : array<string|int, mixed>
- $resourceData : array<string|int, mixed>
- $bibFootnoteIds : array<string|int, mixed>
- $footnoteOrder : array<string|int, mixed>
- $footnotes : array<string|int, mixed>
- $footnotePages : mixed
- $endSameIds : array<string|int, mixed>
Return values
string —getPreviewBibOrder()
Return ordered $resIds for inText and endSameIdOrdered preview bibliography/endnotes.
private
getPreviewBibOrder() : array<string|int, mixed>
We create temporary table so we can use MySQL ordering as we do for full bibliography output.
Return values
array<string|int, mixed> —getResourceData()
Get resource data
private
getResourceData(array<string|int, mixed> $resIds, int $editorSwitch[, bool $full = FALSE ][, bool $list = FALSE ][, array<string|int, mixed> $listParams = [] ]) : array<string|int, mixed>
Parameters
- $resIds : array<string|int, mixed>
- $editorSwitch : int
- $full : bool = FALSE
-
(Default is FALSE)
- $list : bool = FALSE
-
(Default is FALSE)
- $listParams : array<string|int, mixed> = []
-
(Default is [])
Return values
array<string|int, mixed> —getResourcesCollection()
Get collection resource data for each sentence
private
getResourcesCollection(int $id) : array<string|int, mixed>
Parameters
- $id : int
Return values
array<string|int, mixed> —getResourcesCreators()
Get creator resource data for each sentence and creatorIdStrings
private
getResourcesCreators(int $id, string $type) : array<string|int, mixed>
Parameters
- $id : int
- $type : string
Return values
array<string|int, mixed> —getResourcesCustom()
Get custom resource data for each sentence
private
getResourcesCustom(int $id) : array<string|int, mixed>
Parameters
- $id : int
Return values
array<string|int, mixed> —getResourcesPublisher()
Get publisher resource data for each sentence
private
getResourcesPublisher(string $type, int $publisherId, int $miscFieldId) : array<string|int, mixed>
Parameters
- $type : string
- $publisherId : int
- $miscFieldId : int
Return values
array<string|int, mixed> —getResourceSubquery()
Return a subQuery providing 'creatorSurname' as an order
private
getResourceSubquery(array<string|int, mixed> $resIds, int $editorSwitch) : string
Parameters
- $resIds : array<string|int, mixed>
- $editorSwitch : int
Return values
string —getResourcesUrl()
Get URL resource data for each sentence
private
getResourcesUrl(int $id) : array<string|int, mixed>
Parameters
- $id : int
Return values
array<string|int, mixed> —getSentenceResources()
Get resource data for each sentence
private
getSentenceResources(array<string|int, mixed> $sentences, int $editorSwitch) : array<string|int, mixed>
Parameters
- $sentences : array<string|int, mixed>
- $editorSwitch : int
Return values
array<string|int, mixed> —getSentenceResourcesPreview()
Get resource data for each sentence—for style previewing only.
private
getSentenceResourcesPreview(array<string|int, mixed> $sentences) : array<string|int, mixed>
Resource data comes from the array $previewResources which, for each citation, has 'resource', 'creators' and 'URL' elements.
Parameters
- $sentences : array<string|int, mixed>
Return values
array<string|int, mixed> —getStyle()
Transform the raw data from the XML file into usable arrays and load some data arrays.
private
getStyle() : mixed
NB $this->flags is not properly set yet so we must use $this->info to find the style and citation types etc.
Return values
mixed —grabCustomFields()
Grab any custom fields
private
grabCustomFields() : mixed
Return values
mixed —printBibliography()
Print the bibliography/endnotes
private
printBibliography(array<string|int, mixed> $bibEntries, array<string|int, mixed> $bibFootnoteIds, array<string|int, mixed> $endnoteIds) : string
Parameters
- $bibEntries : array<string|int, mixed>
- $bibFootnoteIds : array<string|int, mixed>
- $endnoteIds : array<string|int, mixed>
Return values
string —removeSlashes()
Remove slashes (callback)
private
removeSlashes(string $element) : string
Parameters
- $element : string
Return values
string —setCitationOrder()
Set ordering as per the bibliographic ordering set for the style when parsing cited text
private
setCitationOrder() : array<string|int, mixed>
Return values
array<string|int, mixed> —setListOrder()
Set ordering for list and search operations (not for cited text)
private
setListOrder(array<string|int, mixed> $listParams) : mixed
Parameters
- $listParams : array<string|int, mixed>
Return values
mixed —setOrderCreator()
Set SQL ordering for creator
private
setOrderCreator() : string
Return values
string —setOrderYear()
Set SQL ordering for year
private
setOrderYear() : string
For some resource types, year1 is original publication year, year2 field is a reprint/revision year so year2 this provides the order
Return values
string —setResourceConditions()
Set the order resources should be returned in, join tables, and return resource fields for a list of resources.
private
setResourceConditions([bool $full = FALSE ][, bool $list = FALSE ][, array<string|int, mixed> $listParams = [] ]) : string
For a bibliography pulled from cited text, minimal information is required. Resources otherwise require more information and this is triggered by setting $full to TRUE (default is FALSE)
Parameters
- $full : bool = FALSE
- $list : bool = FALSE
-
(Default is FALSE)
- $listParams : array<string|int, mixed> = []
-
(Populated if $list = TRUE)
Return values
string —setResourceOrder()
Set the resource order.
private
setResourceOrder([bool $list = FALSE ][, array<string|int, mixed> $listParams = [] ]) : mixed
The order is important:
- for in-text citations as it controls disambiguation where a letter is added after the year.
- for endnote-style citations, if your bibliographic style says that a resource following another by the same creator(s) should have the creator(s) replaced by something like '_______', order is again important.
- for endnote-style citations having the same id no. for the same resource where the id no. in the text follows the bibliography order.
Parameters
- $list : bool = FALSE
-
(Default is FALSE)
- $listParams : array<string|int, mixed> = []
-
(Populated if $list = TRUE)
Return values
mixed —setSingleResourceConditions()
Join tables, and return resource fields when getting data for a single ressource.
private
setSingleResourceConditions() : string