diff --git a/composer.json b/composer.json index 5d69e549..63df5e6b 100755 --- a/composer.json +++ b/composer.json @@ -81,6 +81,8 @@ "victorjonsson/markdowndocs": "^1.3.8" }, "config": { + "apcu-autoloader": true, + "optimize-autoloader": true, "platform-check": false, "sort-packages": true, "allow-plugins": { diff --git a/src/flextype/core/Entries/Entries.php b/src/flextype/core/Entries/Entries.php index fff8b220..f4d4165b 100755 --- a/src/flextype/core/Entries/Entries.php +++ b/src/flextype/core/Entries/Entries.php @@ -124,7 +124,7 @@ class Entries continue; } - if (filesystem()->file(ROOT_DIR . $value['path'])->exists()) { + if (filesystem()->file(ROOT_DIR . '/' . $value['path'])->exists()) { include_once ROOT_DIR . '/' . $value['path']; } } @@ -140,7 +140,7 @@ class Entries public function initDirectives(array $directives): void { foreach ($directives as $key => $value) { - if (filesystem()->file(ROOT_DIR . $value['path'])->exists()) { + if (filesystem()->file(ROOT_DIR . '/' . $value['path'])->exists()) { include_once ROOT_DIR . '/' . $value['path']; } } @@ -498,7 +498,7 @@ class Entries $currentEntryID = strings($currenEntry->getPath()) ->replace('\\', '/') - ->replace(PATH['project'] . $this->options['directory'] . '/', '') + ->replace(PATH['project'] . '/' . $this->options['directory'] . '/', '') ->trim('/') ->toString(); @@ -893,7 +893,7 @@ class Entries return $this->registry()->get('methods.getFileLocation.result'); } - return PATH['project'] . $this->options['directory'] . '/' . $this->registry()->get('methods.getFileLocation.params.id') . '/' . $this->registry()->get('methods.getFileLocation.collection.filename') . '.' . $this->registry()->get('methods.getFileLocation.collection.extension'); + return PATH['project'] . '/' . $this->options['directory'] . '/' . $this->registry()->get('methods.getFileLocation.params.id') . '/' . $this->registry()->get('methods.getFileLocation.collection.filename') . '.' . $this->registry()->get('methods.getFileLocation.collection.extension'); } /** @@ -924,7 +924,7 @@ class Entries return $this->registry()->get('methods.getDirectoryLocation.result'); } - return PATH['project'] . $this->options['directory'] . '/' . $this->registry()->get('methods.getDirectoryLocation.params.id'); + return PATH['project'] . '/' . $this->options['directory'] . '/' . $this->registry()->get('methods.getDirectoryLocation.params.id'); } /** diff --git a/src/flextype/core/Entries/Fields/Default/CreatedAtField.php b/src/flextype/core/Entries/Fields/Default/CreatedAtField.php index 024ad20c..2686f53c 100644 --- a/src/flextype/core/Entries/Fields/Default/CreatedAtField.php +++ b/src/flextype/core/Entries/Fields/Default/CreatedAtField.php @@ -20,9 +20,9 @@ emitter()->addListener('onEntriesFetchSingleHasResult', static function (): void if (! entries()->registry()->get('methods.fetch.collection.fields.created_at.enabled')) { return; } - + // Determine is the current field file path is the same. - if (! strings(__FILE__)->replace(ROOT_DIR, '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.created_at.path'))) { + if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.created_at.path'))) { return; } diff --git a/src/flextype/core/Entries/Fields/Default/CreatedByField.php b/src/flextype/core/Entries/Fields/Default/CreatedByField.php index 6a650fe2..88ab8e67 100644 --- a/src/flextype/core/Entries/Fields/Default/CreatedByField.php +++ b/src/flextype/core/Entries/Fields/Default/CreatedByField.php @@ -22,7 +22,7 @@ emitter()->addListener('onEntriesCreate', static function (): void { } // Determine is the current field file path is the same. - if (! strings(__FILE__)->replace(ROOT_DIR, '')->isEqual(entries()->registry()->get('methods.create.collection.fields.created_by.path'))) { + if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.create.collection.fields.created_by.path'))) { return; } diff --git a/src/flextype/core/Entries/Fields/Default/IdField.php b/src/flextype/core/Entries/Fields/Default/IdField.php index 317b90d9..9bb774ee 100644 --- a/src/flextype/core/Entries/Fields/Default/IdField.php +++ b/src/flextype/core/Entries/Fields/Default/IdField.php @@ -22,7 +22,7 @@ emitter()->addListener('onEntriesFetchSingleHasResult', static function (): void } // Determine is the current field file path is the same. - if (! strings(__FILE__)->replace(ROOT_DIR, '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.id.path'))) { + if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.id.path'))) { return; } diff --git a/src/flextype/core/Entries/Fields/Default/ModifiedAtField.php b/src/flextype/core/Entries/Fields/Default/ModifiedAtField.php index 469b499b..6aa1d67f 100644 --- a/src/flextype/core/Entries/Fields/Default/ModifiedAtField.php +++ b/src/flextype/core/Entries/Fields/Default/ModifiedAtField.php @@ -22,7 +22,7 @@ emitter()->addListener('onEntriesFetchSingleHasResult', static function (): void } // Determine is the current field file path is the same. - if (! strings(__FILE__)->replace(ROOT_DIR, '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.modified_at.path'))) { + if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.modified_at.path'))) { return; } diff --git a/src/flextype/core/Entries/Fields/Default/PublishedAtField.php b/src/flextype/core/Entries/Fields/Default/PublishedAtField.php index 0d6be195..8b8bbd36 100644 --- a/src/flextype/core/Entries/Fields/Default/PublishedAtField.php +++ b/src/flextype/core/Entries/Fields/Default/PublishedAtField.php @@ -22,7 +22,7 @@ emitter()->addListener('onEntriesFetchSingleHasResult', static function (): void } // Determine is the current field file path is the same. - if (! strings(__FILE__)->replace(ROOT_DIR, '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.published_at.path'))) { + if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.published_at.path'))) { return; } diff --git a/src/flextype/core/Entries/Fields/Default/PublishedByField.php b/src/flextype/core/Entries/Fields/Default/PublishedByField.php index c24a82cf..dc2b8227 100644 --- a/src/flextype/core/Entries/Fields/Default/PublishedByField.php +++ b/src/flextype/core/Entries/Fields/Default/PublishedByField.php @@ -22,7 +22,7 @@ emitter()->addListener('onEntriesCreate', static function (): void { } // Determine is the current field file path is the same. - if (! strings(__FILE__)->replace(ROOT_DIR, '')->isEqual(entries()->registry()->get('methods.create.collection.fields.published_by.path'))) { + if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.create.collection.fields.published_by.path'))) { return; } diff --git a/src/flextype/core/Entries/Fields/Default/RoutableField.php b/src/flextype/core/Entries/Fields/Default/RoutableField.php index 36a17498..8da74640 100644 --- a/src/flextype/core/Entries/Fields/Default/RoutableField.php +++ b/src/flextype/core/Entries/Fields/Default/RoutableField.php @@ -22,7 +22,7 @@ emitter()->addListener('onEntriesFetchSingleHasResult', static function (): void } // Determine is the current field file path is the same. - if (! strings(__FILE__)->replace(ROOT_DIR, '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.routable.path'))) { + if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.routable.path'))) { return; } diff --git a/src/flextype/core/Entries/Fields/Default/SlugField.php b/src/flextype/core/Entries/Fields/Default/SlugField.php index cbb7bb39..676f6072 100644 --- a/src/flextype/core/Entries/Fields/Default/SlugField.php +++ b/src/flextype/core/Entries/Fields/Default/SlugField.php @@ -22,7 +22,7 @@ emitter()->addListener('onEntriesFetchSingleHasResult', static function (): void } // Determine is the current field file path is the same. - if (! strings(__FILE__)->replace(ROOT_DIR, '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.slug.path'))) { + if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.slug.path'))) { return; } diff --git a/src/flextype/core/Entries/Fields/Default/UuidField.php b/src/flextype/core/Entries/Fields/Default/UuidField.php index 9d75ee06..e38fad9f 100644 --- a/src/flextype/core/Entries/Fields/Default/UuidField.php +++ b/src/flextype/core/Entries/Fields/Default/UuidField.php @@ -24,7 +24,7 @@ emitter()->addListener('onEntriesCreate', static function (): void { } // Determine is the current field file path is the same. - if (! strings(__FILE__)->replace(ROOT_DIR, '')->isEqual(entries()->registry()->get('methods.create.collection.fields.uuid.path'))) { + if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.create.collection.fields.uuid.path'))) { return; } diff --git a/src/flextype/core/Entries/Fields/Default/VisibilityField.php b/src/flextype/core/Entries/Fields/Default/VisibilityField.php index 6fe951ae..48fd37a1 100644 --- a/src/flextype/core/Entries/Fields/Default/VisibilityField.php +++ b/src/flextype/core/Entries/Fields/Default/VisibilityField.php @@ -22,7 +22,7 @@ emitter()->addListener('onEntriesFetchSingleHasResult', static function (): void } // Determine is the current field file path is the same. - if (! strings(__FILE__)->replace(ROOT_DIR, '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.visibility.path'))) { + if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.visibility.path'))) { return; } diff --git a/src/flextype/core/Entries/Fields/Tokens/Items/CallsField.php b/src/flextype/core/Entries/Fields/Tokens/Items/CallsField.php index 42af54de..4a21c18d 100644 --- a/src/flextype/core/Entries/Fields/Tokens/Items/CallsField.php +++ b/src/flextype/core/Entries/Fields/Tokens/Items/CallsField.php @@ -22,7 +22,7 @@ emitter()->addListener('onEntriesCreate', static function (): void { } // Determine is the current field file path is the same. - if (! strings(__FILE__)->replace(ROOT_DIR, '')->isEqual(entries()->registry()->get('methods.create.collection.fields.calls.path'))) { + if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.create.collection.fields.calls.path'))) { return; } diff --git a/src/flextype/core/Entries/Fields/Tokens/Items/IdField.php b/src/flextype/core/Entries/Fields/Tokens/Items/IdField.php index ef8722ec..a2e8171a 100644 --- a/src/flextype/core/Entries/Fields/Tokens/Items/IdField.php +++ b/src/flextype/core/Entries/Fields/Tokens/Items/IdField.php @@ -22,7 +22,7 @@ emitter()->addListener('onEntriesFetchSingleHasResult', static function (): void } // Determine is the current field file path is the same. - if (! strings(__FILE__)->replace(ROOT_DIR, '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.id.path'))) { + if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.id.path'))) { return; } diff --git a/src/flextype/core/Entries/Fields/Tokens/Items/LimitCallsField.php b/src/flextype/core/Entries/Fields/Tokens/Items/LimitCallsField.php index 18d462b9..f8a88979 100644 --- a/src/flextype/core/Entries/Fields/Tokens/Items/LimitCallsField.php +++ b/src/flextype/core/Entries/Fields/Tokens/Items/LimitCallsField.php @@ -22,7 +22,7 @@ emitter()->addListener('onEntriesCreate', static function (): void { } // Determine is the current field file path is the same. - if (! strings(__FILE__)->replace(ROOT_DIR, '')->isEqual(entries()->registry()->get('methods.create.collection.fields.limit_calls.path'))) { + if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.create.collection.fields.limit_calls.path'))) { return; } diff --git a/src/flextype/core/Entries/Fields/Tokens/Items/StateField.php b/src/flextype/core/Entries/Fields/Tokens/Items/StateField.php index 52b79856..438bf45d 100644 --- a/src/flextype/core/Entries/Fields/Tokens/Items/StateField.php +++ b/src/flextype/core/Entries/Fields/Tokens/Items/StateField.php @@ -22,7 +22,7 @@ emitter()->addListener('onEntriesCreate', static function (): void { } // Determine is the current field file path is the same. - if (! strings(__FILE__)->replace(ROOT_DIR, '')->isEqual(entries()->registry()->get('methods.create.collection.fields.state.path'))) { + if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.create.collection.fields.state.path'))) { return; } diff --git a/src/flextype/core/Parsers/Shortcodes.php b/src/flextype/core/Parsers/Shortcodes.php index ee7656c2..f1da3acb 100644 --- a/src/flextype/core/Parsers/Shortcodes.php +++ b/src/flextype/core/Parsers/Shortcodes.php @@ -117,7 +117,7 @@ final class Shortcodes continue; } - if (! file_exists(ROOT_DIR . $shortcode['path'])) { + if (! file_exists(ROOT_DIR . '/' . $shortcode['path'])) { continue; }