Options

Settings Options Utilities

Tags
author

Barn2 Plugins support@barn2.com

license

GPL-3.0

copyright

Barn2 Media Ltd

Table of Contents

DOCUMENT_FIELDS_OPTION_KEY  = 'dlp_document_fields'
DOCUMENT_PAGE_OPTION_KEY  = 'dlp_document_page'
DOCUMENT_SLUG_OPTION_KEY  = 'dlp_document_slug'
FOLDER_CLOSE_SVG_OPTION_KEY  = 'dlp_folder_icon_svg_closed'
FOLDER_OPEN_SVG_OPTION_KEY  = 'dlp_folder_icon_svg_open'
GENERAL_OPTION_GROUP  = 'document_library_pro_general'
GRID_OPTION_GROUP  = 'document_library_pro_grid'
MISC_OPTION_KEY  = 'dlp_misc_settings'
SEARCH_PAGE_OPTION_KEY  = 'dlp_search_page'
SETTINGS_KEY  = 'document-library-pro_settings'
SHORTCODE_OPTION_KEY  = 'dlp_shortcode_defaults'
SINGLE_DOCUMENT_DISPLAY_OPTION_KEY  = 'dlp_document_fields_display'
SINGLE_OPTION_GROUP  = 'document_library_pro_single_document'
TABLE_OPTION_GROUP  = 'document_library_pro_table'
convert_checkbox_value_to_boolean()  : string
Convert to checkbox value to boolean.
convert_to_checkbox_value()  : string
Convert to checkbox value
get_additional_options()  : mixed
Get additional options.
get_defaults()  : array<string|int, mixed>
Returns the hardcoded default arguments for DLP
get_dlp_specific_default_args()  : array<string|int, string>
Retrieves the default args specific to DLP (as opposed to the PTP defaults)
get_document_display_default_structure()  : array<string|int, mixed>
Get the document display default structure.
get_document_display_fields()  : array<string|int, mixed>
Retrieve the single document display option.
get_document_display_option_labels()  : mixed
Get the document display option labels
get_document_fields()  : array<string|int, mixed>
Retrive the Document post type fields.
get_document_slug()  : array<string|int, mixed>
Retrieve the document slug
get_search_page_option()  : int|false
Retrieve the search page option.
get_settings()  : array<string|int, mixed>
Retrieve the new settings key and format the options for table args.
get_shortcode_options()  : array<string|int, mixed>
Retrieve the shortcode options.
get_single_document_display_defaults()  : array<string|int, mixed>
Get the document display default structure.
get_supported_columns()  : array<string|int, mixed>
Retrieve the supported columns.
get_supported_taxonomies()  : array<string|int, mixed>
Retrieve the supported taxonomies.
get_user_shortcode_options()  : array<string|int, mixed>
Retrieve the user shortcode options.
get_v2_default_args()  : array<string|int, mixed>
Get the new args for the v2 changes
get_version_control_mode()  : bool|string
Return the version control mode (keep or delete) or false if version control is disabled
has_db_migrated_to_2_0()  : bool
Determine if the database has been successfully migrated to 2.0
is_submission_admin_email_active()  : bool
Determine if admin notifications for frontend submissions are active.
is_submission_moderated()  : bool
Determine if frontend submissions are moderated.
is_version_history_active()  : bool
Determine whether the version control is enabled and the replacing file strategy is set to `keep`
maybe_parse_bool()  : bool|string
Convert to checkbox value to boolean.
migrate_accessing_document_settings()  : bool
Generate the accessing document settings.
migrate_columns()  : array<string|int, mixed>
Migrate columns and links to the new structure.
migrate_link_style_settings()  : array<string|int, mixed>
Generate the link style settings.
migrate_multicheckbox_settings()  : array<string|int, mixed>
Generate the multicheckbox settings.
migrate_preview_style_settings()  : array<string|int, mixed>
Generate the preview link style settings.
normalize_user_arguments()  : array<string|int, mixed>
Normalize user arguments provided to shortcode.
parse_column_breakpoints_from_v2_columns()  : string
Get the list of column breakpoints.
parse_column_link_destination_from_v2_columns()  : string
Get the list of column breakpoints.
parse_columns_from_v2_columns()  : string
Get the list of columns.
parse_links_from_v2_columns()  : string
Get the list of columns that have links.
parse_priorities_from_v2_columns()  : string
Get the list of column priorities.
parse_search_on_click_from_v2_columns()  : string
Get the list of columns that have search on click.
parse_widths_from_v2_columns()  : string
Get the list of columns width.
sanitize_grid_content()  : array<string|int, mixed>
Sanitizes grid content data to the correct array format.
string_list_to_multicheckbox_array()  : null|array<string|int, mixed>
Convert a string list to a multicheckbox array.
update_settings()  : bool
Update the settings.
update_shortcode_option()  : bool
Update the shortcode options.
uses_excerpt_option()  : bool
Determine if the excerpt option is enabled and in use.
get_option()  : mixed
Retrieve an option.
sanitize_shortcode_options()  : array<string|int, mixed>
Sanitize the shortcode options.

