\MatthiasWeb\RealMediaLibrary\folderBaseFolder

Abstract base class for folders. It handles the available fields and getters / setters.

The class is completely documented in the implemented interface.

Summary

Methods
Properties
Constants
getPluginConstantPrefix()
anyParentHas()
anyParentHasMetadata()
anyChildrenHas()
anyChildrenHasMetadata()
hasChildren()
getId()
getParent()
getAllParents()
getName()
getSlug()
getPath()
getOwner()
getAbsolutePath()
getCnt()
getChildren()
getOrder()
getRestrictions()
getRestrictionsCount()
getPlain()
setRestrictions()
is()
isVisible()
isRestrictFor()
No public properties found
No constants found
No protected methods found
$id
$parent
$name
$cnt
$order
$slug
$absolutePath
$row
$children
$visible
$restrictions
$restrictionsCount
$systemReservedFolders
$contentCustomOrder
N/A
No private methods found
No private properties found
N/A

Properties

$id

$id :

Type

$parent

$parent :

Type

$name

$name :

Type

$cnt

$cnt :

Type

$order

$order :

Type

$slug

$slug :

Type

$absolutePath

$absolutePath :

Type

$row

$row :

Type

$children

$children :

Type

$visible

$visible :

Type

$restrictions

$restrictions :

Type

$restrictionsCount

$restrictionsCount :

Type

$systemReservedFolders

$systemReservedFolders :

Type

$contentCustomOrder

$contentCustomOrder :

Type

Methods

getPluginConstantPrefix()

getPluginConstantPrefix(): string

Get the prefix of this plugin so composer packages can dynamically build other constant values on it.

Returns

string

anyParentHas()

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.

Parameters

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

Returns

array —

folderId => columnValue, first id is the first found parent

anyParentHasMetadata()

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.

Parameters

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

Returns

array —

Array with keys: id (meta_id), folderId, value (meta_value), first id is the first found parent

anyChildrenHas()

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.

Parameters

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

Returns

array —

folderId => columnValue, first id is the first found child

anyChildrenHasMetadata()

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.

Parameters

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

Returns

array —

Array with keys: id (meta_id), folderId, value (meta_value), first id is the first found child

hasChildren()

hasChildren(string  $name,boolean  $returnObject = false): boolean

Checks if this folder has a children with a given name.

Parameters

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

Returns

boolean

getId()

getId(): integer

Get the folder id.

Returns

integer

getParent()

getParent(): integer

Get the parent folder id.

Returns

integer

getAllParents()

getAllParents(integer  $until = null,integer  $colIdx): array<mixed,integer>

Get all parents of this folder.

Parameters

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

Returns

array<mixed,integer> —

Folder ids, first id is the first parent

getName()

getName(boolean  $htmlentities = false): string

Get the folder name.

Parameters

boolean $htmlentities

If true the name is returned htmlentitied for output

Returns

string

getSlug()

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.

Parameters

boolean $force

Forces to regenerate the slug

boolean $fromSetName

For internal usage only

Returns

string

getPath()

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");

Parameters

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

Returns

string —

htmlentitied path

getOwner()

getOwner(): integer

Get the creator/owner of the folder.

Returns

integer —

ID of the user

getAbsolutePath()

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.

Parameters

boolean $force

Forces to regenerate the absolute path

boolean $fromSetName

For internal usage only

Returns

string

getCnt()

getCnt(boolean  $forceReload = false): integer

Gets the count of the files in this folder.

Parameters

boolean $forceReload

If true the count cache gets reloaded

Returns

integer

getOrder()

getOrder(): integer

Get the order number.

Returns

integer

getRestrictions()

getRestrictions(): array<mixed,string>

Get the restrictions of this folder.

Returns

array<mixed,string>

getRestrictionsCount()

getRestrictionsCount(): integer

Get the count of the restrictions.

Returns

integer

getPlain()

getPlain(boolean  $deep = false): array

Gets a plain array with folder properties.

Parameters

boolean $deep

Return the children as plain object array

Returns

array —

or null when not visible

setRestrictions()

setRestrictions(  $restrictions = array())

Parameters

$restrictions

is()

is(integer  $folder_type): boolean

Check if the folder object is a given type.

Parameters

integer $folder_type

The folder type

Returns

boolean

isVisible()

isVisible(): boolean

Check if the folder object is visible to the user.

Returns

boolean

isRestrictFor()

isRestrictFor(string  $restriction): boolean

Checks if this folder has a special restriction.

Parameters

string $restriction

The restriction to check

Returns

boolean