Documentation

O3PO_PublicForm
in package
uses O3PO_Form

AbstractYes

Class for the ready to publish form.

Tags
since
0.4.0
subpackage

O3PO/includes

author

Christian Gogolin o3po@quantum-journal.org

Table of Contents

Properties

$coming_from_page  : int
The page id of the page the user is coming from
$fields  : array<string|int, mixed>
Array of all field of the form.
$pages  : array<string|int, mixed>
Array of all pages of the form.
$plugin_name  : string
The unique identifier of this plugin.
$sections  : array<string|int, mixed>
Array of all sections of the form.
$session_id  : str
The id of this session
$slug  : string
Slug of this form.
$errors  : array<string|int, mixed>
Errors identified in the form
$field_values  : array<string|int, mixed>
Field values of the form.
$navigation  : string
Value of the navigation
$page_to_display  : int
Page to display
$submitted_successfully  : bool
Whether the form was submitted successfully
$title  : string
Title

Methods

__construct()  : mixed
Read all form values from $_POST and process.
checked()  : mixed
Ensure that a check box field is checked
checked_if_on_or_past_containing_page_unless_back_or_upload()  : mixed
Ensure that a check box field is checked
checked_or_unchecked()  : mixed
Restrict input to checked or unchecked fields
do_parse_request()  : mixed
Parse form requests
generate_session_id()  : string
Generate a unique session id
get_errors()  : array<string|int, mixed>
Return all errors
get_field_default()  : string
Get the default value of a field by id.
get_field_defaults()  : mixed
Get the default values of all fields.
get_field_title()  : mixed
Get the title of a field by id.
get_field_value()  : mixed
Get the value of a field by id.
get_page_to_display()  : string
Return page to display
handle_form_data_and_produce_content()  : mixed
Handle the form data and render the form
init()  : mixed
Adds a rewrite endpoint for the form.
leave_unchanged()  : mixed
Leave user input to field unchanged.
on_submit()  : mixed
Called on form submission
read_and_validate_field_values()  : mixed
Read all form values from $_POST and process.
render_array_as_comma_separated_list_field()  : mixed
Render an array as comma separated list type field.
render_checkbox_field()  : mixed
Render a checkbox type field.
render_image_upload_field()  : mixed
Render an image upload field
render_multi_line_field()  : mixed
Render a multi line text box type field.
render_navigation()  : mixed
Render the form navigation
render_password_field()  : mixed
Render a password field.
render_select_field()  : mixed
Render a select type field.
render_single_line_field()  : mixed
Render a standard text box type field.
render_summary()  : mixed
Render the form summary
sanitize_user_input()  : string
Sanitize user input
specify_fake_field()  : mixed
Add a fake field
specify_field()  : mixed
Specify a field of the form.
specify_page()  : mixed
Specify a section of the form.
specify_section()  : mixed
Specify a section of the form.
submitted_message()  : string
The message to show after submission
trim()  : mixed
Trim user input to field
trim_strip_tags()  : mixed
Trim user input to field
validate_array_as_comma_separated_list()  : mixed
Validate input to comma separated list fields.
validate_array_of_at_most_1000_checked_or_unchecked()  : mixed
Validate an array of at most 1000 values of checked or unchecked
validate_array_of_at_most_1000_name_styles()  : mixed
Validate that an array of at most 1000 name styles
validate_array_of_at_most_1000_names()  : mixed
Validate that an array of at most 1000 names
validate_array_of_at_most_1000_roles()  : mixed
Validate an array of at most 1000 editor coordinator or steering board entries
validate_array_of_at_most_1000_urls()  : mixed
Validate an array of at most 1000 urls
validate_array_of_at_most_1000_urls_or_empty()  : mixed
Validate an array of at most 1000 urls or empty fields
validate_array_of_at_most_1000_uuidv4s()  : mixed
Validate that an array consists of at most 1000 UUIDv4s
validate_array_of_at_most_1000_years()  : mixed
Validate that an array of at most 1000 years
validate_array_of_at_most_1000_years_or_empty()  : mixed
Validate that an array of at most 1000 years or empty
validate_doi_prefix()  : mixed
Clean user input to doi_prefix fields
validate_doi_suffix()  : mixed
Clean user input to doi_suffix fields
validate_email()  : mixed
Clean user input to email fields
validate_eprint()  : string
Clean user input to eprint fields
validate_four_digit_year()  : mixed
Clean user input to fields expecting a year.
validate_issn()  : mixed
Clean user input to issn fields
validate_issn_or_empty()  : string
Clean user input to issn fields
validate_non_negative_euros()  : mixed
Validate non-negative euro fields
validate_non_negative_float()  : mixed
Validate non-negative float
validate_positive_integer()  : mixed
Validate positive integer fields
validate_role()  : mixed
Restrict input to valid roles of people working for the journal
validate_session_id()  : mixed
Check whether an id is a valid session id
validate_two_letter_country_code()  : mixed
Validate two letter country code fields
validate_url()  : mixed
Clean user input to url fields
add_error()  : mixed
Add an error or warning to the list of errors
add_sideloaded_files_to_media_library()  : mixed
Add the files uploaded by the user to the media library.
append_session_data()  : mixed
Append a field value pair to the current session data
get_session_data()  : mixed
Get field from the data of a session
put_session_data()  : mixed
Set field in the data of a session
specify_pages_sections_and_fields()  : mixed
Specifies form sections and fields.
delete_sideloaded_files()  : mixed
Delete the sideloaded files of a session
discard_session()  : mixed
Discard a session and all its data
get_class_option()  : array<string|int, mixed>
Get the option element used by this class
get_session_ids()  : array<string|int, mixed>
Get all recent session ids
make_post()  : mixed
Make a fake post to show the form
renew_session_id()  : mixed
Renew a session and all its data
setup_query()  : mixed
Setup the query to show a post
update_class_option()  : mixed
Set the option element used by this class

