Documentation

plugin_functions.php

Functions related to the management of plugins.

Table of Contents

Functions

activate_plugin()  : bool
Activate a named plugin.
deactivate_plugin()  : void
Deactivate a named plugin.
purge_plugin_config()  : mixed
Purge configuration of a plugin.
get_plugin_yaml()  : array<string|int, mixed>|bool
Load plugin .yaml file.
config_json_encode()  : string
A subset json_encode function that only works on $config arrays but has none of the version-to-version variability and other "unusual" behavior of PHP's.
config_encode()  : an
Utility function to encode the passed string to something that conforms to the json spec for a string. Json doesn't allow strings with double-quotes, backslashes or control characters in them. For double-quote and backslash, the encoding is '\"' and '\\' respectively. The encoding for control characters is of the form '\uxxx' where "xxx" is the UTF-8 4-digit hex value of the encoded character.
get_plugin_config()  : mixed|null
Return plugin config stored in plugins table for a given plugin name.
set_plugin_config()  : mixed
Store a plugin's configuration in the database.
is_plugin_activated()  : bool
Check if a plugin is activated.
get_active_plugins()  : array<string|int, mixed>
Get active plugins
config_gen_setup_post()  : void|string
Generate the first half of the "guts" of a plugin setup page from a page definition array. This function deals with processing the POST that comes (usually) as a result of clicking on the Save Configuration button.
config_gen_setup_html()  : mixed
Generate the second half of the "guts" of a plugin setup page from a page definition array. The page definition array is typically constructed by a series of calls to config_add_xxxx functions (see below). See the setup page for the sample plugin for information on how to use this and the associated functions.
config_section_header()  : mixed
Generate an html text section header
config_add_section_header()  : mixed
Return a data structure that will instruct the configuration page generator functions to add a section header.
config_add_text_list_input()  : mixed
Return a data structure that will instruct the configuration page generator functions to add a comma-separated list text entry configuration variable to the setup page.
config_multi_select()  : mixed
Generate an html multi-select + options block
config_add_multi_select()  : mixed
Return a data structure that will instruct the configuration page generator functions to add a multi select configuration variable to the setup page.
config_single_user_select()  : mixed
Generate an html single-select block for selecting one of the RS users.
config_add_single_user_select()  : mixed
Return a data structure that will instruct the configuration page generator functions to add a single RS user select configuration variable to the setup page.
config_multi_user_select()  : mixed
Generate an html multi-select block for selecting from among RS users.
config_add_multi_user_select()  : mixed
Return a data structure that will instruct the configuration page generator functions to add a multiple RS user select configuration variable to the setup page.
config_single_group_select()  : mixed
Generate an html single-select block for selecting from among RS user groups.
config_add_single_group_select()  : mixed
Return a data structure that will instruct the configuration page generator functions to add a single RS group select configuration variable to the setup page.
config_multi_group_select()  : mixed
Generate an html multi-select block for selecting from among RS user groups.
config_add_multi_group_select()  : mixed
Return a data structure that will instruct the configuration page generator functions to add a multiple RS user select configuration variable to the setup page.
config_multi_ftype_select()  : mixed
Generate an html multi-select + options block for selecting multiple RS field types. The selected field type is posted as an array of the values of the "ref" column of the selected field types.
config_add_multi_ftype_select()  : mixed
Return a data structure that will instruct the configuration page generator functions to add a multiple RS field-type select configuration variable to the setup page.
config_single_rtype_select()  : mixed
Generate an html single-select + options block for selecting one of the RS resource types. The selected field type is posted as the value of the "ref" column of the selected resource type.
config_add_single_rtype_select()  : mixed
Return a data structure that will instruct the configuration page generator functions to add a single RS resource-type select configuration variable to the setup page.
config_multi_rtype_select()  : mixed
Generate an html multi-select check boxes block for selecting multiple the RS resource types. The selected field type is posted as an array of the values of the "ref" column of the selected resource types.
config_add_multi_rtype_select()  : mixed
Return a data structure that will instruct the configuration page generator functions to add a multiple RS resource-type select configuration variable to the setup page.
config_multi_archive_select()  : mixed
Generate an html multi-select check boxes block for selecting multiple the RS archive states.
config_add_multi_archive_select()  : mixed
Return a data structure that will instruct the configuration page generator functions to add a multiple RS archive select configuration variable to the setup page.
config_db_single_select()  : mixed
Generate an html single-select + options block for selecting from among rows returned by a database query in which one of the columns is the unique key (by default, the "ref" column) and one of the others is the text to display (by default the "name" column). The value posted is the value at the intersection of the selected rown with the column given by the $ixcol variable.
config_add_db_single_select()  : mixed
Return a data structure that will instruct the configuration page generator functions to add a single select configuration variable whose value is chosen from among the results of a db query to the setup page.
config_db_multi_select()  : mixed
Generate an html multi-select + options block for selecting from among rows returned by a database query in which one of the columns is the unique key (by default, the "ref" column) and one of the others is the text to display (by default the "name" column). The value posted is an array of the values of the column given by the $ixcol variable for the rows selected.
config_add_db_multi_select()  : mixed
Return a data structure that will instruct the configuration page generator functions to add a multi select configuration variable whose values are chosen from among the results of a db query to the setup page.
config_add_hidden()  : mixed
Return a data structure that will instruct the configuration page generator functions to add a hidden configuration variable.
config_text_field()  : mixed
Deprecated -- use config_text_input instead
config_userselect_field()  : mixed
Deprecated -- use config_multi_user_select instead
config_field_select()  : mixed
Deprecated -- use config_single_ftype_select instead
config_boolean_field()  : mixed
Deprecated -- use config_boolean_select instead
config_custom_select_multi()  : mixed
Deprecated -- use config_db_multi_select instead
config_custom_select()  : mixed
Deprecated -- use config_single_select instead
get_plugin_css()  : mixed
plugin_activate_for_setup()  : mixed
include_plugin_config()  : void
Includes configuration files for a specified plugin.
register_plugin_language()  : void
Registers the language files for a specified plugin.
get_plugin_path()  : string|false
Retrieves the file path for a specified plugin.
register_plugin()  : bool
Registers a specified plugin by including its hooks and API bindings.
plugin_encode_complex_configs()  : string
Encode complex plugin configuration (e.g mappings defined by users on plugins' setup page)
plugin_decode_complex_configs()  : mixed
Decode complex plugin configuration (e.g mappings defined by users on plugins' setup page)
register_group_access_plugins()  : array<string|int, mixed>
Load group specific plugins and reorder plugins list
register_all_group_access_plugins()  : array<string|int, mixed>
Load ALL group specific plugins and reorder plugins list This will bypass any group access controls for use with CLI scripts
RenderPlugin()  : void
Render the plugin in the Plugin Manager with options to activate and configure.

Functions

activate_plugin()

Activate a named plugin.

activate_plugin(string $name) : bool

Parses the plugins directory to look for a pluginname.yaml file and adds the plugin to the plugins database, setting the inst_version field to the version specified in the yaml file.

Parameters
$name : string

Name of plugin to be activated.

Tags
see
deactivate_plugin
Return values
bool

Returns true if plugin directory was found.

deactivate_plugin()

Deactivate a named plugin.

deactivate_plugin(string $name) : void

Blanks the inst_version field in the plugins database, which has the effect of deactivating the plugin while maintaining any configuration that is stored in the database.

Parameters
$name : string

Name of plugin to be deativated.

Tags
see
activate_plugin

purge_plugin_config()

Purge configuration of a plugin.

purge_plugin_config(string $name) : mixed

Replaces config value in plugins table with NULL. Note, this function will operate on an activated plugin as well so its configuration can be 'defaulted' by the plugin's configuration page.

Parameters
$name : string

Name of plugin to purge configuration.

Tags
category

PluginAuthors

get_plugin_yaml()

Load plugin .yaml file.

get_plugin_yaml(string $plugin[, bool $validate = true ][, bool $translate = true ]) : array<string|int, mixed>|bool

Load a .yaml file for a plugin and return an array of its values.

Parameters
$plugin : string

Name of the plugin

$validate : bool = true

Check that the .yaml file is complete. [optional, default=false]

$translate : bool = true

Translate the contents to the user's selected language (default=true)

Return values
array<string|int, mixed>|bool

Associative array of yaml values. If validate is false, this function will return an array of blank values if a yaml isn't available

config_json_encode()

A subset json_encode function that only works on $config arrays but has none of the version-to-version variability and other "unusual" behavior of PHP's.

config_json_encode(mixed $config) : string

implementation.

Parameters
$config : mixed

mixed a configuration variables array. This must be an array whose elements are UTF-8 encoded strings, booleans, numbers or arrays of such elements and whose keys are either numbers or UTF-8 encoded strings.

Return values
string

encoded version of $config or null if $config is beyond our capabilities to encode

config_encode()

Utility function to encode the passed string to something that conforms to the json spec for a string. Json doesn't allow strings with double-quotes, backslashes or control characters in them. For double-quote and backslash, the encoding is '\"' and '\\' respectively. The encoding for control characters is of the form '\uxxx' where "xxx" is the UTF-8 4-digit hex value of the encoded character.

config_encode(mixed $input) : an
Parameters
$input : mixed

string the string that needs encoding

Return values
an

encoded version of $input

get_plugin_config()

Return plugin config stored in plugins table for a given plugin name.

get_plugin_config(string $name) : mixed|null

Queries the plugins table for a stored config value and, if found, unserializes the data and returns the result. If config isn't found returns null.

Parameters
$name : string

Plugin name

Tags
see
set_plugin_config
used-by
tms_link_save_module_mappings_config()
Return values
mixed|null

Returns config data or null if no config.

set_plugin_config()

Store a plugin's configuration in the database.

set_plugin_config(string $plugin_name, mixed $config) : mixed

Serializes the $config parameter and stores in the config and config_json columns of the plugins table.

Parameters
$plugin_name : string

Plugin name

$config : mixed

Configuration variable to store.

Tags
see
get_plugin_config
used-by
tms_link_save_module_mappings_config()

is_plugin_activated()

Check if a plugin is activated.

is_plugin_activated(mixed $name) : bool

Returns true is a plugin is activated in the plugins database.

Parameters
$name : mixed

Name of plugin to check

Return values
bool

Returns true is plugin is activated.

get_active_plugins()

Get active plugins

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

config_gen_setup_post()

Generate the first half of the "guts" of a plugin setup page from a page definition array. This function deals with processing the POST that comes (usually) as a result of clicking on the Save Configuration button.

config_gen_setup_post(mixed $page_def, mixed $plugin_name) : void|string

The page definition array is typically constructed by a series of calls to config_add_xxxx functions (see below). See the setup page for the sample plugin for information on how to use this and the associated functions.

If wishing to store array of values in one config option, in your setup page have something like the following which adds a single definition for each key of your config option: foreach($usergroups as $k => $group) { global $usergroupemails; if(!isset($usergroupemails[$group["ref"]])){$usergroupemails[$group["ref"]]=array();} // Define any missing keys $page_def[] = config_add_text_list_input("usergroupemails[".$group["ref"]."]",$group["name"]); //need to pass a string that looks like: "$configoption["key"]" } The key can consist of numbers, letters or an underscore contained within "" or ''. If using numbers you don't need the quote marks

Parameters
$page_def : mixed

mixed an array whose elements are generated by calls to config_add_xxxx functions each of which describes how one of the plugin's configuration variables.

$plugin_name : mixed

string the name of the plugin for which the function is being invoked.

Return values
void|string

Returns NULL

config_gen_setup_html()

Generate the second half of the "guts" of a plugin setup page from a page definition array. The page definition array is typically constructed by a series of calls to config_add_xxxx functions (see below). See the setup page for the sample plugin for information on how to use this and the associated functions.

config_gen_setup_html(mixed $page_def, mixed $plugin_name, mixed $upload_status, mixed $plugin_page_heading[, mixed $plugin_page_frontm = '' ]) : mixed

If wishing to ouput array of values for one config option, in your setup page have something like the following which adds a single definition for each key of your config option: foreach($usergroups as $k => $group) { global $usergroupemails; if(!isset($usergroupemails[$group["ref"]])){$usergroupemails[$group["ref"]]=array();} // Define any missing keys $page_def[] = config_add_text_list_input("usergroupemails[".$group["ref"]."]",$group["name"]); //need to pass a string that looks like: "$configoption["key"]" } The key can consist of numbers, letters or an underscore contained within "" or ''. If using numbers you don't need the quote marks

Parameters
$page_def : mixed

mixed an array whose elements are generated by calls to config_add_xxxx functions each of which describes how one of the plugin's configuratoin variables.

$plugin_name : mixed

string the name of the plugin for which the function is being invoked.

$upload_status : mixed

string the status string returned by config_get_setup_post().

$plugin_page_heading : mixed

string the heading to be displayed for the setup page for this plugin, typically a $lang[] variable.

$plugin_page_frontm : mixed = ''

string front matter for the setup page in html format. This material is placed after the page heading and before the form. Default: '' (i.e., no front matter).

config_section_header()

Generate an html text section header

config_section_header(string $title, string $description) : mixed
Parameters
$title : string

the title of the section.

$description : string

the user text displayed to describe the section. Usually a $lang string.

config_add_section_header()

Return a data structure that will instruct the configuration page generator functions to add a section header.

config_add_section_header(string $title[, string $description = '' ]) : mixed
Parameters
$title : string

the title of the section.

$description : string = ''

Usually a $lang string.

config_add_text_list_input()

Return a data structure that will instruct the configuration page generator functions to add a comma-separated list text entry configuration variable to the setup page.

config_add_text_list_input(string $config_var, string $label[, bool $password = false ][, int $width = 300 ]) : mixed
Parameters
$config_var : string

the name of the configuration variable to be added.

$label : string

the user text displayed to label the text block. Usually a $lang string.

$password : bool = false

whether this is a "normal" text-entry field or a password-style field. Defaulted to false.

$width : int = 300

the width of the input field in pixels. Default: 300.

config_multi_select()

Generate an html multi-select + options block

config_multi_select(string $name, string $label, mixed $current, mixed $choices[, bool $usekeys = true ][, int $width = 300 ]) : mixed
Parameters
$name : string

the name of the select block. Usually the name of the config variable being set.

$label : string

the user text displayed to label the select block. Usually a $lang string.

$current : mixed
$choices : mixed
$usekeys : bool = true

tells whether to use the keys from $choices as the values of the options. If set to false the values from $choices will be used for both the values of the options and the text the user sees. Defaulted to true.

$width : int = 300

the width of the input field in pixels. Default: 300.

config_add_multi_select()

Return a data structure that will instruct the configuration page generator functions to add a multi select configuration variable to the setup page.

config_add_multi_select(string $config_var, string $label, mixed $choices[, bool $usekeys = true ][, int $width = 300 ]) : mixed
Parameters
$config_var : string

the name of the configuration variable to be added.

$label : string

the user text displayed to label the select block. Usually a $lang string.

$choices : mixed
$usekeys : bool = true

tells whether to use the keys from $choices as the values of the options. If set to false the values from $choices will be used for both the values of the options and the text the user sees. Defaulted to true.

$width : int = 300

the width of the input field in pixels. Default: 300.

config_single_user_select()

Generate an html single-select block for selecting one of the RS users.

config_single_user_select(string $name, string $label[, int $current = array() ][, int $width = 300 ]) : mixed

The user key (i.e., the value from the "ref" column of the user table) of the selected user is the value posted.

Parameters
$name : string

the name of the select block. Usually the name of the config variable being set.

$label : string

the user text displayed to label the select block. Usually a $lang string.

$current : int = array()

the current value of the config variable being set.

$width : int = 300

the width of the input field in pixels. Default: 300.

config_add_single_user_select()

Return a data structure that will instruct the configuration page generator functions to add a single RS user select configuration variable to the setup page.

config_add_single_user_select(string $config_var, string $label[, int $width = 300 ]) : mixed
Parameters
$config_var : string

the name of the configuration variable to be added.

$label : string

the user text displayed to label the select block. Usually a $lang string.

$width : int = 300

the width of the input field in pixels. Default: 300.

config_multi_user_select()

Generate an html multi-select block for selecting from among RS users.

config_multi_user_select(string $name, string $label[, mixed $current = array() ][, int $width = 420 ]) : mixed

An array consisting of the user keys (i.e., values from the "ref" column of the user table) for the selected users is the value posted.

Parameters
$name : string

the name of the select block. Usually the name of the config variable being set.

$label : string

the user text displayed to label the select block. Usually a $lang string.

$current : mixed = array()
$width : int = 420

the width of the input field in pixels. Default: 300.

config_add_multi_user_select()

Return a data structure that will instruct the configuration page generator functions to add a multiple RS user select configuration variable to the setup page.

config_add_multi_user_select(string $config_var, string $label[, int $width = 420 ]) : mixed
Parameters
$config_var : string

the name of the configuration variable to be added.

$label : string

the user text displayed to label the select block. Usually a $lang string.

$width : int = 420

the width of the input field in pixels. Default: 420.

config_single_group_select()

Generate an html single-select block for selecting from among RS user groups.

config_single_group_select(string $name, string $label[, mixed $current = array() ][, int $width = 300 ]) : mixed
Parameters
$name : string

the name of the select block. Usually the name of the config variable being set.

$label : string

the user text displayed to label the select block. Usually a $lang string.

$current : mixed = array()
$width : int = 300

the width of the input field in pixels. Default: 300.

config_add_single_group_select()

Return a data structure that will instruct the configuration page generator functions to add a single RS group select configuration variable to the setup page.

config_add_single_group_select(string $config_var, string $label[, int $width = 300 ]) : mixed
Parameters
$config_var : string

the name of the configuration variable to be added.

$label : string

the user text displayed to label the select block. Usually a $lang string.

$width : int = 300

the width of the input field in pixels. Default: 300.

config_multi_group_select()

Generate an html multi-select block for selecting from among RS user groups.

config_multi_group_select(string $name, string $label[, mixed $current = array() ][, int $width = 420 ]) : mixed

An array consisting of the group keys (i.e., values from the "ref" column of the usergroup table) for the selected groups is the value posted.

Parameters
$name : string

the name of the select block. Usually the name of the config variable being set.

$label : string

the user text displayed to label the select block. Usually a $lang string.

$current : mixed = array()
$width : int = 420

the width of the input field in pixels. Default: 300.

config_add_multi_group_select()

Return a data structure that will instruct the configuration page generator functions to add a multiple RS user select configuration variable to the setup page.

config_add_multi_group_select(string $config_var, string $label[, int $width = 420 ]) : mixed
Parameters
$config_var : string

the name of the configuration variable to be added.

$label : string

the user text displayed to label the select block. Usually a $lang string.

$width : int = 420

the width of the input field in pixels. Default: 300.

config_multi_ftype_select()

Generate an html multi-select + options block for selecting multiple RS field types. The selected field type is posted as an array of the values of the "ref" column of the selected field types.

config_multi_ftype_select(string $name, string $label, array<string|int, mixed> $current[, int $width = 300 ][, int $size = 7 ][, int $rtype = false ]) : mixed
Parameters
$name : string

the name of the select block. Usually the name of the config variable being set.

$label : string

the user text displayed to label the select block. Usually a $lang string.

$current : array<string|int, mixed>

Array holding the current field IDs of the config variable being set

$width : int = 300

the width of the input field in pixels. Default: 300.

$size : int = 7
  • Number of visible options. Default 7
$rtype : int = false
  • Limit to fields associated with a specific resource type

config_add_multi_ftype_select()

Return a data structure that will instruct the configuration page generator functions to add a multiple RS field-type select configuration variable to the setup page.

config_add_multi_ftype_select(string $config_var, string $label[, int $width = 300 ][, mixed $size = 7 ][, mixed $ftype = false ]) : mixed
Parameters
$config_var : string

the name of the configuration variable to be added.

$label : string

the user text displayed to label the select block. Usually a $lang string.

$width : int = 300

the width of the input field in pixels. Default: 300.

$size : mixed = 7
$ftype : mixed = false

config_single_rtype_select()

Generate an html single-select + options block for selecting one of the RS resource types. The selected field type is posted as the value of the "ref" column of the selected resource type.

config_single_rtype_select(string $name, string $label, int $current[, int $width = 300 ]) : mixed
Parameters
$name : string

the name of the select block. Usually the name of the config variable being set.

$label : string

the user text displayed to label the select block. Usually a $lang string.

$current : int

the current value of the config variable being set

$width : int = 300

the width of the input field in pixels. Default: 300.

config_add_single_rtype_select()

Return a data structure that will instruct the configuration page generator functions to add a single RS resource-type select configuration variable to the setup page.

config_add_single_rtype_select(string $config_var, string $label[, int $width = 300 ]) : mixed
Parameters
$config_var : string

the name of the configuration variable to be added.

$label : string

the user text displayed to label the select block. Usually a $lang string.

$width : int = 300

the width of the input field in pixels. Default: 300.

config_multi_rtype_select()

Generate an html multi-select check boxes block for selecting multiple the RS resource types. The selected field type is posted as an array of the values of the "ref" column of the selected resource types.

config_multi_rtype_select(string $name, string $label, mixed $current[, int $width = 300 ]) : mixed
Parameters
$name : string

the name of the select block. Usually the name of the config variable being set.

$label : string

the user text displayed to label the select block. Usually a $lang string.

$current : mixed
$width : int = 300

the width of the input field in pixels. Default: 300.

config_add_multi_rtype_select()

Return a data structure that will instruct the configuration page generator functions to add a multiple RS resource-type select configuration variable to the setup page.

config_add_multi_rtype_select(string $config_var, string $label[, int $width = 300 ]) : mixed
Parameters
$config_var : string

the name of the configuration variable to be added.

$label : string

the user text displayed to label the select block. Usually a $lang string.

$width : int = 300

the width of the input field in pixels. Default: 300.

config_multi_archive_select()

Generate an html multi-select check boxes block for selecting multiple the RS archive states.

config_multi_archive_select(string $name, string $label, mixed $current, mixed $choices[, int $width = 300 ]) : mixed

The selections are posted as an array of the archive states archive state.

Parameters
$name : string

the name of the select block. Usually the name of the config variable being set.

$label : string

the user text displayed to label the select block. Usually a $lang string.

$current : mixed
$choices : mixed
$width : int = 300

the width of the input field in pixels. Default: 300.

config_add_multi_archive_select()

Return a data structure that will instruct the configuration page generator functions to add a multiple RS archive select configuration variable to the setup page.

config_add_multi_archive_select(string $config_var, string $label, mixed $choices[, int $width = 300 ]) : mixed
Parameters
$config_var : string

the name of the configuration variable to be added.

$label : string

the user text displayed to label the select block. Usually a $lang string.

$choices : mixed
$width : int = 300

the width of the input field in pixels. Default: 300.

config_db_single_select()

Generate an html single-select + options block for selecting from among rows returned by a database query in which one of the columns is the unique key (by default, the "ref" column) and one of the others is the text to display (by default the "name" column). The value posted is the value at the intersection of the selected rown with the column given by the $ixcol variable.

config_db_single_select(string $name, string $label, string $current, array<string|int, mixed> $choices[, string $ixcol = 'ref' ][, string $dispcolA = 'name' ][, string $dispcolB = '' ][, string $fmt = '' ][, int $width = 300 ]) : mixed
Parameters
$name : string

the name of the select block. Usually the name of the config variable being set.

$label : string

the user text displayed to label the select block. Usually a $lang string.

$current : string

the current value of the config variable being set.

$choices : array<string|int, mixed>

the array of db rows that make up the choices.

$ixcol : string = 'ref'

the key in $choices (i.e., the db column) for the value of the choice. Defaulted to 'ref'.

$dispcolA : string = 'name'

the key in $choices (i.e., the db column) for the text to display to the user. Defaulted to 'name'.

$dispcolB : string = ''

the key in $choices (i.e., the db column) for secondary text to display to the user. Defaulted to '' indicating that only $dispcolA is to be displayed.

$fmt : string = ''

the formatting string for combining $dispcolA and B when both are specified. Defaulted to $lang['plugin_field_fmt']. $fmt is all literal except for %A and %B which are replaced with values. In English $fmt is '%A(%B)' which results in the i-th choice displaying as: $choices[i][$dispcolA] . '(' . $choices[i][$dispcolB] . ')'

$width : int = 300

the width of the input field in pixels. Default: 300.

config_add_db_single_select()

Return a data structure that will instruct the configuration page generator functions to add a single select configuration variable whose value is chosen from among the results of a db query to the setup page.

config_add_db_single_select(string $config_var, string $label, array<string|int, mixed> $choices[, string $ixcol = 'ref' ][, string $dispcolA = 'name' ][, string $dispcolB = '' ][, string $fmt = '' ][, int $width = 300 ]) : mixed
Parameters
$config_var : string

the name of the configuration variable to be added.

$label : string

the user text displayed to label the select block. Usually a $lang string.

$choices : array<string|int, mixed>

the array of db rows that make up the choices.

$ixcol : string = 'ref'

the key in $choices (i.e., the db column) for the value of the choice. Defaulted to 'ref'.

$dispcolA : string = 'name'

the key in $choices (i.e., the db column) for the text to display to the user. Defaulted to 'name'.

$dispcolB : string = ''

the key in $choices (i.e., the db column) for secondary text to display to the user. Defaulted to '' indicating that only $dispcolA is to be displayed.

$fmt : string = ''

the formatting string for combining $dispcolA and B when both are specified. Defaulted to $lang['plugin_field_fmt']. $fmt is all literal except for %A and %B which are replaced with values. In English $fmt is '%A(%B)' which results in the i-th choice displaying as: $choices[i][$dispcolA] . '(' . $choices[i][$dispcolB] . ')'

$width : int = 300

the width of the input field in pixels. Default: 300.

config_db_multi_select()

Generate an html multi-select + options block for selecting from among rows returned by a database query in which one of the columns is the unique key (by default, the "ref" column) and one of the others is the text to display (by default the "name" column). The value posted is an array of the values of the column given by the $ixcol variable for the rows selected.

config_db_multi_select(string $name, string $label, mixed $current, array<string|int, mixed> $choices[, string $ixcol = 'ref' ][, string $dispcolA = 'name' ][, string $dispcolB = '' ][, string $fmt = '' ][, int $width = 300 ]) : mixed
Parameters
$name : string

the name of the select block. Usually the name of the config variable being set.

$label : string

the user text displayed to label the select block. Usually a $lang string.

$current : mixed
$choices : array<string|int, mixed>

the array of db rows that make up the choices.

$ixcol : string = 'ref'

the key in $choices (i.e., the db column) for the value of the choice Defaulted to 'ref'.

$dispcolA : string = 'name'

the key in $choices (i.e., the db column) for the text to display to the user. Defaulted to 'name'.

$dispcolB : string = ''

the key in $choices (i.e., the db column) for secondary text to display to the user. Defaulted to '' indicating that only $dispcolA is to be displayed.

$fmt : string = ''

the formatting string for combining $dispcolA and B when both are specified. Defaulted to $lang['plugin_field_fmt']. $fmt is all literal except for %A and %B which are replaced with values. In English $fmt is '%A(%B)' which results in the i-th choice displaying as: $choices[i][$dispcolA] . '(' . $choices[i][$dispcolB] . ')'

$width : int = 300

the width of the input field in pixels. Default: 300.

config_add_db_multi_select()

Return a data structure that will instruct the configuration page generator functions to add a multi select configuration variable whose values are chosen from among the results of a db query to the setup page.

config_add_db_multi_select(string $config_var, string $label, array<string|int, mixed> $choices[, string $ixcol = 'ref' ][, string $dispcolA = 'name' ][, string $dispcolB = '' ][, string $fmt = '' ][, int $width = 300 ]) : mixed
Parameters
$config_var : string

the name of the configuration variable to be added.

$label : string

the user text displayed to label the select block. Usually a $lang string.

$choices : array<string|int, mixed>

the array of db rows that make up the choices.

$ixcol : string = 'ref'

the key in $choices (i.e., the db column) for the value of the choice. Defaulted to 'ref'.

$dispcolA : string = 'name'

the key in $choices (i.e., the db column) for the text to display to the user. Defaulted to 'name'.

$dispcolB : string = ''

the key in $choices (i.e., the db column) for secondary text to display to the user. Defaulted to '' indicating that only $dispcolA is to be displayed.

$fmt : string = ''

the formatting string for combining $dispcolA and B when both are specified. Defaulted to $lang['plugin_field_fmt']. $fmt is all literal except for %A and %B which are replaced with values. In English $fmt is '%A(%B)' which results in the i-th choice displaying as: $choices[i][$dispcolA] . '(' . $choices[i][$dispcolB] . ')'

$width : int = 300

the width of the input field in pixels. Default: 300.

config_add_hidden()

Return a data structure that will instruct the configuration page generator functions to add a hidden configuration variable.

config_add_hidden(string $config_var) : mixed
Parameters
$config_var : string

the name of the configuration variable to be added.

config_text_field()

Deprecated -- use config_text_input instead

config_text_field(mixed $name, mixed $label, mixed $value[, mixed $size = '30' ]) : mixed
Parameters
$name : mixed
$label : mixed
$value : mixed
$size : mixed = '30'

config_userselect_field()

Deprecated -- use config_multi_user_select instead

config_userselect_field(mixed $name, mixed $label[, mixed $values = array() ]) : mixed
Parameters
$name : mixed
$label : mixed
$values : mixed = array()

config_field_select()

Deprecated -- use config_single_ftype_select instead

config_field_select(mixed $name, mixed $label, mixed $value) : mixed
Parameters
$name : mixed
$label : mixed
$value : mixed

config_boolean_field()

Deprecated -- use config_boolean_select instead

config_boolean_field(mixed $name, mixed $label, mixed $value) : mixed
Parameters
$name : mixed
$label : mixed
$value : mixed

config_custom_select_multi()

Deprecated -- use config_db_multi_select instead

config_custom_select_multi(mixed $name, mixed $label, mixed $available, mixed $values[, mixed $index = 'ref' ][, mixed $nameindex = 'name' ][, mixed $additional = '' ]) : mixed
Parameters
$name : mixed
$label : mixed
$available : mixed
$values : mixed
$index : mixed = 'ref'
$nameindex : mixed = 'name'
$additional : mixed = ''

config_custom_select()

Deprecated -- use config_single_select instead

config_custom_select(mixed $name, mixed $label, mixed $available, mixed $value) : mixed
Parameters
$name : mixed
$label : mixed
$available : mixed
$value : mixed

plugin_activate_for_setup()

plugin_activate_for_setup(mixed $plugin_name) : mixed
Parameters
$plugin_name : mixed

include_plugin_config()

Includes configuration files for a specified plugin.

include_plugin_config(string $plugin_name[, string $config = "" ][, string $config_json = "" ]) : void
Parameters
$plugin_name : string

The name of the plugin whose configuration files are to be included.

$config : string = ""

Optional serialized base64-encoded configuration string.

$config_json : string = ""

Optional JSON-encoded configuration string.

Return values
void

This function does not return a value; it modifies global variables.

register_plugin_language()

Registers the language files for a specified plugin.

register_plugin_language(string $plugin) : void
Parameters
$plugin : string

The name of the plugin for which to register language files.

Return values
void

This function does not return a value; it modifies the global $lang variable.

get_plugin_path()

Retrieves the file path for a specified plugin.

get_plugin_path(string $plugin[, bool $url = false ]) : string|false

This function checks both the standard plugin directory and the user-uploaded filestore directory to locate the plugin. It can return either the file path on disk or a URL to the plugin based on the provided parameter.

Parameters
$plugin : string

The short name of the plugin to locate.

$url : bool = false

Optional. If true, return the URL to the plugin instead of the file path. Default is false.

Return values
string|false

The path to the plugin on disk or the URL to the plugin, or false if the plugin is not found.

register_plugin()

Registers a specified plugin by including its hooks and API bindings.

register_plugin(string $plugin) : bool

This function attempts to load hook files specific to the current page, as well as an 'all' hook that is applicable across all pages. Additionally, it loads any API bindings that the plugin may have.

Parameters
$plugin : string

The short name of the plugin to register.

Return values
bool

Always returns true after attempting to include the relevant files.

plugin_encode_complex_configs()

Encode complex plugin configuration (e.g mappings defined by users on plugins' setup page)

plugin_encode_complex_configs(mixed $c) : string
Parameters
$c : mixed

Configuration requiring encoding

Return values
string

plugin_decode_complex_configs()

Decode complex plugin configuration (e.g mappings defined by users on plugins' setup page)

plugin_decode_complex_configs(string $b64sc) : mixed
Parameters
$b64sc : string

Configuration encoded prior with plugin_encode_complex_configs()

register_group_access_plugins()

Load group specific plugins and reorder plugins list

register_group_access_plugins([int $usergroup = -1 ][, array<string|int, mixed> $plugins = [] ]) : array<string|int, mixed>
Parameters
$usergroup : int = -1

Usergroup reference

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

Enabled Plugins

Return values
array<string|int, mixed>

register_all_group_access_plugins()

Load ALL group specific plugins and reorder plugins list This will bypass any group access controls for use with CLI scripts

register_all_group_access_plugins(array<string|int, mixed> $plugins) : array<string|int, mixed>
Parameters
$plugins : array<string|int, mixed>

Enabled Plugins

Return values
array<string|int, mixed>

RenderPlugin()

Render the plugin in the Plugin Manager with options to activate and configure.

RenderPlugin(array<string|int, mixed> $plugin[, bool $active = true ]) : void
Parameters
$plugin : array<string|int, mixed>

An array containing the plugin data, loaded from the plugin table

$active : bool = true

If true, display options to deactivate and allow group configuration

On this page

Search results