thunderer/shortcode
Framework-agnostic PHP library for parsing and processing shortcodes/BBCodes. Extract shortcodes from text, handle replacements, and apply them via processors and events. Includes serializers for Text/XML/JSON/YAML. Supports PHP 5.3–8.x.
v0.6.2 (25.04.2016)
v0.6.1 (25.02.2016)
v0.6.0 (13.02.2016)
FilterShortcodesEvent for modifying set of parsed shortcodes before processing them,ReplaceShortcodesEvent to alter the way shortcode replacements are applied to source text at each processing level,EventContainerInterface with default implementation EventContainer to store event handlers,Processor with events above,Processor::withEventContainer() to configure event handlers,ProcessedShortcode::hasAncestor() to detect if shortcode has any parent with given name,ReplacedShortcode which represents parsed shortcode data with replacement returned from its handler,FilterRawEventHandler allows to automatically configure shortcodes that should not have their content processed,ReplaceJoinEventHandler discards the parent shortcode content and returns only concatenated replacements,HandlerContainer::addAlias() bug that may have silently added aliases for default handler,WordpressParser with names from array or HandlerContainer to catch only those like WordPress does,RegexBuilderUtility::buildNameRegex()ShortcodeFacade for better developer experience.v0.5.3 (26.01.2016)
v0.5.2 (20.01.2016)
v0.5.1 (12.11.2015)
v0.5.0 (28.10.2015)
ProcessedShortcode::getTextContent() to allow returning unprocessed content regardless of auto processing setting value,create*() methods from ShortcodeFacade, now all dependencies construction is inside the constructor,RegexExtractor and ExtractorInterface, its functionality was moved to Parser - now it returns instances of ParsedShortcodeInterface,Match and MatchInterface,HandlerInterface, from now on handlers can be only closures and classes with __invoke() (callable typehint),Processor (extracted to HandlerContainer):
addHandler(),addHandlerAlias(),setDefaultHandler().ShortcodeFacade to also use HandlerContainer, also SyntaxInterface parameter is now required,Processor is now immutable, options setters were refactored to return reconfigured clones:
setRecursionDepth() » withRecursionDepth(),setMaxIterations() » withMaxIterations(),setAutoProcessContent() » withAutoProcessContent(),HandlerContainerInterface and its default implementation HandlerContainer from Processor,Processor now requires instance of HandlerContainer,RegularParser with dedicated parser implementation that correctly handles nested shortcodes,WordpressParser with slightly refactored implementation of WordPress' regex-based shortcodes in case anyone would like full compatibility,ImmutableHandlerContainer as an alternative implementation,ProcessorContext to store internal state when processing text,AbstractShortcode, restored final on regular Shortcode,ProcessedShortcode can be now created with static method createFromContext() using instance of ProcessorContext,ParsedShortcode and ParsedShortcodeInterface that extends ShortcodeInterface with position and exact text match.v0.4.0 (15.07.2015)
use clauses and use new names. Backward compatibility was fully maintained, but note that previous class files will be removed in the next release. Old class files contain call to class_alias() and empty implementation for IDE autocompletion, interfaces extend those from new locations. All modified elements are listed below:
Extractor » Parser\RegexExtractor,ExtractorInterface » Extractor\ExtractorInterface,HandlerInterface » Extractor\HandlerInterface,Parser » Parser\RegexParser,ParserInterface » Parser\ParserInterface,Processor » Processor\Processor,ProcessorInterface » Processor\ProcessorInterface,SerializerInterface » Serializer\SerializerInterface,Shortcode » Shortcode\Shortcode,Syntax » Syntax\Syntax,SyntaxBuilder » Syntax\SyntaxBuilder,Extractor abstraction will be removed and its functionality will be merged with Parser,ProcessedShortcode will be aware of ProcessorInterface instance that is processing it,HandlerContainer will be refactored outside Processor to remove SRP violation,ProcessedShortcode will not extend Shortcode and Shortcode will be final again,Match class will be removed and ParsedShortcode will be introduced in its place,ShortcodeInterface for reusable shortcode implementation, handlers should typehint it,ProcessedShortcode to provide more runtime information about context in handlers,CommonSyntax with default values,RegexBuilderUtility to separate regex building from Syntax class,HandlerInterface was deprecated, please use classes with __invoke() method.v0.3.0 (08.05.2015)
[self-closing /] shortcodes,Syntax regular expressions are now built once in constructor,[ code arg = val ] [ / code ],Syntax and SyntaxBuilder support whitespaced and strict syntaxes.v0.2.2 (26.04.2015)
v0.2.1 (23.04.2015)
v0.2.0 (17.04.2015)
Syntax object,- to allowed characters in shortcode names,Processor::setRecursion(), use Processor::setRecursionDepth() instead,v0.1.0 (06.04.2015)
How can I help you explore Laravel packages today?