Constants

MLA_ALT_TEXT_SUBQUERY

MLA_ALT_TEXT_SUBQUERY

Provides a unique value for the ALT Text "Search Media" subquery

The subquery is used to filter the Media/Assistant submenu table by ALT Text with the Search Media text box.

MLA_ORDERBY_SUBQUERY

MLA_ORDERBY_SUBQUERY

Provides a unique suffix for the custom field "orderby" subquery

The subquery is used to sort the Media/Assistant submenu table on ALT Text and custom field columns.

MLA_TABLE_VIEW_SUBQUERY

MLA_TABLE_VIEW_SUBQUERY

Provides a unique suffix for the "Table View custom:" SQL View

The SQL View is used to filter the Media/Assistant submenu table on custom field Table Views.

Properties

$wp_4dot0_plus

$wp_4dot0_plus : boolean

WordPress version test for $wpdb->esc_like() Vs esc_sql()

Type

boolean

$default_columns

$default_columns : array

Table column definitions

This array defines table columns and titles where the key is the column slug (and class) and the value is the column's title text. If you need a checkbox for bulk actions, use the special slug "cb".

The 'cb' column is treated differently than the rest. If including a checkbox column in your table you must create a column_cb() method. If you don't need bulk actions or checkboxes, simply leave the 'cb' entry out of your array.

All of the columns are added to this array by MLA_List_Table::mla_admin_init_action.

Type

array

$default_hidden_columns

$default_hidden_columns : array

Default values for hidden columns

This array is used when the user-level option is not set, i.e., the user has not altered the selection of hidden columns.

