API Documentation
Table of Contents
Namespaces
Constants
- REAL_UTILS_ROOT_SLUG = 'devowl-wp'
- REAL_UTILS_SLUG = 'real-utils'
- REAL_UTILS_SLUG_CAMELCASE = lcfirst(str_replace('-', '', ucwords(REAL_UTILS_SLUG, '-')))
- REAL_UTILS_TD = REAL_UTILS_ROOT_SLUG . '-' . REAL_UTILS_SLUG
- REAL_UTILS_VERSION = filemtime(__FILE__)
- RML_PRO_VERSION = $translatedUrl
- RML_TD = $this->getPluginData('TextDomain')
- RML_VERSION = $this->getPluginData('Version')
- RPM_WP_CLIENT_OPT_PREFIX = 'rpm-wpc'
- RPM_WP_CLIENT_ROOT_SLUG = 'devowl-wp'
- RPM_WP_CLIENT_SLUG = 'real-product-manager-wp-client'
- RPM_WP_CLIENT_SLUG_CAMELCASE = lcfirst(str_replace('-', '', ucwords(RPM_WP_CLIENT_SLUG, '-')))
- RPM_WP_CLIENT_TD = RPM_WP_CLIENT_ROOT_SLUG . '-' . RPM_WP_CLIENT_SLUG
- RPM_WP_CLIENT_VERSION = filemtime(__FILE__)
Functions
- wp_rml_get_attachments() : null|array<string|int, int>
- Reads content of a folder.
- wp_attachment_folder() : int|mixed
- Returns the folder id of an given attachment or more than one attachment (array). If you pass an array as attachment ids, then the default value does not work, only for single queries. When you pass a shortcut attachment id, the folder id for the shortcut is returned.
- wp_attachment_order_update() : bool
- (Pro only) Moves an attachment before another given attachment in the order table.
- wp_rml_move() : bool|array<string|int, string>
- Move or create shortcuts of a set of attachments to a specific folder.
- wp_rml_create_shortcuts() : bool|array<string|int, string>
- Link/Copy a set of attachments to a specific folder. When the folder has already a given shortcut, the movement for the given attachment will be skipped.
- wp_rml_created_shortcuts_last_ids() : array<string|int, int>
- If you create shortcuts you can get the ids for those shortcuts with this function.
- wp_attachment_ensure_source_file() : int|WP_Post
- Checks if a given attachment has already a shortcut in a given folder id or has generally shortcuts.
- wp_attachment_has_shortcuts() : bool
- Checks if a given attachment has already a shortcut in a given folder id or has generally shortcuts.
- wp_attachment_get_shortcuts() : mixed
- Checks if a given attachment ID has shortcut and returns the shortcut IDs as array.
- wp_attachment_is_shortcut() : bool|int
- Checks if a given attachment is a shortcut, use the $returnSourceId parameter to get the source attachment id.
- _wp_rml_synchronize_attachment() : bool
- Synchronizes a result with the realmedialibrary_posts table so on this base there can be made the folder content. It also creates shortcuts, if the given $isShortcut parameter is true.
- wp_rml_debug() : mixed
- This function is recommend for RML add-ons. You can use this function to generate log entries in the database when Settings > Media > Debug is enabled.
- is_rml_folder() : bool
- Checks, if a given variable is an implementation of the IFolder interface.
- wp_rml_get_parent_id() : int
- Get the parent ID of a given folder id.
- wp_rml_objects() : array<string|int, IFolder>
- Get all available folders, collections, galleries, .
- wp_rml_root_childs() : array<string|int, IFolder>
- Gets the first level childs of the media library.
- wp_rml_create() : int|array<string|int, string>
- Creates a folder. At first it checks if a folder in parent already exists.
- wp_rml_create_p() : int|array<string|int, string>
- (Pro only) Creates multiple folders like "test/test2". At first it checks if a folder in parent already exists.
- wp_rml_create_or_return_existing_id() : int|array<string|int, string>
- Wrapper function for wp_rml_create.
- wp_rml_rename() : bool|array<string|int, string>
- Renames a folder and then checks, if there is no duplicate folder in the parent folder.
- wp_rml_delete() : bool|array<string|int, string>
- Deletes a folder by ID.
- wp_rml_update_count() : string|null
- Handle the count cache for the folders. This should avoid a lack SQL subquery which loads data from the postmeta table.
- wp_rml_selector() : string
- This function returns a HTML code (input[type="hidden"]) which gets nicely rendered via Javascript (FolderSelector). If you need a more complex implementation have a look at FolderSelector.js module.
- wp_rml_dropdown() : string
- This functions returns a HTML formatted string which contains options-tag elements with all folders, collections and galleries.
- wp_rml_dropdown_collection() : string
- This functions returns a HTML formatted string which contains `<options>` elements with all folders, collections and galleries.
- wp_rml_dropdown_gallery() : string
- This functions returns a HTML formatted string which contains option-tag elements with all folders, collections and galleries.
- wp_rml_dropdown_gallery_or_collection() : string
- This functions returns a HTML formatted string which contains option-tag elements with all folders, collections and galleries.
- wp_rml_is_type() : bool
- Determines if a Folder is a special folder type.
- wp_rml_get_object_by_id() : IFolder
- A shortcut function for the wp_rml_get_by_id function that ensures, that a IFolder object is returned. For -1 the root instance is returned.
- wp_rml_get_by_id() : IFolder
- This functions checks if a specific folder exists by ID and is a given allowed RML Folder Type. If the given folder is _wp_rml_root you will get the first level folders.
- wp_rml_get_by_absolute_path() : IFolder
- This functions checks if a specific folder exists by absolute path and is a given allowed RML Folder Type.
- wp_rml_register_creatable() : mixed
- Register a new folder type for RML. It does not check if the creatable type is already registered.
- _wp_rml_root() : int
- Get the parent root folder for a given blog id.
- wp_rml_active() : bool
- Checks if RML is active for the current user.
- _wp_rml_sanitize() : string
- Sanitize to a valid slug name for a given folder name. If the passed folder name contains only invalid characters, then it falls back to the base64 encode.
- _wp_rml_sanitize_filename() : mixed
- wp_rml_structure_reset() : IFolder
- Resets the structure. This function must be called when you create a new folder for example and to register it to the structure.
- wp_rml_structure() : IStructure
- Get the main working structure.
- wp_rml_create_all_parents_sql() : string|bool
- Returns a SQL query to get all parents for a folder id.
- wp_rml_all_children_sql_supported() : bool
- Checks if the wp_rml_create_all_children_sql() SQL is supported by the current used database system. The function itself creates a dummy table and performs the SQL and checks if the result is as expected. The "support" result is cached site-wide.
- wp_rml_create_all_children_sql() : string|bool
- Returns a SQL query to get all children for a folder id.
- wp_rml_last_queried_folder() : int
- Set or get the last queried folder.
- get_media_folder_meta() : array<string|int, mixed>|mixed
- Retrieve folder meta field for a folder.
- add_media_folder_meta() : int|false
- Add meta data field to a folder.
- update_media_folder_meta() : int|bool
- Update folder meta field based on folder ID.
- delete_media_folder_meta() : bool
- Remove metadata matching criteria from a folder.
- delete_media_folder_meta_by_key() : bool
- Delete everything from folder meta matching meta key.
- truncate_media_folder_meta() : int
- Remove all meta of a folder. Use this with caution!!
- add_rml_user_settings_box() : bool
- Add a visible content to the general user settings dialog.
- add_rml_meta_box() : bool
- Add a visible content to the folder details dialog.
- rml_skip_already_admin_notice() : mixed
- Show an admin notice to administrators when the plugin is already active.
- rml_skip_already_deactivate_lite() : mixed
- Automatically deactivate Lite version when we try to activate the PRO version.
- rml_skip_php_admin_notice() : mixed
- Show an admin notice to administrators when the minimum PHP version could not be reached. The error message is only in english available.
- rml_skip_rest_admin_notice() : mixed
- Show an admin notice to administrators when the minimum WP version could not be reached. The error message is only in english available.
- rml_skip_wp_admin_notice() : mixed
- Show an admin notice to administrators when the minimum WP version could not be reached. The error message is only in english available.
Constants
REAL_UTILS_ROOT_SLUG
public
mixed
REAL_UTILS_ROOT_SLUG
= 'devowl-wp'
REAL_UTILS_SLUG
public
mixed
REAL_UTILS_SLUG
= 'real-utils'
REAL_UTILS_SLUG_CAMELCASE
public
mixed
REAL_UTILS_SLUG_CAMELCASE
= lcfirst(str_replace('-', '', ucwords(REAL_UTILS_SLUG, '-')))
REAL_UTILS_TD
public
mixed
REAL_UTILS_TD
= REAL_UTILS_ROOT_SLUG . '-' . REAL_UTILS_SLUG
REAL_UTILS_VERSION
public
mixed
REAL_UTILS_VERSION
= filemtime(__FILE__)
RML_PRO_VERSION
public
mixed
RML_PRO_VERSION
= $translatedUrl
RML_TD
public
mixed
RML_TD
= $this->getPluginData('TextDomain')
RML_VERSION
public
mixed
RML_VERSION
= $this->getPluginData('Version')
RPM_WP_CLIENT_OPT_PREFIX
public
mixed
RPM_WP_CLIENT_OPT_PREFIX
= 'rpm-wpc'
RPM_WP_CLIENT_ROOT_SLUG
public
mixed
RPM_WP_CLIENT_ROOT_SLUG
= 'devowl-wp'
RPM_WP_CLIENT_SLUG
public
mixed
RPM_WP_CLIENT_SLUG
= 'real-product-manager-wp-client'
RPM_WP_CLIENT_SLUG_CAMELCASE
public
mixed
RPM_WP_CLIENT_SLUG_CAMELCASE
= lcfirst(str_replace('-', '', ucwords(RPM_WP_CLIENT_SLUG, '-')))
RPM_WP_CLIENT_TD
public
mixed
RPM_WP_CLIENT_TD
= RPM_WP_CLIENT_ROOT_SLUG . '-' . RPM_WP_CLIENT_SLUG
RPM_WP_CLIENT_VERSION
public
mixed
RPM_WP_CLIENT_VERSION
= filemtime(__FILE__)
Functions
wp_rml_get_attachments()
Reads content of a folder.
wp_rml_get_attachments(int $fid[, string $order = null ][, string $orderby = null ]) : null|array<string|int, int>
Parameters
- $fid : int
-
The folder id
- $order : string = null
-
The order statement
- $orderby : string = null
-
The order by statement
Return values
null|array<string|int, int> —Null if folder not exists or array of post ids
wp_attachment_folder()
Returns the folder id of an given attachment or more than one attachment (array). If you pass an array as attachment ids, then the default value does not work, only for single queries. When you pass a shortcut attachment id, the folder id for the shortcut is returned.
wp_attachment_folder(int $attachmentId[, int $default = null ]) : int|mixed
Parameters
- $attachmentId : int
-
The attachment ID, if you pass an array you get an array of folder IDs
- $default : int = null
-
If no folder was found for this, this value is returned for the attachment
Return values
int|mixed —Folder ID or $default or Array
wp_attachment_order_update()
(Pro only) Moves an attachment before another given attachment in the order table.
wp_attachment_order_update(int $folderId, int $attachmentId, int|false $nextId[, int $lastIdInView = false ]) : bool
Parameters
- $folderId : int
-
The folder id where the attachment exists
- $attachmentId : int
-
The attachment which should be moved
- $nextId : int|false
-
The attachment next to the currentId, if it is false the currentId should be moved to the end of table.
- $lastIdInView : int = false
-
If you have pagination, you can pass the last id from this view
Return values
bool —True or array with error strings
wp_rml_move()
Move or create shortcuts of a set of attachments to a specific folder.
wp_rml_move(int $to, array<string|int, int> $ids[, bool $supress_validation = false ][, bool $isShortcut = false ]) : bool|array<string|int, string>
If you copy attachments, the action called is also "RML/Item/Move"... but there is a paramter $isShortcut.
Parameters
- $to : int
-
Folder ID
- $ids : array<string|int, int>
-
Array of attachment ids
- $supress_validation : bool = false
-
Supress the permission validation
- $isShortcut : bool = false
-
Determines, if the ID's are copies
Return values
bool|array<string|int, string> —True or Array with errors
wp_rml_create_shortcuts()
Link/Copy a set of attachments to a specific folder. When the folder has already a given shortcut, the movement for the given attachment will be skipped.
wp_rml_create_shortcuts(int $to, array<string|int, int> $ids[, bool $supress_validation = false ]) : bool|array<string|int, string>
If you want to receive the last created shortcut ID's you can use the wp_rml_created_shortcuts_last_ids() function.
Parameters
- $to : int
-
Folder ID, if folder not exists then root will be
- $ids : array<string|int, int>
-
Array of attachment ids
- $supress_validation : bool = false
-
Supress the permission validation
Return values
bool|array<string|int, string> —True or Array with errors
wp_rml_created_shortcuts_last_ids()
If you create shortcuts you can get the ids for those shortcuts with this function.
wp_rml_created_shortcuts_last_ids() : array<string|int, int>
Return values
array<string|int, int>wp_attachment_ensure_source_file()
Checks if a given attachment has already a shortcut in a given folder id or has generally shortcuts.
wp_attachment_ensure_source_file(int|WP_Post $post) : int|WP_Post
Parameters
- $post : int|WP_Post
-
The attachment id or a WP_Post object
Return values
int|WP_Postwp_attachment_has_shortcuts()
Checks if a given attachment has already a shortcut in a given folder id or has generally shortcuts.
wp_attachment_has_shortcuts(int $postId[, int $fid = false ]) : bool
Parameters
- $postId : int
-
The attachment id
- $fid : int = false
-
The folder id, if false, it checks if there generally exists shortcuts
Return values
boolwp_attachment_get_shortcuts()
Checks if a given attachment ID has shortcut and returns the shortcut IDs as array.
wp_attachment_get_shortcuts(int $postId[, int $fid = false ][, bool $extended = false ]) : mixed
Parameters
- $postId : int
-
The attachment id
- $fid : int = false
-
The folder id, if false, it checks if there generally exists shortcuts
- $extended : bool = false
-
If true the result is an array with all information about the associated folder
wp_attachment_is_shortcut()
Checks if a given attachment is a shortcut, use the $returnSourceId parameter to get the source attachment id.
wp_attachment_is_shortcut(int|WP_Post $post[, bool $returnSourceId = false ]) : bool|int
Parameters
- $post : int|WP_Post
-
The attachment id or a WP_Post object
- $returnSourceId : bool = false
-
If true, the return will be the source attachment id or 0 if it is no shortcut
Return values
bool|int_wp_rml_synchronize_attachment()
Synchronizes a result with the realmedialibrary_posts table so on this base there can be made the folder content. It also creates shortcuts, if the given $isShortcut parameter is true.
_wp_rml_synchronize_attachment(int $postId, int $fid[, bool $isShortcut = false ]) : bool
Do not use this directly, instead use the wp_rml_move function.
Parameters
- $postId : int
-
The post ID
- $fid : int
-
The folder ID
- $isShortcut : bool = false
-
true = Is shortcut in the given folder, false = Is no shortcut, mainly in this folder
Return values
boolwp_rml_debug()
This function is recommend for RML add-ons. You can use this function to generate log entries in the database when Settings > Media > Debug is enabled.
wp_rml_debug(mixed|string $message[, string $methodOrFunction = null ]) : mixed
Parameters
- $message : mixed|string
-
The message
- $methodOrFunction : string = null
-
METHOD or FUNCTION
Tags
is_rml_folder()
Checks, if a given variable is an implementation of the IFolder interface.
is_rml_folder(int|IFolder $obj) : bool
Parameters
- $obj : int|IFolder
-
Object or int (ID)
Return values
boolwp_rml_get_parent_id()
Get the parent ID of a given folder id.
wp_rml_get_parent_id(int $id) : int
Parameters
- $id : int
-
The id of the folder, collection, ...
Return values
int —or null
wp_rml_objects()
Get all available folders, collections, galleries, .
wp_rml_objects() : array<string|int, IFolder>
..
Return values
array<string|int, IFolder>wp_rml_root_childs()
Gets the first level childs of the media library.
wp_rml_root_childs() : array<string|int, IFolder>
Return values
array<string|int, IFolder>wp_rml_create()
Creates a folder. At first it checks if a folder in parent already exists.
wp_rml_create(string $name, int $parent, int $type[, array<string|int, string> $restrictions = [] ][, bool $supress_validation = false ][, bool $return_existing_id = false ]) : int|array<string|int, string>
Then it checks if the given type is allowed in the parent.
It is highly recommend, to use wp_rml_structure_reset after you created your folders.
Parameters
- $name : string
-
String Name of the folder
- $parent : int
-
int ID of the parent (_wp_rml_root() for root)
- $type : int
-
integer 0|1|2, Folder.inc
- $restrictions : array<string|int, string> = []
-
Restrictions for this folder
- $supress_validation : bool = false
-
Supress the permission validation
- $return_existing_id : bool = false
-
If true and the folder already exists, then return the ID of the existing folder
Tags
Return values
int|array<string|int, string> —int (ID) when successfully array with error strings
wp_rml_create_p()
(Pro only) Creates multiple folders like "test/test2". At first it checks if a folder in parent already exists.
wp_rml_create_p(string $name, int $parent, int $type[, array<string|int, string> $restrictions = [] ][, bool $supress_validation = false ]) : int|array<string|int, string>
Then it checks if the given type is allowed in the parent.
It is highly recommend, to use wp_rml_structure_reset after you created your folders.
Parameters
- $name : string
-
String Name of the folder
- $parent : int
-
int ID of the parent (_wp_rml_root() for root)
- $type : int
-
integer 0|1|2, Folder.inc
- $restrictions : array<string|int, string> = []
-
Restrictions for this folder, it is only applied to first folder
- $supress_validation : bool = false
-
Supress the permission validation
Tags
Return values
int|array<string|int, string> —int (ID) when successfully array with error strings
wp_rml_create_or_return_existing_id()
Wrapper function for wp_rml_create.
wp_rml_create_or_return_existing_id(string $name, int $parent, int $type[, array<string|int, string> $restrictions = [] ][, bool $supress_validation = false ]) : int|array<string|int, string>
Parameters
- $name : string
-
String Name of the folder
- $parent : int
-
int ID of the parent (_wp_rml_root() for root)
- $type : int
-
integer 0|1|2, Folder.inc
- $restrictions : array<string|int, string> = []
-
Restrictions for this folder
- $supress_validation : bool = false
-
Supress the permission validation
Tags
Return values
int|array<string|int, string> —int (ID) when successfully array with error strings
wp_rml_rename()
Renames a folder and then checks, if there is no duplicate folder in the parent folder.
wp_rml_rename(string $name, int $id[, bool $supress_validation = false ]) : bool|array<string|int, string>
Parameters
- $name : string
-
String New name of the folder
- $id : int
-
The ID of the folder
- $supress_validation : bool = false
-
Suppress the permission validation
Return values
bool|array<string|int, string> —true or array with error strings
wp_rml_delete()
Deletes a folder by ID.
wp_rml_delete(int $id[, bool $supress_validation = false ]) : bool|array<string|int, string>
Parameters
- $id : int
-
The ID of the folder
- $supress_validation : bool = false
-
Supress the permission validation
Return values
bool|array<string|int, string> —True or array with error string
wp_rml_update_count()
Handle the count cache for the folders. This should avoid a lack SQL subquery which loads data from the postmeta table.
wp_rml_update_count([array<string|int, int> $folders = null ][, array<string|int, int> $attachments = null ][, bool $onlyReturn = false ]) : string|null
Parameters
- $folders : array<string|int, int> = null
-
Array of folders ID, if null then all folders with cnt NULL are updated
- $attachments : array<string|int, int> = null
-
Array of attachments ID, is merged with $folders if given
- $onlyReturn : bool = false
-
Set to true if you only want the SQL query
Return values
string|nullwp_rml_selector()
This function returns a HTML code (input[type="hidden"]) which gets nicely rendered via Javascript (FolderSelector). If you need a more complex implementation have a look at FolderSelector.js module.
wp_rml_selector([array<string|int, mixed> $options = [] ]) : string
$options:
- mixed selected=Root The selected item, "" => "None", _wp_rml_root() => "Root", int => Folder ID
- int[] disabled Which folder types are disabled
- boolean nullable=false Defines if null ('') is allowed as value
- boolean editable=true Define if the selector is editable
- string name Name for the input
- string title Title in the modal dialog
Parameters
- $options : array<string|int, mixed> = []
Tags
Return values
stringwp_rml_dropdown()
This functions returns a HTML formatted string which contains options-tag elements with all folders, collections and galleries.
wp_rml_dropdown(mixed $selected, array<string|int, int> $disabled[, bool $useAll = true ]) : string
This function should only be used if you want to provide output. For a more UX friendly dropdown use wp_rml_selector()!
Parameters
- $selected : mixed
-
The selected item, "" => "All Files", _wp_rml_root() => "Root", int => Folder ID. Can also be an array for multiple select (since 3.1.2)
- $disabled : array<string|int, int>
-
Which folder types are disabled. Default disabled is RML_TYPE_COLLECTION
- $useAll : bool = true
-
boolean Defines, if "All Files" should be showed
Return values
stringwp_rml_dropdown_collection()
This functions returns a HTML formatted string which contains `<options>` elements with all folders, collections and galleries.
wp_rml_dropdown_collection(mixed $selected) : string
Note: Only COLLECTIONS are SELECTABLE!
This function should only be used if you want to provide output. For a more UX friendly dropdown use wp_rml_selector()!
Parameters
- $selected : mixed
-
The selected item, "" => "All Files", _wp_rml_root() => "Root", int => Folder ID. Can also be an array for multiple select (since 3.1.2)
Return values
stringwp_rml_dropdown_gallery()
This functions returns a HTML formatted string which contains option-tag elements with all folders, collections and galleries.
wp_rml_dropdown_gallery(mixed $selected) : string
Note: Only GALLERIES are SELECTABLE!
This function should only be used if you want to provide output. For a more UX friendly dropdown use wp_rml_selector()!
Parameters
- $selected : mixed
-
The selected item, "" => "All Files", _wp_rml_root() => "Root", int => Folder ID. Can also be an array for multiple select (since 3.1.2)
Return values
stringwp_rml_dropdown_gallery_or_collection()
This functions returns a HTML formatted string which contains option-tag elements with all folders, collections and galleries.
wp_rml_dropdown_gallery_or_collection(mixed $selected) : string
Note: Only GALLERIES AND COLLECTIONS are SELECTABLE!
Parameters
- $selected : mixed
-
The selected item, "" => "All Files", _wp_rml_root() => "Root", int => Folder ID. Can also be an array for multiple select (since 3.1.2)
Return values
stringwp_rml_is_type()
Determines if a Folder is a special folder type.
wp_rml_is_type(IFolder|int $folder, array<string|int, int> $allowed) : bool
Parameters
- $folder : IFolder|int
-
The folder object
- $allowed : array<string|int, int>
-
Which folder types are allowed
Return values
boolwp_rml_get_object_by_id()
A shortcut function for the wp_rml_get_by_id function that ensures, that a IFolder object is returned. For -1 the root instance is returned.
wp_rml_get_object_by_id(int $id[, array<string|int, int> $allowed = null ]) : IFolder
Parameters
- $id : int
- $allowed : array<string|int, int> = null
Return values
IFolderwp_rml_get_by_id()
This functions checks if a specific folder exists by ID and is a given allowed RML Folder Type. If the given folder is _wp_rml_root you will get the first level folders.
wp_rml_get_by_id(int $id[, array<string|int, int> $allowed = null ][, bool $mustBeFolderObject = false ][, bool $nullForRoot = true ]) : IFolder
Parameters
- $id : int
-
Folder ID
- $allowed : array<string|int, int> = null
-
Which folder types are allowed. If null all folder types are allowed.
- $mustBeFolderObject : bool = false
-
Defines if the function may return the wp_rml_root_childs result
- $nullForRoot : bool = true
-
If set to false and $id == -1 then the Root instance is returned
Return values
IFolderwp_rml_get_by_absolute_path()
This functions checks if a specific folder exists by absolute path and is a given allowed RML Folder Type.
wp_rml_get_by_absolute_path(string $path[, array<string|int, int> $allowed = null ]) : IFolder
Parameters
- $path : string
-
Folder Absolute Path
- $allowed : array<string|int, int> = null
-
Which folder types are allowed. If null all folder types are allowed.
Return values
IFolderwp_rml_register_creatable()
Register a new folder type for RML. It does not check if the creatable type is already registered.
wp_rml_register_creatable(string $qualified, int $type[, bool $onRegister = false ]) : mixed
Parameters
- $qualified : string
-
The qualified name of the class representing the creatable
- $type : int
-
The type of the creatable. It must be the same as in yourClass::getType is returned
- $onRegister : bool = false
-
Calls the yourClass::onRegister function
_wp_rml_root()
Get the parent root folder for a given blog id.
_wp_rml_root() : int
Return values
int —Folder id
wp_rml_active()
Checks if RML is active for the current user.
wp_rml_active() : bool
Tags
Return values
bool_wp_rml_sanitize()
Sanitize to a valid slug name for a given folder name. If the passed folder name contains only invalid characters, then it falls back to the base64 encode.
_wp_rml_sanitize(string $name[, bool $database = false ][, int $exclude = -1 ]) : string
Parameters
- $name : string
-
The name of the folder
- $database : bool = false
-
If true the name is generated unique from the database slugs
- $exclude : int = -1
Return values
string_wp_rml_sanitize_filename()
_wp_rml_sanitize_filename(mixed $name) : mixed
Parameters
- $name : mixed
wp_rml_structure_reset()
Resets the structure. This function must be called when you create a new folder for example and to register it to the structure.
wp_rml_structure_reset([int $root = null ][, bool $fetchData = true ][, int $returnId = false ]) : IFolder
ATTENTION: This function will be declared as deprecated soon, because it is planned to automatically reset the structure data / reset folder data (lazy loading of Folder objects).
Parameters
- $root : int = null
-
The root folder to read the structure
- $fetchData : bool = true
-
Determine if the data should be re-fetched
- $returnId : int = false
-
If set this folder is returned
Return values
IFolder —If $returnId is set
wp_rml_structure()
Get the main working structure.
wp_rml_structure() : IStructure
Tags
Return values
IStructurewp_rml_create_all_parents_sql()
Returns a SQL query to get all parents for a folder id.
wp_rml_create_all_parents_sql(IFolder|int $folder[, bool $includeSelf = false ][, int $until = null ][, array<string|int, mixed> $options = null ]) : string|bool
The first result for this SQL statement is the first parent and so on... Use rmltmp.lvl field for the depth number upwards. To avoid performance lacks you should figure out if there is already an action available to search for a meta_key in the action RML/$action/AnyParentHasMeta.
$options parameters:
"fields" => (string) SELECT fields (default: "rmldata.*, rmltmp.lvl AS lvlup") "join" => (string) JOIN statement (default: "") "where" => (string) Replace WHERE statement, it is preferred to use afterWhere (default: "rmltmp.lvl > " . ($includeSelf === true ? "-1" : "0")) "afterWhere"=> (string) Additional WHERE statement to the above WHERE (default: "") "orderby" => (string) ORDER BY statement (default: "rmltmp.lvl ASC") "limit" => (string) LIMIT statement (default: "")
Note: The created SQL is supported by all well-known MySQL systems.
Parameters
- $folder : IFolder|int
-
The folder object or folder id
- $includeSelf : bool = false
-
Set true to include self (passed $folder)
- $until : int = null
-
Until this folder id
- $options : array<string|int, mixed> = null
-
Additional options for the SQL query, see above
Return values
string|bool —SQL query or false if something went wrong
wp_rml_all_children_sql_supported()
Checks if the wp_rml_create_all_children_sql() SQL is supported by the current used database system. The function itself creates a dummy table and performs the SQL and checks if the result is as expected. The "support" result is cached site-wide.
wp_rml_all_children_sql_supported([bool $force = false ][, string $type = 'legacy' ]) : bool
Parameters
- $force : bool = false
-
If true the database check is performed again
- $type : string = 'legacy'
-
The type which is minimum required. Possible values: 'function' (MySQL UDF) or 'legacy' (default, old variant)
Tags
Return values
boolwp_rml_create_all_children_sql()
Returns a SQL query to get all children for a folder id.
wp_rml_create_all_children_sql(IFolder|int $folder[, bool $includeSelf = false ][, array<string|int, mixed> $options = null ]) : string|bool
The first result for this SQL statement is the first children and so on...
$options parameters:
"fields" => (string) SELECT fields (default: "rmldata.*"), "join" => (string) JOIN statement (default: ""), "where" => (string) Replace WHERE statement, it is preferred to use afterWhere (default: '1=1 ' . ($includeSelf === true ? "" : $wpdb->prepare(" AND rmldata.id != %d", $folderId))), "afterWhere" => (string) Additional WHERE statement to the above WHERE (default: ""), "orderby" => (string) ORDER BY statement (default: "rmldata.parent, rmldata.ord"), "limit" => (string) LIMIT statement (default: "")
Note: Not all database systems do support this kind of SQL query. You have to use the wp_rml_all_children_sql_supported() API function to check if it is supported.
Parameters
- $folder : IFolder|int
-
The folder object or folder id
- $includeSelf : bool = false
-
Set true to include self (passed $folder)
- $options : array<string|int, mixed> = null
-
Additional options for the SQL query, see above
Return values
string|bool —SQL query or false if something went wrong
wp_rml_last_queried_folder()
Set or get the last queried folder.
wp_rml_last_queried_folder([int $folder = null ]) : int
Parameters
- $folder : int = null
-
The folder id (0 is handled as "All files" folder)
Tags
Return values
intget_media_folder_meta()
Retrieve folder meta field for a folder.
get_media_folder_meta(int $folder_id[, string $key = '' ][, bool $single = false ]) : array<string|int, mixed>|mixed
Parameters
- $folder_id : int
-
Folder ID.
- $key : string = ''
-
The meta key to retrieve. By default, returns data for all keys.
- $single : bool = false
-
Whether to return a single value. Default false.
Return values
array<string|int, mixed>|mixed —Will be an array if $single is false. Will be value of meta data field if $single is true.
add_media_folder_meta()
Add meta data field to a folder.
add_media_folder_meta(int $folder_id, string $meta_key, mixed $meta_value[, bool $unique = false ]) : int|false
Folder meta data is called "Custom Fields" on the Administration Screen.
Parameters
- $folder_id : int
-
Folder ID.
- $meta_key : string
-
Metadata name.
- $meta_value : mixed
-
Metadata value. Must be serializable if non-scalar.
- $unique : bool = false
-
Whether the same key should not be added.
Return values
int|falseupdate_media_folder_meta()
Update folder meta field based on folder ID.
update_media_folder_meta(int $folder_id, string $meta_key, mixed $meta_value[, mixed $prev_value = '' ]) : int|bool
Use the $prev_value parameter to differentiate between meta fields with the same key and folder ID.
If the meta field for the folder does not exist, it will be added.
Parameters
- $folder_id : int
-
Folder ID.
- $meta_key : string
-
Metadata key.
- $meta_value : mixed
-
Metadata value. Must be serializable if non-scalar.
- $prev_value : mixed = ''
-
Previous value to check before removing.
Return values
int|booldelete_media_folder_meta()
Remove metadata matching criteria from a folder.
delete_media_folder_meta(int $folder_id, string $meta_key[, mixed $meta_value = '' ]) : bool
You can match based on the key, or key and value. Removing based on key and value, will keep from removing duplicate metadata with the same key. It also allows removing all metadata matching key, if needed.
Parameters
- $folder_id : int
-
Folder ID.
- $meta_key : string
-
Metadata name.
- $meta_value : mixed = ''
-
Metadata value. Must be serializable if non-scalar.
Return values
bool —True on success, false on failure.
delete_media_folder_meta_by_key()
Delete everything from folder meta matching meta key.
delete_media_folder_meta_by_key(string $folder_meta_key) : bool
Parameters
- $folder_meta_key : string
-
Key to search for when deleting.
Return values
bool —Whether the post meta key was deleted from the database.
truncate_media_folder_meta()
Remove all meta of a folder. Use this with caution!!
truncate_media_folder_meta(int $folder_id) : int
Parameters
- $folder_id : int
-
Folder ID
Return values
intadd_rml_user_settings_box()
Add a visible content to the general user settings dialog.
add_rml_user_settings_box(string $name, IUserSettings $obj[, bool $deprecated = false ][, int $priority = 10 ][, string $contentGroup = '' ]) : bool
Example: Adding a new tab "Physical" group to user settings dialog (or RML/Folder/Meta/Groups for folder details)
add_filter("RML/User/Settings/Groups", function($groups) {
$groups["physical"] = __("Physical");
return $groups;
});
Parameters
- $name : string
-
Unique name for this meta box
- $obj : IUserSettings
-
The object which implements IUserSettings
- $deprecated : bool = false
-
boolean Load the resources if exists (since 4.3.0 deprecated, scripts method is always called)
- $priority : int = 10
-
Priority for actions and filters
- $contentGroup : string = ''
-
The tab group for the meta settings, see example for adding a new group
Return values
booladd_rml_meta_box()
Add a visible content to the folder details dialog.
add_rml_meta_box(string $name, IMetadata $obj[, bool $hasScripts = false ][, int $priority = 10 ][, string $contentGroup = '' ]) : bool
Example: Adding a new tab "Physical" group to meta dialog (or RML/User/Settings/Groups for user settings)
add_filter("RML/Folder/Meta/Groups", function($groups) {
$groups["physical"] = __("Physical");
return $groups;
});
Parameters
- $name : string
-
Unique name for this meta box
- $obj : IMetadata
-
The object which implements IMetadata
- $hasScripts : bool = false
-
boolean Load the resources if exists
- $priority : int = 10
-
Priority for actions and filters
- $contentGroup : string = ''
-
The tab group for the meta settings, see example for adding a new group
Return values
boolrml_skip_already_admin_notice()
Show an admin notice to administrators when the plugin is already active.
rml_skip_already_admin_notice() : mixed
rml_skip_already_deactivate_lite()
Automatically deactivate Lite version when we try to activate the PRO version.
rml_skip_already_deactivate_lite() : mixed
rml_skip_php_admin_notice()
Show an admin notice to administrators when the minimum PHP version could not be reached. The error message is only in english available.
rml_skip_php_admin_notice() : mixed
rml_skip_rest_admin_notice()
Show an admin notice to administrators when the minimum WP version could not be reached. The error message is only in english available.
rml_skip_rest_admin_notice() : mixed
rml_skip_wp_admin_notice()
Show an admin notice to administrators when the minimum WP version could not be reached. The error message is only in english available.
rml_skip_wp_admin_notice() : mixed