WIKINDX API 6.4.10

wikindx

Packages

core

Interfaces, Classes and Traits

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
CONSTANTS
CONSTANTS class (English)
ERRORS
WIKINDX : Bibliographic Management system.
MESSAGES
MESSAGES class (English)
SUCCESS
WIKINDX : Bibliographic Management system.
PASSWORD
PASSWORD class.
LOADPLUGINS
LOADPLUGINS class for third-party plug-in modules in the WIKINDX_DIR_COMPONENT_PLUGINS directory

Table of Contents

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.
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.
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_ChangeDateOfFiles()  : mixed
Change recursively the last access/modification datetime of files and subdirectories of a directory
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.
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
createComponentPackageReproducible()  : string
Create a compressed package for the release of WIKINDX core, manual or one of its components
createComponentPackageUnix()  : string
Create a compressed package for the release of WIKINDX core, manual or one of its components
createComponentPackageBzip2Unix()  : mixed
Create a compressed package in .tar.bz2 format for the release of WIKINDX core, manual or one of its components
createComponentPackageGzUnix()  : mixed
Create a compressed package in .tar.gz format for the release of WIKINDX core, manual or one of its components
createComponentPackageZipUnix()  : mixed
Create a compressed package in .zip format for the release of WIKINDX core, manual or one of its components
createComponentPackage()  : string
Create a compressed package for the release of WIKINDX core, manual or one of its components
createComponentPackageBzip2()  : mixed
Create a compressed package in .tar.bz2 format for the release of WIKINDX core, manual or one of its components
createComponentPackageGz()  : mixed
Create a compressed package in .tar.gz format for the release of WIKINDX core, manual or one of its components
createComponentPackageZip()  : mixed
Create a compressed package in .zip format for the release of WIKINDX core, manual or one of its components
createComponentPackageTar()  : string
Create a compressed package in .tar format for the release of WIKINDX core, manual or one of its components
command_exists2()  : bool
Does an unix command exist?
command_exists()  : bool
Does an unix command exist?
suhosin_function_exists()  : bool
Does a function exist ou is enabled with or without the suhosin security extension?
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
_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
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
jsInline()  : string
Inlining JavaScript code
jsInlineExternal()  : string
Insert a call to an external javascript
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.
dateFormatFromString()  : string
Format dates and times for localization
dateFormatFromTimeStamp()  : string
Format dates and times for localization
getSystemLocales()  : array<string|int, mixed>
Return the list of all locales available on the current OS, defined in cached file /cache/languages/locales_system.json
refreshSystemLocalesCache()  : mixed
Create a data file containing the list of available locales on the current system
checkSystemLocales()  : array<string|int, mixed>
Return a dynamic list of all locales available on the current OS
getLocaleGettextAliases()  : array<string|int, string>
Return all alias of a locale with and without UTF-8 charset for Gettext
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 gettext 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 the list of all locales defined in /languages/locales.json
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
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
getCurrentProtocole()  : string
Return the base url of the current website seen by the visitor
smartUtf8_encode()  : string
Encode a string in UTF-8 if not already UTF-8
smartUtf8_decode()  : string
Decode UTF-8 ONLY if the input has been UTF-8-encoded.
decodeUtf8()  : string
UTF-8 encoding - PROPERLY decode UTF-8 as PHP's utf8_decode can't hack it.
html_uentity_decode()  : string
Encode UTF-8 from unicode 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_chr()  : string
Simulate chr() for multibytes strings
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_ord()  : string
Simulate ord() for UTF8 strings (not arbitrary multibytes strings)
mb_trim()  : string
Code by Ben XO at https://www.php.net/manual/en/ref.mbstring.php
code2utf8()  : string
convert an integer to its chr() representation
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
checkComponentsList()  : array<string|int, mixed>
Return a structured list of installed components
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.
download_sf_file()  : bool
Download a file from SourceForge with curl
uuid()  : mixed
checkFoldersPerms()  : mixed
Check the permissions of various folders and files which must be writable
splitDate()  : array<string|int, mixed>
Take input from HTML FORM <input type=date> and split into separate fields.
writeUserPassword()  : mixed
verifyUserPassword()  : mixed
array_value_select()  : mixed
createHelpTopicLink()  : string
Create a popup link for a Help Topic on the website
loadStaticConfig()  : array<string|int, mixed>
Load configuration from config.php
wkx_session_open()  : bool
wkx_session_close()  : bool
wkx_session_read()  : string
wkx_session_write()  : bool
wkx_session_destroy()  : bool
wkx_session_gc()  : bool
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

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([ $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 : = FALSE

bool 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"> IDSTYLE Identifier of my custom bibliographic Style (IDSTYLE) English 5 [...] </style>
Parameters
$file : string

Location of a StyleFile

Return values
associative

array - keys = name, description, language, osbibversion

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

setHeaders()

Set download headers

setHeaders(string $type, int $size, string $filename, string $lastmodified[, string $charset = '' ]) : mixed
Parameters
$type : string
$size : int
$filename : string
$lastmodified : string
$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_ChangeDateOfFiles()

Change recursively the last access/modification datetime of files and subdirectories of a directory

recurse_ChangeDateOfFiles(string $dir, int $time) : mixed
Parameters
$dir : string

A directory to explore

$time : int

A Unix timestamp

Return values
mixed

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 $path) : mixed
Parameters
$files : array<string|int, mixed>

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

$path : string

file path

Return values
mixed

unqualified SHA1'ed filename of zip or FALSE if failure

extractComponentPackage()

Extract a WIKINDX Component Package to a folder

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

The .tar.gz and .tar.bz2 archives are decompressed in two stages and require the creation of a temporary .tar file in the same directory as the archive to uncompress.

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>

The .tar.gz and .tar.bz2 archives are decompressed in two stages and require the creation of a temporary .tar file in the same directory as the archive to uncompress.

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

createComponentPackageReproducible()

Create a compressed package for the release of WIKINDX core, manual or one of its components

createComponentPackageReproducible(string $SrcDir, string $DstDir, string $Archive, string $Format) : string

This function is a wrapper that hide the specifics of compression formats.

Parameters
$SrcDir : string

Absolute or relative path to a source directory

$DstDir : string

Absolute or relative path to a destination directory

$Archive : string

Name of the package file, without path and extension

$Format : string

Code of a package format (ZIP, GZ, BZIP2)

Return values
string

Absolute or relative path to the final package file with its extension

createComponentPackageUnix()

Create a compressed package for the release of WIKINDX core, manual or one of its components

createComponentPackageUnix(string $SrcDir, string $DstDir, string $Archive, string $Format) : string

This function is a wrapper that hide the specifics of compression formats.

Parameters
$SrcDir : string

Absolute or relative path to a source directory

$DstDir : string

Absolute or relative path to a destination directory

$Archive : string

Name of the package file, without path and extension

$Format : string

Code of a package format (ZIP, GZ, BZIP2)

Return values
string

Absolute or relative path to the final package file with its extension

createComponentPackageBzip2Unix()

Create a compressed package in .tar.bz2 format for the release of WIKINDX core, manual or one of its components

createComponentPackageBzip2Unix(string $SrcDir, string $DstFile) : mixed

This function must be called from createComponentPackage() only.

Parameters
$SrcDir : string

Absolute or relative path to a source directory

$DstFile : string

Absolute or relative path to a destination package file

Return values
mixed

createComponentPackageGzUnix()

Create a compressed package in .tar.gz format for the release of WIKINDX core, manual or one of its components

createComponentPackageGzUnix(string $SrcDir, string $DstFile) : mixed

This function must be called from createComponentPackage() only.

Parameters
$SrcDir : string

Absolute or relative path to a source directory

$DstFile : string

Absolute or relative path to a destination package file

Return values
mixed

createComponentPackageZipUnix()

Create a compressed package in .zip format for the release of WIKINDX core, manual or one of its components

createComponentPackageZipUnix(string $SrcDir, string $DstFile) : mixed

This function must be called from createComponentPackage() only.

Parameters
$SrcDir : string

Absolute or relative path to a source directory

$DstFile : string

Absolute or relative path to a destination package file

Return values
mixed

createComponentPackage()

Create a compressed package for the release of WIKINDX core, manual or one of its components

createComponentPackage(string $SrcDir, string $DstDir, string $Archive, string $Format) : string

This function is a wrapper that hide the specifics of compression formats.

Parameters
$SrcDir : string

Absolute or relative path to a source directory

$DstDir : string

Absolute or relative path to a destination directory

$Archive : string

Name of the package file, without path and extension

$Format : string

Code of a package format (ZIP, GZ, BZIP2)

Return values
string

Absolute or relative path to the final package file with its extension

createComponentPackageBzip2()

Create a compressed package in .tar.bz2 format for the release of WIKINDX core, manual or one of its components

createComponentPackageBzip2(string $SrcFile, string $DstFile) : mixed

This function must be called from createComponentPackage() only.

Parameters
$SrcFile : string

Absolute or relative path to a source TAR file

$DstFile : string

Absolute or relative path to a destination package file

Return values
mixed

createComponentPackageGz()

Create a compressed package in .tar.gz format for the release of WIKINDX core, manual or one of its components

createComponentPackageGz(string $SrcFile, string $DstFile) : mixed

This function must be called from createComponentPackage() only.

Parameters
$SrcFile : string

Absolute or relative path to a source TAR file

$DstFile : string

Absolute or relative path to a destination package file

Return values
mixed

createComponentPackageZip()

Create a compressed package in .zip format for the release of WIKINDX core, manual or one of its components

createComponentPackageZip(string $SrcDir, string $DstFile) : mixed

This function must be called from createComponentPackage() only.

Parameters
$SrcDir : string

Absolute or relative path to a source directory

$DstFile : string

Absolute or relative path to a destination package file

Return values
mixed

createComponentPackageTar()

Create a compressed package in .tar format for the release of WIKINDX core, manual or one of its components

createComponentPackageTar(string $SrcDir, string $DstDir) : string

This function must be called from createComponentPackage() only.

Parameters
$SrcDir : string

Absolute or relative path to a source directory

$DstDir : string

Absolute or relative path to a destination directory

Return values
string

Absolute or relative path to an intermediate TAR file (generate a random name itself)

command_exists2()

Does an unix command exist?

command_exists2(string $command) : bool
Parameters
$command : string

Command to test with the default shell

Return values
bool

TRUE on success

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 ou is enabled with or without the suhosin security extension?

suhosin_function_exists(string $func) : bool
Parameters
$func : string

Function name

Tags
see
https://suhosin.org/stories/index.html
author

webmaster@mamo-net.de

Return values
bool

TRUE if the function is enabled

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
see
https://www.php.net/manual/en/function.json-decode.php
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
see
https://www.php.net/manual/en/function.json-encode.php
Return values
int

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

formatSize()

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

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

In bytes

Return values
string

getMimeType()

Return the mime-type of a file

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

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

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

Parameters
$filepath : string

An absolute or relative file path

$altfilename : string = ""

Default is ""

Return values
string

A mime-type

getExtension()

Return the extension of a file

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

An absolute or relative file path

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 = ''
$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

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

jsInline()

Inlining JavaScript code

jsInline([string $function = '' ]) : string
Parameters
$function : string = ''

Default is ''

Return values
string

jsInlineExternal()

Insert a call to an external javascript

jsInlineExternal([string $src = '' ]) : string
Parameters
$src : 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

dateFormatFromString()

Format dates and times for localization

dateFormatFromString(string $datetime) : string

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

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

dateFormatFromTimeStamp(int $timestamp) : string

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

Parameters
$timestamp : int
Return values
string

getSystemLocales()

Return the list of all locales available on the current OS, defined in cached file /cache/languages/locales_system.json

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

Each entry of the returned array is locale code (format: ll_CC@variant) 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

If the source file is not readeable only the reference language is listed.

Parameters
$display_code_only : bool = FALSE

Display the code of the locale instead of its localized name (optional, FALSE by default)

Return values
array<string|int, mixed>

refreshSystemLocalesCache()

Create a data file containing the list of available locales on the current system

refreshSystemLocalesCache([bool $force = FALSE ]) : mixed

The file is stored at /cache/languages/locales_system.json

Parameters
$force : bool = FALSE

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

Return values
mixed

checkSystemLocales()

Return a dynamic list of all locales available on the current OS

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

This function can be a bit of a time (1-2 s) running because it tests all possible variants of all known locales.

Return values
array<string|int, mixed>

getLocaleGettextAliases()

Return all alias of a locale with and without UTF-8 charset for Gettext

getLocaleGettextAliases(string $locale) : array<string|int, string>

Although locales codes have a canonical form and the LANG environment variable of operating systems respect it, Gettext doesn't always follow the standard. This function provides all the possible variants known to us on Windows 7, Mac, Debian 10 and OpenBSD 6.6 for one locale code.

These forms are provided to test if a locale is available on the current system and are not intended for users.

Parameters
$locale : string

Normalized code of a locale

Return values
array<string|int, string>

load_locales()

Load the gettext 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[_CC][@variant])(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[_CC][@variant])(optional, NULL by default)

