1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-08 14:16:46 +02:00

Merge branch 'dev'

This commit is contained in:
Awilum
2020-12-30 16:15:16 +03:00
27 changed files with 125 additions and 117 deletions

View File

@@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
php: ['7.3', '7.4', '8.0']
php: ['7.4', '8.0']
dependency-version: [prefer-stable]
steps:

View File

@@ -1,5 +1,5 @@
##
# Flextype (http://flextype.org)
# Flextype (https://flextype.org)
# Founded by Sergey Romanenko and maintained by Flextype Community.
#

View File

@@ -5,7 +5,7 @@ Flextype is an MIT-licensed open source project and completely free to use..
However, the amount of effort needed to maintain and develop new features for the project is not sustainable without proper financial backing. You can support it's ongoing development by being a backer or a sponsor:
* [Become a backer or sponsor on Patreon](https://www.patreon.com/awilum).
* [One-time donation via PayPal, QIWI, Sberbank, Yandex](http://flextype.org/en/one-time-donation)
* [One-time donation via PayPal, QIWI, Sberbank, Yandex](https://flextype.org/en/one-time-donation)
* [Visit our Sponsors & Backers page](https://flextype.org/en/sponsors)
### Gold Sponsor

View File

@@ -1,3 +1,24 @@
<a name="0.9.14"></a>
# [0.9.14](https://github.com/flextype/flextype/compare/v0.9.13...v0.9.14) (2020-12-30)
### Features
* **core** Moving to PHP 7.4.0 ([#524](https://github.com/flextype/flextype/issues/524))
* **plugins** Set default plugin priority 100 and SORT them ascending ([#523](https://github.com/flextype/flextype/issues/523))
### Bug Fixes
* **core** fix issue with Rest API endpoints detection. ([#522](https://github.com/flextype/flextype/issues/522))
* **entries** fix issue with empty variable $data in fetch() method. ([#531](https://github.com/flextype/flextype/issues/531))
* **entries** fix issue with deleteStorage() method return data.
### Refactoring
* **core** general code refactoring and improvements.
<a name="0.9.13"></a>
# [0.9.13](https://github.com/flextype/flextype/compare/v0.9.12...v0.9.13) (2020-12-20)

View File

@@ -27,7 +27,7 @@ The underlying architecture of Flextype is built using well established and best
Make sure your server meets the following requirements.
* Webserver (Apache with Mod Rewrite)
* PHP 7.3.0 or higher
* PHP 7.4.0 or higher
#### PHP EXTENSIONS
Flextype needs the following PHP extensions to be enabled:

View File

@@ -17,7 +17,7 @@
"issues": "https://github.com/flextype/flextype/issues"
},
"require": {
"php": "^7.3 || ^8.0",
"php": "^7.4 || ^8.0",
"ext-json": "*",
"ext-dom": "*",
"ext-spl": "*",

View File

@@ -3,7 +3,7 @@
declare(strict_types=1);
/**
* Flextype (http://flextype.org)
* Flextype (https://flextype.org)
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
@@ -21,7 +21,7 @@ use const PHP_VERSION;
/**
* Define the application minimum supported PHP version.
*/
define('FLEXTYPE_MINIMUM_PHP', '7.3.0');
define('FLEXTYPE_MINIMUM_PHP', '7.4.0');
/**
* Define the PATH to the root directory (without trailing slash).
@@ -32,8 +32,8 @@ define('ROOT_DIR', str_replace(DIRECTORY_SEPARATOR, '/', getcwd()));
* Define the PATH (without trailing slash).
*/
define('PATH', [
'project' => ROOT_DIR . '/project',
'tmp' => ROOT_DIR . '/var/tmp',
'project' => ROOT_DIR . '/project',
'tmp' => ROOT_DIR . '/var/tmp',
]);
/**

10
phpstan.neon Normal file
View File

@@ -0,0 +1,10 @@
parameters:
level: 0
reportUnmatchedIgnoredErrors: false
paths:
- src
ignoreErrors:
- '/Constant PATH not found./'
- '/Constant ROOT_DIR not found./'
- '/Variable \$api_errors might not be defined./'
- '/Variable \$registry might not be defined./'

View File

@@ -3,7 +3,7 @@
declare(strict_types=1);
/**
* Flextype (http://flextype.org)
* Flextype (https://flextype.org)
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
@@ -14,7 +14,7 @@ use function filesystem;
/**
* Validate access token
*/
function validate_access_token($token): bool
function validate_access_token(string $token): bool
{
return filesystem()->file(PATH['project'] . '/tokens/access/' . $token . '/token.yaml')->exists();
}

View File

@@ -3,7 +3,7 @@
declare(strict_types=1);
/**
* Flextype (http://flextype.org)
* Flextype (https://flextype.org)
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/

View File

@@ -3,7 +3,7 @@
declare(strict_types=1);
/**
* Flextype (http://flextype.org)
* Flextype (https://flextype.org)
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
@@ -22,7 +22,7 @@ use function is_array;
/**
* Validate entries entries token
*/
function validate_entries_token($token): bool
function validate_entries_token(string $token): bool
{
return filesystem()->file(PATH['project'] . '/tokens/entries/' . $token . '/token.yaml')->exists();
}
@@ -143,7 +143,7 @@ flextype()->get('/api/entries', function (Request $request, Response $response)
*/
flextype()->post('/api/entries', function (Request $request, Response $response) use ($api_errors) {
// Get Post Data
$post_data = $request->getParsedBody();
$post_data = (array) $request->getParsedBody();
if (! isset($post_data['token']) || ! isset($post_data['access_token']) || ! isset($post_data['id']) || ! isset($post_data['data'])) {
return $response
@@ -253,7 +253,7 @@ flextype()->post('/api/entries', function (Request $request, Response $response)
*/
flextype()->patch('/api/entries', function (Request $request, Response $response) use ($api_errors) {
// Get Post Data
$post_data = $request->getParsedBody();
$post_data = (array) $request->getParsedBody();
if (! isset($post_data['token']) || ! isset($post_data['access_token']) || ! isset($post_data['id']) || ! isset($post_data['data'])) {
return $response
@@ -363,7 +363,7 @@ flextype()->patch('/api/entries', function (Request $request, Response $response
*/
flextype()->put('/api/entries', function (Request $request, Response $response) use ($api_errors) {
// Get Post Data
$post_data = $request->getParsedBody();
$post_data = (array) $request->getParsedBody();
if (! isset($post_data['token']) || ! isset($post_data['access_token']) || ! isset($post_data['id']) || ! isset($post_data['new_id'])) {
return $response
@@ -474,7 +474,7 @@ flextype()->put('/api/entries', function (Request $request, Response $response)
*/
flextype()->put('/api/entries/copy', function (Request $request, Response $response) use ($api_errors) {
// Get Post Data
$post_data = $request->getParsedBody();
$post_data = (array) $request->getParsedBody();
if (! isset($post_data['token']) || ! isset($post_data['access_token']) || ! isset($post_data['id']) || ! isset($post_data['new_id'])) {
return $response
@@ -584,7 +584,7 @@ flextype()->put('/api/entries/copy', function (Request $request, Response $respo
*/
flextype()->delete('/api/entries', function (Request $request, Response $response) use ($api_errors) {
// Get Post Data
$post_data = $request->getParsedBody();
$post_data = (array) $request->getParsedBody();
if (! isset($post_data['token']) || ! isset($post_data['access_token']) || ! isset($post_data['id'])) {
return $response

View File

@@ -3,7 +3,7 @@
declare(strict_types=1);
/**
* Flextype (http://flextype.org)
* Flextype (https://flextype.org)
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
@@ -19,7 +19,7 @@ use function flextype;
/**
* Validate images token
*/
function validate_images_token($token): bool
function validate_images_token(string $token): bool
{
return filesystem()->file(PATH['project'] . '/tokens/images/' . $token . '/token.yaml')->exists();
}

View File

@@ -3,7 +3,7 @@
declare(strict_types=1);
/**
* Flextype (http://flextype.org)
* Flextype (https://flextype.org)
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
@@ -23,7 +23,7 @@ use function is_dir;
/**
* Validate files token
*/
function validate_files_token($token): bool
function validate_files_token(string $token): bool
{
return filesystem()->file(PATH['project'] . '/tokens/media/files/' . $token . '/token.yaml')->exists();
}
@@ -31,7 +31,7 @@ function validate_files_token($token): bool
/**
* Validate folders token
*/
function validate_folders_token($token): bool
function validate_folders_token(string $token): bool
{
return filesystem()->file(PATH['project'] . '/tokens/media/folders/' . $token . '/token.yaml')->exists();
}
@@ -155,7 +155,7 @@ flextype()->get('/api/media/files', function (Request $request, Response $respon
*/
flextype()->post('/api/media/files', function (Request $request, Response $response) use ($api_errors) {
// Get Post Data
$post_data = $request->getParsedBody();
$post_data = (array) $request->getParsedBody();
if (! isset($post_data['token']) || ! isset($post_data['access_token']) || ! isset($post_data['folder']) || ! isset($_FILES['file'])) {
return $response->withStatus($api_errors['0501']['http_status_code'])
@@ -265,7 +265,7 @@ flextype()->post('/api/media/files', function (Request $request, Response $respo
*/
flextype()->put('/api/media/files', function (Request $request, Response $response) use ($api_errors) {
// Get Post Data
$post_data = $request->getParsedBody();
$post_data = (array) $request->getParsedBody();
if (! isset($post_data['token']) || ! isset($post_data['access_token']) || ! isset($post_data['id']) || ! isset($post_data['new_id'])) {
return $response->withStatus($api_errors['0501']['http_status_code'])
@@ -374,7 +374,7 @@ flextype()->put('/api/media/files', function (Request $request, Response $respon
*/
flextype()->put('/api/media/files/copy', function (Request $request, Response $response) use ($api_errors) {
// Get Post Data
$post_data = $request->getParsedBody();
$post_data = (array) $request->getParsedBody();
if (! isset($post_data['token']) || ! isset($post_data['access_token']) || ! isset($post_data['id']) || ! isset($post_data['new_id'])) {
return $response->withStatus($api_errors['0501']['http_status_code'])
@@ -482,7 +482,7 @@ flextype()->put('/api/media/files/copy', function (Request $request, Response $r
*/
flextype()->delete('/api/media/files', function (Request $request, Response $response) use ($api_errors) {
// Get Post Data
$post_data = $request->getParsedBody();
$post_data = (array) $request->getParsedBody();
if (! isset($post_data['id']) || ! isset($post_data['access_token']) || ! isset($post_data['id'])) {
return $response->withStatus($api_errors['0501']['http_status_code'])
@@ -533,7 +533,7 @@ flextype()->delete('/api/media/files', function (Request $request, Response $res
$response_code = $delete_file ? 204 : 404;
// Update calls counter
filesystem()->file($files_token_file_path)->get(flextype('serializers')->yaml()->encode(array_replace_recursive($files_token_file_data, ['calls' => $files_token_file_data['calls'] + 1])));
filesystem()->file($files_token_file_path)->put(flextype('serializers')->yaml()->encode(array_replace_recursive($files_token_file_data, ['calls' => $files_token_file_data['calls'] + 1])));
if ($response_code === 404) {
// Return response
@@ -585,7 +585,7 @@ flextype()->delete('/api/media/files', function (Request $request, Response $res
*/
flextype()->patch('/api/media/files/meta', function (Request $request, Response $response) use ($api_errors) {
// Get Post Data
$post_data = $request->getParsedBody();
$post_data = (array) $request->getParsedBody();
if (! isset($post_data['token']) || ! isset($post_data['access_token']) || ! isset($post_data['id']) || ! isset($post_data['field']) || ! isset($post_data['value'])) {
return $response->withStatus($api_errors['0501']['http_status_code'])
@@ -609,7 +609,7 @@ flextype()->patch('/api/media/files/meta', function (Request $request, Response
// Set files and access token file
if (
($files_token_file_data = flextype('serializers')->yaml()->decode(filesystem()->file($files_token_file_path)->get())) &&
($access_token_file_data = flextype('serializers')->yaml()->decode(filesystem()->file($access_token_file_path)->get($access_token_file_path)))
($access_token_file_data = flextype('serializers')->yaml()->decode(filesystem()->file($access_token_file_path)->get()))
) {
if (
$files_token_file_data['state'] === 'disabled' ||
@@ -696,7 +696,7 @@ flextype()->patch('/api/media/files/meta', function (Request $request, Response
*/
flextype()->post('/api/media/files/meta', function (Request $request, Response $response) use ($api_errors) {
// Get Post Data
$post_data = $request->getParsedBody();
$post_data = (array) $request->getParsedBody();
if (! isset($post_data['token']) || ! isset($post_data['access_token']) || ! isset($post_data['id']) || ! isset($post_data['field']) || ! isset($post_data['value'])) {
return $response->withStatus($api_errors['0501']['http_status_code'])
@@ -807,7 +807,7 @@ flextype()->post('/api/media/files/meta', function (Request $request, Response $
*/
flextype()->delete('/api/media/files/meta', function (Request $request, Response $response) use ($api_errors) {
// Get Post Data
$post_data = $request->getParsedBody();
$post_data = (array) $request->getParsedBody();
if (! isset($post_data['token']) || ! isset($post_data['access_token']) || ! isset($post_data['id']) || ! isset($post_data['field'])) {
return $response->withStatus($api_errors['0501']['http_status_code'])
@@ -1020,7 +1020,7 @@ flextype()->get('/api/media/folders', function (Request $request, Response $resp
*/
flextype()->post('/api/media/folders', function (Request $request, Response $response) use ($api_errors) {
// Get Post Data
$post_data = $request->getParsedBody();
$post_data = (array) $request->getParsedBody();
if (! isset($post_data['token']) || ! isset($post_data['access_token']) || ! isset($post_data['id'])) {
return $response->withStatus($api_errors['0601']['http_status_code'])
@@ -1126,7 +1126,7 @@ flextype()->post('/api/media/folders', function (Request $request, Response $res
*/
flextype()->put('/api/media/folders/copy', function (Request $request, Response $response) use ($api_errors) {
// Get Post Data
$post_data = $request->getParsedBody();
$post_data = (array) $request->getParsedBody();
if (! isset($post_data['token']) || ! isset($post_data['access_token']) || ! isset($post_data['id']) || ! isset($post_data['new_id'])) {
return $response->withStatus($api_errors['0601']['http_status_code'])
@@ -1235,7 +1235,7 @@ flextype()->put('/api/media/folders/copy', function (Request $request, Response
*/
flextype()->put('/api/media/folders', function (Request $request, Response $response) use ($api_errors) {
// Get Post Data
$post_data = $request->getParsedBody();
$post_data = (array) $request->getParsedBody();
if (! isset($post_data['token']) || ! isset($post_data['access_token']) || ! isset($post_data['id']) || ! isset($post_data['new_id'])) {
return $response->withStatus($api_errors['0601']['http_status_code'])
@@ -1341,7 +1341,7 @@ flextype()->put('/api/media/folders', function (Request $request, Response $resp
*/
flextype()->delete('/api/media/folders', function (Request $request, Response $response) use ($api_errors) {
// Get Post Data
$post_data = $request->getParsedBody();
$post_data = (array) $request->getParsedBody();
if (! isset($post_data['token']) || ! isset($post_data['access_token']) || ! isset($post_data['id'])) {
return $response->withStatus($api_errors['0601']['http_status_code'])

View File

@@ -3,7 +3,7 @@
declare(strict_types=1);
/**
* Flextype (http://flextype.org)
* Flextype (https://flextype.org)
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
@@ -19,7 +19,7 @@ use function flextype;
/**
* Validate registry token
*/
function validate_registry_token($token): bool
function validate_registry_token(string $token): bool
{
return filesystem()->file(PATH['project'] . '/tokens/registry/' . $token . '/token.yaml')->exists();
}

View File

@@ -33,7 +33,7 @@ class Entries
* @var array
* @access private
*/
private $storage = [
private array $storage = [
'fetch' => [
'id' => '',
'data' => [],
@@ -74,7 +74,7 @@ class Entries
*
* @access public
*
* @return self Returns instance of The Arrays class.
* @return Arrays Returns instance of The Arrays class with items.
*/
public function fetch(string $id, array $options = []): Arrays
{
@@ -179,6 +179,9 @@ class Entries
// Walk through entries results
if ($entries->hasResults()) {
$data = [];
foreach ($entries as $currenEntry) {
if ($currenEntry->getType() !== 'file' || $currenEntry->getFilename() !== 'entry' . '.' . flextype('registry')->get('flextype.settings.entries.extension')) {
continue;
@@ -415,11 +418,13 @@ class Entries
*
* @access public
*
* @return array Updated storage.
* @return self Returns instance of The Entries class.
*/
public function setStorage(?string $key, $value): void
public function setStorage(?string $key, $value): self
{
$this->storage = arrays($this->storage)->set($key, $value)->toArray();
return $this;
}
/**
@@ -427,11 +432,13 @@ class Entries
*
* @param array|string $keys Keys
*
* @return array Updated storage.
* @return self Returns instance of The Entries class.
*/
public function deleteStorage($keys): self
{
return $this->storage = arrays($this->storage)->delete($keys)->toArray();
$this->storage = arrays($this->storage)->delete($keys)->toArray();
return $this;
}
/**

View File

@@ -14,6 +14,7 @@ if (flextype('registry')->get('flextype.settings.entries.fields.entries.fetch.en
if (flextype('entries')->hasStorage('fetch.data.entries.fetch')) {
// Get fetch.
$original = flextype('entries')->getStorage('fetch');
$data = [];
switch (flextype('registry')->get('flextype.settings.entries.fields.entries.fetch.result')) {
case 'toArray':

View File

@@ -14,6 +14,7 @@ if (flextype('registry')->get('flextype.settings.entries.fields.media.files.fetc
if (flextype('entries')->hasStorage('fetch.data.media.files.fetch')) {
// Get fetch.
$original = flextype('entries')->getStorage('fetch');
$data = [];
switch (flextype('registry')->get('flextype.settings.entries.fields.media.files.fetch.result')) {
case 'toArray':
@@ -63,6 +64,7 @@ if (flextype('registry')->get('flextype.settings.entries.fields.media.folders.fe
// Get fetch.
$original = flextype('entries')->getStorage('fetch');
$data = [];
switch (flextype('registry')->get('flextype.settings.entries.fields.media.folders.fetch.result')) {
case 'toArray':

View File

@@ -22,7 +22,7 @@ final class Flextype extends App
/**
* Flextype version
*/
public const VERSION = '0.9.13';
public const VERSION = '0.9.14';
/**
* The Flextype's instance is stored in a static field. This field is an
@@ -31,7 +31,7 @@ final class Flextype extends App
*
* @var array
*/
private static $instances = [];
private static array $instances = [];
/**
* Flextype should not be cloneable.
@@ -88,16 +88,6 @@ final class Flextype extends App
return self::$instances[$cls];
}
/**
* Determine API Request
*
* @return bool
*/
public function isApiRequest(): bool
{
return explode('/', Uri::createFromEnvironment(new Environment($_SERVER))->getPath())[0] === 'api';
}
/**
* Returns the current Flextype version
*/

View File

@@ -3,7 +3,7 @@
declare(strict_types=1);
/**
* Flextype (http://flextype.org)
* Flextype (https://flextype.org)
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/

View File

@@ -34,7 +34,7 @@ class Plugins
*
* @var array
*/
private $locales = [];
private array $locales = [];
/**
* Constructor
@@ -95,13 +95,14 @@ class Plugins
}
} else {
// Init plugin configs
$plugins = [];
$plugins = [];
$defaultPluginSettings = [];
$projectPluginSettings = [];
$defaultPluginManifest = [];
// Go through...
foreach ($pluginsList as $plugin) {
// Set plugin settings directory
$projectPluginSettingsDir = PATH['project'] . '/config/plugins/' . $plugin['dirname'];
@@ -121,7 +122,7 @@ class Plugins
}
// Get default plugin settings content
$defaultPluginSettingsFileContent = filesystem()->file($defaultPluginSettingsFile)->get();
$defaultPluginSettingsFileContent = filesystem()->file($defaultPluginSettingsFile)->get();
$defaultPluginSettings = flextype('serializers')->yaml()->decode($defaultPluginSettingsFileContent);
// Create project plugin settings file
@@ -142,7 +143,7 @@ class Plugins
}
// Get default plugin manifest content
$defaultPluginManifestFileContent = filesystem()->file($defaultPluginManifestFile)->get();
$defaultPluginManifestFileContent = filesystem()->file($defaultPluginManifestFile)->get();
$defaultPluginManifest = flextype('serializers')->yaml()->decode($defaultPluginManifestFileContent);
// Merge plugin settings and manifest data
@@ -160,7 +161,7 @@ class Plugins
}
// Sort plugins list by priority.
$plugins = arrays($plugins)->sortBy('_priority', 'DESC')->toArray();
$plugins = arrays($plugins)->sortBy('_priority', 'ASC')->toArray();
// ... and delete tmp _priority field for sorting
foreach ($plugins as $pluginName => $pluginData) {
@@ -378,7 +379,7 @@ class Plugins
continue;
}
include_once PATH['project'] . '/plugins/' . $pluginName . '/bootstrap.php';
include_once PATH['project'] . '/plugins/' . $pluginName . '/plugin.php';
}
}
}

View File

@@ -3,7 +3,7 @@
declare(strict_types=1);
/**
* Flextype (http://flextype.org)
* Flextype (https://flextype.org)
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/

View File

@@ -3,11 +3,11 @@
declare(strict_types=1);
/**
* Flextype (http://flextype.org)
* Flextype (https://flextype.org)
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
use Symfony\Component\Finder\Finder;
use Symfony\Component\Finder\Finder as Finder;
if (! function_exists('find')) {
/**
@@ -17,7 +17,7 @@ if (! function_exists('find')) {
* @param array $options Options array.
* @param string $searchIn Search in 'files' or 'directories'. Default is 'files'.
*
* @return Symfony\Component\Finder<Finder>
* @return Finder
*/
function find(string $path = '', array $options = [], string $searchIn = 'files'): Finder
{

View File

@@ -49,8 +49,6 @@ final class Shortcode
/**
* Shortcode construct
*
* @param
*/
protected function __construct()
{
@@ -59,8 +57,6 @@ final class Shortcode
/**
* Shortcode facade
*
* @param
*/
public function facade(): ShortcodeFacade
{
@@ -69,8 +65,6 @@ final class Shortcode
/**
* Returns Shortcode Instance
*
* @param
*/
public static function getInstance(): Shortcode
{

View File

@@ -3,7 +3,7 @@
declare(strict_types=1);
/**
* Flextype (http://flextype.org)
* Flextype (https://flextype.org)
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
@@ -57,7 +57,6 @@ $flextype = Flextype::getInstance([
],
]);
/**
* Display Errors
*/
@@ -172,14 +171,12 @@ flextype('plugins')->init();
/**
* Include API ENDPOINTS
*/
if (flextype()->isApiRequest()) {
include_once ROOT_DIR . '/src/flextype/Endpoints/Utils/errors.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/Utils/access.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/entries.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/registry.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/media.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/images.php';
}
include_once ROOT_DIR . '/src/flextype/Endpoints/Utils/errors.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/Utils/access.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/entries.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/registry.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/media.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/images.php';
/**
* Enable lazy CORS
@@ -190,6 +187,11 @@ if (flextype()->isApiRequest()) {
*/
flextype('cors')->init();
/**
* Run high priority event: onFlextypeBeforeRun before Flextype Application starts.
*/
flextype('emitter')->emit('onFlextypeBeforeRun');
/**
* Run application
*/

View File

@@ -3,7 +3,7 @@
declare(strict_types=1);
/**
* Flextype (http://flextype.org)
* Flextype (https://flextype.org)
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
@@ -54,23 +54,17 @@ use function sys_get_temp_dir;
/**
* Create a standard session hanndler
*/
flextype()->container()['session'] = static function () {
return new Session();
};
flextype()->container()['session'] = fn() => new Session();
/**
* Supply a custom callable resolver, which resolves PSR-15 middlewares.
*/
flextype()->container()['callableResolver'] = static function () {
return new CallableResolver(flextype()->container());
};
flextype()->container()['callableResolver'] = fn() => new CallableResolver(flextype()->container());
/**
* Add registry service to Flextype container
*/
flextype()->container()['registry'] = static function () use ($registry) {
return $registry;
};
flextype()->container()['registry'] = $registry;
/**
* Add logger service to Flextype container
@@ -85,9 +79,7 @@ flextype()->container()['logger'] = static function () {
/**
* Add emitter service to Flextype container
*/
flextype()->container()['emitter'] = static function () {
return new Emitter();
};
flextype()->container()['emitter'] = fn() => new Emitter();
/**
* Add slugify service to Flextype container
@@ -216,16 +208,12 @@ flextype()->container()['cache'] = static function () {
/**
* Add parsers service to Flextype container
*/
flextype()->container()['parsers'] = static function () {
return new Parsers();
};
flextype()->container()['parsers'] = fn() => new Parsers();
/**
* Add serializer service to Flextype container
*/
flextype()->container()['serializers'] = static function () {
return new Serializers();
};
flextype()->container()['serializers'] = fn() => new Serializers();
/**
* Add images service to Flextype container
@@ -285,27 +273,19 @@ flextype()->container()['images'] = static function () {
/**
* Add entries service to Flextype container
*/
flextype()->container()['entries'] = static function () {
return new Entries();
};
flextype()->container()['entries'] = fn() => new Entries();
/**
* Add media service to Flextype container
*/
flextype()->container()['media'] = static function () {
return new Media();
};
flextype()->container()['media'] = fn() => new Media();
/**
* Add plugins service to Flextype container
*/
flextype()->container()['plugins'] = static function () {
return new Plugins();
};
flextype()->container()['plugins'] = fn() => new Plugins();
/**
* Add cors service to Flextype container
*/
flextype()->container()['cors'] = static function () {
return new Cors();
};
flextype()->container()['cors'] = fn() => new Cors();

View File

@@ -1,5 +1,5 @@
name: Flextype
version: 0.9.13
version: 0.9.14
description: Hybrid Content Management System
author:
name: Sergey Romanenko

View File

@@ -8,7 +8,7 @@ $flextypeManifestFilePath = ROOT_DIR . '/src/flextype/flextype.yaml';
$defaultFlextypeSettingsFilePath = ROOT_DIR . '/src/flextype/settings.yaml';
$customFlextypeSettingsFilePath = PATH['project'] . '/config/flextype/settings.yaml';
$preflightFlextypePath = PATH['tmp'] . '/preflight/flextype/';
$customFlextypeSettingsPath = PATH['project'] . '/config/flextype/';
$customFlextypeSettingsPath = PATH['project'] . '/config/flextype/';
! filesystem()->directory($preflightFlextypePath)->exists() and filesystem()->directory($preflightFlextypePath)->create(0755, true);
! filesystem()->directory($customFlextypeSettingsPath)->exists() and filesystem()->directory($customFlextypeSettingsPath)->create(0755, true);