\MatthiasWeb\RealMediaLibrary\attachmentShortcut

Handle the metadata and attached file for shortcuts.

Summary

Methods
Properties
Constants
getPluginConstantPrefix()
create()
get_post_metadata()
add_post_metadata()
update_post_metadata()
getLastIds()
delete_attachment()
_resetLastIds()
getInstance()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
__construct()
isInheritableMetaKey()
$me
$lockCreate
$lastIds
N/A

Properties

$me

$me :

Type

$lockCreate

$lockCreate :

Avoid recursive creation of shortcuts.

Type

$lastIds

$lastIds :

The last generated shortcut ids.

Type

Methods

getPluginConstantPrefix()

getPluginConstantPrefix(): string

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

Returns

string

create()

create(integer  $postId,integer  $fid,boolean  $isShortcut = false): boolean

Creates a shortcut.

Parameters

integer $postId
integer $fid
boolean $isShortcut

Returns

boolean

get_post_metadata()

get_post_metadata(mixed  $check,integer  $object_id,string  $meta_key,boolean  $single): mixed

If it is a shortcut, read the metadata from the source file.

It also handles the wp_delete_attachment process to avoid to delete the source files if shortcut.

Parameters

mixed $check
integer $object_id
string $meta_key
boolean $single

Returns

mixed

add_post_metadata()

add_post_metadata(mixed  $check,integer  $object_id,string  $meta_key,string  $meta_value,boolean  $unique): mixed

Avoids to generate own meta data for shortcuts.

Parameters

mixed $check
integer $object_id
string $meta_key
string $meta_value
boolean $unique

Returns

mixed

update_post_metadata()

update_post_metadata(mixed  $check,integer  $object_id,string  $meta_key,string  $meta_value,string  $prev_value): mixed

Avoids to generate own meta data for shortcuts.

Parameters

mixed $check
integer $object_id
string $meta_key
string $meta_value
string $prev_value

Returns

mixed

getLastIds()

getLastIds(): array<mixed,integer>

Get last generated shortcut ids.

Returns

array<mixed,integer>

delete_attachment()

delete_attachment(integer  $postId)

Delete all associated shortcuts.

Parameters

integer $postId

_resetLastIds()

_resetLastIds()

This function should only be used in the Creatable::insert() function.

__construct()

__construct()

C'tor.

isInheritableMetaKey()

isInheritableMetaKey(string  $meta_key,boolean  $withAttached = true): boolean

Check if a meta key is inheritable.

Parameters

string $meta_key
boolean $withAttached

Returns

boolean