Documentation

config_functions.php

Helper and rendering function for the configuration pages in the team center

Table of Contents

Functions

render_select_option()  : string
Renders a select element.
render_bool_option()  : string
Render a yes/no field with the given fieldname.
render_text_option()  : string
Renders a text field for a given field name.
set_config_option()  : bool
Save/ Update config option for user preference or system config. For user group config see set_usergroup_config_option().
set_usergroup_config_option()  : bool
Save or update config option for user group.
delete_config_option()  : bool
Delete entry from the user_preferences table completely (instead of setting to blank via set_config_option).
remove_config_option()  : bool
Remove system/user preferences
get_config_option()  : bool
Get config option value from the database. This may be a system wide config, a user group preference, a user preference, or the result of overriding a user group preference with a user preference if any are present.
get_config_option_users()  : array<string|int, mixed>
Get all user refs with a specific configuration option set from database
get_config_options()  : bool
Get config option from database for a specific user, system wide or user group.
get_usergroup_parent_for_inherit_flag()  : int
Check if the usergroup has a parent and the specified inherit flag is in use e.g. user group inherits permissions from parent.
process_config_options()  : void
Process configuration options from database either system wide, user group or user specific, setting the global variable.
config_clean()  : a
Utility function to "clean" the passed $config. Cleaning consists of two parts: * Suppressing really simple XSS attacks by refusing to allow strings containing the characters "<script" in upper, lower or mixed case.
config_html()  : mixed
Generate arbitrary html
config_add_html()  : mixed
Return a data structure that will instruct the configuration page generator functions to add arbitrary HTML
config_text_input()  : mixed
Generate an html text entry or password block
config_integer_input()  : void
Generate an HTML form element for input of integer only values. Field will include validation for supplied value being of type int and between supplied min and max values.
config_add_text_input()  : mixed
Return a data structure that will instruct the configuration page generator functions to add a text entry configuration variable to the setup page.
config_add_integer_input()  : mixed
config_add_hidden_input()  : array<string|int, mixed>
Generate a data structure to instruct the configuration page generator to add a hidden input
config_file_input()  : mixed
Generate an HTML input file with its own form
config_add_file_input()  : mixed
Return a data structure that will be used to generate the HTML for uploading a file
config_single_select()  : mixed
Generate an html single-select + options block
config_add_single_select()  : mixed
Return a data structure that will instruct the configuration page generator functions to add a single select configuration variable to the setup page.
config_boolean_select()  : mixed
Generate an html boolean select block
config_add_boolean_select()  : mixed
Return a data structure that will instruct the configuration page generator functions to add a boolean configuration variable to the setup page.
config_checkbox_select()  : mixed
Generate an html checkbox options block
config_add_checkbox_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_add_colouroverride_input()  : mixed
config_add_single_ftype_select()  : mixed
Return a data structure that will instruct the configuration page generator functions to add a single RS field-type select configuration variable to the setup page.
config_single_ftype_select()  : mixed
Generate an html single-select + options block for selecting one of the RS field types. The selected field type is posted as the value of the "ref" column of the selected field type.
config_generate_AutoSaveConfigOption_function()  : mixed
Generate Javascript function used for auto saving individual config options
config_process_file_input()  : mixed
config_generate_html()  : mixed
Generates HTML foreach element found in the page definition
config_merge_non_image_types()  : array<string|int, mixed>
Merge all non image configurations
get_header_image()  : string
Retrieves the header image URL based on the user's appearance preference and system configuration.
config_register_core_fieldvars()  : void
Used to block deletion of 'core' fields. Any variable added to the $corefields array will be checked before a field is deleted and if the field is referenced by one of these core variables the deletion will be blocked
config_register_core_field_refs()  : mixed
Used to block deletion of 'core' fields.
override_rs_variables_by_eval()  : void
Run PHP code on array of variables. Used for modifying $GLOBALS.
update_resource_type_field_resource_types()  : void
Update the resource_type_field - resource_type mappings
get_resource_type_field_resource_types()  : array<string|int, mixed>
Get all resource_type->resource-type_field associations
create_resource_type()  : int|bool
Create a new resource type with the specified name
save_resource_type()  : bool
Save updated resource_type data
clear_restype_cache()  : void
Force clear of restype_cache after editing resource type where get_resource_types() needs to pick up the new value.
rs_get_resource_type()  : array<string|int, mixed>
Get resource_type data
save_resource_type_field()  : bool
Save resource type field - used on pages/admin/admin_resource_type_field_edit.php
get_resource_type_field_columns()  : array<string|int, mixed>
Get the definitions for resource_type_field columns, including properties and display configurations.
is_valid_contact_sheet_preview_size()  : bool
Input validation helper function to determine if the $contact_sheet_preview_size config is valid.
save_removed_ui_config()  : bool
Store a config option that has been removed from the UI so that it will still work until it has been set in config file
check_removed_ui_config()  : bool
Check if there is a previously stored value for the given config option.
config_add_fixed_input()  : array<string|int, mixed>
Return a data structure that will instruct the configuration page generator functions to add a fixed input setting to the setup page. Uses render_fixed_text_question(). Useful for options removed from the UI
render_config_filter_by_search()  : void
Add config option search to user preferences / system configuration page.
config_filter_by_search()  : array<string|int, mixed>
Process values from config search fields, see render_config_filter_by_search() Filter $page_def elements to show only those searched for.
config_remove_user_preferences()  : void
Remove user preferences by resetting to system preferences. Used to display system config or user group config without the current user's preferences changing the values.
config_percent_range()  : mixed
Generate a percentage range input
config_add_percent_range()  : mixed
Return a data structure that will instruct the configuration page generator functions to add a text entry configuration variable to the setup page.
config_check_valid_option()  : bool
Server side validation for saving values submitted using the page generation functions "config_add_...()" and created with config_generate_html(). For example, the system configuration page.