Properties

$coming_from_page

The page id of the page the user is coming from

protected int $coming_from_page = \false

Page id.

Tags
since
0.4.0
access

private

$fields

Array of all field of the form.

protected array<string|int, mixed> $fields = array()

Dictionary of all fields and their properties.

Tags
since
0.4.0
access

protected

$pages

Array of all pages of the form.

protected array<string|int, mixed> $pages = array()
Tags
since
0.4.0
access

protected

$plugin_name

The unique identifier of this plugin.

protected string $plugin_name

The string used to uniquely identify this plugin.

Tags
since
0.1.0
access

private

$sections

Array of all sections of the form.

protected array<string|int, mixed> $sections = array()

Dictionary of all sections and their properties.

Tags
since
0.4.0
access

protected

$slug

Slug of this form.

protected string $slug

Used for css classes when rendering the sections and fields. Used then storing/retreiving data from the database.

Slug of the form.

Tags
since
0.4.0
access

protected

$errors

Errors identified in the form

private array<string|int, mixed> $errors = array()

Array of errors.

Tags
since
0.4.0
access

private

$field_values

Field values of the form.

private array<string|int, mixed> $field_values = array()

Array of field values.

Tags
since
0.4.0
access

private

$navigation

Value of the navigation

private string $navigation = \false

One of 'Next', 'Back', 'Submit', or 'Upload'

Tags
since
0.4.0
access

private

$page_to_display

Page to display

private int $page_to_display = \false

Id of page to display.

Tags
since
0.4.0
access

private

$submitted_successfully

Whether the form was submitted successfully

private bool $submitted_successfully = \false

Whether the form was submitted successfully.

Tags
since
0.4.0
access

private

Methods

__construct()

Read all form values from $_POST and process.

public __construct(string $plugin_name, string $slug, string $title) : mixed
Parameters
$plugin_name : string

The name of the plugin.

$slug : string

The slug of the form.

$title : string

The title of the form.

Tags
since
0.4.0
access

public

checked()

