diff --git a/src/flextype/core/Parsers/Markdown.php b/src/flextype/core/Parsers/Markdown.php index 2c713842..5d94fcf8 100644 --- a/src/flextype/core/Parsers/Markdown.php +++ b/src/flextype/core/Parsers/Markdown.php @@ -10,13 +10,14 @@ declare(strict_types=1); namespace Flextype\Parsers; use Exception; -use League\CommonMark\MarkdownConverter; use League\CommonMark\Environment\Environment; -use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension; use League\CommonMark\Extension\Attributes\AttributesExtension; +use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension; use League\CommonMark\Extension\Table\TableExtension; +use League\CommonMark\MarkdownConverter; -use function flextype; +use function cache; +use function registry; use function strings; final class Markdown @@ -132,4 +133,4 @@ final class Markdown { return strings('markdown' . $input)->hash()->toString(); } -} \ No newline at end of file +} diff --git a/src/flextype/core/Parsers/Parsers.php b/src/flextype/core/Parsers/Parsers.php index 64c7ced1..71c21881 100644 --- a/src/flextype/core/Parsers/Parsers.php +++ b/src/flextype/core/Parsers/Parsers.php @@ -10,8 +10,6 @@ declare(strict_types=1); namespace Flextype\Parsers; use Atomastic\Macroable\Macroable; -use Flextype\Parsers\Shortcodes; -use Flextype\Parsers\Markdown; class Parsers { diff --git a/src/flextype/core/Parsers/Shortcodes.php b/src/flextype/core/Parsers/Shortcodes.php index f6520dc0..d363f830 100644 --- a/src/flextype/core/Parsers/Shortcodes.php +++ b/src/flextype/core/Parsers/Shortcodes.php @@ -12,7 +12,11 @@ namespace Flextype\Parsers; use Exception; use Thunder\Shortcode\ShortcodeFacade; -use function flextype; +use function cache; +use function count; +use function file_exists; +use function is_array; +use function registry; use function strings; final class Shortcodes diff --git a/src/flextype/core/Parsers/Shortcodes/ContentShortcode.php b/src/flextype/core/Parsers/Shortcodes/ContentShortcode.php index 5c1fa571..f23900c0 100644 --- a/src/flextype/core/Parsers/Shortcodes/ContentShortcode.php +++ b/src/flextype/core/Parsers/Shortcodes/ContentShortcode.php @@ -11,13 +11,16 @@ namespace Flextype\Parsers\Shortcodes; use Thunder\Shortcode\Shortcode\ShortcodeInterface; +use function arrays; +use function content; +use function parsers; +use function registry; + // Shortcode: [content_fetch id="content-id" field="field-name" default="default-value"] parsers()->shortcodes()->addHandler('content_fetch', static function (ShortcodeInterface $s) { - if (! registry()->get('flextype.settings.parsers.shortcodes.shortcodes.content.enabled')) { return ''; } return arrays(content()->fetch($s->getParameter('id')))->get($s->getParameter('field'), $s->getParameter('default')); }); - diff --git a/src/flextype/core/Parsers/Shortcodes/MediaShortcode.php b/src/flextype/core/Parsers/Shortcodes/MediaShortcode.php index 199a6eaf..ec306ac8 100644 --- a/src/flextype/core/Parsers/Shortcodes/MediaShortcode.php +++ b/src/flextype/core/Parsers/Shortcodes/MediaShortcode.php @@ -11,13 +11,16 @@ namespace Flextype\Parsers\Shortcodes; use Thunder\Shortcode\Shortcode\ShortcodeInterface; +use function arrays; +use function flextype; +use function parsers; +use function registry; + // Shortcode: [media_files_fetch id="media-id" field="field-name" default="default-value"] parsers()->shortcodes()->addHandler('media_files_fetch', static function (ShortcodeInterface $s) { - if (! registry()->get('flextype.settings.parsers.shortcodes.shortcodes.media.enabled')) { return ''; } return arrays(flextype('media')->files()->fetch($s->getParameter('id')))->get($s->getParameter('field'), $s->getParameter('default')); }); - diff --git a/src/flextype/core/Parsers/Shortcodes/RawShortcode.php b/src/flextype/core/Parsers/Shortcodes/RawShortcode.php index 804f2294..60cf344c 100644 --- a/src/flextype/core/Parsers/Shortcodes/RawShortcode.php +++ b/src/flextype/core/Parsers/Shortcodes/RawShortcode.php @@ -13,10 +13,11 @@ use Thunder\Shortcode\EventHandler\FilterRawEventHandler; use Thunder\Shortcode\Events; use Thunder\Shortcode\Shortcode\ShortcodeInterface; +use function parsers; + // Shortcode: [raw] parsers()->shortcodes()->addHandler('raw', static function (ShortcodeInterface $s) { return $s->getContent(); }); parsers()->shortcodes()->addEventHandler(Events::FILTER_SHORTCODES, new FilterRawEventHandler(['raw'])); - diff --git a/src/flextype/core/Parsers/Shortcodes/RegistryShortcode.php b/src/flextype/core/Parsers/Shortcodes/RegistryShortcode.php index 08647414..28569424 100644 --- a/src/flextype/core/Parsers/Shortcodes/RegistryShortcode.php +++ b/src/flextype/core/Parsers/Shortcodes/RegistryShortcode.php @@ -11,12 +11,14 @@ namespace Flextype\Parsers\Shortcodes; use Thunder\Shortcode\Shortcode\ShortcodeInterface; +use function parsers; +use function registry; + // Shortcode: [registry_get name="item-name" default="default-value"] parsers()->shortcodes()->addHandler('registry_get', static function (ShortcodeInterface $s) { - if (! registry()->get('flextype.settings.parsers.shortcodes.shortcodes.registry.enabled')) { return ''; } return registry()->get($s->getParameter('name'), $s->getParameter('default')); -}); \ No newline at end of file +}); diff --git a/src/flextype/core/Parsers/Shortcodes/UrlShortcode.php b/src/flextype/core/Parsers/Shortcodes/UrlShortcode.php index 4bb4bf5f..eb023619 100644 --- a/src/flextype/core/Parsers/Shortcodes/UrlShortcode.php +++ b/src/flextype/core/Parsers/Shortcodes/UrlShortcode.php @@ -9,13 +9,13 @@ declare(strict_types=1); namespace Flextype\Parsers\Shortcodes; -use Slim\Http\Environment; -use Slim\Http\Uri; +use function app; +use function parsers; +use function registry; // Shortcode: [url] parsers()->shortcodes()->addHandler('url', static function () { - - if (!registry()->get('flextype.settings.parsers.shortcodes.shortcodes.url.enabled')) { + if (! registry()->get('flextype.settings.parsers.shortcodes.shortcodes.url.enabled')) { return ''; }