Properties

$mla_debug

$mla_debug : boolean

Turn debug collection and display on or off

Type

boolean

$term_list_item_specific_arguments

$term_list_item_specific_arguments : array

These are the default parameters for term list display

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 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

Type

array

$mla_get_shortcode_attachments_parameters

$mla_get_shortcode_attachments_parameters : array

Data selection parameters for the WP_Query in [mla_gallery]

Type

array

$mla_get_terms_parameters

$mla_get_terms_parameters : array

Data selection parameters for [mla_tag_cloud], [mla_term_list]

Type

array

Methods

mla_ghostscript_present()

mla_ghostscript_present(  $explicit_path = '',   $ghostscript_only = false) : boolean

Verify the presence of Ghostscript for mla_viewer

Parameters

$explicit_path
$ghostscript_only

Returns

boolean —

true if Ghostscript available else false

mla_gallery_shortcode()

mla_gallery_shortcode(array  $attr, string  $content = NULL) : string

The MLA Gallery shortcode.

This is a superset of the WordPress Gallery shortcode for displaying images on a post, page or custom post type. It is adapted from /wp-includes/media.php gallery_shortcode. Enhancements include many additional selection parameters and full taxonomy support.

Parameters

array $attr

Attributes of the shortcode

string $content

Optional content for enclosing shortcodes; used with mla_alt_shortcode

Returns

string —

HTML content to display gallery.

mla_tag_cloud()

mla_tag_cloud(array  $attr) : string

The MLA Tag Cloud support function.

This is an alternative to the WordPress wp_tag_cloud function, with additional options to customize the hyperlink behind each term.

Parameters

array $attr

Attributes of the shortcode.

Returns

string —

HTML content to display the tag cloud.

mla_tag_cloud_shortcode()

mla_tag_cloud_shortcode(array  $attr, string  $content = NULL) : string

The MLA Tag Cloud shortcode.

This is an interface to the mla_tag_cloud function.

Parameters

array $attr

Attributes of the shortcode.

string $content

Optional content for enclosing shortcodes

Returns

string —

HTML content to display the tag cloud.

_compose_term_list()

_compose_term_list(string  $list, array  $links, array  $terms, array  $markup_values, array  $arguments, array  $attr) : void

Compose one level of an mla_term_list

Adds shortcode output text and term-specific links to arrays passed by reference.

Parameters

string $list

Shortcode output text, by reference

array $links

Term-specific links for flat/array output, by reference

array $terms

Term objects, by reference

array $markup_values

Style and list-level substitution parameters, by reference

array $arguments

Shortcode parameters, including defaults, by reference

array $attr

Shortcode parameters, explicit, by reference

mla_term_list()

mla_term_list(array  $attr) : string

The MLA Term List support function.

This is an alternative to the WordPress wp_list_categories, wp_dropdown_categories and wp_terms_checklist functions, with additional options to customize the hyperlink behind each term.

Parameters

array $attr

Attributes of the shortcode.

Returns

string —

HTML content to display the term list, dropdown control or checklist.

mla_term_list_shortcode()

mla_term_list_shortcode(array  $attr, string  $content = NULL) : string

The MLA Term List shortcode.

This is an interface to the mla_term_list function.

Parameters

array $attr

Attributes of the shortcode.

string $content

Optional content for enclosing shortcodes

Returns

string —

HTML content to display the term list.

mla_get_shortcode_attachments()

mla_get_shortcode_attachments(  $post_parent,   $attr,   $return_found_rows = NULL) : array

Parses shortcode parameters and returns the gallery objects

Parameters

$post_parent
$attr
$return_found_rows

Returns

array —

List of attachments returned from WP_Query

mla_shortcode_query_posts_join_filter()

mla_shortcode_query_posts_join_filter(  $join_clause) : string

Filters the JOIN clause for shortcode queries

Defined as public because it's a filter.

Parameters

$join_clause

Returns

string —

query clause after item modification

mla_shortcode_query_posts_where_filter()

mla_shortcode_query_posts_where_filter(  $where_clause) : string

Filters the WHERE clause for shortcode queries

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.

Parameters

$where_clause

Returns

string —

query clause after modification

mla_shortcode_query_posts_orderby_filter()

mla_shortcode_query_posts_orderby_filter(  $orderby_clause) : string

Filters the ORDERBY clause for shortcode queries

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.

Parameters

$orderby_clause

Returns

string —

query clause after modification

mla_shortcode_query_posts_clauses_filter()

mla_shortcode_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_shortcode_query_posts_clauses_request_filter()

mla_shortcode_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)

mla_get_terms()

mla_get_terms(  $attr) : array

Retrieve the terms in one or more taxonomies.

Alternative to WordPress /wp-includes/taxonomy.php function get_terms() that provides an accurate count of attachments associated with each term.

taxonomy - string containing one or more (comma-delimited) taxonomy names or an array of taxonomy names. Default 'post_tag'.

post_mime_type - MIME type(s) of the items to include in the term-specific counts. Default 'all'.

post_type - The post type(s) of the items to include in the term-specific counts. The default is "attachment".

post_status - The post status value(s) of the items to include in the term-specific counts. The default is "inherit".