Ensure that a check box field is checked

public checked(string $id, string $input) : mixed
Parameters
$id : string

The field this was input to.

$input : string

User input.

Tags
sinde

0.4.0

access

public

checked_if_on_or_past_containing_page_unless_back_or_upload()

Ensure that a check box field is checked

public checked_if_on_or_past_containing_page_unless_back_or_upload(string $id, string $input) : mixed
Parameters
$id : string

The field this was input to.

$input : string

User input.

Tags
sinde

0.4.0

access

public

checked_or_unchecked()

Restrict input to checked or unchecked fields

public checked_or_unchecked(string $id, string $input) : mixed
Parameters
$id : string

The field this was input to.

$input : string

User input.

Tags
since
0.3.0
access

private

do_parse_request()

Parse form requests

public do_parse_request(bool $bool, WP $wp[, bool $do_not_exit = false ]) : mixed

Processes form input and displays the form.

Parameters
$bool : bool

Whether or not to parse the request.

$wp : WP

Current WordPress environment instance.

$do_not_exit : bool = false

Whether to exit after parsing the request. Can be set to false for testing only.

Tags
since
0.4.0
access

public

generate_session_id()

Generate a unique session id

public generate_session_id() : string
Tags
since
0.4.0
access

public

Return values
string —

Random hex string

get_errors()

Return all errors

public get_errors() : array<string|int, mixed>
Tags
since
0.4.0
access

public

Return values
array<string|int, mixed> —

All errors recorded so far.

get_field_default()

Get the default value of a field by id.

public get_field_default(int $id) : string
Parameters
$id : int

Id of the field.

Tags
since
0.4.0
acceess

public

Return values
string —

Default value of the field

get_field_defaults()

Get the default values of all fields.

public get_field_defaults([bool $include_fake_fields = false ]) : mixed
Parameters
$include_fake_fields : bool = false

Whether to also include fake fields in the list.

Tags
since
0.4.0
acceess

public

get_field_title()

Get the title of a field by id.

public get_field_title(int $id) : mixed
Parameters
$id : int

Id of the field.

Tags
since
0.4.0
acceess

prublic

get_field_value()

Get the value of a field by id.

public get_field_value(int $id) : mixed
Parameters
$id : int

Id of the field.

Tags
since
0.4.0
acceess

prublic

get_page_to_display()

Return page to display

public get_page_to_display() : string
Tags
since
0.4.0
access

public

Return values
string —

Page id to be displayed

handle_form_data_and_produce_content()

Handle the form data and render the form

public handle_form_data_and_produce_content() : mixed
Tags
since
0.4.0
access

public

init()

Adds a rewrite endpoint for the form.

public init() : mixed

To be added to the 'init' action.

Tags
since
0.1.0
access

public

leave_unchanged()

Leave user input to field unchanged.

public leave_unchanged(string $id, string $input) : mixed
Parameters
$id : string

The field this was input to.

$input : string

User input.

Tags
since
0.3.0
access

private

on_submit()

Called on form submission

public abstract on_submit(array<string|int, mixed> $attach_ids) : mixed

Must be implemented by sub classes.

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

The ids of attachments created during form submission.

Tags
since
0.4.0
access

private

read_and_validate_field_values()

Read all form values from $_POST and process.

public read_and_validate_field_values() : mixed
Tags
since
0.4.0
access

public

render_array_as_comma_separated_list_field()

Render an array as comma separated list type field.

public render_array_as_comma_separated_list_field(string $id[, string $placeholder = null ]) : mixed

Does not escape or otherwise handle individual fields that contain commas.

Parameters
$id : string

Id of the field.

$placeholder : string = null

Placeholder text.

Tags
since
0.3.0
access

public

render_checkbox_field()

Render a checkbox type field.

public render_checkbox_field(string $id[, string $label = '' ][, bool $esc_label = true ]) : mixed
Parameters
$id : string

Id of the field.

$label : string = ''

Label of the field.

$esc_label : bool = true

