REAL_UTILS_ROOT_SLUG
public
mixed
REAL_UTILS_ROOT_SLUG
= 'devowl-wp'
public
mixed
REAL_UTILS_ROOT_SLUG
= 'devowl-wp'
public
mixed
REAL_UTILS_SLUG
= 'real-utils'
public
mixed
REAL_UTILS_SLUG_CAMELCASE
= lcfirst(str_replace('-', '', ucwords(REAL_UTILS_SLUG, '-')))
public
mixed
REAL_UTILS_TD
= REAL_UTILS_ROOT_SLUG . '-' . REAL_UTILS_SLUG
public
mixed
REAL_UTILS_VERSION
= filemtime(__FILE__)
public
mixed
RML_PRO_VERSION
= $translatedUrl
public
mixed
RML_TD
= $this->getPluginData('TextDomain')
public
mixed
RML_VERSION
= $this->getPluginData('Version')
public
mixed
RPM_WP_CLIENT_OPT_PREFIX
= 'rpm-wpc'
public
mixed
RPM_WP_CLIENT_ROOT_SLUG
= 'devowl-wp'
public
mixed
RPM_WP_CLIENT_SLUG
= 'real-product-manager-wp-client'
public
mixed
RPM_WP_CLIENT_SLUG_CAMELCASE
= lcfirst(str_replace('-', '', ucwords(RPM_WP_CLIENT_SLUG, '-')))
public
mixed
RPM_WP_CLIENT_TD
= RPM_WP_CLIENT_ROOT_SLUG . '-' . RPM_WP_CLIENT_SLUG
public
mixed
RPM_WP_CLIENT_VERSION
= filemtime(__FILE__)
Reads content of a folder.
wp_rml_get_attachments(int $fid[, string $order = null ][, string $orderby = null ]) : null|array<string|int, int>
The folder id
The order statement
The order by statement
Null if folder not exists or array of post ids
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
The attachment ID, if you pass an array you get an array of folder IDs
If no folder was found for this, this value is returned for the attachment
Folder ID or $default or Array
(Pro only) Moves an attachment before another given attachment in the order table.
wp_attachment_order_update(int $folderId, int $attachmentId, int $nextId[, int $lastIdInView = false ]) : bool
The folder id where the attachment exists
The attachment which should be moved
The attachment next to the currentId, if it is false the currentId should be moved to the end of table.
If you have pagination, you can pass the last id from this view
True or array with error strings
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.
Folder ID
Array of attachment ids
Supress the permission validation
Determines, if the ID's are copies
True or Array with errors
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.
Folder ID, if folder not exists then root will be
Array of attachment ids
Supress the permission validation
True or Array with errors
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>
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
The attachment id or a WP_Post object
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
The attachment id
The folder id, if false, it checks if there generally exists 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
The attachment id
The folder id, if false, it checks if there generally exists shortcuts
If true the result is an array with all information about the associated folder
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
The attachment id or a WP_Post object
If true, the return will be the source attachment id or 0 if it is no shortcut
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.
The post ID
The folder ID
true = Is shortcut in the given folder, false = Is no shortcut, mainly in this folder
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
The message
METHOD or FUNCTION
Checks, if a given variable is an implementation of the IFolder interface.
is_rml_folder(int|IFolder $obj) : bool
Object or int (ID)
Get the parent ID of a given folder id.
wp_rml_get_parent_id(int $id) : int
The id of the folder, collection, ...
or null
Get all available folders, collections, galleries, .
wp_rml_objects() : array<string|int, IFolder>
..
Gets the first level childs of the media library.
wp_rml_root_childs() : array<string|int, IFolder>
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.
String Name of the folder
int ID of the parent (_wp_rml_root() for root)
integer 0|1|2, Folder.inc
Restrictions for this folder
Supress the permission validation
If true and the folder already exists, then return the ID of the existing folder
int (ID) when successfully array with error strings
(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.
String Name of the folder
int ID of the parent (_wp_rml_root() for root)
integer 0|1|2, Folder.inc
Restrictions for this folder, it is only applied to first folder
Supress the permission validation
int (ID) when successfully array with error strings
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>
String Name of the folder
int ID of the parent (_wp_rml_root() for root)
integer 0|1|2, Folder.inc
Restrictions for this folder
Supress the permission validation
int (ID) when successfully array with error strings
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>
String New name of the folder
The ID of the folder
Suppress the permission validation
true or array with error strings
Deletes a folder by ID.
wp_rml_delete(int $id[, bool $supress_validation = false ]) : bool|array<string|int, string>
The ID of the folder
Supress the permission validation
True or array with error string
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
Array of folders ID, if null then all folders with cnt NULL are updated
Array of attachments ID, is merged with $folders if given
Set to true if you only want the SQL query
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:
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()!
The selected item, "" => "All Files", _wp_rml_root() => "Root", int => Folder ID. Can also be an array for multiple select (since 3.1.2)
Which folder types are disabled. Default disabled is RML_TYPE_COLLECTION
boolean Defines, if "All Files" should be showed
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()!
The selected item, "" => "All Files", _wp_rml_root() => "Root", int => Folder ID. Can also be an array for multiple select (since 3.1.2)
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()!
The selected item, "" => "All Files", _wp_rml_root() => "Root", int => Folder ID. Can also be an array for multiple select (since 3.1.2)
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!
The selected item, "" => "All Files", _wp_rml_root() => "Root", int => Folder ID. Can also be an array for multiple select (since 3.1.2)
Determines if a Folder is a special folder type.
wp_rml_is_type(IFolder|int $folder, array<string|int, int> $allowed) : bool
The folder object
Which folder types are allowed
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
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
Folder ID
Which folder types are allowed. If null all folder types are allowed.
Defines if the function may return the wp_rml_root_childs result
If set to false and $id == -1 then the Root instance is returned
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
Folder Absolute Path
Which folder types are allowed. If null all folder types are allowed.
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
The qualified name of the class representing the creatable
The type of the creatable. It must be the same as in yourClass::getType is returned
Calls the yourClass::onRegister function
Get the parent root folder for a given blog id.
_wp_rml_root() : int
Folder id
Checks if RML is active for the current user.
wp_rml_active() : bool
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
The name of the folder
If true the name is generated unique from the database slugs
_wp_rml_sanitize_filename(mixed $name) : mixed
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).
The root folder to read the structure
Determine if the data should be re-fetched
If set this folder is returned
If $returnId is set
Get the main working structure.
wp_rml_structure() : IStructure
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.
The folder object or folder id
Set true to include self (passed $folder)
Until this folder id
Additional options for the SQL query, see above
SQL query or false if something went wrong
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
If true the database check is performed again
The type which is minimum required. Possible values: 'function' (MySQL UDF) or 'legacy' (default, old variant)
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.
The folder object or folder id
Set true to include self (passed $folder)
Additional options for the SQL query, see above
SQL query or false if something went wrong
Set or get the last queried folder.
wp_rml_last_queried_folder([int $folder = null ]) : int
The folder id (0 is handled as "All files" folder)
Retrieve folder meta field for a folder.
get_media_folder_meta(int $folder_id[, string $key = '' ][, bool $single = false ]) : array<string|int, mixed>|mixed
Folder ID.
The meta key to retrieve. By default, returns data for all keys.
Whether to return a single value. Default false.
Will be an array if $single is false. Will be value of meta data field if $single is true.
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.
Folder ID.
Metadata name.
Metadata value. Must be serializable if non-scalar.
Whether the same key should not be added.
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.
Folder ID.
Metadata key.
Metadata value. Must be serializable if non-scalar.
Previous value to check before removing.
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.
Folder ID.
Metadata name.
Metadata value. Must be serializable if non-scalar.
True on success, false on failure.
Delete everything from folder meta matching meta key.
delete_media_folder_meta_by_key(string $folder_meta_key) : bool
Key to search for when deleting.
Whether the post meta key was deleted from the database.
Remove all meta of a folder. Use this with caution!!
truncate_media_folder_meta(int $folder_id) : int
Folder ID
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;
});
Unique name for this meta box
The object which implements IUserSettings
boolean Load the resources if exists (since 4.3.0 deprecated, scripts method is always called)
Priority for actions and filters
The tab group for the meta settings, see example for adding a new group
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;
});
Unique name for this meta box
The object which implements IMetadata
boolean Load the resources if exists
Priority for actions and filters
The tab group for the meta settings, see example for adding a new group
Show an admin notice to administrators when the plugin is already active.
rml_skip_already_admin_notice() : mixed
Automatically deactivate Lite version when we try to activate the PRO version.
rml_skip_already_deactivate_lite() : 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_php_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_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