Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Awilum committed Mar 3, 2020
2 parents 3a3c5cb + 3185e73 commit cfb8e60
Show file tree
Hide file tree
Showing 309 changed files with 11,013 additions and 6,475 deletions.
189 changes: 175 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,166 @@
<a name="0.9.6"></a>
# [0.9.6](https://github.com/flextype/flextype/compare/v0.9.5...v0.9.6) (2019-12-01)
<a name="0.9.7"></a>
# [0.9.7](https://github.com/flextype/flextype/compare/v0.9.6...v0.9.7) (2020-03-03)

### Features
* **core:** add Delivery API's for Entries, Images and Registry. #159

Use Flextype as a Headless CMS with the full power of the Admin Panel.
Build a Websites and Apps with a technology you are familiar with.

Endpoints for Delivery API's:
```
/api/delivery/entries
/api/delivery/images
/api/delivery/registry
```

* **core:** add new core constants `PATH['tokens']`, `PATH['accounts']`, `PATH['logs']`, `PATH['uploads']`
* **core:** add new locales support Persian, Indonesian, Galician #327
* **core:** add alternative comparison syntax for Entries API

Alternative comparison syntax:
```
!= - Not equals to
like - Contains the substring
```

* **core:** set entries field `routable`=`true` on new entry creation #320
* **core:** use `array_merge()` instead of `array_replace_recursive()` for entries update method.
* **core:** initialize plugins before themes #323
* **core:** update Cache to use adapter to retrieve driver object #341
* **core:** load Shortcodes extensions based on `flextype.shortcodes.extensions` array #352
* **core:** load Twig extensions based on flextype.twig.extensions array #351
* **core:** add new Global Vars `PATH_ACCOUNTS`, `PATH_UPLOADS`, `PATH_TOKENS`, `PATH_LOGS` for Twig.
* **default-theme:** Moving to Tailwind CSS from Twitter Bootstrap #356
* **site-plugin:** add ability to set custom site url, new shortcode `[site_url]` and twig var `{{ site_url }}`
* **form-plugin:** add new Form plugin for forms handling instead of core Forms API.
* **icon-plugin:** add new Icon plugin for Font Awesome icons set.

usage in templates:
```
<i class="icon">{{ icon('fab fa-apple') }}</i>
```

usage in entries content:
```
[icon value="fab fa-apple"]
```

* **(site-plugin):** add ability to access `uri` variable in the theme templates.

usage in templates:
```
{{ uri }}
```

* **admin-plugin:** add RTL support for URLs #62

/site/config/plugins/admin/settings.yaml
```
...
entries:
slugify: true # set `false` to disable slugify for entries
```

* **admin-plugin:** add ability to deactivate/activate all type of plugins. #211
* **admin-plugin:** add Confirmation Required modal for system plugins deactivation.
* **admin-plugin:** new Admin Panel UI with better UX and powered by Tailwind CSS.
* **admin-plugin:** new improved entries media manager page.
* **admin-plugin:** add ability to continue editing after saving in the editor.
* **admin-plugin:** add action `onAdminThemeTail` for admin panel `base` layout.
* **admin-plugin:** add ability to change entries view from `list view` to `table view`.

/site/config/plugins/admin/settings.yaml
```
...
entries:
items_view_default: list # set `table` for table entries view
```

* **admin-plugin:** increase upload limit for `_uploadFile` from 3mb to 5mb
* **admin-plugin:** do not rewrite plugins and themes manifest with custom manifests.
* **admin-plugin:** add parsleys for frontend form validation.
* **admin-plugin:** add select2 for all select form controls.
* **admin-plugin:** add swal for all modals.
* **admin-plugin:** add flatpickr for date and time.
* **admin-plugin:** add tippy.js for all tooltips and dropdown menus.
* **admin-plugin:** add confirmation modals powered by swal for all critical actions.
* **admin-plugin:** add dim color for entries with `draft`, `hidden` and `routable`=`false` status #324
* **admin-plugin:** add ability to select entry type in the nice modal on entry creation. #331
* **admin-plugin:** add new setting `entries.items_view_default` with default value `list`.
* **admin-plugin:** add ability for redirect to the editor after creating #343
* **admin-plugin:** add ability to create default API tokens on installation process.
* **admin-plugin:** add ability to use local SVG version of Font Awesome Icons #322

