shortcode_manager
class shortcode_manager implements shortcode_manager_interface
Shortcode Manager.
Service responsible for managing and rendering shortcodes. Registered as a singleton in the DI container.
Methods
Registers a shortcode by associating a tag with a callback function.
Processes the given text, parses shortcode patterns, and replaces them with corresponding content based on registered shortcode types.
Checks whether a shortcode is registered.
Clears all registered shortcodes.
Details
at line 40
void
register(string $tag, callable $callback)
Registers a shortcode by associating a tag with a callback function.
at line 53
string
render(string $text)
Processes the given text, parses shortcode patterns, and replaces them with corresponding content based on registered shortcode types.
at line 87
bool
has(string $tag)
Checks whether a shortcode is registered.
at line 99
void
clear()
Clears all registered shortcodes.
Intended for testing purposes only. It will only clear when the PHPUNIT_TEST constant is defined and set to true. In production, this method is a no-op (or you may throw an exception if desired).