class ShortcodeParser extends Object

A simple parser that allows you to map BBCode-like "shortcodes" to an arbitrary callback.

It is a simple regex based parser that allows you to replace simple bbcode-like tags within a HTMLText or HTMLVarchar field when rendered into a template. The API is inspired by and very similar to the Wordpress implementation of shortcodes.

Constants

WARN

STRIP

LEAVE

ERROR

BEFORE

AFTER

SPLIT

INLINE

Properties

string $class from Object
protected array $extension_instances from Object
protected array[callable] $beforeExtendCallbacks List of callbacks to call prior to extensions having extend called on them, each grouped by methodName. from Object
protected array[callable] $afterExtendCallbacks List of callbacks to call after extensions having extend called on them, each grouped by methodName. from Object
static protected $instances
static protected $active_instance
protected $shortcodes Registered shortcodes. Items follow this structure: [shortcode_name] => Array( [0] => class_containing_handler [1] => name_of_shortcode_handler_method )
static protected $marker_class
static protected $block_level_elements
static protected $attrrx
static protected $tagrx
static $error_behavior

Methods

static Config_ForClass|null
config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .

from Object
beforeExtending(string $method, callable $callback)

Allows user code to hook into Object::extend prior to control being delegated to extensions. Each callback will be reset once called.

from Object
afterExtending(string $method, callable $callback)

Allows user code to hook into Object::extend after control being delegated to extensions. Each callback will be reset once called.

from Object
static Object
create()

An implementation of the factory method, allows you to create an instance of a class

from Object
static Object
singleton()

Creates a class instance by the "singleton" design pattern.

from Object
static 
create_from_string($classSpec, $firstArg = null)

Create an object from a string representation. It treats it as a PHP constructor without the 'new' keyword. It also manages to construct the object without the use of eval().

from Object
static 
parse_class_spec($classSpec)

Parses a class-spec, such as "Versioned('Stage','Live')", as passed to create_from_string().

from Object
static Object
strong_create()

Similar to {@link Object::create()}, except that classes are only overloaded if you set the $strong parameter to TRUE when using {@link Object::useCustomClass()}

from Object
static 
useCustomClass(string $oldClass, string $newClass, bool $strong = false)

This class allows you to overload classes with other classes when they are constructed using the factory method {@link Object::create()}

from Object
static string
getCustomClass(string $class)

If a class has been overloaded, get the class name it has been overloaded with - otherwise return the class name

from Object
static any
static_lookup($class, $name, null $default = null)

Get the value of a static property of a class, even in that property is declared protected (but not private), without any inheritance, merging or parent lookup if it doesn't exist on the given class.

from Object
static 
get_static($class, $name, $uncached = false) deprecated

No description

from Object
static 
set_static($class, $name, $value) deprecated

No description

from Object
static 
uninherited_static($class, $name, $uncached = false) deprecated

No description

from Object
static 
combined_static($class, $name, $ceiling = false) deprecated

No description

from Object
static 
addStaticVars($class, $properties, $replace = false) deprecated

No description

from Object
static 
add_static_var($class, $name, $value, $replace = false) deprecated

No description

from Object
static 
has_extension(string $classOrExtension, string $requiredExtension = null, boolean $strict = false)

Return TRUE if a class has a specified extension.

from Object
static 
add_extension(string $classOrExtension, string $extension = null)

Add an extension to a specific class.

from Object
static 
remove_extension(string $extension)

Remove an extension from a class.

from Object
static array
get_extensions(string $class, bool $includeArgumentString = false)

No description

from Object
static 
get_extra_config_sources($class = null)

No description

from Object
__construct()

No description

from Object
mixed
__call(string $method, array $arguments)

Attemps to locate and call a method dynamically added to a class at runtime if a default cannot be located

from Object
bool
hasMethod(string $method)

Return TRUE if a method exists on this object

from Object
array
allMethodNames(bool $custom = false)

Return the names of all the methods available on this object

from Object
defineMethods()

Adds any methods from {@link Extension} instances attached to this object.

from Object
array
findMethodsFromExtension(object $extension)

No description

from Object
addMethodsFrom(string $property, string|int $index = null)

Add all the methods from an object property (which is an {@link Extension}) to this object.

from Object
removeMethodsFrom(string $property, string|int $index = null)

Add all the methods from an object property (which is an {@link Extension}) to this object.

from Object
addWrapperMethod(string $method, string $wrap)

