\MLAOptions

Class MLA (Media Library Assistant) Options manages the plugin option settings and provides functions to get and put them from/to WordPress option variables

Separated from class MLASettings in version 1.00

Summary

Methods
Properties
Constants
initialize()
mla_get_option()
mla_update_option()
mla_delete_option()
mla_taxonomy_support()
mla_supported_taxonomies()
mla_attachment_display_settings_option_handler()
mla_taxonomy_option_handler()
mla_search_option_handler()
mla_wp_handle_upload_prefilter_filter()
mla_wp_handle_upload_filter()
mla_add_attachment_action()
mla_update_attachment_metadata_filter()
mla_get_data_source()
mla_is_data_source()
mla_evaluate_custom_field_mapping()
mla_custom_field_option_handler()
mla_evaluate_iptc_exif_mapping()
mla_iptc_exif_option_handler()
No public properties found
MLA_VERSION_OPTION
MLA_EXCLUDE_REVISIONS
MLA_FEATURED_IN_TUNING
MLA_INSERTED_IN_TUNING
MLA_GALLERY_IN_TUNING
MLA_MLA_GALLERY_IN_TUNING
MLA_COUNT_TERM_ATTACHMENTS
MLA_TAXONOMY_SUPPORT
MLA_SCREEN_PAGE_TITLE
MLA_SCREEN_MENU_TITLE
MLA_SCREEN_ORDER
MLA_SCREEN_DISPLAY_LIBRARY
MLA_DEFAULT_ORDERBY
MLA_DEFAULT_ORDER
MLA_TABLE_VIEWS_WIDTH
MLA_TABLE_ICON_SIZE
MLA_BULK_CHUNK_SIZE
MLA_TAXONOMY_FILTER_DEPTH
MLA_TAXONOMY_FILTER_INCLUDE_CHILDREN
MLA_SEARCH_MEDIA_FILTER_SHOW_CONTROLS
MLA_SEARCH_MEDIA_FILTER_DEFAULTS
MLA_EXIF_SIZE
MLA_NEW_CUSTOM_RULE
MLA_NEW_CUSTOM_FIELD
MLA_EDIT_MEDIA_SEARCH_TAXONOMY
MLA_EDIT_MEDIA_META_BOXES
MLA_ADD_NEW_BULK_EDIT
MLA_ADD_NEW_BULK_EDIT_ON_TOP
MLA_MEDIA_GRID_TOOLBAR
MLA_MEDIA_MODAL_TOOLBAR
MLA_MEDIA_MODAL_MIMETYPES
MLA_MEDIA_MODAL_MONTHS
MLA_MEDIA_MODAL_TERMS
MLA_MEDIA_MODAL_TERMS_SEARCH
MLA_MEDIA_MODAL_SEARCHBOX
MLA_MEDIA_MODAL_SEARCHBOX_CONTROLS
MLA_MEDIA_MODAL_DETAILS_CATEGORY_METABOX
MLA_MEDIA_MODAL_DETAILS_TAG_METABOX
MLA_MEDIA_MODAL_DETAILS_AUTOFILL
MLA_MEDIA_MODAL_ORDERBY
MLA_MEDIA_MODAL_ORDER
MLA_POST_MIME_TYPES
MLA_ENABLE_POST_MIME_TYPES
MLA_UPLOAD_MIMES
MLA_ENABLE_UPLOAD_MIMES
MLA_ENABLE_MLA_ICONS
MLA_DEBUG_DISPLAY_LIMIT
MLA_DEBUG_FILE
MLA_DEBUG_REPLACE_PHP_LOG
MLA_DEBUG_REPLACE_PHP_REPORTING
MLA_DEBUG_REPLACE_LEVEL
No protected methods found
No protected properties found
N/A
_load_option_templates()
_update_attachment_metadata()
_compose_custom_field_option_list()
_compose_data_source_option_list()
_update_custom_field_mapping()
_get_term_id()
_compose_iptc_option_list()
_compose_parent_option_list()
_update_iptc_exif_standard_mapping()
_update_iptc_exif_taxonomy_mapping()
_update_iptc_exif_custom_mapping()
_get_custom_field_names()
$mla_option_templates
$add_attachment_id
N/A

Constants

MLA_VERSION_OPTION

MLA_VERSION_OPTION

Provides a unique name for the current version option

