From fdf6d3d8332b957776c5113863a5a2a9ab963429 Mon Sep 17 00:00:00 2001 From: Awilum Date: Mon, 23 Nov 2020 09:51:18 +0300 Subject: [PATCH] fix(fields): fix issues with strtotime() function. --- src/flextype/Foundation/Entries/Fields/CreatedAtField.php | 4 ++-- src/flextype/Foundation/Entries/Fields/ModifiedAtField.php | 2 +- src/flextype/Foundation/Entries/Fields/PublishedAtField.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/flextype/Foundation/Entries/Fields/CreatedAtField.php b/src/flextype/Foundation/Entries/Fields/CreatedAtField.php index 0476b90e..cf7aa3f8 100644 --- a/src/flextype/Foundation/Entries/Fields/CreatedAtField.php +++ b/src/flextype/Foundation/Entries/Fields/CreatedAtField.php @@ -11,7 +11,7 @@ use Atomastic\Strings\Strings; if (flextype('registry')->get('flextype.settings.entries.fields.created_at.enabled')) { flextype('emitter')->addListener('onEntryAfterInitialized', static function (): void { - if (flextype('entries')->getStorage('fetch_single.data.created_at') == null) { + if (flextype('entries')->getStorage('fetch_single.data.created_at') === null) { flextype('entries')->setStorage('fetch_single.data.created_at', (int) flextype('filesystem')->file(flextype('entries')->getFileLocation(flextype('entries')->getStorage('fetch_single.id')))->lastModified()); } else { flextype('entries')->setStorage('fetch_single.data.created_at', (int) strtotime((string) flextype('entries')->getStorage('fetch_single.data.created_at'))); @@ -19,7 +19,7 @@ if (flextype('registry')->get('flextype.settings.entries.fields.created_at.enabl }); flextype('emitter')->addListener('onEntryCreate', static function (): void { - if (flextype('entries')->getStorage('create.data.created_at') == null) { + if (flextype('entries')->getStorage('create.data.created_at') === null) { flextype('entries')->setStorage('create.data.created_at', date(flextype('registry')->get('flextype.settings.date_format'), time())); } }); diff --git a/src/flextype/Foundation/Entries/Fields/ModifiedAtField.php b/src/flextype/Foundation/Entries/Fields/ModifiedAtField.php index 76994e21..978eda85 100644 --- a/src/flextype/Foundation/Entries/Fields/ModifiedAtField.php +++ b/src/flextype/Foundation/Entries/Fields/ModifiedAtField.php @@ -9,7 +9,7 @@ declare(strict_types=1); if (flextype('registry')->get('flextype.settings.entries.fields.modified_at.enabled')) { flextype('emitter')->addListener('onEntryAfterInitialized', static function (): void { - if (flextype('entries')->getStorage('fetch_single.data.modified_at') == null) { + if (flextype('entries')->getStorage('fetch_single.data.modified_at') === null) { flextype('entries')->setStorage('fetch_single.data.modified_at', (int) flextype('filesystem')->file(flextype('entries')->getFileLocation(flextype('entries')->getStorage('fetch_single.id')))->lastModified()); } }); diff --git a/src/flextype/Foundation/Entries/Fields/PublishedAtField.php b/src/flextype/Foundation/Entries/Fields/PublishedAtField.php index 4421531b..5bbb7536 100644 --- a/src/flextype/Foundation/Entries/Fields/PublishedAtField.php +++ b/src/flextype/Foundation/Entries/Fields/PublishedAtField.php @@ -9,7 +9,7 @@ declare(strict_types=1); if (flextype('registry')->get('flextype.settings.entries.fields.published_at.enabled')) { flextype('emitter')->addListener('onEntryAfterInitialized', static function (): void { - if (flextype('entries')->getStorage('fetch_single.data.published_at') == null) { + if (flextype('entries')->getStorage('fetch_single.data.published_at') === null) { flextype('entries')->setStorage('fetch_single.data.published_at', (int) flextype('filesytem')->file(flextype('entries')->getFileLocation(flextype('entries')->getStorage('fetch_single.id')))->lastModified()); } else { flextype('entries')->setStorage('fetch_single.data.published_at', (int) strtotime((string) flextype('entries')->getStorage('fetch_single.data.published_at'))); @@ -17,7 +17,7 @@ if (flextype('registry')->get('flextype.settings.entries.fields.published_at.ena }); flextype('emitter')->addListener('onEntryCreate', static function (): void { - if (flextype('entries')->getStorage('create.data.published_at') == null) { + if (flextype('entries')->getStorage('create.data.published_at') === null) { flextype('entries')->setStorage('create.data.published_at', date(flextype('registry')->get('flextype.settings.date_format'), time())); } });