usage in templates:
```
<i class="icon">{{ icon('fas fa-ellipsis-h') }}</i>
```

### Bug Fixes

* **admin-plugin:** fix issue with saving entry source #251
* **admin-plugin:** fix file browser styles
* **admin-plugin:** fix breadcrumbs for theme templates
* **core:** Entries API - fix Collection Undefined Index(s) for fetchAll method #243
* **core:** fix broken logic for form inputs without labels #274
* **core:** fix default and site settings loading #297
* **core:** fix id's names for all generated fields #277
* **core:** fix notice undefined index: created_at in Entries API
* **core:** fix notice undefined index: published_at in Entries API #265
* **core:** fix Plugins API - createPluginsDictionary method and increase app perfomance #259
* **core:** fix state of active tabs for all generated forms #276
* **core:** fix state of aria-selected for all generated forms #275
* **core:** fix discord server link #325
* **core:** fix issue with system fields data types in the Entries API #383
* **admin-plugin:** fix issue for creating entry process with same IDs #333
* **admin-plugin:** fix redirect for entries after edit process.
* **admin-plugin:** fix issues with routable field on entry edit process.

### Refactoring

* **core:** move `/site/cache directory` to the `/var/cache` #347
* **core:** remove Forms API from Flextype core #360
* **admin-plugin:** improve Gulp configuration for better assets building.
* **default-theme:** improve Gulp configuration for better assets building.
* **core:** simplify logic for themes initialization process, remove extra checks for theme setting is `enabled` or not.
* **admin-plugin:** move templates from `views` folder into the `templates` folder #347
* **admin-plugin:** remove unused namespaces in EntriesContoller #347
* **admin-plugin:** remove complex logic for themes activation process.
* **admin-plugin:** add `ext-gd` to the require section of composer.json #347
* **admin-plugin:** add `ext-fileinfo` to the require section of composer.json #347
* **admin-plugin:** add `ext-dom` to the require section of composer.json #347
* **admin-plugin:** add `ext-spl` to the require section of composer.json #347
* **default-theme:** remove `enabled` option from theme settings.

### Vendor Updates
* **core:** Update vendor monolog/monolog to 2.0.2
* **core:** Update vendor cocur/slugify to 4.0.0
* **core:** Update vendor thunderer/shortcode to 0.7.3
* **core:** Update vendor ramsey/uuid to 3.9.2

### BREAKING CHANGES

* **core:** accounts moved to their specific folders.

for e.g.
```
/accounts/admin.yaml => /accounts/admin/profile.yaml
```

* **core:** remove Debug, Html and Form Flextype Components.
* **core:** all images links should be updated
```
http://docs.flextype.org/en/content/media
```
* **core:** core and plugin settings keys renamed
```
For all core settings:
settings.* => flextype.*
For all site settings:
settings.title => plugins.site.title
settings.description => plugins.site.description
settings.keywords => plugins.site.keywords
settings.robots => plugins.site.robots
settings.author.email => plugins.site.author.email
settings.author.name => plugins.site.author.name
```

* **admin-plugin:** remove Twitter Bootstrap from Admin Panel and Default Theme.
* **admin-plugin:** remove user profile page `/admin/profile`
* **admin-plugin:** method `getUsers()` renamed to `getUsersList()` in UsersController.

<a name="0.9.6"></a>
# [0.9.6](https://github.com/flextype/flextype/compare/v0.9.5...v0.9.6) (2019-12-01)

### Features

Expand Down Expand Up @@ -127,6 +272,22 @@
* **core:** improve Cache on production and increase app performance #290 #263


### Bug Fixes

* **admin-plugin:** fix issue with saving entry source #251
* **admin-plugin:** fix file browser styles
* **admin-plugin:** fix breadcrumbs for theme templates
* **core:** Entries API - fix Collection Undefined Index(s) for fetchAll method #243
* **core:** fix broken logic for form inputs without labels #274
* **core:** fix default and site settings loading #297
* **core:** fix id's names for all generated fields #277
* **core:** fix notice undefined index: created_at in Entries API
* **core:** fix notice undefined index: published_at in Entries API #265
* **core:** fix Plugins API - createPluginsDictionary method and increase app perfomance #259
* **core:** fix state of active tabs for all generated forms #276
* **core:** fix state of aria-selected for all generated forms #275