MLA_EXCLUDE_REVISIONS

MLA_EXCLUDE_REVISIONS

Provides a unique name for the exclude revisions option

MLA_INSERTED_IN_TUNING

MLA_INSERTED_IN_TUNING

Provides a unique name for a database tuning option

MLA_COUNT_TERM_ATTACHMENTS

MLA_COUNT_TERM_ATTACHMENTS

Provides a unique name for the taxonomy count Attachments option

MLA_TAXONOMY_SUPPORT

MLA_TAXONOMY_SUPPORT

Provides a unique name for the taxonomy support option

MLA_SCREEN_PAGE_TITLE

MLA_SCREEN_PAGE_TITLE

Provides a unique name for the admin screen page title option

MLA_SCREEN_MENU_TITLE

MLA_SCREEN_MENU_TITLE

Provides a unique name for the admin screen menu title option

MLA_SCREEN_ORDER

MLA_SCREEN_ORDER

Provides a unique name for the admin screen menu order option

MLA_SCREEN_DISPLAY_LIBRARY

MLA_SCREEN_DISPLAY_LIBRARY

Provides a unique name for the admin screen remove Media/Library option

MLA_DEFAULT_ORDERBY

MLA_DEFAULT_ORDERBY

Provides a unique name for the default orderby option

MLA_DEFAULT_ORDER

MLA_DEFAULT_ORDER

Provides a unique name for the default order option

MLA_TABLE_VIEWS_WIDTH

MLA_TABLE_VIEWS_WIDTH

Provides a unique name for the Media/Assistant submenu table views width option

MLA_TABLE_ICON_SIZE

MLA_TABLE_ICON_SIZE

Provides a unique name for the Media/Assistant submenu table thumbnail/icon size option

MLA_BULK_CHUNK_SIZE

MLA_BULK_CHUNK_SIZE

Provides a unique name for the Bulk Update and Map All chunk size option

MLA_TAXONOMY_FILTER_DEPTH

MLA_TAXONOMY_FILTER_DEPTH

Provides a unique name for the taxonomy filter maximum depth option

MLA_TAXONOMY_FILTER_INCLUDE_CHILDREN

MLA_TAXONOMY_FILTER_INCLUDE_CHILDREN

Provides a unique name for the taxonomy filter maximum depth option

MLA_SEARCH_MEDIA_FILTER_SHOW_CONTROLS

MLA_SEARCH_MEDIA_FILTER_SHOW_CONTROLS

Provides a unique name for the display Search Media controls option

MLA_SEARCH_MEDIA_FILTER_DEFAULTS

MLA_SEARCH_MEDIA_FILTER_DEFAULTS

Provides a unique name for the display Search Media controls option

MLA_EXIF_SIZE

MLA_EXIF_SIZE

Provides a "size" attribute value for the EXIF/Template Value field

MLA_NEW_CUSTOM_RULE

MLA_NEW_CUSTOM_RULE

Provides a unique name for the Custom Field "new rule" key

MLA_NEW_CUSTOM_FIELD

MLA_NEW_CUSTOM_FIELD

Provides a unique name for the Custom Field "new field" key

MLA_EDIT_MEDIA_SEARCH_TAXONOMY

MLA_EDIT_MEDIA_SEARCH_TAXONOMY

Provides a unique name for the "searchable taxonomies" option

MLA_EDIT_MEDIA_META_BOXES

MLA_EDIT_MEDIA_META_BOXES

Provides a unique name for the Edit Media additional meta boxes option

MLA_ADD_NEW_BULK_EDIT

MLA_ADD_NEW_BULK_EDIT

Provides a unique name for the Media/Add New bulk edit option

MLA_ADD_NEW_BULK_EDIT_ON_TOP

MLA_ADD_NEW_BULK_EDIT_ON_TOP

Provides a unique name for the Media/Add New bulk edit "on top" option

MLA_MEDIA_GRID_TOOLBAR

MLA_MEDIA_GRID_TOOLBAR

Provides a unique name for the Media Grid toolbar option, which also controls the ATTACHMENT DETAILS enhancements

MLA_MEDIA_MODAL_TOOLBAR

MLA_MEDIA_MODAL_TOOLBAR

Provides a unique name for the Media Manager toolbar option, which also controls the ATTACHMENT DETAILS enhancements

