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 Creatable

Abstract class for a creatable folder item. It handles all general actions for a folder item. If you want to add an new folder type, have a look at the api function wp_rml_register_creatable();

A new folder type MUST have the implementation with class FOLDERTYPE extends order\Sortable because every folder can also be sortable!

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

Direct known subclasses

MatthiasWeb\RealMediaLibrary\order\Sortable

Indirect known subclasses

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

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

Methods summary

public
# __construct( $id, $parent = -1, $name = "", $slug = "", $absolute = "", $order = -1, $cnt = 0, $row = array() )

C'tor with the main properties.

C'tor with the main properties.

The constructor does not throw any errors because when it is fully filled with parameters it expects the right properties from the database.

Only ::instance and ::create should create instances from this class!

Synced with order\Sortable::__construct

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
# relocate( integer $parentId, integer $nextFolderId = false )

Relocate a folder to a given place in the folder structure.

Relocate a folder to a given place in the folder structure.

Parameters

$parentId
The parent id
$nextFolderId
The next folder id it should be prepend or false for the end

Throws

Exception

Returns

boolean|string[] true or array with errors
public
# reindexChildrens( boolean $resetData = false )

Reindex the children folders so the "ord" number is setted right.

Reindex the children folders so the "ord" number is setted right.

Parameters

$resetData
If true, the structure is resetted

See

IFolder::getOrder
public true
# insert( int[] $ids, boolean $supress_validation = false, boolean $isShortcut = false )

Insert an amount of post ID's (attachments) to this folder.

Insert an amount of post ID's (attachments) to this folder.

Parameters

$ids
Array of post ids
$supress_validation
Supress the permission validation
$isShortcut
Determines, if the post's should be "copied" to the folder (no physical copy)

Returns

true

Throws

Exception

See

wp_rml_move()
wp_rml_create_shortcuts()
protected
# singleCheckInsertPermissions( integer $id )

Simply check, if an id can be inserted in this folder. If something is wrong with the id, please throw an exception!

Simply check, if an id can be inserted in this folder. If something is wrong with the id, please throw an exception!

Parameters

$id
The id

Throws

Exception
protected
# singleCheckInsert( integer $id )

Simply check, if an id can be inserted in this folder. If something is wrong with the id, please throw an exception!

Simply check, if an id can be inserted in this folder. If something is wrong with the id, please throw an exception!

Parameters

$id
The id

Throws

Exception
public
# persist( )

Persist the given creatable with the database. Think about it, that this only works, when the ID === -1 (that means, it will be a new folder).

Persist the given creatable with the database. Think about it, that this only works, when the ID === -1 (that means, it will be a new folder).

After the folder is created, this instance is useless, you must get the folder with the API wp_rml_get_by_id

Throws

Exception

Returns

integer ID of the newly created folder
public
# updateThisAndChildrensAbsolutePath( )

Iterate all chrildren of this folder recursivly and update the absolute pathes. Use this function with caution because it can be time intensive.

Iterate all chrildren of this folder recursivly and update the absolute pathes. Use this function with caution because it can be time intensive.

public
# addChildren( $children )

DO NOT USE THIS FUNCTION! IT IS ONLY FOR STRUCTURE PURPOSES.

DO NOT USE THIS FUNCTION! IT IS ONLY FOR STRUCTURE PURPOSES.

public
# getMaxOrder( )

Get the maximal order number of the children.

Get the maximal order number of the children.

Since

3.3.1

Returns

integer Max order number
public
# getRowData( string $field = null )

Get the full row of the SQL query.

Get the full row of the SQL query.

Parameters

$field
The field name

Since

3.3

Returns

mixed Any object or false
public
# getTypeName( string $default = null )

Get the type name for this folder. For example: Folder, Collection, Gallery, Unorganized.

Get the type name for this folder. For example: Folder, Collection, Gallery, Unorganized.

Parameters

$default
The default (if null "Folder" is used as default)

Since

3.3.1

See

Filter RML/Folder/Type/Name

Returns

string
public
# getTypeDescription( string $default = null )

Get the type description for this folder.

Get the type description for this folder.

Parameters

$default
The default (if null folder description is used as default)

Since

3.3.1

See

Filter RML/Folder/Type/Description

Returns

string
public
# setParent( integer $id, integer $ord = -1, boolean $force = false )

Changes the parent folder of this folder.

Changes the parent folder of this folder.

Parameters

$id
The new parent (use -1 for root)
$ord
The order number
$force
If true no permission checks are executed

Throws

Exception

Returns

boolean
public
# setName( string $name, boolean $supress_validation = false )

Renames a folder and then checks, if there is no duplicate folder in the parent folder.

Renames a folder and then checks, if there is no duplicate folder in the parent folder.

Parameters

$name
String New name of the folder
$supress_validation
Supress the permission validation

Throws

Exception

Returns

boolean
public
# isValidName( string $name )

Checks, if a given folder name is valid. The name is also santisized so there can be no problem for physical moves for example.

Checks, if a given folder name is valid. The name is also santisized so there can be no problem for physical moves for example.

Parameters

$name
The folder name

Returns

boolean
public static
# xread( integer $id, string $order = null, string $orderby = null )

Read ids for a given folder id.

Read ids for a given folder id.

Parameters

$id
The folder id (-1 for root)
$order
The order
$orderby
The order by

Returns

array with ids

Methods inherited from MatthiasWeb\RealMediaLibrary\folder\BaseFolder

anyChildrenHas(), anyChildrenHasMetadata(), anyParentHas(), anyParentHasMetadata(), getAbsolutePath(), getAllParents(), getChildren(), getCnt(), getId(), getName(), getOrder(), getOwner(), getParent(), getPath(), getPlain(), getRestrictions(), getRestrictionsCount(), getSlug(), hasChildren(), is(), isRestrictFor(), isValidChildrenType(), setRestrictions()

Methods inherited from MatthiasWeb\RealMediaLibrary\base\Base

debug(), getCore(), getTableName()

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\IFolder

getAllowedChildrenTypes(), getType()

Properties summary

Properties inherited from MatthiasWeb\RealMediaLibrary\folder\BaseFolder

$absolutePath, $children, $cnt, $contentCustomOrder, $id, $name, $order, $orderNumbers, $parent, $restrictions, $restrictionsCount, $row, $slug, $systemReservedFolders

API documentation generated by ApiGen