### Vendor Updates
* **core:** Update vendor flextype-components/date to 1.0.0
* **core:** Update vendor symfony/yaml to 4.4.0
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2018-2019 Sergey Romanenko
Copyright (c) 2018-2020 Sergey Romanenko

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![preview](/site/plugins/admin/preview.png)

<p align="center">
<a href="https://github.com/flextype/flextype/releases"><img alt="Version" src="https://img.shields.io/github/release/flextype/flextype.svg?label=version"></a> <a href="https://github.com/flextype/flextype"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a> <a href="https://github.com/flextype/flextype"><img src="https://img.shields.io/github/downloads/flextype/flextype/total.svg?colorB=blue" alt="Total downloads"></a> <a href="https://crowdin.com/project/flextype"><img src="https://d322cqt584bo4o.cloudfront.net/flextype/localized.svg" alt="Crowdin"></a> <a href="https://scrutinizer-ci.com/g/flextype/flextype?branch=master"><img src="https://img.shields.io/scrutinizer/g/flextype/flextype.svg?branch=master" alt="Quality Score"></a> <a href="https://discordapp.com/invite/CCKPKVG"><img src="https://img.shields.io/discord/423097982498635778.svg?logo=discord&colorB=728ADA&label=Discord%20Chat" alt="Discord"></a>
<a href="https://github.com/flextype/flextype/releases"><img alt="Version" src="https://img.shields.io/github/release/flextype/flextype.svg?label=version"></a> <a href="https://github.com/flextype/flextype"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a> <a href="https://github.com/flextype/flextype"><img src="https://img.shields.io/github/downloads/flextype/flextype/total.svg?colorB=blue" alt="Total downloads"></a> <a href="https://crowdin.com/project/flextype"><img src="https://d322cqt584bo4o.cloudfront.net/flextype/localized.svg" alt="Crowdin"></a> <a href="https://scrutinizer-ci.com/g/flextype/flextype?branch=master"><img src="https://img.shields.io/scrutinizer/g/flextype/flextype.svg?branch=master" alt="Quality Score"></a> <a href=""><img src="https://img.shields.io/discord/423097982498635778.svg?logo=discord&colorB=728ADA&label=Discord%20Chat" alt="Discord"></a>
</p>

<h1 align="center">Supporting Flextype</h1>
Expand Down Expand Up @@ -68,9 +68,8 @@ Mobile
Flextype is open source, community driven project, and maintained by community!

