WIKINDX API 6.10.2

wikindx

Table of Contents

Packages

core

Classes

API
API hooks
IDEASCOMMON
IDEASCOMMON class
EXPORTCOMMON
EXPORT COMMON class
FILETOTEXT
Convert files of various types to text ready for searching.
FileManager
FileManager
FileServer
FileServer
Location
Location
EncodeExplorer
EncodeExplorer
HIGHLIGHT
HIGHLIGHT class.
PASSWORD
PASSWORD class.

Functions

loadJavascript()  : void
Load the ajax javascript and the user javascript(s) into the HTML page output.
jActionForm()  : string
Create and load the HTML form element insert for the AJAX action and function.
jActionIcon()  : string
Create and load the IMG element insert for the AJAX action and function. Works with core/libs/LOADICONS.php.
encode_jArray()  : string
Convert $jsonArray to JSON string and format any array elements referencing javascript functions.
decode_jString()  : mixed
Convert JSON-formatted $jsonString to an array or object.
_json_error()  : void
echo JSON error or return if none.
getBibData()  : array<string|int, mixed>
Get data from citation sentences and return an array of citation data and an array of resource data ready for producing a bibliography from.
getItemArray()  : array<string|int, mixed>
Create an array of bibliographic data matching the template fields
addCreators()  : void
Add creators
findSubsequentFootnoteTemplates()  : void
Find examples of ibid, idem, and opCit footnote templates.
mapTemplate()  : array<string|int, mixed>
Map a template to the raw values and produce a basic bibliographic/footnote entry
invertFormat()  : string
Invert the format of a title where necessary.
mapSpecialTemplate()  : string
Map a special template (no partial, creator fields etc.—e.g., runningTimeTemplate) to the raw values and produce a string
checkMultiplePunctuation()  : array<string|int, mixed>
Make sure we don't have multiple punctuation characters after a field —NOT CURRENTLY USED (see cleanItems())
addLinks()  : string
Add link items such as URL and DOI
addLinksFt()  : string
Find any links in footnotes and make active if required
addDateStage1()  : array<string|int, mixed>
Add date: stage 1
addDateStage2()  : string
Add date: stage 2
formatDate()  : string
formatDay()  : array<string|int, mixed>
Format the day part of a date
addRunningTime()  : string
Add and format running time (films, TV etc.)
formatPages()  : array<string|int, mixed>
Add and format pages
addOtherItems()  : array<string|int, mixed>
Find other items in various resource arrays for adding to the $items array
setBookYears()  : void
For WIKINDX, if type is book, book_chapter or book article and there exists both 'year1' and 'year2' in $resource (entered as publication year and reprint year respectively), then switch these around as 'year1' is entered in the style template as 'originalPublicationYear' and 'year2' should be 'publicationYear'.
cleanItems()  : array<string|int, mixed>
Clean up the $item elements, deal with ordinals, and flatten to final string.
checkUltimate()  : array<string|int, mixed>
Check if the ultimate value should have its first characterf removed (double punctuation)
editorSwitch()  : bool
Set any author/editor re-ordering for book and book_article type.
formatCreators()  : void
Format creator name lists (authors, editors, etc.)
numCreatorManage()  : array<string|int, mixed>
Keep only some elements in array if we've exceeded set thresholds and create an etAl string if necessary.
rewriteCreatorStrings()  : array<string|int, mixed>
Rewrite creator strings
addCustom()  : array<string|int, mixed>
Add custom fields.
formatRunningTime()  : string
Format running time for audiovisual bibliography items
findAmbiguousYears()  : array<string|int, mixed>
Add year fields.
addEdition()  : array<string|int, mixed>
Add any edition field
formatEdition()  : mixed
Format edition (might not be numeric)
getOrdinalExtensionAlignment()  : array<string|int, mixed>
checkPartial()  : array<string|int, mixed>
Check that the first field of $template exists in $item and has a value.
checkFallBackFields()  : array<string|int, mixed>
When using a fallback template, ensure the fields are valid for that resource type
setCreatorRepeat()  : array<string|int, mixed>
Check against repeat creator options and amend $items if required If this is footnotes, then $newItems is also ordered correctly.
setCreatorRepeatEndnotes()  : array<string|int, mixed>
Check against repeat creator options and amend $items if required If this is footnotes, then $newItems is also ordered correctly.
mapTemplateCreatorRepeatString()  : string
Basic map template for creator repeat string
settings()  : mixed
Deal with various settings, setting, getting, incrementing, decrementing etc.
getNameString()  : string
Get the nameString variable
checkInitials()  : string
Handle initials.
hyphenatedInitials()  : string
Deal with hyphenated firstnames as initials
addCreatorDelimiters()  : void
Add delimiters to creators
formatMultiplePages()  : string
Format multiple pages.
titleCapitalization()  : string
Do title capitalization
setEtAl()  : string
Set et al. for multiple creators
findAlternates()  : array<string|int, mixed>
Find alternate fields dependent on previous or following fields and deal with accordingly.
formatTitle()  : string
Format a resource title
formatShortTitle()  : string
Format a resource shorTitle
mapDependencies()  : array<string|int, mixed>
Deal with __DEPENDENT_ON_PREVIOUS_FIELD__ for pre and post dependent on previous field's existence and __DEPENDENT_ON_NEXT_FIELD__ for pre and post dependent on the next field's existence
mapTemplateIndependents()  : void
Map independent fields of templates.
mapTemplatePlurals()  : array<string|int, mixed>
Deal with singular/plural dependencies for fields such as pages and creators
replaceWhitespace()  : string|array<string|int, mixed>
Replace ASCII whitespace with locale's whitespace character(s) from elements of an array Callback
stripTemplateBackticks()  : array<string|int, mixed>
Strip backticks used in template
ordinals()  : string
format ordinals
findAmbiguity()  : array<string|int, mixed>
Identify ambiguous in-text citations and references.
fillinPreview()  : array<string|int, mixed>
Provide empty array elements in resourceData from the adminstyle plugin's preview functions to conform with what BIBCITEGATEWAY expects.
setJustify()  : string|false
Generic code for setting justification
setLineSpace()  : string|false
Generic code for setting line height
setIndentation()  : string|false
Generic code for setting indentation
setFontSize()  : string|false
Generic code for setting font size
exportSettings()  : mixed
Setters and getters for various export preferences (e.g. from word processor)
doCitations()  : array<string|int, mixed>
Compile and add the citations to the text
mapTemplate()  : array<string|int, mixed>
Map a template to the raw values and produce a basic citation for inserting into the text
checkResourceTypeTemplate()  : array<string|int, mixed>
Some resource types have specific templates for in-text citations
forceAmbiguousTemplate()  : array<string|int, mixed>
Force the use of ambiguous templates overriding other templates other than subsequentCreatorTemplate
checkSubsequentCreatorTemplate()  : array<string|int, mixed>
Confirm (or not) that a subsequentCreatorTemplate designation is correct.
citationPosition()  : array<string|int, mixed>
Find required position of citation in sentence. Not all requests are possible so drop through three levels . . . Be careful! 0 => "Unchanged" 1 => "After previous creator name(s)" 2 => "After previous quotation" 3 => "Before end of sentence" 4 => "After end of sentence" 5 => "Before next soft punctuation" 6 => "After next soft punctuation"
checkConsecutiveCitations()  : array<string|int, mixed>
For multiple citations that are repositioned after soft or hard punctuation, mark them as consecutive citations.
checkFollowCreatorTemplate()  : array<string|int, mixed>
Confirm (or not) that a followCreatorTemplate designation is correct (in-text citations).
checkConsecutiveCreatorTemplate()  : array<string|int, mixed>
Confirm (or not) that a consecutiveCreatorTemplate designation is correct (in-text citations).
formatCitation()  : array<string|int, mixed>
Format the citation
hyperlinkCitation()  : void
Hyperlink the citation text
citationWrapping()  : array<string|int, mixed>
Format citation with wrapping characters taking account of consecutive citation runs and their delimiting characters
trueFootnoteWrapping()  : string
Wrapping of true footnotes in the text — only used for endInc, endSameId, and endSameIdOrdered
formatSentence()  : string
Format the sentence with each citation obeying required positions.
positionCitationInSentence()  : array<string|int, mixed>
Position citations in the sentence.
doPageSplit()  : void
Check if a citation page should indeed be split and deal with dependencies.
mapTemplateTidyYears()  : array<string|int, mixed>
Do some pre-processing of various year fields in the template
formatPages()  : void
Format pages.
formatCreators()  : void
Format creator name lists (authors, editors, etc.)
replacementYears()  : array<string|int, mixed>
Add replacement years fields to templates
copyYearAlternates()  : void
Copy any alternates relating to pre and post fields from the 'year' field to 'year1' and 'year2' fields
parseIndependent()  : void
Parse independent strings of new templates
compileTemplates()  : array<string|int, mixed>
Compile in-text and endote-style citation templates
addAmbiguity()  : void
Add any ambiguity letter to year field. Only for in-text citations
formatYear()  : void
Format years for citations
secondYearField()  : array<string|int, mixed>
Conditionally add second year field for formatting citations (e.g. revision year, reprint year etc.)—depends on resource type
splitIntoSentences()  : arrray
Split text into sentences.
parseSentences()  : array<string|int, mixed>
Parse the sentences array for citations and make some initial decisions
findSubsequentTemplates()  : void
Decide if the template for this citation should be the subsequentCreatorTemplate or similar for endnote styles.
findFollowCreatorTemplate()  : array<string|int, mixed>
Find cases for followCreatorTemplate and mark position after creator's name.
getCPattern()  : array<string|int, mixed>
Create the preg pattern for finding a citation's creator names in the same sentence.
tidySentences()  : array<string|int, mixed>
end-of-sentence characters have been captured in $split's array elements. These must be appended to the previous part sentence.
quotationCitationIndex()  : array<string|int, mixed>
Add the citation index to relevant quotations.
tidySentencesEndQuote()  : array<string|int, mixed>
Ensure hard punctuation just before a quotation end marker is treated as marking the end of a complete sentence.
findSpecialQuotes()  : string
Find special quotes such as dialogue and nested quotes—mark them and protect contents of nested quotes
findDialogueQuotes()  : string
Find dialogue quotes and mark them.
findNestedQuotes()  : string
Find and mark nested quotations.
findQuotes()  : string
Mark quotations and protect their content (in case the content has hard punctuation).
blockQuote1()  : string
Mark blockquotes.
blockQuote2()  : string
Format blockquotes and ensure tailend bits are part of it.
blockQuoteSort()  : string
Sort the blockQuote array by length so that the preg_replace works as expected
findEllipses()  : string
Mark ellipses and protect their content (in case the content has hard punctuation).
findTitle()  : array<string|int, mixed>
Find and note existence of title and short title in sentences
tidyInputText()  : string
Preliminary tidying of input text.
reconstituteBlockquote()  : string
Reconsitute blockquote
reconstituteQuote()  : string
Reconsitute quotation
reconstituteQuoteCallback()  : string
Reconsitute quotation callback
reconstituteText()  : string
Return sentence temporary markup to original
debugPrint()  : void
Print an array prettily for debugging purposes
getType()  : array<string|int, string>
Return an array containing the most used grammar types of a locale
compileQuotationMarkers()  : array<string|int, mixed>
Return array of quotation markers for each locale.
compileHardPunctuation()  : array<string|int, mixed>
Return array of hard punctuation (END of sentence only) for each locale.
compileSoftPunctuation()  : array<string|int, mixed>
Return array of soft punctuation (within sentence) for each locale.
compileAllPunctuation()  : array<string|int, mixed>
Return array of all hard and soft punctuation.
compileAbbreviations()  : array<string|int, mixed>
Return array of abbreviations for each locale.
compileNumbers()  : array<string|int, mixed>
Return array of number abbreviations (ordinals and measurements) for each locale.
compileEllipses()  : array<string|int, mixed>
Return array of ellipses for each locale.
compilePossessives()  : array<string|int, string>
Return array of possessives for each locale.
compileEtAl()  : array<string|int, mixed>
Return array of et al. possibilities for each locale.
compileCreatorConjunctions()  : array<string|int, mixed>
Return array of creator conjunction possibilities for each locale.
compileWordSpace()  : array<string|int, mixed>
Return array of word space characters for each locale.
compileApostrophe()  : array<string|int, mixed>
Return array of apostophe for each locale (e.g., in English the "'" of "it's" (short for "it is")
compileInitialPunctuation()  : array<string|int, mixed>
Return array of initial punctuation for each locale.
compileNumberConjunctions()  : array<string|int, mixed>
Return array of number conjunctions for each locale.
abbreviationsAppend()  : array<string|int, mixed>
Append common (Latin) bibliographic abbreviations
readComponentsList()  : array<string|int, mixed>
Read and return the list of all components installed
writeComponentsList()  : void
Write a list of components from an array
refreshComponentsListCache()  : void
Refresh the components list if needed, or forced by the caller
isBuiltinComponent()  : bool
Is a component builtin?
checkComponentsList()  : array<string|int, mixed>
Return a structured list of installed components
computeComponentVersion()  : int
Compute a component version number from the current date
computeComponentSignature()  : string
Compute the hash signature of a component from its installed code
createComponentMetadataFile()  : void
Create the component.json file of a component
enableComponent()  : bool
Enable a component
disableComponent()  : bool
Disable a component
checkComponentIntegrity()  : int
Check the integrity of a component
componentIntegrityErrorMessage()  : string
Return the message of an error code of the function checkComponentIntegrity()
extractComponentPackage()  : bool
Extract a WIKINDX Component Package to a folder
extractComponentPackageDefinition()  : array<string|int, mixed>
Extract the component.json file of a WIKINDX Component Package to an array
listPluginComponents()  : array<string|int, mixed>
List all plugins enabled in WIKINDX_DIR_COMPONENT_PLUGINS with a sane configuration
listStyleComponents()  : array<string|int, mixed>
List all styles enabled in WIKINDX_DIR_COMPONENT_STYLES with a sane configuration
listTemplateComponents()  : array<string|int, mixed>
List all templates enabled in WIKINDX_DIR_COMPONENT_TEMPLATES with a sane configuration
checkPluginVersionCompatibility()  : bool
Check version compatibility of a plugin
loadStyleInfo()  : associative
Extract info entries from a JSON bibliographic style file and return an associative array of childnode's value of 'info' node.
format()  : string
Format for HTML or RTF/plain?
bbcode()  : string
Deal with BBCODE
endnoteId()  : string
Format the endnote ID in the endnotes
trueFootnoteId()  : string
Format the true footnote ID in the footnotes section
newline()  : string
Return a newline character.
setHeaders()  : void
Set download headers
readfile_chunked()  : bool
Download file to user
createFileName()  : array<string|int, mixed>
create a fileName for this file. If directory based on session ID does not exist, create it.
fileAttachUploadMaxSize()  : int
Get attachment max upload size in bytes
imageUploadMaxSize()  : int
Get image max upload size in bytes
fileUploadMaxSize()  : int
Get file max upload size in bytes
return_bytes()  : int
Convert some ini values to numerical values (to bytes)
dirToArray()  : array<string|int, mixed>
Enumerate files and subdirectories of a directory except . and .. subdirectories
dirInDirToArray()  : array<string|int, mixed>
Enumerate subdirectories of a directory except . and .. subdirectories
fileInDirToArray()  : array<string|int, mixed>
Enumerate files of a directory except . and .. subdirectories
recurse_AbsoluteDirToArray()  : array<string|int, mixed>
Enumerate recursively files and subdirectories of a directory except . and .. subdirectories
recurse_fileInDirToArray()  : array<string|int, mixed>
Enumerate recursively files and subdirectories of a directory except . and .. subdirectories
recurse_dir_copy()  : void
Copy recursively a folder
recurse_rmdir()  : void
Remove recursively a folder
rmfile()  : void
Remove a file
fileUpload()  : array<string|int, mixed>
Return filename, hash, type and size of an uploaded file or an array of such information for each file uploaded
rearrangeFilesArray()  : array<string|int, mixed>
Rearrange the $_FILES array for multiple file uploads
fileStore()  : bool
Store uploaded file in given directory with given name
listFiles()  : array<string|int, mixed>
list and HTML format all files for sessionID
tidyFiles()  : void
tidy up the files directory by removing all files and folders older than WIKINDX_FILE_DELETE_SECONDS
zip()  : mixed
Zip up an array of files. File is stored in files dir.
read_json_file()  : mixed
Read a JSON file to a data structure
write_json_file()  : int
Write a data structure to a JSON file
formatSize()  : string
Format a file size in bytes to the greater multiple for display
getMimeType()  : string
Return the mime-type of a file
getExtension()  : string
Return the extension of a file in lowercase (without point)
replaceFileExtension()  : string
Replace the extension of a file by an other
removeFileExtension()  : string
Remove the extension of a file path (and its point)
base64_encode_file()  : void
Encode a file with base64 as an other file
base64_decode_file()  : void
Encode a file with base64 as an other file
bin2hex_encode_file()  : void
Encode a file with bin2hex as an other file
hash_path()  : string
Generates a hash of a file or directory at the given path with the specified algo.
_inlineHtmlAttribute()  : string
Build a string for insertion of an HTML tag attribute.
formHeader()  : string
print form header with hidden action field
formHeaderVisibleAction()  : string
print form header with visible action field -- typically used for tinyMCE popups
formHeaderName()  : string
print form header with hidden action field and name and id fields
formEnd()  : string
end a form
formMultiHeader()  : string
print form header with hidden action field for multi-part upload forms
formSubmit()  : string
print form footer with submit field
closePopup()  : string
print form footer with close popup button
formSubmitButton()  : string
print form footer with submit button field
formReset()  : string
print form reset button
hidden()  : string
print hidden form input
hiddenNoJSNoId()  : string
print hidden form input without JavaScript action
radioButton()  : string
print radio button
radioButtonGroup()  : string
Print a radio button group.
checkbox()  : string
print checkbox
selectYesNoBox()  : string
create special select box that only provides yes (1) and no (0) as options (values)
selectFBox()  : string
create select boxes for HTML forms
selectedBox()  : string
create select boxes for HTML forms
selectFBoxValue()  : string
create select boxes for HTML forms
selectedBoxValue()  : string
create select boxes for HTML forms
selectFBoxValueMultiple()  : string
create select boxes for HTML forms
selectedBoxValueMultiple()  : string
create select boxes for HTML forms
passwordInput()  : string
password input type
honeypotInput()  : string
A honeypot field made with text input
textInput()  : string
text input type
colorInput()  : string
color input type
textareaInput()  : string
textarea input type
textareaInputmceNoEditor()  : string
textarea input type without MCE editor
textareaReadonly()  : string
textarea readonly
fileUpload()  : string
upload box
fileUploadMultiple()  : string
upload box for multiple files
dateInput()  : string
date input type
label()  : string
Label Form element
filterHTML()  : string
Filter HTML in fields destined for the search_ tables
filterHTMLLinks()  : string
Filter HTML links for LISTCOMMON output
escape()  : mixed
Escape strings inserted in HTML
escapeHTMLTemp()  : mixed
Temporarily escape HTML entities
_inlineHtmlAttribute()  : string
Build a string for insertion of an HTML tag attribute.
h()  : string
<Hx> heading element
div()  : string
<DIV> element
divScrollable()  : string
Scrollable <DIV> element
iframe()  : string
<IFRAME> element
p()  : string
<P> element
pBrowse()  : string
<P> element
pre()  : string
<PRE> element
ul()  : string
<UL> element
ol()  : string
<OL> element
li()  : string
<LI> element
hr()  : string
<HR> element
mark()  : string
<mark> element
object()  : string
<OBJECT> element For display attachment previews
span()  : string
<SPAN> element
color()  : string
<SPAN color> element
strong()  : string
<STRONG> element (Semantic equivalent of <B>)
em()  : string
<EM> element (Semantic equivalent of <I>)
u()  : string
<U> element
img()  : string
<IMG> element
anchor()  : string
<A> element used as internal anchor
a()  : string
<A> element used as hyperlink
aBrowse()  : string
<A> element used as hyperlink
tableStart()  : string
Start a <TABLE> tag
tableEnd()  : string
Close a <TABLE> tag
tableCaption()  : string
provide a table <caption>
tbodyStart()  : string
Provide a <tbody> tag
tbodyEnd()  : string
Provide a </tbody> tag
theadStart()  : string
Provde a <thead> tag
theadEnd()  : string
Provide a </thead> tag
tfootStart()  : string
Provide a <tfoot> tag
tfootEnd()  : string
Provide a </tfoot> tag
trStart()  : string
Provide a <tr> tag
trEnd()  : string
Provide a </tr> tag
tdStart()  : string
Provide a <td> tag without closing it or encapsulating data
tdEnd()  : string
Provide a </td> tag
td()  : string
Provide a <td>...</td> tag
thStart()  : string
Provide a <th> tag without closing it or encapsulating data
thEnd()  : string
Provide a </th> tag
th()  : string
Provide a <th>...</th> tag
cssInlineExternal()  : string
Insert a call to an external CSS file
jsInline()  : string
Inlining JavaScript code
jsInlineExternal()  : string
Insert a call to an external javascript file
successToast()  : string
Format a text as a HTML success toast message (temporary info)
errorToast()  : string
Format a text as a HTML error toast message (temporary info)
nlToHtml()  : string
replace newlines and carriage returns with appropriate HTML code.
htmlToNl()  : mixed
replace HTML newlines and carriage returns in a string or array with appropriate ANSI code.
removeNl()  : string
remove all newlines.
stripHtml()  : mixed
Strip HTML from string or array
clearSortField()  : string
Strip HTML from string
get_core_message()  : string
Translate a message from a domain
get_message()  : string
Translate a message from a domain
translate_message()  : string
Translate a message from a domain
dateFormatFromString()  : string
Format dates and times for localization in numeric short format
dateFormatFromTimeStamp()  : string
Format dates and times for localization in numeric short format
codeISO639a1toName()  : string
Return the name of a language defined by its locale code or its ISO 639-1 (alpha-2) code.
set_locales()  : void
Set the default locale of Intl library with the user's preferred locale
load_locales()  : array<string|int, mixed>
Load the translation catalogs of the user's preferred language.
determine_locale()  : string
Determine the user's preferred language.
determine_locale_priority_stack()  : array<string|int, string>
Determine the user's preferred language.
getAllLocales()  : array<string|int, string>
Return a selected list of all locales recognised by Intl and usable for translation and formatting
localetoBCP47()  : string
Return the BCP 47 code that matches the code of a locale.
getTranslatableLocales()  : array<string|int, string>
Get a list of translatable locales sorted by locale name
searchLanguageCode()  : string
Return the language code matching a language name
sort()  : bool
Sort an array according to the current Intl locale in ascending order
asort()  : bool
Sort an array according to the current Intl locale in ascending order and maintain index association
ksort()  : bool
Sort an array according to the current Intl locale in ascending order and maintain index association
rsort()  : bool
Sort an array according to the current Intl locale in descending order
arsort()  : bool
Sort an array according to the current Intl locale in descending order and maintain index association
krsort()  : bool
Sort an array according to the current Intl locale in descending order and maintain index association
messageTranslatorNeeded()  : string
Return a message if the project need translation contribution for the current locale
getPagingParams()  : array<string|int, mixed>
Get the paging start and total
getNum()  : string
Get information on the number or characters being used for alphabetical and dictionary paging
setLinks()  : array<string|int, mixed>
Get links for alphabetical and dictionary paging
getZoomSlices()  : void
Get zooming paging slices
calculateZoomSlices()  : mixed
Calculate the zoom slices
getZoomLinks()  : array<string|int, mixed>
Get the zoom links
zoomToTop()  : string
Set zoom top link link
zoomUpOneLevel()  : string
Set zoom up one level link
storeZoomData()  : void
Store the zoom session
getRootLink()  : mixed
Get the root link for the paging link
linksInfo()  : string
Format display information string
getUserBib()  : array<string|int, mixed>
Check for user bibliographies
getBib()  : mixed
Get details about the bibliography being used
getData()  : array<string|int, mixed>
get data from database
grabCollection()  : void
Grab collection title
grabPublisher()  : void
Grab publisher
grabNames()  : void
grabNames
webFormat()  : string
web_article, URL and accessed date
year2Format()  : string
format YYYY/MM/DD of conference dates etc
year1Format()  : string
format YYYY/MM/DD of publication
timeFormat()  : string
format running time for films
grabNoteAbstract()  : void
grabNoteAbstract
grabKeywords()  : void
grabKeywords
tidyOutput()  : array<string|int, mixed>
Tidy up the output for plain text
header()  : string
Set some defaults and create the RTF opening tag
footer()  : string
Create the RTF closing tag
footnotes()  : mixed
Set RTF headers regarding footnotes/endnotes
citation()  : mixed
Citation stuff The options for $citeStyle are: 'inText' In-text citations (needs bibliography appended) 'ftInc' Footnotes: the footnotes order increments from 1 (needs bibliography appended) 'endInc' Endnotes: the endnotes 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
documentSettings()  : mixed
Deal with document defaults. This function has various roles depending on the value of $method Must be called before traverseDOM()
cleanHtml()  : string
Clean up HTML before parsing and do some initial conversion
specialCharsToRTF()  : string
Convert special characters.
cleanBlockquotes()  : string
TinyMCE always puts p tags within blockquote—remove them!
fonts()  : mixed
Deal with fonts. This function has various roles depending on the value of $method
colours()  : mixed
Deal with colours. This function has various roles depending on the value of $method
lists()  : mixed
Deal with lists. This function has various roles depending on the value of $method
listToRTF()  : string
Convert lists to RTF (deals with nested lists too and recognizes unordered or ordered)
newListTableItem()  : string
Create new listtable item
textDecoration()  : mixed
text-decoration styling
fontWeight()  : string
Convert font-weight
fontSize()  : string
Convert font size to RTF
traverseDOM()  : string
Traverse the DOM and produce RTF code
nodeAttributes()  : mixed
Convert attributes
tables()  : mixed
Deal with tables and their elements. This function has various roles depending on the value of $method
setCellEdgeDefaults()  : array<string|int, mixed>
Set cell edge defaults in the table matrix.
tableCellToRTF()  : array<string|int, mixed>
Convert table cell to RTF cell property string
inheritParentBorders()  : array<string|int, mixed>
Transfer the parent's border properties to a spanned child
getCellBorderParams()  : array<string|int, mixed>
Get cell border parameters
updateCellEdges()  : array<string|int, mixed>
Update cell edge in the table matrix for one cell. i.e. border has been set for this table cell
cellBordersToString()  : string
Create a string of cell border properties from an array
calculateTableMatrix()  : array<string|int, mixed>
We need to set up a table matrix counting number of rows and number of their children so we can deal with various properties.
getCellWidth()  : string
Get cell width
startCellToRTF()  : array<string|int, mixed>
Start the process of converting a td or th element
utf8_2_rtfansicpg1252()  : string
UTF-8 to ANSI Windows 1252 strings for RTF only
domImageToRtfImagePlaceholders()  : string
Replace HTML image src attribut by a placeholder pointing to a cached file on disk
domNodeAttributes2Array()  : array<string|int, string>
Convert attributes of a DOMNode to an array of attributes
arrayMonthAndSeasonNames()  : array<string|int, string>
Return an array of months and season names
monthAndSeasonName()  : string
Return a month or season name
cardinalToOrdinal()  : string
Make an ordinal from a cardinal. Default is English
cardinalToOrdinalWord()  : string
Convert ordinal to word
cardinalToOrdinalWordLatin()  : string
Convert ordinal to word in Latin
cardinalToGreek()  : string
convert cardinal (Arabic) to Greek numerals
cardinalToRoman()  : string
convert cardinal (Arabic) to Roman numerals
getUuid()  : string
Get UUID from database
store()  : bool
Store/merge data.
exists()  : bool
Check a row exists
fetch()  : array<string|int, mixed>|false
Fetch data array
fetchOne()  : mixed
Fetch one array element
delete()  : void
Delete row
deleteKeys()  : bool
Delete keys from the row data array
build_query()  : string
Generate URL-encoded query string according to RFC 3986
escape()  : string
Escape a component of a URL according to RFC 3986
reduceUrl()  : string
Reduce the size of long URL to keep web browser display tidy
getCurrentProtocol()  : string
Return the protocol requested by the HTTP client
getVhost()  : string
Return the vHost name (Virtual Hostname)
URL_exists()  : bool
Check that an internet resource exists
html_numeric_entity_decode()  : string
Convert numeric HTML entities to their corresponding characters
mb_ucfirst()  : string
A unicode aware replacement for ucfirst()
mb_explode()  : array<string|int, mixed>
Simulate explode() for multibytes strings (as documented for PHP 7.0)
mb_strrev()  : string
Simulate strrev() for multibytes strings
mb_substr_replace()  : string
Simulate substr_replace() for multibytes strings
mb_trim()  : string
Multi-byte safely strip white-spaces (or other characters) from the beginning and end of a string.
mb_ltrim()  : string
Multi-byte safely strip white-spaces (or other characters) from the beginning of a string.
mb_rtrim()  : string
Multi-byte safely strip white-spaces (or other characters) from the end of a string.
listCoreMandatoryPHPExtensions()  : array<string|int, string>
Return an array of mandatory PHP extensions used by the WIKINDX core
listCoreOptionalPHPExtensions()  : array<string|int, string>
Return an array of optional PHP extensions used by the WIKINDX core
OSName()  : string
Return the normalized name of the current os
matchPrefix()  : bool
Check if a prefix match against a string
matchSuffix()  : bool
Check if a suffix match against a string
curl_download_file_http()  : bool
Download a file from an url with HTTP
uuid()  : string
Return a (pseudo) unique string of variable length using random_bytes().
createDataFolders()  : void
Create default data folders used by the application
checkFileSystemPerms()  : mixed
Check the permissions of various folders and files which must be writable
arrayCombinations()  : void
Generate an array of all possible combinations of array values From https://stackoverflow.com/questions/10834393/php-how-to-get-all-possible-combinations-of-1d-array with minor adaptation ($space)
splitDate()  : array<string|int, mixed>
Take input from HTML FORM <input type=date> and split into separate fields.
balanceBraces()  : string
Balance braces after removing noSort in resource input/edit of title or for bibTeX input
sumBraces()  : int
Balance braces after removing noSort or for bibTeX input — return result of sum of open - close braces
noSortPattern()  : string
Create a preg pattern for checking presence of a WIKINDX_NO_SORT value at the beginning of a string.
writeUserPassword()  : void
Write a hashed version of a user password in users table
verifyUserPassword()  : bool
Verify that a password matches a password hash of a user
array_value_select()  : mixed
Return the corresponding value of an array key or a default value
createHelpTopicLink()  : string
Create a popup link for a Help Topic on the website
canIResumeExecution()  : bool
Can I resume execution?
command_exists()  : bool
Does an unix command exist?
insertExportImages()  : void
Insert cached images inside exported files, and delete them
reduceLongText()  : string
Reduce the size of long text (in select boxes usually) to keep web browser display tidy.
computeBibtexKeyAuthorYear()  : string
Generate a BibTeX citation key for one resource with format 'AuthorYear'
computeBibtexKeyAuthorID()  : string
Generate a BibTeX citation key for one resource with format 'Author.ResourceId'
clearXmlString()  : string
Clear forbidden characters from an XML string
clearDOI()  : string
Clear a DOI number
validateDOI()  : bool
Validate a DOI number
escape()  : string
Escape strings inserted in XML
handleParams()  : array<string|int, mixed>
Handle the params array and act as a gateway to other functions
initialiseParams()  : array<string|int, mixed>
Initialise params for each type of list.
commonInit()  : array<string|int, mixed>
Initialise common list parameters
qsearchInit()  : array<string|int, mixed>
Initialise qsearch parameters
citeInit()  : array<string|int, mixed>
Initialise cite parameters
basketInit()  : array<string|int, mixed>
Initialise basket parameters
browseInit()  : array<string|int, mixed>
Initialise browse parameters
ideasInit()  : array<string|int, mixed>
Initialise ideas parameters
advsearchInit()  : array<string|int, mixed>
Initialise advsearch parameters
advsearchForm()  : array<string|int, mixed>
Get some advsearch parameters for initialising the advsearch form
setParams()  : array<string|int, mixed>
Set a parameter. Multiple parameters can be set.
finalize()  : mixed
After completion of listing, save parameters
loadStaticConfig()  : array<string|int, mixed>
Load configuration from config.php
wkx_session_open()  : bool
The open callback works like a constructor in classes and is executed when the session is being opened.
wkx_session_close()  : bool
The close callback works like a destructor in classes and is executed after the session write callback has been called.
wkx_session_read()  : string
The read callback must always return a session encoded (serialized) string, or an empty string if there is no data to read.
wkx_session_write()  : bool
The write callback is called when the session needs to be saved and closed.
wkx_session_destroy()  : bool
This callback is executed when a session is destroyed with session_destroy() or with session_regenerate_id() with the destroy parameter set to true.
wkx_session_gc()  : bool
The garbage collector callback is invoked internally by PHP periodically in order to purge old session data.
needUpdate()  : bool
Check if the current WIKINDX data (db and files) need an upgrade
existsTableVersion()  : bool
Check if 'version' table that stores the version number of the db schema exists
getCoreInternalVersion()  : float
Return the internal version stored in the database of the core
setCoreInternalVersion()  : mixed
Write an internal version in the database of a component or the core
getComponentInternalVersion()  : float
Return the internal version of a component stored in the database
setComponentInternalVersion()  : mixed
Write an internal version of a component in the database
deleteComponentInternalVersion()  : mixed
Delete an internal version of a component from the database
existsSuperadminAccount()  : bool
Check if 'users' table has not been filled with the superadmin account
getConfigContactEmail()  : float
Return the configContactEmail depending on the software version
logonCheckUpgradeDB()  : bool
Initial logon to the system when upgrading the database.
wkx_error_handler()  : bool
Custom PHP errors handler
wkx_error_log()  : void
Write a message to the application log
wkx_clear_error_log()  : mixed
Remove expired error logs (14 days max) and limit their size to 25 MB by file
buildUpgradePage()  : mixed

Functions

loadJavascript()

Load the ajax javascript and the user javascript(s) into the HTML page output.

loadJavascript([mixed $scripts = [] ]) : void
Parameters
$scripts : mixed = []

Either an array of .js scripts to load or a single string.

jActionForm()

Create and load the HTML form element insert for the AJAX action and function.

jActionForm(string $action, array<string|int, mixed> $jsonArray[, bool $return = FALSE ]) : string
Parameters
$action : string

The javascript action such as 'onclick' etc.

$jsonArray : array<string|int, mixed>

The parameter to be passed to gateway() as an array ready to be converted to JSON

$return : bool = FALSE

If TRUE, generated javascript has a return from the gateway() function. Default is FALSE.

Return values
string

jActionIcon()

Create and load the IMG element insert for the AJAX action and function. Works with core/libs/LOADICONS.php.

jActionIcon(string $icon, string $action, array<string|int, mixed> $jsonArray[, bool $return = FALSE ]) : string
Parameters
$icon : string

The icon to make an image of ('add', 'delete', 'view' etc.)

$action : string

The javascript action such as 'onclick' etc.

$jsonArray : array<string|int, mixed>

The parameter to be passed to gateway() as an array ready to be converted to JSON

$return : bool = FALSE

If TRUE, generated javascript has a return from the gateway() function. Default is FALSE.

Return values
string

The image tag

encode_jArray()

Convert $jsonArray to JSON string and format any array elements referencing javascript functions.

encode_jArray(array<string|int, mixed> $jsonArray[, bool $quote = FALSE ]) : string
Parameters
$jsonArray : array<string|int, mixed>

The unformatted JSON array

$quote : bool = FALSE

No encoding of quotation marks (") if set to FALSE. Default is FALSE.

Return values
string

The JSON string

decode_jString()

Convert JSON-formatted $jsonString to an array or object.

decode_jString(string $jsonString) : mixed
Parameters
$jsonString : string

The JSON string

Return values
mixed

Array or object

_json_error()

echo JSON error or return if none.

_json_error(string $type) : void
Parameters
$type : string

getBibData()

Get data from citation sentences and return an array of citation data and an array of resource data ready for producing a bibliography from.

getBibData(mixed $sentences, array<string|int, mixed> $resIds, array<string|int, mixed> $flags) : array<string|int, mixed>

We only get here if the text from which $sentences is produced has citations (and thus resource data for the bibliography). NB elements of the $sentences array might not themselves have citations/resource data — discard these.

$resIds is an ordered list of resourceIds for in-text bibliographies and endnote-style citations using the same ID number where the style dictates the bibliography order is NOT to be used: in this case, we use the citation array's endnoteId. In other endnote styles, we order $resourceData by the citation array's endnoteId value.

Parameters
$sentences : mixed
$resIds : array<string|int, mixed>
$flags : array<string|int, mixed>
Return values
array<string|int, mixed>

getItemArray()

Create an array of bibliographic data matching the template fields

getItemArray(array<string|int, mixed> $localBibType, array<string|int, mixed> $bibStyle, mixed $creatorStyle, array<string|int, mixed> $template, array<string|int, mixed> $customTypes, array<string|int, mixed> $flags, string $styleLocalisation, string $type, array<string|int, mixed> $resourceData, array<string|int, mixed> $citationData, string $puncPattern, string $space) : array<string|int, mixed>
Parameters
$localBibType : array<string|int, mixed>
$bibStyle : array<string|int, mixed>
$creatorStyle : mixed
$template : array<string|int, mixed>
$customTypes : array<string|int, mixed>
$flags : array<string|int, mixed>
$styleLocalisation : string
$type : string
$resourceData : array<string|int, mixed>
$citationData : array<string|int, mixed>
$puncPattern : string
$space : string
Return values
array<string|int, mixed>

addCreators()

Add creators

addCreators(array<string|int, mixed> $localBibType, array<string|int, mixed> $template, array<string|int, mixed> $resourceData, array<string|int, mixed> $creatorStyle, string $styleLocalisation, string $type, array<string|int, mixed> &$items, array<string|int, mixed> $flags) : void
Parameters
$localBibType : array<string|int, mixed>
$template : array<string|int, mixed>
$resourceData : array<string|int, mixed>
$creatorStyle : array<string|int, mixed>
$styleLocalisation : string
$type : string
$items : array<string|int, mixed>
$flags : array<string|int, mixed>

findSubsequentFootnoteTemplates()

Find examples of ibid, idem, and opCit footnote templates.

findSubsequentFootnoteTemplates(array<string|int, mixed> &$footnotes, string $citeType) : void

If using endnotes that use the same ID for the same resource, set only to templateEndnote.

Parameters
$footnotes : array<string|int, mixed>
$citeType : string

mapTemplate()

Map a template to the raw values and produce a basic bibliographic/footnote entry

mapTemplate(array<string|int, mixed> $localBibType, array<string|int, mixed> $bibStyle, string $styleLocalisation, array<string|int, mixed> $template, string $allPuncPattern, array<string|int, mixed> $item, array<string|int, mixed> $flags) : array<string|int, mixed>
Parameters
$localBibType : array<string|int, mixed>
$bibStyle : array<string|int, mixed>
$styleLocalisation : string
$template : array<string|int, mixed>
$allPuncPattern : string
$item : array<string|int, mixed>
$flags : array<string|int, mixed>
Return values
array<string|int, mixed>

invertFormat()

Invert the format of a title where necessary.

invertFormat(string $title, string $pre, string $post) : string

e.g., if the original title has elements in italics and the title field of the template is enclosed in italics, remove the formatting of those original elements. The same for underline, bold, superscript, and subscript. The formatting comes from tinyMCE so we know what it is for each type.

Parameters
$title : string
$pre : string
$post : string
Return values
string

mapSpecialTemplate()

Map a special template (no partial, creator fields etc.—e.g., runningTimeTemplate) to the raw values and produce a string

mapSpecialTemplate(array<string|int, mixed> $template, array<string|int, mixed> $item) : string
Parameters
$template : array<string|int, mixed>
$item : array<string|int, mixed>
Return values
string

checkMultiplePunctuation()

Make sure we don't have multiple punctuation characters after a field —NOT CURRENTLY USED (see cleanItems())

checkMultiplePunctuation(string $itemString, string $lastItemString, string $puncPattern, string $pre, string $post) : array<string|int, mixed>
Parameters
$itemString : string
$lastItemString : string
$puncPattern : string
$pre : string
$post : string
Return values
array<string|int, mixed>

Add link items such as URL and DOI

addLinks(string|array<string|int, mixed>|null $item, array<string|int, mixed> $flags) : string
Parameters
$item : string|array<string|int, mixed>|null
$flags : array<string|int, mixed>
Return values
string

addLinksFt()

Find any links in footnotes and make active if required

addLinksFt(string $item, array<string|int, mixed> $flags) : string
Parameters
$item : string
$flags : array<string|int, mixed>
Return values
string

addDateStage1()

Add date: stage 1

addDateStage1(array<string|int, mixed> $localBibType, string $styleLocalisation, array<string|int, mixed> $bibStyle, array<string|int, mixed> $data, array<string|int, mixed> $items) : array<string|int, mixed>

For 'web_article', $startDay and $startMonth represent the publication date

Parameters
$localBibType : array<string|int, mixed>
$styleLocalisation : string
$bibStyle : array<string|int, mixed>
$data : array<string|int, mixed>
$items : array<string|int, mixed>
Return values
array<string|int, mixed>

addDateStage2()

Add date: stage 2

addDateStage2(array<string|int, mixed> $localBibType, string $styleLocalisation, array<string|int, mixed> $bibStyle, string|int $startDay, string|int $startMonth, string|int $endDay, string|int $endMonth) : string
Parameters
$localBibType : array<string|int, mixed>
$styleLocalisation : string
$bibStyle : array<string|int, mixed>
$startDay : string|int
$startMonth : string|int
$endDay : string|int
$endMonth : string|int
Return values
string

formatDate()

formatDate(mixed $startDay, mixed $endDay, mixed $startMonth, mixed $endMonth, mixed $monthArray, mixed $bibStyle) : string
Parameters
$startDay : mixed
$endDay : mixed
$startMonth : mixed
$endMonth : mixed
$monthArray : mixed
$bibStyle : mixed
Return values
string

formatDay()

Format the day part of a date

formatDay(string|int $startDay, string|int $endDay, array<string|int, mixed> $bibStyle, string $styleLocalisation) : array<string|int, mixed>
Parameters
$startDay : string|int
$endDay : string|int
$bibStyle : array<string|int, mixed>
$styleLocalisation : string
Return values
array<string|int, mixed>

addRunningTime()

Add and format running time (films, TV etc.)

addRunningTime(string $styleLocalisation, array<string|int, mixed> $bibStyle, array<string|int, mixed> $data) : string
Parameters
$styleLocalisation : string
$bibStyle : array<string|int, mixed>
$data : array<string|int, mixed>
Return values
string

formatPages()

Add and format pages

formatPages(array<string|int, mixed> $data, array<string|int, mixed> $bibStyle, array<string|int, mixed> $items) : array<string|int, mixed>
Parameters
$data : array<string|int, mixed>
$bibStyle : array<string|int, mixed>
$items : array<string|int, mixed>
Return values
array<string|int, mixed>

addOtherItems()

Find other items in various resource arrays for adding to the $items array

addOtherItems(array<string|int, mixed> $localBibType, array<string|int, mixed> $resourceData, array<string|int, mixed> $items) : array<string|int, mixed>
Parameters
$localBibType : array<string|int, mixed>
$resourceData : array<string|int, mixed>
$items : array<string|int, mixed>
Return values
array<string|int, mixed>

setBookYears()

For WIKINDX, if type is book, book_chapter or book article and there exists both 'year1' and 'year2' in $resource (entered as publication year and reprint year respectively), then switch these around as 'year1' is entered in the style template as 'originalPublicationYear' and 'year2' should be 'publicationYear'.

setBookYears(array<string|int, mixed> &$resource, string $type) : void
Parameters
$resource : array<string|int, mixed>
$type : string

cleanItems()

Clean up the $item elements, deal with ordinals, and flatten to final string.

cleanItems(string $styleLocalisation, array<string|int, mixed> $itemArray, string $allPuncPattern, string $space, string $ultimate, array<string|int, mixed> $flags) : array<string|int, mixed>

Keep the print statements (commented out for production) as they are useful for debugging. Note that we use '·' to help show spaces either end of the string.

Parameters
$styleLocalisation : string
$itemArray : array<string|int, mixed>
$allPuncPattern : string
$space : string
$ultimate : string
$flags : array<string|int, mixed>
Return values
array<string|int, mixed>

checkUltimate()

Check if the ultimate value should have its first characterf removed (double punctuation)

checkUltimate(array<string|int, mixed> $item, string $ultimate, array<string|int, mixed> $puncs) : array<string|int, mixed>
Parameters
$item : array<string|int, mixed>
$ultimate : string
$puncs : array<string|int, mixed>
Return values
array<string|int, mixed>

editorSwitch()

Set any author/editor re-ordering for book and book_article type.

editorSwitch(array<string|int, mixed> $bibStyle, array<string|int, mixed> &$template, array<string|int, mixed>|null &$creators, string $type) : bool

If required, we unset the 'authors' element in template, set resourcecreatorRole to 1, and copy the editorSwitch template to the 'authors' element so that the primary creator name formatting settings are used. Setting resourcecreatorRole to 1, we don't need to unset the 'editors' element in $template.

Parameters
$bibStyle : array<string|int, mixed>
$template : array<string|int, mixed>
$creators : array<string|int, mixed>|null
$type : string
Return values
bool

formatCreators()

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

formatCreators(array<string|int, mixed> $creators, string $nameType, array<string|int, mixed> $localBibType, array<string|int, mixed> $creatorStyle, string $styleLocalisation, array<string|int, mixed> $template, string $type, array<string|int, mixed> &$items, array<string|int, mixed> $flags) : void
Parameters
$creators : array<string|int, mixed>

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
$localBibType : array<string|int, mixed>
$creatorStyle : array<string|int, mixed>
$styleLocalisation : string
$template : array<string|int, mixed>
$type : string
$items : array<string|int, mixed>
$flags : array<string|int, mixed>

numCreatorManage()

Keep only some elements in array if we've exceeded set thresholds and create an etAl string if necessary.

numCreatorManage(array<string|int, mixed> $bibStyle, array<string|int, mixed> $cArray, string $localNameType, string $list, string $limit, string $moreThan, bool $italics, string $abbreviation, string $delimitTwo, string $delimitFirstBetween, string $delimitNextBetween, string $delimitLast) : array<string|int, mixed>

Produce the near-final creator string. Check if there are plural creators.

Parameters
$bibStyle : array<string|int, mixed>
$cArray : array<string|int, mixed>
$localNameType : string
$list : string
$limit : string
$moreThan : string
$italics : bool
$abbreviation : string
$delimitTwo : string
$delimitFirstBetween : string
$delimitNextBetween : string
$delimitLast : string
Return values
array<string|int, mixed>

rewriteCreatorStrings()

Rewrite creator strings

rewriteCreatorStrings(array<string|int, mixed> $template, string $nameString, string $nameType, bool &$firstInList, bool &$rewriteCreatorBeforeDone) : array<string|int, mixed>
Parameters
$template : array<string|int, mixed>
$nameString : string
$nameType : string
$firstInList : bool
$rewriteCreatorBeforeDone : bool
Return values
array<string|int, mixed>

addCustom()

Add custom fields.

addCustom(array<string|int, mixed> $customTypes, array<string|int, mixed>|string $data, string $type, array<string|int, mixed> $items) : array<string|int, mixed>
Parameters
$customTypes : array<string|int, mixed>
$data : array<string|int, mixed>|string
$type : string
$items : array<string|int, mixed>
Return values
array<string|int, mixed>

formatRunningTime()

Format running time for audiovisual bibliography items

formatRunningTime(string $styleLocalisation, array<string|int, mixed> $bibStyle, mixed $hours, mixed $minutes, mixed $seconds, mixed $milliseconds) : string
Parameters
$styleLocalisation : string
$bibStyle : array<string|int, mixed>
$hours : mixed
$minutes : mixed
$seconds : mixed
$milliseconds : mixed
Return values
string

findAmbiguousYears()

Add year fields.

findAmbiguousYears(array<string|int, mixed> $localBibType, array<string|int, mixed> $resourceData, array<string|int, mixed> $citationData, array<string|int, mixed> $bibStyle, array<string|int, mixed> $template, string $type, array<string|int, mixed> $items) : array<string|int, mixed>

Ambiguous entires are those with the same author(s) and same publication year(s). For in-text styles, we must deal with any ambiguity and place any letter picked up in CITE.php accordingly—ambiguous entires here are ONLY when the entries come from cited text. Append the letter to the main publication year except for certain types. a) For certain types, if the second year field follows immediately on from the first year field in the template, append the letter there. NB. This assumes the template provides some conjunction between the two fields so that the result might be: 2012–2021a or 2012/2021b b) If a) is not the case for these types, append the letter to the 'resourceyearYear1' field in the template as it must match the in-text citation. c) If there is no ambiguity or this is not an in-text style, return the years unchanged.