Return values
array<string|int, string>

getAllLocales()

Return the list of all locales defined in /languages/locales.json

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

Each entry of the returned array is locale code (format: ll_CC@variant) 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

If the source file is not readeable only the reference language is listed.

Parameters
$display_code_only : bool = FALSE

Display the code of the locale instead of its localized name (optional, FALSE by default)

Return values
array<string|int, string>

localetoBCP47()

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

localetoBCP47( $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.

The resolution table was built by hand because there is no systematic correspondence with an ISO language code.

Parameters
$locale :

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

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

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

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

getCurrentProtocole()

Return the base url of the current website seen by the visitor

getCurrentProtocole() : string
Return values
string

smartUtf8_encode()

Encode a string in UTF-8 if not already UTF-8

smartUtf8_encode(string $str) : string

Tools for validing a UTF-8 string is well formed. The Original Code is Mozilla Communicator client code. The Initial Developer of the Original Code is Netscape Communications Corporation. Portions created by the Initial Developer are Copyright (C) 1998 the Initial Developer. All Rights Reserved. Ported to PHP by Henri Sivonen (http://hsivonen.iki.fi) Slight modifications to fit with phputf8 library by Harry Fuecks (hfuecks gmail com)

Tests a string as to whether it's valid UTF-8 and supported by the Unicode standard

Parameters
$str : string

UTF-8 encoded string

Tags
see
http://lxr.mozilla.org/seamonkey/source/intl/uconv/src/nsUTF8ToUnicode.cpp
see
http://lxr.mozilla.org/seamonkey/source/intl/uconv/src/nsUnicodeToUTF8.cpp
see
http://hsivonen.iki.fi/php-utf8/
see
utf8_compliant
author

hsivonen@iki.fi

Return values
string

smartUtf8_decode()

Decode UTF-8 ONLY if the input has been UTF-8-encoded.

smartUtf8_decode(string $inStr) : string

Adapted from 'nospam' in the user contributions at: http://www.php.net/manual/en/function.utf8-decode.php

Parameters
$inStr : string
Return values
string

decodeUtf8()

UTF-8 encoding - PROPERLY decode UTF-8 as PHP's utf8_decode can't hack it.

decodeUtf8(string $utf8_string) : string

Freely borrowed from morris_hirsch at http://www.php.net/manual/en/function.utf8-decode.php bytes bits representation 1 7 0bbbbbbb 2 11 110bbbbb 10bbbbbb 3 16 1110bbbb 10bbbbbb 10bbbbbb 4 21 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb Each b represents a bit that can be used to store character data.

input CANNOT have single byte upper half extended ascii codes

Parameters
$utf8_string : string
Return values
string

html_uentity_decode()

Encode UTF-8 from unicode characters

html_uentity_decode(string $str) : string
Parameters
$str : string
Return values
string

mb_ucfirst()

A unicode aware replacement for ucfirst()

mb_ucfirst(string $str) : string
Parameters
$str : string
Tags
author

Andrea Rossato arossato@istitutocolli.org

see
ucfirst()
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>
Parameters
$str : string
$format : string
$charlist : string = ""
Tags
see
https://www.php.net/manual/en/function.str-word-count.php
Return values
int|array<string|int, string>

mb_chr()

Simulate chr() for multibytes strings

mb_chr(string $dec) : string
Parameters
$dec : string
Return values
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_ord()

Simulate ord() for UTF8 strings (not arbitrary multibytes strings)

mb_ord(string $string) : string
Parameters
$string : string
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

code2utf8()

convert an integer to its chr() representation

code2utf8(int $num) : string
Parameters
$num : int
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,  $prefix) : bool
Parameters
$string :

A string

$prefix :

A prefix

Return values
bool

matchSuffix()

Check if a suffix match against a string

matchSuffix( $string,  $suffix) : bool
Parameters
$string :

A string

$suffix :

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

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>

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, or vendor)