- [Github](https://github.com/flextype)
- [Discord](https://discord.gg/CCKPKVG)
- [Discord](https://flextype.org/en/discord)
- [Twitter](https://twitter.com/getflextype)
- [Forum](http://forum.flextype.org)
- [Vkontakte](https://vk.com/flextype)

## CONTRIBUTE
Expand All @@ -86,4 +85,4 @@ Flextype is an open source project and community contributions are essential to

## LICENSE
[The MIT License (MIT)](https://github.com/flextype/flextype/blob/master/LICENSE.txt)
Copyright (c) 2018-2019 [Sergey Romanenko](https://github.com/Awilum)
Copyright (c) 2018-2020 [Sergey Romanenko](https://github.com/Awilum)
23 changes: 12 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{
"name": "Sergey Romanenko",
"email": "hello@romanenko.digital",
"homepage": "http://romanenko.digital"
"homepage": "http://digital.flextype.org"
}
],
"support": {
Expand All @@ -18,7 +18,11 @@
"require": {
"php": ">=7.2.0",
"ext-json": "*",
"ext-gd": "*",
"ext-dom": "*",
"ext-spl": "*",
"ext-mbstring": "*",
"ext-fileinfo": "*",

"doctrine/cache": "~1.10.0",
"doctrine/collections": "~1.6.4",
Expand All @@ -27,14 +31,12 @@
"flextype-components/assets" : "1.0.3",
"flextype-components/cookie" : "1.2.0",
"flextype-components/date" : "1.1.0",
"flextype-components/debug" : "1.0.0",
"flextype-components/filesystem" : "2.0.6",
"flextype-components/i18n" : "1.3.0",
"flextype-components/number" : "1.1.0",
"flextype-components/registry" : "2.0.0",
"flextype-components/session" : "1.1.1",
"flextype-components/text" : "1.1.2",
"flextype-components/form" : "1.0.2",

"slim/slim": "~3.12.3",
"slim/twig-view": "~2.5.0",
Expand All @@ -48,17 +50,15 @@
"league/glide": "~1.5.0",

"respect/validation": "~1.1.31",
"monolog/monolog": "~2.0.1",
"cocur/slugify": "~3.2.0",
"thunderer/shortcode": "~0.7.2",
"ramsey/uuid": "~3.8.0",
"symfony/yaml": "~4.4.0",
"monolog/monolog": "~2.0.2",
"cocur/slugify": "~4.0.0",
"thunderer/shortcode": "~0.7.3",
"ramsey/uuid": "~3.9.2",
"symfony/yaml": "~4.4.4",

"erusev/parsedown": "~1.7.3",
"erusev/parsedown-extra": "~0.7.1",

"middlewares/trailing-slash": "~1.1.0",
"middlewares/response-time": "~1.1.0",
"bnf/slim3-psr15": "~1.1.1"
},
"suggest": {
Expand All @@ -82,6 +82,7 @@
"require-dev": {
"doctrine/coding-standard": "~6.0.0",
"victorjonsson/markdowndocs": "dev-master",
"phpstan/phpstan": "^0.11.19"
"phpstan/phpstan": "^0.11.19",
"symfony/var-dumper": "^4.4"
}
}
79 changes: 79 additions & 0 deletions flextype/api/delivery/entries.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?php

declare(strict_types=1);

/**
* Flextype (http://flextype.org)
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/

namespace Flextype;

use Flextype\Component\Filesystem\Filesystem;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;

/**
* Validate delivery entries token
*/
function validate_delivery_entries_token($request, $flextype) : bool
{
return Filesystem::has(PATH['tokens'] . '/delivery/entries/' . $request->getQueryParams()['token'] . '/token.yaml');
}

/**
* Fetch entry(entries)
*
* endpoint: /api/delivery/entries
*/
$app->get('/api/delivery/entries', function (Request $request, Response $response) use ($flextype) {

// Get Query Params
$query = $request->getQueryParams();

// Set variables
$id = $query['id'];
$args = isset($query['args']) ? $query['args'] : null;

if ($flextype['registry']->get('flextype.api.entries.enabled')) {

// Validate delivery token
if (validate_delivery_entries_token($request, $flextype)) {
$delivery_entries_token_file_path = PATH['tokens'] . '/delivery/entries/' . $request->getQueryParams()['token'] . '/token.yaml';

// Set delivery token file
if ($delivery_entries_token_file_data = $flextype['parser']->decode(Filesystem::read($delivery_entries_token_file_path), 'yaml')) {
if ($delivery_entries_token_file_data['state'] == 'disabled' ||
($delivery_entries_token_file_data['limit_calls'] != 0 && $delivery_entries_token_file_data['calls'] >= $delivery_entries_token_file_data['limit_calls'])) {
return $response->withJson(["detail" => "Incorrect authentication credentials."], 401);
} else {
// Fetch entry
$data = $flextype['entries']->fetch($id, $args);

// Set response code
$response_code = (count($data) > 0) ? 200 : 404 ;

// Update calls counter
Filesystem::write($delivery_entries_token_file_path, $flextype['parser']->encode(array_replace_recursive($delivery_entries_token_file_data, ['calls' => $delivery_entries_token_file_data['calls'] + 1]), 'yaml'));

// Return response
return $response
->withJson($data, $response_code)
->withHeader('Access-Control-Allow-Origin', '*');
}
} else {
return $response
->withJson(["detail" => "Incorrect authentication credentials."], 401)
->withHeader('Access-Control-Allow-Origin', '*');
}
} else {
return $response
->withJson(["detail" => "Incorrect authentication credentials."], 401)
->withHeader('Access-Control-Allow-Origin', '*');
}
} else {
return $response
->withJson(["detail" => "Incorrect authentication credentials."], 401)
->withHeader('Access-Control-Allow-Origin', '*');
}
});

0 comments on commit cfb8e60

Please sign in to comment.