Class MLA (Media Library Assistant) Query provides database query support for "where-used" reporting needs

package Media Library Assistant
since 2.20

 Methods

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

mla_attachment_array_fetch_references_handler(array $attachments) : void

Called from MLAQuery::mla_fetch_attachment_references, which handles conditional loading of this file.

since 1.94

Parameters

$attachments

array

WP_Post objects, passed by reference

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

mla_fetch_attachment_references_handler(int $ID, int $parent, boolean $add_references) : array

Called from MLAQuery::mla_fetch_attachment_references, which handles conditional loading of this file.

since 0.1

Parameters

$ID

int

post ID of attachment

$parent

int

post ID of attachment's parent, if any

$add_references

boolean

True to compute references, false to return empty values

Returns

arrayReference information; see $references array comments

Invalidates the $mla_galleries or $galleries array and cached values

mla_flush_mla_galleries_handler(string $option_name) : void

Called from MLAQuery::mla_flush_mla_galleries, which handles conditional loading of this file.

since 1.00

Parameters

$option_name

string

name of the gallery's cache/option variable

Builds the $mla_galleries or $galleries array

_build_mla_galleries(string $option_name, array $galleries_array, string $shortcode, boolean $exclude_revisions) : boolean

since 0.70

Parameters

$option_name

string

name of the gallery's cache/option variable

$galleries_array

array

by reference to the private static galleries array variable

$shortcode

string

the shortcode to be searched for and processed

$exclude_revisions

boolean

true to exclude revisions from the search

Returns

booleantrue if the galleries array is not empty

Search the $mla_galleries or $galleries array

_search_mla_galleries(array $galleries_array, int $attachment_id) : array

since 0.70

Parameters

$galleries_array

array

by reference to the private static galleries array variable

$attachment_id

int

the attachment ID to be searched for and processed

Returns

arrayAll posts/pages with one or more galleries that include the attachment. The array key is the parent_post ID; each entry contains post_title and post_type.

 Properties

 

Objects containing [gallery] shortcodes

$galleries : array

This array contains all of the objects containing one or more [gallery] shortcodes and array(s) of which attachments each [gallery] contains. The arrays are built once each page load and cached for subsequent calls.

The outer array is keyed by post_id. It contains an associative array with: ['parent_title'] post_title of the gallery parent, ['parent_type'] 'post' or 'page' or the custom post_type of the gallery parent, ['parent_status'] 'publish', 'private', 'future', 'pending', 'draft' ['results'] array ( ID => ID ) of attachments appearing in ANY of the parent's galleries. ['galleries'] array of [gallery] entries numbered from one (1), containing: galleries[X]['query'] contains a string with the arguments of the [gallery], galleries[X]['results'] contains an array ( ID ) of post_ids for the objects in the gallery.

since 0.70
 

Objects containing [mla_gallery] shortcodes

$mla_galleries : array

This array contains all of the objects containing one or more [mla_gallery] shortcodes and array(s) of which attachments each [mla_gallery] contains. The arrays are built once each page load and cached for subsequent calls.

since 0.70