PHPDoc Real Media Library
  • Namespace
  • Class

Namespaces

  • MatthiasWeb
    • RealMediaLibrary
      • api
  • None

Interfaces

  • IFolder
  • IMetadata
  • IUserSettings

Interface IFolder

This interface provides elementary methods for folder objects. All folder types (Folder, Collection, Gallery, ...) have implemented this interface. Also the root ("Unorganized") is a folder and implements this interface. Usually, the root acts as "-1" but you should use the _wp_rml_root() function to get the root id.

If this interface does not provide an expected method, yet, have a look at the other API files. For example to create a folder use wp_rml_create().

Check if a variable is surely a IFolder interface object:

$folder = wp_rml_get_object_by_id(5);
if (is_rml_folder($folder)) {
     // It is an interface implementation of IFolder
}
Namespace: MatthiasWeb\RealMediaLibrary\api
See: wp_rml_root_childs()
See: wp_rml_get_object_by_id()
See: wp_rml_get_by_id()
See: wp_rml_get_by_absolute_path()
See: wp_rml_objects()
See: is_rml_folder()
Located at IFolder.interface.php

Methods summary

public
# read( string $order = null, string $orderby = null )

Fetch all attachment ids currently in this folder. It uses the default WP_Query to fetch the ids. You can also use the WP_Query like:

$query = new \WP_Query(array(
    'post_status' => 'inherit',
    'post_type' => 'attachment',
    'rml_folder' => 4
));

Fetch all attachment ids currently in this folder. It uses the default WP_Query to fetch the ids. You can also use the WP_Query like:

$query = new \WP_Query(array(
    'post_status' => 'inherit',
    'post_type' => 'attachment',
    'rml_folder' => 4
));

Parameters

$order
The order "ASC" or "DESC"
$orderby
Use "rml" to get ids ordered by custom order

Returns

int[] Post ids
public
# hasChildren( string $slug, boolean $isSlug = true, 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

$slug
Slug or Name of folder
$isSlug
Set it to false if $slug is not slugged
$returnObject
If set to true and a children with this name is found, then return the object for this folder

Returns

boolean
public
# getType( )

Return the type for the given folder. For example: 0 = Folder, 1 = Collection, 2 = Gallery

Return the type for the given folder. For example: 0 = Folder, 1 = Collection, 2 = Gallery

Returns

int
public boolean|int[]
# getAllowedChildrenTypes( )

Get all allowed children folder types.

Get all allowed children folder types.

Returns

boolean|int[]
Array with allowed types or TRUE for all types allowed
public
# getId( )

Get the folder id.

Get the folder id.

Returns

int
public
# getParent( )

Get the parent folder id.

Get the parent folder id.

Returns

int
public
# getName( )

Get the folder name.

Get the folder name.

Returns

string
public
# getSlug( boolean $force = 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

Returns

string
public
# getPath( string $implode = "/" )

Creates a absolute path without slugging' the names.

Creates a absolute path without slugging' the names.

Parameters

$implode
Delimitter for the folder names

Returns

string
public
# getAbsolutePath( boolean $force = 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

Returns

string
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

Returns

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

Get children of this folder.

Get children of this folder.

Returns

MatthiasWeb\RealMediaLibrary\api\IFolder[]
public
# getOrder( )

Get the order number.

Get the order number.

Returns

int
public
# getRestrictions( )

Get the restrictions of this folder.

Get the restrictions of this folder.

Returns

string[]
public
# getRestrictionsCount( )

Get the count of the restrictions.

Get the count of the restrictions.

Returns

int
public
# getChildrens( )

Returns childrens of this folder.

Returns childrens of this folder.

Deprecated

Use IFolder::getChildren()!
public
# getPlain( )

Gets a plain array with folder properties.

Gets a plain array with folder properties.

Returns

array
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
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
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
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
PHPDoc Real Media Library API documentation generated by ApiGen