initialize()
mla_fetch_attachment_references()
mla_get_attachment_by_id()
mla_load_template()
mla_parse_template()
mla_prepare_list_table_query()
mla_query_list_table_items()
mla_query_list_table_items_helper()
_fetch_attachment_metadata()
_fetch_attachment_parent_data()
Class MLA (Media Library Assistant) Data provides database and template file access for MLA needs.
The _template functions are inspired by the book "WordPress 3 Plugin Development Essentials." Templates separate HTML markup from PHP code for easier maintenance and localization.
package | Media Library Assistant |
---|---|
since | 0.1 |
initialize()
since | 0.1 |
---|
mla_load_template(string $filepath) : string
Loads a template to a string or a multi-part template to an array. Multi-part templates are divided by comments of the form , where "key" becomes the key part of the array.
since | 0.1 |
---|
string
Complete path and name of the template file
string
For files that do not contain template divider comments array For files containing template divider comments false If file does not exist NULL If file could not be loadedmla_parse_template(string $tpl, array $hash) : string
A simple parsing function for basic templating.
since | 0.1 |
---|
string
A formatting string containing [+placeholders+]
array
An associative array containing keys and values e.g. array('key' => 'value');
string
Placeholders corresponding to the keys of the hash will be replaced with their values.mla_prepare_list_table_query(array $request) : array
Prepare the arguments for WP_Query. Modeled after wp_edit_attachments_query in wp-admin/post.php NOTE: The caller must remove the 'posts_where' filter, if required.
since | 0.1 |
---|
array
query parameters from web page, usually found in $_REQUEST
array
revised arguments suitable for WP_Querymla_query_list_table_items(array $request, string $orderby, string $order, int $offset, int $count) : array
Supports prepare_items in class-mla-list-table.php Modeled after wp_edit_attachments_query in wp-admin/post.php
since | 0.1 |
---|
array
query parameters from web page, usually found in $_REQUEST
string
database column to sort by
string
ASC or DESC
int
number of rows to skip over to reach desired page
int
number of rows on each page
array
attachment objects (posts) including parent data, meta data and referencesmla_query_list_table_items_helper(string $where) : string
Modeled after _edit_attachments_query_helper in wp-admin/post.php Defined as public so callers can remove it after the query
since | 0.1 |
---|
string
query clause before modification
string
query clause after "detached" item modification