Constants

DOCUMENT_FIELDS_OPTION_KEY

public mixed DOCUMENT_FIELDS_OPTION_KEY = 'dlp_document_fields'
Tags

DOCUMENT_PAGE_OPTION_KEY

public mixed DOCUMENT_PAGE_OPTION_KEY = 'dlp_document_page'
Tags

DOCUMENT_SLUG_OPTION_KEY

public mixed DOCUMENT_SLUG_OPTION_KEY = 'dlp_document_slug'
Tags

FOLDER_CLOSE_SVG_OPTION_KEY

public mixed FOLDER_CLOSE_SVG_OPTION_KEY = 'dlp_folder_icon_svg_closed'
Tags

FOLDER_OPEN_SVG_OPTION_KEY

public mixed FOLDER_OPEN_SVG_OPTION_KEY = 'dlp_folder_icon_svg_open'
Tags

GENERAL_OPTION_GROUP

public mixed GENERAL_OPTION_GROUP = 'document_library_pro_general'
Tags

GRID_OPTION_GROUP

public mixed GRID_OPTION_GROUP = 'document_library_pro_grid'
Tags

MISC_OPTION_KEY

public mixed MISC_OPTION_KEY = 'dlp_misc_settings'
Tags

SEARCH_PAGE_OPTION_KEY

public mixed SEARCH_PAGE_OPTION_KEY = 'dlp_search_page'
Tags

SETTINGS_KEY

public mixed SETTINGS_KEY = 'document-library-pro_settings'
Tags

SHORTCODE_OPTION_KEY

public mixed SHORTCODE_OPTION_KEY = 'dlp_shortcode_defaults'
Tags

SINGLE_DOCUMENT_DISPLAY_OPTION_KEY

public mixed SINGLE_DOCUMENT_DISPLAY_OPTION_KEY = 'dlp_document_fields_display'
Tags

SINGLE_OPTION_GROUP

public mixed SINGLE_OPTION_GROUP = 'document_library_pro_single_document'
Tags

TABLE_OPTION_GROUP

public mixed TABLE_OPTION_GROUP = 'document_library_pro_table'
Tags

Methods

convert_checkbox_value_to_boolean()

Convert to checkbox value to boolean.

public static convert_checkbox_value_to_boolean(string|bool $value) : string
Parameters
$value : string|bool
Tags
Return values
string

convert_to_checkbox_value()

Convert to checkbox value

public static convert_to_checkbox_value(string|bool $value) : string

Convert true / false, 'true' / 'false', 1 / 0 to '1' / '0'.

Parameters
$value : string|bool
Tags
Return values
string

get_additional_options()

Get additional options.

public static get_additional_options() : mixed