TODO: The use of 'ambiguousTemplate' in the citation means no letter is provided — perhaps this should be looked at at some later date so that the bibliographic entries are disambiguated . . .

Parameters
$localBibType : array<string|int, mixed>
$resourceData : array<string|int, mixed>
$citationData : array<string|int, mixed>
$bibStyle : array<string|int, mixed>
$template : array<string|int, mixed>
$type : string
$items : array<string|int, mixed>
Return values
array<string|int, mixed>

addEdition()

Add any edition field

addEdition(array<string|int, mixed> $localBibType, array<string|int, mixed> $data, array<string|int, mixed> $bibStyle, string $styleLocalisation, string $type, array<string|int, mixed> $items) : array<string|int, mixed>
Parameters
$localBibType : array<string|int, mixed>
$data : array<string|int, mixed>
$bibStyle : array<string|int, mixed>
$styleLocalisation : string
$type : string
$items : array<string|int, mixed>
Return values
array<string|int, mixed>

formatEdition()

Format edition (might not be numeric)

formatEdition(mixed $edition, array<string|int, mixed> $bibStyle, string $styleLocalisation) : mixed
Parameters
$edition : mixed
$bibStyle : array<string|int, mixed>
$styleLocalisation : string

getOrdinalExtensionAlignment()

getOrdinalExtensionAlignment(mixed $alignment) : array<string|int, mixed>
Parameters
$alignment : mixed
Return values
array<string|int, mixed>

