Shortcut
in package
Uses
UtilsProvider
Handle the metadata and attached file for shortcuts.
Table of Contents
Properties
- $lastIds : mixed
- The last generated shortcut ids.
- $lockCreate : mixed
- Avoid recursive creation of shortcuts.
- $me : mixed
Methods
- _resetLastIds() : mixed
- This function should only be used in the Creatable::insert() function.
- add_post_metadata() : mixed
- Avoids to generate own meta data for shortcuts.
- create() : bool
- Creates a shortcut.
- delete_attachment() : mixed
- Delete all associated shortcuts.
- get_post_metadata() : mixed
- If it is a shortcut, read the metadata from the source file.
- getInstance() : Shortcut
- Get instance.
- getLastIds() : array<string|int, int>
- Get last generated shortcut ids.
- getPluginConstantPrefix() : string
- Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
- update_post_metadata() : mixed
- Avoids to generate own meta data for shortcuts.
- __construct() : mixed
- C'tor.
- isInheritableMetaKey() : bool
- Check if a meta key is inheritable.
Properties
$lastIds
The last generated shortcut ids.
private
mixed
$lastIds
= false
$lockCreate
Avoid recursive creation of shortcuts.
private
mixed
$lockCreate
= false
$me
private
static mixed
$me
= null
Methods
_resetLastIds()
This function should only be used in the Creatable::insert() function.
public
_resetLastIds() : mixed
add_post_metadata()
Avoids to generate own meta data for shortcuts.
public
add_post_metadata(mixed $check, int $object_id, string $meta_key, string $meta_value, bool $unique) : mixed
Parameters
- $check : mixed
- $object_id : int
- $meta_key : string
- $meta_value : string
- $unique : bool
create()
Creates a shortcut.
public
create(int $postId, int $fid[, bool $isShortcut = false ]) : bool
Parameters
- $postId : int
- $fid : int
- $isShortcut : bool = false
Tags
Return values
booldelete_attachment()
Delete all associated shortcuts.
public
delete_attachment(int $postId) : mixed
Parameters
- $postId : int
get_post_metadata()
If it is a shortcut, read the metadata from the source file.
public
get_post_metadata(mixed $check, int $object_id, string $meta_key, bool $single) : mixed
It also handles the wp_delete_attachment process to avoid to delete the source files if shortcut.
Parameters
- $check : mixed
- $object_id : int
- $meta_key : string
- $single : bool
getInstance()
Get instance.
public
static getInstance() : Shortcut
Return values
ShortcutgetLastIds()
Get last generated shortcut ids.
public
getLastIds() : array<string|int, int>
Tags
Return values
array<string|int, int>getPluginConstantPrefix()
Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
public
getPluginConstantPrefix() : string
Tags
Return values
stringupdate_post_metadata()
Avoids to generate own meta data for shortcuts.
public
update_post_metadata(mixed $check, int $object_id, string $meta_key, string $meta_value, string $prev_value) : mixed
Parameters
- $check : mixed
- $object_id : int
- $meta_key : string
- $meta_value : string
- $prev_value : string
__construct()
C'tor.
private
__construct() : mixed
isInheritableMetaKey()
Check if a meta key is inheritable.
private
isInheritableMetaKey(string $meta_key[, bool $withAttached = true ]) : bool
Parameters
- $meta_key : string
- $withAttached : bool = true