interface shortcode_manager_interface

Interface for the Shortcode Manager.

Defines the contract for registering and rendering [middag] shortcodes.

Methods

void
register(string $tag, callable $callback)

Registers a shortcode by associating a tag with a callback function.

string
render(string $text)

Processes the given text, parses shortcode patterns, and replaces them with corresponding content.

bool
has(string $tag)

Checks whether a shortcode is registered.

void
clear()

Clears all registered shortcodes.

Details

at line 32
void register(string $tag, callable $callback)

Registers a shortcode by associating a tag with a callback function.

Parameters

string $tag

the name of the shortcode tag to register (case-insensitive)

callable $callback

the callback function that renders the content for the shortcode

Return Value

void

at line 41
string render(string $text)

Processes the given text, parses shortcode patterns, and replaces them with corresponding content.

Parameters

string $text

the input text containing shortcodes to be rendered

Return Value

string

the text with shortcodes replaced by their respective rendered content

at line 50
bool has(string $tag)

Checks whether a shortcode is registered.

Parameters

string $tag

the shortcode tag name to check

Return Value

bool

true if the shortcode is registered; false otherwise

at line 56
void clear()

Clears all registered shortcodes.

Intended primarily for testing context reset.

Return Value

void