Add a wrapper method - a method which points to another method with a different name. For example, Thumbnail(x) can be wrapped to generateThumbnail(x)

from Object
createMethod(string $method, string $code)

Add an extra method using raw PHP code passed as a string

from Object
stat($name, $uncached = false)

No description

from Object
set_stat($name, $value)

No description

from Object
uninherited($name)

No description

from Object
bool
exists()

Return true if this object "exists" i.e. has a sensible value

from Object
string
parentClass()

No description

from Object
bool
is_a(string $class)

Check if this class is an instance of a specific class, or has that class as one of its parents

from Object
string
__toString()

No description

from Object
mixed
invokeWithExtensions(string $method, mixed $argument = null)

Calls a method if available on both this object and all applied {@link Extensions}, and then attempts to merge all results into an array

from Object
array
extend($method, $a1 = null, $a2 = null, $a3 = null, $a4 = null, $a5 = null, $a6 = null, $a7 = null)

Run the given function on all of this object's extensions. Note that this method originally returned void, so if you wanted to return results, you're hosed

from Object
getExtensionInstance(string $extension)

Get an extension instance attached to this object by name.

from Object
bool
hasExtension(string $extension)

Returns TRUE if this object instance has a specific extension applied in {@link $extension_instances}. Extension instances are initialized at constructor time, meaning if you use {@link add_extension()} afterwards, the added extension will just be added to new instances of the extended class. Use the static method {@link has_extension()} to check if a class (not an instance) has a specific extension.

from Object
array
getExtensionInstances()

Get all extension instances for this specific object instance.

from Object
mixed
cacheToFile(string $method, int $lifetime = 3600, string $ID = false, array $arguments = array())

Cache the results of an instance method in this object to a file, or if it is already cache return the cached results

from Object
clearCache($method, $ID = false, $arguments = array())

Clears the cache for the given cacheToFile call

from Object
mixed
loadCache(string $cache, int $lifetime = 3600)

Loads a cache from the filesystem if a valid on is present and within the specified lifetime

from Object
saveCache(string $cache, mixed $data)

Save a piece of cached data to the file system

from Object
string
sanitiseCachename(string $name)

Strip a file name of special characters so it is suitable for use as a cache file name

from Object
img_shortcode($attrs)

No description

static ShortcodeParser
get(string $identifier = 'default')

Get the {@link ShortcodeParser} instance that is attached to a particular identifier.

static ShortcodeParser
get_active()

Get the currently active/default {@link ShortcodeParser} instance.

static 
set_active(string $identifier)

Set the identifier to use for the current active/default {@link ShortcodeParser} instance.

register(string $shortcode, callback $callback)

Register a shortcode, and attach it to a PHP callback.

bool
registered(string $shortcode)

Check if a shortcode has been registered.

unregister(string $shortcode)

Remove a specific registered shortcode.

array
getRegisteredShortcodes()

Get an array containing information about registered shortcodes

clear()

Remove all registered shortcodes.

callShortcode($tag, $attributes, $content, $extra = array())

Call a shortcode and return its replacement text Returns false if the shortcode isn't registered

getShortcodeReplacementText($tag, $extra = array(), $isHTMLAllowed = true)

Return the text to insert in place of a shoprtcode.

removeNode($node)

No description

insertAfter($new, $after)

No description

insertListAfter($new, $after)

No description

static 
attrrx()

No description

static 
tagrx()

No description

array
extractTags(string $content)

Look through a string that contains shortcode tags and pull out the locations and details of those tags

string
replaceTagsWithText($content, $tags, $generator)

Replaces the shortcode tags extracted by extractTags with HTML element "markers", so that we can parse the resulting string as HTML and easily mutate the shortcodes in the DOM

replaceAttributeTagsWithContent($htmlvalue)

Replace the shortcodes in attribute values with the calculated content

replaceElementTagsWithMarkers(string $content)

Replace the element-scoped tags with markers

findParentsForMarkers($nodes)

No description

moveMarkerToCompliantHome($node, $parent, $location)

Given a node with represents a shortcode marker and a location string, mutates the DOM to put the marker in the compliant location

replaceMarkerWithContent(DOMElement $node, array $tag)

Given a node with represents a shortcode marker and some information about the shortcode, call the shortcode handler & replace the marker with the actual content

string
parse(string $content)

Parse a string, and replace any registered shortcodes within it with the result of the mapped callback.

