Options

Functions for handling the Posts Table Pro plugin options.

Tags
author

Barn2 Plugins [email protected]

license

GPL-3.0

copyright

Barn2 Media Ltd

Table of Contents

ADDITIONAL_POST_TYPES_OPTION_KEY  = 'ptp_additional_post_types'
MISC_OPTION_KEY  = 'ptp_misc_settings'
SEARCH_PAGE_KEY  = 'ptp_search_page'
SHORTCODE_OPTION_KEY  = 'ptp_shortcode_defaults'
get_additional_post_type_slugs()  : array<string|int, string>
Get the explicitly selected additional post types.
get_cache_expiration_length()  : int
Get the cache expiration length.
get_design_template_settings()  : array<string|int, mixed>
Retrieves the design template settings by merging defaults with saved options.
get_misc_options()  : array<string|int, mixed>
Get the miscellaneous options.
get_search_page_option()  : int|false
Get the search page option.
get_setting_table_styling()  : array<string|int, mixed>
Get the table styling settings.
get_shortcode_options()  : array<string|int, mixed>
Get the shortcode options.
merge_design_defaults_with_options()  : array<string|int, mixed>
Merges the default design settings with saved options.
get_option()  : mixed
Get an option merged with its defaults.
normalize_saved_filter_decision()  : array<string|int, mixed>
Adapt the location-only DataViews format using only actually stored keys.
table_settings_to_args()  : array<string|int, mixed>
Convert saved table settings to shortcode arguments.

Constants

ADDITIONAL_POST_TYPES_OPTION_KEY

public mixed ADDITIONAL_POST_TYPES_OPTION_KEY = 'ptp_additional_post_types'
Tags

MISC_OPTION_KEY

public mixed MISC_OPTION_KEY = 'ptp_misc_settings'
Tags

SEARCH_PAGE_KEY

public mixed SEARCH_PAGE_KEY = 'ptp_search_page'
Tags

SHORTCODE_OPTION_KEY

public mixed SHORTCODE_OPTION_KEY = 'ptp_shortcode_defaults'
Tags

Methods

get_additional_post_type_slugs()

Get the explicitly selected additional post types.

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

get_cache_expiration_length()

Get the cache expiration length.

public static get_cache_expiration_length() : int
Tags
Return values
int —

Cache expiration length in hours.

get_design_template_settings()

Retrieves the design template settings by merging defaults with saved options.

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

The merged template settings.

get_misc_options()

Get the miscellaneous options.

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

Miscellaneous options.

get_search_page_option()

Get the search page option.

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

Search page ID or false when no valid page is set.

get_setting_table_styling()

Get the table styling settings.

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

Table styling settings.

get_shortcode_options()

Get the shortcode options.

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

Default shortcode options.

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

Shortcode options.

merge_design_defaults_with_options()

Merges the default design settings with saved options.

public static merge_design_defaults_with_options(array<string|int, mixed> $defaults, array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
$defaults : array<string|int, mixed>

The default design settings.

$options : array<string|int, mixed>

The saved design options from the settings.

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

The merged design settings, with saved options overriding defaults.

get_option()

Get an option merged with its defaults.

private static get_option(string $option, mixed $default_value) : mixed
Parameters
$option : string

Option name.

$default_value : mixed

Default option value.

Tags
Return values
mixed —

Option value.

normalize_saved_filter_decision()

Adapt the location-only DataViews format using only actually stored keys.

private static normalize_saved_filter_decision(array<string|int, mixed> $options) : array<string|int, mixed>

Keep the existing options conversion and default processing intact.

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

Options after default merging.

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

table_settings_to_args()

Convert saved table settings to shortcode arguments.

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

Saved table settings.

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

Default table settings.

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

Shortcode arguments.

Search results