wikindx
Packages
Interfaces, Classes, Traits and Enums
- ENDNOTEMAP
- Endnote Map class.
- EXPORTCOMMON
- EXPORT COMMON class
- RISMAP
- RIS Map class.
- FILETOTEXT
- Convert files of various types to text ready for searching.
- FileManager
- FileManager
- FileServer
- FileServer
- Location
- Location
- EncodeExplorer
- EncodeExplorer
- MESSAGES
- MESSAGES class (English)
- HIGHLIGHT
- HIGHLIGHT class.
- LISTSESSION
- LISTSESSION class
- PASSWORD
- PASSWORD class.
- LOADPLUGINS
- LOADPLUGINS class for third-party plug-in modules in the WIKINDX_DIR_COMPONENT_PLUGINS directory
Table of Contents
- 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() : mixed
- Add creators
- findSubsequentFootnoteTemplates() : mixed
- 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
- 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
- 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() : mixed
- 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() : mixed
- 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.
- editorSwitch() : bool
- Set any author/editor re-ordering for book and book_article type.
- formatCreators() : mixed
- 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() : 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() : int|string
- Format edition (might not be numeric)
- getOrdinalExtensionAlignment() : 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() : mixed
- 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() : mixed
- add delimiters to creators
- formatMultiplePages() : mixed
- 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() : mixed
- Map independent fields of templates.
- mapTemplatePlurals() : array<string|int, mixed>
- Deal with singular/plural dependencies for fields such as pages and creators
- replaceWhitespace() : string
- Replace ASCII whitespace with locale's whitespace character(s) Callback
- removeSlashes() : string
- Remove slashes depending upon output: used for removeSlashes()
- stripTemplateBackticks() : mixed
- Strip backticks used in template
- ordinals() : string
- format ordinals
- findAmbiguity() : array<string|int, mixed>
- Identify ous 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() : mixed
- Generic code for setting justification
- setLineSpace() : mixed
- Generic code for setting line height
- setIndentation() : mixed
- Generic code for setting indentation
- setFontSize() : mixed
- 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() : mixed
- 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() : bool
- 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() : mixed
- Format pages.
- formatCreators() : mixed
- Format creator name lists (authors, editors, etc.)
- replacementYears() : array<string|int, mixed>
- Add replacement years fields to templates
- copyYearAlternates() : mixed
- Copy any alternates relating to pre and post fields from the 'year' field to 'year1' and 'year2' fields
- parseIndependent() : mixed
- Parse independent strings of new templates
- compileTemplates() : array<string|int, mixed>
- Compile in-text and endote-style citation templates
- addAmbiguity() : string
- Add any ambiguity letter to year field. Only for in-text citations
- formatYear() : mixed
- 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() : string
- 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() : mixed
- Mark blockquotes.
- blockQuote2() : mixed
- 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() : mixed
- 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() : mixed
- Append common (Latin) bibliographic abbreviations
- 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.
- loadDir() : array<string|int, mixed>
- Read ROOT_DIR directory for XML style files and return an associative array. Each XML file should be within its own folder within ROOT_DIR. This folder name should match the first part of the XML file name e.g.
- loadStyleInfo() : associative
- Extract info entries from a XML bibliographic style file and return an associative array of childnode's value of 'info' node.
- arrayMonthAndSeasonNames() : array<string|int, string>
- Return an array of months and season names
- monthAndSeasonName() : string
- Return a month or season name
- cardinalToOrdinal() : string|bool
- 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
- loadJavascript() : mixed
- 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() : mixed
- echo JSON error or return if none.
- 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
- setHeaders() : mixed
- 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() : mixed
- Copy recursively a folder
- recurse_rmdir() : mixed
- Remove recursively a folder
- rmfile() : mixed
- 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() : mixed
- 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() : null|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() : mixed
- Encode a file with base64 as an other file
- base64_decode_file() : mixed
- Encode a file with base64 as an other file
- bin2hex_encode_file() : mixed
- Encode a file with bin2hex as an other file
- _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
- hiddenNoJS() : string
- print hidden form input without JavaScript action
- radioButton() : string
- print radio button
- checkbox() : string
- print checkbox
- 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
- 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
- reduceLongText() : string
- reduce the size of long text (in select boxes usually) to keep web browser display tidy
- _inlineHtmlAttribute() : string
- Build a string for insertion of an HTML tag attribute.
- h() : string
- <Hx> heading element
- div() : string
- <DIV> element
- iframe() : string
- <IFRAME> element
- p() : string
- <P> element
- pBrowse() : string
- <P> element
- ul() : string
- <UL> element
- ol() : string
- <OL> element
- li() : string
- <LI> element
- hr() : string
- <HR> element
- mark() : string
- <mark> element
- 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
- aName() : 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
- cssInline() : string
- Inlining CSS code
- 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
- nlToHtml() : string
- replace newlines and carriage returns with appropriate HTML code.
- htmlToNl() : string
- replace HTML newlines and carriage returns with appropriate ANSI code.
- removeNl() : string
- remove all newlines.
- dbToFormTidy() : string
- Format text grabbed from database for printing to form elements.
- dbToHtmlTidy() : string
- Format text grabbed from database for printing to HTML (should be just where the original input was from text input elements).
- dbToHtmlPopupTidy() : string
- Format text grabbed from database for printing to HTML popups.
- stripHtml() : string
- Strip HTML from string
- dbToTinyMCE() : string
- Format text grabbed from database for printing to tinyMCE form elements.
- 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)
- 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.
- load_locales() : 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() : mixed
- Get a list of translatable locales sorted by locale name
- searchLanguageCode() : mixed
- Return the language code matching a language name
- sort() : mixed
- Sort an array according to the current Intl locale in ascending order
- asort() : mixed
- Sort an array according to the current Intl locale in ascending order and maintain index association
- ksort() : mixed
- Sort an array according to the current Intl locale in ascending order and maintain index association
- rsort() : mixed
- Sort an array according to the current Intl locale in descending order
- arsort() : mixed
- Sort an array according to the current Intl locale in descending order and maintain index association
- krsort() : mixed
- Sort an array according to the current Intl locale in descending order and maintain index association
- messageTranslatorNeeded() : mixed
- Return a message if the project need translation contribution for the current locale
- 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() : 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
- getUuid() : string
- Get UUID from database
- store() : bool
- Store/merge data
- exists() : bool
- Check a row exists
- fetch() : array<string|int, mixed>
- Fetch data array
- fetchOne() : mixed
- Fetch one array element
- delete() : mixed
- Delete row
- deleteKeys() : bool
- Delete keys from the row data array
- 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_str_word_count() : int|array<string|int, string>
- count UTF-8 words in a string
- mb_explode() : string
- Simulate explode() for multibytes strings (as documented for PHP 7.0)
- mb_str_pad() : string
- Simulate str_pad() for multibytes strings
- mb_strcasecmp() : string
- Simulate strcasecmp() for multibytes strings
- mb_strrev() : string
- Simulate strrev() for multibytes strings
- mb_substr_replace() : string
- Simulate substr_replace() for multibytes strings
- mb_trim() : string
- Code by Ben XO at https://www.php.net/manual/en/ref.mbstring.php
- 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
- readComponentsList() : array<string|int, mixed>
- Read and return the list of all components installed
- writeComponentsList() : mixed
- Write a list of components from an array
- refreshComponentsListCache() : mixed
- 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() : mixed
- 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()
- hash_path() : string
- Generates a hash of a file or directory at the given path with the specified algo.
- 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().
- checkFoldersPerms() : mixed
- Check the permissions of various folders and files which must be writable
- arrayCombinations() : mixed
- 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() : mixed
- 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?
- suhosin_function_exists() : bool
- Does a function exist or is enabled with (or without) the suhosin security extension?
- insertExportImages() : mixed
- Insert cached images inside exported files, and delete them
- 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
- getPluginInternalVersion() : float
- Return the internal version stored in the database of a plugin
- setPluginInternalVersion() : mixed
- Write an internal version in the database of a plugin
- 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.
Functions
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(object $messages, 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
- $messages : object
- $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, object &$items, array<string|int, mixed> $flags) : mixed
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 : object
- $flags : array<string|int, mixed>
Return values
mixed —findSubsequentFootnoteTemplates()
Find examples of ibid, idem, and opCit footnote templates.
findSubsequentFootnoteTemplates(array<string|int, mixed> &$footnotes, string $citeType) : mixed
If using endnotes that use the same ID for the same resource, set only to templateEndnote.
Parameters
- $footnotes : array<string|int, mixed>
- $citeType : string
Return values
mixed —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, array<string|int, mixed> $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 : array<string|int, mixed>
- $template : array<string|int, mixed>
- $allPuncPattern : string
- $item : array<string|int, mixed>
- $flags : array<string|int, mixed>
Return values
array<string|int, mixed> —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
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> —addLinks()
Add link items such as URL and DOI
addLinks(string $item, array<string|int, mixed> $flags) : string
Parameters
- $item : string
- $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, array<string|int, mixed> $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 : array<string|int, mixed>
- $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, array<string|int, mixed> $styleLocalisation, array<string|int, mixed> $bibStyle, int $startDay, int $startMonth, int $endDay, int $endMonth) : string
Parameters
- $localBibType : array<string|int, mixed>
- $styleLocalisation : array<string|int, mixed>
- $bibStyle : array<string|int, mixed>
- $startDay : int
- $startMonth : int
- $endDay : int
- $endMonth : int
Return values
string —formatDate()
formatDate(mixed $startDay, mixed $endDay, mixed $startMonth, mixed $endMonth, mixed $monthArray, mixed $bibStyle) : mixed
Parameters
- $startDay : mixed
- $endDay : mixed
- $startMonth : mixed
- $endMonth : mixed
- $monthArray : mixed
- $bibStyle : mixed
Return values
mixed —formatDay()
Format the day part of a date
formatDay(int $startDay, int $endDay, array<string|int, mixed> $bibStyle, string $styleLocalisation) : array<string|int, mixed>
Parameters
- $startDay : int
- $endDay : int
- $bibStyle : array<string|int, mixed>
- $styleLocalisation : string
Return values
array<string|int, mixed> —addRunningTime()
Add and format running time (films, TV etc.)
addRunningTime(object $messages, array<string|int, mixed> $styleLocalisation, array<string|int, mixed> $bibStyle, array<string|int, mixed> $data) : string
Parameters
- $messages : object
- $styleLocalisation : array<string|int, mixed>
- $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(object $localBibType, array<string|int, mixed> $resourceData, array<string|int, mixed> $items) : array<string|int, mixed>
Parameters
- $localBibType : object
- $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) : mixed
Parameters
- $resource : array<string|int, mixed>
- $type : string
Return values
mixed —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>
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> —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> &$creators, string $type) : bool
If required, we unset the 'authors' element in template, set resourcecreatorRole to 1, and copy the editorSwtich template to the 'authors' element so that the primary creator name formatting settings are used. Seeting 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>
- $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, object &$items, array<string|int, mixed> $flags) : mixed
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 : object
- $flags : array<string|int, mixed>
Return values
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 $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
- $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> $data, string $type, array<string|int, mixed> $items) : mixed
Custom fields are a type of metadata so could be formatted with HTML. This must be stripped.
Parameters
- $customTypes : array<string|int, mixed>
- $data : array<string|int, mixed>
- $type : string
- $items : array<string|int, mixed>
Return values
mixed —formatRunningTime()
Format running time for audiovisual bibliography items
formatRunningTime(object $messages, array<string|int, mixed> $styleLocalisation, array<string|int, mixed> $bibStyle, int $hours, int $minutes, int $seconds, int $milliseconds) : string
Parameters
- $messages : object
- $styleLocalisation : array<string|int, mixed>
- $bibStyle : array<string|int, mixed>
- $hours : int
- $minutes : int
- $seconds : int
- $milliseconds : int
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 entires 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(int|string $edition, array<string|int, mixed> $bibStyle, string $styleLocalisation) : int|string
Parameters
- $edition : int|string
- $bibStyle : array<string|int, mixed>
- $styleLocalisation : string
Return values
int|string —getOrdinalExtensionAlignment()
getOrdinalExtensionAlignment(int $alignment) : mixed
Parameters
- $alignment : int
Return values
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 $styleMap, array<string|int, mixed> $template, array<string|int, mixed> $fallbacks, string $type) : array<string|int, mixed>
Parameters
- $styleMap : object
- $template : array<string|int, mixed>
- $fallbacks : array<string|int, mixed>
- $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> $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>
- $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) : mixed
Parameters
- $cTemplate : array<string|int, mixed>
- $string : string
- $output : string
- $replaceFormatting : bool
Return values
mixed —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
Return values
mixed —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
Return values
string —Formatted string of initials.
hyphenatedInitials()
Deal with hyphenated firstnames as initials
hyphenatedInitials(string $hyphenated, int $initialsStyle) : string
'Jean-Pierre' should become 'J.-P.'
Parameters
- $hyphenated : string
- $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) : mixed
Parameters
- $style : array<string|int, mixed>
- $cArray : array<string|int, mixed>
- $delimitTwo : string
- $delimitFirstBetween : string
- $delimitNextBetween : string
- $delimitLast : string
Return values
mixed —formatMultiplePages()
Format multiple pages.
formatMultiplePages(int $pageFormat, int $rangeDelimiter, string $start, string $end) : mixed
$this->style['pageFormat']: 0 == 132-9 1 == 132-39 2 == 132-139
Parameters
- $pageFormat : int
- $rangeDelimiter : int
- $start : string
-
Page start.
- $end : string
-
Page end.
Return values
mixed —titleCapitalization()
Do title capitalization
titleCapitalization(string $pString, string $delimitLeft, string $delimitRight[, int $CondCapitalization = 1 ]) : string
Parameters
- $pString : string
-
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) : mixed
Check for independent characters. These (should) come in pairs.
Parameters
- $independent : array<string|int, mixed>
- $itemArray : array<string|int, mixed>
Return values
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) Callback
replaceWhitespace(string $input, string $citeLocalisation) : string
Parameters
- $input : string
- $citeLocalisation : string
Return values
string —removeSlashes()
Remove slashes depending upon output: used for removeSlashes()
removeSlashes(string $element, string $output) : string
Parameters
- $element : string
- $output : string
Return values
string —stripTemplateBackticks()
Strip backticks used in template
stripTemplateBackticks(string $pre, mixed $post) : mixed
Parameters
- $pre : string
- $post : mixed
Return values
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 ous 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) : mixed
Parameters
- $input : string
Return values
mixed —setLineSpace()
Generic code for setting line height
setLineSpace(string $input) : mixed
Parameters
- $input : string
Return values
mixed —setIndentation()
Generic code for setting indentation
setIndentation(string $input[, mixed $bq = FALSE ]) : mixed
Parameters
- $input : string
- $bq : mixed = FALSE
Return values
mixed —setFontSize()
Generic code for setting font size
setFontSize(string $input) : mixed
Parameters
- $input : string
Return values
mixed —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
Return values
mixed —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, string $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 : string
- $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, array<string|int, mixed> $itemArray, array<string|int, mixed> $flags, mixed $hyperlinkBase) : array<string|int, mixed>
Parameters
- $citation : array<string|int, mixed>
- $cIndex : int
- $styleCitation : array<string|int, mixed>
- $itemArray : array<string|int, mixed>
- $flags : array<string|int, mixed>
- $hyperlinkBase : mixed
Return values
array<string|int, mixed> —hyperlinkCitation()
Hyperlink the citation text
hyperlinkCitation(mixed &$citeText, int $id, string $hyperlinkBase) : mixed
Parameters
- $citeText : mixed
- $id : int
- $hyperlinkBase : string
Return values
mixed —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, mixed $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 : mixed
- $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) : bool
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
Return values
bool —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, object &$item[, bool $footnotes = FALSE ][, string $field = 'pages' ]) : mixed
If $footnotes is TRUE, these are pages for short footnotes
Parameters
- $styleCitation : array<string|int, mixed>
- $pages : string
- $item : object
- $footnotes : bool = FALSE
-
Default FALSE
- $field : string = 'pages'
-
Default 'pages'
Return values
mixed —formatCreators()
Format creator name lists (authors, editors, etc.)
formatCreators(array<string|int, mixed> $creators, array<string|int, mixed> $styleCitation, string $citeLocalisation, object &$item, array<string|int, mixed> $resIds, int $resId) : mixed
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 : object
- $resIds : array<string|int, mixed>
- $resId : int
Return values
mixed —replacementYears()
Add replacement years fields to templates
replacementYears(string $template, array<string|int, mixed> $style, array<string|int, mixed> $styleMap) : array<string|int, mixed>
Parameters
- $template : string
- $style : array<string|int, mixed>
- $styleMap : array<string|int, mixed>
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) : mixed
Parameters
- $yearField : string
- $newTemplate : array<string|int, mixed>
Return values
mixed —parseIndependent()
Parse independent strings of new templates
parseIndependent(array<string|int, mixed> &$template) : mixed
Parameters
- $template : array<string|int, mixed>
Return values
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) : string
Parameters
- $styleCitation : array<string|int, mixed>
- $item : array<string|int, mixed>
- $citation : array<string|int, mixed>
Return values
string —formatYear()
Format years for citations
formatYear(array<string|int, mixed> $styleCitation, array<string|int, mixed> &$item, array<string|int, mixed> $resource) : mixed
Parameters
- $styleCitation : array<string|int, mixed>
- $item : array<string|int, mixed>
- $resource : array<string|int, mixed>
Return values
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(string $styleCitation, string $sentence, object &$templateField, array<string|int, mixed> $resIds, int $resId, int $resIdsIndex, string $currentPages, string $previousPages) : string
We don't have all information yet to make further decisions (e.g., creator's name).
Parameters
- $styleCitation : string
- $sentence : string
- $templateField : object
- $resIds : array<string|int, mixed>
- $resId : int
- $resIdsIndex : int
- $currentPages : string
- $previousPages : string
Return values
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, space $cInitialPunc, string $spaceRaw, string $space) : array<string|int, mixed>
Parameters
- $creators : array<string|int, mixed>
- $citeLocalisation : string
- $cInitialPunc : space
- $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) : mixed
This is only used when exporting a document (e.g., from the word processor)
Parameters
- $matches : array<string|int, mixed>
-
return string
Return values
mixed —blockQuote2()
Format blockquotes and ensure tailend bits are part of it .
blockQuote2(string $text, string $citeLocalisation, string $space) : mixed
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
mixed —blockQuoteSort()
Sort the blockQuote array by length so that the preg_replace works as expected
blockQuoteSort(array<string|int, mixed> $a, string $b) : string
Parameters
- $a : array<string|int, mixed>
- $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:
- No paragraph start at beginning of sentence (but there could be).
- 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) : mixed
Parameters
- $array : array<string|int, mixed>
Return values
mixed —getType()
Return an array containing the most used grammar types of a locale
getType([string $locale = "en" ][, string $type = "" ]) : array<string|int, string>
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
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
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.
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 stings end up in the regexp as the first matches tried. Particularly important if using similar characters as in English.
Tags
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
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 the 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. might be required.
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> —abbreviationsAppend()
Append common (Latin) bibliographic abbreviations
abbreviationsAppend(mixed $array) : mixed
Parameters
- $array : mixed
Tags
Return values
mixed —format()
Format for HTML or RTF/plain?
format(string $data, string $outputFormat[, int $citeId = FALSE ][, int $bibId = FALSE ]) : string
Parameters
- $data : string
-
Input string
- $outputFormat : string
-
One of 'wikindx', 'html', 'ooxml', 'wp', 'plain', 'rtf'
- $citeId : int = FALSE
-
Default FALSE (Only present and used if formatting a citation for 'wikindx' or 'html' output)
- $bibId : int = 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 —loadDir()
Read ROOT_DIR directory for XML style files and return an associative array. Each XML file should be within its own folder within ROOT_DIR. This folder name should match the first part of the XML file name e.g.
loadDir([bool $all = FALSE ]) : array<string|int, mixed>
apa/apa.xml or chicago/chicago.xml.
CONSTANTS.php stores WIKINDX_COMPONENTS_COMPATIBLE_VERSION["style"] -- the osbibVersion field of the style XML file must equal this.
Parameters
- $all : bool = FALSE
-
If TRUE, force the loading of all styles
Return values
array<string|int, mixed> —Sorted associative array - keys = filename (less '.xml'), values = Style description.
loadStyleInfo()
Extract info entries from a XML bibliographic style file and return an associative array of childnode's value of 'info' node.
loadStyleInfo(string $file) : associative
This function is taylored by hand to replace the generic parser simplexml_load_file. SimpleXml is very simple to use, but is so slow that parse each style file of WIKINDX implies a waste of 100 ms in each load.
This function is closed to a determined tree node as showed below:
<style xml:lang="en">Parameters
- $file : string
-
Location of a StyleFile
Return values
associative —array - keys = name, description, language, osbibversion
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
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
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|bool
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
Return values
string|bool —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)
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
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
Return values
string —loadJavascript()
Load the ajax javascript and the user javascript(s) into the HTML page output.
loadJavascript([mixed $scripts = FALSE ]) : mixed
Parameters
- $scripts : mixed = FALSE
-
Either an array of .js scripts to load or a single string. It can be FALSE.
Return values
mixed —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) : mixed
Parameters
- $type : string
Return values
mixed —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
setHeaders()
Set download headers
setHeaders(string $type, int $size, string $filename, string $lastmodified[, string $mode = 'inline' ][, string $charset = '' ]) : mixed
Parameters
- $type : string
- $size : int
- $filename : string
- $lastmodified : string
- $mode : string = 'inline'
-
'inline' or 'attachment' ('attachment' forces the download)
- $charset : string = ''
-
Default is ''
Return values
mixed —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) : mixed
Parameters
- $src : string
-
Source directory
- $dst : string
-
Destination directory
Return values
mixed —recurse_rmdir()
Remove recursively a folder
recurse_rmdir(string $dir) : mixed
Parameters
- $dir : string
-
Target directory
Return values
mixed —rmfile()
Remove a file
rmfile(string $file) : mixed
Parameters
- $file : string
-
Target filename
Return values
mixed —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[, false|int $index = FALSE ]) : bool
Parameters
- $dirName : string
- $name : string
- $index : false|int = 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() : mixed
Return values
mixed —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) : null|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
Return values
null|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
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 —base64_encode_file()
Encode a file with base64 as an other file
base64_encode_file(string $fsrc, string $fdst) : mixed
Parameters
- $fsrc : string
-
An absolute or relative file path as source
- $fdst : string
-
An absolute or relative file path as destination
Tags
Return values
mixed —base64_decode_file()
Encode a file with base64 as an other file
base64_decode_file(string $fsrc, string $fdst) : mixed
Parameters
- $fsrc : string
-
An absolute or relative file path as source
- $fdst : string
-
An absolute or relative file path as destination
Tags
Return values
mixed —bin2hex_encode_file()
Encode a file with bin2hex as an other file
bin2hex_encode_file(string $fsrc, string $fdst) : mixed
Parameters
- $fsrc : string
-
An absolute or relative file path as source
- $fdst : string
-
An absolute or relative file path as destination
Return values
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 = ''
- $value : string = ''
-
Default is ''
Return values
string —formHeader()
print form header with hidden action field
formHeader(string $action[, string $js = '' ]) : string
$js is for javascript functions
Parameters
- $action : string
- $js : string = ''
-
Default is ''
Return values
string —formHeaderVisibleAction()
print form header with visible action field -- typically used for tinyMCE popups
formHeaderVisibleAction(string $action, string $name[, string $js = '' ]) : string
$js is for javascript functions
Parameters
- $action : string
- $name : string
- $js : string = ''
-
Default is ''
Return values
string —formHeaderName()
print form header with hidden action field and name and id fields
formHeaderName(string $action, string $name[, string $js = '' ]) : string
js is for javascript functions
Parameters
- $action : string
- $name : string
- $js : string = ''
-
Default is ''
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([string $value = FALSE ][, string $name = FALSE ][, string $js = '' ]) : string
Parameters
- $value : string = FALSE
-
Default is FALSE
- $name : string = 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(string $value[, string $name = FALSE ][, string $js = '' ]) : string
Parameters
- $value : string
-
Default is FALSE
- $name : string = 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 —hiddenNoJS()
print hidden form input without JavaScript action
hiddenNoJS(string $name, string $value) : string
Parameters
- $name : string
- $value : string
Return values
string —radioButton()
print radio button
radioButton(string $label, string $name[, string $value = FALSE ][, string $checked = FALSE ][, string $js = '' ]) : string
Parameters
- $label : string
- $name : string
- $value : string = FALSE
-
Default is FALSE
- $checked : string = FALSE
-
Default is FALSE
- $js : string = ''
-
Default is ''
Return values
string —checkbox()
print checkbox
checkbox(string $label, string $name[, string $checked = FALSE ][, string $title = '' ][, string $js = '' ]) : string
Parameters
- $label : string
- $name : string
- $checked : string = FALSE
-
Default is FALSE
- $title : string = ''
-
Default is ''
- $js : string = ''
-
Default is ''
Return values
string —selectFBox()
create select boxes for HTML forms
selectFBox(string $label, string $name, array<string|int, mixed> $array[, int $size = 3 ][, int $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
- $label : string
- $name : string
- $array : array<string|int, mixed>
- $size : int = 3
-
Default is 3
- $override : int = FALSE
-
Default is FALSE
- $js : string = ''
-
Default is ''
Return values
string —selectedBox()
create select boxes for HTML forms
selectedBox(string $label, string $name, array<string|int, mixed> $array, string $select[, int $size = 3 ][, int $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
- $label : string
- $name : string
- $array : array<string|int, mixed>
- $select : string
- $size : int = 3
-
Default is 3
- $override : int = FALSE
-
Default is FALSE
- $js : string = ''
-
Default is ''
Return values
string —selectFBoxValue()
create select boxes for HTML forms
selectFBoxValue(string $label, string $name, array<string|int, mixed> $array[, int $size = 3 ][, int $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
- $label : string
- $name : string
- $array : array<string|int, mixed>
- $size : int = 3
-
Default is 3
- $override : int = FALSE
-
Default is FALSE
- $js : string = ''
-
Default is ''
Return values
string —selectedBoxValue()
create select boxes for HTML forms
selectedBoxValue(string $label, string $name, array<string|int, mixed> $array, string $select[, int $size = 3 ][, int $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
- $label : string
- $name : string
- $array : array<string|int, mixed>
- $select : string
- $size : int = 3
-
Default is 3
- $override : int = FALSE
-
Default is FALSE
- $js : string = ''
-
Default is ''
Return values
string —selectFBoxValueMultiple()
create select boxes for HTML forms
selectFBoxValueMultiple(string $label, string $name, array<string|int, mixed> $array[, int $size = 3 ][, int $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
- $label : string
- $name : string
- $array : array<string|int, mixed>
- $size : int = 3
-
Default is 3
- $override : int = FALSE
-
Default is FALSE
- $js : string = ''
-
Default is ''
Return values
string —selectedBoxValueMultiple()
create select boxes for HTML forms
selectedBoxValueMultiple(string $label, string $name, array<string|int, mixed> $array, array<string|int, mixed> $values[, int $size = 3 ][, int $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
- $label : string
- $name : string
- $array : array<string|int, mixed>
- $values : array<string|int, mixed>
- $size : int = 3
-
Default is 3
- $override : int = FALSE
-
Default is FALSE
- $js : string = ''
-
Default is ''
Return values
string —passwordInput()
password input type
passwordInput(string $label, string $name[, string $value = FALSE ][, int $size = 20 ][, int $maxLength = 255 ][, string $js = '' ]) : string
Parameters
- $label : string
- $name : string
- $value : string = FALSE
-
Default is FALSE
- $size : int = 20
-
Default is 20
- $maxLength : int = 255
-
Default is 255
- $js : string = ''
-
Default is ''
Return values
string —textInput()
text input type
textInput(string $label, string $name[, string $value = FALSE ][, int $size = 20 ][, int $maxLength = 255 ][, string $js = '' ]) : string
Parameters
- $label : string
- $name : string
- $value : string = 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 $label, string $name[, string $value = FALSE ][, string $js = '' ]) : string
Parameters
- $label : string
- $name : string
- $value : string = FALSE
-
Default is FALSE
- $js : string = ''
-
Default is ''
Return values
string —textareaInput()
textarea input type
textareaInput(string $label, string $name[, string $value = FALSE ][, int $cols = 30 ][, int $rows = 5 ][, string $js = '' ]) : string
Parameters
- $label : string
- $name : string
- $value : string = 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 $label, string $name[, string $value = FALSE ][, int $cols = 30 ][, int $rows = 5 ][, string $js = '' ]) : string
Parameters
- $label : string
- $name : string
- $value : string = 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 $label, string $name[, string $value = FALSE ][, int $cols = 30 ][, int $rows = 5 ][, string $js = '' ]) : string
Parameters
- $label : string
- $name : string
- $value : string = 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 $label, string $name[, int $size = 20 ][, string $accept = "" ][, string $js = '' ]) : string
Parameters
- $label : string
- $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 $label, array<string|int, mixed> $name[, int $size = 20 ][, string $accept = "" ][, string $js = '' ]) : string
Parameters
- $label : string
- $name : array<string|int, mixed>
- $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 $label, string $name[, string $value = FALSE ][, string $js = '' ]) : string
Parameters
- $label : string
- $name : string
- $value : string = FALSE
-
Default is FALSE
- $js : string = ''
-
Default is ''
Return values
string —reduceLongText()
reduce the size of long text (in select boxes usually) to keep web browser display tidy
reduceLongText(string $text[, string $override = FALSE ]) : string
optional $override allows the programmer to override the user set preferences
Parameters
- $text : string
- $override : string = FALSE
-
Default is FALSE
Return values
string —_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([string $data = '' ][, string $class = '' ][, int $level = 4 ]) : string
Parameters
- $data : string = ''
-
Default is ''
- $class : string = ''
-
Default is ''
- $level : int = 4
-
Default is 4
Return values
string —div()
<DIV> element
div(int $id[, string $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 : int
- $data : string = ''
-
Default is ''
- $class : string = ''
-
Default is ''
Return values
string —iframe()
<IFRAME> element
iframe(int $id[, string $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 : int
- $data : string = ''
-
Default is ''
- $class : string = ''
-
Default is ''
Return values
string —p()
<P> element
p([string $data = '' ][, string $class = '' ][, string $align = 'left' ]) : string
Parameters
- $data : string = ''
-
Default is ''
- $class : string = ''
-
Default is ''
- $align : string = 'left'
-
Default is 'left'
Return values
string —pBrowse()
<P> element
pBrowse([string $data = '' ][, string $class = '' ]) : string
for browsing creators, collections etc. (tag colour) where a background colour needs to be specified
Parameters
- $data : string = ''
-
Default is ''
- $class : string = ''
-
Default is ''
Return values
string —ul()
<UL> element
ul([string $data = '' ][, string $class = '' ]) : string
Parameters
- $data : string = ''
-
Default is ''
- $class : string = ''
-
Default is ''
Return values
string —ol()
<OL> element
ol([string $data = '' ][, string $class = '' ]) : string
Parameters
- $data : string = ''
-
Default is ''
- $class : string = ''
-
Default is ''
Return values
string —li()
<LI> element
li([string $data = '' ][, string $class = '' ]) : string
Parameters
- $data : string = ''
-
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(string $data) : string
Parameters
- $data : string
Return values
string —span()
<SPAN> element
span([string $data = '' ][, string $class = '' ][, string $title = '' ][, string $js = '' ]) : string
Parameters
- $data : string = ''
-
Default is ''
- $class : string = ''
-
Default is ''
- $title : string = ''
-
Default is ''
- $js : string = ''
-
Default is ''
Return values
string —color()
<SPAN color> element
color([string $data = '' ][, string $class = 'blackText' ]) : string
Parameters
- $data : string = ''
-
Default is ''
- $class : string = 'blackText'
-
Default is 'blackText'
Return values
string —strong()
<STRONG> element (Semantic equivalent of <B>)
strong([string $data = '' ][, string $class = '' ]) : string
Parameters
- $data : string = ''
-
Default is ''
- $class : string = ''
-
Default is ''
Return values
string —em()
<EM> element (Semantic equivalent of <I>)
em([string $data = '' ][, string $class = '' ]) : string
Parameters
- $data : string = ''
-
Default is ''
- $class : string = ''
-
Default is ''
Return values
string —u()
<U> element
u(string $data[, string $class = '' ]) : string
Parameters
- $data : string
- $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 —aName()
<A> element used as internal anchor
aName([string $name = '' ][, string $data = '' ][, string $title = '' ]) : string
Parameters
- $name : string = ''
-
Default is ''
- $data : string = ''
-
Default is ''
- $title : string = ''
-
Default is ''
Return values
string —a()
<A> element used as hyperlink
a(string $class, string $label, string $link[, string $target = '' ][, string $title = '' ]) : string
Parameters
- $class : string
- $label : string
- $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' ][, string $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 : string = ''
-
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([string $caption = '' ][, string $class = '' ]) : string
Parameters
- $caption : string = ''
-
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 = '' ][, string $colspan = '' ]) : string
Parameters
- $class : string = ''
-
Default is ''
- $colspan : string = ''
-
Default is ''
Return values
string —tdEnd()
Provide a </td> tag
tdEnd() : string
Return values
string —td()
Provide a <td>...</td> tag
td([string $data = '' ][, string $class = '' ][, string $colspan = '' ]) : string
Parameters
- $data : string = ''
-
Default is ''
- $class : string = ''
-
Default is ''
- $colspan : string = ''
-
Default is ''
Return values
string —thStart()
Provide a <th> tag without closing it or encapsulating data
thStart([string $class = '' ][, string $colspan = '' ]) : string
Parameters
- $class : string = ''
-
Default is ''
- $colspan : string = ''
-
Default is ''
Return values
string —thEnd()
Provide a </th> tag
thEnd() : string
Return values
string —th()
Provide a <th>...</th> tag
th([string $data = '' ][, string $class = '' ][, string $colspan = '' ]) : string
Parameters
- $data : string = ''
-
Default is ''
- $class : string = ''
-
Default is ''
- $colspan : string = ''
-
Default is ''
Return values
string —cssInline()
Inlining CSS code
cssInline([string $cssCode = '' ]) : string
Parameters
- $cssCode : string = ''
-
Default is ''
Return values
string —cssInlineExternal()
Insert a call to an external CSS file
cssInlineExternal([string $url = '' ]) : string
Parameters
- $url : string = ''
-
Default is ''
Return values
string —jsInline()
Inlining JavaScript code
jsInline([string $jsCode = '' ]) : string
Parameters
- $jsCode : string = ''
-
Default is ''
Return values
string —jsInlineExternal()
Insert a call to an external javascript file
jsInlineExternal([string $url = '' ]) : string
Parameters
- $url : string = ''
-
Default is ''
Return values
string —nlToHtml()
replace newlines and carriage returns with appropriate HTML code.
nlToHtml(string $string) : string
first multiples then singles. Used for display back from DB table
Parameters
- $string : string
Return values
string —htmlToNl()
replace HTML newlines and carriage returns with appropriate ANSI code.
htmlToNl(string $string) : string
first multiples then singles. Used for display back from DB table
Parameters
- $string : string
Return values
string —removeNl()
remove all newlines.
removeNl(string $string) : string
For cases when user cut 'n' pastes multiple lines into single-line text box Used before writing to DB table
Parameters
- $string : string
Return values
string —dbToFormTidy()
Format text grabbed from database for printing to form elements.
dbToFormTidy(string $string[, bool $stripHtml = FALSE ]) : string
Parameters
- $string : string
- $stripHtml : bool = FALSE
-
Default is FALSE
Return values
string —dbToHtmlTidy()
Format text grabbed from database for printing to HTML (should be just where the original input was from text input elements).
dbToHtmlTidy(string $string) : string
Parameters
- $string : string
Return values
string —dbToHtmlPopupTidy()
Format text grabbed from database for printing to HTML popups.
dbToHtmlPopupTidy(string $string) : string
Parameters
- $string : string
Return values
string —stripHtml()
Strip HTML from string
stripHtml(string $string) : string
Parameters
- $string : string
Return values
string —dbToTinyMCE()
Format text grabbed from database for printing to tinyMCE form elements.
dbToTinyMCE(string $string) : string
Parameters
- $string : string
Return values
string —successToast()
Format a text as a HTML success toast message (temporary info)
successToast(string $string) : string
Parameters
- $string : string
Return values
string —errorToast()
Format a text as a HTML error toast message (temporary info)
errorToast(string $string) : string
Parameters
- $string : string
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
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 —codeISO639a1toName()
Return the name of a language defined by its locale code or its ISO 639-1 (alpha-2) code.
codeISO639a1toName(string $codeISO) : string
Parameters
- $codeISO : string
Tags
Return values
string —load_locales()
Load the translation catalogs of the user's preferred language.
load_locales() : mixed
Return values
mixed —determine_locale()
Determine the user's preferred language.
determine_locale([null|string $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 : null|string = 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([null|string $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 : null|string = 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
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
Return values
string —If a BCP47 code is missing, return 'en'
getTranslatableLocales()
Get a list of translatable locales sorted by locale name
getTranslatableLocales(mixed $in_locale) : mixed
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.
Each key is a locale code and its value a displayname.
return string[]
Parameters
- $in_locale : mixed
Return values
mixed —searchLanguageCode()
Return the language code matching a language name
searchLanguageCode(mixed $name_search) : mixed
If no language code matchs the name, return FALSE.
NB: this function is slow and should not be used outside the upgrade code
return string|FALSE
Parameters
- $name_search : mixed
Return values
mixed —sort()
Sort an array according to the current Intl locale in ascending order
sort(array<string|int, mixed> &$array[, int $flags = Collator::SORT_REGULAR ]) : mixed
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
Return values
mixed —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 ]) : mixed
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
Return values
mixed —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 ]) : mixed
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
Return values
mixed —rsort()
Sort an array according to the current Intl locale in descending order
rsort(array<string|int, mixed> &$array[, int $flags = Collator::SORT_REGULAR ]) : mixed
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
Return values
mixed —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 ]) : mixed
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
Return values
mixed —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 ]) : mixed
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
Return values
mixed —messageTranslatorNeeded()
Return a message if the project need translation contribution for the current locale
messageTranslatorNeeded() : mixed
return string
Return values
mixed —header()
Set some defaults and create the RTF opening tag
header() : string
Return values
string —footer()
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
Return values
mixed —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
Return values
mixed —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'
Return values
mixed —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 ''
Return values
mixed —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 ''
Return values
mixed —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 ''
Return values
mixed —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
Return values
mixed —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(object $domNode, mixed $listLevel, int $tableNestLevel) : string
Parameters
- $domNode : object
- $listLevel : mixed
- $tableNestLevel : int
-
Default = 0
Return values
string —nodeAttributes()
Convert attributes
nodeAttributes(object $node[, bool $wantArray = FALSE ]) : mixed
Parameters
- $node : object
- $wantArray : bool = FALSE
-
Default = FALSE
Return values
mixed —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
Return values
mixed —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[, bookl $th = FALSE ]) : array<string|int, mixed>
Parameters
- $attributes : array<string|int, mixed>
- $cellArray : array<string|int, mixed>
- $thisRowNumber : int
- $thisCellNumber : int
- $th : bookl = 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(object $domNode) : 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 : object
Return values
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(object $domNode, bool $rowSpanParent, int $tableNestLevel) : array<string|int, mixed>
Parameters
- $domNode : object
- $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
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(object $domNode) : string
The file is hex encoded in cache/files and its filename is inserted inside src, using a pattern as "##
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 : object
Return values
string —domNodeAttributes2Array()
Convert attributes of a DOMNode to an array of attributes
domNodeAttributes2Array(object $domNode) : array<string|int, string>
Parameters
- $domNode : object
Return values
array<string|int, string> —getUuid()
Get UUID from database
getUuid(class $db) : string
Parameters
- $db : class
Return values
string —$uuid
store()
Store/merge data
store(class $db, string $uuid, array<string|int, mixed> $data) : bool
Parameters
- $db : class
- $uuid : string
- $data : array<string|int, mixed>
Return values
bool —FALSE if $uuid not set or $data empty, otherwise TRUE
exists()
Check a row exists
exists(class $db, string $uuid) : bool
Parameters
- $db : class
- $uuid : string
Return values
bool —fetch()
Fetch data array
fetch(class $db, string $uuid) : array<string|int, mixed>
Parameters
- $db : class
- $uuid : string
Return values
array<string|int, mixed> —$data
fetchOne()
Fetch one array element
fetchOne(class $db, string $uuid, string $key) : mixed
Parameters
- $db : class
- $uuid : string
- $key : string
Return values
mixed —$data FALSE if $key is not in row
delete()
Delete row
delete(class $db, string $uuid) : mixed
Parameters
- $db : class
- $uuid : string
Return values
mixed —deleteKeys()
Delete keys from the row data array
deleteKeys(class $db, string $uuid, array<string|int, mixed> $deleteKeys) : bool
Parameters
- $db : class
- $uuid : string
- $deleteKeys : array<string|int, mixed>
Return values
bool —FALSE if row doesn't exist, otherwise TRUE
reduceUrl()
reduce the size of long URL to keep web browser display tidy
reduceUrl(string $text[, false|int $limit = FALSE ]) : string
Parameters
- $text : string
- $limit : false|int = FALSE
-
Default is FALSE
Return values
string —getCurrentProtocol()
Return the protocol requested by the HTTP client
getCurrentProtocol() : string
Return values
string —http or https
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
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
Return values
string —mb_ucfirst()
A unicode aware replacement for ucfirst()
mb_ucfirst(string $str) : string
Parameters
- $str : string
Tags
Return values
string —mb_str_word_count()
count UTF-8 words in a string
mb_str_word_count(string $str, string $format[, string $charlist = "" ]) : int|array<string|int, string>
This simple utf-8 word count function (it only counts) is a bit faster then the one with preg_match_all about 10x slower then the built-in str_word_count
If you need the hyphen or other code points as word-characters just put them into the [brackets] like [^\p{L}\p{N}'-]
Parameters
- $str : string
- $format : string
- $charlist : string = ""
Tags
Return values
int|array<string|int, string> —mb_explode()
Simulate explode() for multibytes strings (as documented for PHP 7.0)
mb_explode(string $delimiter, string $string[, int $limit = PHP_INT_MAX ]) : string
Parameters
- $delimiter : string
- $string : string
- $limit : int = PHP_INT_MAX
-
Default is PHP_INT_MAX.
Return values
string —mb_str_pad()
Simulate str_pad() for multibytes strings
mb_str_pad(string $str, int $pad_len[, string $pad_str = ' ' ][, string $dir = STR_PAD_RIGHT ][, string $encoding = NULL ]) : string
Parameters
- $str : string
- $pad_len : int
- $pad_str : string = ' '
-
Default is ' '.
- $dir : string = STR_PAD_RIGHT
-
Default is STR_PAD_RIGHT.
- $encoding : string = NULL
-
Default is NULL.
Return values
string —mb_strcasecmp()
Simulate strcasecmp() for multibytes strings
mb_strcasecmp(string $str1, string $str2[, string $encoding = NULL ]) : string
A simple multibyte-safe case-insensitive string comparison
Parameters
- $str1 : string
- $str2 : string
- $encoding : string = NULL
-
Default is NULL.
Return values
string —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 $length = NULL ][, string $encoding = NULL ]) : string
Parameters
- $string : string
- $replacement : string
- $start : int
- $length : int = NULL
-
Default is NULL.
- $encoding : string = NULL
-
Default is NULL.
Return values
string —mb_trim()
Code by Ben XO at https://www.php.net/manual/en/ref.mbstring.php
mb_trim(string $string[, string $charlist = '\\s' ][, bool $ltrim = TRUE ][, bool $rtrim = TRUE ]) : string
Trim characters from either (or both) ends of a string in a way that is multibyte-friendly.
Mostly, this behaves exactly like trim() would: for example supplying 'abc' as the charlist will trim all 'a', 'b' and 'c' chars from the string, with, of course, the added bonus that you can put unicode characters in the charlist.
We are using a PCRE character-class to do the trimming in a unicode-aware way, so we must escape ^, , - and ] which have special meanings here. As you would expect, a single \ in the charlist is interpretted as "trim backslashes" (and duly escaped into a double-\ ). Under most circumstances you can ignore this detail.
As a bonus, however, we also allow PCRE special character-classes (such as '\s') because they can be extremely useful when dealing with UCS. '\pZ', for example, matches every 'separator' character defined in Unicode, including non-breaking and zero-width spaces.
It doesn't make sense to have two or more of the same character in a character class, therefore we interpret a double \ in the character list to mean a single \ in the regex, allowing you to safely mix normal characters with PCRE special classes.
Be careful when using this bonus feature, as PHP also interprets backslashes as escape characters before they are even seen by the regex. Therefore, to specify '\s' in the regex (which will be converted to the special character class '\s' for trimming), you will usually have to put 4 backslashes in the PHP code - as you can see from the default value of $charlist.
Parameters
- $string : string
-
The string to trim
- $charlist : string = '\\s'
-
charlist list of characters to remove from the ends
- $ltrim : bool = TRUE
-
trim the left? (Default is TRUE)
- $rtrim : bool = TRUE
-
trim the right? (Default is TRUE)
Return values
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
Parameters
- $string : string
-
A string
- $prefix : string
-
A prefix
Return values
bool —matchSuffix()
Check if a suffix match against a string
matchSuffix(string $string, string $suffix) : bool
Parameters
- $string : string
-
A string
- $suffix : string
-
A suffix
Return values
bool —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) : 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 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)
Return values
mixed —refreshComponentsListCache()
Refresh the components list if needed, or forced by the caller
refreshComponentsListCache([bool $force = FALSE ]) : mixed
Parameters
- $force : bool = FALSE
-
Forces the file overwriting if it already exists (optional, FALSE by default)
Return values
mixed —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) : mixed
Do not overwrite the file if it already exists.
Parameters
- $component_type : string
-
(plugin, style, template)
- $component_id : string
Return values
mixed —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
hash_path()
Generates a hash of a file or directory at the given path with the specified algo.
hash_path(string $path[, string $algo = WIKINDX_PACKAGE_HASH_ALGO ]) : string
If the path is to a single file, it uses sha1_file. Otherwise, it recursively loops through all files in a directory to generate the hash.
Parameters
- $path : string
-
- the path of the folder or file
- $algo : string = WIKINDX_PACKAGE_HASH_ALGO
-
- the hash algo used (WIKINDX_PACKAGE_HASH_ALGO by default)
Tags
Return values
string —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 —checkFoldersPerms()
Check the permissions of various folders and files which must be writable
checkFoldersPerms() : mixed
Return values
mixed —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) : mixed
Parameters
- $arr : array<string|int, mixed>
- $temp_string : string
- $space : string
- $collect : array<string|int, mixed>
Return values
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 = []
Return values
string —writeUserPassword()
Write a hashed version of a user password in users table
writeUserPassword(object $dbo, string $usersId, string $usersPassword) : mixed
Implementation history: see \UTILS\verifyUserPassword()
Parameters
- $dbo : object
-
An SQL object
- $usersId : string
-
A user Id
- $usersPassword : string
-
A clear password to encrypt/hash
Return values
mixed —verifyUserPassword()
Verify that a password matches a password hash of a user
verifyUserPassword(object $dbo, string $usersId, string $usersPassword) : bool
It hides the implementation changes linked to the evolution of cryptographic techniques.
Parameters
- $dbo : object
-
An SQL object
- $usersId : string
-
A user Id
- $usersPassword : string
-
A clear password to verify
Tags
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)
Return values
mixed —createHelpTopicLink()
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
suhosin_function_exists()
Does a function exist or is enabled with (or without) the suhosin security extension?
suhosin_function_exists(string $func) : bool
Parameters
- $func : string
-
Function name
Tags
Return values
bool —TRUE if the function is enabled
insertExportImages()
Insert cached images inside exported files, and delete them
insertExportImages(string $fileName) : mixed
The file is written to consume as little memory as possible because the number of images can be large.
Parameters
- $fileName : string
Return values
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 $dbo) : bool
Parameters
- $dbo : object
-
An SQL object
Return values
bool —existsTableVersion()
Check if 'version' table that stores the version number of the db schema exists
existsTableVersion(object $dbo) : bool
Check also the old names of the version table.
This function is used only during the upgrade process.
Parameters
- $dbo : object
-
An SQL object
Return values
bool —getCoreInternalVersion()
Return the internal version stored in the database of the core
getCoreInternalVersion(object $dbo) : 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
- $dbo : object
-
An SQL object
Return values
float —setCoreInternalVersion()
Write an internal version in the database of a component or the core
setCoreInternalVersion(object $dbo[, 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
- $dbo : object
-
An SQL object
- $version : string = NULL
-
(Default is NULL)
Return values
mixed —getPluginInternalVersion()
Return the internal version stored in the database of a plugin
getPluginInternalVersion(object $dbo, string $ComponentId) : 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
- $dbo : object
-
An SQL object
- $ComponentId : string
-
Id of a component or 'core' for the WIKINDX core
Return values
float —setPluginInternalVersion()
Write an internal version in the database of a plugin
setPluginInternalVersion(object $dbo, string $ComponentId[, 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
- $dbo : object
-
An SQL object
- $ComponentId : string
-
Id of a component or 'core' for the WIKINDX core
- $version : string = NULL
-
(Default is NULL)
Return values
mixed —existsSuperadminAccount()
Check if 'users' table has not been filled with the superadmin account
existsSuperadminAccount(object $dbo) : bool
This function is used only during the upgrade process.
Parameters
- $dbo : object
-
An SQL object
Return values
bool —getConfigContactEmail()
Return the configContactEmail depending on the software version
getConfigContactEmail(object $dbo) : 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
- $dbo : object
-
An SQL object
Return values
float —logonCheckUpgradeDB()
Initial logon to the system when upgrading the database.
logonCheckUpgradeDB(object $dbo, string $username, string $password) : bool
Parameters
- $dbo : object
-
An SQL object
- $username : string
- $password : string
Return values
bool —TRUE if able to authenticate