$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, or vendor)

$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, or vendor)

$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
see
https://www.php.net/manual/en/function.hash-algos.php
Return values
string

download_sf_file()

Download a file from SourceForge with curl

download_sf_file(string $url, string $file) : bool

Curl is configured to track SF redirects to the nearest server.

Parameters
$url : string
  • the url of a resource on SF
$file : string
  • the path of a file on the server
Return values
bool

TRUE if the download is successful, FALSE otherwise

uuid()

uuid([int $length = 16 ]) : mixed
Parameters
$length : int = 16
Return values
mixed

checkFoldersPerms()

Check the permissions of various folders and files which must be writable

checkFoldersPerms() : 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)

writeUserPassword()

writeUserPassword(mixed $dbo, mixed $usersId, mixed $usersPassword) : mixed
Parameters
$dbo : mixed
$usersId : mixed
$usersPassword : mixed
Return values
mixed

verifyUserPassword()

verifyUserPassword(mixed $dbo, mixed $usersId, mixed $usersPassword) : mixed
Parameters
$dbo : mixed
$usersId : mixed
$usersPassword : mixed
Return values
mixed

array_value_select()

array_value_select(mixed $array, mixed $key[, mixed $defaultKey = NULL ][, mixed $defaultValue = NULL ]) : mixed
Parameters
$array : mixed
$key : mixed
$defaultKey : mixed = NULL
$defaultValue : mixed = NULL
Return values
mixed

Create a popup link for a Help Topic on the website

createHelpTopicLink(mixed $helpTopic) : string
Parameters
$helpTopic : mixed
Return values
string

HTML link tag

loadStaticConfig()

Load configuration from config.php

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

Array of error messages

wkx_session_open()

wkx_session_open(string $savePath, string $sessionName) : bool
Parameters
$savePath : string
$sessionName : string
Return values
bool

wkx_session_close()

wkx_session_close() : bool
Return values
bool

wkx_session_read()

wkx_session_read(string $sessionId) : string
Parameters
$sessionId : string
Return values
string

wkx_session_write()

wkx_session_write(string $sessionId, string $sessionData) : bool
Parameters
$sessionId : string
$sessionData : string
Return values
bool

wkx_session_destroy()

wkx_session_destroy(string $sessionId) : bool
Parameters
$sessionId : string
Return values
bool

wkx_session_gc()

wkx_session_gc(int $maxSessionLifetime) : bool
Parameters
$maxSessionLifetime : int
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

Search results