The value on the right-hand side must match the column slug, e.g., array(0 => 'ID_parent, 1 => 'title_name').

Taxonomy and custom field columns are added to this array by MLA_List_Table::mla_admin_init_action.

Type

array

$default_sortable_columns

$default_sortable_columns : array

Sortable column definitions

This array defines the table columns that can be sorted. The array key is the column slug that needs to be sortable, and the value is database column to sort by. Often, the key and value will be the same, but this is not always the case (as the value is a column name from the database, not the list table).

The array value also contains a boolean which is 'true' if the initial sort order for the column is DESC/Descending.

Taxonomy and custom field columns are added to this array by MLA_List_Table::mla_admin_init_action.

Type

array

$query_parameters

$query_parameters : array

WP_Query filter "parameters"

This array defines parameters for the query's join, where and orderby filters. The parameters are set up in the _prepare_list_table_query function, and any further logic required to translate those values is contained in the filters.

Array index values are: use_alt_text_view, use_postmeta_view, use_orderby_view, alt_text_value, postmeta_key, postmeta_value, patterns, detached, orderby, order, mla-metavalue, debug (also in search_parameters)

Type

array

$search_parameters

$search_parameters : array

WP_Query 'posts_search' filter "parameters"

This array defines parameters for the query's posts_search filter, which uses 'search_string' to add a clause to the query's WHERE clause. It is shared between the list_table-query functions here and the mla_get_shortcode_attachments function in class-mla-shortcodes.php. This array passes the relevant parameters to the filter.

Array index values are: ['mla_terms_search']['phrases'] ['mla_terms_search']['taxonomies'] ['mla_terms_search']['radio_phrases'] => AND/OR ['mla_terms_search']['radio_terms'] => AND/OR ['s'] => numeric for ID/parent search ['mla_search_fields'] => 'content', 'title', 'excerpt', 'alt-text', 'name', 'terms' Note: 'alt-text' is not supported in [mla_gallery] ['mla_search_connector'] => AND/OR ['sentence'] => entire string must match as one "keyword" ['exact'] => entire string must match entire field value ['debug'] => internal element, console/log/shortcode/none ['tax_terms_count'] => internal element, shared with JOIN and GROUP BY filters

Type

array

$mla_list_table_items

$mla_list_table_items : array

Cache the results of mla_count_list_table_items for reuse in mla_query_list_table_items

Type

array

Methods

initialize()

initialize() 

Initialization function, similar to __construct()

mla_fetch_attachment_references()

mla_fetch_attachment_references(  $ID,   $parent,   $add_references = true) : array

Find Featured Image and inserted image/link references to an attachment

Searches all post and page content to see if the attachment is used as a Featured Image or inserted in the post as an image or link.

Parameters

$ID
$parent
$add_references

Returns

array —

Reference information; see $references array comments

mla_attachment_array_fetch_references()

mla_attachment_array_fetch_references(  $attachments) : void

Add Featured Image and inserted image/link references to an array of attachments

Searches all post and page content to see if the attachmenta are used as a Featured Image or inserted in the post as an image or link.

Parameters

$attachments

mla_flush_mla_galleries()

mla_flush_mla_galleries(  $option_name) : void

Invalidates the $mla_galleries or $galleries array and cached values

Parameters

$option_name

mla_localize_default_columns_array()

mla_localize_default_columns_array() 

Builds the $default_columns array with translated source texts.

Called from MLATest::initialize because the $default_columns information might be accessed from "front end" posts/pages.

mla_get_sortable_columns()

mla_get_sortable_columns() : array

Return the names and display values of the sortable columns

Returns

array —

name => array( orderby value, heading ) for sortable columns

mla_count_list_table_items()

mla_count_list_table_items(  $request,   $offset = NULL,   $count = NULL) : integer

Get the total number of attachment posts

Parameters

$request
$offset
$count

Returns

integer —

Number of attachment posts

mla_query_list_table_items()

mla_query_list_table_items(  $request,   $offset,   $count) : array

Retrieve attachment objects for list table display

Supports prepare_items in class-mla-list-table.php. Modeled after wp_edit_attachments_query in wp-admin/post.php

Parameters

$request
$offset
$count

Returns

array —

attachment objects (posts) including parent data, meta data and references

mla_query_media_modal_items()

mla_query_media_modal_items(  $request,   $offset,   $count) : object

Retrieve attachment objects for the WordPress Media Manager

Supports month-year and taxonomy-term filters as well as the enhanced search box

Parameters

$request
$offset
$count

Returns

object —

WP_Query object with query results

mla_fetch_attachment_parent_data()

mla_fetch_attachment_parent_data(  $parent_id) : array

Returns information about an attachment's parent, if found

Parameters

$parent_id

Returns

array —

Parent information; post_date, post_title and post_type

mla_fetch_attachment_metadata()

mla_fetch_attachment_metadata(  $post_id) : array

Fetch and filter meta data for an attachment

Returns a filtered array of a post's meta data. Internal values beginning with '' are stripped out or converted to an 'mla' equivalent.

Parameters

$post_id

Returns

array —

Meta data variables

mla_custom_field_option_value()

mla_custom_field_option_value(  $slug) : array

Fetch custom field option value given a slug

Parameters

$slug

Returns

array —

option value, e.g., array( 'name' => 'File Size', ... )

mla_search_terms_tidy()

mla_search_terms_tidy(  $term) : string

Replaces a WordPress function deprecated in v3.7

Defined as public because it's a callback from array_map().

Parameters

$term

Returns

string —

cleaned up search term

mla_query_posts_search_filter()

mla_query_posts_search_filter(  $search_string,   $query_object) : string

Adds a keyword search to the WHERE clause, if required

Defined as public because it's a filter.

Parameters

$search_string
$query_object

Returns

string —

query clause after keyword search addition

mla_query_posts_where_filter()

mla_query_posts_where_filter(  $where_clause) : string

Adds/modifies the WHERE clause for meta values, LIKE patterns and detached items

Modeled after _edit_attachments_query_helper in wp-admin/post.php. Defined as public because it's a filter.

Parameters

$where_clause

Returns

string —

query clause after modification

mla_query_posts_join_filter()

mla_query_posts_join_filter(  $join_clause) : string

Adds a JOIN clause, if required, to handle sorting/searching on custom fields or ALT Text

Defined as public because it's a filter.

Parameters

$join_clause

Returns

string —

query clause after "LEFT JOIN view ON post_id" item modification

mla_query_posts_groupby_filter()

mla_query_posts_groupby_filter(  $groupby_clause) : string

Adds a GROUPBY clause, if required

Taxonomy text queries and postmeta queries can return multiple results for the same ID. Defined as public because it's a filter.

Parameters

$groupby_clause

Returns

string —

updated query clause

mla_query_posts_orderby_filter()

mla_query_posts_orderby_filter(  $orderby_clause) : string

Adds a ORDERBY clause, if required

Expands the range of sort options because the logic in WP_Query is limited. Defined as public because it's a filter.

Parameters

$orderby_clause

Returns

string —

updated query clause

mla_query_relevanssi_admin_search_ok_filter()

mla_query_relevanssi_admin_search_ok_filter(  $admin_search_ok) : boolean

Disable Relevanssi - A Better Search, v3.2 by Mikko Saari Defined as public because it's a filter.

Parameters

$admin_search_ok

Returns

boolean —

Updated setting

mla_query_relevanssi_prevent_default_request_filter()

mla_query_relevanssi_prevent_default_request_filter(  $prevent) : boolean

Disable Relevanssi - A Better Search, v3.2 by Mikko Saari Defined as public because it's a filter.

Parameters

$prevent

Returns

boolean —

Updated setting

mla_query_terms_clauses_filter()

mla_query_terms_clauses_filter(array  $pieces, array  $taxonomies, array  $args) 

Filters all clauses for get_terms queries

Defined as public because it's a filter.

Parameters

array $pieces

Terms query SQL clauses.

array $taxonomies

An array of taxonomies.

array $args

An array of terms query arguments.

mla_query_posts_clauses_filter()

mla_query_posts_clauses_filter(  $pieces) : array

Filters all clauses for shortcode queries, pre caching plugins

This is for debug purposes only. Defined as public because it's a filter.

Parameters

$pieces

Returns

array —

query clauses after modification (none)

mla_query_posts_clauses_request_filter()

mla_query_posts_clauses_request_filter(  $pieces) : array

Filters all clauses for shortcode queries, post caching plugins

This is for debug purposes only. Defined as public because it's a filter.

Parameters

$pieces

Returns

array —

query clauses after modification (none)

_prepare_list_table_query()

_prepare_list_table_query(  $raw_request,   $offset,   $count) : array

Sanitize and expand query arguments from request variables

Prepare the arguments for WP_Query. Modeled after wp_edit_attachments_query in wp-admin/post.php

Parameters

$raw_request
$offset
$count

Returns

array —

revised arguments suitable for WP_Query

_execute_list_table_query()

_execute_list_table_query(  $request) : object

Add filters, run query, remove filters

Parameters

$request

Returns

object —

WP_Query object with query results

_wildcard_search_string()

_wildcard_search_string(  $search_string) : boolean

Detects wildcard searches, i.e., containing an asterisk outside quotes

Defined as public because it's a callback from array_map().

Parameters

$search_string

Returns

boolean —

true if wildcard

_match_quoted_phrase()

_match_quoted_phrase(  $needle,   $haystack) : boolean

Isolates keyword match results to word boundaries

Eliminates matches such as "man" in "woman".

Parameters

$needle
$haystack

Returns

boolean —

$needle is a word match within $haystack

_parse_terms_search()

_parse_terms_search(  $whole_string,   $delimiter = ',',   $full_parse = false) : array

Process a terms search term or phrase list with quoted phrases and variable delimiters

Parameters

$whole_string
$delimiter
$full_parse

Returns

array —

individual arguments, e.g. array( 0 => '"a phrase"', 1 => 'separate', 2 => 'phrase' )