Overview
  • Namespace
  • Class

Namespaces

  • MatthiasWeb
    • RealMediaLibrary
      • api
      • attachment
      • base
      • comp
        • complexquery
      • folder
      • general
      • metadata
      • order
      • rest
      • usersettings
  • None

Classes

  • BaseFolder
  • Collection
  • Creatable
  • CRUD
  • Folder
  • Gallery
  • Root

Class BaseFolder

Abstract base class for folders. It handles the available fields and getters / setters. The class is completely documentated in the implemented interface.

MatthiasWeb\RealMediaLibrary\base\Base
Extended by MatthiasWeb\RealMediaLibrary\folder\BaseFolder implements MatthiasWeb\RealMediaLibrary\api\IFolder

Direct known subclasses

MatthiasWeb\RealMediaLibrary\folder\Creatable

Indirect known subclasses

MatthiasWeb\RealMediaLibrary\folder\Collection, MatthiasWeb\RealMediaLibrary\folder\Folder, MatthiasWeb\RealMediaLibrary\folder\Gallery, MatthiasWeb\RealMediaLibrary\folder\Root, MatthiasWeb\RealMediaLibrary\order\Sortable

Abstract
Namespace: MatthiasWeb\RealMediaLibrary\folder
Located at folder/BaseFolder.class.php

Methods summary

public
# anyParentHas( string $column, mixed $value = null, string $valueFormat = "%s", boolean $includeSelf = false, integer $until = null )

Get all parents which meets a given column value or column value is not empty.

Get all parents which meets a given column value or column value is not empty.

Parameters

$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
$value
The value the column should have
$valueFormat
The value format for $value ($wpdb->prepare) This string is not escaped when you pass it through this function
$includeSelf
Set true to add self to list
$until
The highest allowed folder id. If null _wp_rml_root() is used

Since

3.3

Returns

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

Implementation of

MatthiasWeb\RealMediaLibrary\api\IFolder::anyParentHas()
public
# anyParentHasMetadata( string $meta_key, mixed $meta_value = null, string $valueFormat = "%s", boolean $includeSelf = false, integer $until = null )

Get all parents which meets a given meta key value or meta key value is not empty.

Get all parents which meets a given meta key value or meta key value is not empty.

Parameters

$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
$meta_value
The value the meta key should have
$valueFormat
The value format for $value ($wpdb->prepare) This string is not escaped when you pass it through this function
$includeSelf
Set true to add self to list
$until
The highest allowed folder id. If null _wp_rml_root() is used

Since

3.3

Returns

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

Implementation of

MatthiasWeb\RealMediaLibrary\api\IFolder::anyParentHasMetadata()
public
# anyChildrenHas( string $column, mixed $value = null, string $valueFormat = "%s", boolean $includeSelf = false )

Get all children which meets a given column value or column value is not empty.

Get all children which meets a given column value or column value is not empty.

Parameters

$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
$value
The value the column should have
$valueFormat
The value format for $value ($wpdb->prepare) This string is not escaped when you pass it through this function
$includeSelf
Set true to add self to list

Since

3.3

Returns

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

Implementation of

MatthiasWeb\RealMediaLibrary\api\IFolder::anyChildrenHas()
public
# anyChildrenHasMetadata( string $meta_key, mixed $meta_value = null, string $valueFormat = "%s", boolean $includeSelf = false )

Get all chilren which meets a given meta key value or meta key value is not empty.

Get all chilren which meets a given meta key value or meta key value is not empty.

Parameters

$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
$meta_value
The value the meta key should have
$valueFormat
The value format for $value ($wpdb->prepare) This string is not escaped when you pass it through this function
$includeSelf
Set true to add self to list

Since

3.3

Returns

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

Implementation of

MatthiasWeb\RealMediaLibrary\api\IFolder::anyChildrenHasMetadata()
public
# hasChildren( string $name, boolean $returnObject = false )

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

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

Parameters

$name
Name of folder
$returnObject
If set to true and a children with this name is found, then return the object for this folder

Since

3.3 Now it checks for a given folder name instead the slug

Returns

boolean

Implementation of

MatthiasWeb\RealMediaLibrary\api\IFolder::hasChildren()
public
# getId( )

Get the folder id.

Get the folder id.

Returns

int

Implementation of

MatthiasWeb\RealMediaLibrary\api\IFolder::getId()
public
# getParent( )

Get the parent folder id.

Get the parent folder id.

Returns

int

Implementation of

MatthiasWeb\RealMediaLibrary\api\IFolder::getParent()
public
# getAllParents( integer $until = null, integer $colIdx = 0 )

Get all parents of this folder.

Get all parents of this folder.

Parameters

$until
The highest allowed folder id. If null _wp_rml_root() is used
$colIdx
The index returning for the wp_rml_create_all_parents_sql() query

Since

3.3

Returns

int[] Folder ids, first id is the first parent

Implementation of

MatthiasWeb\RealMediaLibrary\api\IFolder::getAllParents()
public
# getName( boolean $htmlentities = false )

Get the folder name.

Get the folder name.

Parameters

$htmlentities
If true the name is returned htmlentitied for output

Returns

string

Implementation of

MatthiasWeb\RealMediaLibrary\api\IFolder::getName()
public
# getSlug( boolean $force = false, $fromSetName = false )

Returns a santitized title for the folder. If the slug is empty or forced to, it will be updated in the database, too.

Returns a santitized title for the folder. If the slug is empty or forced to, it will be updated in the database, too.

Parameters

$force
Forces to regenerate the slug
$fromSetName

Returns

string

Implementation of

MatthiasWeb\RealMediaLibrary\api\IFolder::getSlug()
public
# getPath( string $implode = "/", callable $map = "htmlentities" )