Whether to escape the content of $label, disable in case you want $label to contains htmls

Tags
since
0.1.0
access

public

render_image_upload_field()

Render an image upload field

public render_image_upload_field(string $id[, string $label = '' ][, bool $esc_label = true ]) : mixed
Parameters
$id : string

Id of the field

$label : string = ''

Label of the field. May contain html and is not escaped!

$esc_label : bool = true

Whether to escape the label

Tags
since
0.0.4
access

public

render_multi_line_field()

Render a multi line text box type field.

public render_multi_line_field(string $id[, int $rows = false ][, string $style = false ][, bool $preview = false ][, string $placeholder = false ]) : mixed
Parameters
$id : string

Id of the field.

$rows : int = false

Number of rows

$style : string = false

CSS style

$preview : bool = false

Whether to show a LaTeX preview below the field.

$placeholder : string = false

Placeholder

Tags
since
0.4.0
access

public

render_navigation()

Render the form navigation

public render_navigation(int $previous_page_id, int $page_id, int $next_page_id) : mixed
Parameters
$previous_page_id : int

Id of the previous page

$page_id : int

Id of this page

$next_page_id : int

Id of the next page

Tags
since
0.4.0
access

public

render_password_field()

Render a password field.

public render_password_field(string $id) : mixed
Parameters
$id : string

Id of the field.

Tags
since
0.1.0
access

public

render_select_field()

Render a select type field.

public render_select_field(string $id, array<string|int, mixed> $options[, string $onchange = false ][, mixed $label = '' ][, mixed $esc_label = true ]) : mixed
Parameters
$id : string

Id of the field.

$options : array<string|int, mixed>

The options between which to select

$onchange : string = false

The HTML onchange parameter

$label : mixed = ''
$esc_label : mixed = true
Tags
since
0.4.0
access

public

render_single_line_field()

Render a standard text box type field.

public render_single_line_field(string $id[, string|null $placeholder = null ][, string $autocomplete = 'on' ][, string $style = false ][, string $label = false ][, bool $esc_label = true ][, string $label_style = false ][, mixed $fallback_value = false ][, mixed $readonly = false ][, mixed $default_generator = false ]) : mixed
Parameters
$id : string

Id of the field.

$placeholder : string|null = null

Placeholder text (default is null).

$autocomplete : string = 'on'

Whether to auto complete 'on' (default) or 'off.

$style : string = false

CSS style.

$label : string = false

HTML label.

$esc_label : bool = true

Whether to escape the content of label.

$label_style : string = false

CSS style for the label.

$fallback_value : mixed = false
$readonly : mixed = false
$default_generator : mixed = false
Tags
since
0.4.0
access

public

render_summary()

Render the form summary

public render_summary() : mixed
Tags
since
0.4.0
access

public

sanitize_user_input()

Sanitize user input

public sanitize_user_input(string $input) : string
Parameters
$input : string

The input to sanitize.

Tags
since
0.4.0
access

public

Return values
string —

Sanitized input

specify_fake_field()

Add a fake field

public specify_fake_field(string $id, string $default) : mixed

Fake fields cannot be modified, but have default values that can be used to avoid hard coding values.

Parameters
$id : string

Slug-name to identify the section. Used in the 'id' attribute of tags.

$default : string

Default value for the field.

Tags
since
0.4.0
access

private

specify_field()

Specify a field of the form.

public specify_field(string $id, string $title, callable $callback, string $page, string $section, array<string|int, mixed> $args, callable $validation_callable, string $default[, int $max_length = false ]) : mixed

Keeps a record of all fields in $this->fields.

Parameters
$id : string

Slug-name to identify the field. Used in the 'id' attribute of tags.

$title : string

Formatted title of the field. Shown as the heading for the field.

$callback : callable

Function that echos out any content at the top of the field (between heading and fields).

$page : string

The slug-name of the page on which to show the field.

$section : string

The slug-name of the section in which to show the field.

$args : array<string|int, mixed>

