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
Properties
- $citation : mixed
- array
- $customTypes : mixed
- array
- $dir : mixed
- string
- $externalParams : mixed
- array
- $flags : mixed
- array
- $footnotes : mixed
- array
- $footnotesCommon : mixed
- array
- $info : mixed
- array
- $previewResources : mixed
- array
- $resIds : mixed
- array
- $resourceTemplates : mixed
- array
- $style : mixed
- array
- $styleFile : mixed
- string
Methods
- __construct() : mixed
- BIBCITEGATEWAY
- bibStart() : array<string|int, mixed>
- Start the bibliography process
- citeStart() : bool
- Start the citation process by checking if we need to go further and initialize some things.
- getBibliographyFromList() : array<string|int, mixed>|string
- Producing the bibliography from a list or search operation.
- getDataFromResIds() : array<string|int, mixed>
- Get one or more bibliographic items from resourceIds.
- getDataFromSQL() : array<string|int, mixed>
- Produce a populated $resourceData set (resource, creators, publisher etc.) from a SQL statement.
- getPuncs() : array<string|int, mixed>
- Get punctuation patterns and space
- getSingleBib() : string
- Get items and other data for a single resource and return the formatted resource
- getStyle() : mixed
- Transform the raw data from the XML file into usable arrays and load some data arrays.
- initialize() : mixed
- Initialize system
- loadTemplates() : mixed
- Compile citation templates to final array adding replacement year template if required.
- parseCitations() : mixed
- parse [cite]...[/cite] and format citations
- previewSetCreatorIdStrings() : array<string|int, mixed>
- Find missing creatorIdStrings when previewing citations that are not footnotes — possibly should be set elsewhere but good for now.
- previewSetCreatorIdStringsFootnotes() : array<string|int, mixed>
- Find missing creatorIdStrings when previewing citations that are footnotes — possibly should be set elsewhere but good for now.
- setCiteType() : mixed
- Define the cite type and set some other parameters in $this->flags
- wpGetSet() : mixed
- Set and get word processor export options
Properties
$citation
array
public
mixed
$citation
$customTypes
array
public
mixed
$customTypes
= []
$dir
string
public
mixed
$dir
= ''
$externalParams
array
public
mixed
$externalParams
= []
$flags
array
public
mixed
$flags
$footnotes
array
public
mixed
$footnotes
$footnotesCommon
array
public
mixed
$footnotesCommon
= []
$info
array
public
mixed
$info
$previewResources
array
public
mixed
$previewResources
= []
$resIds
array
public
mixed
$resIds
= []
$resourceTemplates
array
public
mixed
$resourceTemplates
$style
array
public
mixed
$style
$styleFile
string
public
mixed
$styleFile
= ''
Methods
__construct()
BIBCITEGATEWAY
public
__construct([string $output = 'wikindx' ]) : mixed
Parameters
- $output : string = 'wikindx'
-
$this->flags[] holds a number of settings which can be set externally to this class (changes to settings should be done asap).
'preview' ('cite' if this class is called from previewcite or 'style' for previewstyle within the adminstyle plugin, otherwise FALSE)
'cite' TRUE if called from CITEOPTIONS
'output' (the type/order of bibliography) The options for $this->flags['output'] are: 'wikindx' Output will be HTML (used for WIKINDX display) — DEFAULT 'wikindxNoBib' Output will be HTML (used for WIKINDX display) but with no appended bibliography (i.e., showing just cited text from, e.g., \core\lists\LISTSOMERESOURCES::metaKeywordProcess() 'html' Output will be HTML (e.g., export to HTML) 'rtf' Output will be RTF format (e.g., export to RTF). 'wp' Output will be one of the options set in the Word Processor 'plain' No formatting (e.g., emailed statistics)
'bibType' (the type/order of bibliography) The options for $this->flags['citeType'] are: 'inText' In-text citations 'endInc' Endnotes: the endnotes order increments from 1 'ftInc' Footnotes: the footnotes order increments from 1 'endSameId' Endnotes using the same ID for the same resource: the endnotes order increments from 1 'endSameIdOrdered' Endnotes using the same ID for the same resource: the endnotes order is set in the bibliography settings
Note the following: 1. $this->flags['citeType'] = 'ftInc': cited text displays footnotes when $this->flags['output'] != 'html'. Footnotes and appended bibliography are output when $this->flags['output'] is 'rtf' or some other appropriate export format. When outputting footnotes and endnotes from cited text, $this->flags['footnotes'] is set to TRUE each time the main endnotes/footnotes or one of the three replace templates must be used and does not use 'citation' as its single field. If 'citation' is used for styles using footnotes, the footnote template for the resource type is used for the footnotes (if $this->flags['output'] != 'html') and the appended bibliography uses the bibliography template for the resoruce type. 2. Endnote and footnote type bibliographies that are not drawn from cited text, are not numbered, are ordered according to the set bibliography order, and use exclusively the bibliography template for each entry.
bibStart()
Start the bibliography process
public
bibStart() : array<string|int, mixed>
Start the bibliography process by checking if we need to go further and initialize some things Should only be called if processing only bibliographies. Cited text (with appended bibliography) starts with citeStart()
Currently only called from adminstyle plugin previewstyle()
Return values
array<string|int, mixed>citeStart()
Start the citation process by checking if we need to go further and initialize some things.
public
citeStart(string $text[, bool $wpExport = false ]) : bool
If called from the word processor, initialize() has already been run in the WP's export code.
Parameters
- $text : string
-
Input text
- $wpExport : bool = false
-
Default is FALSE
Return values
boolgetBibliographyFromList()
Producing the bibliography from a list or search operation.
public
getBibliographyFromList(array<string|int, mixed> $resourceData) : array<string|int, mixed>|string
$resourceData is already fully populated sith resource, crreators, publisher etc. information.
Template and creators arrays are dynamic and might be modified by various functions so be careful how you pass them to functions.
Parameters
- $resourceData : array<string|int, mixed>
Return values
array<string|int, mixed>|stringgetDataFromResIds()
Get one or more bibliographic items from resourceIds.
public
getDataFromResIds(int|array<string|int, mixed> $input[, bool $list = false ][, array<string|int, mixed> $listParams = [] ]) : array<string|int, mixed>
$resIds is either an int or an array of ints. There are two main ordering systems for a bibliographic list of resources:
- Order set in list and search operations within WIKINDX: $list = TRUE
- Order set from cited text (e.g. single resource view with cited metadata or from te wordprocessor): $list = FALSE (default)
Parameters
- $input : int|array<string|int, mixed>
- $list : bool = false
- $listParams : array<string|int, mixed> = []
-
(Default is [])
Return values
array<string|int, mixed>getDataFromSQL()
Produce a populated $resourceData set (resource, creators, publisher etc.) from a SQL statement.
public
getDataFromSQL(string $sql) : array<string|int, mixed>
This SQL statement might be the unlimited list SQL stored in sql_ListStmt or can come externally from CMS (which is sql_ListStmt anyway). The retur array is in a format that can be sent directly to getBibliographyFromList() in order to get formatted bib entries.
Parameters
- $sql : string
Return values
array<string|int, mixed>getPuncs()
Get punctuation patterns and space
public
getPuncs(string $citeLocalisation) : array<string|int, mixed>
Parameters
- $citeLocalisation : string
Return values
array<string|int, mixed>getSingleBib()
Get items and other data for a single resource and return the formatted resource
public
getSingleBib(array<string|int, mixed> $resourceData[, bool|array<string|int, mixed> $template = false ]) : string
Parameters
- $resourceData : array<string|int, mixed>
- $template : bool|array<string|int, mixed> = false
-
. An array means the template comes from previewstyle() in the adminstyle plugin.
Return values
stringgetStyle()
Transform the raw data from the XML file into usable arrays and load some data arrays.
public
getStyle() : mixed
NB $this->flags is not properly set yet so we must use $this->info to find the style and citation types etc.
initialize()
Initialize system
public
initialize() : mixed
loadTemplates()
Compile citation templates to final array adding replacement year template if required.
public
loadTemplates() : mixed
parseCitations()
parse [cite]...[/cite] and format citations
public
parseCitations(string $text[, bool $wpExport = false ]) : mixed
The return is usually a string. It is an array [text, bib] if called from the word processor.
NB In some cases (e.g. DOCX), we do not want to write footnote texts to a span enclosed in a div. Instead we gather these texts for later use.
Parameters
- $text : string
-
Input text
- $wpExport : bool = false
-
Default is FALSE
previewSetCreatorIdStrings()
Find missing creatorIdStrings when previewing citations that are not footnotes — possibly should be set elsewhere but good for now.
public
previewSetCreatorIdStrings(array<string|int, mixed> $resourceData, array<string|int, mixed> $items) : array<string|int, mixed>
Parameters
- $resourceData : array<string|int, mixed>
- $items : array<string|int, mixed>
Return values
array<string|int, mixed>previewSetCreatorIdStringsFootnotes()
Find missing creatorIdStrings when previewing citations that are footnotes — possibly should be set elsewhere but good for now.
public
previewSetCreatorIdStringsFootnotes(array<string|int, mixed> $resourceData, array<string|int, mixed> $items, array<string|int, mixed> $bibFootnoteIds) : array<string|int, mixed>
Parameters
- $resourceData : array<string|int, mixed>
- $items : array<string|int, mixed>
- $bibFootnoteIds : array<string|int, mixed>
Return values
array<string|int, mixed>setCiteType()
Define the cite type and set some other parameters in $this->flags
public
setCiteType() : mixed
Set $this->flags['citeType'] Can be reset in previewcite() of the adminstyle plugin.
wpGetSet()
Set and get word processor export options
public
wpGetSet(string $method[, mixed $input = false ]) : mixed
Parameters
- $method : string
- $input : mixed = false
-
Default = FALSE