checkPartial()

Check that the first field of $template exists in $item and has a value.

checkPartial(array<string|int, mixed> $template, array<string|int, mixed> $item, bool $esDone) : array<string|int, mixed>

If it does not, and $template has a partial template array, rearrange $template

Parameters
$template : array<string|int, mixed>
$item : array<string|int, mixed>
$esDone : bool
Return values
array<string|int, mixed>

checkFallBackFields()

When using a fallback template, ensure the fields are valid for that resource type

checkFallBackFields(object|null $styleMap, array<string|int, mixed> $template, string $fallbacks, string $type) : array<string|int, mixed>
Parameters
$styleMap : object|null
$template : array<string|int, mixed>
$fallbacks : string
$type : string
Return values
array<string|int, mixed>

setCreatorRepeat()

Check against repeat creator options and amend $items if required If this is footnotes, then $newItems is also ordered correctly.

setCreatorRepeat(object $styleMap, array<string|int, mixed> $bibStyle, array<string|int, mixed> $items, array<string|int, mixed> $bibFootnoteIds, array<string|int, mixed>|bool $footnotes, array<string|int, mixed> $flags) : array<string|int, mixed>
Parameters
$styleMap : object
$bibStyle : array<string|int, mixed>
$items : array<string|int, mixed>
$bibFootnoteIds : array<string|int, mixed>
$footnotes : array<string|int, mixed>|bool
$flags : array<string|int, mixed>
Return values
array<string|int, mixed>

setCreatorRepeatEndnotes()

Check against repeat creator options and amend $items if required If this is footnotes, then $newItems is also ordered correctly.

setCreatorRepeatEndnotes(object $styleMap, array<string|int, mixed> $bibStyle, array<string|int, mixed> $items, array<string|int, mixed> $footnotes, array<string|int, mixed> $flags) : array<string|int, mixed>
Parameters
$styleMap : object
$bibStyle : array<string|int, mixed>
$items : array<string|int, mixed>
$footnotes : array<string|int, mixed>
$flags : array<string|int, mixed>
Return values
array<string|int, mixed>

mapTemplateCreatorRepeatString()

Basic map template for creator repeat string

mapTemplateCreatorRepeatString(array<string|int, mixed> $cTemplate, string $string, string $output, bool $replaceFormatting) : string
Parameters
$cTemplate : array<string|int, mixed>
$string : string
$output : string
$replaceFormatting : bool
Return values
string

settings()

Deal with various settings, setting, getting, incrementing, decrementing etc.

settings(string $method[, mixed $extra = FALSE ]) : mixed

This is a common location for this sort of thing.

Parameters
$method : string
$extra : mixed = FALSE
Tags
poaram

mixed $extra Default = FALSE

getNameString()

Get the nameString variable

getNameString(string $initialsStyle, string $firstNameInitial, string $nameStyle, string $uppercase, array<string|int, mixed> $style, array<string|int, mixed> $creator, string $localisation[, bool $citation = FALSE ][, array<string|int, mixed> $citationVars = [] ][, bool $ftUseSurname = FALSE ]) : string
Parameters
$initialsStyle : string
$firstNameInitial : string
$nameStyle : string
$uppercase : string
$style : array<string|int, mixed>
$creator : array<string|int, mixed>
$localisation : string
$citation : bool = FALSE

default = FALSE

$citationVars : array<string|int, mixed> = []

default = []

$ftUseSurname : bool = FALSE

default = FALSE

Return values
string

checkInitials()

Handle initials.

checkInitials(array<string|int, mixed> &$creator, int $initialsStyle, bool $firstNameInitial, string $localisation) : string
Parameters
$creator : array<string|int, mixed>

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 : bool
$localisation : string
Tags
see
formatNames()
Return values
string

Formatted string of initials.

hyphenatedInitials()

Deal with hyphenated firstnames as initials

hyphenatedInitials(array<string|int, mixed> $hyphenated, int $initialsStyle) : string

'Jean-Pierre' should become 'J.-P.'

Parameters
$hyphenated : array<string|int, mixed>
$initialsStyle : int
Return values
string

addCreatorDelimiters()

Add delimiters to creators

addCreatorDelimiters(array<string|int, mixed> $style, array<string|int, mixed> &$cArray, string $delimitTwo, string $delimitFirstBetween, string $delimitNextBetween, string $delimitLast) : void
Parameters
$style : array<string|int, mixed>
$cArray : array<string|int, mixed>
$delimitTwo : string
$delimitFirstBetween : string
$delimitNextBetween : string
$delimitLast : string

formatMultiplePages()

Format multiple pages.

formatMultiplePages(int $pageFormat, int|string $rangeDelimiter, string $start, string $end) : string

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

Parameters
$pageFormat : int
$rangeDelimiter : int|string
$start : string

Page start.

$end : string

Page end.

Return values
string

titleCapitalization()

Do title capitalization

titleCapitalization(string|null $pString, string $delimitLeft, string $delimitRight[, int $CondCapitalization = 1 ]) : string
Parameters
$pString : string|null

Raw title string.

$delimitLeft : string
$delimitRight : string
$CondCapitalization : int = 1

Default is 1.

Return values
string

Formatted title string.

setEtAl()

Set et al. for multiple creators

setEtAl(array<string|int, mixed> &$creators, int $limit, bool $italics, string $abbreviation) : string
Parameters
$creators : array<string|int, mixed>
$limit : int
$italics : bool
$abbreviation : string
Return values
string

findAlternates()

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

findAlternates(array<string|int, mixed> $template, array<string|int, mixed> $item) : array<string|int, mixed>
Parameters
$template : array<string|int, mixed>
$item : array<string|int, mixed>
Return values
array<string|int, mixed>

formatTitle()

Format a resource title

formatTitle(array<string|int, mixed> $resource, array<string|int, mixed> $styleCitation, string $puncPattern, string $space[, bool $trans = FALSE ]) : string
Parameters
$resource : array<string|int, mixed>
$styleCitation : array<string|int, mixed>
$puncPattern : string
$space : string
$trans : bool = FALSE

Default FALSE

Return values
string

formatShortTitle()

Format a resource shorTitle

formatShortTitle(array<string|int, mixed> $resource, array<string|int, mixed> $styleCitation[, bool $trans = FALSE ][, bool $ftUseTitle = FALSE ]) : string
Parameters
$resource : array<string|int, mixed>
$styleCitation : array<string|int, mixed>
$trans : bool = FALSE

Default FALSE

$ftUseTitle : bool = FALSE

Default FALSE

Return values
string

mapDependencies()

Deal with __DEPENDENT_ON_PREVIOUS_FIELD__ for pre and post dependent on previous field's existence and __DEPENDENT_ON_NEXT_FIELD__ for pre and post dependent on the next field's existence

mapDependencies(array<string|int, mixed> $value, bool $previousFieldExists, mixed $nextFieldExists, string $pre, string $post) : array<string|int, mixed>
Parameters
$value : array<string|int, mixed>
$previousFieldExists : bool
$nextFieldExists : mixed
$pre : string
$post : string
Return values
array<string|int, mixed>

mapTemplateIndependents()

Map independent fields of templates.

mapTemplateIndependents(array<string|int, mixed> $independent, array<string|int, mixed> &$itemArray) : void

Check for independent characters. These (should) come in pairs.

Parameters
$independent : array<string|int, mixed>
$itemArray : array<string|int, mixed>

mapTemplatePlurals()

Deal with singular/plural dependencies for fields such as pages and creators

mapTemplatePlurals(array<string|int, mixed> $value, string $pre, string $post, mixed $plurals) : array<string|int, mixed>
Parameters
$value : array<string|int, mixed>
$pre : string
$post : string
$plurals : mixed
Return values
array<string|int, mixed>

replaceWhitespace()

Replace ASCII whitespace with locale's whitespace character(s) from elements of an array Callback

replaceWhitespace(string|array<string|int, mixed> $input, string|array<string|int, mixed> $citeLocalisation) : string|array<string|int, mixed>
Parameters
$input : string|array<string|int, mixed>
$citeLocalisation : string|array<string|int, mixed>
Return values
string|array<string|int, mixed>

stripTemplateBackticks()

Strip backticks used in template

stripTemplateBackticks(string $pre, mixed $post) : array<string|int, mixed>
Parameters
$pre : string
$post : mixed
Return values
array<string|int, mixed>

ordinals()

format ordinals

ordinals(array<string|int, mixed> $matches, string $output) : string
Parameters
$matches : array<string|int, mixed>
$output : string
Return values
string

findAmbiguity()

Identify ambiguous in-text citations and references.

findAmbiguity(array<string|int, mixed> $sentences, array<string|int, mixed> $resIds, int $ambiguousAction) : array<string|int, mixed>

An ambiguous citation is one reference that has the same creator(s) and publication year(s) as another. There are three options: Do nothing (use the original templates for the citation and reference) Add a letter after the year with the original citation template (in which case the bibliographic entry must also use the letter) Use the ambiguous template for the in-text citation and no letter for the reference.

The order of the reference in the bibliography provides the ordering of the letters. The $resIds array provides this order.

Parameters
$sentences : array<string|int, mixed>
$resIds : array<string|int, mixed>
$ambiguousAction : int

(1 = letter, 2 = template)

Return values
array<string|int, mixed>

fillinPreview()

Provide empty array elements in resourceData from the adminstyle plugin's preview functions to conform with what BIBCITEGATEWAY expects.

fillinPreview(array<string|int, mixed> $resourceData) : array<string|int, mixed>
Parameters
$resourceData : array<string|int, mixed>
Return values
array<string|int, mixed>

setJustify()

Generic code for setting justification

setJustify(string $input) : string|false
Parameters
$input : string
Return values
string|false

setLineSpace()

Generic code for setting line height

setLineSpace(string $input) : string|false
Parameters
$input : string
Return values
string|false

setIndentation()

Generic code for setting indentation

setIndentation(string $input[, mixed $bq = FALSE ]) : string|false
Parameters
$input : string
$bq : mixed = FALSE
Return values
string|false

setFontSize()

Generic code for setting font size

setFontSize(string $input) : string|false
Parameters
$input : string
Return values
string|false

exportSettings()

Setters and getters for various export preferences (e.g. from word processor)

exportSettings(string $method[, mixed $extra = FALSE ]) : mixed
Parameters
$method : string
$extra : mixed = FALSE

Default = FALSE

doCitations()

Compile and add the citations to the text

doCitations(array<string|int, mixed> $sentences, array<string|int, mixed> $orderedResIds, array<string|int, mixed> $styleInfo, array<string|int, mixed> $styleCitation, array<string|int, mixed> $templates, array<string|int, mixed> $replaceInTextCitationTemplates, array<string|int, mixed> $flags, string $hyperlinkBase) : array<string|int, mixed>
Parameters
$sentences : array<string|int, mixed>
$orderedResIds : array<string|int, mixed>
$styleInfo : array<string|int, mixed>
$styleCitation : array<string|int, mixed>
$templates : array<string|int, mixed>
$replaceInTextCitationTemplates : array<string|int, mixed>
$flags : array<string|int, mixed>
$hyperlinkBase : string
Return values
array<string|int, mixed>

mapTemplate()

Map a template to the raw values and produce a basic citation for inserting into the text

mapTemplate(array<string|int, mixed> &$citation, int $cIndex, string $sentence, array<string|int, mixed> $templates, array<string|int, mixed> $styleCitation, string $citeLocalisation, array<string|int, mixed> $item) : array<string|int, mixed>
Parameters
$citation : array<string|int, mixed>
$cIndex : int
$sentence : string
$templates : array<string|int, mixed>
$styleCitation : array<string|int, mixed>
$citeLocalisation : string
$item : array<string|int, mixed>
Return values
array<string|int, mixed>

checkResourceTypeTemplate()

Some resource types have specific templates for in-text citations

checkResourceTypeTemplate(array<string|int, mixed> $citations, array<string|int, mixed> $replaceTemplates, array<string|int, mixed> $templates) : array<string|int, mixed>
Parameters
$citations : array<string|int, mixed>
$replaceTemplates : array<string|int, mixed>
$templates : array<string|int, mixed>
Return values
array<string|int, mixed>

forceAmbiguousTemplate()

Force the use of ambiguous templates overriding other templates other than subsequentCreatorTemplate

forceAmbiguousTemplate(array<string|int, mixed> $citations) : array<string|int, mixed>
Parameters
$citations : array<string|int, mixed>
Return values
array<string|int, mixed>

checkSubsequentCreatorTemplate()

Confirm (or not) that a subsequentCreatorTemplate designation is correct.

checkSubsequentCreatorTemplate(array<string|int, mixed> $styleCitation, mixed $sentence) : array<string|int, mixed>

$styleCitation['subsequentCreatorRange'] == 0 // Entire text $styleCitation['subsequentCreatorRange'] == 1 // Paragraph $styleCitation['subsequentCreatorRange'] == 2 // Section

Parameters
$styleCitation : array<string|int, mixed>
$sentence : mixed
Return values
array<string|int, mixed>

citationPosition()

Find required position of citation in sentence. Not all requests are possible so drop through three levels . . . Be careful! 0 => "Unchanged" 1 => "After previous creator name(s)" 2 => "After previous quotation" 3 => "Before end of sentence" 4 => "After end of sentence" 5 => "Before next soft punctuation" 6 => "After next soft punctuation"

citationPosition(array<string|int, mixed> $styleCitation, string $citeLocalisation, array<string|int, mixed> $citations, string &$sentence) : array<string|int, mixed>

NB positions 0, 3 and 4 are final destinations that if provided, preclude all later options

Parameters
$styleCitation : array<string|int, mixed>
$citeLocalisation : string
$citations : array<string|int, mixed>
$sentence : string
Return values
array<string|int, mixed>

checkConsecutiveCitations()

For multiple citations that are repositioned after soft or hard punctuation, mark them as consecutive citations.

checkConsecutiveCitations(array<string|int, mixed> $sentence, int $citationStyle) : array<string|int, mixed>
Parameters
$sentence : array<string|int, mixed>
$citationStyle : int
Return values
array<string|int, mixed>

checkFollowCreatorTemplate()

Confirm (or not) that a followCreatorTemplate designation is correct (in-text citations).

checkFollowCreatorTemplate(array<string|int, mixed> $styleCitation, array<string|int, mixed> $citations) : array<string|int, mixed>
Parameters
$styleCitation : array<string|int, mixed>
$citations : array<string|int, mixed>
Return values
array<string|int, mixed>

checkConsecutiveCreatorTemplate()

Confirm (or not) that a consecutiveCreatorTemplate designation is correct (in-text citations).

checkConsecutiveCreatorTemplate(array<string|int, mixed> $citations) : array<string|int, mixed>
Parameters
$citations : array<string|int, mixed>
Return values
array<string|int, mixed>

formatCitation()

Format the citation

formatCitation(array<string|int, mixed> $citation, int $cIndex, array<string|int, mixed> $styleCitation, mixed $itemArray, array<string|int, mixed> $flags, string $hyperlinkBase) : array<string|int, mixed>
Parameters
$citation : array<string|int, mixed>
$cIndex : int
$styleCitation : array<string|int, mixed>
$itemArray : mixed
$flags : array<string|int, mixed>
$hyperlinkBase : string
Return values
array<string|int, mixed>

hyperlinkCitation()

Hyperlink the citation text

hyperlinkCitation(mixed &$citeText, int $id, string $hyperlinkBase) : void
Parameters
$citeText : mixed
$id : int
$hyperlinkBase : string

citationWrapping()

Format citation with wrapping characters taking account of consecutive citation runs and their delimiting characters

citationWrapping(array<string|int, mixed> $styleCitation, array<string|int, mixed> $citation, string $citeText, string $pageSplit, string $output) : array<string|int, mixed>
Parameters
$styleCitation : array<string|int, mixed>
$citation : array<string|int, mixed>
$citeText : string
$pageSplit : string
$output : string
Return values
array<string|int, mixed>

trueFootnoteWrapping()

Wrapping of true footnotes in the text — only used for endInc, endSameId, and endSameIdOrdered

trueFootnoteWrapping(array<string|int, mixed> $styleCitation, array<string|int, mixed> $citation, string $citeText, array<string|int, mixed> $flags) : string
Parameters
$styleCitation : array<string|int, mixed>
$citation : array<string|int, mixed>
$citeText : string
$flags : array<string|int, mixed>
Return values
string

formatSentence()

Format the sentence with each citation obeying required positions.

formatSentence(array<string|int, mixed> $citation, int $cIndex, string $sentence, array<string|int, mixed> $styleCitation, string $citeLocalisation, mixed $citeText, bool $pageSplit, bool $isConsecutive, array<string|int, mixed> $flags) : string
Parameters
$citation : array<string|int, mixed>
$cIndex : int
$sentence : string
$styleCitation : array<string|int, mixed>
$citeLocalisation : string
$citeText : mixed
$pageSplit : bool
$isConsecutive : bool
$flags : array<string|int, mixed>
Return values
string

positionCitationInSentence()

Position citations in the sentence.

positionCitationInSentence(string $sentence, array<string|int, mixed> $citeTexts, array<string|int, mixed> $patterns, array<string|int, mixed> $hardPuncs, string $space) : array<string|int, mixed>

The array $hardPuncs contains bools. If TRUE, the $hardPunc pattern is part of the search pattern. This encodes whatever the hard punctuation was and thus might include concluding space characters. If we don't want a space before the citation, these space characters must be placed after the citation. The matching array element from $citeTexts must be an array. If the elements of this array are integers, they refer to elements of the callback's $matches array

Parameters
$sentence : string
$citeTexts : array<string|int, mixed>
$patterns : array<string|int, mixed>
$hardPuncs : array<string|int, mixed>
$space : string
Return values
array<string|int, mixed>

doPageSplit()

Check if a citation page should indeed be split and deal with dependencies.

doPageSplit(array<string|int, mixed> &$styleCitation, array<string|int, mixed> &$citation, string &$pre, string &$post) : void

Splitting only occurs if the cited creator's name(s) is in the sentence.

Deal with DEPENDENT_ON_PREVIOUS_FIELD for characters dependent on previous field's existence and DEPENDENT_ON_NEXT_FIELD for characters dependent on the next field's existence

Parameters
$styleCitation : array<string|int, mixed>
$citation : array<string|int, mixed>
$pre : string
$post : string

mapTemplateTidyYears()

Do some pre-processing of various year fields in the template

mapTemplateTidyYears(array<string|int, mixed> $template, array<string|int, mixed> $item) : array<string|int, mixed>
Parameters
$template : array<string|int, mixed>
$item : array<string|int, mixed>
Return values
array<string|int, mixed>

formatPages()

Format pages.

formatPages(array<string|int, mixed> $styleCitation, string $pages, array<string|int, mixed> &$item[, bool $footnotes = FALSE ][, string $field = 'pages' ]) : void

If $footnotes is TRUE, these are pages for short footnotes

Parameters
$styleCitation : array<string|int, mixed>
$pages : string
$item : array<string|int, mixed>
$footnotes : bool = FALSE

Default FALSE

$field : string = 'pages'

Default 'pages'

formatCreators()

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

formatCreators(array<string|int, mixed> $creators, array<string|int, mixed> $styleCitation, string $citeLocalisation, array<string|int, mixed> &$item, array<string|int, mixed> $resIds, int $resId) : void
Parameters
$creators : array<string|int, mixed>

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'))
$styleCitation : array<string|int, mixed>
$citeLocalisation : string
$item : array<string|int, mixed>
$resIds : array<string|int, mixed>
$resId : int

replacementYears()

Add replacement years fields to templates

replacementYears(string $template, array<string|int, mixed> $style, STYLEMAP $styleMap) : array<string|int, mixed>
Parameters
$template : string
$style : array<string|int, mixed>
$styleMap : STYLEMAP
Return values
array<string|int, mixed>

copyYearAlternates()

Copy any alternates relating to pre and post fields from the 'year' field to 'year1' and 'year2' fields

copyYearAlternates(string $yearField, array<string|int, mixed> &$newTemplate) : void
Parameters
$yearField : string
$newTemplate : array<string|int, mixed>

parseIndependent()

Parse independent strings of new templates

parseIndependent(array<string|int, mixed> &$template) : void
Parameters
$template : array<string|int, mixed>

compileTemplates()

Compile in-text and endote-style citation templates

compileTemplates(array<string|int, mixed> $template, array<string|int, mixed> $citationFields, array<string|int, mixed> $years[, bool $freeStanding = FALSE ]) : array<string|int, mixed>
Parameters
$template : array<string|int, mixed>
$citationFields : array<string|int, mixed>
$years : array<string|int, mixed>
$freeStanding : bool = FALSE

Default FALSE

Return values
array<string|int, mixed>

addAmbiguity()

Add any ambiguity letter to year field. Only for in-text citations

addAmbiguity(array<string|int, mixed> $styleCitation, array<string|int, mixed> &$item, array<string|int, mixed> $citation) : void
Parameters
$styleCitation : array<string|int, mixed>
$item : array<string|int, mixed>
$citation : array<string|int, mixed>

formatYear()

Format years for citations

formatYear(array<string|int, mixed> $styleCitation, array<string|int, mixed> &$item, array<string|int, mixed> $resource) : void
Parameters
$styleCitation : array<string|int, mixed>
$item : array<string|int, mixed>
$resource : array<string|int, mixed>

secondYearField()

Conditionally add second year field for formatting citations (e.g. revision year, reprint year etc.)—depends on resource type

secondYearField(mixed $types, string|array<string|int, mixed> $citationYearsTemplate, array<string|int, mixed> $row) : array<string|int, mixed>
Parameters
$types : mixed
$citationYearsTemplate : string|array<string|int, mixed>
$row : array<string|int, mixed>
Return values
array<string|int, mixed>

splitIntoSentences()

Split text into sentences.

splitIntoSentences(string $citeLocalisation, string $text) : arrray

Must discount abbreviations ending in an end-of-sentence character and such characters deep within quotation marks

Parameters
$citeLocalisation : string
$text : string
Return values
arrray

Array of ordered sentences.

parseSentences()

Parse the sentences array for citations and make some initial decisions

parseSentences(string $citeLocalisation, array<string|int, mixed> $styleCitation, array<string|int, mixed> $input) : array<string|int, mixed>
Parameters
$citeLocalisation : string
$styleCitation : array<string|int, mixed>
$input : array<string|int, mixed>
Return values
array<string|int, mixed>