{ Extra arguments used when outputting the field. May be an empty array().

@type string $label_for When supplied, the label will be wrapped
                        in a `<label>` element, its `for` attribute populated
                        with this value.
@type string $class     CSS Class to be added to the `<tr>` element when the
                        field is output.

}

$validation_callable : callable

Callable to use during validation of inputs. Must take a field ID and input as parameters and return a valid value for the field. Should call $this->add_error() to indicate problems.

$default : string

Default value for the field.

$max_length : int = false

Maximum length of the value of the field.

Tags
since
0.4.0
access

private

specify_page()

Specify a section of the form.

public specify_page(string $id, string $title[, callable $callback = null ]) : mixed

Keeps a record of all sections in $this->sections.

Parameters
$id : string

Slug-name to identify the page.

$title : string

Formatted title of the section. Shown as the heading for the section.

$callback : callable = null

Function that echos out the any content at the top of the page (before the first section).

Tags
since
0.4.0
access

private

specify_section()

Specify a section of the form.

public specify_section(string $id, string $title, callable $callback, string $page[, callable $summary_callback = null ]) : mixed

Keeps a record of all sections in $this->sections.

Parameters
$id : string

Slug-name to identify the section. Used in the 'id' attribute of tags.

$title : string

Formatted title of the section. Shown as the heading for the section.

$callback : callable

Function that echos out any content at the top of the section (between heading and fields).

$page : string

The slug-name of the page on which to show the section.

$summary_callback : callable = null

Callback to call when composing the summary of this form.

Tags
since
0.4.0
access

private

submitted_message()

The message to show after submission

public submitted_message(bool $submitted_successfully) : string
Parameters
$submitted_successfully : bool

Whether the form was submitted successfully.

Tags
since
0.4.0
access

public

Return values
string —

Message to display.

trim()

Trim user input to field

public trim(string $id, string $input) : mixed
Parameters
$id : string

The field this was input to.

$input : string

User input.

Tags
since
0.3.0
access

private

trim_strip_tags()

Trim user input to field

public trim_strip_tags(string $id, string $input) : mixed
Parameters
$id : string

The field this was input to.

$input : string

User input.

Tags
since
0.3.0
access

private

validate_array_as_comma_separated_list()

Validate input to comma separated list fields.

public validate_array_as_comma_separated_list(string $id, string $input) : mixed

Break a comma separated list into an array of fields.

Parameters
$id : string

The field this was input to.

$input : string

User input.

Tags
since
0.3.0
access

private

validate_array_of_at_most_1000_checked_or_unchecked()

Validate an array of at most 1000 values of checked or unchecked

public validate_array_of_at_most_1000_checked_or_unchecked(string $id, array<string|int, mixed> $input) : mixed
Parameters
$id : string

The id of the field whose input is validated.

$input : array<string|int, mixed>

The input.

Tags
since
0.4.1
access

private

validate_array_of_at_most_1000_name_styles()

Validate that an array of at most 1000 name styles

public validate_array_of_at_most_1000_name_styles(string $id, array<string|int, mixed> $input) : mixed
Parameters
$id : string

The id of the field whose input is validated.

$input : array<string|int, mixed>

The input.

Tags
since
0.4.0
access

private

validate_array_of_at_most_1000_names()

Validate that an array of at most 1000 names

public validate_array_of_at_most_1000_names(string $id, array<string|int, mixed> $input) : mixed
Parameters
$id : string

The id of the field whose input is validated.

$input : array<string|int, mixed>

The input.

Tags
since
0.4.1
access

private

validate_array_of_at_most_1000_roles()

Validate an array of at most 1000 editor coordinator or steering board entries

public validate_array_of_at_most_1000_roles(string $id, array<string|int, mixed> $input) : mixed
Parameters
$id : string

The id of the field whose input is validated.

$input : array<string|int, mixed>

The input.

Tags
since
0.4.1
access

private

validate_array_of_at_most_1000_urls()

Validate an array of at most 1000 urls