We use the PTP function to maintain consistency across grid and table code.

Tags
Return values
mixed

get_defaults()

Returns the hardcoded default arguments for DLP

public static get_defaults() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

get_dlp_specific_default_args()

Retrieves the default args specific to DLP (as opposed to the PTP defaults)

public static get_dlp_specific_default_args() : array<string|int, string>
Tags
Return values
array<string|int, string>

get_document_display_default_structure()

Get the document display default structure.

public static get_document_display_default_structure() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

get_document_display_fields()

Retrieve the single document display option.

public static get_document_display_fields() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

get_document_display_option_labels()

Get the document display option labels

public static get_document_display_option_labels() : mixed
Tags
Return values
mixed

get_document_fields()

Retrive the Document post type fields.

public static get_document_fields() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

get_document_slug()

Retrieve the document slug

public static get_document_slug() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

get_search_page_option()

Retrieve the search page option.

public static get_search_page_option() : int|false
Tags
Return values
int|false

get_settings()

Retrieve the new settings key and format the options for table args.

public static get_settings() : array<string|int, mixed>

We need to preserve the existing table args for backwards compatibility with the shortcodes.

Tags
Return values
array<string|int, mixed>

get_shortcode_options()

Retrieve the shortcode options.

public static get_shortcode_options([array<string|int, mixed> $defaults = [] ]) : array<string|int, mixed>

We use the PTP function to maintain consistency across grid and table code.

Parameters
$defaults : array<string|int, mixed> = []
Tags
Return values
array<string|int, mixed>

get_single_document_display_defaults()

Get the document display default structure.

public static get_single_document_display_defaults() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

get_supported_columns()

Retrieve the supported columns.

public static get_supported_columns() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

get_supported_taxonomies()

Retrieve the supported taxonomies.

public static get_supported_taxonomies() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

get_user_shortcode_options()

Retrieve the user shortcode options.

public static get_user_shortcode_options() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

get_v2_default_args()

Get the new args for the v2 changes

public static get_v2_default_args() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

get_version_control_mode()

Return the version control mode (keep or delete) or false if version control is disabled

public static get_version_control_mode() : bool|string
Tags
Return values
bool|string

Either 'keep', 'delete' or false

has_db_migrated_to_2_0()

Determine if the database has been successfully migrated to 2.0

public static has_db_migrated_to_2_0() : bool
Tags
Return values
bool

is_submission_admin_email_active()

Determine if admin notifications for frontend submissions are active.

public static is_submission_admin_email_active() : bool
Tags
Return values
bool

is_submission_moderated()

Determine if frontend submissions are moderated.

public static is_submission_moderated() : bool
Tags
Return values
bool

is_version_history_active()

Determine whether the version control is enabled and the replacing file strategy is set to `keep`

public static is_version_history_active() : bool
Tags
Return values
bool

maybe_parse_bool()

Convert to checkbox value to boolean.

public static maybe_parse_bool(string|bool $maybe_bool) : bool|string
Parameters
$maybe_bool : string|bool
Tags
Return values
bool|string

migrate_accessing_document_settings()

Generate the accessing document settings.

public static migrate_accessing_document_settings(string $accessing_document) : bool
Parameters
$accessing_document : string
Tags
Return values
bool

migrate_columns()

Migrate columns and links to the new structure.

public static migrate_columns(string $columns, string $links) : array<string|int, mixed>
Parameters
$columns : string

Colunms from the v1 settings

$links : string

Clickable fields from the v1 settings

Tags
Return values
array<string|int, mixed>

Generate the link style settings.

public static migrate_link_style_settings(string $link_style) : array<string|int, mixed>
Parameters
$link_style : string
Tags
Return values
array<string|int, mixed>

migrate_multicheckbox_settings()

Generate the multicheckbox settings.

public static migrate_multicheckbox_settings(array<string|int, mixed> $setting) : array<string|int, mixed>
Parameters
$setting : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

