Class MLA (Media Library Assistant) provides several enhancements to the handling of images and files held in the WordPress Media Library.

package Media Library Assistant
since 0.1

 Methods

Initialization function, similar to __construct()

initialize() : void

This function contains add_action and add_filter calls to set up the Ajax handlers, enqueue JavaScript and CSS files, and set up the Assistant submenu.

since 0.1

Add contextual help tabs to all the MLA pages

mla_add_help_tab() : void

since 0.1

Add the "XX Entries per page" filter to the Screen Options tab

mla_add_menu_options() : void

since 0.1

Load the plugin's Style Sheet and Javascript files

mla_admin_enqueue_scripts_action(string $page_hook) : void

since 0.1

Parameters

$page_hook

string

Name of the page being loaded

Load the plugin's Ajax handler or process Edit Media update actions

mla_admin_init_action() : void

since 0.20

Add the submenu pages

mla_admin_menu_action() : void

Add a submenu page in the "Media" section, add settings page in the "Settings" section. add settings link in the Plugins section entry for MLA.

For WordPress versions before 3.5, add submenu page(s) for attachment taxonomies, add filter to clean up taxonomy submenu labels.

since 0.1

Redirect to the Edit Tags/Categories page

mla_edit_tax_redirect() : void

The custom taxonomy add/edit submenu entries go to "upload.php" by default. This filter is the only way to redirect them to the correct WordPress page. The filter is not required for WordPress 3.5 and later.

since 0.1

Ajax handler for inline editing (quick and bulk edit)

mla_inline_edit_ajax_action() : void

Adapted from wp_ajax_inline_save in /wp-admin/includes/ajax-actions.php

since 0.20

Redirect to Media/Assistant if Media/Library is hidden

mla_load_media_action() : void

since 1.60

Cleanup menus for Edit Tags/Categories page

mla_parent_file_filter(array $parent_file) : string

For WordPress before 3.5, the submenu entries for custom taxonomies under the "Media" menu are not set up correctly by WordPress, so this function cleans them up, redirecting the request to the right WordPress page for editing/adding taxonomy terms. For WordPress 3.5 and later, the function fixes the submenu bolding when going to the Edit Media screen.

since 0.1

Parameters

$parent_file

array

The top-level menu page

Returns

stringThe updated top-level menu page

Load a plugin text domain

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

Render the "Assistant" subpage in the Media section, using the list_table package

mla_render_admin_page() : void

since 0.1

Only show screen options on the table-list screen

mla_screen_options_show_screen_filter(boolean $show_screen, string $this_screen) : boolean

since 0.1

Parameters

$show_screen

boolean

True to display "Screen Options", false to suppress them

$this_screen

string

Name of the page being loaded

Returns

booleanTrue to display "Screen Options", false to suppress them

Ajax handler to set post_parent for a single attachment

mla_set_parent_ajax_action() : void

Adapted from wp_ajax_inline_save in /wp-admin/includes/ajax-actions.php

since 0.20

Save the "Entries per page" option set by this user

mla_set_screen_option_filter(mixed $status, string $option, string $value) : string | void

since 0.1

Parameters

$status

mixed

false or value returned by previous filter

$option

string

Name of the option being changed

$value

string

New value of the option

Returns

stringvoidNew value if this is our option, otherwise nothing

Get the edit Authors dropdown box, if user has suitable permissions

_authors_dropdown(integer $author, string $name, string $class) : string | false

since 0.20

Parameters

$author

integer

Optional User ID of the current author, default 0

$name

string

Optional HTML name attribute, default 'post_author'

$class

string

Optional HTML class attribute, default 'authors'

Returns

stringfalseHTML markup for the dropdown field or False

Build the hidden row templates for inline editing (quick and bulk edit)

_build_inline_edit_form(object $MLAListTable) : string

inspired by inline_edit() in wp-admin\includes\class-wp-posts-list-table.php.

since 0.20

Parameters

$MLAListTable

object

MLA List Table object

Returns

stringHTML
markup for hidden rows

Get the current action selected from the bulk actions dropdown

_current_bulk_action() : string | false

since 0.1

Returns

stringfalseThe action name or False if no action was selected

Delete a single item permanently

_delete_single_item(array $post_id) : array

since 0.1

Parameters

$post_id

array

The form POST data

Returns

arraysuccess/failure message and NULL content

Display a single item sub page; prepare the form to change the meta data for a single attachment.

_display_single_item(int $post_id) : array

This function is not used in WordPress 3.5 and later.

since 0.1

Parameters

$post_id

int

The WordPress Post ID of the attachment item

Returns

arraymessage and/or HTML content

Process bulk edit area fields, which may contain a Content Template

_process_bulk_value(integer $post_id, string $bulk_value) : string

since 1.80

Parameters

$post_id

integer

Current post ID

$bulk_value

string

Field value as entered

Returns

stringEmpty, or new value for the field

Restore a single item from the Trash

_restore_single_item(array $post_id) : array

since 0.1

Parameters

$post_id

array

The form POST data

Returns

arraysuccess/failure message and NULL content

Move a single item to Trash

_trash_single_item(array $post_id) : array

since 0.1

Parameters

$post_id

array

The form POST data

Returns

arraysuccess/failure message and NULL content

 Properties

 

Holds screen ids to match help text to corresponding screen

$page_hooks : array

since 0.1

 Constants

 

Slug for adding plugin submenu

ADMIN_PAGE_SLUG : string

since 0.1
 

Current version number

CURRENT_MLA_VERSION : string

since 0.1
 

Object name for localizing JavaScript - MLA List Table

JAVASCRIPT_INLINE_EDIT_OBJECT : string

since 0.20
 

Slug for localizing and enqueueing JavaScript - MLA List Table

JAVASCRIPT_INLINE_EDIT_SLUG : string

since 0.20
 

Object name for localizing JavaScript - edit single item page

JAVASCRIPT_SINGLE_EDIT_OBJECT : string

since 0.1
 

Slug for localizing and enqueueing JavaScript - edit single item page

JAVASCRIPT_SINGLE_EDIT_SLUG : string

since 0.1
 

Action name; uniquely identifies the nonce

MLA_ADMIN_NONCE : string

since 0.1
 

mla_admin_action value for setting an item's parent object

MLA_ADMIN_SET_PARENT : string

since 1.82
 

mla_admin_action value for mapping Custom Field metadata

MLA_ADMIN_SINGLE_CUSTOM_FIELD_MAP : string

since 1.10
 

mla_admin_action value for permanently deleting a single item

MLA_ADMIN_SINGLE_DELETE : string

since 0.1
 

mla_admin_action value for displaying a single item

MLA_ADMIN_SINGLE_EDIT_DISPLAY : string

since 0.1
 

mla_admin_action value for updating a single item

MLA_ADMIN_SINGLE_EDIT_UPDATE : string

since 0.1
 

mla_admin_action value for mapping IPTC/EXIF metadata

MLA_ADMIN_SINGLE_MAP : string

since 1.00
 

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
 

Slug for registering and enqueueing plugin style sheet

STYLESHEET_SLUG : string

since 0.1