public validate_array_of_at_most_1000_urls(string $id, array<string|int, mixed> $input) : mixed
Parameters
$id : string

The id of the field whose input is validated.

$input : array<string|int, mixed>

The input.

Tags
since
0.4.1
access

private

validate_array_of_at_most_1000_urls_or_empty()

Validate an array of at most 1000 urls or empty fields

public validate_array_of_at_most_1000_urls_or_empty(string $id, array<string|int, mixed> $input) : mixed
Parameters
$id : string

The id of the field whose input is validated.

$input : array<string|int, mixed>

The input.

Tags
since
0.4.1
access

private

validate_array_of_at_most_1000_uuidv4s()

Validate that an array consists of at most 1000 UUIDv4s

public validate_array_of_at_most_1000_uuidv4s(string $id, array<string|int, mixed> $input) : mixed
Parameters
$id : string

The id of the field whose input is validated.

$input : array<string|int, mixed>

The input.

Tags
since
0.4.3
access

private

validate_array_of_at_most_1000_years()

Validate that an array of at most 1000 years

public validate_array_of_at_most_1000_years(string $id, array<string|int, mixed> $input) : mixed
Parameters
$id : string

The id of the field whose input is validated.

$input : array<string|int, mixed>

The input.

Tags
since
0.4.1
access

private

validate_array_of_at_most_1000_years_or_empty()

Validate that an array of at most 1000 years or empty

public validate_array_of_at_most_1000_years_or_empty(string $id, array<string|int, mixed> $input) : mixed
Parameters
$id : string

The id of the field whose input is validated.

$input : array<string|int, mixed>

The input.

Tags
since
0.4.1
access

private

validate_doi_prefix()

Clean user input to doi_prefix fields

public validate_doi_prefix(string $id, string $input) : mixed
Parameters
$id : string

The field this was input to.

$input : string

User input.

Tags
since
0.4.0
access

private

validate_doi_suffix()

Clean user input to doi_suffix fields

public validate_doi_suffix(string $id, string $input) : mixed
Parameters
$id : string

The field this was input to.

$input : string

User input.

Tags
since
0.4.0
access

private

validate_email()

Clean user input to email fields

public validate_email(string $id, string $input) : mixed
Parameters
$id : string

The field this was input to.

$input : string

User input.

Tags
since
0.4.0
access

private

validate_eprint()

Clean user input to eprint fields

public validate_eprint(string $id, string $input) : string
Parameters
$id : string

The field this was input to.

$input : string

User input.

Tags
since
0.4.0
access

private

Return values
string —

Valid issn or empty string.

validate_four_digit_year()

Clean user input to fields expecting a year.

public validate_four_digit_year(string $id, string $input) : mixed
Parameters
$id : string

The field this was input to.

$input : string

User input.

Tags
since
0.3.1
access

private

validate_issn()

Clean user input to issn fields

public validate_issn(string $id, string $input) : mixed
Parameters
$id : string

The field this was input to.

$input : string

User input.

Tags
since
0.3.0
access

private

validate_issn_or_empty()

Clean user input to issn fields

public validate_issn_or_empty(string $id, string $input) : string
Parameters
$id : string

The field this was input to.

$input : string

User input.

Tags
since
0.4.0
access

private

Return values
string —

Valid issn or empty string.

validate_non_negative_euros()

Validate non-negative euro fields

public validate_non_negative_euros(string $id, string $input) : mixed
Parameters
$id : string

The field this was input to.

$input : string

User input.

Tags
since
0.3.0
access

private

validate_non_negative_float()

Validate non-negative float

public validate_non_negative_float(string $id, string $input) : mixed
Parameters
$id : string

The field this was input to.

$input : string

User input.

Tags
since
0.3.0
access

private

validate_positive_integer()

Validate positive integer fields

public validate_positive_integer(string $id, string $input) : mixed
Parameters
$id : string

The field this was input to.

$input : string

User input.

Tags
since
0.3.0
access

private

validate_role()

