Functions

Add words to the spellchecker.

add_spellchecker_words(array $words) 
package core_form_interfaces

Parameters

$words

array

List of words

Show a field set that has just been finished off.

alternate_fields_set__end(\ID_TEXT $set_name, mixed $pretty_name, mixed $description, \Tempcode $fields, boolean $required, \?URLPATH $existing_image_preview_url = null, boolean $raw = false) : \Tempcode
package core_form_interfaces

Parameters

$set_name

\ID_TEXT

The codename for this field set (blank: just collect raw fields, no actual field set)

$pretty_name

mixed

The human-readable name for this field set

$description

mixed

The human-readable description for this field set

$fields

\Tempcode

The field set Tempcode

$required

boolean

Whether it is required that this field set be filled in

$existing_image_preview_url

\?URLPATH

Image URL to show, of the existing selection for this field (null: N/A) (blank: N/A)

$raw

boolean

Whether we just want the raw set contents, without any wrapper field row

Returns

\TempcodeThe field set

Start off a field set.

alternate_fields_set__start(\ID_TEXT $set_name) : \Tempcode

IMPORTANT: Note that this function uses global state -- any fields generated between alternate_fields_setstart and alternate_fields_setend will be rendered using field set templating.

package core_form_interfaces

Parameters

$set_name

\ID_TEXT

The codename for this field set

Returns

\TempcodeTempcode to start attaching the field set to

Attach the WYSIWYG editor.

attach_wysiwyg() 

Build up a preview based on what was submitted.

build_preview(boolean $multi_return = false) : mixed
package core_form_interfaces

Parameters

$multi_return

boolean

Whether to return additional data

Returns

mixedEither Tempcode for the preview, or a tuple of details

Ensure Suhosin is not going to break a request due to number of request form fields. Call this each time a field is added to the output.

