Documentation

BaseFolder
in package
implements IFolder Uses UtilsProvider

AbstractYes

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

$contentCustomOrder

protected mixed $contentCustomOrder

$restrictions

protected mixed $restrictions = []

$restrictionsCount

protected mixed $restrictionsCount = 0

$systemReservedFolders

protected mixed $systemReservedFolders = ['/', '..', '.']

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
string

getAllParents()

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

getCnt()

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
int

getId()

Get the folder id.

public getId() : int
Return values
int

getName()

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
string

getOrder()

Get the order number.

public getOrder() : int
Return values
int

getOwner()

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
int

getPath()

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
codeCoverageIgnore

It only returns a string with the constant prefix

Return values
string

getRestrictions()

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
int

getSlug()

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
string

hasChildren()

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
bool

is()

Check if the folder object is a given type.

public is(mixed $folder_type) : bool
Parameters
$folder_type : mixed

The folder type

Return values
bool

isRestrictFor()

Checks if this folder has a special restriction.

public isRestrictFor(mixed $restriction) : bool
Parameters
$restriction : mixed

The restriction to check

Return values
bool

isVisible()

Check if the folder object is visible to the user.

public isVisible() : bool
Return values
bool

setRestrictions()

public setRestrictions([mixed $restrictions = [] ]) : mixed
Parameters
$restrictions : mixed = []

        
On this page

Search results