Class MLA (Media Library Assistant) Settings provides the settings page to edit the plugin option settings

package Media Library Assistant
since 0.1

 Methods

Initialization function, similar to __construct()

initialize() : void

since 0.1

Perform one-time actions on plugin activation

mla_activation_hook() : void

Adds a view to the database to support sorting the listing on 'ALT Text'.

since 0.40

Add contextual help tabs to all the MLA pages

mla_add_help_tab_action() : void

since 1.40

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

mla_add_menu_options_action() : void

since 1.40

Load the plugin's Style Sheet and Javascript files

mla_admin_enqueue_scripts_action(string $page_hook) : void

since 1.40

Parameters

$page_hook

string

Name of the page being loaded

Load the plugin's Ajax handler

mla_admin_init_action() : void

since 1.40

Add settings page in the "Settings" section, add screen options and help tabs, add settings link in the Plugins section entry for MLA.

mla_admin_menu_action() : void

since 0.1

Compose the table row for a single MLA option

mla_compose_option_row(string $key, array $value, array $option_table) : string

since 0.80
uses \global\$page_template_array

Parameters

$key

string

HTML id/name attribute and option database key (OMIT MLA_OPTION_PREFIX)

$value

array

Option parameters, e.g., 'type', 'std'

$option_table

array

Custom option definitions

Returns

stringHTML markup for the option's table row

Perform one-time actions on plugin deactivation

mla_deactivation_hook() : void

Removes (if present) a view from the database that supports sorting the listing on 'ALT Text'.

since 0.40

Get an HTML select element representing a list of icon types

mla_get_icon_type_dropdown(array $templates, string $name, string $selection) : string

since 1.40

Parameters

$templates

array

Display template array

$name

string

HTML name attribute value

$selection

string

currently selected Icon Type

Returns

stringHTML select element or empty string on failure.

Ajax handler for Upload MIME Types inline editing (quick and bulk edit)

mla_inline_edit_upload_action() : void

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

since 1.40

Ajax handler for Post MIME Types inline editing (quick and bulk edit)

mla_inline_edit_view_action() : void

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

since 1.40

Ajax handler for Custom Fields tab inline mapping

mla_inline_mapping_custom_action() : void

since 2.00

Ajax handler for IPTC/EXIF tab inline mapping

mla_inline_mapping_iptc_exif_action() : void

since 2.00

Localize $mla_tablist array

mla_localize_tablist() : void

Localization must be done at runtime, and these calls cannot be placed in the "public static" array definition itself.

since 1.70

Render (echo) the "Media Library Assistant" subpage in the Settings section

mla_render_settings_page() : void

since 0.1

Only show screen options on the View and Upload tabs

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

since 1.40

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

Save the "Views/Uploads per page" option set by this user

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

since 1.40

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

Update or delete a single MLA option value

mla_update_option_row(string $key, array $value, array $option_table) : string

since 0.80
uses \global\$_REQUEST

Parameters

$key

string

HTML id/name attribute and option database key (OMIT MLA_OPTION_PREFIX)

$value

array

Option parameters, e.g., 'type', 'std'

$option_table

array

Custom option definitions

Returns

stringHTML markup for the option's table row

Compose the Custom Field tab content for the Settings subpage

_compose_custom_field_tab() : array

since 1.10
uses \global\$page_template_array

Returns

array'message' => status/error messages, 'body' => tab content

Compose the Debug tab content for the Settings subpage

_compose_debug_tab() : array

since 2.10
uses \global\$page_template_array

Returns

array'message' => status/error messages, 'body' => tab content

Compose the Documentation tab content for the Settings subpage

_compose_documentation_tab() : array

since 0.80
uses \global\$page_template_array

Returns

array'message' => status/error messages, 'body' => tab content

Compose the Edit Upload type tab content for the Settings subpage

_compose_edit_upload_tab(array $item, string $templates) : array

since 1.40

Parameters

$item

array

data values for the item

$templates

string

Display template array

Returns

array'message' => status/error messages, 'body' => tab content

Compose the Edit View tab content for the Settings subpage

_compose_edit_view_tab(array $view, string $template) : array

since 1.40

Parameters

$view

array

