Class MLA (Media Library Assistant) Shortcodes defines the shortcodes available to MLA users

package Media Library Assistant
since 0.20

 Methods

Initialization function, similar to __construct()

initialize() : void

since 0.20

WordPress Shortcode; renders a complete list of all attachments and references to them

mla_attachment_list_shortcode() : void

since 0.1

Parses shortcode parameters and returns the gallery objects

mla_get_shortcode_attachments(int $post_parent, array $attr) : array

since .50

Parameters

$post_parent

int

Post ID of the parent

$attr

array

Attributes of the shortcode

Returns

arrayList of attachments returned from WP_Query

Filters all clauses for shortcode queries, pre caching plugins

mla_shortcode_query_posts_clauses_filter(array $pieces) : array

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

since 1.30

Parameters

$pieces

array

query clauses before modification

Returns

arrayquery clauses after modification (none)

Filters all clauses for shortcode queries, post caching plugins

mla_shortcode_query_posts_clauses_request_filter(array $pieces) : array

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

since 1.30

Parameters

$pieces

array

query clauses before modification

Returns

arrayquery clauses after modification (none)

Filters the ORDERBY clause for shortcode queries

mla_shortcode_query_posts_orderby_filter(string $orderby_clause) : string

This is an enhanced version of the code found in wp-includes/query.php, function get_posts. Defined as public because it's a filter.

since 1.20

Parameters

$orderby_clause

string

query clause before modification

Returns

stringquery clause after modification

Filters the WHERE clause for shortcode queries

mla_shortcode_query_posts_where_filter(string $where_clause) : string

Captures debug information. Adds whitespace to the post_type = 'attachment' phrase to circumvent subsequent Role Scoper modification of the clause. Handles post_parent "any" and "none" cases. Defined as public because it's a filter.

since 0.70

Parameters

$where_clause

string

query clause before modification

Returns

stringquery clause after modification

Handles brace/bracket escaping and parses template for a shortcode parameter

_process_shortcode_parameter(string $text, string $markup_values) : string

since 1.14

Parameters

$text

string

raw shortcode parameter, e.g., "text {+field+} {brackets} \{braces\}"

$markup_values

string

template substitution values, e.g., ('instance' => '1', ... )

Returns

stringquery specification with HTML escape sequences and line breaks removed

Cleans up damage caused by the Visual Editor to the tax_query and meta_query specifications

_sanitize_query_specification(string $specification) : string

since 1.14

Parameters

$specification

string

query specification; PHP nested arrays

Returns

stringquery specification with HTML escape sequences and line breaks removed

Translates query parameters to a valid SQL order by clause.

_validate_sql_orderby(array $query_parameters) : string | bool

Accepts one or more valid columns, with or without ASC/DESC. Enhanced version of /wp-includes/formatting.php function sanitize_sql_orderby().

since 1.20

Parameters

$query_parameters

array

Validated query parameters

Returns

stringboolReturns the orderby clause if present, false otherwise.

 Properties

 

Accumulates debug messages

$mla_debug_messages : string

since 0.60
 

IPTC Dataset friendly name/slug and identifiers

$mla_iptc_keys : array

This array contains the sanitized names and identifiers of Datasets defined in the "IPTC-NAA Information Interchange Model Version No. 4.1".

since 0.90
 

Data selection parameters for the WP_Query in [mla_gallery]

$data_selection_parameters : array

since 1.30
 

Turn debug collection and display on or off

$mla_debug : boolean

since 0.70
 

IPTC Dataset descriptions

$mla_iptc_descriptions : array

This array contains the descriptions of Datasets defined in the "IPTC-NAA Information Interchange Model Version No. 4.1".

since 0.90
 

IPTC file format identifiers and descriptions

$mla_iptc_formats : array

This array contains the file format identifiers and descriptions defined in the "IPTC-NAA Information Interchange Model Version No. 4.1" for dataset 1#020.

since 0.90
 

IPTC image type identifiers and descriptions

$mla_iptc_image_types : array

This array contains the image type identifiers and descriptions defined in the "IPTC-NAA Information Interchange Model Version No. 4.1" for dataset 2#130, octet 2.

since 0.90
 

IPTC Dataset identifiers and names

$mla_iptc_records : array

This array contains the identifiers and names of Datasets defined in the "IPTC-NAA Information Interchange Model Version No. 4.1".

since 0.90
 

WP_Query filter "parameters"

$query_parameters : array

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

Array index values are: orderby, post_parent

since 1.13