ids - A comma-separated list of attachment ID values for an item-specific cloud.

include - An array, comma- or space-delimited string of term ids to include in the return array.

exclude - An array, comma- or space-delimited string of term ids to exclude from the return array. If 'include' is non-empty, 'exclude' is ignored.

parent - term_id of the terms' immediate parent; 0 for top-level terms.

minimum - minimum number of attachments a term must have to be included. Default 0.

no_count - 'true', 'false' (default) to suppress term-specific attachment-counting process.

number - maximum number of term objects to return. Terms are ordered by count, descending and then by term_id before this value is applied. Default 0.

orderby - 'count', 'id', 'name' (default), 'none', 'random', 'slug'

order - 'ASC' (default), 'DESC'

no_orderby - 'true', 'false' (default) to suppress ALL sorting clauses else false.

preserve_case - 'true', 'false' (default) to make orderby case-sensitive.

pad_counts - 'true', 'false' (default) to to include the count of all children in their parents' count.

limit - final number of term objects to return, for pagination. Default 0.

offset - number of term objects to skip, for pagination. Default 0.

fields - string with fields for the SQL SELECT clause, e.g., 't.term_id, t.name, t.slug, COUNT(p.ID) AS count'

Parameters

$attr

Returns

array —

array of term objects, empty if none found

_validate_attributes()

_validate_attributes(mixed  $attr, string  $content = NULL) : array

Make sure $attr is an array, repair line-break damage, merge with $content

Parameters

mixed $attr

Array or string containing shortcode attributes

string $content

Optional content for enclosing shortcodes; might be used with mla_alt_shortcode

Returns

array —

clean attributes array

_registered_dimensions()

_registered_dimensions() : array

Computes image dimensions for scalable graphics, e.g., SVG

Returns

array

_process_shortcode_parameter()

_process_shortcode_parameter(  $text,   $markup_values) : string

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

Parameters

$text
$markup_values

Returns

string —

parameter with brackets, braces, substitution parameters and templates processed

_paginate_links()

_paginate_links(  $output_parameters,   $markup_values,   $arguments,   $found_rows,   $output = '') : mixed

Handles pagnation output types 'previous_page', 'next_page', and 'paginate_links'

Parameters

$output_parameters
$markup_values
$arguments
$found_rows
$output

Returns

mixed —

false or string with HTML for pagination output types

_process_pagination_output_types()

_process_pagination_output_types(  $output_parameters,   $markup_values,   $arguments,   $attr,   $found_rows,   $output = '') : mixed

Handles pagnation output types 'previous_page', 'next_page', and 'paginate_links'

Parameters

$output_parameters
$markup_values
$arguments
$attr
$found_rows
$output

Returns

mixed —

false or string with HTML for pagination output types

_sanitize_query_specification()

_sanitize_query_specification(  $specification) : string

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

Parameters

$specification

Returns

string —

query specification with HTML escape sequences and line breaks removed

_validate_sql_orderby()

_validate_sql_orderby(  $query_parameters,   $table_prefix = NULL,   $allowed_keys = NULL,   $binary_keys = array()) : string|boolean

Translates query parameters to a valid SQL order by clause.

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

Parameters

$query_parameters
$table_prefix
$allowed_keys
$binary_keys

Returns

string|boolean —

Returns the orderby clause if present, false otherwise.

_get_term_tree()

_get_term_tree(array  $terms, array  $arguments = array()) : array

Walk a list of terms and find hierarchy, preserving source order.

Parameters

array $terms

Term objects, by reference

array $arguments

Shortcode arguments, including defaults

Returns

array —

( [taxonomy] => array( [root terms] => array( [fields], array( 'children' => [child terms] )

_find_child_of()

_find_child_of(array  $parents, integer  $parent_id) : mixed

Find a term that matches $child_of

Parameters

array $parents

Potential parent Term objects, by reference

integer $parent_id

Term_id of the desired parent

Returns

mixed —

Term object of the desired parent else false

_find_include_tree()

_find_include_tree(array  $terms, array  $include_tree) : mixed

Find the term(s) that match $include_tree

Parameters

array $terms

Potential term objects, by reference

array $include_tree

term_id(s) of the desired terms

Returns

mixed —

Term object(s) of the desired terms else false

_remove_exclude_tree()

_remove_exclude_tree(array  $terms, array  $exclude_tree) : void

Remove the term(s) that match $exclude_tree

Parameters

array $terms

Potential term objects, by reference

array $exclude_tree

term_id(s) of the desired terms

_count_term_children()

_count_term_children(object  $parent, integer  $depth) : integer

Add level to term children and count them, all levels.

Recalculates term counts by including items from child terms. Assumes all relevant children are already in the $terms argument.

Parameters

object $parent

Parent Term objects, by reference

integer $depth

Maximum depth of parent/child relationship

Returns

integer —

Total number of children, all levels

_pad_term_counts()

_pad_term_counts(  $terms,   $taxonomy,   $post_types = NULL,   $post_stati = NULL) : null

Add count of children to parent count.

Recalculates term counts by including items from child terms. Assumes all relevant children are already in the $terms argument.

Parameters

$terms
$taxonomy
$post_types
$post_stati

Returns

null —

Will break from function if conditions are not met.