Creates a absolute path without slugging' the names.

Creates a absolute path without slugging' the names.

Parameters

$implode
Delimitter for the folder names
$map
Map the names with this function. Pass null to skip this map function

Example

// Get valid physical folder name
$folder->getPath("/", "_wp_rml_sanitize_filename")

Returns

string htmlentitied path

Implementation of

MatthiasWeb\RealMediaLibrary\api\IFolder::getPath()
public
# getOwner( )

Get the creator/owner of the folder.

Get the creator/owner of the folder.

Since

3.3

Returns

int ID of the user

Implementation of

MatthiasWeb\RealMediaLibrary\api\IFolder::getOwner()
public
# getAbsolutePath( boolean $force = false, $fromSetName = false )

Creates a absolute path. If the absolute path is empty or forced to, it will be updated in the database, too.

Creates a absolute path. If the absolute path is empty or forced to, it will be updated in the database, too.

Parameters

$force
Forces to regenerate the absolute path
$fromSetName

Returns

string

Implementation of

MatthiasWeb\RealMediaLibrary\api\IFolder::getAbsolutePath()
public
# getCnt( boolean $forceReload = false )

Gets the count of the files in this folder.

Gets the count of the files in this folder.

Parameters

$forceReload
If true the count cache gets reloaded

Since

3.3.1

Returns

int

Implementation of

MatthiasWeb\RealMediaLibrary\api\IFolder::getCnt()
public IFolder[]
# getChildren( )

Get children of this folder.

Get children of this folder.

Returns

IFolder[]

Implementation of

MatthiasWeb\RealMediaLibrary\api\IFolder::getChildren()
public
# getOrder( )

Get the order number.

Get the order number.

Since

3.3.1

Returns

int

Implementation of

MatthiasWeb\RealMediaLibrary\api\IFolder::getOrder()
public
# getRestrictions( )

Get the restrictions of this folder.

Get the restrictions of this folder.

Returns

string[]

Implementation of

MatthiasWeb\RealMediaLibrary\api\IFolder::getRestrictions()
public
# getRestrictionsCount( )

Get the count of the restrictions.

Get the count of the restrictions.

Returns

int

Implementation of

MatthiasWeb\RealMediaLibrary\api\IFolder::getRestrictionsCount()
public
# getPlain( boolean $deep = false )

Gets a plain array with folder properties.

Gets a plain array with folder properties.

Parameters

$deep
Return the children as plain object array

Returns

array

Implementation of

MatthiasWeb\RealMediaLibrary\api\IFolder::getPlain()
public
# setRestrictions( string[] $restrictions = array() )

Set restrictions for this folder. Allowed restrictions for folders:

Set restrictions for this folder. Allowed restrictions for folders:

  • par Restrict to change the parent id
  • rea Restrict to rearrange the hierarchical levels of all subfolders (it is downwards all subfolders!) and can not be inherited
  • cre Restrict to create new subfolders
  • ins Restrict to insert/upload new attachments, automatically moved to root if upload
  • ren Restrict to rename the folder
  • del Restrict to delete the folder
  • mov Restrict to move files outside the folder

You can append a ">" after each permission so it is inherited in each created subfolder: "cre>", "ins>", ...

Parameters

$restrictions
Array with restrictions

Returns

boolean

Implementation of

MatthiasWeb\RealMediaLibrary\api\IFolderActions::setRestrictions()
public
# is( integer $folder_type )

Check if the folder object is a given type.

Check if the folder object is a given type.

Parameters

$folder_type
The folder type

Returns

boolean

Implementation of

MatthiasWeb\RealMediaLibrary\api\IFolder::is()
public
# isRestrictFor( string $restriction )

Checks if this folder has a special restriction.

Checks if this folder has a special restriction.

Parameters

$restriction
The restriction to check

See

IFolder::setRestrictions()

Returns

boolean

Implementation of

MatthiasWeb\RealMediaLibrary\api\IFolder::isRestrictFor()
public
# isValidChildrenType( integer $type )

Checks if a given folder type is allowed in this folder.

Checks if a given folder type is allowed in this folder.

Parameters

$type
The type

See

IFolder::getAllowedChildrenTypes()

Returns

boolean

Implementation of

MatthiasWeb\RealMediaLibrary\api\IFolder::isValidChildrenType()

Methods inherited from MatthiasWeb\RealMediaLibrary\base\Base

debug(), getCore(), getTableName()

Methods inherited from MatthiasWeb\RealMediaLibrary\api\IFolder

getAllowedChildrenTypes(), getMaxOrder(), getRowData(), getType(), getTypeDescription(), getTypeName()

Methods inherited from MatthiasWeb\RealMediaLibrary\api\IFolderContent

contentDeleteOrder(), contentEnableOrder(), contentIndex(), contentOrder(), contentReindex(), contentRestoreOldCustomNr(), getAttachmentNextTo(), getContentAggregationNr(), getContentCustomOrder(), getContentNrOf(), getContentOldCustomNrCount(), getContentOrderNumbers(), isContentCustomOrderAllowed()

Methods inherited from MatthiasWeb\RealMediaLibrary\api\IFolderActions

insert(), read(), reindexChildrens(), relocate(), setName(), setParent(), updateThisAndChildrensAbsolutePath()

Properties summary

protected $id
#
protected $parent
#
protected $name
#
protected $cnt
#
protected $order
#
protected $slug
#
protected $absolutePath
#
protected $row
#
protected $children
#
protected array $restrictions
# array()
protected integer $restrictionsCount
# 0
protected array $systemReservedFolders
# array("/", "..", ".")
protected $contentCustomOrder
#
public array $orderNumbers
# array()
API documentation generated by ApiGen