Restrict input to valid roles of people working for the journal

public validate_role(string $id, string $input) : mixed
Parameters
$id : string

The field this was input to.

$input : string

User input.

Tags
since
0.4.1
access

private

validate_session_id()

Check whether an id is a valid session id

public validate_session_id(int $id) : mixed
Parameters
$id : int

Id to validate

Tags
since
0.4.0
Return values
mixed —

Session id or False if invalid.

validate_two_letter_country_code()

Validate two letter country code fields

public validate_two_letter_country_code(string $id, string $input) : mixed
Parameters
$id : string

The field this was input to.

$input : string

User input.

Tags
since
0.3.0
access

private

validate_url()

Clean user input to url fields

public validate_url(string $id, string $input) : mixed
Parameters
$id : string

The field this was input to.

$input : string

User input.

Tags
since
0.3.0
access

private

add_error()

Add an error or warning to the list of errors

protected add_error(string $setting, string $code, string $message[, string $type = 'error' ]) : mixed
Parameters
$setting : string

Setting that produced the error.

$code : string

Error code.

$message : string

Error message

$type : string = 'error'

Type of error, one of 'error' or 'warning'.

Tags
since
0.4.0
access

public

add_sideloaded_files_to_media_library()

Add the files uploaded by the user to the media library.

protected add_sideloaded_files_to_media_library() : mixed
Tags
since
0.4.0
access

protected

append_session_data()

Append a field value pair to the current session data

protected append_session_data(string $field, mixed $value) : mixed
Parameters
$field : string

The field to set.

$value : mixed

The value to set.

Tags
since
0.4.0

get_session_data()

Get field from the data of a session

protected get_session_data(string $field[, mixed $default = null ][, string $session_id = null ]) : mixed
Parameters
$field : string

The field to get.

$default : mixed = null

The default value in case the field is not set.

$session_id : string = null

The session id for which to get the field.

Tags
since
0.4.0

put_session_data()

Set field in the data of a session

protected put_session_data(string $field, mixed $value[, string $session_id = null ]) : mixed
Parameters
$field : string

The field to set.

$value : mixed

The value to set.

$session_id : string = null

The session id for which to set the field.

Tags
since
0.4.0

specify_pages_sections_and_fields()

Specifies form sections and fields.

protected abstract specify_pages_sections_and_fields() : mixed
Tags
since
0.4.0
access

private

delete_sideloaded_files()

Delete the sideloaded files of a session

private delete_sideloaded_files(string $session_id) : mixed
Parameters
$session_id : string

Session id.

Tags
since
0.4.0
access

private

discard_session()

Discard a session and all its data

private discard_session(int $session_id) : mixed
Parameters
$session_id : int

Id to discard

Tags
since
0.4.0

get_class_option()

Get the option element used by this class

private get_class_option() : array<string|int, mixed>
Tags
since
0.4.0
Return values
array<string|int, mixed> —

Class option

get_session_ids()

Get all recent session ids

private get_session_ids([int $dicard_older_than = 24 * 60 * 60 ]) : array<string|int, mixed>
Parameters
$dicard_older_than : int = 24 * 60 * 60

Discard all session ids older than this many seconds

Tags
since
0.4.0
Return values
array<string|int, mixed> —

Recent session ids

make_post()

Make a fake post to show the form

private make_post(string $title, string $content) : mixed
Parameters
$title : string

Title of the post

$content : string

Content of the post

Tags
since
0.4.0
access

public

renew_session_id()

Renew a session and all its data

private renew_session_id(int $session_id) : mixed
Parameters
$session_id : int

Id to renew

Tags
since
0.4.0

setup_query()

Setup the query to show a post

private setup_query(WP_Post $wp_post) : mixed
Parameters
$wp_post : WP_Post

Post to show.

Tags
since
0.4.0
access

public

update_class_option()

Set the option element used by this class

private update_class_option(mixed $class_options) : mixed
Parameters
$class_options : mixed
Tags
since
0.4.0

        
On this page

Search results