Details

in Object at line 60
static Config_ForClass|null config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .

....).

Return Value

Config_ForClass|null

in Object at line 85
protected beforeExtending(string $method, callable $callback)

Allows user code to hook into Object::extend prior to control being delegated to extensions. Each callback will be reset once called.

Parameters

string $method The name of the method to hook into
callable $callback The callback to execute

in Object at line 108
protected afterExtending(string $method, callable $callback)

Allows user code to hook into Object::extend after control being delegated to extensions. Each callback will be reset once called.

Parameters

string $method The name of the method to hook into
callable $callback The callback to execute

in Object at line 132
static Object create()

An implementation of the factory method, allows you to create an instance of a class

This method first for strong class overloads (singletons & DB interaction), then custom class overloads. If an overload is found, an instance of this is returned rather than the original class. To overload a class, use {@link Object::useCustomClass()}

This can be called in one of two ways - either calling via the class directly, or calling on Object and passing the class name as the first parameter. The following are equivalent: $list = DataList::create('SiteTree'); $list = SiteTree::get();

Return Value

Object

in Object at line 155
static Object singleton()

Creates a class instance by the "singleton" design pattern.

It will always return the same instance for this class, which can be used for performance reasons and as a simple way to access instance methods which don't rely on instance data (e.g. the custom SilverStripe static handling).

Return Value

Object The singleton instance

in Object at line 190
static create_from_string($classSpec, $firstArg = null)

Create an object from a string representation. It treats it as a PHP constructor without the 'new' keyword. It also manages to construct the object without the use of eval().

Construction itself is done with Object::create(), so that Object::useCustomClass() calls are respected.