check_suhosin_request_quantity(integer $inc = 1, integer $name_length = 0
package core_form_interfaces

Parameters

$inc

integer

How much to increment the counter by

$name_length

integer

The name length being checked

Ensure Suhosin is not going to break a request due to request size.

check_suhosin_request_size(integer $size) 
package core_form_interfaces

Parameters

$size

integer

Most determinitve size within wider request size (we'll assume we actually need 500 more bytes than this)

Find all the words in some text.

find_words(string $text) : array
package core_form_interfaces

Parameters

$text

string

Text to scan for words in (should be plain text, not be HTML text)

Returns

arrayList of words

Get the Tempcode for a complex input that chooses partials from a list ('all', 'all-except-these', or 'these').

form_input_all_and_not(mixed $pretty_name, mixed $description, string $base, \Tempcode $list, string $type = '+', \?integer $tabindex = null) : \Tempcode
package core_form_interfaces
set + - *

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$base

string

The base name which this input field is for

$list

\Tempcode

A list culmulation to select against

$type

string

The current type of partial selection

$tabindex

\?integer

The tab index of the field (null: not specified)

Returns

\TempcodeThe input field

Get the Tempcode for a author/username input line.

form_input_author(mixed $pretty_name, mixed $description, \ID_TEXT $name, \?string $default, boolean $required, \?integer $tabindex = null) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The name which this input field is for

$default

\?string

The default value for this input field (null: blank)

$required

boolean

Whether this is a required input field

$tabindex

\?integer

The tab index of the field (null: not specified)

Returns

\TempcodeThe input field

Get the Tempcode for a codename input line.

form_input_codename(mixed $pretty_name, mixed $description, \ID_TEXT $name, \?string $default, boolean $required, \?integer $tabindex = null, \?integer $_maxlength = null, \?array $extra_chars = null, \?string $placeholder = null) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The name which this input field is for

$default

\?string

The default value for this input field (null: blank)

$required

boolean

Whether this is a required input field

$tabindex

\?integer

The tab index of the field (null: not specified)

$_maxlength

\?integer

The maximum length of the field (null: default 80)

$extra_chars

\?array

List of extra characters to allow (null: none)

$placeholder

\?string

The placeholder value for this input field (null: none)

Returns

\TempcodeThe input field

Get the Tempcode for a colour input.

form_input_colour(mixed $pretty_name, mixed $description, \ID_TEXT $name, \?string $default, boolean $required, \?integer $tabindex = null) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The name which this input field is for

$default

\?string

The default value for this input field (null: blank)

$required

boolean

Whether this is a required input field

$tabindex

\?integer

The tab index of the field (null: not specified)

Returns

\TempcodeThe input field

Get the Tempcode for a combo-box (listbox with free text input). Works best if HTML5 is available.

form_input_combo(mixed $pretty_name, mixed $description, \ID_TEXT $name, string $default, \Tempcode $options, \?integer $tabindex = null, boolean $required = true) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The name which this input field is for

$default

string

Current selection

$options

\Tempcode

The list entries for our list

$tabindex

\?integer

The tab index of the field (null: not specified)

$required

boolean

Whether this is required

Returns

\TempcodeThe input field

Get the Tempcode for a date input. Use get_input_date to read the result.

form_input_date(mixed $pretty_name, mixed $description, \ID_TEXT $name, boolean $required, boolean $null_default, boolean $do_time, \?mixed $default_time = null, \?integer $total_years_to_show = 10, \?integer $year_start = null, \?integer $tabindex = null, boolean $do_date = true, \?ID_TEXT $timezone = null, boolean $handle_timezone = true) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The parameter name for this input field

$required

boolean

Whether this is not a required field

$null_default

boolean

Whether this field is empty by default

$do_time

boolean

Whether to input time for this field also

$default_time

\?mixed

The default timestamp to use (either TIME or array of time components) (null: now)

$total_years_to_show

\?integer

The number of years to allow selection from (pass a negative number for selection of past years instead of future years) (null: no limit)

$year_start

\?integer

The year to start from (null: this year)

$tabindex

\?integer

The tab index of the field (null: not specified)

$do_date

boolean

Whether to input date for this field (if false, will just do time)

$timezone

\?ID_TEXT

Timezone to input in (null: current user's timezone)

$handle_timezone

boolean

Convert $default_time to $timezone

Returns

\TempcodeThe input field

Get the Tempcode for a date input, or if cron is not on, return blank.

form_input_date__scheduler(mixed $pretty_name, mixed $description, \ID_TEXT $name, boolean $required, boolean $null_default, boolean $do_time, \?mixed $default_time = null, integer $total_years_to_show = 10, \?integer $year_start = null, \?integer $tabindex = null) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The parameter name for this input field

$required

boolean

Whether this is a required field

$null_default

boolean

Whether this field is empty by default

$do_time

boolean

Whether to input time for this field also

$default_time

\?mixed

The default timestamp to use (either TIME or array of time components) (null: now)

$total_years_to_show

integer

The number of years to allow selection from (all into the future, as this field type is not meant for inputting past dates)

$year_start

\?integer

The year to start from (null: this year)

$tabindex

\?integer

The tab index of the field (null: not specified)

Returns

\TempcodeThe input field

Get the Tempcode for an width/height input.

form_input_dimensions(mixed $pretty_name, mixed $description, \ID_TEXT $name_width, \ID_TEXT $name_height, \?integer $default_width, \?integer $default_height, boolean $required, \?integer $tabindex = null) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name_width

\ID_TEXT

The name which this input field is for: width part

$name_height

\ID_TEXT

The name which this input field is for: height part

$default_width

\?integer

The default value for this input field: width part (null: no default)

$default_height

\?integer

The default value for this input field: height part (null: no default)

$required

boolean

Whether this is a required input field

$tabindex

\?integer

The tab index of the field (null: not specified)

Returns

\TempcodeThe input field

Get the Tempcode for a email-address input line.

form_input_email(mixed $pretty_name, mixed $description, \ID_TEXT $name, \?string $default, boolean $required, \?integer $tabindex = null) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The name which this input field is for

$default

\?string

The default value for this input field (null: blank)

$required

boolean

Whether this is a required input field

$tabindex

\?integer

The tab index of the field (null: not specified)

Returns

\TempcodeThe input field

Get the Tempcode for a float-only input.

form_input_float(mixed $pretty_name, mixed $description, \ID_TEXT $name, \?float $default, boolean $required, \?integer $tabindex = null) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The name which this input field is for

$default

\?float

The default value for this input field (null: no default)

$required

boolean

Whether this is a required input field

$tabindex

\?integer

The tab index of the field (null: not specified)

Returns

\TempcodeThe input field

Get the Tempcode for a huge text input (textarea).

form_input_huge(mixed $pretty_name, mixed $description, \ID_TEXT $name, string $default, boolean $required, \?integer $tabindex = null, integer $rows = 20, mixed $description_side = '', boolean $scrolls = false) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The name which this input field is for

$default

string

The default value for this input field

$required

boolean

Whether this is a required input field

$tabindex

\?integer

The tab index of the field (null: not specified)

$rows

integer

The number of rows to use

$description_side

mixed

A secondary side description for this input field

$scrolls

boolean

Whether the field scrolls

Returns

\TempcodeThe input field

Get the Tempcode for a huge comcode-enabled text input (textarea). These need extra space to fit. This function is also used as an automatic replacement for form_input_text_comcode if WYSIWYG is available (as WYSIWYG needs more space too)

form_input_huge_comcode(mixed $pretty_name, mixed $description, \ID_TEXT $name, string $default, boolean $required, \?integer $tabindex = null, integer $rows = 20, mixed $description_side = '', \?Tempcode $default_parsed = null, boolean $scrolls = false, boolean $force_non_wysiwyg = false) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The name which this input field is for

$default

string

The default value for this input field

$required

boolean

Whether this is a required input field

$tabindex

\?integer

The tab index of the field (null: not specified)

$rows

integer

The number of rows to use

$description_side

mixed

A secondary side description for this input field

$default_parsed

\?Tempcode

The parsed Comcode. (null: calculate)

$scrolls

boolean

Whether the field scrolls

$force_non_wysiwyg

boolean

Force non-WYSIWYG and non default-Comcode parsing

Returns

\TempcodeThe input field

Get the Tempcode for a huge listbox.

form_input_huge_list(mixed $pretty_name, mixed $description, \ID_TEXT $name, \Tempcode $content, \?integer $tabindex = null, boolean $inline_list = false, boolean $required = true, \?integer $size = null) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The name which this input field is for

$content

\Tempcode

The list entries for our list

$tabindex

\?integer

The tab index of the field (null: not specified)

$inline_list

boolean

Whether this is an inline displayed list as opposed to a dropdown

$required

boolean

Whether this is required

$size

\?integer

Size of list (null: default)

Returns

\TempcodeThe input field

Get the Tempcode for an integer-only input.

form_input_integer(mixed $pretty_name, mixed $description, \ID_TEXT $name, \?integer $default, boolean $required, \?integer $tabindex = null) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The name which this input field is for

$default

\?integer

The default value for this input field (null: no default)

$required

boolean

Whether this is a required input field

$tabindex

\?integer

The tab index of the field (null: not specified)

Returns

\TempcodeThe input field

Get the Tempcode for a text input line (an <input type="text" .

form_input_line(mixed $pretty_name, mixed $description, \ID_TEXT $name, \?string $default, boolean $required, \?integer $tabindex = null, \?integer $_maxlength = null, string $type = 'text', \?string $placeholder = null, \?string $pattern = null, \?string $pattern_error = null) : \Tempcode

.. />).

package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The name which this input field is for

$default

\?string

The default value for this input field (null: blank)

$required

boolean

Whether this is a required input field

$tabindex

\?integer

The tab index of the field (null: not specified)

$_maxlength

\?integer

The maximum length of the field (null: default 255)

$type

string

The input type

$placeholder

\?string

The placeholder value for this input field (null: none)

$pattern

\?string

Custom regex pattern (null: none)

$pattern_error

\?string

Custom regex pattern validation error (null: none)

Returns

\TempcodeThe input field

Get the Tempcode for a Comcode-enabled text input line.

form_input_line_comcode(mixed $pretty_name, mixed $description, \ID_TEXT $name, \?string $default, boolean $required, \?integer $tabindex = null) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The name which this input field is for

$default

\?string

The default value for this input field (null: blank)

$required

boolean

Whether this is a required input field

$tabindex

\?integer

The tab index of the field (null: not specified)

Returns

\TempcodeThe input field

Get the Tempcode for a DHTML input field that takes multiple lines. A new line is added when the prior one isn't blank.

form_input_line_multi(mixed $pretty_name, mixed $description, \ID_TEXT $name, array $default_array, integer $num_required, \?integer $tabindex = null, string $class = 'line', \?string $pattern = null, \?string $pattern_error = null) : \Tempcode
package core_form_interfaces
set line email

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The base parameter name which this input field is for (as this takes multiple parameters, they are named ). This name must end with '_'.

$default_array

array

An array of lines to use as default (at least this many lines, filled by this array, will be presented by default)

$num_required

integer

The minimum number of inputs allowed.

$tabindex

\?integer

The tab index of the field (null: not specified)

$class

string

CSS class for input.

$pattern

\?string

Custom regex pattern (null: none)

$pattern_error

\?string

Custom regex pattern validation error (null: none)

Returns

\TempcodeThe input field

Get the Tempcode for a listbox.

form_input_list(mixed $pretty_name, mixed $description, \ID_TEXT $name, \Tempcode $content, \?integer $tabindex = null, boolean $inline_list = false, boolean $required = true, \?array $images = null, integer $size = 5) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The name which this input field is for

$content

\Tempcode

The list entries for our list

$tabindex

\?integer

The tab index of the field (null: not specified)

$inline_list

boolean

Whether this is an inline displayed list as opposed to a dropdown

$required

boolean

Whether this is required

$images

\?array

List of theme images that $content is allowing selection of (so that we can show the images within the list, if JS is enabled) (null: none)

$size

integer

How much space the list takes up (inline lists only)

Returns

\TempcodeThe input field

Get the Tempcode for a listbox with multiple selections.

form_input_multi_list(mixed $pretty_name, mixed $description, \ID_TEXT $name, \Tempcode $content, \?integer $tabindex = null, integer $size = 5, boolean $required = false, \?ID_TEXT $custom_name = null, \?mixed $custom_value = null) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The name which this input field is for

$content

\Tempcode

The list entries for our list

$tabindex

\?integer

The tab index of the field (null: not specified)

$size

integer

How much space the list takes up

$required

boolean

Whether at least one must be selected

$custom_name

\?ID_TEXT

Name for custom value to be entered to (null: no custom value allowed)

$custom_value

\?mixed

Value for custom value, string (accept single value) or array (accept multiple values) (null: no custom value known)

Returns

\TempcodeThe input field

Used to create a NULL option for field sets.

form_input_na(mixed $pretty_name, \?integer $tabindex = null) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

The human-readable name for this field

$tabindex

\?integer

The tab index (null: none specified)

Returns

\TempcodeThe field

Get the Tempcode for a password input.

form_input_password(mixed $pretty_name, mixed $description, \ID_TEXT $name, boolean $required, \?integer $tabindex = null, string $default = '') : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The name which this input field is for

$required

boolean

Whether this is a required input field

$tabindex

\?integer

The tab index of the field (null: not specified)

$default

string

The default value for this input field

Returns

\TempcodeThe input field

Get the Tempcode for a radio group.

form_input_radio(mixed $pretty_name, mixed $description, \ID_TEXT $name, \Tempcode $content, boolean $required = false, boolean $picture_contents = false, string $selected_path = '') : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The name which this input field is for

$content

\Tempcode

The radio buttons for our radio group

$required

boolean

Whether a radio selection is required

$picture_contents

boolean

Whether this is a picture-based radio list

$selected_path

string

Default value (only appropriate if has picture contents)

Returns

\TempcodeThe input field

Get the Tempcode for a radio input. (You would gather together the outputs of several of these functions, then put them in as the $content in a form_input_radio function call).

form_input_radio_entry(string $name, string $value, boolean $selected = false, mixed $text = '', \?integer $tabindex = null, mixed $description = '') : \Tempcode
package core_form_interfaces

Parameters

$name

string

The name of the radio button group this will be put in (i.e. the name the value presented here will be possibly matched against)

$value

string

The value for this entry

$selected

boolean

Whether this entry is selected by default or not

$text

mixed

The text associated with this choice (blank: just use value for text)

$tabindex

\?integer

The tab index of the field (null: not specified)

$description

mixed

An additional long description (blank: no description)

Returns

\TempcodeThe input field

Get the Tempcode for a text input (textarea).

form_input_text(mixed $pretty_name, mixed $description, \ID_TEXT $name, string $default, boolean $required, \?integer $tabindex = null, boolean $scrolls = false, \?integer $maxlength = null, \?integer $rows = null) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The name which this input field is for

$default

string

The default value for this input field

$required

boolean

Whether this is a required input field

$tabindex

\?integer

The tab index of the field (null: not specified)

$scrolls

boolean

Whether the field scrolls

$maxlength

\?integer

The maximum length of the field (null: unlimited)

$rows

\?integer

Number of rows for text input (null: default)

Returns

\TempcodeThe input field

Get the Tempcode for a Comcode-enabled text input (textarea).

form_input_text_comcode(mixed $pretty_name, mixed $description, \ID_TEXT $name, string $default, boolean $required, \?integer $tabindex = null, boolean $force_non_wysiwyg = false, mixed $description_side = '', \?Tempcode $default_parsed = null, boolean $scrolls = false, \?integer $rows = null) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The name which this input field is for

$default

string

The default value for this input field

$required

boolean

Whether this is a required input field

$tabindex

\?integer

The tab index of the field (null: not specified)

$force_non_wysiwyg

boolean

Force non-WYSIWYG and non default-Comcode parsing

$description_side

mixed

A secondary side description for this input field

$default_parsed

\?Tempcode

The parsed Comcode. (null: calculate)

$scrolls

boolean

Whether the field scrolls

$rows

\?integer

Number of rows for text input (null: default)

Returns

\TempcodeThe input field

Get the Tempcode for a DHTML input field that takes multiple textareas. A new textarea is added when the prior one isn't blank.

form_input_text_multi(mixed $pretty_name, mixed $description, \ID_TEXT $name, array $default_array, integer $num_required, \?integer $tabindex = null, \?integer $maxlength = null) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The base parameter name which this input field is for (as this takes multiple parameters, they are named ). This name must end with '_'.

$default_array

array

An array of texts to use as default (at least this many textareas, filled by this array, will be presented by default)

$num_required

integer

The minimum number of textareas allowed.

$tabindex

\?integer

The tab index of the field (null: not specified)

$maxlength

\?integer

The maximum length of the field (null: unlimited)

Returns

\TempcodeThe input field

Get the Tempcode to choose a picture from the given list of images in the theme image system, with sub-categorisation.

form_input_theme_image(mixed $pretty_name, mixed $description, \ID_TEXT $name, array $ids, \?URLPATH $selected_url = null, \?string $selected_code = null, \?integer $tabindex = null, boolean $allow_none = false, \?object $db = null, \?ID_TEXT $theme = null, \?ID_TEXT $lang = null, boolean $linear = false, boolean $direct_titles = false) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The name which this input field is for

$ids

array

A list of image IDs (codes) we can choose from, probably found via get_all_image_ids_type

$selected_url

\?URLPATH

The currently selected entry in our picture choosing, by URL (null: none)

$selected_code

\?string

The currently selected entry in our picture choosing, by code (null: none)

$tabindex

\?integer

The tab index of the field (null: not specified)

$allow_none

boolean

Whether to allow the selection of 'no' picture

$db

\?object

The database connection to the Conversr install we are choosing images from (null: site db)

$theme

\?ID_TEXT

Theme to use (null: current theme)

$lang

\?ID_TEXT

Language to use (null: current language)

$linear

boolean

Whether choices are presented in a list (as opposed to a grid); useful when sizes are irregular

$direct_titles

boolean

Whether to show direct codenames, rather than trying to prettify them into titles

Returns

\TempcodeThe input field

Get the Tempcode for a checkbox input.

form_input_tick(mixed $pretty_name, mixed $description, \ID_TEXT $name, boolean $ticked, \?integer $tabindex = null, \ID_TEXT $value = '1') : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The name which this input field is for

$ticked

boolean

Whether this is ticked by default

$tabindex

\?integer

The tab index of the field (null: not specified)

$value

\ID_TEXT

The value the checkbox passes when ticked

Returns

\TempcodeThe input field

Get the Tempcode for an AJAX-powered tree listbox.

form_input_tree_list(mixed $pretty_name, mixed $description, \ID_TEXT $name, \?ID_TEXT $root_id, string $hook, array $options, boolean $required, \?string $default = null, boolean $use_server_id = false, \?integer $tabindex = null, boolean $multi_select = false, \?string $nice_label = null) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The name which this input field is for

$root_id

\?ID_TEXT

The ID to do under (null: root)

$hook

string

The ajax tree-list hook that drives our data

$options

array

A map of special options

$required

boolean

Whether this is a required input field

$default

\?string

The default value for the field (null: none)

$use_server_id

boolean

Whether to use the server-ID in the list instead of the ID in the list

$tabindex

\?integer

The tab index of the field (null: not specified)

$multi_select

boolean

Whether multiple selections are allowed

$nice_label

\?string

Label for default value (null: just use the literal)

Returns

\TempcodeThe input field

Get the Tempcode for a file upload input.

form_input_upload(mixed $pretty_name, mixed $description, \ID_TEXT $name, boolean $required, \?string $default = null, \?integer $tabindex = null, boolean $plupload = true, string $filter = '', \?string $syndication_json = null) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The name which this input field is for

$required

boolean

Whether this is a required input field. Set this to false if you are using this field on an edit form and already have an uploaded file -- therefore you'd know no new file would mean not to replace the existing file

$default

\?string

The default value for the field (null: none) (blank: none). Should only be passed if $required is false, because it creates a delete button for the existing file, implying that leaving it with no file is valid

$tabindex

\?integer

The tab index of the field (null: not specified)

$plupload

boolean

Whether plupload-style is preferred

$filter

string

File-type filter to limit to, comma-separated file extensions (might not be supported)

$syndication_json

\?string

JSON structure of what uploader syndications there will be (null: none)

Returns

\TempcodeThe input field

Get the Tempcode for a multiple file upload input.

form_input_upload_multi(mixed $pretty_name, mixed $description, string $name, boolean $required, \?integer $tabindex = null, \?array $default = null, boolean $plupload = true, string $filter = '', \?string $syndication_json = null) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

string

The base name which this input field is for

$required

boolean

Whether this is a required input field

$tabindex

\?integer

The tab index of the field (null: not specified)

$default

\?array

The default value for the field (null: none)

$plupload

boolean

Whether plupload-style is preferred

$filter

string

File-type filter to limit to, comma-separated file extensions (might not be supported)

$syndication_json

\?string

JSON structure of what uploader syndications there will be (null: none)

Returns

\TempcodeThe input field

Get the Tempcode for a multi-set upload, allowing selection from multiple different sources.

form_input_upload_multi_source(mixed $set_title, mixed $set_description, \Tempcode $hidden, \ID_TEXT $set_name = 'image', \?ID_TEXT $theme_image_type = null, boolean $required = true, \?string $default = null, boolean $support_syndication = false, \?string $filter = null, boolean $images_only = true) : \Tempcode

Mainly for images, used with post_param_image or post_param_multi_source_upload.

package core_form_interfaces

Parameters

$set_title

mixed

A human intelligible name for this input field

$set_description

mixed

A description for this input field

$hidden

\Tempcode

A reference to where we're putting hidden fields

$set_name

\ID_TEXT

The name which this input field is for (actually, this is a prefix put in front of different input types).

$theme_image_type

\?ID_TEXT

The directory of theme images to provide selection from (null: do not support theme images)

$required

boolean

Whether this is a required input field. Set this to false if you are using this field on an edit form and already have an uploaded file -- therefore you'd know no new file would mean not to replace the existing file

$default

\?string

The default value for the field (null: none) (blank: none). Should only be passed if $required is false, because it creates a delete button for the existing file, implying that leaving it with no file is valid

$support_syndication

boolean

Whether to syndicate the file off

$filter

\?string

File type filter (null: autodetect)

$images_only

boolean

Whether to accept images only

Returns

\TempcodeThe input field

Get the Tempcode for a URL.

form_input_url(mixed $pretty_name, mixed $description, \ID_TEXT $name, \?string $default, boolean $required, \?integer $tabindex = null) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The name which this input field is for

$default

\?string

The default value for this input field (null: blank)

$required

boolean

Whether this is a required input field

$tabindex

\?integer

The tab index of the field (null: not specified)

Returns

\TempcodeThe input field

Get the Tempcode for a username input line.

form_input_username(mixed $pretty_name, mixed $description, \ID_TEXT $name, \?string $default, boolean $required, boolean $needs_match = true, \?integer $tabindex = null) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The name which this input field is for

$default

\?string

The default value for this input field (null: blank)

$required

boolean

Whether this is a required input field

$needs_match

boolean

Whether it is required than a valid username is given

$tabindex

\?integer

The tab index of the field (null: not specified)

Returns

\TempcodeThe input field

Get the Tempcode for a username input line.

form_input_username_multi(mixed $pretty_name, mixed $description, \ID_TEXT $name, array $default_array, integer $num_required, boolean $needs_match = true, \?integer $tabindex = null) : \Tempcode
package core_form_interfaces

Parameters

$pretty_name

mixed

A human intelligible name for this input field

$description

mixed

A description for this input field

$name

\ID_TEXT

The base parameter name which this input field is for (as this takes multiple parameters, they are named ). This name must end with '_'.

$default_array

array

An array of lines to use as default (at least this many lines, filled by this array, will be presented by default)

$num_required

integer

The minimum number of inputs allowed

$needs_match

boolean

Whether this is a required input field

$tabindex

\?integer

The tab index of the field (null: not specified)

Returns

\TempcodeThe input field

Get the Tempcode for a bank of tick boxes.

form_input_various_ticks(array $options, mixed $description, \?integer $_tabindex = null, mixed $_pretty_name = '', boolean $simple_style = false, \?ID_TEXT $custom_name = null, \?mixed $custom_value = null) : \Tempcode
package core_form_interfaces

Parameters

$options

array

A list of tuples: (prettyname, name, value, description)

$description

mixed

A description for this input field

$_tabindex

\?integer

The tab index of the field (null: not specified)

$_pretty_name

mixed

A human intelligible name for this input field (blank: use default)

$simple_style

boolean

Whether to place each tick on a new line

$custom_name

\?ID_TEXT

Name for custom value to be entered to (null: no custom value allowed)

$custom_value

\?mixed

Value for custom value, string (accept single value) or array (accept multiple values) (null: no custom value known)

Returns

\TempcodeThe input field

Get what we need to get attachments in a form-field interface.

get_attachments(\ID_TEXT $posting_field_name) : array
package core_form_interfaces

Parameters

$posting_field_name

\ID_TEXT

The name of the field attachments are for

Returns

arrayA pair: the attachments UI (Tempcode), the hidden attachment field

Creates a Comcode editor.

get_comcode_editor(string $field_name = 'post', boolean $cut_down = false) : \Tempcode
package core_form_interfaces

Parameters

$field_name

string

The name of the field the editor is working for

$cut_down

boolean

Whether to make a cut-down version

Returns

\TempcodeThe Comcode editor

Get the value of a scoped field restriction property. Returns "first-found".

get_field_restrict_property(string $property, string $field, \?string $page = null, \?string $type = null) : \?string
package core_form_interfaces

Parameters

$property

string

The name of the property

$field

string

The name of the field it's scoped for

$page

\?string

The page name scoped for (null: current page)

$type

\?string

The page type scoped for (null: current type)

Returns

\?stringThe property (null: non-existent)

Helper function for tab-index linearisation (serves as a filter).

get_form_field_tabindex(\?integer $tabindex = null) : integer
package core_form_interfaces

Parameters

$tabindex

\?integer

Requested tab-index (null: no specific request)

Returns

integerUsed tab-index

Creates a posting form, with attachment support.

get_posting_form(mixed $submit_name, \ID_TEXT $submit_icon, \LONG_TEXT $post, mixed $post_url, \Tempcode $hidden_fields, \Tempcode $specialisation, \?mixed $post_comment = null, string $extra = '', \?Tempcode $specialisation2 = null, \?Tempcode $default_parsed = null, \?string $javascript = null, \?integer $tabindex = null, boolean $required = true, boolean $has_preview = true, boolean $avoid_wysiwyg = false, boolean $support_autosave = true, boolean $specialisation2_hidden = false) : \Tempcode
package core_form_interfaces

Parameters

$submit_name

mixed

The title of the form submission button

$submit_icon

\ID_TEXT

The submit icon CSS class.

$post

\LONG_TEXT

The default post to put in.

$post_url

mixed

Where the form is sent (URLPATH or Tempcode).

$hidden_fields

\Tempcode

A form_input_hidden buildup of hidden fields (additional parameters sent to the target URL).

$specialisation

\Tempcode

A buildup of leading extra fields, in a format compatible with the templates used by this function.

$post_comment

\?mixed

The post comment (string or Tempcode). This gives information about how you should post. (null: no post comment)

$extra

string

Extra info to put on the posting form

$specialisation2

\?Tempcode

A buildup of trailing extra fields, in a format compatible with the templates used by this function. (null: none)

$default_parsed

\?Tempcode

The parsed Comcode. (null: calculate)

$javascript

\?string

JavaScript code to include (null: none)

$tabindex

\?integer

The tab index of the field (null: not specified)

$required

boolean

Whether this is a required input field

$has_preview

boolean

Whether the form supports previewing

$avoid_wysiwyg

boolean

Whether to avoid WYSIWYG mode

$support_autosave

boolean

Whether to support auto-save

$specialisation2_hidden

boolean

Whether to support auto-save

Returns

\TempcodeThe posting form

Look for editing conflicts, and setup editing pinging.

handle_conflict_resolution(\?ID_TEXT $id = null, boolean $only_staff = false) : array
package core_form_interfaces

Parameters

$id

\?ID_TEXT

The ID we're editing (null: get from param, 'id')

$only_staff

boolean

Whether to only care about staff conflicts

Returns

arrayA pair: warning details, ping url

Insert hidden data for the maximum file size of form fields.

handle_max_file_size(\Tempcode $hidden, \ID_TEXT $regular_max_size_type = 'file'
package core_form_interfaces
set image file

Parameters

$hidden

\Tempcode

Hidden fields

$regular_max_size_type

\ID_TEXT

Code representing the media types we are using limits for

Read a multi code from a named parameter stub.

read_multi_code(\ID_TEXT $param) : \SHORT_TEXT
package core_form_interfaces

Parameters

$param

\ID_TEXT

The parameter stub (stub of a series of POST parameters, made by cns_get_forum_multi_code_field's field or similar).

Returns

\SHORT_TEXTThe multi code.

Run a spellcheck on some text.

run_spellcheck(string $text, \?ID_TEXT $lang = null, boolean $skip_known_words_in_db = true) : array
package core_form_interfaces

Parameters

$text

string

Text to scan for words in (should be plain text, not be HTML text)

$lang

\?ID_TEXT

Language to check in (null: current language)

$skip_known_words_in_db

boolean

Whether to avoid spellchecking known keywords etc

Returns

arrayA map of misspellings, lower case bad word => array of corrections

Stop serving single field.

single_field__end() 

Start serving single field. This is used if you just need the raw widget, not the label (etc).

single_field__start() 

Find the path to where data is stored.

sl_get_custom_file_base() : string
package core_form_interfaces

Returns

stringRelative path

Fix spellings in input string.

spell_correct_phrase(string $text) : string
package core_form_interfaces

Parameters

$text

string

Input string

Returns

stringFixed input string

Find a default property, defaulting to the average of what is there already, or the given default if really necessary.

take_param_int_modeavg(integer $setting, \ID_TEXT $db_property, \ID_TEXT $table, integer $default) : integer
package core_form_interfaces

Parameters

$setting

integer

The current setting (null: we have to work it out); if non-null, the function will immediately return

$db_property

\ID_TEXT

The property

$table

\ID_TEXT

The table to average within

$default

integer

The last-resort default

Returns

integerThe value

Disable reading in default parameters from the GET environment. This is typically called after 'add' forms.

url_default_parameters__disable() 

Enable reading in default parameters from the GET environment. This is typically called before 'add' forms.

url_default_parameters__enable() 

Find whether WYSIWYG is currently on.

wysiwyg_on() : boolean
package core_form_interfaces

Returns

booleanWhether it is

Constants

 

WORD_REGEXP

WORD_REGEXP = '#([\w\'\-]{1,200})#' . (get_charset() == 'utf-8' ? 'u' : '')