BaseFolder
in package
implements
IFolder
Uses
UtilsProvider
Abstract base class for folders. It handles the available fields and getters / setters.
The class is completely documented in the implemented interface.
Table of Contents
Interfaces
- IFolder
- This interface provides elementary getter and setter methods for folder objects. All folder types (Folder, Collection, Gallery, ...) have implemented this interface.
Properties
- $absolutePath : mixed
- $children : mixed
- $cnt : mixed
- $contentCustomOrder : mixed
- $id : mixed
- $name : mixed
- $order : mixed
- $owner : mixed
- $parent : mixed
- $restrictions : mixed
- $restrictionsCount : mixed
- $row : mixed
- $slug : mixed
- $systemReservedFolders : mixed
- $visible : mixed
Methods
- anyChildrenHas() : array<string|int, mixed>
- Get all children which meets a given column value or column value is not empty.
- anyChildrenHasMetadata() : array<string|int, mixed>
- Get all chilren which meets a given meta key value or meta key value is not empty.
- anyParentHas() : array<string|int, mixed>
- Get all parents which meets a given column value or column value is not empty.
- anyParentHasMetadata() : array<string|int, mixed>
- Get all parents which meets a given meta key value or meta key value is not empty.
- getAbsolutePath() : string
- Creates a absolute path. If the absolute path is empty or forced to, it will be updated in the database, too.
- getAllParents() : array<string|int, int>
- Get all parents of this folder.
- getChildren() : IFolder
- Get children of this folder.
- getCnt() : int
- Gets the count of the files in this folder.
- getId() : int
- Get the folder id.
- getName() : string
- Get the folder name.
- getOrder() : int
- Get the order number.
- getOwner() : int
- Get the creator/owner of the folder.
- getParent() : int
- Get the parent folder id.
- getPath() : string
- Creates a absolute path without slugging' the names.
- getPlain() : array<string|int, mixed>
- Gets a plain array with folder properties.
- getPluginConstantPrefix() : string
- Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
- getRestrictions() : array<string|int, string>
- Get the restrictions of this folder.
- getRestrictionsCount() : int
- Get the count of the restrictions.
- getSlug() : string
- Returns a sanitized title for the folder. If the slug is empty or forced to, it will be updated in the database, too.
- hasChildren() : bool
- Checks if this folder has a children with a given name.
- is() : bool
- Check if the folder object is a given type.
- isRestrictFor() : bool
- Checks if this folder has a special restriction.
- isVisible() : bool
- Check if the folder object is visible to the user.
- setRestrictions() : mixed
Properties
$absolutePath
protected
mixed
$absolutePath
$children
protected
mixed
$children
$cnt
protected
mixed
$cnt
$contentCustomOrder
protected
mixed
$contentCustomOrder
$id
protected
mixed
$id
$name
protected
mixed
$name
$order
protected
mixed
$order
$owner
protected
mixed
$owner
$parent
protected
mixed
$parent
$restrictions
protected
mixed
$restrictions
= []
$restrictionsCount
protected
mixed
$restrictionsCount
= 0
$row
protected
mixed
$row
$slug
protected
mixed
$slug
$systemReservedFolders
protected
mixed
$systemReservedFolders
= ['/', '..', '.']
$visible
protected
mixed
$visible
= true
Methods
anyChildrenHas()
Get all children which meets a given column value or column value is not empty.
public
anyChildrenHas(mixed $column[, mixed $value = null ][, mixed $valueFormat = '%s' ][, mixed $includeSelf = false ]) : array<string|int, mixed>
Parameters
- $column : mixed
-
The column name for the wp_realmedialibrary SQL table. "slug", "name", "absolutePath", ... This string is not escaped when you pass it through this function
- $value : mixed = null
-
The value the column should have
- $valueFormat : mixed = '%s'
-
The value format for $value ($wpdb->prepare) This string is not escaped when you pass it through this function
- $includeSelf : mixed = false
-
Set true to add self to list
Return values
array<string|int, mixed> —folderId => columnValue, first id is the first found child
anyChildrenHasMetadata()
Get all chilren which meets a given meta key value or meta key value is not empty.
public
anyChildrenHasMetadata(mixed $meta_key[, mixed $meta_value = null ][, mixed $valueFormat = '%s' ][, mixed $includeSelf = false ]) : array<string|int, mixed>
Parameters
- $meta_key : mixed
-
The meta key name for the wp_realmedialibrary_meta SQL table. This string is not escaped when you pass it through this function
- $meta_value : mixed = null
-
The value the meta key should have
- $valueFormat : mixed = '%s'
-
The value format for $value ($wpdb->prepare) This string is not escaped when you pass it through this function
- $includeSelf : mixed = false
-
Set true to add self to list
Return values
array<string|int, mixed> —Array with keys: id (meta_id), folderId, value (meta_value), first id is the first found child
anyParentHas()
Get all parents which meets a given column value or column value is not empty.
public
anyParentHas(mixed $column[, mixed $value = null ][, mixed $valueFormat = '%s' ][, mixed $includeSelf = false ][, mixed $until = null ]) : array<string|int, mixed>
Parameters
- $column : mixed
-
The column name for the wp_realmedialibrary SQL table. "slug", "name", "absolutePath", ... This string is not escaped when you pass it through this function
- $value : mixed = null
-
The value the column should have
- $valueFormat : mixed = '%s'
-
The value format for $value ($wpdb->prepare) This string is not escaped when you pass it through this function
- $includeSelf : mixed = false
-
Set true to add self to list
- $until : mixed = null
-
The highest allowed folder id. If null _wp_rml_root() is used
Return values
array<string|int, mixed> —folderId => columnValue, first id is the first found parent
anyParentHasMetadata()
Get all parents which meets a given meta key value or meta key value is not empty.
public
anyParentHasMetadata(mixed $meta_key[, mixed $meta_value = null ][, mixed $valueFormat = '%s' ][, mixed $includeSelf = false ][, mixed $until = null ]) : array<string|int, mixed>
Parameters
- $meta_key : mixed
-
The meta key name for the wp_realmedialibrary_meta SQL table. This string is not escaped when you pass it through this function
- $meta_value : mixed = null
-
The value the meta key should have
- $valueFormat : mixed = '%s'
-
The value format for $value ($wpdb->prepare) This string is not escaped when you pass it through this function
- $includeSelf : mixed = false
-
Set true to add self to list
- $until : mixed = null
-
The highest allowed folder id. If null _wp_rml_root() is used
Return values
array<string|int, mixed> —Array with keys: id (meta_id), folderId, value (meta_value), first id is the first found parent
getAbsolutePath()
Creates a absolute path. If the absolute path is empty or forced to, it will be updated in the database, too.
public
getAbsolutePath([mixed $force = false ][, mixed $fromSetName = false ]) : string
Parameters
- $force : mixed = false
-
Forces to regenerate the absolute path
- $fromSetName : mixed = false
-
For internal usage only
Return values
stringgetAllParents()
Get all parents of this folder.
public
getAllParents([mixed $until = null ][, mixed $colIdx = 0 ]) : array<string|int, int>
Parameters
- $until : mixed = null
-
The highest allowed folder id. If null _wp_rml_root() is used
- $colIdx : mixed = 0
-
The index returning for the wp_rml_create_all_parents_sql() query
Return values
array<string|int, int> —Folder ids, first id is the first parent
getChildren()
Get children of this folder.
public
getChildren() : IFolder
Return values
IFoldergetCnt()
Gets the count of the files in this folder.
public
getCnt([mixed $forceReload = false ]) : int
Parameters
- $forceReload : mixed = false
-
If true the count cache gets reloaded
Return values
intgetId()
Get the folder id.
public
getId() : int
Return values
intgetName()
Get the folder name.
public
getName([mixed $htmlentities = false ]) : string
Parameters
- $htmlentities : mixed = false
-
If true the name is returned htmlentitied for output
Return values
stringgetOrder()
Get the order number.
public
getOrder() : int
Return values
intgetOwner()
Get the creator/owner of the folder.
public
getOwner() : int
Return values
int —ID of the user
getParent()
Get the parent folder id.
public
getParent() : int
Return values
intgetPath()
Creates a absolute path without slugging' the names.
public
getPath([mixed $implode = '/' ][, mixed $map = 'htmlentities' ][, mixed $filter = null ]) : string
// Get valid physical folder name
$folder->getPath("/", "_wp_rml_sanitize_filename");
Parameters
- $implode : mixed = '/'
-
Delimiter for the folder names
- $map : mixed = 'htmlentities'
-
Map the names with this function. Pass null to skip this map function
- $filter : mixed = null
-
Filter folders
Return values
string —htmlentitied path
getPlain()
Gets a plain array with folder properties.
public
getPlain([mixed $deep = false ]) : array<string|int, mixed>
Parameters
- $deep : mixed = false
-
Return the children as plain object array
Return values
array<string|int, mixed> —or null when not visible
getPluginConstantPrefix()
Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
public
getPluginConstantPrefix() : string
Tags
Return values
stringgetRestrictions()
Get the restrictions of this folder.
public
getRestrictions() : array<string|int, string>
Return values
array<string|int, string>getRestrictionsCount()
Get the count of the restrictions.
public
getRestrictionsCount() : int
Return values
intgetSlug()
Returns a sanitized title for the folder. If the slug is empty or forced to, it will be updated in the database, too.
public
getSlug([mixed $force = false ][, mixed $fromSetName = false ]) : string
Parameters
- $force : mixed = false
-
Forces to regenerate the slug
- $fromSetName : mixed = false
-
For internal usage only
Return values
stringhasChildren()
Checks if this folder has a children with a given name.
public
hasChildren(mixed $name[, mixed $returnObject = false ]) : bool
Parameters
- $name : mixed
-
Name of folder
- $returnObject : mixed = false
-
If set to true and a children with this name is found, then return the object for this folder
Return values
boolis()
Check if the folder object is a given type.
public
is(mixed $folder_type) : bool
Parameters
- $folder_type : mixed
-
The folder type
Return values
boolisRestrictFor()
Checks if this folder has a special restriction.
public
isRestrictFor(mixed $restriction) : bool
Parameters
- $restriction : mixed
-
The restriction to check
Return values
boolisVisible()
Check if the folder object is visible to the user.
public
isVisible() : bool
Return values
boolsetRestrictions()
public
setRestrictions([mixed $restrictions = [] ]) : mixed
Parameters
- $restrictions : mixed = []