findSubsequentTemplates()

Decide if the template for this citation should be the subsequentCreatorTemplate or similar for endnote styles.

findSubsequentTemplates(array<string|int, mixed> $styleCitation, string $sentence, null &$templateField, array<string|int, mixed> $resIds, int $resId, int $resIdsIndex, string $currentPages, string $previousPages) : void

We don't have all information yet to make further decisions (e.g., creator's name).

Parameters
$styleCitation : array<string|int, mixed>
$sentence : string
$templateField : null
$resIds : array<string|int, mixed>
$resId : int
$resIdsIndex : int
$currentPages : string
$previousPages : string

findFollowCreatorTemplate()

Find cases for followCreatorTemplate and mark position after creator's name.

findFollowCreatorTemplate(string $citeLocalisation, array<string|int, mixed> $styleCitation, array<string|int, mixed> $sentenceArray, int $citationKey, array<string|int, mixed> $previousCPatterns) : array<string|int, mixed>

If an author has already been found by a previous citation in the sentence, do not mark the position for this citation. We check by comparing this $cPattern with previous ones in this sentence.

Parameters
$citeLocalisation : string
$styleCitation : array<string|int, mixed>
$sentenceArray : array<string|int, mixed>
$citationKey : int
$previousCPatterns : array<string|int, mixed>
Return values
array<string|int, mixed>

getCPattern()

Create the preg pattern for finding a citation's creator names in the same sentence.

getCPattern(array<string|int, mixed> $creators, string $citeLocalisation, string $cInitialPunc, string $spaceRaw, string $space) : array<string|int, mixed>
Parameters
$creators : array<string|int, mixed>
$citeLocalisation : string
$cInitialPunc : string
$spaceRaw : string
$space : string
Return values
array<string|int, mixed>

[$cPattern, $puncTrim]

tidySentences()

end-of-sentence characters have been captured in $split's array elements. These must be appended to the previous part sentence.

tidySentences(string $citeLocalisation, array<string|int, mixed> $split, array<string|int, mixed> $puncs) : array<string|int, mixed>
Parameters
$citeLocalisation : string
$split : array<string|int, mixed>
$puncs : array<string|int, mixed>
Return values
array<string|int, mixed>

quotationCitationIndex()

Add the citation index to relevant quotations.

quotationCitationIndex(string $citeLocalisation, array<string|int, mixed> $sentences) : array<string|int, mixed>
Parameters
$citeLocalisation : string
$sentences : array<string|int, mixed>
Return values
array<string|int, mixed>

tidySentencesEndQuote()

Ensure hard punctuation just before a quotation end marker is treated as marking the end of a complete sentence.

tidySentencesEndQuote(string $citeLocalisation, array<string|int, mixed> $sentences, array<string|int, mixed> $quotes, array<string|int, mixed> $puncs) : array<string|int, mixed>
Parameters
$citeLocalisation : string
$sentences : array<string|int, mixed>
$quotes : array<string|int, mixed>
$puncs : array<string|int, mixed>
Return values
array<string|int, mixed>

findSpecialQuotes()

Find special quotes such as dialogue and nested quotes—mark them and protect contents of nested quotes

findSpecialQuotes(string $text, array<string|int, mixed> $quotes, array<string|int, mixed> $apostrophes, string $space) : string
Parameters
$text : string
$quotes : array<string|int, mixed>
$apostrophes : array<string|int, mixed>
$space : string
Return values
string

findDialogueQuotes()

Find dialogue quotes and mark them.

findDialogueQuotes(mixed $para, string $qStart, string $qEnd, string $apos1, string $apos2) : string

First use the split paragraphs in attempt to find dialogue quotes (odd numbers of quotation marks in each paragraph indicate dialogue). Need to ensure we don't count quote characters that function as apostrophe or possessive. Need mark only the start and continuation of such a pattern leaving quote marks in between. The pattern might be:

Here begins "some dialogue." Mark said “Stéphane!"

// paragraph with odd number of marks. The last marks the start.

“What?” said Stéphane. “Go away. . .

// paragraph with odd number of marks.

“OK” said Mark.

// First subsequent paragraph with even number of marks.

Could also be:

Here begins "some dialogue." Mark said “Stéphane!

// paragraph with odd number of marks. The last marks the start.

“What?” said Stéphane. “Go away. . .

// paragraph with odd number of marks.

“OK.”

// First subsequent paragraph with even number of marks. . . . and other variations . . .

Parameters
$para : mixed
$qStart : string
$qEnd : string
$apos1 : string
$apos2 : string
Return values
string

findNestedQuotes()

Find and mark nested quotations.

findNestedQuotes(string $text, string $qStart, string $qEnd, string $quoteProtection, string $apos2, string $space) : string
Parameters
$text : string
$qStart : string
$qEnd : string
$quoteProtection : string
$apos2 : string
$space : string
Return values
string

findQuotes()

Mark quotations and protect their content (in case the content has hard punctuation).

findQuotes(string $text, string $citeLocalisation, string $space) : string

We also find the number of qords in long quotations and mark the text as blockquote if required. If doing this, we also need to ensure that any punctuation immediately following is part of the blockquote plus any citation or footnote.

Parameters
$text : string
$citeLocalisation : string
$space : string
Return values
string

blockQuote1()

Mark blockquotes.

blockQuote1(array<string|int, mixed> $matches) : string

This is only used when exporting a document (e.g., from the word processor)

Parameters
$matches : array<string|int, mixed>

return string

Return values
string

blockQuote2()

Format blockquotes and ensure tailend bits are part of it.

blockQuote2(string $text, string $citeLocalisation, string $space) : string

This is only used when exporting a document (e.g., from the word processor) We use

because of the indent options available to the user

Parameters
$text : string
$citeLocalisation : string
$space : string

return string

Return values
string

blockQuoteSort()

Sort the blockQuote array by length so that the preg_replace works as expected

blockQuoteSort(string $a, string $b) : string
Parameters
$a : string
$b : string
Return values
string

findEllipses()

Mark ellipses and protect their content (in case the content has hard punctuation).

findEllipses(string $text, string $citeLocalisation, string $space) : string
Parameters
$text : string
$citeLocalisation : string
$space : string
Return values
string

findTitle()

Find and note existence of title and short title in sentences

findTitle(array<string|int, mixed> $sentences) : array<string|int, mixed>
Parameters
$sentences : array<string|int, mixed>
Return values
array<string|int, mixed>

tidyInputText()

Preliminary tidying of input text.

tidyInputText(string $text, string $citeLocalisation, string $space) : string

Text from TinyMce can be a complete mess . . . For example: "[cite]201:101[/cite]. Here is an initial citation [cite]100:252-253[/cite] that has page numbers. Yet another quote from the same source with a different page number is: "Bløh, bløh, bløh"[cite]46:65-66[/cite].

Here's a new paragraph with a subsequent citation [cite]46:71[/cite]. And again [cite]46:99[/cite]. Here, [cite]101[/cite], is a work by one author who also, [cite]101[/cite], in the 44th. year, wrote this ambiguous tome stating: "yet more blah, blah, blah" [cite]100:133[/cite]. Again, a citation with multiple authors, a publication year, and a page number: "We were 'worked' like slaves" says [cite]111:41[/cite], and another with no creator [cite]99[/cite]. Try this: "A quotation. Here we go again. Third part of quotation ?" A "quotation . . . with ellipses !" So . . . here. . . . and....there... again… ? Finally. . . . it's working!

A web citation: [cite]357[/cite].

Another paragraph with a citation that has no creators[cite]1172[/cite]. "But I'll be back."

New paragraph.

I say "blah blah" [cite]515[/cite][cite]535[/cite] something.

A sentence with a citation [cite]515[/cite] and then another [cite]535[/cite] that follows.

Problems here include:

  1. No paragraph start at beginning of sentence (but there could be).
  2. Use of

    for a new paragraph mixed with use of

    ...

User input practices can vary. For example, variable number of spaces (or none) before the [cite] tag. These must be removed as the citation style dictates if there should be a space before citations or not.

Note that tinyMCE appears to do its own tidying up—not always successfully! For example, resource metadata that, in the editor's HTML view, looks like:

I say "blah blah"[cite]515[/cite][cite]535[/cite] something.

A sentence with a citation[cite]515[/cite] and then another[cite]535[/cite] that follows.

might be returned by tinyMCE as:

I say "blah blah"[cite]515[/cite][cite]535[/cite] something.

A sentence with a citation[cite]515[/cite] and then another[cite]535[/cite] that follows.

There is a missing paragraph end at the end of the first sentence—this must be dealt with.

The sentences and paragraphs need to be normalized before starting the citation parsing in such a way that the resultant text does not differ (too much) from the original but that the citation parsing can do its job. The above example should end up as:

"

[cite]201:101[/cite]. Here is an initial citation[cite]100:252-253[/cite] that has page numbers. Yet another quote from the same source with a different page number is: "Bløh, bløh, bløh"[cite]46:65-66[/cite].

Here's a new paragraph with a subsequent citation[cite]46:71[/cite]. And again[cite]46:99[/cite]. Here,[cite]101[/cite], is a work by one author who also,[cite]101[/cite], in the 44th. year, wrote this ambiguous tome stating: "yet more blah, blah, blah"[cite]100:133[/cite]. Again, a citation with multiple authors, a publication year, and a page number: "We were 'worked' like slaves" says[cite]111:41[/cite], and another with no creator[cite]99[/cite]. Try this: "A quotation. Here we go again. Third part of quotation ?" A "quotation . . . with ellipses !" So . . . here. . . . and....there... again… ? Finally. . . . it's working!

A web citation:[cite]357[/cite].

Another paragraph with a citation that has no creators[cite]1172[/cite]. "But I'll be back."

New paragraph.

I say "blah blah"[cite]515[/cite][cite]535[/cite] something.

A sentence with a citation[cite]515[/cite] and then another[cite]535[/cite] that follows.

before then replacing paragraph tags and passing onto the citation parser.

Parameters
$text : string
$citeLocalisation : string
$space : string
Return values
string

reconstituteBlockquote()

Reconsitute blockquote

reconstituteBlockquote(string $newText, array<string|int, mixed> $quotes) : string
Parameters
$newText : string
$quotes : array<string|int, mixed>
Return values
string

reconstituteQuote()

Reconsitute quotation

reconstituteQuote(string $newText, array<string|int, mixed> $quotes[, bool $keepQuoteMarks = TRUE ]) : string
Parameters
$newText : string
$quotes : array<string|int, mixed>
$keepQuoteMarks : bool = TRUE

Default = TRUE

Return values
string

reconstituteQuoteCallback()

Reconsitute quotation callback

reconstituteQuoteCallback(array<string|int, mixed> $matches, string $qStart, string $qEnd, bool $keepQuoteMarks) : string
Parameters
$matches : array<string|int, mixed>
$qStart : string
$qEnd : string
$keepQuoteMarks : bool
Return values
string

reconstituteText()

Return sentence temporary markup to original

reconstituteText(string $newText, string $citeLocalisation, array<string|int, mixed> $flags, array<string|int, mixed> $quotes) : string
Parameters
$newText : string
$citeLocalisation : string
$flags : array<string|int, mixed>
$quotes : array<string|int, mixed>
Return values
string

debugPrint()

Print an array prettily for debugging purposes

debugPrint(array<string|int, mixed> $array) : void
Parameters
$array : array<string|int, mixed>

getType()

Return an array containing the most used grammar types of a locale

getType([string $locale = "en" ][, string $type = "" ]) : array<string|int, string>

When grammar type is not defined for a locale, the grammar type of the language is used, and in last resort the grammar type of 'en'.

'en' is not 'en_GB' but a generic/default form using typical English grammar types (e.g., " and " as quotes). It must exist in the array.

Parameters
$locale : string = "en"

Code of a locale (format: ll[_Script][_CC])(optional, 'en' by default)

$type : string = ""

Grammar type ('' by default). One of: 'quotation', 'hardPunctuation', 'softPunctuation', 'allPunctuation', 'abbreviations', 'numbers', 'ellipses', 'possessives', 'etAl', 'creatorConjunctions', 'wordSpace', 'apostrophe', 'initialPunctuation', 'numberConjunctions'

Tags
see
https://github.com/unicode-org/cldr/tree/main/common/main

CLDR Unicode Database

see
https://en.wikipedia.org/wiki/Quotation_mark
see
https://op.europa.eu/en/web/eu-vocabularies/formex/physical-specifications/character-encoding/use-of-quotation-marks-in-the-different-languages
Return values
array<string|int, string>

[0 => "", 1 => ""] Where the value of 0 is the starting quotation and 1 is the ending quotation

compileQuotationMarkers()

Return array of quotation markers for each locale.

compileQuotationMarkers() : array<string|int, mixed>

'en' must be a key of the returned array.

If a language does not use it, put in an empty array or else the 'en' array will be used by default.

The first member of the array opens the quotation, the second member closes it.

Some languages have alternate quote marks (se 'da' below for an example). Ensure there are an even number of elements in the array.

Tags
todo

Check locale validity with later versions of Intl

see
https://en.wikipedia.org/wiki/Quotation_mark
see
https://op.europa.eu/en/web/eu-vocabularies/formex/physical-specifications/character-encoding/use-of-quotation-marks-in-the-different-languages
Return values
array<string|int, mixed>

compileHardPunctuation()

Return array of hard punctuation (END of sentence only) for each locale.

compileHardPunctuation() : array<string|int, mixed>

'en' must be a key of the returned array.

If a language does not use it, put in an empty array or else the 'en' array will be used by default.

Spaces around punctuation must be present if required. Space characters here are assumed to be the same as those entered for compileWordSpace() below.

Return values
array<string|int, mixed>

compileSoftPunctuation()

Return array of soft punctuation (within sentence) for each locale.

compileSoftPunctuation() : array<string|int, mixed>

'en' must be a key of the returned array.

If a language does not use it, put in an empty array or else the 'en' array will be used by default.

Spaces around punctuation must be present if required. Space characters here are assumed to be the same as those entered for compileWordSpace() below.

Used for finding creator names in sentences—see compileCreatorConjunctions()

Return values
array<string|int, mixed>

compileAllPunctuation()

Return array of all hard and soft punctuation.

compileAllPunctuation() : array<string|int, mixed>

Used when compiling bibliographies and deciding whether to remove the title-subtitle conjunction (removed if title is closed with punctuation).

Return values
array<string|int, mixed>

compileAbbreviations()

Return array of abbreviations for each locale.

compileAbbreviations() : array<string|int, mixed>

'en' must be a key of the returned array.

If a language does not use it, put in an empty array or else the 'en' array will be used by default.

This is not necessarily an exhaustive list for each language.

———> The point is to avoid a false end of sentence <——— Only abbreviations with a locale-specific, end-of-sentence character at the end should be listed (see compileHardPunctuation() for each locale). –––> Do NOT add this final end-of-sentence character. <–––

Abbreviations are case sensitive so give all possible forms.

Common (Latin) bibliographic abbreviations are appended to each locale.

Abbreviation arrays are used to distinguish false sentence endings (abbreviations) from real sentence endings.

Abbreviations such as U.S.A. etc. are dealt with in the code.

Return values
array<string|int, mixed>

compileNumbers()

Return array of number abbreviations (ordinals and measurements) for each locale.

compileNumbers() : array<string|int, mixed>

'en' must be a key of the returned array.

If a language does not use it, put in an empty array or else the 'en' array will be used by default.

In English, an ordinal would be '2nd.', '44th.' etc. The '.' is a false end-of-sentence character. You can also add abbreviations following a number where there is no space inbetween (e.g., units such as weight, measurement, time). These can also be listed in abbreviations above but there a space is inserted in the code before the abbreviation. It is probably safest to have the number abbreviation duplicated in abbreviations.

Anything listed here is assumed to have a cardinal/digit before it (checked in regexp with '\d?') and no intervening space.

———> The point is to avoid a false end of sentence <——— Only abbreviations with a locale-specific, end-of-sentence character at the end should be listed (see compileHardPunctuation() for each locale). –––> Do NOT add this final end-of-sentence character. <–––

Abbreviations are case sensitive so give all possible forms.

Tags
see
https://en.wikipedia.org/wiki/Imperial_units
see
https://en.wikipedia.org/wiki/United_States_customary_units
see
https://en.wikipedia.org/wiki/Metrication
see
https://en.wikipedia.org/wiki/International_System_of_Units
see
https://www.ramat.ca/

Ramat, A., & Benoit, A.-M. (2020). Le ramat de la typographie. 11th ed. Québec: Anne-Marie Benoit éditrice. (Original work published 2017).

Return values
array<string|int, mixed>

compileEllipses()

Return array of ellipses for each locale.

compileEllipses() : array<string|int, mixed>

'en' must be a key of the returned array.

If a language does not use it, put in an empty array or else the 'en' array will be used by default.

Needs listing ONLY if the ellipses contain hard punctuation for the locale. NB Necessary to order by size so that longer strings end up in the regexp as the first matches tried. Particularly important if using similar characters as in English.

Tags
see
https://en.wikipedia.org/wiki/Ellipsis
Return values
array<string|int, mixed>

compilePossessives()

Return array of possessives for each locale.

compilePossessives() : array<string|int, string>

'en' must be a key of the returned array.

If a language does not use it, put in an empty array or else the 'en' array will be used by default.

When using the word processor, how is the possessive defined. This is only for a single creator's surname (or following values from the etAll array below) and is used to detect if that name is in the same sentence as the citation (e.g., "Grimshaw's", "Jones'", "and colleagues'"). English has two forms (singular or plural/words that end in 's').

Tags
see
https://en.wikipedia.org/wiki/Possessive#From_nouns
see
https://wals.info/chapter/57
Return values
array<string|int, string>

compileEtAl()

Return array of et al. possibilities for each locale.

compileEtAl() : array<string|int, mixed>

'en' must be a key of the returned array.

If a language does not use it, put in an empty array or else the 'en' array will be used by default.

This is used only for checking the occurrence of creator names in a sentence (e.g., 'Grimshaw et al.', 'Jones and colleagues'). It relates to repositioning of the citation after the creator's name. Each locale should list common abbreviations for multiple creator names.

Add spaces to ONLY the start of the phrase if required. Space characters here are assumed to be the same as those entered for compileWordSpace() below.

Return values
array<string|int, mixed>

compileCreatorConjunctions()

Return array of creator conjunction possibilities for each locale.

compileCreatorConjunctions() : array<string|int, mixed>

'en' must be a key of the returned array.

If a language does not use it, put in an empty array or else the 'en' array will be used by default.

This is used only for checking the occurrence of creator names in a sentence. An example would be 'Grimshaw, Grimshaw-Aagaard & Aulery claim that . . .' where '&' is the conjunction. Checking for the ',' is done through compileSoftPunctuation().

It relates to repositioning of the citation after the creator's name. Each locale should list common conjunctions between multiple creator names.

Add spaces to either or both sides of the phrase if required. Space characters here are assumed to be the same as those entered for compileWordSpace() below.

Return values
array<string|int, mixed>

compileWordSpace()

Return array of word space characters for each locale.

compileWordSpace() : array<string|int, mixed>

'en' must be a key of the returned array.

If a language does not use it, put in an empty array element thus [""] or else the 'en' array will be used by default.

This is used in regexps for identifying potential gaps between words that a language might have. As the regexps are UTF-8-safe, you can use not only multiple characters but also multibyte characters here.

Each array should have only ONE element.

Word space characters here are assumed to be the same as those entered in other functions here where it is indicated they might be required either side of the characters being entered.

Note, that if your language uses the same word space character as the English 'en' locale, then you need not add your locale here as the 'en' character will be used.

Return values
array<string|int, mixed>

compileApostrophe()

