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