diff --git a/src/flextype/Foundation/Entries/Entries.php b/src/flextype/Foundation/Entries/Entries.php index 52eb9c89..df59b52f 100755 --- a/src/flextype/Foundation/Entries/Entries.php +++ b/src/flextype/Foundation/Entries/Entries.php @@ -105,7 +105,6 @@ class Entries // 2. Try to get current requested entry from filesystem if ($this->has($this->storage['fetch']['id'])) { - // Get entry file location $entryFile = $this->getFileLocation($this->storage['fetch']['id']); diff --git a/src/flextype/Foundation/Entries/Fields/IdField.php b/src/flextype/Foundation/Entries/Fields/IdField.php index 8598e73d..284d76e0 100644 --- a/src/flextype/Foundation/Entries/Fields/IdField.php +++ b/src/flextype/Foundation/Entries/Fields/IdField.php @@ -7,7 +7,6 @@ declare(strict_types=1); * Founded by Sergey Romanenko and maintained by Flextype Community. */ -use Atomastic\Strings\Strings; if (flextype('registry')->get('flextype.settings.entries.fields.id.enabled')) { flextype('emitter')->addListener('onEntryAfterInitialized', static function (): void { diff --git a/src/flextype/Foundation/Entries/Fields/ParsersField.php b/src/flextype/Foundation/Entries/Fields/ParsersField.php index 40f42377..b2c7d7fb 100644 --- a/src/flextype/Foundation/Entries/Fields/ParsersField.php +++ b/src/flextype/Foundation/Entries/Fields/ParsersField.php @@ -15,38 +15,59 @@ if (flextype('registry')->get('flextype.settings.entries.fields.parsers.enabled' function processParsersField(): void { - if (flextype('entries')->getStorage('fetch.data.cache.enabled') == null) { + if (flextype('entries')->getStorage('fetch.data.cache.enabled') === null) { $cache = false; } else { $cache = (bool) flextype('entries')->getStorage('fetch.data.cache.enabled'); } - if (flextype('entries')->getStorage('fetch.data.parsers') != null) { - foreach (flextype('entries')->getStorage('fetch.data.parsers') as $parser_name => $parser_data) { - if (in_array($parser_name, ['markdown', 'shortcode'])) { - if (flextype('entries')->getStorage('fetch.data.parsers.'.$parser_name.'.enabled') === true) { - if (flextype('entries')->getStorage('fetch.data.parsers.'.$parser_name.'.fields') != null) { - if (is_array(flextype('entries')->getStorage('fetch.data.parsers.'.$parser_name.'.fields'))) { - foreach (flextype('entries')->getStorage('fetch.data.parsers.'.$parser_name.'.fields') as $field) { - if (! in_array($field, flextype('registry')->get('flextype.settings.entries.fields'))) { - if ($parser_name == 'markdown') { - if (arrays(flextype('entries')->getStorage('fetch.data'))->has($field)) { - flextype('entries')->setStorage('fetch.data.'.$field, - flextype('markdown')->parse(flextype('entries')->getStorage('fetch.data.'.$field), $cache)); - } - } - if ($parser_name == 'shortcode') { - if (arrays(flextype('entries')->getStorage('fetch.data'))->has($field)) { - flextype('entries')->setStorage('fetch.data.'.$field, - flextype('shortcode')->process(flextype('entries')->getStorage('fetch.data.'.$field), $cache)); - } - } - } - } - } - } + if (flextype('entries')->getStorage('fetch.data.parsers') === null) { + return; + } + + foreach (flextype('entries')->getStorage('fetch.data.parsers') as $parser_name => $parser_data) { + if (! in_array($parser_name, ['markdown', 'shortcode'])) { + continue; + } + + if (flextype('entries')->getStorage('fetch.data.parsers.' . $parser_name . '.enabled') !== true) { + continue; + } + + if (flextype('entries')->getStorage('fetch.data.parsers.' . $parser_name . '.fields') === null) { + continue; + } + + if (! is_array(flextype('entries')->getStorage('fetch.data.parsers.' . $parser_name . '.fields'))) { + continue; + } + + foreach (flextype('entries')->getStorage('fetch.data.parsers.' . $parser_name . '.fields') as $field) { + if (in_array($field, flextype('registry')->get('flextype.settings.entries.fields'))) { + continue; + } + + if ($parser_name === 'markdown') { + if (arrays(flextype('entries')->getStorage('fetch.data'))->has($field)) { + flextype('entries')->setStorage( + 'fetch.data.' . $field, + flextype('markdown')->parse(flextype('entries')->getStorage('fetch.data.' . $field), $cache) + ); } } + + if ($parser_name !== 'shortcode') { + continue; + } + + if (! arrays(flextype('entries')->getStorage('fetch.data'))->has($field)) { + continue; + } + + flextype('entries')->setStorage( + 'fetch.data.' . $field, + flextype('shortcode')->process(flextype('entries')->getStorage('fetch.data.' . $field), $cache) + ); } } } diff --git a/src/flextype/Foundation/Entries/Fields/SlugField.php b/src/flextype/Foundation/Entries/Fields/SlugField.php index e8bf5697..2025e535 100644 --- a/src/flextype/Foundation/Entries/Fields/SlugField.php +++ b/src/flextype/Foundation/Entries/Fields/SlugField.php @@ -7,7 +7,6 @@ declare(strict_types=1); * Founded by Sergey Romanenko and maintained by Flextype Community. */ -use Atomastic\Strings\Strings; if (flextype('registry')->get('flextype.settings.entries.fields.slug.enabled')) { flextype('emitter')->addListener('onEntryAfterInitialized', static function (): void { diff --git a/src/flextype/Support/Parsers/Markdown.php b/src/flextype/Support/Parsers/Markdown.php index f7c764fa..39fc51ff 100644 --- a/src/flextype/Support/Parsers/Markdown.php +++ b/src/flextype/Support/Parsers/Markdown.php @@ -9,9 +9,8 @@ declare(strict_types=1); namespace Flextype\Support\Parsers; -use Atomastic\Strings\Strings; - use function flextype; +use function strings; class Markdown { diff --git a/src/flextype/Support/Parsers/Shortcode.php b/src/flextype/Support/Parsers/Shortcode.php index 149f0ced..b7d211fa 100644 --- a/src/flextype/Support/Parsers/Shortcode.php +++ b/src/flextype/Support/Parsers/Shortcode.php @@ -9,9 +9,8 @@ declare(strict_types=1); namespace Flextype\Support\Parsers; -use Atomastic\Strings\Strings; - use function flextype; +use function strings; class Shortcode { diff --git a/src/flextype/Support/Serializers/Frontmatter.php b/src/flextype/Support/Serializers/Frontmatter.php index 8cb55789..5d18efb1 100644 --- a/src/flextype/Support/Serializers/Frontmatter.php +++ b/src/flextype/Support/Serializers/Frontmatter.php @@ -9,8 +9,6 @@ declare(strict_types=1); namespace Flextype\Support\Serializers; -use Atomastic\Strings\Strings; - use function array_slice; use function arrays; use function count; @@ -19,6 +17,7 @@ use function implode; use function ltrim; use function preg_replace; use function preg_split; +use function strings; use const PHP_EOL; diff --git a/src/flextype/Support/Serializers/Json.php b/src/flextype/Support/Serializers/Json.php index fa7ff854..f9fab43c 100644 --- a/src/flextype/Support/Serializers/Json.php +++ b/src/flextype/Support/Serializers/Json.php @@ -9,7 +9,6 @@ declare(strict_types=1); namespace Flextype\Support\Serializers; -use Atomastic\Strings\Strings; use RuntimeException; use function defined; @@ -18,6 +17,7 @@ use function json_decode; use function json_encode; use function json_last_error; use function json_last_error_msg; +use function strings; use const JSON_PRESERVE_ZERO_FRACTION; use const JSON_PRETTY_PRINT; diff --git a/src/flextype/Support/Serializers/Yaml.php b/src/flextype/Support/Serializers/Yaml.php index f118bd24..a4ffcb2b 100644 --- a/src/flextype/Support/Serializers/Yaml.php +++ b/src/flextype/Support/Serializers/Yaml.php @@ -9,7 +9,6 @@ declare(strict_types=1); namespace Flextype\Support\Serializers; -use Atomastic\Strings\Strings; use RuntimeException; use Symfony\Component\Yaml\Exception\DumpException as SymfonyYamlDumpException; use Symfony\Component\Yaml\Exception\ParseException as SymfonyYamlParseException; @@ -20,6 +19,7 @@ use function flextype; use function function_exists; use function ini_get; use function ini_set; +use function strings; class Yaml { diff --git a/src/flextype/dependencies.php b/src/flextype/dependencies.php index d74669c0..678bd780 100644 --- a/src/flextype/dependencies.php +++ b/src/flextype/dependencies.php @@ -10,7 +10,6 @@ declare(strict_types=1); namespace Flextype; use Atomastic\Session\Session; -use Atomastic\Strings\Strings; use Bnf\Slim3Psr15\CallableResolver; use Cocur\Slugify\Slugify; use Flextype\Foundation\Cors; @@ -57,6 +56,7 @@ use function date; use function extension_loaded; use function flextype; use function in_array; +use function strings; use function sys_get_temp_dir; /**