Class MLA (Media Library Assistant) Core is the minimum support required for all other MLA features

package Media Library Assistant
since 2.20

 Methods

Define the Media/Assistant submenu screen to the Admin Columns plugin

admin_columns_support(array $storage_models, object $cpac) 

since 2.22

Parameters

$storage_models

array

List of storage model class instances ( [key] => [CPAC_Storage_Model object] )

$cpac

object

CPAC, the root CodePress Admin Columns object

Initialization function, similar to __construct()

initialize() : void

since 1.00

Display taxonomy "checklist" form fields

mla_checklist_meta_box(object $target_post, array $box) : void

Adapted from /wp-admin/includes/ajax-actions.php function _wp_ajax_add_hierarchical_term(). Includes the "? Search" area to filter the term checklist by entering part or all of a word/phrase in the term label. Output to the Media/Edit Media screen and to the Media Manager Modal Window.

since 1.71

Parameters

$target_post

object

The current post

$box

array

The meta box parameters

Evaluate support information for custom field mapping

mla_custom_field_support(string $support_type) : array

since 1.10

Parameters

$support_type

string

array format; 'default_columns' (default), 'default_hidden_columns', 'default_sortable_columns', 'quick_edit' or 'bulk_edit'

Returns

arraydefault, hidden, sortable quick_edit or bulk_edit colums in appropriate format

Add a debug message to the collection

mla_debug_add(string $message, integer $debug_level) 

since 2.12

Parameters

$message

string

Message text

$debug_level

integer

Optional. Debug category.

Get debug information without clearing the buffer

mla_debug_content(string $format, string $glue) : boolean

since 2.12

Parameters

$format

string

Return data type: 'string' (default) or 'array'

$glue

string

Join array elements with '\n' or '

<

p>' (default)

Returns

booleantrue if success else false

Get/Set debug information collection output file for mode = 'log'

mla_debug_file(string $file) : string

Note that WP_CONTENT_DIR will be pre-pended to the value, and a slash will be added to the front of the value if necessary.

since 2.14

Parameters

$file

string

Optional. The (optional path and) file name, relative to WP_CONTENT_DIR, or false/empty string to clear the value.

Returns

stringThe previous file value, i.e., before the update, relative to WP_CONTENT_DIR

Flush debug information and clear buffer

mla_debug_flush(string $destination, boolean $stop_collecting) : string

since 2.12

Parameters

$destination

string

Destination: 'buffer' (default), 'console', 'log' or 'none'

$stop_collecting

boolean

true (default) to stop, false to continue collection

Returns

stringdebug content if $destination == 'buffer' else empty string

Get/Set debug information collection mode

mla_debug_mode(string $mode) : string

since 2.12

Parameters

$mode

string

Optional. New collection mode: 'none' (default), 'buffer', 'console' or 'log'

Returns

stringThe previous mode value, i.e., before the update

Delete the stored value of a defined MLA option

mla_delete_option(string $option, array $option_table) : boolean

since 2.20

Parameters

$option

string

Name of the desired option

$option_table

array

Custom option definitions

Returns

booleanTrue if the option was deleted, otherwise false

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

mla_get_option(string $option, boolean $get_default, boolean $get_stored, array $option_table) : mixed

since 2.20

Parameters

$option

string

Name of the desired option

$get_default

boolean

True to ignore current setting and return default values

$get_stored

boolean

True to ignore default values and return only stored values

$option_table

array

Custom option definitions

Returns

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

Initialize "tax_checked_on_top" => "checked" default for all supported taxonomies

mla_initialize_tax_checked_on_top() : void

Called after all taxonomies are registered, e.g., in MLAObjects::_build_taxonomies.

since 2.02

Load an HTML template from a file

mla_load_template(string $source, string $type) : string | array | false | NULL

Loads a template to a string or a multi-part template to an array. Multi-part templates are divided by comments of the form , where "key" becomes the key part of the array.

since 0.1

Parameters

$source

string

Complete path and/or name of the template file, option name or the raw template

$type

string

Optional type of template source; 'path', 'file' (default), 'option', 'string'

Returns

stringarrayfalseNULLstring for files that do not contain template divider comments, array for files containing template divider comments, false if file or option does not exist, NULL if file could not be loaded.

Ensures that MLA media manager enhancements are present when required.

mla_media_view_settings_filter(array $settings, object $post) 

Declared public because it is a filter.

since 2.30

Parameters

$settings

array

associative array with setting => value pairs

$post

object

|| NULL current post object, if available

Analyze a Library View/Post MIME Type specification, returning an array of the placeholders it contains

mla_parse_view_specification(string | array $specification) : array

since 1.40

Parameters

$specification

stringarray

A specification, e.g., "custom:Field,null" or "audio,application/vnd.ms"

Returns

array( ['prefix'] => string, ['name'] => string, ['value'] => string, ['option'] => string, optional ['error'] => string )

Load a plugin text domain and alternate debug file