MLA_MEDIA_MODAL_MIMETYPES

MLA_MEDIA_MODAL_MIMETYPES

Provides a unique name for the Media Manager toolbar MIME Types option

MLA_MEDIA_MODAL_MONTHS

MLA_MEDIA_MODAL_MONTHS

Provides a unique name for the Media Manager toolbar Month and Year option

MLA_MEDIA_MODAL_TERMS

MLA_MEDIA_MODAL_TERMS

Provides a unique name for the Media Manager toolbar Taxonomy Terms option

MLA_MEDIA_MODAL_SEARCHBOX_CONTROLS

MLA_MEDIA_MODAL_SEARCHBOX_CONTROLS

Provides a unique name for the Media Manager toolbar Search Box Controls option

MLA_MEDIA_MODAL_DETAILS_CATEGORY_METABOX

MLA_MEDIA_MODAL_DETAILS_CATEGORY_METABOX

Provides a unique name for the Media Manager Attachment Details searchable taxonomy option This option is for hierarchical taxonomies, e.g., "Att. Categories".

MLA_MEDIA_MODAL_DETAILS_TAG_METABOX

MLA_MEDIA_MODAL_DETAILS_TAG_METABOX

Provides a unique name for the Media Manager Attachment Details searchable taxonomy option This option is for flat taxonomies, e.g., "Att. Tags".

MLA_MEDIA_MODAL_DETAILS_AUTOFILL

MLA_MEDIA_MODAL_DETAILS_AUTOFILL

Provides a unique name for the Media Manager Attachment Details auto-fill option

MLA_MEDIA_MODAL_ORDERBY

MLA_MEDIA_MODAL_ORDERBY

Provides a unique name for the Media Manager orderby option

MLA_MEDIA_MODAL_ORDER

MLA_MEDIA_MODAL_ORDER

Provides a unique name for the Media Manager order option

MLA_POST_MIME_TYPES

MLA_POST_MIME_TYPES

Provides a unique name for the Post MIME Types option

MLA_ENABLE_POST_MIME_TYPES

MLA_ENABLE_POST_MIME_TYPES

Provides a unique name for the Enable Post MIME Types option

MLA_UPLOAD_MIMES

MLA_UPLOAD_MIMES

Provides a unique name for the Upload MIME Types option

MLA_ENABLE_UPLOAD_MIMES

MLA_ENABLE_UPLOAD_MIMES

Provides a unique name for the Enable Upload MIME Types option

MLA_ENABLE_MLA_ICONS

MLA_ENABLE_MLA_ICONS

Provides a unique name for the Enable MLA Icons option

MLA_DEBUG_DISPLAY_LIMIT

MLA_DEBUG_DISPLAY_LIMIT

Provides a unique name for the Debug display limit option

MLA_DEBUG_FILE

MLA_DEBUG_FILE

Provides a unique name for the Debug alternate log file option

MLA_DEBUG_REPLACE_PHP_LOG

MLA_DEBUG_REPLACE_PHP_LOG

Provides a unique name for the Debug replace PHP log file option

MLA_DEBUG_REPLACE_PHP_REPORTING

MLA_DEBUG_REPLACE_PHP_REPORTING

Provides a unique name for the Debug replace PHP error_reporting option

MLA_DEBUG_REPLACE_LEVEL

MLA_DEBUG_REPLACE_LEVEL

Provides a unique name for the Debug replace MLA_DEBUG_LEVEL option

Properties

$mla_option_templates

$mla_option_templates : array

Option Setting templates

Type

array

$add_attachment_id

$add_attachment_id : integer

Attachment ID passed from mla_add_attachment_action to mla_update_attachment_metadata_filter

Ensures that IPTC/EXIF and Custom Field mapping is only performed when the attachment is first added to the Media Library.

Type

integer

Methods

initialize()

initialize() : void

Initialization function, similar to __construct()

mla_get_option()

mla_get_option(  $option,   $get_default = false,   $get_stored = false,   $option_table = NULL) : mixed

Return the stored value or default value of a defined MLA option

Compatibility shim for MLACore::mla_get_option

Parameters

$option
$get_default
$get_stored
$option_table

Returns

mixed —

Value(s) for the option or false if the option is not a defined MLA option

mla_update_option()

mla_update_option(  $option,   $newvalue,   $option_table = NULL) : boolean