data values for the item

$template

string

Display template

Returns

array'message' => status/error messages, 'body' => tab content

Compose the General tab content for the Settings subpage

_compose_general_tab() : array

since 0.80
uses \global\$page_template_array

Returns

array'message' => status/error messages, 'body' => tab content

Compose HTML markup for the import settings if any settings files exist

_compose_import_settings() : string

since 1.50

Returns

stringHTML markup for the Import All Settings button and dropdown list, if any

Compose the IPTC/EXIF tab content for the Settings subpage

_compose_iptc_exif_tab() : array

since 1.00
uses \global\$page_template_array

Returns

array'message' => status/error messages, 'body' => tab content

Compose the Optional File Upload MIME Types tab content for the Settings subpage

_compose_optional_upload_tab(string $page_template_array) : array

since 1.40

Parameters

$page_template_array

string

Display templates

Returns

array'message' => status/error messages, 'body' => tab content

Compose the Debug tab Debug Settings content for one setting

_compose_settings_row(string $label, string $value) : string

since 2.14

Parameters

$label

string

Display name for the setting

$value

string

Current value for the setting

Returns

stringHTML table row markup for the label setting pair

Compose the navigation tabs for the Settings subpage

_compose_settings_tabs(string $active_tab) : string

since 0.80
uses \global\$page_template_array

Parameters

$active_tab

string

Optional data-tab-id value for the active tab, default 'general'

Returns

stringHTML markup for the Settings subpage navigation tabs

Compose the File Upload MIME Types tab content for the Settings subpage

_compose_upload_tab() : array

since 1.40

Returns

array'message' => status/error messages, 'body' => tab content

Compose the Post MIME Type Views tab content for the Settings subpage

_compose_view_tab() : array

since 1.40

Returns

array'message' => status/error messages, 'body' => tab content

Get the current action selected from the bulk actions dropdown

_current_bulk_action() : string | false

since 1.40

Returns

stringfalseThe action name or False if no action was selected

Delete a custom field from the wp_postmeta table

_delete_custom_field(array $value) : array

since 1.10

Parameters

$value

array

specific custom_field_mapping rule

Returns

arrayMessage(s) reflecting the results of the operation

Serialize option settings and write them to a file

_export_settings() : array

Options with a default value, i.e., not stored in the database are NOT written to the file.

since 1.50

Returns

arrayMessage(s) reflecting the results of the operation

Read a serialized file of option settings and write them to the database

_import_settings() : array

since 1.50

Returns

arrayMessage(s) reflecting the results of the operation

Process custom field settings against all image attachments without saving the settings to the mla_option

_process_custom_field_mapping(array $settings, integer $offset, integer $length) : array

since 1.10
uses \global\$_REQUEST

Parameters

$settings

array

| NULL specific custom_field_mapping values

$offset

integer

offset for chunk mapping

$length

integer

length for chunk mapping

Returns

arrayMessage(s) reflecting the results of the operation

Process IPTC/EXIF custom field settings against all image attachments without saving the settings to the mla_option

_process_iptc_exif_custom(array $settings, integer $offset, integer $length) : array

since 1.00
uses \global\$_REQUEST

Parameters

$settings

array

| NULL specific iptc_exif_custom_mapping values

$offset

integer

offset for chunk mapping

$length

integer

length for chunk mapping

Returns

arrayMessage(s) reflecting the results of the operation

Process IPTC/EXIF standard field settings against all image attachments without saving the settings to the mla_option

_process_iptc_exif_standard(integer $offset, integer $length) : array

since 1.00
uses \global\$_REQUEST

Parameters

$offset

integer

offset for chunk mapping

$length

integer

length for chunk mapping

Returns

arrayMessage(s) reflecting the results of the operation

Process IPTC/EXIF taxonomy term settings against all image attachments without saving the settings to the mla_option

_process_iptc_exif_taxonomy(integer $offset, integer $length) : array

since 1.00
uses \global\$_REQUEST

Parameters

$offset

integer

offset for chunk mapping

$length

integer

length for chunk mapping

Returns

arrayMessage(s) reflecting the results of the operation

Process an Optional Upload MIME Type selection