mla_plugins_loaded_action() : void

The "add_action" for this function is in mla-plugin-loader.php, because the "initialize" function above doesn't run in time. Defined as public because it's an action.

since 1.60

Convert a Library View/Post MIME Type specification to WP_Query parameters

mla_prepare_view_query(string $slug, string $specification) : array

since 1.40

Parameters

$slug

string

View slug, unique identifier

$specification

string

A specification, e.g., "custom:Field,null" or "audio,application/vnd.ms"

Returns

arraypost_mime_type specification or custom field query

Returns an array of taxonomy names assigned to $support_type

mla_supported_taxonomies(string $support_type) : array

since 2.20

Parameters

$support_type

string

Optional. 'support' (default), 'quick-edit', 'flat-checklist', 'term-search' or 'filter'

Returns

arraytaxonomies assigned to $support_type; can be empty.

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

mla_taxonomy_support(string $tax_name, string $support_type) : boolean | string

since 2.20

Parameters

$tax_name

string

Taxonomy name, e.g., attachment_category

$support_type

string

Optional. 'support' (default), 'quick-edit' or 'filter'

Returns

booleanstringtrue 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.

Add or update the stored value of a defined MLA option

mla_update_option(string $option, mixed $newvalue, array $option_table) : boolean

since 2.20

Parameters

$option

string

Name of the desired option

$newvalue

mixed

New value for the desired option

$option_table

array

Custom option definitions

Returns

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

Registers and enqueues the mla-beaver-builder-style.css file, when needed.

mla_wp_enqueue_media_action() 

Declared public because it is an action.

since 2.30

Filter the redirect location.

mla_wp_redirect_filter(string $location, int $status) 

since 2.25

Parameters

$location

string

The path to redirect to.

$status

int

Status code to use.

Write a debug message to the appropriate log file

_debug_log(string $message) 

since 2.14

Parameters

$message

string

Message text

 Properties

 

Admin Columns support storage model object for the Media/Assistant submenu

$admin_columns_storage_model : object

since 2.22
 

Effective MLA Debug Level, from MLA_DEBUG_LEVEL or override option

$mla_debug_level : integer

since 2.15
 

Original PHP error_log path and file

$original_php_log : string

since 2.20
 

Original PHP error_reporting value

$original_php_reporting : string

since 2.20
     

Option setting for "Inserted in" reporting

$process_inserted_in : boolean

This setting is false if the "Inserted in" database access setting is "disabled", else true.

since 1.00
   

Debug information output file for mode = 'log'

$mla_debug_file : string

since 2.14
 

Accumulates debug messages

$mla_debug_messages : string

since 2.12
 

Debug information collection mode

$mla_debug_mode : string

Collection mode: 'buffer', 'console', 'log' or 'none' (default).

since 2.12

 Constants

 

Slug for adding plugin submenu

ADMIN_PAGE_SLUG : string

since 0.1
 

Current version number (moved from class-mla-main.php)

CURRENT_MLA_VERSION : string

since 2.30
 

Slug for the "fill compat-attachment-fields" action - Add Media and related dialogs

JAVASCRIPT_FILL_COMPAT_ACTION : string

since 1.80
 

Slug for localizing and enqueueing JavaScript - MLA List Table

JAVASCRIPT_INLINE_EDIT_SLUG : string

since 0.20
 

Slug for the "query attachments" action - Add Media and related dialogs

JAVASCRIPT_QUERY_ATTACHMENTS_ACTION : string

since 1.80
 

Slug for the "update compat-attachment-fields" action - Add Media and related dialogs

JAVASCRIPT_UPDATE_COMPAT_ACTION : string

since 1.80
 

Action name; gives a context for the nonce

MLA_ADMIN_NONCE_ACTION : string

since 0.1
 

Nonce name; uniquely identifies the nonce

MLA_ADMIN_NONCE_NAME : string

since 2.13
 

mla_admin_action value for permanently deleting a single item

MLA_ADMIN_SINGLE_DELETE : string

since 0.1
 

mla_admin_action value for restoring a single item from the trash

MLA_ADMIN_SINGLE_RESTORE : string

since 0.1
 

mla_admin_action value for moving a single item to the trash

MLA_ADMIN_SINGLE_TRASH : string

since 0.1
 

Constant to log Ajax debug activity

MLA_DEBUG_CATEGORY_AJAX : integer

since 2.13
 

Constant to log "any" debug activity

MLA_DEBUG_CATEGORY_ANY : integer

since 2.25
 

Constant to log WPML/Polylang action/filter activity

MLA_DEBUG_CATEGORY_LANGUAGE : integer

since 2.15
 

Constant to log Ghostscript/Imagick activity

MLA_DEBUG_CATEGORY_THUMBNAIL : integer

since 2.23
 

Slug for registering and enqueueing plugin style sheets (moved from class-mla-main.php)

STYLESHEET_SLUG : string

since 2.30