Return array of apostophe for each locale (e.g., in English the "'" of "it's" (short for "it is")

compileApostrophe() : array<string|int, mixed>

'en' must be a key of the returned array.

If a language does not use it, put in an empty array element thus [""] or else the 'en' array will be used by default.

This is used in regexps for avoiding misidentification of quotation marks. You should only add a locale and apostrophe forms here (if not using the default 'en' locale) if the locale's apostrophe is the same as one of the quotation marks for that locale—see compileQuotationMarkers().

The regexp assumes an apostrophe is preceded and followed by a word character.

As the regexps are UTF-8-safe, you can use not only multiple characters but also multibyte characters here.

Note, that if your language uses the same apostrophe character as the English 'en' locale, then you need not add your locale here as the 'en' character will be used.

If you put in an empty array for your locale, no conjunctions will be used between numbers.

Return values
array<string|int, mixed>

compileInitialPunctuation()

Return array of initial punctuation for each locale.

compileInitialPunctuation() : array<string|int, mixed>

'en' must be a key of the returned array.

If a language does not use it, put in an empty array element thus [""] or else the 'en' array will be used by default.

This is used in regexps for identifying initials when part of a name (e.g. M.N. Grimshaw-Aagaard). As the regexps are UTF-8-safe, you can use not only multiple characters but also multibyte characters here.

It is also used in citation and bibliographic formatting to replace the '.' character following creator initials if a creator initial option is chosen that uses '.' (default English) while the style localisation specifies something else.

If there is no equivalent in your locale for the English character, put in an empty array element.

The first element of the 'en' array represents the character(s) between initials. For example: M. N. Grimshaw-Aagaard where periods are extracted from the 'en' array. Spaces come from compileWordSpace() above.

Each array should have only ONE element.

There should be no whitespace characters either side—the regexp takes care of this along with compileWordSpace() above.

Note, that if your language uses the same initial character as the English 'en' locale, then you need not add your locale here as the 'en' character will be used.

Return values
array<string|int, mixed>

compileNumberConjunctions()

Return array of number conjunctions for each locale.

compileNumberConjunctions() : array<string|int, mixed>

'en' must be a key of the returned array.

If a language does not use such conjunctions, put in an empty array element thus [""] or else the 'en' array will be used by default.

When presenting, for example, running time (film, TV, etc.), numbers can be conjoined by characters. For example, running time might be given as 2'45", 2:45, and so on, but these can be replaced if appropriate characters are provided for your locale and the bibliographic style localisation is set to that locale.

It is important that there be parity between the lengths of the 'en' array and another locale and across conjunction positions in the array. If there is no equivalent in your locale for the English conjunction, put in an empty array element.

For example: 2 hours, 45 minutes where comma is extracted from the 'en' array. Spaces come from compileWordSpace() above. Note that the last element has the spaces around the English word.

Note, that if your language uses the same characters as the English 'en' locale, then you need not add your locale here as the 'en' character set will be used.

Return values
array<string|int, mixed>

readComponentsList()

Read and return the list of all components installed

readComponentsList([bool $force = FALSE ]) : array<string|int, mixed>

Status of activation are kept in /data/components.json file, other data are in /cache/components.json file because the status must be be persistent between two upgrades, or a component is uninstalled. This function merges status after reading the two files.

Use only this function to read the components list.

Parameters
$force : bool = FALSE

Forces the cache overwriting if it already exists (optional, FALSE by default)

Return values
array<string|int, mixed>

writeComponentsList()

Write a list of components from an array

writeComponentsList(array<string|int, mixed> $ComponentsList) : void

Status of activation are kept in /data/components.json file, other data are in /cache/components.json file because the status must be be persistent between two upgrades, or a component is uninstalled. This function separates the status from the other fields and saves them in separate files.

Use only this function to save the components list.

Parameters
$ComponentsList : array<string|int, mixed>

Components list (with activation status)

refreshComponentsListCache()

Refresh the components list if needed, or forced by the caller

refreshComponentsListCache([bool $force = FALSE ]) : void
Parameters
$force : bool = FALSE

Forces the file overwriting if it already exists (optional, FALSE by default)

isBuiltinComponent()

Is a component builtin?

isBuiltinComponent(string $component_type, string $component_id) : bool

A builtin component is packed with the core. It can be updated and cannot be disabled or uninstalled.

Parameters
$component_type : string
$component_id : string
Return values
bool

checkComponentsList()

Return a structured list of installed components

checkComponentsList() : array<string|int, mixed>

The list is extracted form the component.json file of each component and an integrity check is performed against the component. A default activation status is computed from this minimal integrity check and the configuration read.

Return values
array<string|int, mixed>

computeComponentVersion()

Compute a component version number from the current date

computeComponentVersion() : int

The component version number is the number of days elapsed since the launch of the system of components (v6 on 2020-01-12)

Return values
int

computeComponentSignature()

Compute the hash signature of a component from its installed code

computeComponentSignature(string $component_type, string $component_id) : string

The algorithm used is defined implicitly by the WIKINDX_PACKAGE_HASH_ALGO constant.

During the hashing a temp folder is created inside cache/cmpsigning/<type_id>

Parameters
$component_type : string

(plugin, style, template)

$component_id : string
Return values
string

createComponentMetadataFile()

Create the component.json file of a component

createComponentMetadataFile(string $component_type, string $component_id) : void

Do not overwrite the file if it already exists.

Parameters
$component_type : string

(plugin, style, template)

$component_id : string

enableComponent()

Enable a component

enableComponent(string $component_type, string $component_id) : bool
Parameters
$component_type : string

(plugin, style, template)

$component_id : string
Return values
bool

TRUE on success, FALSE otherwise

disableComponent()

Disable a component

disableComponent(string $component_type, string $component_id) : bool
Parameters
$component_type : string

(plugin, style, template)

$component_id : string
Return values
bool

TRUE on success, FALSE otherwise

checkComponentIntegrity()

Check the integrity of a component

checkComponentIntegrity(string $componentDirPath) : int
Parameters
$componentDirPath : string

A path to the folder of a component

Return values
int

Error code: 0 is for OK and others issues.

componentIntegrityErrorMessage()

Return the message of an error code of the function checkComponentIntegrity()

componentIntegrityErrorMessage(int $error_code) : string
Parameters
$error_code : int
Return values
string

An error message

extractComponentPackage()

Extract a WIKINDX Component Package to a folder

extractComponentPackage(string $ComponentPackageFile, string $DestinationFolder) : bool

Only Zip packages are supported.

If missing, the destination folder is created silently. otherwise its contents is overwritten and existing files that are not in the archive are deleted.

It is not necessary to delete the files of the previous component that occupies the same destination, which limits the loss of an already installed component if the operation does not complete.

However, it is always possible to end up in an inconsistent state if the operation failed between the decompression of two files. It should be very rare.

So a component should never create files and folders in its code directories otherwise they will be deleted. Use the private cache and data folders of a component for this task.*

BUGS: https://bugs.php.net/bug.php?id=79912 Phar crashs with an exception on Gzip/Bzip2 archives

Parameters
$ComponentPackageFile : string

Absolute or relative path to an archive file created with \FILE\createComponentPackage

$DestinationFolder : string

Absolute or relative path of a folder where the archive is extracted

Return values
bool

TRUE on success, FALSE otherwise

extractComponentPackageDefinition()

Extract the component.json file of a WIKINDX Component Package to an array

extractComponentPackageDefinition(string $ComponentPackageFile) : array<string|int, mixed>

Only Zip packages are supported.

The component.json file is read in memory before parsing.

Parameters
$ComponentPackageFile : string

Absolute or relative path to an archive file created with \FILE\createComponentPackage

Return values
array<string|int, mixed>

Structured definition of the component

listPluginComponents()

List all plugins enabled in WIKINDX_DIR_COMPONENT_PLUGINS with a sane configuration

listPluginComponents([bool $all = FALSE ]) : array<string|int, mixed>
Parameters
$all : bool = FALSE

If TRUE, lists also disabled components

Return values
array<string|int, mixed>

Sorted associative array - keys = component_id, values = component_longname.

listStyleComponents()

List all styles enabled in WIKINDX_DIR_COMPONENT_STYLES with a sane configuration

listStyleComponents([bool $all = FALSE ]) : array<string|int, mixed>
Parameters
$all : bool = FALSE

If TRUE, lists also disabled components

Return values
array<string|int, mixed>

Sorted associative array - keys = component_id, values = component_longname.

listTemplateComponents()

List all templates enabled in WIKINDX_DIR_COMPONENT_TEMPLATES with a sane configuration

listTemplateComponents([bool $all = FALSE ]) : array<string|int, mixed>
Parameters
$all : bool = FALSE

If TRUE, lists also disabled components

Return values
array<string|int, mixed>

checkPluginVersionCompatibility()

Check version compatibility of a plugin

checkPluginVersionCompatibility(string $dir) : bool
Parameters
$dir : string
Return values
bool

loadStyleInfo()

Extract info entries from a JSON bibliographic style file and return an associative array of childnode's value of 'info' node.

loadStyleInfo(string $file) : associative
Parameters
$file : string

Location of a StyleFile

Return values
associative

array - keys = name, description, styleLocalisation, citeLocalisation, osbibversion

format()

Format for HTML or RTF/plain?

format(string $data, string $outputFormat[, int|false $citeId = FALSE ][, int|false $bibId = FALSE ]) : string
Parameters
$data : string

Input string

$outputFormat : string

One of 'wikindx', 'html', 'cite', 'wp', 'plain', 'rtf'

$citeId : int|false = FALSE

Default FALSE (Only present and used if formatting a citation for 'wikindx' or 'html' output)

$bibId : int|false = FALSE

Default FALSE (Only present and used if formatting a bibliography reference for 'wikindx' or 'html' output)

Return values
string

bbcode()

Deal with BBCODE

bbcode(string $data, string $outputFormat) : string
Parameters
$data : string
$outputFormat : string
Return values
string

endnoteId()

Format the endnote ID in the endnotes

endnoteId(array<string|int, mixed> $citationStyle, int $id, string $outputFormat) : string
Parameters
$citationStyle : array<string|int, mixed>
$id : int
$outputFormat : string
Return values
string

trueFootnoteId()

Format the true footnote ID in the footnotes section

trueFootnoteId(array<string|int, mixed> $citationStyle, int $id, string $outputFormat) : string
Parameters
$citationStyle : array<string|int, mixed>
$id : int
$outputFormat : string
Return values
string

newline()

Return a newline character.

newline(string $outputFormat) : string

Also, bibliographic/footnote templates may have the special string 'NEWLINE'

Parameters
$outputFormat : string
Return values
string

setHeaders()

Set download headers

setHeaders(string $type, int $size, string $filename, string $lastmodified[, string $mode = 'inline' ][, string $charset = '' ]) : void
Parameters
$type : string
$size : int
$filename : string
$lastmodified : string
$mode : string = 'inline'

'inline' or 'attachment' ('attachment' forces the download)

$charset : string = ''

Default is ''

readfile_chunked()

Download file to user

readfile_chunked(string $file) : bool

From http://uk3.php.net/function.readfile

Parameters
$file : string
Return values
bool

createFileName()

create a fileName for this file. If directory based on session ID does not exist, create it.

createFileName(string $dirName, string $string, string $extension) : array<string|int, mixed>
Parameters
$dirName : string
$string : string

File contents

$extension : string

File extension

Return values
array<string|int, mixed>

(filename, full filepath)

fileAttachUploadMaxSize()

Get attachment max upload size in bytes

fileAttachUploadMaxSize() : int

WIKINDX_FILE_ATTACH_SIZE_UPPER_LIMIT is the upper limit

Return values
int

imageUploadMaxSize()

Get image max upload size in bytes

imageUploadMaxSize() : int

WIKINDX_IMG_SIZE_UPPER_LIMIT is the upper limit

Return values
int

fileUploadMaxSize()

Get file max upload size in bytes

fileUploadMaxSize() : int

1G is the upper limit

Return values
int

return_bytes()

Convert some ini values to numerical values (to bytes)

return_bytes(int|string $val) : int
Parameters
$val : int|string
Return values
int

dirToArray()

Enumerate files and subdirectories of a directory except . and .. subdirectories

dirToArray(string $dir) : array<string|int, mixed>
Parameters
$dir : string

A directory to explore

Return values
array<string|int, mixed>

An array of file and subdirectory names

dirInDirToArray()

Enumerate subdirectories of a directory except . and .. subdirectories

dirInDirToArray(string $dir) : array<string|int, mixed>
Parameters
$dir : string

A directory to explore

Return values
array<string|int, mixed>

An array of subdirectory names

fileInDirToArray()

Enumerate files of a directory except . and .. subdirectories

fileInDirToArray(string $dir) : array<string|int, mixed>
Parameters
$dir : string

A directory to explore

Return values
array<string|int, mixed>

An array of filenames

recurse_AbsoluteDirToArray()

Enumerate recursively files and subdirectories of a directory except . and .. subdirectories

recurse_AbsoluteDirToArray(string $dir) : array<string|int, mixed>
Parameters
$dir : string

A directory to explore

Return values
array<string|int, mixed>

An array of file and subdirectory absolute paths

recurse_fileInDirToArray()

Enumerate recursively files and subdirectories of a directory except . and .. subdirectories

recurse_fileInDirToArray(string $dir) : array<string|int, mixed>
Parameters
$dir : string

A directory to explore

Return values
array<string|int, mixed>

An array of file and subdirectory paths

recurse_dir_copy()

Copy recursively a folder

recurse_dir_copy(string $src, string $dst) : void
Parameters
$src : string

Source directory

$dst : string

Destination directory

recurse_rmdir()

Remove recursively a folder

recurse_rmdir(string $dir) : void
Parameters
$dir : string

Target directory

rmfile()

Remove a file

rmfile(string $file) : void
Parameters
$file : string

Target filename

fileUpload()

Return filename, hash, type and size of an uploaded file or an array of such information for each file uploaded

fileUpload([false|string $filename = FALSE ][, bool $multiple = FALSE ]) : array<string|int, mixed>
Parameters
$filename : false|string = FALSE
$multiple : bool = FALSE

multiple files (default FALSE)

Return values
array<string|int, mixed>

(filename, hash, type, size) or array of these

rearrangeFilesArray()

Rearrange the $_FILES array for multiple file uploads

rearrangeFilesArray(array<string|int, mixed> $files) : array<string|int, mixed>
Parameters
$files : array<string|int, mixed>
Return values
array<string|int, mixed>

fileStore()

Store uploaded file in given directory with given name

fileStore(string $dirName, string $name[, int|false $index = FALSE ]) : bool
Parameters
$dirName : string
$name : string
$index : int|false = FALSE

if moving multiple file uploads

Return values
bool

listFiles()

list and HTML format all files for sessionID

listFiles() : array<string|int, mixed>
Return values
array<string|int, mixed>

(filesDir, fileDeleteSecs, fileArray)

tidyFiles()

tidy up the files directory by removing all files and folders older than WIKINDX_FILE_DELETE_SECONDS

tidyFiles() : void

zip()

Zip up an array of files. File is stored in files dir.

zip(array<string|int, mixed> $files, string $dirpath) : mixed
Parameters
$files : array<string|int, mixed>

unqualified filenames (key is label of file, value is filename on disk)

$dirpath : string

directory path

Return values
mixed

unqualified SHA1'ed filename of zip or FALSE if failure

read_json_file()

Read a JSON file to a data structure

read_json_file(string $file) : mixed

Read a JSON file and unserialize its content to a data structure with json_decode()

Parameters
$file : string

An absolute or relative path to a file

Tags
see
https://www.php.net/manual/en/function.json-decode.php
Return values
mixed

A value, a data structure, or NULL on error

write_json_file()

Write a data structure to a JSON file

write_json_file(string $file, mixed $data) : int

Serialize a data structure with json_encode() and write it in a file

Parameters
$file : string

An absolute or relative path to a file

$data : mixed

A data structure or a value

Tags
see
https://www.php.net/manual/en/function.json-encode.php
Return values
int

JSON_ERROR_NONE on success, a JSON error constant on encoding error, or JSON_ERROR_NONE - 1 on file writing error

formatSize()

Format a file size in bytes to the greater multiple for display

formatSize(int $size) : string
Parameters
$size : int

In bytes

Return values
string

getMimeType()

Return the mime-type of a file

getMimeType(string $filepath[, string $altfilename = "" ]) : string

The PHP finfo() function doesn't always return the right mime-type, so it tries to read it from OCF containers and to fallback on file extension when the mime-type is obviously too generic (e.g. text/plain, text/xml).

You can provide an alternate filename to force the extension instead of taking the extension of filepath.

Parameters
$filepath : string

An absolute or relative file path

$altfilename : string = ""

Default is ""

Return values
string

A mime-type

getExtension()

Return the extension of a file in lowercase (without point)

getExtension(string $filepath) : string
Parameters
$filepath : string

An absolute or relative file path

Return values
string

replaceFileExtension()

Replace the extension of a file by an other

replaceFileExtension(string $filepath, string $new_extension) : string
Parameters
$filepath : string

An absolute or relative file path

$new_extension : string

New extension (without point)

Return values
string

removeFileExtension()

Remove the extension of a file path (and its point)

removeFileExtension(string $filepath) : string
Parameters
$filepath : string

An absolute or relative file path

Return values
string

bin2hex_encode_file()

Encode a file with bin2hex as an other file

bin2hex_encode_file(string $fsrc, string $fdst) : void
Parameters
$fsrc : string

An absolute or relative file path as source

$fdst : string

An absolute or relative file path as destination

hash_path()

Generates a hash of a file or directory at the given path with the specified algo.

hash_path(string $algo, string $path) : string

If the path is to a single file, it uses hash_file. Otherwise, it recursively loops through all files in a directory to generate the hash of hashes of those files.

Parameters
$algo : string
  • the hash algo
$path : string
  • the path of the folder or file
Tags
see
https://www.php.net/manual/en/function.hash-algos.php
Return values
string

_inlineHtmlAttribute()

Build a string for insertion of an HTML tag attribute.

_inlineHtmlAttribute([string $name = '' ][, mixed $value = '' ]) : string

Ensures that the attribute value is never empty (incorrect syntax)

Parameters
$name : string = ''
$value : mixed = ''

Default is ''

Return values
string

formHeader()

print form header with hidden action field

formHeader(string $action[, string $js = '' ][, bool $BT = TRUE ]) : string

$js is for javascript functions

Parameters
$action : string
$js : string = ''

Default is ''

$BT : bool = TRUE

Default is TRUE

Return values
string

formHeaderVisibleAction()

print form header with visible action field -- typically used for tinyMCE popups

formHeaderVisibleAction(string $action, string $name[, string $js = '' ][, bool $BT = TRUE ]) : string

$js is for javascript functions

Parameters
$action : string
$name : string
$js : string = ''

Default is ''

$BT : bool = TRUE

Default is TRUE

Return values
string

formHeaderName()

print form header with hidden action field and name and id fields

formHeaderName(string $action, string $name[, string $js = '' ][, bool $BT = TRUE ]) : string

js is for javascript functions

Parameters
$action : string
$name : string
$js : string = ''

Default is ''

$BT : bool = TRUE

Default is TRUE

Return values
string

formEnd()

end a form

formEnd() : string
Return values
string

formMultiHeader()

print form header with hidden action field for multi-part upload forms

formMultiHeader(string $action[, string $js = '' ]) : string
Parameters
$action : string
$js : string = ''

Default is ''

Return values
string

formSubmit()

print form footer with submit field

formSubmit([mixed $value = FALSE ][, string|false $name = FALSE ][, string $js = '' ]) : string
Parameters
$value : mixed = FALSE

Default is FALSE

$name : string|false = FALSE

Default is FALSE

$js : string = ''

Default is ''

Return values
string

closePopup()

print form footer with close popup button

closePopup(mixed $value) : string
Parameters
$value : mixed
Return values
string

formSubmitButton()

print form footer with submit button field

formSubmitButton(mixed $value[, string|false $name = FALSE ][, string $js = '' ]) : string
Parameters
$value : mixed

Default is FALSE

$name : string|false = FALSE

Default is FALSE

$js : string = ''

Default is ''

Return values
string

formReset()

print form reset button

formReset(mixed $value[, string $js = '' ]) : string
Parameters
$value : mixed
$js : string = ''

Default is ''

Return values
string

hidden()

print hidden form input

hidden(string $name, string $value[, string $js = '' ]) : string
Parameters
$name : string
$value : string
$js : string = ''

Default is ''

Return values
string

hiddenNoJSNoId()

print hidden form input without JavaScript action

hiddenNoJSNoId(string $name, mixed $value) : string
Parameters
$name : string
$value : mixed
Return values
string

radioButton()

print radio button

radioButton(string $name[, mixed $value = FALSE ][, bool|string $checked = FALSE ][, string $js = '' ]) : string
Parameters
$name : string
$value : mixed = FALSE

Default is FALSE

$checked : bool|string = FALSE

Default is FALSE

$js : string = ''

Default is ''

Return values
string

radioButtonGroup()

Print a radio button group.

radioButtonGroup(string $groupName, array<string|int, mixed> $buttons, mixed $checkedValue[, string $divider = BR ][, string $js = '' ]) : string

For more fine-grained control over radio buttons (individual $js for each button, placement of label etc.), do not use this but use radioButton() directly.

Parameters
$groupName : string
$buttons : array<string|int, mixed>

[$buttonValue => $buttonLabel]

$checkedValue : mixed

Which $buttonValue is checked

$divider : string = BR

Default BR

$js : string = ''

Default ''

Return values
string

checkbox()

print checkbox

checkbox(string $label, string $name[, bool|string $checked = FALSE ][, string $title = '' ][, string $js = '' ]) : string
Parameters
$label : string
$name : string
$checked : bool|string = FALSE

Default is FALSE

$title : string = ''

Default is ''

$js : string = ''

Default is ''

Return values
string

selectYesNoBox()

create special select box that only provides yes (1) and no (0) as options (values)

selectYesNoBox(string $name, string|null $select[, string $js = '' ]) : string

'selected value' is set SELECTED

Parameters
$name : string
$select : string|null
$js : string = ''

Default is ''

Return values
string

selectFBox()

create select boxes for HTML forms

selectFBox(string $name, array<string|int, mixed> $array[, int $size = 3 ][, int|bool $override = FALSE ][, string $js = '' ]) : string

First OPTION is always SELECTED optional $override allows the programmer to override the user set preferences for character limiting in select boxes

Parameters
$name : string
$array : array<string|int, mixed>
$size : int = 3

Default is 3

$override : int|bool = FALSE

Default is FALSE

$js : string = ''

Default is ''

Return values
string

selectedBox()

create select boxes for HTML forms

selectedBox(string $name, array<string|int, mixed> $array, string $select[, int $size = 3 ][, int|bool $override = FALSE ][, string $js = '' ]) : string

'selected value' is set SELECTED optional $override allows the programmer to override the user set preferences for character limiting in select boxes

Parameters
$name : string
$array : array<string|int, mixed>
$select : string
$size : int = 3

Default is 3

$override : int|bool = FALSE

Default is FALSE

$js : string = ''

Default is ''

Return values
string

selectFBoxValue()

create select boxes for HTML forms

selectFBoxValue(string $name, array<string|int, mixed> $array[, int $size = 3 ][, int|bool $override = FALSE ][, string $js = '' ]) : string

First entry is default selection. OPTION VALUE is set so expects assoc. array where key holds this value optional $override allows the programmer to override the user set preferences for character limiting in select boxes

Parameters
$name : string
$array : array<string|int, mixed>
$size : int = 3

Default is 3

$override : int|bool = FALSE

Default is FALSE

$js : string = ''

Default is ''

Return values
string

selectedBoxValue()

create select boxes for HTML forms

selectedBoxValue(string $name, array<string|int, mixed> $array, string $select[, int $size = 3 ][, int|bool $override = FALSE ][, string $js = '' ]) : string

$select is default selection. OPTION VALUE is set so expects assoc. array where key holds this value optional $override allows the programmer to override the user set preferences for character limiting in select boxes

Parameters
$name : string
$array : array<string|int, mixed>
$select : string
$size : int = 3

Default is 3

$override : int|bool = FALSE

Default is FALSE

$js : string = ''

Default is ''

Return values
string

selectFBoxValueMultiple()

create select boxes for HTML forms

selectFBoxValueMultiple(string $name, array<string|int, mixed> $array[, int $size = 3 ][, int|bool $override = FALSE ][, string $js = '' ]) : string

First entry is default selection. OPTION VALUE is set so expects assoc. array where key holds this value. MULTIPLE values may be selected optional $override allows the programmer to override the user set preferences for character limiting in select boxes

Parameters
$name : string
$array : array<string|int, mixed>
$size : int = 3

Default is 3

$override : int|bool = FALSE

Default is FALSE

$js : string = ''

Default is ''

Return values
string

selectedBoxValueMultiple()

create select boxes for HTML forms

selectedBoxValueMultiple(string $name, array<string|int, mixed> $array, array<string|int, mixed> $values[, int $size = 3 ][, int|bool $override = FALSE ][, string $js = '' ]) : string

OPTION VALUE is set so expects assoc. array where key holds this value. MULTIPLE values may be selected optional $override allows the programmer to override the user set preferences for character limiting in select boxes

Parameters
$name : string
$array : array<string|int, mixed>
$values : array<string|int, mixed>
$size : int = 3

Default is 3

$override : int|bool = FALSE

Default is FALSE

$js : string = ''

Default is ''

Return values
string

passwordInput()

password input type

passwordInput(string $name[, mixed $value = FALSE ][, int $size = 20 ][, int $maxLength = 255 ][, string $js = '' ]) : string
Parameters
$name : string
$value : mixed = FALSE

Default is FALSE

$size : int = 20

Default is 20

$maxLength : int = 255

Default is 255

$js : string = ''

Default is ''

Return values
string

honeypotInput()

A honeypot field made with text input

honeypotInput(string $name) : string

Robots fill it by mistake and are pawned!

Parameters
$name : string
Return values
string

textInput()

text input type

textInput(string $name[, mixed $value = FALSE ][, int $size = 20 ][, int $maxLength = 255 ][, string $js = '' ]) : string
Parameters
$name : string
$value : mixed = FALSE

Default is FALSE

$size : int = 20

Default is 20

$maxLength : int = 255

Default is 255

$js : string = ''

Default is ''

Return values
string

colorInput()

color input type

colorInput(string $name[, mixed $value = FALSE ][, string $js = '' ]) : string
Parameters
$name : string
$value : mixed = FALSE

Default is FALSE

$js : string = ''

Default is ''

Return values
string

textareaInput()

textarea input type

textareaInput(string $name[, mixed $value = FALSE ][, int $cols = 30 ][, int $rows = 5 ][, string $js = '' ]) : string
Parameters
$name : string
$value : mixed = FALSE

Default is FALSE

$cols : int = 30

Default is 30

$rows : int = 5

Default is 5

$js : string = ''

Default is ''

Return values
string

textareaInputmceNoEditor()

textarea input type without MCE editor

textareaInputmceNoEditor(string $name[, mixed $value = FALSE ][, int $cols = 30 ][, int $rows = 5 ][, string $js = '' ]) : string
Parameters
$name : string
$value : mixed = FALSE

Default is FALSE

$cols : int = 30

Default is 30

$rows : int = 5

Default is 5

$js : string = ''

Default is ''

Return values
string

textareaReadonly()

textarea readonly

textareaReadonly(string $name[, mixed $value = FALSE ][, int $cols = 30 ][, int $rows = 5 ][, string $js = '' ]) : string
Parameters
$name : string
$value : mixed = FALSE

Default is FALSE

$cols : int = 30

Default is 30

$rows : int = 5

Default is 5

$js : string = ''

Default is ''

Return values
string

fileUpload()

upload box

fileUpload(string $name[, int $size = 20 ][, string $accept = "" ][, string $js = '' ]) : string
Parameters
$name : string
$size : int = 20

Default is 20

$accept : string = ""

Default is "" (all file types)

$js : string = ''

Default is ''

Return values
string

fileUploadMultiple()

upload box for multiple files

fileUploadMultiple(string $name[, int $size = 20 ][, string $accept = "" ][, string $js = '' ]) : string
Parameters
$name : string
$size : int = 20

Default is 20

$accept : string = ""

Default is "" (all file types)

$js : string = ''

Default is ''

Return values
string

dateInput()

date input type

dateInput(string $name[, mixed $value = FALSE ][, string $js = '' ]) : string
Parameters
$name : string
$value : mixed = FALSE

Default is FALSE

$js : string = ''

Default is ''

Return values
string

label()

Label Form element

label(string $for) : string
Parameters
$for : string

Id of the form control associated to this label

Return values
string

filterHTML()

Filter HTML in fields destined for the search_ tables

filterHTML(string $html) : string
Parameters
$html : string
Return values
string

Filter HTML links for LISTCOMMON output

filterHTMLLinks(string $html) : string

This function is used only to remove links from a formatted resource when it is displayed inside a link because nested links are not supported by HTML.

Parameters
$html : string
Return values
string

escape()

Escape strings inserted in HTML

escape(mixed $value[, bool $force = FALSE ]) : mixed

If $value is not a string, return $value unchanged

NB: This function ignores the special case of backticks as attribute delimiters. IE is no longer supported.

Parameters
$value : mixed
$force : bool = FALSE

If true force escaping of allready escaped entities (Default if FALSE)

escapeHTMLTemp()

Temporarily escape HTML entities

escapeHTMLTemp(bool $protect, mixed $value) : mixed

If $value is not a string, return $value unchanged

This function is usually called twice. The first time ($protect = TRUE) will convert HTML entities. Presumably something is then done with the returned string, after which the function can be called with $protect = FALSE. The intention is to allow operations on a string that might interfere with or be interfered by any HTML entities in the string that are of type &...;

Parameters
$protect : bool
$value : mixed

_inlineHtmlAttribute()

Build a string for insertion of an HTML tag attribute.

_inlineHtmlAttribute([string $name = '' ][, string $value = '' ]) : string

Ensures that the attribute value is never empty (incorrect syntax)

Parameters
$name : string = ''

Default is ''

$value : string = ''

Default is ''

Return values
string

h()

<Hx> heading element

h([mixed $data = '' ][, string $class = '' ][, int $level = 4 ]) : string
Parameters
$data : mixed = ''

Default is ''

$class : string = ''

Default is ''

$level : int = 4

Default is 4

Return values
string

div()

<DIV> element

div(string $id[, mixed $data = '' ][, string $class = '' ]) : string

If no $data, then this is probably used in conjunction with AJAX to hide or unhide a page element

Parameters
$id : string
$data : mixed = ''

Default is ''

$class : string = ''

Default is ''

Return values
string

divScrollable()

Scrollable <DIV> element

divScrollable(string $id[, mixed $data = '' ][, string $class = '' ][, int $width = 500 ][, int $height = 200 ]) : string

If no $data, then this is probably used in conjunction with AJAX to hide or unhide a page element

Parameters
$id : string
$data : mixed = ''

Default is ''

$class : string = ''

Default is ''

$width : int = 500

Default is 500px

$height : int = 200

Default is 200px

Return values
string

iframe()

<IFRAME> element

iframe(string $id[, mixed $data = '' ][, string $class = '' ]) : string

If no $data, then this is probably used in conjunction with AJAX to hide or unhide a page element

Parameters
$id : string
$data : mixed = ''

Default is ''

$class : string = ''

Default is ''

Return values
string

p()

<P> element

p([mixed $data = '' ][, string $class = '' ][, string $align = 'left' ]) : string
Parameters
$data : mixed = ''

Default is ''

$class : string = ''

Default is ''

$align : string = 'left'

Default is 'left'

Return values
string

pBrowse()

<P> element

pBrowse([mixed $data = '' ][, string $class = '' ]) : string

for browsing creators, collections etc. (tag colour) where a background colour needs to be specified

Parameters
$data : mixed = ''

Default is ''

$class : string = ''

Default is ''

Return values
string

pre()

<PRE> element

pre(mixed $data[, string $class = '' ][, string $align = 'left' ]) : string
Parameters
$data : mixed
$class : string = ''

Default is ''

$align : string = 'left'

Default is 'left'

Return values
string

ul()

<UL> element

ul([mixed $data = '' ][, string $class = '' ]) : string
Parameters
$data : mixed = ''

Default is ''

$class : string = ''

Default is ''

Return values
string

ol()

<OL> element

ol([mixed $data = '' ][, string $class = '' ]) : string
Parameters
$data : mixed = ''

Default is ''

$class : string = ''

Default is ''

Return values
string

li()

<LI> element

li([mixed $data = '' ][, string $class = '' ]) : string
Parameters
$data : mixed = ''

Default is ''

$class : string = ''

Default is ''

Return values
string

hr()

<HR> element

hr([string $class = '' ]) : string
Parameters
$class : string = ''

Default is ''

Return values
string

mark()

<mark> element

mark(mixed $data) : string
Parameters
$data : mixed
Return values
string

object()

<OBJECT> element For display attachment previews

object(mixed $data, string $type, int $width, int $height) : string
Parameters
$data : mixed
$type : string
$width : int
$height : int
Return values
string

span()

<SPAN> element

span([mixed $data = '' ][, string $class = '' ][, string $title = '' ][, string $js = '' ]) : string
Parameters
$data : mixed = ''

Default is ''

$class : string = ''

Default is ''

$title : string = ''

Default is ''

$js : string = ''

Default is ''

Return values
string

color()

<SPAN color> element

color([mixed $data = '' ][, string $class = 'blackText' ]) : string
Parameters
$data : mixed = ''

Default is ''

$class : string = 'blackText'

Default is 'blackText'

Return values
string

strong()

<STRONG> element (Semantic equivalent of <B>)

strong([mixed $data = '' ][, string $class = '' ]) : string
Parameters
$data : mixed = ''

Default is ''

$class : string = ''

Default is ''

Return values
string

em()

<EM> element (Semantic equivalent of <I>)

em([mixed $data = '' ][, string $class = '' ]) : string
Parameters
$data : mixed = ''

Default is ''

$class : string = ''

Default is ''

Return values
string

u()

<U> element

u(mixed $data[, string $class = '' ]) : string
Parameters
$data : mixed
$class : string = ''

Default is ''

Return values
string

img()

<IMG> element

img(string $src, int $width, int $height[, string $title = '' ][, string $alt = '' ][, string $js = '' ]) : string
Parameters
$src : string
$width : int
$height : int
$title : string = ''

Default is ''

$alt : string = ''

Default is ''

$js : string = ''

Default is ''

Return values
string

anchor()

<A> element used as internal anchor

anchor(string $name[, mixed $data = '' ][, string $title = '' ]) : string
Parameters
$name : string
$data : mixed = ''

Default is ''

$title : string = ''

Default is ''

Return values
string

a()

<A> element used as hyperlink

a(string $class, mixed $label, string $link[, string $target = '' ][, string $title = '' ]) : string
Parameters
$class : string
$label : mixed
$link : string
$target : string = ''

Default is ''

$title : string = ''

Default is ''

Return values
string

aBrowse()

<A> element used as hyperlink

aBrowse([string $color = '#000' ][, string $size = '1em' ][, mixed $label = '' ][, string $link = '' ][, string $target = '' ][, string $title = '' ][, string $js = '' ]) : string

Hyperlinks for browsing creators, collections etc. (tag clouds) where the text colour and size is provided by the scripts to indicate frequency

Parameters
$color : string = '#000'

Default is '#000'

$size : string = '1em'

Default is '1em'

$label : mixed = ''

Default is ''

$link : string = ''

Default is ''

$target : string = ''

Default is ''

$title : string = ''

Default is ''

$js : string = ''

Default is ''

Return values
string

tableStart()

Start a <TABLE> tag

tableStart([string $class = '' ]) : string
Parameters
$class : string = ''

Default is ''

Return values
string

tableEnd()

Close a <TABLE> tag

tableEnd() : string
Return values
string

tableCaption()

provide a table <caption>

tableCaption([mixed $caption = '' ][, string $class = '' ]) : string
Parameters
$caption : mixed = ''

Default is ''

$class : string = ''

Default is ''

Return values
string

tbodyStart()

Provide a <tbody> tag

tbodyStart([string $class = '' ]) : string
Parameters
$class : string = ''

Default is ''

Return values
string

tbodyEnd()

Provide a </tbody> tag

tbodyEnd() : string
Return values
string

theadStart()

Provde a <thead> tag

theadStart([string $class = '' ]) : string
Parameters
$class : string = ''

Default is ''

Return values
string

theadEnd()

Provide a </thead> tag

theadEnd() : string
Return values
string

tfootStart()

Provide a <tfoot> tag

tfootStart([string $class = '' ]) : string
Parameters
$class : string = ''

Default is ''

Return values
string

tfootEnd()

Provide a </tfoot> tag

tfootEnd() : string
Return values
string

trStart()

Provide a <tr> tag

trStart([string $class = '' ]) : string
Parameters
$class : string = ''

Default is ''

Return values
string

trEnd()

Provide a </tr> tag

trEnd() : string
Return values
string

tdStart()

Provide a <td> tag without closing it or encapsulating data

tdStart([string $class = '' ][, int|string $colspan = '' ]) : string
Parameters
$class : string = ''

Default is ''

$colspan : int|string = ''

Default is ''

Return values
string

tdEnd()

Provide a </td> tag

tdEnd() : string
Return values
string

td()

Provide a <td>...</td> tag

td([mixed $data = '' ][, string $class = '' ][, int|string $colspan = '' ]) : string
Parameters
$data : mixed = ''

Default is ''

$class : string = ''

Default is ''

$colspan : int|string = ''

Default is ''

Return values
string

thStart()

Provide a <th> tag without closing it or encapsulating data

thStart([string $class = '' ][, int|string $colspan = '' ]) : string
Parameters
$class : string = ''

Default is ''

$colspan : int|string = ''

Default is ''

Return values
string

thEnd()

Provide a </th> tag

thEnd() : string
Return values
string

th()

Provide a <th>...</th> tag

th([mixed $data = '' ][, string $class = '' ][, int|string $colspan = '' ]) : string
Parameters
$data : mixed = ''

Default is ''

$class : string = ''

Default is ''

$colspan : int|string = ''

Default is ''

Return values
string

cssInlineExternal()

Insert a call to an external CSS file

cssInlineExternal(string $url[, string $media = "all" ]) : string
Parameters
$url : string
$media : string = "all"

Default is 'all' (can be 'all' for all media, 'print' for printing, 'screen' for screens)

Tags
see
https://developer.mozilla.org/en-US/docs/Web/CSS/@media#media_types
Return values
string

jsInline()

Inlining JavaScript code

jsInline(string $jsCode[, string $execMode = "sync" ][, string $type = "" ]) : string
Parameters
$jsCode : string
$execMode : string = "sync"

When the script should be executed? Default is 'sync'

$type : string = ""

Script type? Default is ''

Tags
see
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
see
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules

Execution modes:

  • 'sync' for sync loading and execution
  • 'async' for async loading and execution
  • 'defer' to defer execution until the DOM is fully parsed (not allowed on inlined scripts)

Script types:

  • '' for a regular JS script
  • 'module' for a JavaScript module
  • 'importmap' for an import map
Return values
string

jsInlineExternal()

Insert a call to an external javascript file

jsInlineExternal(string $url[, string $execMode = "sync" ][, string $type = "" ]) : string
Parameters
$url : string
$execMode : string = "sync"
$type : string = ""

Script type? Default is ''

Tags
see
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
see
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules

Execution modes:

  • 'sync' for sync loading and execution
  • 'async' for async loading and execution
  • 'defer' to defer execution until the DOM is fully parsed (not allowed on inlined scripts)

Script types:

  • '' for a regular JS script
  • 'module' for a JavaScript module
  • 'importmap' for an import map
Return values
string

successToast()

Format a text as a HTML success toast message (temporary info)

successToast(mixed $string) : string
Parameters
$string : mixed
Return values
string

errorToast()

Format a text as a HTML error toast message (temporary info)

errorToast(mixed $string) : string
Parameters
$string : mixed
Return values
string

nlToHtml()

replace newlines and carriage returns with appropriate HTML code.

nlToHtml(mixed $string) : string

first multiples then singles. Used for display back from DB table

Parameters
$string : mixed
Return values
string

htmlToNl()

replace HTML newlines and carriage returns in a string or array with appropriate ANSI code.

htmlToNl(mixed $string) : mixed

first multiples then singles. Used for display back from DB table

Parameters
$string : mixed

removeNl()

remove all newlines.

removeNl(mixed $string) : string

For cases when user cut 'n' pastes multiple lines into single-line text box Used before writing to DB table

Parameters
$string : mixed
Return values
string

stripHtml()

Strip HTML from string or array

stripHtml(mixed $string) : mixed
Parameters
$string : mixed

clearSortField()

Strip HTML from string

clearSortField(mixed $string) : string
Parameters
$string : mixed
Return values
string

get_core_message()

Translate a message from a domain

get_core_message(string $sectionKey, string $messageKey[, mixed $messageParam = "" ]) : string

This function is mimicking dgettext().

Parameters
$sectionKey : string

Section key of the catalog

$messageKey : string

Message key of the catalog

$messageParam : mixed = ""

Optional array or single value that replaces '###' in the message. Default is ""

Tags
see
https://www.php.net/manual/en/function.dgettext.php
Return values
string

get_message()

Translate a message from a domain

get_message(string $domain, string $sectionKey, string $messageKey[, mixed $messageParam = "" ]) : string

This function is mimicking dgettext().

Parameters
$domain : string

Catalog domain name

$sectionKey : string

Section key of the catalog

$messageKey : string

Message key of the catalog

$messageParam : mixed = ""

Optional array or single value that replaces '###' in the message. Default is ""

Tags
see
https://www.php.net/manual/en/function.dgettext.php
see
https://en.wikipedia.org/wiki/Pseudolocalization
Return values
string

translate_message()

Translate a message from a domain

translate_message(string $domain, string $message) : string

This function is mimicking dgettext().

Parameters
$domain : string

Catalog domain name

$message : string

Message to translate

Tags
see
https://www.php.net/manual/en/function.dgettext.php
Return values
string

dateFormatFromString()

Format dates and times for localization in numeric short format

dateFormatFromString(string $datetime) : string

Use it for displaying data to the user, not formatting data for the db.

If $datetime is not parseable then its value is returned unformated.

If IntlDateFormatter instanciation fails then the date is formated with "Y-M-d H:i:s" pattern.

Parameters
$datetime : string

comes in from the database in the format 'YYYY-MM-DD HH:MM:SS' e.g. 2013-01-31 15:54:55

Return values
string

dateFormatFromTimeStamp()

Format dates and times for localization in numeric short format

dateFormatFromTimeStamp(int $timestamp) : string

Use it for displaying data to the user, not formatting data for the db.

If IntlDateFormatter instanciation fails then the date is formated with "Y-M-d H:i:s" pattern.

Parameters
$timestamp : int
Return values
string

set_locales()

Set the default locale of Intl library with the user's preferred locale

set_locales() : void

load_locales()

Load the translation catalogs of the user's preferred language.

load_locales(string $domain, string $locale) : array<string|int, mixed>
Parameters
$domain : string
$locale : string
Return values
array<string|int, mixed>

determine_locale()

Determine the user's preferred language.

determine_locale([string|null $force_locale = NULL ]) : string

This function builds a language priority stack and return the first entry as the user's preferred language.

If $force_locale is passed, this function will try to use this locale first.

Parameters
$force_locale : string|null = NULL

Code of a locale (format: ll[_Script][_CC])(optional, NULL by default)

Return values
string

determine_locale_priority_stack()

Determine the user's preferred language.

determine_locale_priority_stack([string|null $force_locale = NULL ]) : array<string|int, string>

This function builds a language priority stack. The first is the highest priority.

If $force_locale is passed, this function will try to use this locale first.

Parameters
$force_locale : string|null = NULL

Code of a locale (format: ll[_Script][_CC])(optional, NULL by default)

Return values
array<string|int, string>

getAllLocales()

Return a selected list of all locales recognised by Intl and usable for translation and formatting

getAllLocales([bool $sorted_by_key = FALSE ]) : array<string|int, string>

Each entry of the returned array is locale code (format: ll[_Script][_CC]) as key and its name as value [format: language (Country, Variant)].

ll is a mandatory language code CC is an optional country code variant is an optional script, money or collation code

Parameters
$sorted_by_key : bool = FALSE

If TRUE, sort the table by keys instead of values

Tags
see
https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-input-locales-for-windows-language-packs?view=windows-11
see
https://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/share/locale/Makefile.locale
see
https://github.com/freebsd/freebsd-src/blob/main/share/ctypedef/Makefile
see
https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/share/ctypedef/Makefile
see
https://github.com/haiku/haiku/tree/master/data/catalogs/preferences/locale
Return values
array<string|int, string>

localetoBCP47()

Return the BCP 47 code that matches the code of a locale.

localetoBCP47(string $locale) : string

The BCP 47 code is used in the lang attribute of any HTML tag. The list of supported languages is simple enough to avoid having to encounter any particular case.

Parameters
$locale : string

Code of a locale (format: ll[_Script][_CC])

Tags
see
https://www.w3.org/International/questions/qa-html-language-declarations
see
https://www.w3.org/International/questions/qa-choosing-language-tags
see
https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
Return values
string

If a BCP47 code is missing, return 'en'

getTranslatableLocales()

Get a list of translatable locales sorted by locale name

getTranslatableLocales(string $in_locale) : array<string|int, string>

This is a list of locales that a translator can use to translate a text, and not a list of locales currently available on the system.

Parameters
$in_locale : string

Transalate locales names with local $in_locale

Return values
array<string|int, string>

Each key is a locale code and its value a displayname.

searchLanguageCode()

Return the language code matching a language name

searchLanguageCode(string $language_name) : string

If no language code matchs the name, return "".

NB: this function is slow and should not be used outside the upgrade code

Parameters
$language_name : string
Return values
string

sort()

Sort an array according to the current Intl locale in ascending order

sort(array<string|int, mixed> &$array[, int $flags = Collator::SORT_REGULAR ]) : bool

This function is a wrapper of collator_sort() that works as sort().

If you really need more flexibility or the full power of an Unicode sort algo, use the original function.

Parameters
$array : array<string|int, mixed>

Array of strings to sort.

$flags : int = Collator::SORT_REGULAR

Optional sorting type, one of the following:

  • Collator::SORT_REGULAR - compare items normally (don't change types)
  • Collator::SORT_NUMERIC - compare items numerically
  • Collator::SORT_STRING - compare items as strings Default sorting type is Collator::SORT_REGULAR. It is also used if an invalid flags value has been specified.

return bool TRUE on success, FALSE otherwise

Tags
see
https://www.php.net/manual/en/function.sort.php
see
https://www.php.net/manual/en/collator.sort.php
see
https://www.php.net/manual/fr/class.collator.php
Return values
bool

asort()

Sort an array according to the current Intl locale in ascending order and maintain index association

asort(array<string|int, mixed> &$array[, int $flags = Collator::SORT_REGULAR ]) : bool

This function is a wrapper of collator_asort() that works as asort().

If you really need more flexibility or the full power of an Unicode sort algo, use the original function.

Parameters
$array : array<string|int, mixed>

Array of strings to sort.

$flags : int = Collator::SORT_REGULAR

Optional sorting type, one of the following:

  • Collator::SORT_REGULAR - compare items normally (don't change types)
  • Collator::SORT_NUMERIC - compare items numerically
  • Collator::SORT_STRING - compare items as strings Default sorting type is Collator::SORT_REGULAR. It is also used if an invalid flags value has been specified.

return bool TRUE on success, FALSE otherwise

Tags
see
https://www.php.net/manual/en/function.asort.php
see
https://www.php.net/manual/fr/collator.asort.php
see
https://www.php.net/manual/fr/class.collator.php
Return values
bool

ksort()

Sort an array according to the current Intl locale in ascending order and maintain index association

ksort(array<string|int, mixed> &$array[, int $flags = Collator::SORT_REGULAR ]) : bool

This function is a wrapper of Collator::compare() that works as ksort().

If you really need more flexibility or the full power of an Unicode sort algo, use the original function.

Parameters
$array : array<string|int, mixed>

Array of strings to sort.

$flags : int = Collator::SORT_REGULAR

Optional sorting type, one of the following:

  • Collator::SORT_REGULAR - compare items normally (don't change types)
  • Collator::SORT_NUMERIC - compare items numerically
  • Collator::SORT_STRING - compare items as strings Default sorting type is Collator::SORT_REGULAR. It is also used if an invalid flags value has been specified.

return bool TRUE on success, FALSE otherwise

Tags
see
https://www.php.net/manual/en/function.ksort.php
see
https://www.php.net/manual/fr/collator.compare.php
see
https://www.php.net/manual/fr/class.collator.php
Return values
bool

rsort()

Sort an array according to the current Intl locale in descending order

rsort(array<string|int, mixed> &$array[, int $flags = Collator::SORT_REGULAR ]) : bool

This function is a wrapper of Collator::compare() that works as rsort().

If you really need more flexibility or the full power of an Unicode sort algo, use the original function.

Parameters
$array : array<string|int, mixed>

Array of strings to sort.

$flags : int = Collator::SORT_REGULAR

Optional sorting type, one of the following:

  • Collator::SORT_REGULAR - compare items normally (don't change types)
  • Collator::SORT_NUMERIC - compare items numerically
  • Collator::SORT_STRING - compare items as strings Default sorting type is Collator::SORT_REGULAR. It is also used if an invalid flags value has been specified.

return bool TRUE on success, FALSE otherwise

Tags
see
https://www.php.net/manual/en/function.rsort.php
see
https://www.php.net/manual/fr/collator.compare.php
see
https://www.php.net/manual/fr/class.collator.php
Return values
bool

arsort()

Sort an array according to the current Intl locale in descending order and maintain index association

arsort(array<string|int, mixed> &$array[, int $flags = Collator::SORT_REGULAR ]) : bool

This function is a wrapper of Collator::compare() that works as arsort().

If you really need more flexibility or the full power of an Unicode sort algo, use the original function.

Parameters
$array : array<string|int, mixed>

Array of strings to sort.

$flags : int = Collator::SORT_REGULAR

Optional sorting type, one of the following:

  • Collator::SORT_REGULAR - compare items normally (don't change types)
  • Collator::SORT_NUMERIC - compare items numerically
  • Collator::SORT_STRING - compare items as strings Default sorting type is Collator::SORT_REGULAR. It is also used if an invalid flags value has been specified.

return bool TRUE on success, FALSE otherwise

Tags
see
https://www.php.net/manual/en/function.arsort.php
see
https://www.php.net/manual/fr/collator.compare.php
see
https://www.php.net/manual/fr/class.collator.php
Return values
bool

krsort()

Sort an array according to the current Intl locale in descending order and maintain index association

krsort(array<string|int, mixed> &$array[, int $flags = Collator::SORT_REGULAR ]) : bool

This function is a wrapper of Collator::compare() that works as krsort().

If you really need more flexibility or the full power of an Unicode sort algo, use the original function.

Parameters
$array : array<string|int, mixed>

Array of strings to sort.

$flags : int = Collator::SORT_REGULAR

Optional sorting type, one of the following:

  • Collator::SORT_REGULAR - compare items normally (don't change types)
  • Collator::SORT_NUMERIC - compare items numerically
  • Collator::SORT_STRING - compare items as strings Default sorting type is Collator::SORT_REGULAR. It is also used if an invalid flags value has been specified.

return bool TRUE on success, FALSE otherwise

Tags
see
https://www.php.net/manual/en/function.krsort.php
see
https://www.php.net/manual/fr/collator.compare.php
see
https://www.php.net/manual/fr/class.collator.php
Return values
bool

messageTranslatorNeeded()

Return a message if the project need translation contribution for the current locale

messageTranslatorNeeded() : string

return string

Return values
string

getPagingParams()

Get the paging start and total

getPagingParams(array<string|int, mixed> $vars) : array<string|int, mixed>
Parameters
$vars : array<string|int, mixed>
Return values
array<string|int, mixed>

getNum()

Get information on the number or characters being used for alphabetical and dictionary paging

getNum(array<string|int, mixed> $pagingArray, string $conjunction, int $start, int $total) : string
Parameters
$pagingArray : array<string|int, mixed>
$conjunction : string
$start : int
$total : int
Return values
string

Get links for alphabetical and dictionary paging

setLinks(array<string|int, mixed> $pagingArray, string $conjunction, int $start, string $browserTabID, string $queryString) : array<string|int, mixed>
Parameters
$pagingArray : array<string|int, mixed>
$conjunction : string
$start : int
$browserTabID : string
$queryString : string
Return values
array<string|int, mixed>

getZoomSlices()

Get zooming paging slices

getZoomSlices(int $paging, int $start, int $total, int $maxLinks, array<string|int, mixed> $vars, string $queryString, string $prefix) : void
Parameters
$paging : int
$start : int
$total : int
$maxLinks : int
$vars : array<string|int, mixed>
$queryString : string
$prefix : string

calculateZoomSlices()

Calculate the zoom slices

calculateZoomSlices(int $paging, int $start, int $total, int $maxLinks, int $row, array<string|int, mixed> $storeSlices, array<string|int, mixed> $vars, object $icons, object $store, string $rootLink, string $queryString, string $prefix, mixed $BT, bool $reloaded) : mixed
Parameters
$paging : int
$start : int
$total : int
$maxLinks : int
$row : int
$storeSlices : array<string|int, mixed>
$vars : array<string|int, mixed>
$icons : object
$store : object
$rootLink : string
$queryString : string
$prefix : string
$BT : mixed
$reloaded : bool

Get the zoom links

getZoomLinks(int $paging, int $start, array<string|int, mixed> $starts, array<string|int, mixed> $ends, array<string|int, mixed> $slices, int $row, int $sliceSize, array<string|int, mixed> $storeColumns, array<string|int, mixed> $storeStarts, array<string|int, mixed> $storeEnds, object $icons, string $rootLink, string $queryString, string $BT) : array<string|int, mixed>
Parameters
$paging : int
$start : int
$starts : array<string|int, mixed>
$ends : array<string|int, mixed>
$slices : array<string|int, mixed>
$row : int
$sliceSize : int
$storeColumns : array<string|int, mixed>
$storeStarts : array<string|int, mixed>
$storeEnds : array<string|int, mixed>
$icons : object
$rootLink : string
$queryString : string
$BT : string
Return values
array<string|int, mixed>

zoomToTop()

Set zoom top link link

zoomToTop(object $icons, string $rootLink, string $queryString, string $BT) : string
Parameters
$icons : object
$rootLink : string
$queryString : string
$BT : string
Return values
string

zoomUpOneLevel()

Set zoom up one level link

zoomUpOneLevel(int $row, array<string|int, mixed> $storeColumns, array<string|int, mixed> $storeStarts, array<string|int, mixed> $storeEnds, object $icons, string $rootLink, string $queryString, string $BT) : string
Parameters
$row : int
$storeColumns : array<string|int, mixed>
$storeStarts : array<string|int, mixed>
$storeEnds : array<string|int, mixed>
$icons : object
$rootLink : string
$queryString : string
$BT : string
Return values
string

storeZoomData()

Store the zoom session

storeZoomData(string $prefix, string $storeSlices, string $storeSliceSizes, string $storeStarts, string $storeEnds, string $storeColumns, object $store) : void
Parameters
$prefix : string
$storeSlices : string
$storeSliceSizes : string
$storeStarts : string
$storeEnds : string
$storeColumns : string
$store : object

Get the root link for the paging link

getRootLink(string $queryString) : mixed
Parameters
$queryString : string

linksInfo()

Format display information string

linksInfo(int $start, int $total, int $paging[, false|string $bibTitle = FALSE ][, false|string $ideas = FALSE ]) : string
Parameters
$start : int
$total : int
$paging : int
$bibTitle : false|string = FALSE

Default is FALSE

$ideas : false|string = FALSE

Default is FALSE

Return values
string

getUserBib()

Check for user bibliographies

getUserBib() : array<string|int, mixed>
Return values
array<string|int, mixed>

getBib()

Get details about the bibliography being used

getBib(string $bibTitle) : mixed
Parameters
$bibTitle : string

getData()

get data from database

getData(array<string|int, mixed> $resourceData, object $common, object $bibCite) : array<string|int, mixed>
Parameters
$resourceData : array<string|int, mixed>
$common : object
$bibCite : object
Return values
array<string|int, mixed>

grabCollection()

Grab collection title

grabCollection(array<string|int, mixed> $rowTypes, array<string|int, mixed> &$entryArray, array<string|int, mixed> $resourceData, object $map) : void
Parameters
$rowTypes : array<string|int, mixed>
$entryArray : array<string|int, mixed>
$resourceData : array<string|int, mixed>
$map : object

grabPublisher()

Grab publisher

grabPublisher(array<string|int, mixed> $rowTypes, array<string|int, mixed> &$entryArray, array<string|int, mixed> $resourceData, object $map) : void
Parameters
$rowTypes : array<string|int, mixed>
$entryArray : array<string|int, mixed>
$resourceData : array<string|int, mixed>
$map : object

grabNames()

grabNames

grabNames(array<string|int, mixed> $rowTypes, array<string|int, mixed> &$entryArray, array<string|int, mixed> $resourceData, object $map, object $common) : void
Parameters
$rowTypes : array<string|int, mixed>
$entryArray : array<string|int, mixed>
$resourceData : array<string|int, mixed>
$map : object
$common : object

webFormat()

web_article, URL and accessed date

webFormat(array<string|int, mixed> $row, array<string|int, mixed> $urls) : string
Parameters
$row : array<string|int, mixed>
$urls : array<string|int, mixed>
Return values
string

year2Format()

format YYYY/MM/DD of conference dates etc

year2Format(array<string|int, mixed> $row) : string
Parameters
$row : array<string|int, mixed>
Return values
string

year1Format()

format YYYY/MM/DD of publication

year1Format(array<string|int, mixed> $row) : string
Parameters
$row : array<string|int, mixed>
Return values
string

timeFormat()

format running time for films

timeFormat(array<string|int, mixed> $row) : string
Parameters
$row : array<string|int, mixed>
Return values
string

grabNoteAbstract()

grabNoteAbstract

grabNoteAbstract(array<string|int, mixed> &$entryArray, array<string|int, mixed> $resourceData, object $bibCite) : void
Parameters
$entryArray : array<string|int, mixed>
$resourceData : array<string|int, mixed>
$bibCite : object

grabKeywords()

grabKeywords

grabKeywords(array<string|int, mixed> &$entryArray, array<string|int, mixed> $rIds, object $db) : void
Parameters
$entryArray : array<string|int, mixed>
$rIds : array<string|int, mixed>
$db : object

tidyOutput()

Tidy up the output for plain text

tidyOutput(array<string|int, mixed> $input) : array<string|int, mixed>
Parameters
$input : array<string|int, mixed>
Return values
array<string|int, mixed>

header()

Set some defaults and create the RTF opening tag

header() : string
Return values
string

Create the RTF closing tag

footer() : string
Return values
string

footnotes()

Set RTF headers regarding footnotes/endnotes

footnotes(string $method[, mixed $extra = FALSE ]) : mixed

See notes at the beginning of this file. But especially remember that endSameId and endSameIdOrdered are fake endnotes (span data-wikindxbib is removed in RTFEXPORT::parseHTML())

Parameters
$method : string
$extra : mixed = FALSE

Default FALSE

citation()

Citation stuff The options for $citeStyle are: 'inText' In-text citations (needs bibliography appended) 'ftInc' Footnotes: the footnotes order increments from 1 (needs bibliography appended) 'endInc' Endnotes: the endnotes 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

citation(string $method[, mixed $extra1 = FALSE ][, mixed $extra2 = FALSE ]) : mixed

Most of the formatting of citations is accomplished by the citation engine and formatting in HTML and a bibliography is appended where appropriate.

Parameters
$method : string
$extra1 : mixed = FALSE

Default FALSE

$extra2 : mixed = FALSE

Default FALSE

documentSettings()

Deal with document defaults. This function has various roles depending on the value of $method Must be called before traverseDOM()

documentSettings(string $method[, mixed $extra = FALSE ][, string $paperSize = 'A4' ][, string $lineSpacing = 'singleSpace' ]) : mixed
Parameters
$method : string
$extra : mixed = FALSE

Default FALSE

$paperSize : string = 'A4'

Default 'A4'

$lineSpacing : string = 'singleSpace'

Default 'singleSpace'

cleanHtml()

Clean up HTML before parsing and do some initial conversion

cleanHtml(string $text) : string
Parameters
$text : string
Return values
string

specialCharsToRTF()

Convert special characters.

specialCharsToRTF(string $text, bool $protectCurlyBrace) : string

For RTF, for escaping special characters used to build control words, it is recommended to convert to hex

Parameters
$text : string
$protectCurlyBrace : bool
Return values
string

cleanBlockquotes()

TinyMCE always puts p tags within blockquote—remove them!

cleanBlockquotes(string $text) : string
Parameters
$text : string
Return values
string

fonts()

Deal with fonts. This function has various roles depending on the value of $method

fonts(string $method[, string $font = '' ]) : mixed
Parameters
$method : string
$font : string = ''

Default ''

colours()

Deal with colours. This function has various roles depending on the value of $method

colours(string $method[, string $colour = '' ]) : mixed
Parameters
$method : string
$colour : string = ''

Default ''

lists()

Deal with lists. This function has various roles depending on the value of $method

lists(string $method[, string $string = '' ]) : mixed
Parameters
$method : string
$string : string = ''

Default ''

listToRTF()

Convert lists to RTF (deals with nested lists too and recognizes unordered or ordered)

listToRTF(array<string|int, mixed> $stack, string $listType) : string

Although list items might have style attributes such as align right, these are ignored by RTF so ignore them here too.

Parameters
$stack : array<string|int, mixed>
$listType : string
Return values
string

newListTableItem()

Create new listtable item

newListTableItem(int $levelnfc, int $listIndex) : string
Parameters
$levelnfc : int
$listIndex : int
Return values
string

textDecoration()

text-decoration styling

textDecoration(string $style) : mixed
Parameters
$style : string

fontWeight()

Convert font-weight

fontWeight(string $style) : string
Parameters
$style : string
Return values
string

fontSize()

Convert font size to RTF

fontSize(string $size) : string
Parameters
$size : string
Return values
string

traverseDOM()

Traverse the DOM and produce RTF code

traverseDOM(DOMNode $domNode[, mixed $listLevel = 0 ][, int $tableNestLevel = 0 ]) : string
Parameters
$domNode : DOMNode
$listLevel : mixed = 0
$tableNestLevel : int = 0

Default = 0

Return values
string

nodeAttributes()

Convert attributes

nodeAttributes(DOMNode $node[, bool $wantArray = FALSE ]) : mixed
Parameters
$node : DOMNode
$wantArray : bool = FALSE

Default = FALSE

tables()

Deal with tables and their elements. This function has various roles depending on the value of $method

tables(string $method[, mixed $extra = FALSE ][, mixed $extra2 = FALSE ]) : mixed

For each table, there is a $tableObject, and each nested table gets a new $tableObject

Parameters
$method : string
$extra : mixed = FALSE

Default = FALSE

$extra2 : mixed = FALSE

Default FALSE

setCellEdgeDefaults()

Set cell edge defaults in the table matrix.

setCellEdgeDefaults(array<string|int, mixed> $tableMatrix, string $key, mixed $value) : array<string|int, mixed>

Done when first encountering a table tag.

Also used to set the table parameter 'cellpadding' on all cells.

Parameters
$tableMatrix : array<string|int, mixed>
$key : string
$value : mixed
Return values
array<string|int, mixed>

tableCellToRTF()

Convert table cell to RTF cell property string

tableCellToRTF(array<string|int, mixed> $attributes, array<string|int, mixed> $cellArray, int $thisRowNumber, int $thisCellNumber[, bool $th = FALSE ]) : array<string|int, mixed>
Parameters
$attributes : array<string|int, mixed>
$cellArray : array<string|int, mixed>
$thisRowNumber : int
$thisCellNumber : int
$th : bool = FALSE

(Default FALSE)

Return values
array<string|int, mixed>

inheritParentBorders()

Transfer the parent's border properties to a spanned child

inheritParentBorders(array<string|int, mixed> $childCell, int $childRowNumber) : array<string|int, mixed>

Child can never have top edge

Parameters
$childCell : array<string|int, mixed>
$childRowNumber : int
Return values
array<string|int, mixed>

getCellBorderParams()

Get cell border parameters

getCellBorderParams(string $key, string $value[, array<string|int, mixed> $attributes = [] ]) : array<string|int, mixed>
Parameters
$key : string
$value : string
$attributes : array<string|int, mixed> = []

Default [] (used only if $key == 'border-style')

Return values
array<string|int, mixed>

updateCellEdges()

Update cell edge in the table matrix for one cell. i.e. border has been set for this table cell

updateCellEdges(array<string|int, mixed> $cellArray, array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$cellArray : array<string|int, mixed>
$params : array<string|int, mixed>

($style, $width, $color)

Return values
array<string|int, mixed>

cellBordersToString()

Create a string of cell border properties from an array

cellBordersToString(array<string|int, mixed> $cellArray, array<string|int, mixed> $edges) : string

We also deal with rowspans where there may or may not be padding and borders

Parameters
$cellArray : array<string|int, mixed>
$edges : array<string|int, mixed>
Return values
string

calculateTableMatrix()

We need to set up a table matrix counting number of rows and number of their children so we can deal with various properties.

calculateTableMatrix(DOMNode $domNode) : array<string|int, mixed>

Need to count max row cells in a table before we can set up the matrix. Note that the HTML code for vertical spanning ('rowspan') is likely to have uneven numbers of cells. Where there are gaps, we must insert the child cell. Note the relationship (Parent/Child) row no./cell no. for each member of a spanned group to be able to deal with inserted cell properties later on. Cell borders, background colours, properties and so on inherit from the table properties but can override them with individual cell settings. This function is called on an opening table or tbody tag, so, here, we first set up the table matrix consisting of rows where the key is the row count for the table and the value is an array comprising an array of default properties for each cell. These properties can then be overriden in tableCellToRTF().

Parameters
$domNode : DOMNode
Return values
array<string|int, mixed>

getCellWidth()

Get cell width

getCellWidth(array<string|int, mixed> $attributes) : string
Parameters
$attributes : array<string|int, mixed>
Return values
string

startCellToRTF()

Start the process of converting a td or th element

startCellToRTF(DOMNode $domNode, bool $rowSpanParent, int $tableNestLevel) : array<string|int, mixed>
Parameters
$domNode : DOMNode
$rowSpanParent : bool
$tableNestLevel : int

// > 1 == nested

Return values
array<string|int, mixed>

utf8_2_rtfansicpg1252()

UTF-8 to ANSI Windows 1252 strings for RTF only

utf8_2_rtfansicpg1252(string $string) : string

Returns a string encoded accordingly to Rich Text Format (RTF) Specification Version 1.9.1.

Parameters
$string : string

UTF-8 encoded string

Tags
see
https://www.microsoft.com/en-us/download/details.aspx?id=10725
Return values
string

plain ASCII with RTF specific sequences for others characters

domImageToRtfImagePlaceholders()

Replace HTML image src attribut by a placeholder pointing to a cached file on disk

domImageToRtfImagePlaceholders(DOMNode $domNode) : string

The file is hex encoded in cache/files and its filename is inserted inside src, using a pattern as "##.img.hex##"

Online resources are dwnloaded and included like others images.

The real insertion is postponed and delegated to \UTILS\insertExportImages() that consumes less memory.

Parameters
$domNode : DOMNode
Return values
string

domNodeAttributes2Array()

Convert attributes of a DOMNode to an array of attributes

domNodeAttributes2Array(DOMNode $domNode) : array<string|int, string>
Parameters
$domNode : DOMNode
Return values
array<string|int, string>

arrayMonthAndSeasonNames()

Return an array of months and season names

arrayMonthAndSeasonNames(string $format[, string $locale = "en_GB" ]) : array<string|int, string>
Parameters
$format : string

Short form (short), Long form (long) (Default is 'long')

$locale : string = "en_GB"

Code of a locale (format: ll[_Script][_CC])(optional, 'en_GB' by default)

Tags
see
https://en.wikipedia.org/wiki/Ordinal_indicator
see
https://es.wikipedia.org/wiki/Indicador_ordinal

When the formatter had no value for a locale, English names re returned.

Accepted month/season numbers are:

  • 1: January
  • 2: February
  • 3: March
  • 4: April
  • 5: May
  • 6: June
  • 7: July
  • 8: August
  • 9: September
  • 10: October
  • 11: November
  • 12: December
  • 13: Spring
  • 14: Summer
  • 15: Autumn
  • 16: Winter
  • 17: Fall
Return values
array<string|int, string>

monthAndSeasonName()

Return a month or season name

monthAndSeasonName(int $number, string $format[, string $locale = "en_GB" ]) : string
Parameters
$number : int

Month or season number

$format : string

Short form (short), Long form (long) (Default is 'long')

$locale : string = "en_GB"

Code of a locale (format: ll[_Script][_CC])(optional, 'en_GB' by default)

Tags
see
https://en.wikipedia.org/wiki/Ordinal_indicator
see
https://es.wikipedia.org/wiki/Indicador_ordinal

When $number is outside the range 1 to 17, an empty string is returned.

When the formatter had no value for a locale, the English name is returned.

Accepted month/season numbers are:

  • 1: January
  • 2: February
  • 3: March
  • 4: April
  • 5: May
  • 6: June
  • 7: July
  • 8: August
  • 9: September
  • 10: October
  • 11: November
  • 12: December
  • 13: Spring
  • 14: Summer
  • 15: Autumn
  • 16: Winter
  • 17: Fall

For seasons translations are taken from Google Translate [1] or Omniglot [2].

see
https://translate.google.fr

Google Translate [1]

see
https://omniglot.com/language/time/seasons.htm

Omniglot [2]

Return values
string

cardinalToOrdinal()

Make an ordinal from a cardinal. Default is English

cardinalToOrdinal(int $number[, string $locale = "en_GB" ][, string $gender = "m" ][, string $pre = '' ][, string $post = '' ]) : string
Parameters
$number : int

Number value

$locale : string = "en_GB"

Code of a locale (format: ll[_Script][_CC])(optional, 'en_GB' by default)

$gender : string = "m"

One letter code for masculine (m), feminine (f) (optional, 'm' by default)

$pre : string = ''

Tag framing the extension of the ordinal on the left

$post : string = ''

Tag framing the extension of the ordinal on the right

Tags
see
https://en.wikipedia.org/wiki/Ordinal_indicator
see
https://es.wikipedia.org/wiki/Indicador_ordinal

When $number is negative, an empty string is returned.

Return values
string

cardinalToOrdinalWord()

Convert ordinal to word

cardinalToOrdinalWord(int $number[, string $locale = "en_GB" ][, string $gender = "m" ]) : string

This implementation is limited to the numeric range 1 to 10,000 for Latin, and to ICU spec. range for others (very high).

When a formatter is not defined or return an error, the English formatter is used instead.

When $number is negative, an empty string is returned.

Parameters
$number : int

Positive number value

$locale : string = "en_GB"

Code of a locale (format: ll[_Script][_CC])(optional, 'en_GB' by default)

$gender : string = "m"

One letter code for masculine (m), feminine (f), or neutral (n) (optional, 'm' by default)

Tags
see
https://www.saxonica.com/html/documentation10/extensibility/config-extend/localizing/ICU-numbering-dates/ICU-numbering.html
Return values
string

cardinalToOrdinalWordLatin()

Convert ordinal to word in Latin

cardinalToOrdinalWordLatin(int $number[, string $gender = "m" ]) : string

This implementation is limited to the numeric range 1 to 10,000. higher numbers are formatted with ICU English formatter instead.

When $number is negative, an empty string is returned.

Parameters
$number : int

Positive number value

$gender : string = "m"

One letter code for masculine (m), feminine (f), or neutral (n) (optional, 'm' by default)

Return values
string

cardinalToGreek()

convert cardinal (Arabic) to Greek numerals

cardinalToGreek(int $cardinal) : string

This implementation is limited to the numeric range 1 to 9,999 following the ancient greek alphabetical numeral system.

Its use is intended only for modern notation of years, centuries, or volumes ..., like Roman numbers in modern latin scripts.

When $cardinal is outside the accepted range, the empty string is returned.

Parameters
$cardinal : int
Tags
see
https://en.wikipedia.org/wiki/Greek_numerals

Greek numerals (Wikipedia)

see
https://simple.wikipedia.org/wiki/Greek_numerals

Greek numerals (Wikipedia simplified)

see
http://www.russellcottrell.com/greek/utilities/GreekNumberConverter.htm

The Greek Number Converter

see
https://www.researchgate.net/publication/2417759_From_Unicode_to_Typography_a_Case_Study_the_Greek_Script

From Unicode to Typography, a Case Study: the Greek Script, p. 16

Return values
string

cardinalToRoman()

convert cardinal (Arabic) to Roman numerals

cardinalToRoman(int $cardinal) : string

This implementation is limited to the numeric range 0 to 3,999 following the standard form of Roman numerals, plus the medieval nulla (N).

Its use is intended only for modern notation of years, centuries, or volumes ...

When $cardinal is outside the accepted range, the empty string is returned.

Parameters
$cardinal : int
Tags
see
https://en.wikipedia.org/wiki/Roman_numerals#Standard_form
Return values
string

getUuid()

Get UUID from database

getUuid(class $db) : string
Parameters
$db : class
Return values
string

$uuid

store()

Store/merge data.

store(SQL $db, string $uuid, array<string|int, mixed> $data[, bool $overwrite = FALSE ]) : bool

If $overwrite is FALSE, the data to be stored is merged with the existing data in the database.

Parameters
$db : SQL
$uuid : string
$data : array<string|int, mixed>
$overwrite : bool = FALSE

Default is FALSE

Return values
bool

FALSE if $uuid is not set or $data empty, otherwise TRUE

exists()

Check a row exists

exists(SQL $db, string $uuid) : bool
Parameters
$db : SQL
$uuid : string
Return values
bool

fetch()

Fetch data array

fetch(SQL $db, string $uuid) : array<string|int, mixed>|false
Parameters
$db : SQL
$uuid : string
Return values
array<string|int, mixed>|false

$data

fetchOne()

Fetch one array element

fetchOne(SQL $db, string $uuid, string $key) : mixed
Parameters
$db : SQL
$uuid : string
$key : string
Return values
mixed

$data FALSE if $key is not in row

delete()

Delete row

delete(SQL $db, string $uuid) : void
Parameters
$db : SQL
$uuid : string

deleteKeys()

Delete keys from the row data array

deleteKeys(SQL $db, string $uuid, array<string|int, mixed> $deleteKeys) : bool
Parameters
$db : SQL
$uuid : string
$deleteKeys : array<string|int, mixed>
Return values
bool

FALSE if row doesn't exist, otherwise TRUE

build_query()

Generate URL-encoded query string according to RFC 3986

build_query(array<string|int, mixed>|object $data) : string

This function is a wrapper for http_build_query() where $encoding_type parameter is always PHP_QUERY_RFC3986

Parameters
$data : array<string|int, mixed>|object

Array or object key-value pairs

Return values
string

escape()

Escape a component of a URL according to RFC 3986

escape(mixed $url) : string

This function attempts to split a URL into its components and recompose it after decoding and re-encoding the components.

A well-constructed URL should not suffer from this operation. Those that are malformed can be corrected but if an & character appears in the parameters, parameters may disappear.

Use the \URL\build_query() function to construct well-encoded parameters.

If $url is not a string, $url is casted to string type before escaping.

Parameters
$url : mixed

URL

Tags
see
https://www.php.net/manual/fr/function.rawurlencode.php#25182
see
http://www.faqs.org/rfcs/rfc3986.html
Return values
string

reduceUrl()

Reduce the size of long URL to keep web browser display tidy

reduceUrl(string $url[, int|null $limit = NULL ]) : string
Parameters
$url : string

URL to reduce

$limit : int|null = NULL

Max number unicode characters (Default is the value of user option 'StringLimit')

Return values
string

getCurrentProtocol()

Return the protocol requested by the HTTP client

getCurrentProtocol() : string
Return values
string

http or https (in lowercase)

getVhost()

Return the vHost name (Virtual Hostname)

getVhost() : string

Read also the special 'CLI_VHOST' constant which can be defined to simulate a vHost in CLI mode.

Return an empty string when the vHost cannot be read.

Return values
string

URL_exists()

Check that an internet resource exists

URL_exists(string $url) : bool

The resource is queried with the HTTP protocol to find out if it really exists online. The HTTP error code returned must be between 200 and 300.

Parameters
$url : string
Return values
bool

html_numeric_entity_decode()

Convert numeric HTML entities to their corresponding characters

html_numeric_entity_decode(string $str) : string

Act like html_entity_decode() builtin but converts also control characters.

Parameters
$str : string
Tags
see
https://www.december.com/html/spec/codes.html
Return values
string

mb_ucfirst()

A unicode aware replacement for ucfirst()

mb_ucfirst(string $str[, string|null $encoding = NULL ]) : string

TODO(LkpPo): remove this polyfill when PHP 8.4 will be the minimum PHP version

Parameters
$str : string
$encoding : string|null = NULL

Encoding ID Default is NULL

Tags
author

Andrea Rossato arossato@istitutocolli.org

see
ucfirst()
see
https://wiki.php.net/rfc/mb_ucfirst
Return values
string

mb_explode()

Simulate explode() for multibytes strings (as documented for PHP 7.0)

mb_explode(string $delimiter, string $string[, int|null $limit = PHP_INT_MAX ]) : array<string|int, mixed>
Parameters
$delimiter : string
$string : string
$limit : int|null = PHP_INT_MAX

Default is PHP_INT_MAX.

Return values
array<string|int, mixed>

mb_strrev()

Simulate strrev() for multibytes strings

mb_strrev(string $str) : string
Parameters
$str : string
Return values
string

mb_substr_replace()

Simulate substr_replace() for multibytes strings

mb_substr_replace(string $string, string $replacement, int $start[, int|null $length = NULL ][, string|null $encoding = NULL ]) : string
Parameters
$string : string
$replacement : string
$start : int

Start position in characters

$length : int|null = NULL

Default is NULL

$encoding : string|null = NULL

Encoding ID Default is NULL

Return values
string

mb_trim()

Multi-byte safely strip white-spaces (or other characters) from the beginning and end of a string.

mb_trim(string $string[, string $characters = "              

   …᠎" ][, string|null $encoding = NULL ]) : string
Parameters
$string : string

The string that will be trimmed.

$characters : string = "              

   …᠎"

Optionally, the stripped characters can also be specified using the $characters parameter. Simply list all characters that you want to be stripped.

$encoding : string|null = NULL

The encoding parameter is the character encoding Default is NULL

Tags
see
https://github.com/PHP-Polyfills/mb_trim/blob/main/src/mb_trim.php

TODO(LkpPo): remove this polyfill when PHP 8.4 will be the minimum PHP version

Return values
string

The trimmed string

mb_ltrim()

Multi-byte safely strip white-spaces (or other characters) from the beginning of a string.

mb_ltrim(string $string[, string $characters = "              

   …᠎" ][, string|null $encoding = NULL ]) : string
Parameters
$string : string

The string that will be trimmed.

$characters : string = "              

   …᠎"

Optionally, the stripped characters can also be specified using the $characters parameter. Simply list all characters that you want to be stripped.

$encoding : string|null = NULL

The encoding parameter is the character encoding Default is NULL

Tags
see
https://github.com/PHP-Polyfills/mb_trim/blob/main/src/mb_trim.php

TODO(LkpPo): remove this polyfill when PHP 8.4 will be the minimum PHP version

Return values
string

The trimmed string

mb_rtrim()

Multi-byte safely strip white-spaces (or other characters) from the end of a string.

mb_rtrim(string $string[, string $characters = "              

   …᠎" ][, string|null $encoding = NULL ]) : string
Parameters
$string : string

The string that will be trimmed.

$characters : string = "              

   …᠎"

Optionally, the stripped characters can also be specified using the $characters parameter. Simply list all characters that you want to be stripped.

$encoding : string|null = NULL

The encoding parameter is the character encoding Default is NULL

Tags
see
https://github.com/PHP-Polyfills/mb_trim/blob/main/src/mb_trim.php

TODO(LkpPo): remove this polyfill when PHP 8.4 will be the minimum PHP version

Return values
string

The trimmed string

listCoreMandatoryPHPExtensions()

Return an array of mandatory PHP extensions used by the WIKINDX core

listCoreMandatoryPHPExtensions() : array<string|int, string>

The name of each extension is the value of an array entry. An extension name use the same casing as get_loaded_extensions().

Return values
array<string|int, string>

listCoreOptionalPHPExtensions()

Return an array of optional PHP extensions used by the WIKINDX core

listCoreOptionalPHPExtensions() : array<string|int, string>

The name of each extension is the value of an array entry. An extension name use the same casing as get_loaded_extensions().

Return values
array<string|int, string>

OSName()

Return the normalized name of the current os

OSName() : string

Values can be:

  • "windows" for Cygwin, mingw, msys, or Windows
  • "mac" forall version of MAC OSX
  • The raw name in lowercase (a-z chars only) for others
Return values
string

matchPrefix()

Check if a prefix match against a string

matchPrefix(string $string, string $prefix[, bool $casesensitive = FALSE ]) : bool
Parameters
$string : string

A string

$prefix : string

A prefix

$casesensitive : bool = FALSE

Perform a case sensitive comparison if TRUE (FALSE by default)

Return values
bool

matchSuffix()

Check if a suffix match against a string

matchSuffix(string $string, string $suffix[, bool $casesensitive = FALSE ]) : bool
Parameters
$string : string

A string

$suffix : string

A suffix

$casesensitive : bool = FALSE

Perform a case sensitive comparison if TRUE (FALSE by default)

Return values
bool

curl_download_file_http()

Download a file from an url with HTTP

curl_download_file_http(string $url, string $file) : bool

NB: follow 32 redirects (for SourceForge) and don't check certificats and fingerprints

Parameters
$url : string

The url of a web resource

$file : string

The path of a local file

Return values
bool

TRUE if the download is successful, FALSE otherwise

uuid()

Return a (pseudo) unique string of variable length using random_bytes().

uuid([int $length = 16 ]) : string
Parameters
$length : int = 16

Length of the returned string (Default is 16)

Return values
string

createDataFolders()

Create default data folders used by the application

createDataFolders() : void

checkFileSystemPerms()

Check the permissions of various folders and files which must be writable

checkFileSystemPerms([bool $withFiles = FALSE ]) : mixed
Parameters
$withFiles : bool = FALSE

Also check file perms (Default is FALSE)

arrayCombinations()

Generate an array of all possible combinations of array values From https://stackoverflow.com/questions/10834393/php-how-to-get-all-possible-combinations-of-1d-array with minor adaptation ($space)

arrayCombinations(array<string|int, mixed> $arr, string $temp_string, string $space, array<string|int, mixed> &$collect) : void
Parameters
$arr : array<string|int, mixed>
$temp_string : string
$space : string
$collect : array<string|int, mixed>

splitDate()

Take input from HTML FORM <input type=date> and split into separate fields.

splitDate(string $dateInput) : array<string|int, mixed>

Date comes in as 'yyyy-mm-dd' (but displayed on web form as 'dd / mm / yyyy'). All three fields must have a valid value else the form input is FALSE. This should be tested before calling this function.

Parameters
$dateInput : string
Return values
array<string|int, mixed>

array(year, month, day)

balanceBraces()

Balance braces after removing noSort in resource input/edit of title or for bibTeX input

balanceBraces(string $string) : string
Parameters
$string : string
Return values
string

sumBraces()

Balance braces after removing noSort or for bibTeX input — return result of sum of open - close braces

sumBraces(string $string) : int
Parameters
$string : string
Return values
int

noSortPattern()

Create a preg pattern for checking presence of a WIKINDX_NO_SORT value at the beginning of a string.

noSortPattern([array<string|int, mixed> $noSortArray = [] ]) : string

If empty($noSortArray), then we use WIKINDX_NO_SORT (and assume that WIKINDX_NO_SORT has been checked for content). Otherwise, $noSortArray is from admin::configure::updateNoSort()

Parameters
$noSortArray : array<string|int, mixed> = []

Default is []

Return values
string

writeUserPassword()

Write a hashed version of a user password in users table

writeUserPassword(SQL $db, string $usersId, string $usersPassword) : void

Implementation history: see \UTILS\verifyUserPassword()

Parameters
$db : SQL

An SQL object

$usersId : string

A user Id

$usersPassword : string

A clear password to encrypt/hash

verifyUserPassword()

Verify that a password matches a password hash of a user

verifyUserPassword(SQL $db, string $usersId, string $usersPassword) : bool

It hides the implementation changes linked to the evolution of cryptographic techniques.

Parameters
$db : SQL

An SQL object

$usersId : string

A user Id

$usersPassword : string

A clear password to verify

Tags
see
https://www.php.net/manual/en/function.password-hash.php#124138

A goof hash renewal strategy is explained on this page: https://www.michalspacek.com/upgrading-existing-password-hashes

Unfortunately the hashes used with crypt have not been memorized and it is not possible to do the double hash step.

So the option chosen is to hash the password the next time a user connects and in a future version remove the old algorithm and reset the password for users who have never reconnected.

Implementation history

  • v1 (before 5.2.0): use crypt() with a salt generated by: strrev(time()).
  • v2 (5.2.0 to 6.3.10): use crypt() with a salt generated by: \UTF8\mb_strrev(time()).
  • v3 (from 6.4.0): use crypt() with a salt generated by: strrev(time()).
  • v4 (from 6.4.0, v35): use password_hash() with PASSWORD_DEFAULT algo without custom options.

The last version replaced the pre-PHP 5.5 crypt() function by password_hash() which has stronger defaults and is protected against time attacks.

version
4
Return values
bool

array_value_select()

Return the corresponding value of an array key or a default value

array_value_select(array<string|int, mixed> $array, mixed $key[, mixed $defaultKey = NULL ][, mixed $defaultValue = NULL ]) : mixed

This function is an access to the value of an array with fallback solutions in the event of absence.

This function is useful when it is necessary to select a value from a list and one of the inputs is also the default key or it is mandatory to obtain a consistent value at the output of the selection without having to write additional code.

Parameters
$array : array<string|int, mixed>

An array to search the key for

$key : mixed

The key whose value must be returned

$defaultKey : mixed = NULL

The default key whose value must be returned if the key was not found (NULL by default)

$defaultValue : mixed = NULL

The value returned if no key was found (NULL by default)

Create a popup link for a Help Topic on the website

createHelpTopicLink(mixed $helpTopic) : string
Parameters
$helpTopic : mixed
Return values
string

HTML link tag

canIResumeExecution()

Can I resume execution?

canIResumeExecution([int $memorySizeRemaining = 1048576 ][, int $excutionTimeRemaining = 6 ]) : bool

Says if it is possible to continue the execution of the program according to the consumption of memory and time.

Use this for memory or time intensive tasks you intend to interrupt without crash.

Say TRUE:

  • if 10 MB or less remains before the PHP max memory limit
  • or if 6 s. or less time remains before max_execution_time.

Otherwise FALSE.

NB:

  • If memory_limit option is set to -1, the memory condition is not checked.
  • If max_execution_time option is set to 0, the time condition is not checked.
Parameters
$memorySizeRemaining : int = 1048576

Memory size in bytes of remaining before the limit (Default is 10MB = 1024 * 1024 bytes)

$excutionTimeRemaining : int = 6

Execution time remaining before the max executionlimit (Default is 6 seconds)

Return values
bool

command_exists()

Does an unix command exist?

command_exists(string $command) : bool
Parameters
$command : string

Command to test with the default shell

Return values
bool

TRUE on success

insertExportImages()

Insert cached images inside exported files, and delete them

insertExportImages(string $fileName) : void

The file is written to consume as little memory as possible because the number of images can be large.

Parameters
$fileName : string

reduceLongText()

Reduce the size of long text (in select boxes usually) to keep web browser display tidy.

reduceLongText(string $text[, bool|int $override = FALSE ][, int $words = 0 ][, bool $balance = TRUE ]) : string

Optional $override allows the programmer to override the user set preferences for number of characters. If optional $words is greater than 0, then that number of words is used rather than a number of characters. If optional $balance l= TRUE, the return string is something like 'xxxx ... xxxx' else it is 'xxxx ...' (if there are chars/words removed). If $words is being used, then $balance is ignored and the first $words are returned.

Parameters
$text : string
$override : bool|int = FALSE

Default is FALSE

$words : int = 0

Default is 0

$balance : bool = TRUE

Default TRUE

Return values
string

computeBibtexKeyAuthorYear()

Generate a BibTeX citation key for one resource with format 'AuthorYear'

computeBibtexKeyAuthorYear(int $resourceId, string $creatorPrefix, string $creatorSurname, string|int $year, array<string|int, string> $bibtexKeys) : string

LkpPo(TODO): fix the max length

Parameters
$resourceId : int

Resource Id

$creatorPrefix : string

Prefix of the first creator of the resource

$creatorSurname : string

Surname of the first creator of the resource

$year : string|int

Year of publication of the resource

$bibtexKeys : array<string|int, string>

An array of existing BibTeX citation keys already stored in db

Return values
string

computeBibtexKeyAuthorID()

Generate a BibTeX citation key for one resource with format 'Author.ResourceId'

computeBibtexKeyAuthorID(int $resourceId, string $creatorPrefix, string $creatorSurname, array<string|int, string> $bibtexKeys) : string

LkpPo(TODO): fix the max length

Parameters
$resourceId : int

Resource Id

$creatorPrefix : string

Prefix of the first creator of the resource

$creatorSurname : string

Surname of the first creator of the resource

$bibtexKeys : array<string|int, string>

An array of existing BibTeX citation keys already stored in db

Return values
string

clearXmlString()

Clear forbidden characters from an XML string

clearXmlString(string $xmlstring) : string

If a forbidden character is in a XML string, PHP XML libraries crash.

This function should be used to remove forbidden characters from an XML file or string when the source in untrusted.

Parameters
$xmlstring : string

An XML string

Tags
see
https://www.w3.org/TR/REC-xml/#charsets
see
https://stackoverflow.com/questions/14463573/php-simplexml-load-file-invalid-character-error
Return values
string

validateDOI()

Validate a DOI number

validateDOI(string $string) : bool

The DOI prefix is <directoryIndicator>.<registrantCode>

The following rules apply:

  • The directory indicator can contain only numeric values. The directory indicator is usually 10 but other indicators may be designated as compliant by the DOI Foundation.

  • The registrant code can contain only numeric values and one or several full stops which are used to subdivide the code. For example: 10.1000, 10.500.100, etc. If the directory indicator is 10 then a registrant code is mandatory

Parameters
$string : string
Tags
see
DOI

Handbook, 3.2.2 DOI PREFIX, https://www.doi.org/doi-handbook/DOI_Handbook_Final.pdf

see
validateDOI()

JS function

Return values
bool

escape()

Escape strings inserted in XML

escape(mixed $value) : string

If $value is not a string, $value is casted to string type before escaping.

Parameters
$value : mixed
Return values
string

handleParams()

Handle the params array and act as a gateway to other functions

handleParams(string $method[, mixed $extra = FALSE ][, string $type = FALSE ]) : array<string|int, mixed>
Parameters
$method : string
$extra : mixed = FALSE

Default FALSE

$type : string = FALSE

Default FALSE

Return values
array<string|int, mixed>

initialiseParams()

Initialise params for each type of list.

initialiseParams(string $type, array<string|int, mixed> $extra) : array<string|int, mixed>
Parameters
$type : string
$extra : array<string|int, mixed>
Return values
array<string|int, mixed>

commonInit()

Initialise common list parameters

commonInit(array<string|int, mixed> $vars, array<string|int, mixed> $params, string $type, bool $reorder) : array<string|int, mixed>
Parameters
$vars : array<string|int, mixed>
$params : array<string|int, mixed>
$type : string
$reorder : bool
Return values
array<string|int, mixed>

qsearchInit()

Initialise qsearch parameters

qsearchInit(array<string|int, mixed> $vars, array<string|int, mixed> $params, string $type, bool $reorder) : array<string|int, mixed>
Parameters
$vars : array<string|int, mixed>
$params : array<string|int, mixed>
$type : string
$reorder : bool
Return values
array<string|int, mixed>

citeInit()

Initialise cite parameters

citeInit(array<string|int, mixed> $vars, array<string|int, mixed> $params, string $type, bool $reorder) : array<string|int, mixed>
Parameters
$vars : array<string|int, mixed>
$params : array<string|int, mixed>
$type : string
$reorder : bool
Return values
array<string|int, mixed>

basketInit()

Initialise basket parameters

basketInit(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>
Return values
array<string|int, mixed>

browseInit()

Initialise browse parameters

browseInit(array<string|int, mixed> $vars, array<string|int, mixed> $params, string $type, bool $reorder) : array<string|int, mixed>
Parameters
$vars : array<string|int, mixed>
$params : array<string|int, mixed>
$type : string
$reorder : bool
Return values
array<string|int, mixed>

ideasInit()

Initialise ideas parameters

ideasInit(array<string|int, mixed> $vars, array<string|int, mixed> $params, mixed $reorder) : array<string|int, mixed>
Parameters
$vars : array<string|int, mixed>
$params : array<string|int, mixed>
$reorder : mixed
Return values
array<string|int, mixed>

advsearchInit()

Initialise advsearch parameters

advsearchInit(array<string|int, mixed> $vars, array<string|int, mixed> $params, string $type, bool $reorder) : array<string|int, mixed>
Parameters
$vars : array<string|int, mixed>
$params : array<string|int, mixed>
$type : string
$reorder : bool
Return values
array<string|int, mixed>

advsearchForm()

Get some advsearch parameters for initialising the advsearch form

advsearchForm(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>
Return values
array<string|int, mixed>

setParams()

Set a parameter. Multiple parameters can be set.

setParams(array<string|int, mixed> $extra, array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$extra : array<string|int, mixed>
$params : array<string|int, mixed>
Return values
array<string|int, mixed>

finalize()

After completion of listing, save parameters

finalize(string $listStmt, mixed $type, array<string|int, mixed> $params) : mixed
Parameters
$listStmt : string

*param string $type

$type : mixed
$params : array<string|int, mixed>

loadStaticConfig()

Load configuration from config.php

loadStaticConfig() : array<string|int, mixed>

This function die() if a config parameter is wrong.

Return values
array<string|int, mixed>

Array of error messages

wkx_session_open()

The open callback works like a constructor in classes and is executed when the session is being opened.

wkx_session_open(string $savePath, string $sessionName) : bool

It is the first callback function executed when the session is started automatically or manually with session_start(). Return value is true for success, false for failure.

Parameters
$savePath : string
$sessionName : string
Return values
bool

wkx_session_close()

The close callback works like a destructor in classes and is executed after the session write callback has been called.

wkx_session_close() : bool

It is also invoked when session_write_close() is called. Return value should be true for success, false for failure.

Return values
bool

wkx_session_read()

The read callback must always return a session encoded (serialized) string, or an empty string if there is no data to read.

wkx_session_read(string $sessionId) : string

This callback is called internally by PHP when the session starts or when session_start() is called. Before this callback is invoked PHP will invoke the open callback.

The value this callback returns must be in exactly the same serialized format that was originally passed for storage to the write callback. The value returned will be unserialized automatically by PHP and used to populate the $_SESSION superglobal. While the data looks similar to serialize() please note it is a different format which is specified in the session.serialize_handler ini setting.

Parameters
$sessionId : string
Return values
string

wkx_session_write()

The write callback is called when the session needs to be saved and closed.

wkx_session_write(string $sessionId, string $sessionData) : bool

This callback receives the current session ID a serialized version the $_SESSION superglobal. The serialization method used internally by PHP is specified in the session.serialize_handler ini setting.

The serialized session data passed to this callback should be stored against the passed session ID. When retrieving this data, the read callback must return the exact value that was originally passed to the write callback.

This callback is invoked when PHP shuts down or explicitly when session_write_close() is called. Note that after executing this function PHP will internally execute the close callback.

Parameters
$sessionId : string
$sessionData : string
Return values
bool

wkx_session_destroy()

This callback is executed when a session is destroyed with session_destroy() or with session_regenerate_id() with the destroy parameter set to true.

wkx_session_destroy(string $sessionId) : bool

Return value should be true for success, false for failure.

Parameters
$sessionId : string
Return values
bool

wkx_session_gc()

The garbage collector callback is invoked internally by PHP periodically in order to purge old session data.

wkx_session_gc(int $maxSessionLifetime) : bool

The frequency is controlled by WIKINDX_SESSION_GC_FREQUENCY. The value of lifetime which is passed to this callback is a fallback set in session.gc_maxlifetime.

The real value of lifetime is:

  • WIKINDX_SESSION_AUTH_MAXLIFETIME for sessions which have been authenticated at least once.
  • WIKINDX_SESSION_AUTH_REMEMBERME_MAXLIFETIME for sessions which have been authenticated at least once with a "Remember Me" flag.
  • WIKINDX_SESSION_NOTAUTH_MAXLIFETIME for sessions which have never been authenticated.

Return value should be true for success, false for failure.

Parameters
$maxSessionLifetime : int

(in seconds)

Return values
bool

needUpdate()

Check if the current WIKINDX data (db and files) need an upgrade

needUpdate(object $db) : bool
Parameters
$db : object

An SQL object

Return values
bool

existsTableVersion()

Check if 'version' table that stores the version number of the db schema exists

existsTableVersion(object $db) : bool

Check also the old names of the version table.

This function is used only during the upgrade process.

Parameters
$db : object

An SQL object

Return values
bool

getCoreInternalVersion()

Return the internal version stored in the database of the core

getCoreInternalVersion(object $db) : float

This function is used only during the upgrade process, and the value should be looked up in the field regardless of the version.

Parameters
$db : object

An SQL object

Return values
float

setCoreInternalVersion()

Write an internal version in the database of a component or the core

setCoreInternalVersion(object $db[, string $version = NULL ]) : mixed

This function is used only during the upgrade process, and the value should be written in the field regardless of the version.

If $version is NULL, the version number used it 0.0.

Parameters
$db : object

An SQL object

$version : string = NULL

(Default is NULL)

getComponentInternalVersion()

Return the internal version of a component stored in the database

getComponentInternalVersion(object $db, string $ComponentType, string $ComponentId) : float

This function is used only during the upgrade process or when a component is installed, and the value should be looked up in the field regardless of the version.

Parameters
$db : object

An SQL object

$ComponentType : string

Type of a component

$ComponentId : string

Id of a component

Return values
float

setComponentInternalVersion()

Write an internal version of a component in the database

setComponentInternalVersion(object $db, string $ComponentType, string $ComponentId[, string $version = NULL ]) : mixed

This function is used only during the upgrade process or when a component is installed, and the value should be written n the field regardless of the version.

If $version is NULL, the version number used it 0.0.

Parameters
$db : object

An SQL object

$ComponentType : string

Type of a component

$ComponentId : string

Id of a component

$version : string = NULL

(Default is NULL)

deleteComponentInternalVersion()

Delete an internal version of a component from the database

deleteComponentInternalVersion(object $db, string $ComponentType, string $ComponentId) : mixed

This function is used only during the upgrade process or when a component is uninstalled, and the value should be written n the field regardless of the version.

Parameters
$db : object

An SQL object

$ComponentType : string

Type of a component

$ComponentId : string

Id of a component

existsSuperadminAccount()

Check if 'users' table has not been filled with the superadmin account

existsSuperadminAccount(object $db) : bool

This function is used only during the upgrade process.

Parameters
$db : object

An SQL object

Return values
bool

getConfigContactEmail()

Return the configContactEmail depending on the software version

getConfigContactEmail(object $db) : float

This function is used only during the upgrade process, and the value should be looked up in the field regardless of the version.

Parameters
$db : object

An SQL object

Return values
float

logonCheckUpgradeDB()

Initial logon to the system when upgrading the database.

logonCheckUpgradeDB(object $db, string $username, string $password) : bool
Parameters
$db : object

An SQL object

$username : string
$password : string
Return values
bool

TRUE if able to authenticate

wkx_error_handler()

Custom PHP errors handler

wkx_error_handler(int $errno, string $errstr, string $errfile, int $errline) : bool

cf. https://www.php.net/manual/fr/function.set-error-handler.php

The $errcontext parameter is not used because it is deprecated since PHP 7.2 It is no longer possible to know the context of the error. Instead we use the debug_print_backtrace() function.

NB: fatal errors like ‘parse error’ are still written in the log defined by error_log php.ini option because this handler cannot be called in that case.

Parameters
$errno : int

PHP error code

$errstr : string

PHP error message

$errfile : string

File or script where the error occurred

$errline : int

Error line number

Return values
bool

wkx_error_log()

Write a message to the application log

wkx_error_log(mixed $Message) : void

When the application is not yet configured, the message is written to the log defined by php.ini.

Parameters
$Message : mixed

Message

wkx_clear_error_log()

Remove expired error logs (14 days max) and limit their size to 25 MB by file

wkx_clear_error_log() : mixed

buildUpgradePage()

buildUpgradePage(string $body) : mixed
Parameters
$body : string

        
On this page

Search results