migrate_preview_style_settings()

Generate the preview link style settings.

public static migrate_preview_style_settings(string $link_style) : array<string|int, mixed>
Parameters
$link_style : string
Tags
Return values
array<string|int, mixed>

normalize_user_arguments()

Normalize user arguments provided to shortcode.

public static normalize_user_arguments(array<string|int, mixed> $args) : array<string|int, mixed>
Parameters
$args : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

parse_column_breakpoints_from_v2_columns()

Get the list of column breakpoints.

public static parse_column_breakpoints_from_v2_columns([array<string|int, mixed> $columns = [] ]) : string
Parameters
$columns : array<string|int, mixed> = []
Tags
Return values
string

Get the list of column breakpoints.

public static parse_column_link_destination_from_v2_columns(string $slug[, array<string|int, mixed> $columns = [] ]) : string
Parameters
$slug : string
$columns : array<string|int, mixed> = []
Tags
Return values
string

parse_columns_from_v2_columns()

Get the list of columns.

public static parse_columns_from_v2_columns([array<string|int, mixed> $selected_columns = [] ]) : string
Parameters
$selected_columns : array<string|int, mixed> = []
Tags
Return values
string

Get the list of columns that have links.

public static parse_links_from_v2_columns([array<string|int, mixed> $columns = [] ]) : string
Parameters
$columns : array<string|int, mixed> = []
Tags
Return values
string

parse_priorities_from_v2_columns()

Get the list of column priorities.

public static parse_priorities_from_v2_columns([array<string|int, mixed> $columns = [] ]) : string
Parameters
$columns : array<string|int, mixed> = []
Tags
Return values
string

parse_search_on_click_from_v2_columns()

Get the list of columns that have search on click.

public static parse_search_on_click_from_v2_columns([array<string|int, mixed> $columns = [] ]) : string
Parameters
$columns : array<string|int, mixed> = []
Tags
Return values
string

parse_widths_from_v2_columns()

Get the list of columns width.

public static parse_widths_from_v2_columns([array<string|int, mixed> $columns = [] ]) : string
Parameters
$columns : array<string|int, mixed> = []
Tags
Return values
string

sanitize_grid_content()

Sanitizes grid content data to the correct array format.

public static sanitize_grid_content(mixed $fields) : array<string|int, mixed>
Parameters
$fields : mixed
Tags
Return values
array<string|int, mixed>

string_list_to_multicheckbox_array()

Convert a string list to a multicheckbox array.

public static string_list_to_multicheckbox_array(mixed $string_list) : null|array<string|int, mixed>
Parameters
$string_list : mixed
Tags
Return values
null|array<string|int, mixed>

update_settings()

Update the settings.

public static update_settings([array<string|int, mixed> $values = [] ]) : bool
Parameters
$values : array<string|int, mixed> = []
Tags
Return values
bool

update_shortcode_option()

Update the shortcode options.

public static update_shortcode_option([array<string|int, mixed> $values = [] ]) : bool
Parameters
$values : array<string|int, mixed> = []
Tags
Return values
bool

uses_excerpt_option()

Determine if the excerpt option is enabled and in use.

public static uses_excerpt_option() : bool
  • New installs and existing installs with the excerpt option disabled will return false.
  • Used to remove the excerpt option from the single document display settings in a backwards compatible way.
Tags
Return values
bool

get_option()

Retrieve an option.

private static get_option(string $option, mixed $default) : mixed
Parameters
$option : string
$default : mixed
Tags
Return values
mixed

sanitize_shortcode_options()

Sanitize the shortcode options.

private static sanitize_shortcode_options(array<string|int, mixed> $options[, array<string|int, mixed> $defaults = [] ]) : array<string|int, mixed>
Parameters
$options : array<string|int, mixed>
$defaults : array<string|int, mixed> = []
Tags
Return values
array<string|int, mixed>

Search results