Add or update the stored value of a defined MLA option

Compatibility shim for MLACore::mla_update_option

Parameters

$option
$newvalue
$option_table

Returns

boolean —

True if the value was changed or false if the update failed

mla_delete_option()

mla_delete_option(  $option,   $option_table = NULL) : boolean

Delete the stored value of a defined MLA option

Compatibility shim for MLACore::mla_delete_option

Parameters

$option
$option_table

Returns

boolean —

True if the option was deleted, otherwise false

mla_taxonomy_support()

mla_taxonomy_support(  $tax_name,   $support_type = 'support') : boolean|string

Determine MLA support for a taxonomy, handling the special case where the settings are being updated or reset.

Compatibility shim for MLACore::mla_taxonomy_support

Parameters

$tax_name
$support_type

Returns

boolean|string —

true if the taxonomy is supported in this way else false. string if $tax_name is '' and $support_type is 'filter', returns the taxonomy to filter by.

mla_supported_taxonomies()

mla_supported_taxonomies(  $support_type = 'support') : array

Returns an array of taxonomy names assigned to $support_type

Compatibility shim for MLACore::mla_taxonomy_support

Parameters

$support_type

Returns

array —

taxonomies assigned to $support_type; can be empty.

mla_attachment_display_settings_option_handler()

mla_attachment_display_settings_option_handler(  $action,   $key,   $value,   $args = NULL) : string

Render and manage Attachment Display Settings options; alignment, link type and size

Parameters

$action
$key
$value
$args

Returns

string —

HTML table row markup for 'render' else message(s) reflecting the results of the operation.

mla_taxonomy_option_handler()

mla_taxonomy_option_handler(  $action,   $key,   $value,   $args = NULL) : string

Render and manage taxonomy support options, e.g., Categories and Post Tags

Parameters

$action
$key
$value
$args

Returns

string —

HTML table row markup for 'render' else message(s) reflecting the results of the operation.

mla_search_option_handler()

mla_search_option_handler(  $action,   $key,   $value,   $args = NULL) : string

Render and manage Search box options, e.g., connector and search fields

Parameters

$action
$key
$value
$args

Returns

string —

HTML table row markup for 'render' else message(s) reflecting the results of the operation.

mla_wp_handle_upload_prefilter_filter()

mla_wp_handle_upload_prefilter_filter(  $file) : array

Examine or alter the filename before the file is made permanent

Parameters

$file

Returns

array —

updated file parameters

mla_wp_handle_upload_filter()

mla_wp_handle_upload_filter(  $file) : array

Called once for each file uploaded

Parameters

$file

Returns

array —

updated file parameters

mla_add_attachment_action()

mla_add_attachment_action(  $post_ID) : void

Set $add_attachment_id to just-inserted attachment

All of the actual processing is done later, in mla_update_attachment_metadata_filter.

Parameters

$post_ID

mla_update_attachment_metadata_filter()

mla_update_attachment_metadata_filter(  $data,   $post_id) : array

Perform IPTC/EXIF and Custom Field mapping on just-inserted attachment

This filter tests the $add_attachment_id variable set by the mla_add_attachment_action to ensure that mapping is only performed for new additions, not metadata updates.

Parameters

$data
$post_id

Returns

array —

Updated attachment metadata

mla_get_data_source()

mla_get_data_source(  $post_id,   $category,   $data_value,   $attachment_metadata = NULL) : string|array

Get IPTC/EXIF or custom field mapping data source; WP_ADMIN mode

Compatibility shim for MLAData_Source::mla_get_data_source.

Parameters

$post_id
$category
$data_value
$attachment_metadata

Returns

string|array —

data source value

mla_is_data_source()

mla_is_data_source(  $candidate_name) : boolean

Identify custom field mapping data source; WP_ADMIN mode

Compatibility shim for MLAData_Source::mla_is_data_source.

Parameters

$candidate_name

Returns

boolean —

true if candidate name matches a data source

mla_evaluate_custom_field_mapping()

mla_evaluate_custom_field_mapping(  $post_id,   $category,   $settings = NULL,   $attachment_metadata = NULL) : array

Evaluate custom field mapping updates for a post

Parameters

$post_id
$category
$settings
$attachment_metadata

Returns

array —

Updates suitable for MLAData::mla_update_single_item, if any

