\GeoMashupOptions

A singleton to manage Geo Mashup saved options.

Summary

Methods
Properties
Constants
__construct()
save()
get()
set_valid_options()
is_valid()
$default_options
$valid_map_types
$corrupt_options
$validation_errors
No constants found
No protected methods found
No protected properties found
N/A
convert_old_settings()
valid_options()
$conversions
$freeform_option_keys
$options
N/A

Properties

$default_options

$default_options : array

Valid options with default values.

Type

array

$valid_map_types

$valid_map_types : array

Valid map types.

Type

array

$corrupt_options

$corrupt_options : array

Old option values that can't be converted.

Type

array

$validation_errors

$validation_errors : array

Validation messages.

Type

array

$conversions

$conversions : array

Map of old option names to new ones.

Type

array

$freeform_option_keys

$freeform_option_keys : array

Options keys whose values aren't predictable.

Type

array

$options

$options : array

Saved option values.

Use the GeoMashupOptions::get() method for access.

Type

array

Methods

__construct()

__construct()

PHP5 constructor

Should be used only in this file.

save()

save() : boolean

Write current values to the database.

Returns

boolean —

Success or failure.

get()

get(string $key1, string $key2, string $key3) : string|array

Get a saved option value.

$single_map_options_array = $geo_mashup_options->get( 'single_map' ); $google_key = $geo_mashup_options->get( 'overall', 'google_key' ); $add_global_satellite_map = $geo_mashup_options->get( 'global_map', 'add_map_type_control', 'G_SATELLITE_MAP' );

Parameters

string $key1

Highest level key.

string $key2

Second level key.

string $key3

Third level key.

Returns

string|array —

The option value or values.

set_valid_options()

set_valid_options(array $option_array)

Import valid options from an array.

Parameters

array $option_array

Associative array of option names and values.

is_valid()

is_valid(string $key, mixed $value) : boolean

Check an option key and value for validity.

Parameters

string $key

Option key.

mixed $value

Option value, modified in some cases.

Returns

boolean —

True if valid.

convert_old_settings()

convert_old_settings(array $settings) : array

Change old option names.

Parameters

array $settings

Existing settings.

Returns

array —

Converted settings.

valid_options()

valid_options(array $option_array, array $defaults, boolean $add_missing) : array

Remove invalid option keys from an array, and replace invalid values with defaults.

Parameters

array $option_array

An array of options to validate.

array $defaults

Optional array of valid default values.

boolean $add_missing

Set if input is not from a form, so missing values are not unchecked checkboxes and should get default values.

Returns

array —

Valid options.