Object::create_from_string("Versioned('Stage','Live')") will return the result of Versioned::create('Stage', 'Live);

It is designed for simple, clonable objects. The first time this method is called for a given string it is cached, and clones of that object are returned.

If you pass the $firstArg argument, this will be prepended to the constructor arguments. It's impossible to pass null as the firstArg argument.

Object::create_from_string("Varchar(50)", "MyField") will return the result of Vachar::create('MyField', '50');

Arguments are always strings, although this is a quirk of the current implementation rather than something that can be relied upon.

Parameters

$classSpec
$firstArg

in Object at line 215
static parse_class_spec($classSpec)

Parses a class-spec, such as "Versioned('Stage','Live')", as passed to create_from_string().

Returns a 2-elemnent array, with classname and arguments

Parameters

$classSpec

in Object at line 341
static Object strong_create()

Similar to {@link Object::create()}, except that classes are only overloaded if you set the $strong parameter to TRUE when using {@link Object::useCustomClass()}

Return Value

Object

in Object at line 361
static useCustomClass(string $oldClass, string $newClass, bool $strong = false)

This class allows you to overload classes with other classes when they are constructed using the factory method {@link Object::create()}

Parameters

string $oldClass the class to replace
string $newClass the class to replace it with
bool $strong allows you to enforce a certain class replacement under all circumstances. This is used in singletons and DB interaction classes

in Object at line 375
static string getCustomClass(string $class)

If a class has been overloaded, get the class name it has been overloaded with - otherwise return the class name

Parameters

string $class the class to check

Return Value

string the class that would be created if you called {@link Object::create()} with the class

in Object at line 396
static any static_lookup($class, $name, null $default = null)

Get the value of a static property of a class, even in that property is declared protected (but not private), without any inheritance, merging or parent lookup if it doesn't exist on the given class.

Parameters

$class
  • The class to get the static from
$name
  • The property to get from the class
null $default
  • The value to return if property doesn't exist on class

Return Value

any
  • The value of the static property $name on class $class, or $default if that property is not defined

in Object at line 436
static get_static($class, $name, $uncached = false) deprecated

deprecated

Parameters

$class
$name
$uncached

in Object at line 444
static set_static($class, $name, $value) deprecated

deprecated

Parameters

$class
$name
$value

in Object at line 452
static uninherited_static($class, $name, $uncached = false) deprecated

deprecated

Parameters

$class
$name
$uncached

in Object at line 460
static combined_static($class, $name, $ceiling = false) deprecated

deprecated

Parameters

$class
$name
$ceiling

in Object at line 470
static addStaticVars($class, $properties, $replace = false) deprecated

deprecated

Parameters

$class
$properties
$replace

in Object at line 478
static add_static_var($class, $name, $value, $replace = false) deprecated

deprecated

Parameters

$class
$name
$value
$replace

in Object at line 494
static has_extension(string $classOrExtension, string $requiredExtension = null, boolean $strict = false)

Return TRUE if a class has a specified extension.

This supports backwards-compatible format (static Object::has_extension($requiredExtension)) and new format ($object->has_extension($class, $requiredExtension))

Parameters

string $classOrExtension if 1 argument supplied, the class name of the extension to check for; if 2 supplied, the class name to test
string $requiredExtension used only if 2 arguments supplied
boolean $strict if the extension has to match the required extension and not be a subclass

in Object at line 536
static add_extension(string $classOrExtension, string $extension = null)

Add an extension to a specific class.

The preferred method for adding extensions is through YAML config, since it avoids autoloading the class, and is easier to override in more specific configurations.

As an alternative, extensions can be added to a specific class directly in the {@link Object::$extensions} array. See {@link SiteTree::$extensions} for examples. Keep in mind that the extension will only be applied to new instances, not existing ones (including all instances created through {@link singleton()}).

Parameters

string $classOrExtension Class that should be extended - has to be a subclass of {@link Object}
string $extension Subclass of {@link Extension} with optional parameters as a string, e.g. "Versioned" or "Translatable('Param')"

See also

http://doc.silverstripe.org/framework/en/trunk/reference/dataextension

in Object at line 601
static remove_extension(string $extension)

Remove an extension from a class.

Keep in mind that this won't revert any datamodel additions of the extension at runtime, unless its used before the schema building kicks in (in your _config.php). Doesn't remove the extension from any {@link Object} instances which are already created, but will have an effect on new extensions. Clears any previously created singletons through {@link singleton()} to avoid side-effects from stale extension information.

Parameters

string $extension Classname of an {@link Extension} subclass, without parameters

in Object at line 640
static array get_extensions(string $class, bool $includeArgumentString = false)

Parameters

string $class
bool $includeArgumentString Include the argument string in the return array, FALSE would return array("Versioned"), TRUE returns array("Versioned('Stage','Live')").

Return Value

array Numeric array of either {@link DataExtension} classnames, or eval'ed classname strings with constructor arguments.

in Object at line 658
static get_extra_config_sources($class = null)

Parameters

$class

in Object at line 697
__construct()

in Object at line 728
mixed __call(string $method, array $arguments)

Attemps to locate and call a method dynamically added to a class at runtime if a default cannot be located

You can add extra methods to a class using {@link Extensions}, {@link Object::createMethod()} or {@link Object::addWrapperMethod()}

Parameters

string $method
array $arguments

Return Value

mixed

in Object at line 795
bool hasMethod(string $method)

Return TRUE if a method exists on this object

This should be used rather than PHP's inbuild method_exists() as it takes into account methods added via extensions

Parameters

string $method

Return Value

bool

in Object at line 805
array allMethodNames(bool $custom = false)

Return the names of all the methods available on this object

Parameters

bool $custom include methods added dynamically at runtime

Return Value

array

in Object at line 825
protected defineMethods()

Adds any methods from {@link Extension} instances attached to this object.

All these methods can then be called directly on the instance (transparently mapped through {@link __call()}), or called explicitly through {@link extend()}.

in Object at line 846
protected array findMethodsFromExtension(object $extension)

Parameters

object $extension

Return Value

array

in Object at line 867
protected addMethodsFrom(string $property, string|int $index = null)

Add all the methods from an object property (which is an {@link Extension}) to this object.

Parameters

string $property the property name
string|int $index an index to use if the property is an array

in Object at line 902
protected removeMethodsFrom(string $property, string|int $index = null)

Add all the methods from an object property (which is an {@link Extension}) to this object.

Parameters

string $property the property name
string|int $index an index to use if the property is an array

in Object at line 934
protected addWrapperMethod(string $method, string $wrap)

Add a wrapper method - a method which points to another method with a different name. For example, Thumbnail(x) can be wrapped to generateThumbnail(x)

Parameters

string $method the method name to wrap
string $wrap the method name to wrap to

in Object at line 949
protected createMethod(string $method, string $code)

Add an extra method using raw PHP code passed as a string

Parameters

string $method the method name
string $code the PHP code - arguments will be in an array called $args, while you can access this object by using $obj. Note that you cannot call protected methods, as the method is actually an external function

in Object at line 962
stat($name, $uncached = false)

Parameters

$name
$uncached

See also

Object::get_static()

in Object at line 969
set_stat($name, $value)

Parameters

$name
$value

See also

Object::set_static()

in Object at line 976
uninherited($name)

Parameters

$name

See also

Object::uninherited_static()

in Object at line 990
bool exists()

Return true if this object "exists" i.e. has a sensible value

This method should be overriden in subclasses to provide more context about the classes state. For example, a {@link DataObject} class could return false when it is deleted from the database

Return Value

bool

in Object at line 997
string parentClass()

Return Value

string this classes parent class

in Object at line 1007
bool is_a(string $class)

Check if this class is an instance of a specific class, or has that class as one of its parents

Parameters

string $class

Return Value

bool

in Object at line 1014
string __toString()

Return Value

string the class name

in Object at line 1029
mixed invokeWithExtensions(string $method, mixed $argument = null)

Calls a method if available on both this object and all applied {@link Extensions}, and then attempts to merge all results into an array

Parameters

string $method the method name to call
mixed $argument a single argument to pass

Return Value

mixed

in Object at line 1051
array extend($method, $a1 = null, $a2 = null, $a3 = null, $a4 = null, $a5 = null, $a6 = null, $a7 = null)

Run the given function on all of this object's extensions. Note that this method originally returned void, so if you wanted to return results, you're hosed

Currently returns an array, with an index resulting every time the function is called. Only adds returns if they're not NULL, to avoid bogus results from methods just defined on the parent extension. This is important for permission-checks through extend, as they use min() to determine if any of the returns is FALSE. As min() doesn't do type checking, an included NULL return would fail the permission checks.

The extension methods are defined during {@link __construct()} in {@link defineMethods()}.

Parameters

$method
$a1
$a2
$a3
$a4
$a5
$a6
$a7

Return Value

array

in Object at line 1090
Extension getExtensionInstance(string $extension)

Get an extension instance attached to this object by name.

Parameters

string $extension

Return Value

Extension

in Object at line 1108
bool hasExtension(string $extension)

Returns TRUE if this object instance has a specific extension applied in {@link $extension_instances}. Extension instances are initialized at constructor time, meaning if you use {@link add_extension()} afterwards, the added extension will just be added to new instances of the extended class. Use the static method {@link has_extension()} to check if a class (not an instance) has a specific extension.

Caution: Don't use singleton()->hasExtension() as it will give you inconsistent results based on when the singleton was first accessed.

Parameters

string $extension Classname of an {@link Extension} subclass without parameters

Return Value

bool

in Object at line 1119
array getExtensionInstances()

Get all extension instances for this specific object instance.

See {@link get_extensions()} to get all applied extension classes for this class (not the instance).

Return Value

array Map of {@link DataExtension} instances, keyed by classname.

in Object at line 1135
mixed cacheToFile(string $method, int $lifetime = 3600, string $ID = false, array $arguments = array())

Cache the results of an instance method in this object to a file, or if it is already cache return the cached results

Parameters

string $method the method name to cache
int $lifetime the cache lifetime in seconds
string $ID custom cache ID to use
array $arguments an optional array of arguments

Return Value

mixed the cached data

in Object at line 1164
clearCache($method, $ID = false, $arguments = array())

Clears the cache for the given cacheToFile call

Parameters

$method
$ID
$arguments

in Object at line 1183
protected mixed loadCache(string $cache, int $lifetime = 3600)

Loads a cache from the filesystem if a valid on is present and within the specified lifetime

Parameters

string $cache the cache name
int $lifetime the lifetime (in seconds) of the cache before it is invalid

Return Value

mixed

in Object at line 1201
protected saveCache(string $cache, mixed $data)

Save a piece of cached data to the file system

Parameters

string $cache the cache name
mixed $data data to save (must be serializable)

in Object at line 1212
protected string sanitiseCachename(string $name)

Strip a file name of special characters so it is suitable for use as a cache file name

Parameters

string $name

Return Value

string the name with all special cahracters replaced with underscores

at line 14
img_shortcode($attrs)

Parameters

$attrs

at line 41
static ShortcodeParser get(string $identifier = 'default')

Get the {@link ShortcodeParser} instance that is attached to a particular identifier.

Parameters

string $identifier Defaults to "default".

Return Value

ShortcodeParser

at line 54
static ShortcodeParser get_active()

Get the currently active/default {@link ShortcodeParser} instance.

Return Value

ShortcodeParser

at line 63
static set_active(string $identifier)

Set the identifier to use for the current active/default {@link ShortcodeParser} instance.

Parameters

string $identifier

at line 83
register(string $shortcode, callback $callback)

Register a shortcode, and attach it to a PHP callback.

The callback for a shortcode will have the following arguments passed to it: - Any parameters attached to the shortcode as an associative array (keys are lower-case). - Any content enclosed within the shortcode (if it is an enclosing shortcode). Note that any content within this will not have been parsed, and can optionally be fed back into the parser. - The {@link ShortcodeParser} instance used to parse the content. - The shortcode tag name that was matched within the parsed content. - An associative array of extra information about the shortcode being parsed.

Parameters

string $shortcode The shortcode tag to map to the callback - normally in lowercase_underscore format.
callback $callback The callback to replace the shortcode with.

at line 93
bool registered(string $shortcode)

Check if a shortcode has been registered.

Parameters

string $shortcode

Return Value

bool

at line 102
unregister(string $shortcode)

Remove a specific registered shortcode.

Parameters

string $shortcode

at line 111
array getRegisteredShortcodes()

Get an array containing information about registered shortcodes

Return Value

array

at line 118
clear()

Remove all registered shortcodes.

at line 126
callShortcode($tag, $attributes, $content, $extra = array())

Call a shortcode and return its replacement text Returns false if the shortcode isn't registered

Parameters

$tag
$attributes
$content
$extra

at line 141
getShortcodeReplacementText($tag, $extra = array(), $isHTMLAllowed = true)

Return the text to insert in place of a shoprtcode.

Behaviour in the case of missing shortcodes depends on the setting of ShortcodeParser::$error_behavior.

Parameters

$tag A map containing the the following keys: - 'open': The name of the tag - 'attrs': Attributes of the tag - 'content': Content of the tag
$extra Extra-meta data
$isHTMLAllowed A boolean indicating whether it's okay to insert HTML tags into the result

at line 165
protected removeNode($node)

Parameters

$node

at line 169
protected insertAfter($new, $after)

Parameters

$new
$after

at line 180
protected insertListAfter($new, $after)

Parameters

$new
$after

at line 213
static protected attrrx()

at line 237
static protected tagrx()

at line 259
protected array extractTags(string $content)

Look through a string that contains shortcode tags and pull out the locations and details of those tags

Doesn't support nested shortcode tags

Parameters

string $content

Return Value

array
  • The list of tags found. When using an open/close pair, only one item will be in the array, with "content" set to the text between the tags

at line 371
protected string replaceTagsWithText($content, $tags, $generator)

Replaces the shortcode tags extracted by extractTags with HTML element "markers", so that we can parse the resulting string as HTML and easily mutate the shortcodes in the DOM

Parameters

$content
$tags
$generator

Return Value

string
  • The HTML string with [tag] style shortcodes replaced by markers

at line 403
protected replaceAttributeTagsWithContent($htmlvalue)

Replace the shortcodes in attribute values with the calculated content

We don't use markers with attributes because there's no point, it's easier to do all the matching in-DOM after the XML parse

Parameters

$htmlvalue

at line 427
protected replaceElementTagsWithMarkers(string $content)

Replace the element-scoped tags with markers

Parameters

string $content

at line 441
protected findParentsForMarkers($nodes)

Parameters

$nodes

at line 490
protected moveMarkerToCompliantHome($node, $parent, $location)

Given a node with represents a shortcode marker and a location string, mutates the DOM to put the marker in the compliant location

For shortcodes inserted BEFORE, that location is just before the block container that the marker is in

For shortcodes inserted AFTER, that location is just after the block container that the marker is in

For shortcodes inserted SPLIT, that location is where the marker is, but the DOM is split around it up to the block container the marker is in - for instance,

ABCD

becomes

AB

CD

For shortcodes inserted INLINE, no modification is needed (but in that case the shortcode handler needs to generate only inline blocks)

Parameters

$node
$parent
$location

at line 540
protected replaceMarkerWithContent(DOMElement $node, array $tag)

Given a node with represents a shortcode marker and some information about the shortcode, call the shortcode handler & replace the marker with the actual content

Parameters

DOMElement $node
array $tag

at line 558
string parse(string $content)

Parse a string, and replace any registered shortcodes within it with the result of the mapped callback.

Parameters

string $content

Return Value

string