Functions

render_select_option()

Renders a select element.

render_select_option(string $fieldname, array<string|int, mixed> $opt_array, mixed $selected[, string $groupby = '' ]) : string

Takes an array of options (as returned from sql_query and returns a valid select element. The query must have a column aliased as value and label. Option groups can be created as well with the optional $groupby parameter. This function retrieves a language field in the form of $lang['cfg-'] to use for the element label.

$options = sql_select("SELECT name AS label, ref AS value FROM resource_type");

render_select_option('myfield', $options, 18);

Parameters
$fieldname : string

Name to use for the field.

$opt_array : array<string|int, mixed>

Array of options to fill the select with

$selected : mixed

If matches value the option is marked as selected

$groupby : string = ''

Column to group by

Return values
string

HTML output.

render_bool_option()

Render a yes/no field with the given fieldname.

render_bool_option(string $fieldname, bool $value) : string

This function will use $lang['cfg-'] as the text label for the element.

Parameters
$fieldname : string

Name of field.

$value : bool

Current field value

Return values
string

HTML Output

render_text_option()

Renders a text field for a given field name.

render_text_option(string $fieldname, string $value[, int $size = 20 ][, string $units = '' ]) : string

Uses $lang['cfg-'] as the field label.

Parameters
$fieldname : string

Name of field

$value : string

Current field value

$size : int = 20

Size of text field, optional, defaults to 20

$units : string = ''

Optional units parameter. Displays to right of text field.

Return values
string

HTML Output

set_config_option()

Save/ Update config option for user preference or system config. For user group config see set_usergroup_config_option().

set_config_option(int $user_id, string $param_name, string $param_value[, string $activity_log_note = null ]) : bool
Parameters
$user_id : int

Current user ID. Use NULL for system wide config options

$param_name : string

Parameter name

$param_value : string

Parameter value

$activity_log_note : string = null

Optional. Allows a note to be recorded in the activity log entry. Helpful to record the origin of the configuration change.

Return values
bool

set_usergroup_config_option()

Save or update config option for user group.

set_usergroup_config_option(int $usergroup_id, string $param_name, string $param_value) : bool
Parameters
$usergroup_id : int

User group id

$param_name : string

Config parameter name

$param_value : string

Config parameter value

Return values
bool

delete_config_option()

Delete entry from the user_preferences table completely (instead of setting to blank via set_config_option).

delete_config_option(array<string|int, mixed> $config_type, string $param_name[, string|null $activity_log_note = null ]) : bool

Used by system preferences page when deleting a file to allow fallback to value (if set) in config.php instead of replacing it with blank from user_preference value.

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

The type of config to delete supplied as an array. The following are possible: array() - Supply an empty array to delete a system config value. array('user' => 1) - Supply 'user' with the integer user reference to delete a user config value. array('usergroup' => 2) - Supply 'usergroup' with the integer user reference to delete a user group config value.

$param_name : string

Parameter name

$activity_log_note : string|null = null
Return values
bool

True if preference was deleted else false.

remove_config_option()

Remove system/user preferences

remove_config_option(int|null $user_id, string $name) : bool
Parameters
$user_id : int|null

Database user ID

$name : string

Configuration option (variable) name

Return values
bool

get_config_option()

Get config option value from the database. This may be a system wide config, a user group preference, a user preference, or the result of overriding a user group preference with a user preference if any are present.

get_config_option(array<string|int, mixed> $config_type, string $name, string &$returned_value[, mixed $default = null ]) : bool
Parameters
$config_type : array<string|int, mixed>

The type of config to retrieve supplied as an array. The following combinations are possible: array() - Supply an empty array to return a system config value. array('usergroup' => 2) - Supply 'usergroup' with the integer user group reference to return a user group config value. array('user' => 1) - Supply 'user' with the integer user reference to return a user config value. array('user' => 1, 'usergroup' => 2) - Supply 'user' with the integer user reference and 'usergroup' with the integer user group reference to return the result of user group config overridden with user preference. Usergroup should always be that of the supplied user. Don't supply parent group as this will be checked.

$name : string

Parameter name

$returned_value : string

The config value will be returned through this parameter which is passed by reference. IMPORTANT: it falls back (defaults) to the globally scoped config option value if there's nothing in the database.

$default : mixed = null

Optionally used to set a default that may not be the current global setting e.g. for checking admin resource preferences

Return values
bool

Indicates if the config option was found in the database or not.

get_config_option_users()

Get all user refs with a specific configuration option set from database

get_config_option_users(string $option, string $value) : array<string|int, mixed>
Parameters
$option : string

Parameter name

$value : string

Parameter value

Return values
array<string|int, mixed>

Array of user references

get_config_options()

Get config option from database for a specific user, system wide or user group.

get_config_options(array<string|int, mixed> $config_type, array<string|int, mixed> &$returned_options) : bool
Parameters
$config_type : array<string|int, mixed>

The type of config to retrieve supplied as an array. The following combinations are possible: array() - Supply an empty array to return a system config value. array('user' => 1) - Supply 'user' with the integer user reference to return user config values. array('usergroup' => 2) - Supply 'usergroup' with the integer user reference to return user group config values. Note: Supplying both 'user' and 'usergroup' is invalid.

$returned_options : array<string|int, mixed>

If a value does exist it will be returned through this parameter which is passed by reference

Return values
bool

get_usergroup_parent_for_inherit_flag()

Check if the usergroup has a parent and the specified inherit flag is in use e.g. user group inherits permissions from parent.

get_usergroup_parent_for_inherit_flag(int $usergroup_id, string $inherit_flag) : int
Parameters
$usergroup_id : int

User group of the current user / user group to test.

$inherit_flag : string

Inherit flag to test for.

Return values
int

User group id of parent if found and using supplied inherit flag else returns user group id supplied.

process_config_options()

Process configuration options from database either system wide, user group or user specific, setting the global variable.

process_config_options(array<string|int, mixed> $config_type) : void

Three modes are possible: array() - Supply an empty array to load system config values. array('user' => 1) - Supply 'user' with the integer user reference to load user config values. array('usergroup' => 2) - Supply 'usergroup' with the integer user reference to load user group config values. Note: Supplying both 'user' and 'usergroup' is invalid. In some scenarios, calling this function twice will be required e.g. load user group config then override with user config. Note: calling this function will not revert user preferences applied previously e.g. during initialisation as a different user. If the current user's preferences shouldn't be shown, consider using $system_wide_config_options to reapply selected system values.

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

Specify the type of config to be loaded. See details above.

config_clean()

Utility function to "clean" the passed $config. Cleaning consists of two parts: * Suppressing really simple XSS attacks by refusing to allow strings containing the characters "<script" in upper, lower or mixed case.

config_clean(mixed $config) : a
  • Unescaping instances of "'" and '"' that have been escaped by the lovely magic_quotes_gpc facility, if it's on.
Parameters
$config : mixed

mixed thing to be cleaned.

Return values
a

cleaned version of $config.

config_html()

Generate arbitrary html

config_html(string $content) : mixed
Parameters
$content : string

arbitrary HTML

config_add_html()

Return a data structure that will instruct the configuration page generator functions to add arbitrary HTML

config_add_html(string $content) : mixed
Parameters
$content : string

config_text_input()

Generate an html text entry or password block

config_text_input(string $name, string $label, string $current[, bool $password = false ][, int $width = 420 ][, bool $textarea = false ][, string $title = null ][, bool $autosave = false ][, bool $hidden = false ][, string $help_link = "" ]) : mixed
Parameters
$name : 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.

$current : string

The current value of the config variable being set.

$password : bool = false

Whether this is a "normal" text-entry field or a password-style field.

$width : int = 420

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

$textarea : bool = false

Render as a HTML <textarea>

$title : string = null

The title attribute of the element

$autosave : bool = false

Enable auto-saving of changes when focus is lost

$hidden : bool = false

Whether field is hidden on the page

$help_link : string = ""

Help link to be displayed alongside the label.

config_integer_input()

Generate an HTML form element for input of integer only values. Field will include validation for supplied value being of type int and between supplied min and max values.

config_integer_input(string $name, string $label, string $current, int $min_value, int $max_value[, int $width = 55 ][, string $title = null ][, bool $autosave = false ][, bool $hidden = false ][, string $help_link = "" ]) : void

** While this function can handle client side validation, config_check_valid_option() must be used on save to allow for server side checking of the value. For an example, see pages/admin/admin_system_config.php

Parameters
$name : 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.

$current : string

The current value of the config variable being set.

$min_value : int

Minimum value permitted in field.

$max_value : int

Maximum value permitted in field.

$width : int = 55

The width of the input field in pixels. Default: 55.

$title : string = null

The title attribute of the element

$autosave : bool = false

Enable auto-saving of changes when focus is lost

$hidden : bool = false

Whether field is hidden on the page

$help_link : string = ""

Help link to be displayed alongside the label.

config_add_text_input()

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

config_add_text_input(string $config_var, string $label[, bool $password = false ][, int $width = 420 ][, bool $textarea = false ][, string $title = null ][, bool $autosave = false ][, bool $hidden = false ][, string $help_link = "" ]) : 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.

$width : int = 420

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

$textarea : bool = false

Render as a HTML <textarea>

$title : string = null

The title attribute of the element

$autosave : bool = false

Enable auto-saving of changes when focus is lost

$hidden : bool = false

Whether field is hidden on the page

$help_link : string = ""

Help link to be displayed alongside the label.

config_add_integer_input()

config_add_integer_input(mixed $config_var, mixed $label, mixed $min_value, mixed $max_value[, mixed $width = 420 ][, mixed $title = null ][, mixed $autosave = false ][, mixed $hidden = false ][, string $help_link = "" ]) : mixed
Parameters
$config_var : mixed
$label : mixed
$min_value : mixed
$max_value : mixed
$width : mixed = 420
$title : mixed = null
$autosave : mixed = false
$hidden : mixed = false
$help_link : string = ""

config_add_hidden_input()

Generate a data structure to instruct the configuration page generator to add a hidden input

config_add_hidden_input(string $cf_var_name[, string $cf_var_value = '' ]) : array<string|int, mixed>
Parameters
$cf_var_name : string

Plugins' configuration variable name

$cf_var_value : string = ''

Value

Return values
array<string|int, mixed>

config_file_input()

Generate an HTML input file with its own form

config_file_input(string $name, string $label, mixed $current, string $form_action[, int $width = 420 ][, mixed $valid_extensions = array() ][, mixed $file_preview = false ][, string $title = null ]) : mixed
Parameters
$name : string

HTML input file name attribute

$label : string
$current : mixed
$form_action : string

URL where the form should post to

$width : int = 420

Wdidth of the input file HTML tag. Default - 420

$valid_extensions : mixed = array()
$file_preview : mixed = false
$title : string = null

Title to be used for the label title. Default: null. Will display as hover text e.g. "Sets configuration variable: $variable_name" if $title is supplied as null. Use '' (blank) to disable where no text is required.

config_add_file_input()

Return a data structure that will be used to generate the HTML for uploading a file

config_add_file_input(mixed $config_var, string $label, string $form_action[, int $width = 420 ][, array<string|int, mixed> $valid_extensions = array() ][, mixed $file_preview = false ][, string $title = null ]) : mixed
Parameters
$config_var : mixed
$label : string

Label for field

$form_action : string

URL where the form should post to

$width : int = 420

Width of the input file HTML tag. Default - 420

$valid_extensions : array<string|int, mixed> = array()

Optional array of file extensions that will be validated during upload, see config_process_file_input()

$file_preview : mixed = false
$title : string = null

Title to be used for the label title. Default: null. Will display as hover text e.g. "Sets configuration variable: $variable_name" if $title is supplied as null. Use '' (blank) to disable where no text is required.

config_single_select()

Generate an html single-select + options block

config_single_select(string $name, string $label, string $current, mixed $choices[, bool $usekeys = true ][, int $width = 420 ][, string $title = null ][, bool $autosave = false ][, mixed $on_change_js = null ][, mixed $hidden = false ][, bool $reload_page = 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 : string

The current value of the config variable being set.

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

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

$title : string = null

Title to be used for the label title. Default: null

$autosave : bool = false

Flag to say whether the there should be an auto save message feedback through JS. Default: false Note: onChange event will call AutoSaveConfigOption([option name])

$on_change_js : mixed = null
$hidden : mixed = false
$reload_page : bool = false

config_add_single_select()

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

config_add_single_select(string $config_var, string $label[, mixed $choices = '' ][, bool $usekeys = true ][, int $width = 420 ][, mixed $title = null ][, mixed $autosave = false ][, mixed $on_change_js = null ][, mixed $hidden = false ][, bool $reload_page = 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.

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

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

$title : mixed = null
$autosave : mixed = false
$on_change_js : mixed = null
$hidden : mixed = false
$reload_page : bool = false

config_boolean_select()

Generate an html boolean select block

config_boolean_select(string $name, string $label, bool $current[, mixed $choices = '' ][, int $width = 420 ][, string $title = null ][, bool $autosave = false ][, mixed $on_change_js = null ][, mixed $hidden = false ][, string $help = '' ][, bool $reload_page = 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 : bool

The current value (true or false) of the config variable being set.

$choices : mixed = ''
$width : int = 420

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

$title : string = null

Title to be used for the label title. Default: null

$autosave : bool = false

Flag to say whether the there should be an auto save message feedback through JS. Default: false Note: onChange event will call AutoSaveConfigOption([option name])

$on_change_js : mixed = null
$hidden : mixed = false
$help : string = ''

Help text to display for this question

$reload_page : bool = false

Reload the page after saving, useful for large CSS changes.

config_add_boolean_select()

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

config_add_boolean_select(string $config_var, string $label[, mixed $choices = '' ][, int $width = 420 ][, mixed $title = null ][, mixed $autosave = false ][, mixed $on_change_js = null ][, mixed $hidden = false ][, string $help = '' ][, bool $reload_page = 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.

$choices : mixed = ''
$width : int = 420

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

$title : mixed = null
$autosave : mixed = false
$on_change_js : mixed = null
$hidden : mixed = false
$help : string = ''

Help text to display for this question

$reload_page : bool = false

Reload the page after saving.

config_checkbox_select()

Generate an html checkbox options block

config_checkbox_select(string $name, string $label, mixed $current, mixed $choices[, bool $usekeys = true ][, int $width = 300 ][, int $columns = 1 ][, mixed $autosave = false ][, mixed $on_change_js = null ][, mixed $hidden = false ]) : mixed
Parameters
$name : string

the name of the checkbox block.

$label : string

the user text displayed to label the checkbox 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.

$columns : int = 1

the number of columns to use

$autosave : mixed = false
$on_change_js : mixed = null
$hidden : mixed = false

config_add_checkbox_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_checkbox_select(string $config_var, string $label, mixed $choices[, bool $usekeys = true ][, int $width = 300 ][, mixed $columns = 1 ][, mixed $autosave = false ][, mixed $on_change_js = null ][, mixed $hidden = 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.

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

$columns : mixed = 1
$autosave : mixed = false
$on_change_js : mixed = null
$hidden : mixed = false

config_add_colouroverride_input()

config_add_colouroverride_input(mixed $config_var[, mixed $label = '' ][, mixed $default = '' ][, mixed $title = '' ][, mixed $autosave = false ][, mixed $on_change_js = null ][, mixed $hidden = false ]) : mixed
Parameters
$config_var : mixed
$label : mixed = ''
$default : mixed = ''
$title : mixed = ''
$autosave : mixed = false
$on_change_js : mixed = null
$hidden : mixed = false

config_add_single_ftype_select()

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

config_add_single_ftype_select(string $config_var, string $label[, int $width = 300 ][, int $rtype = false ][, mixed $ftypes = array() ][, mixed $autosave = 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.

$rtype : int = false

optional to specify a resource type to get fields for

$ftypes : mixed = array()
$autosave : mixed = false

config_single_ftype_select()

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

config_single_ftype_select(string $name, string $label, int $current[, int $width = 300 ][, mixed $rtype = false ][, mixed $ftypes = array() ][, mixed $autosave = 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 : int

the current value of the config variable being set

$width : int = 300

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

$rtype : mixed = false
$ftypes : mixed = array()
$autosave : mixed = false

config_generate_AutoSaveConfigOption_function()

Generate Javascript function used for auto saving individual config options

config_generate_AutoSaveConfigOption_function(string $post_url) : mixed
Parameters
$post_url : string

URL to where the data will be posted

config_process_file_input()

config_process_file_input(array<string|int, mixed> $page_def, mixed $file_location, mixed $redirect_location) : mixed
Parameters
$page_def : array<string|int, mixed>
$file_location : mixed
$redirect_location : mixed

config_generate_html()

Generates HTML foreach element found in the page definition

config_generate_html(array<string|int, mixed> $page_def) : mixed
Parameters
$page_def : array<string|int, mixed>

Array of all elements for which we need to generate HTML

config_merge_non_image_types()

Merge all non image configurations

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

Returns merged array of non image configurations.

get_header_image()

Retrieves the header image URL based on the user's appearance preference and system configuration.

get_header_image([bool $full = false ][, bool $for_header = false ][, string $force_appearance = "" ]) : string
Parameters
$full : bool = false

Whether to return the full URL including the base URL.

$for_header : bool = false

Whether the image is being displayed in the header.

$force_appearance : string = ""

Optionally force the appearance mode ('dark' or 'light').

Return values
string

The resolved URL for the header image.

config_register_core_fieldvars()

Used to block deletion of 'core' fields. Any variable added to the $corefields array will be checked before a field is deleted and if the field is referenced by one of these core variables the deletion will be blocked

config_register_core_fieldvars([string $source = "BASE" ][, array<string|int, mixed> $varnames = array() ]) : void
Parameters
$source : string = "BASE"

Optional origin of variables e.g. 'Transform plugin'

$varnames : array<string|int, mixed> = array()

Array of variable names

config_register_core_field_refs()

Used to block deletion of 'core' fields.

config_register_core_field_refs(string $source, array<string|int, mixed> $refs) : mixed
Parameters
$source : string

What part (e.g plugin) relies on this list of metadata fields

$refs : array<string|int, mixed>

List of metadata field IDs to prevent being deleted

override_rs_variables_by_eval()

Run PHP code on array of variables. Used for modifying $GLOBALS.

override_rs_variables_by_eval(array<string|int, mixed> $variables, string $code, string $override_for) : void
Parameters
$variables : array<string|int, mixed>

Array of variables to apply override on.

$code : string

Signed string containing the PHP code to run.

$override_for : string

Context in which override is being made. Generally this will be 'usergroup' or 'resource_type' config overrides. This ensures we only revert config to its original state for the same origin of the override. For example, if applying resource type specific config, don't revert config changed at the user group level. This also prevents unexpected changes of config whilst pages are being loaded.

update_resource_type_field_resource_types()

Update the resource_type_field - resource_type mappings

update_resource_type_field_resource_types(int $ref, array<string|int, mixed> $resource_types) : void
Parameters
$ref : int

Resource type field ref

$resource_types : array<string|int, mixed>

Array of resource type refs

get_resource_type_field_resource_types()

Get all resource_type->resource-type_field associations

get_resource_type_field_resource_types([array<string|int, mixed> $fields = [] ]) : array<string|int, mixed>
Parameters
$fields : array<string|int, mixed> = []

Optional array of resource_type_field data returned by get_resource_type_fields()

Return values
array<string|int, mixed>

Array with resource_type_field ID as keys and arrays of resource_type IDs as values

create_resource_type()

Create a new resource type with the specified name

create_resource_type(mixed $name) : int|bool
Parameters
$name : mixed

Name of new resouce type

Return values
int|bool

ref of new resource type or false if invalid data passed

save_resource_type()

Save updated resource_type data

save_resource_type(int $ref, array<string|int, mixed> $savedata) : bool
Parameters
$ref : int

Ref of resource type

$savedata : array<string|int, mixed>

Array of column values

Return values
bool

clear_restype_cache()

Force clear of restype_cache after editing resource type where get_resource_types() needs to pick up the new value.

clear_restype_cache() : void

rs_get_resource_type()

Get resource_type data

rs_get_resource_type(int $ref) : array<string|int, mixed>
Parameters
$ref : int
Return values
array<string|int, mixed>

save_resource_type_field()

Save resource type field - used on pages/admin/admin_resource_type_field_edit.php

save_resource_type_field(int $ref, array<string|int, mixed> $columns, mixed $postdata) : bool
Parameters
$ref : int

Field ID

$columns : array<string|int, mixed>

Array of column data

$postdata : mixed

POST'd data

Return values
bool

get_resource_type_field_columns()

Get the definitions for resource_type_field columns, including properties and display configurations.

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

An associative array of resource type field column definitions.

is_valid_contact_sheet_preview_size()

Input validation helper function to determine if the $contact_sheet_preview_size config is valid.

is_valid_contact_sheet_preview_size(string $val) : bool
Parameters
$val : string
Return values
bool

save_removed_ui_config()

Store a config option that has been removed from the UI so that it will still work until it has been set in config file

save_removed_ui_config(string $option) : bool
Parameters
$option : string
Return values
bool

Returns true if option been saved, false if not

check_removed_ui_config()

Check if there is a previously stored value for the given config option.

check_removed_ui_config(string $option[, mixed $default = "" ]) : bool

Intended for options that were previously set in the UI but now need to be set in config.

Parameters
$option : string
$default : mixed = ""

The default value to set for the config option if not set anywhere

Return values
bool

True if the config option is overridden with a stored value from user_preferences, false if not

config_add_fixed_input()

Return a data structure that will instruct the configuration page generator functions to add a fixed input setting to the setup page. Uses render_fixed_text_question(). Useful for options removed from the UI

config_add_fixed_input(string $label, string $value[, string $helptext = "" ]) : array<string|int, mixed>
Parameters
$label : string

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

$value : string

The fixed text value to be displayed

$helptext : string = ""

Optional text that will be displayed below the question

Return values
array<string|int, mixed>

Array of data that will be passed to the page generation code

Add config option search to user preferences / system configuration page.

render_config_filter_by_search(string $filter, string $only_modified) : void

Also requires config_filter_by_search() to process results. For examples, see the above pages.

Parameters
$filter : string

Value from getval("filter", "")

$only_modified : string

Value from getval("only_modified", "no")

Process values from config search fields, see render_config_filter_by_search() Filter $page_def elements to show only those searched for.

config_filter_by_search(array<string|int, mixed> $page_def, array<string|int, mixed> $config_type, string $find, string $only_modified) : array<string|int, mixed>
Parameters
$page_def : array<string|int, mixed>

Array containing page definition, from functions config_add_ ...

$config_type : array<string|int, mixed>

Array representing the type of config to check: array() - empty array for system config array('user' => 1) - key 'user' and int representing user ref to check user preferences array('usergroup' => 2) - key 'usergroup' and int representing usergroup ref to check user group preferences

$find : string

Value from getval("find", "")

$only_modified : string

Value from getval("only_modified", "no")

Return values
array<string|int, mixed>

config_remove_user_preferences()

Remove user preferences by resetting to system preferences. Used to display system config or user group config without the current user's preferences changing the values.

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

Array containing page definition, from functions config_add_ ...

config_percent_range()

Generate a percentage range input

config_percent_range(string $name, string $label, string $current[, int $width = 420 ][, string $title = null ][, string $help_link = "" ]) : mixed
Parameters
$name : 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.

$current : string

The current value of the config variable being set.

$width : int = 420

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

$title : string = null

The title attribute of the element

$help_link : string = ""

Help link to be displayed alongside the label.

config_add_percent_range()

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

config_add_percent_range(string $config_var, string $label[, int $width = 380 ][, string $title = null ][, string $help_link = "" ]) : 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.

$width : int = 380

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

$title : string = null

The title attribute of the element

$help_link : string = ""

Help link to be displayed alongside the label.

config_check_valid_option()

Server side validation for saving values submitted using the page generation functions "config_add_...()" and created with config_generate_html(). For example, the system configuration page.

config_check_valid_option(array<string|int, mixed> $def, mixed $value) : bool
Parameters
$def : array<string|int, mixed>

Array containing field definition e.g. from config_add_integer_input()

$value : mixed

User submitted value to be checked.

Return values
bool

True if the option is valid, else false.

On this page

Search results