diff --git a/src/flextype/Support/Parsers/Shortcodes/EntriesShortcode.php b/src/flextype/Support/Parsers/Shortcodes/EntriesShortcode.php index 3bc6751cc..068c992bf 100644 --- a/src/flextype/Support/Parsers/Shortcodes/EntriesShortcode.php +++ b/src/flextype/Support/Parsers/Shortcodes/EntriesShortcode.php @@ -12,8 +12,8 @@ use Thunder\Shortcode\Shortcode\ShortcodeInterface; // Shortcode: [entries_fetch id="entry-id" field="field-name" default="default-value"] -if (flextype('registry')->get('flextype.settings.parsers.shortcode.shortcodes.content.enabled')) { - flextype('parsers')->shortcode()->addHandler('entries_fetch', static function (ShortcodeInterface $s) { - return arrays(flextype('entries')->fetch($s->getParameter('id')))->get($s->getParameter('field'), $s->getParameter('default')); +if (registry()->get('flextype.settings.parsers.shortcodes.entries.enabled')) { + parsers()->shortcodes()->addHandler('entries_fetch', static function (ShortcodeInterface $s) { + return arrays(entries()->fetch($s->getParameter('id')))->get($s->getParameter('field'), $s->getParameter('default')); }); } diff --git a/src/flextype/Support/Parsers/Shortcodes/MediaShortcode.php b/src/flextype/Support/Parsers/Shortcodes/MediaShortcode.php index 88b6af7df..134aebd33 100644 --- a/src/flextype/Support/Parsers/Shortcodes/MediaShortcode.php +++ b/src/flextype/Support/Parsers/Shortcodes/MediaShortcode.php @@ -12,8 +12,8 @@ use Thunder\Shortcode\Shortcode\ShortcodeInterface; // Shortcode: [media_files_fetch id="media-id" field="field-name" default="default-value"] -if (flextype('registry')->get('flextype.settings.parsers.shortcode.shortcodes.media.enabled')) { - flextype('parsers')->shortcode()->addHandler('media_files_fetch', static function (ShortcodeInterface $s) { +if (registry()->get('flextype.settings.parsers.shortcodes.media.enabled')) { + parsers()->shortcodes()->addHandler('media_files_fetch', static function (ShortcodeInterface $s) { return arrays(flextype('media')->files()->fetch($s->getParameter('id')))->get($s->getParameter('field'), $s->getParameter('default')); }); } diff --git a/src/flextype/Support/Parsers/Shortcodes/RawShortcode.php b/src/flextype/Support/Parsers/Shortcodes/RawShortcode.php index 78aa1a127..cf992abe6 100644 --- a/src/flextype/Support/Parsers/Shortcodes/RawShortcode.php +++ b/src/flextype/Support/Parsers/Shortcodes/RawShortcode.php @@ -14,10 +14,10 @@ use Thunder\Shortcode\Shortcode\ShortcodeInterface; // Shortcode: [raw] -if (flextype('registry')->get('flextype.settings.parsers.shortcode.shortcodes.raw.enabled')) { - flextype('parsers')->shortcode()->addHandler('raw', static function (ShortcodeInterface $s) { +if (registry()->get('flextype.settings.parsers.shortcodes.raw.enabled')) { + parsers()->shortcodes()->addHandler('raw', static function (ShortcodeInterface $s) { return $s->getContent(); }); - flextype('parsers')->shortcode()->addEventHandler(Events::FILTER_SHORTCODES, new FilterRawEventHandler(['raw'])); + parsers()->shortcodes()->addEventHandler(Events::FILTER_SHORTCODES, new FilterRawEventHandler(['raw'])); } diff --git a/src/flextype/Support/Parsers/Shortcodes/RegistryShortcode.php b/src/flextype/Support/Parsers/Shortcodes/RegistryShortcode.php index ecb4f4f7c..9eafa3811 100644 --- a/src/flextype/Support/Parsers/Shortcodes/RegistryShortcode.php +++ b/src/flextype/Support/Parsers/Shortcodes/RegistryShortcode.php @@ -12,8 +12,8 @@ use Thunder\Shortcode\Shortcode\ShortcodeInterface; // Shortcode: [registry_get name="item-name" default="default-value"] -if (flextype('registry')->get('flextype.settings.parsers.shortcode.shortcodes.registry.enabled')) { - flextype('parsers')->shortcode()->addHandler('registry_get', static function (ShortcodeInterface $s) { - return flextype('registry')->get($s->getParameter('name'), $s->getParameter('default')); +if (registry()->get('flextype.settings.parsers.shortcodes.registry.enabled')) { + parsers()->shortcodes()->addHandler('registry_get', static function (ShortcodeInterface $s) { + return registry()->get($s->getParameter('name'), $s->getParameter('default')); }); } diff --git a/src/flextype/Support/Parsers/Shortcodes/UrlShortcode.php b/src/flextype/Support/Parsers/Shortcodes/UrlShortcode.php index a83c9966f..eac444c81 100644 --- a/src/flextype/Support/Parsers/Shortcodes/UrlShortcode.php +++ b/src/flextype/Support/Parsers/Shortcodes/UrlShortcode.php @@ -13,12 +13,12 @@ use Slim\Http\Uri; // Shortcode: [url] -if (flextype('registry')->get('flextype.settings.parsers.shortcode.shortcodes.url.enabled')) { - flextype('parsers')->shortcode()->addHandler('url', static function () { - if (flextype('registry')->has('flextype.settings.url') && flextype('registry')->get('flextype.settings.url') !== '') { - return flextype('registry')->get('flextype.settings.url'); +if (registry()->get('flextype.settings.parsers.shortcodes.url.enabled')) { + parsers()->shortcodes()->addHandler('url', static function () { + if (registry()->has('flextype.settings.url') && registry()->get('flextype.settings.url') !== '') { + return registry()->get('flextype.settings.url'); } - return Uri::createFromEnvironment(new Environment($_SERVER))->getBaseUrl(); + return app()->getBasePath(); }); }