_process_optional_upload_mime(\intger $ID) : array

since 1.40

Parameters

$ID

\intger

MLA Optional Upload MIME Type ID

Returns

array'message' => status/error messages, 'body' => tab content

Delete saved settings, restoring default values

_reset_general_settings() : array

since 0.1

Returns

arrayMessage(s) reflecting the results of the operation

Save custom field settings to the options table

_save_custom_field_settings(array $new_values) : array

since 1.10
uses \global\$_REQUEST

Parameters

$new_values

array

| NULL specific custom_field_mapping values

Returns

arrayMessage(s) reflecting the results of the operation

Save Debug settings to the options table

_save_debug_settings() : array

since 2.10
uses \global\$_REQUEST

Returns

arrayMessage(s) reflecting the results of the operation

Save General settings to the options table

_save_general_settings() : array

since 0.1
uses \global\$_REQUEST

Returns

arrayMessage(s) reflecting the results of the operation

Save IPTC/EXIF custom field settings to the options table

_save_iptc_exif_custom_settings(array $new_values) : array

since 1.30

Parameters

$new_values

array

specific iptc_exif_custom_mapping values

Returns

arrayMessage(s) reflecting the results of the operation

Save IPTC/EXIF settings to the options table

_save_iptc_exif_settings() : array

since 1.00
uses \global\$_REQUEST

Returns

arrayMessage(s) reflecting the results of the operation

Save Upload settings to the options table

_save_upload_settings() : array

since 1.40
uses \global\$_REQUEST

Returns

arrayMessage(s) reflecting the results of the operation

Save View settings to the options table

_save_view_settings() : array

since 1.40
uses \global\$_REQUEST

Returns

arrayMessage(s) reflecting the results of the operation

Database and option update check, for installing new versions

_version_upgrade() : void

since 0.30

Retrieve the list of options tabs or a specific tab value

mla_get_options_tablist(string $tab) : array | false

since 1.82

Parameters

$tab

string

Tab slug, to retrieve a single entry

Returns

arrayfalseThe entire tablist ( $tab = NULL ), a single tab entry or false if not found/not allowed

 Properties

 

Template file for the Settings page(s) and parts

$page_template_array : array

This array contains all of the template parts for the Settings page(s). The array is built once each page load and cached for subsequent use.

since 0.80
 

Holds screen id to match help text to corresponding screen

$current_page_hook : array

since 1.40
 

Definitions for Settings page tab ids, titles and handlers Each tab is defined by an array with the following elements:

$mla_tablist : array

array key => HTML id/name attribute and option database key (OMIT MLA_OPTION_PREFIX)

title => tab label / heading text render => rendering function for tab messages and content. Usage: $tab_content = 'render';

The array must be populated at runtime in MLASettings::mla_localize_tablist(), because Localization calls cannot be placed in the "public static" array definition itself.

since 0.80

 Constants

 

Object name for localizing JavaScript - MLA Upload List Table

JAVASCRIPT_INLINE_EDIT_UPLOAD_OBJECT : string

since 1.40
 

Slug for localizing and enqueueing JavaScript - MLA Upload List Table

JAVASCRIPT_INLINE_EDIT_UPLOAD_SLUG : string

since 1.40
 

Object name for localizing JavaScript - MLA View List Table

JAVASCRIPT_INLINE_EDIT_VIEW_OBJECT : string

since 1.40
 

Slug for localizing and enqueueing JavaScript - MLA View List Table

JAVASCRIPT_INLINE_EDIT_VIEW_SLUG : string

since 1.40
 

Slug for localizing and enqueueing JavaScript - MLA Custom tab

JAVASCRIPT_INLINE_MAPPING_CUSTOM_SLUG : string

since 2.00
 

Slug for localizing and enqueueing JavaScript - MLA IPTC/EXIF tab

JAVASCRIPT_INLINE_MAPPING_IPTC_EXIF_SLUG : string

since 2.00
 

Object name for localizing JavaScript - MLA Custom and IPTC/EXIF tabs

JAVASCRIPT_INLINE_MAPPING_OBJECT : string

since 2.00
 

Provides a unique name for the settings page

MLA_SETTINGS_SLUG : string

since 0.1