mla_custom_field_option_handler()

mla_custom_field_option_handler(  $action,   $key,   $value,   $args = NULL) : string

Render and manage custom field mapping options

Parameters

$action
$key
$value
$args

Returns

string —

HTML table row markup for 'render' else message(s) reflecting the results of the operation.

mla_evaluate_iptc_exif_mapping()

mla_evaluate_iptc_exif_mapping(  $post,   $category,   $settings = NULL,   $attachment_metadata = NULL,   $is_upload = false) : array

Evaluate IPTC/EXIF mapping updates for a post

Parameters

$post
$category
$settings
$attachment_metadata
$is_upload

Returns

array —

Updates suitable for MLAData::mla_update_single_item, if any

mla_iptc_exif_option_handler()

mla_iptc_exif_option_handler(  $action,   $key,   $value,   $args = NULL) : string

Render and manage iptc/exif support options

Parameters

$action
$key
$value
$args

Returns

string —

HTML table row markup for 'render' else message(s) reflecting the results of the operation.

_load_option_templates()

_load_option_templates() : void

Load option settings templates to $mla_option_templates

_update_attachment_metadata()

_update_attachment_metadata(  $updates,   $data) : array

Update _wp_attachment_metadata for just-inserted attachment

Parameters

$updates
$data

Returns

array —

Attachment metadata updates, with "meta:" elements removed

_compose_custom_field_option_list()

_compose_custom_field_option_list(  $selection = 'none',   $blacklist = array()) : string

Compose a Custom Field Options list with current selection

Parameters

$selection
$blacklist

Returns

string —

HTML markup with select field options

_compose_data_source_option_list()

_compose_data_source_option_list(  $selection = 'none') : string

Compose a (Custom Field) Data Source Options list with current selection

Parameters

$selection

Returns

string —

HTML markup with select field options

_update_custom_field_mapping()

_update_custom_field_mapping(  $current_values,   $new_values) : array

Update custom field mappings

Parameters

$current_values
$new_values

Returns

array —

( 'message' => HTML message(s) reflecting results, 'values' => updated custom_field_mapping values, 'changed' => true if any changes detected else false )

_get_term_id()

_get_term_id(  $term_name,   $term_parent,   $taxonomy,   $post_terms) : integer

Build and search a cache of taxonomy and term name to term ID mappings

Parameters

$term_name
$term_parent
$taxonomy
$post_terms

Returns

integer —

term_id for the term name

_compose_iptc_option_list()

_compose_iptc_option_list(  $selection = 'none') : string

Compose an IPTC Options list with current selection

Parameters

$selection

Returns

string —

HTML markup with select field options

_compose_parent_option_list()

_compose_parent_option_list(  $taxonomy,   $selection) : string

Compose an hierarchical taxonomy Parent options list with current selection

Parameters

$taxonomy
$selection

Returns

string —

HTML markup with select field options

_update_iptc_exif_standard_mapping()

_update_iptc_exif_standard_mapping(  $current_values,   $new_values) : array

Update Standard field portion of IPTC/EXIF mappings

Parameters

$current_values
$new_values

Returns

array —

( 'message' => HTML message(s) reflecting results, 'values' => updated iptc_exif_mapping values, 'changed' => true if any changes detected else false )

_update_iptc_exif_taxonomy_mapping()

_update_iptc_exif_taxonomy_mapping(  $current_values,   $new_values) : array

Update Taxonomy term portion of IPTC/EXIF mappings

Parameters

$current_values
$new_values

Returns

array —

( 'message' => HTML message(s) reflecting results, 'values' => updated iptc_exif_mapping values, 'changed' => true if any changes detected else false )

_update_iptc_exif_custom_mapping()

_update_iptc_exif_custom_mapping(  $current_values,   $new_values) : array

Update Custom field portion of IPTC/EXIF mappings

Parameters

$current_values
$new_values

Returns

array —

( 'message' => HTML message(s) reflecting results, 'values' => updated iptc_exif_mapping values, 'changed' => true if any changes detected else false )

_get_custom_field_names()

_get_custom_field_names() : array

Generate a list of all (post) Custom Field names

The list will include any Custom Field and IPTC/EXIF rules that haven't been mapped to any attachments, yet.

Returns

array —

Custom field names from the postmeta table and MLA rules