PHP Class VersionPress\Database\ShortcodesReplacer

!!! This class uses many functions of wp-includes/shortcodes.php, there is no easy way around it.
Afficher le fichier Open project: versionpress/versionpress Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( ShortcodesInfo $shortcodeInfo, VpidRepository $vpidRepository )
entityCanContainShortcodes ( string $entityName ) : boolean Return true if entity can contain shortcodes
fieldCanContainShortcodes ( string $entityName, string $field ) : boolean Return true if a field on an entity can contain shortcodes
replaceShortcodesInEntity ( string $entityName, array $entity ) : array Translates IDs to VPIDs in shortcodes for an entity
restoreShortcodesInEntity ( string $entityName, array $entity ) : array Translates VPIDs to IDs in shortcodes for an entity

Private Methods

Méthode Description
createReplaceCallback ( $idProvider )
getIdByVpid ( $entityName, $vpid )
getVpidByEntityNameAndId ( $entityName, $id )
replaceShortcodes ( string $string ) : string Translates IDs to VPIDs in shortcodes.
restoreShortcodes ( string $string ) : string Translates VPIDs to IDs in shortcodes.

Method Details

__construct() public méthode

public __construct ( ShortcodesInfo $shortcodeInfo, VpidRepository $vpidRepository )
$shortcodeInfo ShortcodesInfo
$vpidRepository VpidRepository

entityCanContainShortcodes() public méthode

Return true if entity can contain shortcodes
public entityCanContainShortcodes ( string $entityName ) : boolean
$entityName string
Résultat boolean

fieldCanContainShortcodes() public méthode

Return true if a field on an entity can contain shortcodes
public fieldCanContainShortcodes ( string $entityName, string $field ) : boolean
$entityName string E.g., 'post'
$field string E.g., 'post_content'
Résultat boolean

replaceShortcodesInEntity() public méthode

Translates IDs to VPIDs in shortcodes for an entity
public replaceShortcodesInEntity ( string $entityName, array $entity ) : array
$entityName string
$entity array Entity data, see {@link WpdbMirrorBridge}
Résultat array Entity data

restoreShortcodesInEntity() public méthode

Translates VPIDs to IDs in shortcodes for an entity
public restoreShortcodesInEntity ( string $entityName, array $entity ) : array
$entityName string
$entity array Entity data, see {@link WpdbMirrorBridge}
Résultat array Entity data