$cachedOrders
$cachedOrders :
Abstract class for a creatable folder item. It handles all general actions for a folder item. If you want to add an new folder type, have a look at the api function wp_rml_register_creatable();
A new folder type MUST have the implementation with class FOLDERTYPE extends order\Sortable because every folder can also be sortable!
deleted_realmedialibrary_meta(array<mixed,integer> $meta_ids,integer $object_id,string $meta_key)
Delete the subOrderAutomatically metadata when deleting the subfolder order and also reset the subfolder order. It also handles the content order.
array<mixed,integer> | $meta_ids | |
integer | $object_id | |
string | $meta_key |
anyParentHas(string $column,mixed $value = null,string $valueFormat = '%s',boolean $includeSelf = false,integer $until = null): array
Get all parents which meets a given column value or column value is not empty.
string | $column | The column name for the wp_realmedialibrary SQL table. "slug", "name", "absolutePath", ... This string is not escaped when you pass it through this function |
mixed | $value | The value the column should have |
string | $valueFormat | The value format for $value ($wpdb->prepare) This string is not escaped when you pass it through this function |
boolean | $includeSelf | Set true to add self to list |
integer | $until | The highest allowed folder id. If null _wp_rml_root() is used |
folderId => columnValue, first id is the first found parent
anyParentHasMetadata(string $meta_key,mixed $meta_value = null,string $valueFormat = '%s',boolean $includeSelf = false,integer $until = null): array
Get all parents which meets a given meta key value or meta key value is not empty.
string | $meta_key | The meta key name for the wp_realmedialibrary_meta SQL table. This string is not escaped when you pass it through this function |
mixed | $meta_value | The value the meta key should have |
string | $valueFormat | The value format for $value ($wpdb->prepare) This string is not escaped when you pass it through this function |
boolean | $includeSelf | Set true to add self to list |
integer | $until | The highest allowed folder id. If null _wp_rml_root() is used |
Array with keys: id (meta_id), folderId, value (meta_value), first id is the first found parent
anyChildrenHas(string $column,mixed $value = null,string $valueFormat = '%s',boolean $includeSelf = false): array
Get all children which meets a given column value or column value is not empty.
string | $column | The column name for the wp_realmedialibrary SQL table. "slug", "name", "absolutePath", ... This string is not escaped when you pass it through this function |
mixed | $value | The value the column should have |
string | $valueFormat | The value format for $value ($wpdb->prepare) This string is not escaped when you pass it through this function |
boolean | $includeSelf | Set true to add self to list |
folderId => columnValue, first id is the first found child
anyChildrenHasMetadata(string $meta_key,mixed $meta_value = null,string $valueFormat = '%s',boolean $includeSelf = false): array
Get all chilren which meets a given meta key value or meta key value is not empty.
string | $meta_key | The meta key name for the wp_realmedialibrary_meta SQL table. This string is not escaped when you pass it through this function |
mixed | $meta_value | The value the meta key should have |
string | $valueFormat | The value format for $value ($wpdb->prepare) This string is not escaped when you pass it through this function |
boolean | $includeSelf | Set true to add self to list |
Array with keys: id (meta_id), folderId, value (meta_value), first id is the first found child
hasChildren(string $name,boolean $returnObject = false): boolean
Checks if this folder has a children with a given name.
string | $name | Name of folder |
boolean | $returnObject | If set to true and a children with this name is found, then return the object for this folder |
getAllParents(integer $until = null,integer $colIdx): array<mixed,integer>
Get all parents of this folder.
integer | $until | The highest allowed folder id. If null _wp_rml_root() is used |
integer | $colIdx | The index returning for the wp_rml_create_all_parents_sql() query |
Folder ids, first id is the first parent
getSlug(boolean $force = false,boolean $fromSetName = false): string
Returns a sanitized title for the folder. If the slug is empty or forced to, it will be updated in the database, too.
boolean | $force | Forces to regenerate the slug |
boolean | $fromSetName | For internal usage only |
getPath(string $implode = '/',callable $map = 'htmlentities',callable $filter = null): string
Creates a absolute path without slugging' the names.
// Get valid physical folder name
$folder->getPath("/", "_wp_rml_sanitize_filename");
string | $implode | Delimiter for the folder names |
callable | $map | Map the names with this function. Pass null to skip this map function |
callable | $filter | Filter folders |
htmlentitied path
getAbsolutePath(boolean $force = false,boolean $fromSetName = false): string
Creates a absolute path. If the absolute path is empty or forced to, it will be updated in the database, too.
boolean | $force | Forces to regenerate the absolute path |
boolean | $fromSetName | For internal usage only |
getChildren(): \MatthiasWeb\RealMediaLibrary\api\IFolder
Get children of this folder.
__construct(integer $id,integer $parent = -1,string $name = '',string $slug = '',string $absolute = '',integer $order = -1,integer $cnt,array $row = array())
C'tor with the main properties.
The constructor does not throw any errors because when it is fully filled with parameters it expects the right properties from the database.
Only ::instance and ::create should create instances from this class!
Synced with order\Sortable::__construct
integer | $id | |
integer | $parent | |
string | $name | |
string | $slug | |
string | $absolute | |
integer | $order | |
integer | $cnt | |
array | $row |
persist(): integer
Persist the given creatable with the database. Think about it, that this only works, when the ID === -1 (that means, it will be a new folder).
After the folder is created, this instance is useless, you must get the folder with the API wp_rml_get_by_id
ID of the newly created folder