diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b396bd..ee182b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,94 @@ +# v1.7.38 +## 01/02/2023 + +1. [](#new) + * New `onBeforeSessionStart()` event to be used to store data lost during session regeneration (e.g. login) +1. [](#improved) + * Vendor library updates to latest versions + * Updated `bin/composer.phar` to latest `2.4.4` version [#3627](https://github.com/getgrav/grav/issues/3627) +1. [](#bugfix) + + * Don't fail hard if pages recurse with same path + * Github workflows security hardening [#3624](https://github.com/getgrav/grav/pull/3624) + +# v1.7.37.1 +## 10/05/2022 + +1. [](#bugfix) + * Fixed a bad return type [#3630](https://github.com/getgrav/grav/issues/3630) + +# v1.7.37 +## 10/05/2022 + +1. [](#new) + * Added new `onPageHeaders()` event to allow for header modification as needed + * Added a `system.pages.dirs` configuration option to allow for configurable paths, and multiple page paths + * Added new `Pages::getSimplePagesHash` which is useful for caching pages specific data + * Updated to latest vendor libraries +1. [](#bugfix) + * An attempt to workaround windows reading locked file issue [getgrav/grav-plugin-admin#2299](https://github.com/getgrav/grav-plugin-admin/issues/2299) + * Force user index file to be updated to fix email addresses [getgrav/grav-plugin-login#229](https://github.com/getgrav/grav-plugin-login/issues/229) + +# v1.7.36 +## 09/08/2022 + +1. [](#new) + * Added `authorize-*@:` support for Flex blueprints, e.g. `authorize-disabled@: not delete` disables the field if user does not have access to delete object + * Added support for `flex-ignore@` to hide all the nested fields in the blueprint +1. [](#bugfix) + * Fixed login with a capitalised email address when using old users [getgrav/grav-plugin-login#229](https://github.com/getgrav/grav-plugin-login/issues/229) + +# v1.7.35 +## 08/04/2022 + +1. [](#new) + * Added support for `multipart/form-data` content type in PUT and PATCH requests + * Added support for object relationships + * Added variables `$environment` (string), `$request` (PSR-7 ServerRequestInterface|null) and `$uri` (PSR-7 Uri|null) to be used in `setup.php` +1. [](#improved) + * Minor vendor updates + +# v1.7.34 +## 06/14/2022 + +1. [](#new) + * Added back Yiddish to Language Codes [#3336](https://github.com/getgrav/grav/pull/3336) + * Ignore upcoming `media.json` file in media +1. [](#bugfix) + * Regression: Fixed saving page with a new language causing cache corruption [getgrav/grav-plugin-admin#2282](https://github.com/getgrav/grav-plugin-admin/issues/2282) + * Fixed a potential fatal error when using watermark in images + * Fixed `bin/grav install` command with arbitrary destination folder name + * Fixed Twig `|filter()` allowing code execution + * Fixed login and user search by email not being case-insensitive when using Flex Users + +# v1.7.33 +## 04/25/2022 + +1. [](#improved) + * When saving yaml and markdown, create also a cached version of the file and recompile it in opcache +2. [](#bugfix) + * Fixed missing changes in **yaml** & **markdown** files if saved multiple times during the same second because of a caching issue + * Fixed XSS check not detecting onX events without quotes + * Fixed default collection ordering in pages admin + +# v1.7.32 +## 03/28/2022 + +1. [](#new) + * Added `|replace_last(search, replace)` filter + * Added `parseurl` Twig function to expose PHP's `parse_url` function +2. [](#improved) + * Added multi-language support for page routes in `Utils::url()` + * Set default maximum length for text fields + - `password`: 256 + - `email`: 320 + - `text`, `url`, `hidden`, `commalist`: 2048 + - `text` (multiline), `textarea`: 65536 +3. [](#bugfix) + * Fixed issue with `system.cache.gzip: true` resulted in "Fetch Failed" for PHP 8.0.17 and PHP 8.1.4 [PHP issue #8218](https://github.com/php/php-src/issues/8218) + * Fix for multi-lang issues with Security Report + * Fixed page search not working with selected language [#3316](https://github.com/getgrav/grav/issues/3316) + # v1.7.31 ## 03/14/2022 diff --git a/assets/.gitkeep b/assets/.gitkeep index 8efbf1f..8c3b423 100644 --- a/assets/.gitkeep +++ b/assets/.gitkeep @@ -1 +1 @@ -/* @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. */ +/* @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. */ diff --git a/bin/composer.phar b/bin/composer.phar index f046190..6d799eb 100755 Binary files a/bin/composer.phar and b/bin/composer.phar differ diff --git a/bin/gpm b/bin/gpm index 12d0c3d..2c6a99b 100755 --- a/bin/gpm +++ b/bin/gpm @@ -2,7 +2,7 @@ =5.3.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "~2.0", - "matthiasmullie/scrapbook": "dev-master", - "phpunit/phpunit": ">=4.8" + "friendsofphp/php-cs-fixer": ">=2.0", + "matthiasmullie/scrapbook": ">=1.3", + "phpunit/phpunit": ">=4.8", + "squizlabs/php_codesniffer": ">=3.0" }, "suggest": { "psr/cache-implementation": "Cache implementation to use with Minify::cache" @@ -1016,12 +1062,12 @@ { "name": "Matthias Mullie", "email": "minify@mullie.eu", - "homepage": "http://www.mullie.eu", + "homepage": "https://www.mullie.eu", "role": "Developer" } ], "description": "CSS & JavaScript minifier, in PHP. Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns.", - "homepage": "http://www.minifier.org", + "homepage": "https://github.com/matthiasmullie/minify", "keywords": [ "JS", "css", @@ -1031,23 +1077,15 @@ ], "support": { "issues": "https://github.com/matthiasmullie/minify/issues", - "source": "https://github.com/matthiasmullie/minify/tree/1.3.66" + "source": "https://github.com/matthiasmullie/minify/tree/1.3.70" }, "funding": [ { - "url": "https://github.com/[user1", - "type": "github" - }, - { - "url": "https://github.com/matthiasmullie] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g.", - "type": "github" - }, - { - "url": "https://github.com/user2", + "url": "https://github.com/matthiasmullie", "type": "github" } ], - "time": "2021-01-06T15:18:10+00:00" + "time": "2022-12-09T12:56:44+00:00" }, { "name": "matthiasmullie/path-converter", @@ -1104,16 +1142,16 @@ }, { "name": "maximebf/debugbar", - "version": "v1.18.0", + "version": "v1.18.1", "source": { "type": "git", "url": "https://github.com/maximebf/php-debugbar.git", - "reference": "0d44b75f3b5d6d41ae83b79c7a4bceae7fbc78b6" + "reference": "ba0af68dd4316834701ecb30a00ce9604ced3ee9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/0d44b75f3b5d6d41ae83b79c7a4bceae7fbc78b6", - "reference": "0d44b75f3b5d6d41ae83b79c7a4bceae7fbc78b6", + "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/ba0af68dd4316834701ecb30a00ce9604ced3ee9", + "reference": "ba0af68dd4316834701ecb30a00ce9604ced3ee9", "shasum": "" }, "require": { @@ -1133,7 +1171,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-master": "1.18-dev" } }, "autoload": { @@ -1164,9 +1202,9 @@ ], "support": { "issues": "https://github.com/maximebf/php-debugbar/issues", - "source": "https://github.com/maximebf/php-debugbar/tree/v1.18.0" + "source": "https://github.com/maximebf/php-debugbar/tree/v1.18.1" }, - "time": "2021-12-27T18:49:48+00:00" + "time": "2022-03-31T14:55:54+00:00" }, { "name": "miljar/php-exif", @@ -1230,16 +1268,16 @@ }, { "name": "monolog/monolog", - "version": "1.26.1", + "version": "1.27.1", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "c6b00f05152ae2c9b04a448f99c7590beb6042f5" + "reference": "904713c5929655dc9b97288b69cfeedad610c9a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/c6b00f05152ae2c9b04a448f99c7590beb6042f5", - "reference": "c6b00f05152ae2c9b04a448f99c7590beb6042f5", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/904713c5929655dc9b97288b69cfeedad610c9a1", + "reference": "904713c5929655dc9b97288b69cfeedad610c9a1", "shasum": "" }, "require": { @@ -1300,7 +1338,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/1.26.1" + "source": "https://github.com/Seldaek/monolog/tree/1.27.1" }, "funding": [ { @@ -1312,7 +1350,7 @@ "type": "tidelift" } ], - "time": "2021-05-28T08:32:12+00:00" + "time": "2022-06-09T08:53:42+00:00" }, { "name": "multiavatar/multiavatar-php", @@ -1363,16 +1401,16 @@ }, { "name": "nyholm/psr7", - "version": "1.5.0", + "version": "1.5.1", "source": { "type": "git", "url": "https://github.com/Nyholm/psr7.git", - "reference": "1461e07a0f2a975a52082ca3b769ca912b816226" + "reference": "f734364e38a876a23be4d906a2a089e1315be18a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Nyholm/psr7/zipball/1461e07a0f2a975a52082ca3b769ca912b816226", - "reference": "1461e07a0f2a975a52082ca3b769ca912b816226", + "url": "https://api.github.com/repos/Nyholm/psr7/zipball/f734364e38a876a23be4d906a2a089e1315be18a", + "reference": "f734364e38a876a23be4d906a2a089e1315be18a", "shasum": "" }, "require": { @@ -1424,7 +1462,7 @@ ], "support": { "issues": "https://github.com/Nyholm/psr7/issues", - "source": "https://github.com/Nyholm/psr7/tree/1.5.0" + "source": "https://github.com/Nyholm/psr7/tree/1.5.1" }, "funding": [ { @@ -1436,7 +1474,7 @@ "type": "github" } ], - "time": "2022-02-02T18:37:57+00:00" + "time": "2022-06-22T07:13:36+00:00" }, { "name": "nyholm/psr7-server", @@ -2122,23 +2160,23 @@ }, { "name": "rockettheme/toolbox", - "version": "1.6.1", + "version": "1.6.2", "source": { "type": "git", "url": "https://github.com/rockettheme/toolbox.git", - "reference": "fdf0195ced25b83525d3b084c3e81f05de96ac8c" + "reference": "99448a20a2f78d6480035d72821ecb9e4dc17032" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rockettheme/toolbox/zipball/fdf0195ced25b83525d3b084c3e81f05de96ac8c", - "reference": "fdf0195ced25b83525d3b084c3e81f05de96ac8c", + "url": "https://api.github.com/repos/rockettheme/toolbox/zipball/99448a20a2f78d6480035d72821ecb9e4dc17032", + "reference": "99448a20a2f78d6480035d72821ecb9e4dc17032", "shasum": "" }, "require": { "ext-json": "*", "php": ">=5.6.0", "pimple/pimple": "^3.0", - "symfony/event-dispatcher": "^3.4|^4.0|^5.0", + "symfony/event-dispatcher": "^3.4|^4.0", "symfony/yaml": "^3.4|^4.0|^5.0" }, "type": "library", @@ -2170,9 +2208,9 @@ ], "support": { "issues": "https://github.com/rockettheme/toolbox/issues", - "source": "https://github.com/rockettheme/toolbox/tree/1.6.1" + "source": "https://github.com/rockettheme/toolbox/tree/1.6.2" }, - "time": "2022-02-08T08:36:03+00:00" + "time": "2022-06-14T16:24:33+00:00" }, { "name": "seld/cli-prompt", @@ -2231,16 +2269,16 @@ }, { "name": "symfony/console", - "version": "v4.4.38", + "version": "v4.4.49", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "5a50085bf5460f0c0d60a50b58388c1249826b8a" + "reference": "33fa45ffc81fdcc1ca368d4946da859c8cdb58d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/5a50085bf5460f0c0d60a50b58388c1249826b8a", - "reference": "5a50085bf5460f0c0d60a50b58388c1249826b8a", + "url": "https://api.github.com/repos/symfony/console/zipball/33fa45ffc81fdcc1ca368d4946da859c8cdb58d9", + "reference": "33fa45ffc81fdcc1ca368d4946da859c8cdb58d9", "shasum": "" }, "require": { @@ -2301,7 +2339,7 @@ "description": "Eases the creation of beautiful and testable command line interfaces", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/console/tree/v4.4.38" + "source": "https://github.com/symfony/console/tree/v4.4.49" }, "funding": [ { @@ -2317,20 +2355,20 @@ "type": "tidelift" } ], - "time": "2022-01-30T21:23:57+00:00" + "time": "2022-11-05T17:10:16+00:00" }, { "name": "symfony/contracts", - "version": "v1.1.11", + "version": "v1.1.13", "source": { "type": "git", "url": "https://github.com/symfony/contracts.git", - "reference": "cf2984f7a99bfae197f9c96f5a16a4041ff6ffb1" + "reference": "9e27f5c175ecbd6fff554d839ff4a432da797168" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/contracts/zipball/cf2984f7a99bfae197f9c96f5a16a4041ff6ffb1", - "reference": "cf2984f7a99bfae197f9c96f5a16a4041ff6ffb1", + "url": "https://api.github.com/repos/symfony/contracts/zipball/9e27f5c175ecbd6fff554d839ff4a432da797168", + "reference": "9e27f5c175ecbd6fff554d839ff4a432da797168", "shasum": "" }, "require": { @@ -2395,7 +2433,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/contracts/tree/v1.1.11" + "source": "https://github.com/symfony/contracts/tree/v1.1.13" }, "funding": [ { @@ -2411,20 +2449,20 @@ "type": "tidelift" } ], - "time": "2021-11-04T13:32:43+00:00" + "time": "2022-06-27T13:16:42+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.4.37", + "version": "v4.4.44", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "3ccfcfb96ecce1217d7b0875a0736976bc6e63dc" + "reference": "1e866e9e5c1b22168e0ce5f0b467f19bba61266a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/3ccfcfb96ecce1217d7b0875a0736976bc6e63dc", - "reference": "3ccfcfb96ecce1217d7b0875a0736976bc6e63dc", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/1e866e9e5c1b22168e0ce5f0b467f19bba61266a", + "reference": "1e866e9e5c1b22168e0ce5f0b467f19bba61266a", "shasum": "" }, "require": { @@ -2479,7 +2517,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v4.4.37" + "source": "https://github.com/symfony/event-dispatcher/tree/v4.4.44" }, "funding": [ { @@ -2495,20 +2533,20 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:41:36+00:00" + "time": "2022-07-20T09:59:04+00:00" }, { "name": "symfony/http-client", - "version": "v4.4.39", + "version": "v4.4.49", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "40342406a975385c5b21e929df46e3fc0278853d" + "reference": "0185497cd61440bdf68df7d81241b97a543e9c3f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/40342406a975385c5b21e929df46e3fc0278853d", - "reference": "40342406a975385c5b21e929df46e3fc0278853d", + "url": "https://api.github.com/repos/symfony/http-client/zipball/0185497cd61440bdf68df7d81241b97a543e9c3f", + "reference": "0185497cd61440bdf68df7d81241b97a543e9c3f", "shasum": "" }, "require": { @@ -2560,7 +2598,7 @@ "description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-client/tree/v4.4.39" + "source": "https://github.com/symfony/http-client/tree/v4.4.49" }, "funding": [ { @@ -2576,20 +2614,20 @@ "type": "tidelift" } ], - "time": "2022-02-28T13:17:32+00:00" + "time": "2022-11-03T19:03:45+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.25.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "30885182c981ab175d4d034db0f6f469898070ab" + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", - "reference": "30885182c981ab175d4d034db0f6f469898070ab", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", "shasum": "" }, "require": { @@ -2604,7 +2642,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2642,7 +2680,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" }, "funding": [ { @@ -2658,20 +2696,20 @@ "type": "tidelift" } ], - "time": "2021-10-20T20:35:02+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-iconv", - "version": "v1.25.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-iconv.git", - "reference": "f1aed619e28cb077fc83fac8c4c0383578356e40" + "reference": "927013f3aac555983a5059aada98e1907d842695" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/f1aed619e28cb077fc83fac8c4c0383578356e40", - "reference": "f1aed619e28cb077fc83fac8c4c0383578356e40", + "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/927013f3aac555983a5059aada98e1907d842695", + "reference": "927013f3aac555983a5059aada98e1907d842695", "shasum": "" }, "require": { @@ -2686,7 +2724,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2725,7 +2763,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-iconv/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-iconv/tree/v1.27.0" }, "funding": [ { @@ -2741,20 +2779,20 @@ "type": "tidelift" } ], - "time": "2022-01-04T09:04:05+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.25.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", - "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", "shasum": "" }, "require": { @@ -2769,7 +2807,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2808,7 +2846,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" }, "funding": [ { @@ -2824,20 +2862,20 @@ "type": "tidelift" } ], - "time": "2021-11-30T18:21:41+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php74", - "version": "v1.25.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php74.git", - "reference": "a5d80cdf049bd3b0af6da91184a2cd37533c0fd8" + "reference": "aa7f1231a1aa56d695e626043252b7be6a90c4ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php74/zipball/a5d80cdf049bd3b0af6da91184a2cd37533c0fd8", - "reference": "a5d80cdf049bd3b0af6da91184a2cd37533c0fd8", + "url": "https://api.github.com/repos/symfony/polyfill-php74/zipball/aa7f1231a1aa56d695e626043252b7be6a90c4ce", + "reference": "aa7f1231a1aa56d695e626043252b7be6a90c4ce", "shasum": "" }, "require": { @@ -2846,7 +2884,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2888,7 +2926,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php74/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-php74/tree/v1.27.0" }, "funding": [ { @@ -2904,20 +2942,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.25.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c" + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4407588e0d3f1f52efb65fbe92babe41f37fe50c", - "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", "shasum": "" }, "require": { @@ -2926,7 +2964,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2971,7 +3009,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" }, "funding": [ { @@ -2987,20 +3025,20 @@ "type": "tidelift" } ], - "time": "2022-03-04T08:16:47+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php81", - "version": "v1.25.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f" + "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/5de4ba2d41b15f9bd0e19b2ab9674135813ec98f", - "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/707403074c8ea6e2edaf8794b0157a0bfa52157a", + "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a", "shasum": "" }, "require": { @@ -3009,7 +3047,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3050,7 +3088,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.27.0" }, "funding": [ { @@ -3066,20 +3104,20 @@ "type": "tidelift" } ], - "time": "2021-09-13T13:58:11+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/process", - "version": "v4.4.37", + "version": "v4.4.44", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "b2d924e5a4cb284f293d5092b1dbf0d364cb8b67" + "reference": "5cee9cdc4f7805e2699d9fd66991a0e6df8252a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/b2d924e5a4cb284f293d5092b1dbf0d364cb8b67", - "reference": "b2d924e5a4cb284f293d5092b1dbf0d364cb8b67", + "url": "https://api.github.com/repos/symfony/process/zipball/5cee9cdc4f7805e2699d9fd66991a0e6df8252a2", + "reference": "5cee9cdc4f7805e2699d9fd66991a0e6df8252a2", "shasum": "" }, "require": { @@ -3112,7 +3150,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v4.4.37" + "source": "https://github.com/symfony/process/tree/v4.4.44" }, "funding": [ { @@ -3128,20 +3166,20 @@ "type": "tidelift" } ], - "time": "2022-01-27T17:14:04+00:00" + "time": "2022-06-27T13:16:42+00:00" }, { "name": "symfony/var-dumper", - "version": "v4.4.39", + "version": "v4.4.47", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "35237c5e5dcb6593a46a860ba5b29c1d4683d80e" + "reference": "1069c7a3fca74578022fab6f81643248d02f8e63" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/35237c5e5dcb6593a46a860ba5b29c1d4683d80e", - "reference": "35237c5e5dcb6593a46a860ba5b29c1d4683d80e", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/1069c7a3fca74578022fab6f81643248d02f8e63", + "reference": "1069c7a3fca74578022fab6f81643248d02f8e63", "shasum": "" }, "require": { @@ -3201,7 +3239,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v4.4.39" + "source": "https://github.com/symfony/var-dumper/tree/v4.4.47" }, "funding": [ { @@ -3217,20 +3255,20 @@ "type": "tidelift" } ], - "time": "2022-02-25T10:38:15+00:00" + "time": "2022-10-03T15:15:11+00:00" }, { "name": "symfony/yaml", - "version": "v4.4.37", + "version": "v4.4.45", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "d7f637cc0f0cc14beb0984f2bb50da560b271311" + "reference": "aeccc4dc52a9e634f1d1eebeb21eacfdcff1053d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/d7f637cc0f0cc14beb0984f2bb50da560b271311", - "reference": "d7f637cc0f0cc14beb0984f2bb50da560b271311", + "url": "https://api.github.com/repos/symfony/yaml/zipball/aeccc4dc52a9e634f1d1eebeb21eacfdcff1053d", + "reference": "aeccc4dc52a9e634f1d1eebeb21eacfdcff1053d", "shasum": "" }, "require": { @@ -3272,7 +3310,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v4.4.37" + "source": "https://github.com/symfony/yaml/tree/v4.4.45" }, "funding": [ { @@ -3288,20 +3326,20 @@ "type": "tidelift" } ], - "time": "2022-01-24T20:11:01+00:00" + "time": "2022-08-02T15:47:23+00:00" }, { "name": "twig/twig", - "version": "v1.44.6", + "version": "v1.44.7", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "ae39480f010ef88adc7938503c9b02d3baf2f3b3" + "reference": "0887422319889e442458e48e2f3d9add1a172ad5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/ae39480f010ef88adc7938503c9b02d3baf2f3b3", - "reference": "ae39480f010ef88adc7938503c9b02d3baf2f3b3", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/0887422319889e442458e48e2f3d9add1a172ad5", + "reference": "0887422319889e442458e48e2f3d9add1a172ad5", "shasum": "" }, "require": { @@ -3354,7 +3392,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v1.44.6" + "source": "https://github.com/twigphp/Twig/tree/v1.44.7" }, "funding": [ { @@ -3366,7 +3404,7 @@ "type": "tidelift" } ], - "time": "2021-11-25T13:31:46+00:00" + "time": "2022-09-28T08:38:36+00:00" }, { "name": "willdurand/negotiation", @@ -3491,16 +3529,16 @@ }, { "name": "codeception/codeception", - "version": "4.1.30", + "version": "4.2.2", "source": { "type": "git", "url": "https://github.com/Codeception/Codeception.git", - "reference": "a035d77d070fa57fad438e07a65447aeca248c45" + "reference": "b88014f3348c93f3df99dc6d0967b0dbfa804474" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeception/Codeception/zipball/a035d77d070fa57fad438e07a65447aeca248c45", - "reference": "a035d77d070fa57fad438e07a65447aeca248c45", + "url": "https://api.github.com/repos/Codeception/Codeception/zipball/b88014f3348c93f3df99dc6d0967b0dbfa804474", + "reference": "b88014f3348c93f3df99dc6d0967b0dbfa804474", "shasum": "" }, "require": { @@ -3563,11 +3601,11 @@ { "name": "Michael Bodnarchuk", "email": "davert@mail.ua", - "homepage": "http://codegyre.com" + "homepage": "https://codegyre.com" } ], "description": "BDD-style testing framework", - "homepage": "http://codeception.com/", + "homepage": "https://codeception.com/", "keywords": [ "BDD", "TDD", @@ -3577,7 +3615,7 @@ ], "support": { "issues": "https://github.com/Codeception/Codeception/issues", - "source": "https://github.com/Codeception/Codeception/tree/4.1.30" + "source": "https://github.com/Codeception/Codeception/tree/4.2.2" }, "funding": [ { @@ -3585,7 +3623,7 @@ "type": "open_collective" } ], - "time": "2022-03-05T18:12:30+00:00" + "time": "2022-08-13T13:28:25+00:00" }, { "name": "codeception/lib-asserts", @@ -3760,20 +3798,20 @@ }, { "name": "codeception/module-phpbrowser", - "version": "1.0.2", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/Codeception/module-phpbrowser.git", - "reference": "770a6be4160a5c0c08d100dd51bff35f6056bbf1" + "reference": "8ba6bede11d0914e74d98691f427fd8f397f192e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeception/module-phpbrowser/zipball/770a6be4160a5c0c08d100dd51bff35f6056bbf1", - "reference": "770a6be4160a5c0c08d100dd51bff35f6056bbf1", + "url": "https://api.github.com/repos/Codeception/module-phpbrowser/zipball/8ba6bede11d0914e74d98691f427fd8f397f192e", + "reference": "8ba6bede11d0914e74d98691f427fd8f397f192e", "shasum": "" }, "require": { - "codeception/codeception": "^4.0", + "codeception/codeception": "^4.1", "codeception/lib-innerbrowser": "^1.3", "guzzlehttp/guzzle": "^6.3|^7.0", "php": ">=5.6.0 <9.0" @@ -3814,22 +3852,22 @@ ], "support": { "issues": "https://github.com/Codeception/module-phpbrowser/issues", - "source": "https://github.com/Codeception/module-phpbrowser/tree/1.0.2" + "source": "https://github.com/Codeception/module-phpbrowser/tree/1.0.3" }, - "time": "2020-10-24T15:29:28+00:00" + "time": "2022-05-21T13:50:41+00:00" }, { "name": "codeception/phpunit-wrapper", - "version": "9.0.7", + "version": "9.0.9", "source": { "type": "git", "url": "https://github.com/Codeception/phpunit-wrapper.git", - "reference": "7d6b1a5ea4ed28d010e5d36b993db813eb49710b" + "reference": "7439a53ae367986e9c22b2ac00f9d7376bb2f8cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeception/phpunit-wrapper/zipball/7d6b1a5ea4ed28d010e5d36b993db813eb49710b", - "reference": "7d6b1a5ea4ed28d010e5d36b993db813eb49710b", + "url": "https://api.github.com/repos/Codeception/phpunit-wrapper/zipball/7439a53ae367986e9c22b2ac00f9d7376bb2f8cf", + "reference": "7439a53ae367986e9c22b2ac00f9d7376bb2f8cf", "shasum": "" }, "require": { @@ -3863,9 +3901,9 @@ "description": "PHPUnit classes used by Codeception", "support": { "issues": "https://github.com/Codeception/phpunit-wrapper/issues", - "source": "https://github.com/Codeception/phpunit-wrapper/tree/9.0.7" + "source": "https://github.com/Codeception/phpunit-wrapper/tree/9.0.9" }, - "time": "2022-01-26T14:43:10+00:00" + "time": "2022-05-23T06:24:11+00:00" }, { "name": "codeception/stub", @@ -3903,30 +3941,30 @@ }, { "name": "doctrine/instantiator", - "version": "1.4.1", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^9", + "doctrine/coding-standard": "^9 || ^11", "ext-pdo": "*", "ext-phar": "*", "phpbench/phpbench": "^0.16 || ^1", "phpstan/phpstan": "^1.4", "phpstan/phpstan-phpunit": "^1", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.22" + "vimeo/psalm": "^4.30 || ^5.4" }, "type": "library", "autoload": { @@ -3953,7 +3991,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.1" + "source": "https://github.com/doctrine/instantiator/tree/1.5.0" }, "funding": [ { @@ -3969,7 +4007,7 @@ "type": "tidelift" } ], - "time": "2022-03-03T08:28:38+00:00" + "time": "2022-12-30T00:15:36+00:00" }, { "name": "getgrav/markdowndocs", @@ -4025,22 +4063,22 @@ }, { "name": "guzzlehttp/guzzle", - "version": "7.4.1", + "version": "7.5.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "ee0a041b1760e6a53d2a39c8c34115adc2af2c79" + "reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ee0a041b1760e6a53d2a39c8c34115adc2af2c79", - "reference": "ee0a041b1760e6a53d2a39c8c34115adc2af2c79", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b50a2a1251152e43f6a37f0fa053e730a67d25ba", + "reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba", "shasum": "" }, "require": { "ext-json": "*", "guzzlehttp/promises": "^1.5", - "guzzlehttp/psr7": "^1.8.3 || ^2.1", + "guzzlehttp/psr7": "^1.9 || ^2.4", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" @@ -4049,10 +4087,10 @@ "psr/http-client-implementation": "1.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", + "bamarni/composer-bin-plugin": "^1.8.1", "ext-curl": "*", "php-http/client-integration-tests": "^3.0", - "phpunit/phpunit": "^8.5.5 || ^9.3.5", + "phpunit/phpunit": "^8.5.29 || ^9.5.23", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "suggest": { @@ -4062,8 +4100,12 @@ }, "type": "library", "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + }, "branch-alias": { - "dev-master": "7.4-dev" + "dev-master": "7.5-dev" } }, "autoload": { @@ -4129,7 +4171,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.4.1" + "source": "https://github.com/guzzle/guzzle/tree/7.5.0" }, "funding": [ { @@ -4145,20 +4187,20 @@ "type": "tidelift" } ], - "time": "2021-12-06T18:43:05+00:00" + "time": "2022-08-28T15:39:27+00:00" }, { "name": "guzzlehttp/promises", - "version": "1.5.1", + "version": "1.5.2", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da" + "reference": "b94b2807d85443f9719887892882d0329d1e2598" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/fe752aedc9fd8fcca3fe7ad05d419d32998a06da", - "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da", + "url": "https://api.github.com/repos/guzzle/promises/zipball/b94b2807d85443f9719887892882d0329d1e2598", + "reference": "b94b2807d85443f9719887892882d0329d1e2598", "shasum": "" }, "require": { @@ -4213,7 +4255,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/1.5.1" + "source": "https://github.com/guzzle/promises/tree/1.5.2" }, "funding": [ { @@ -4229,7 +4271,7 @@ "type": "tidelift" } ], - "time": "2021-10-22T20:56:57+00:00" + "time": "2022-08-28T14:55:35+00:00" }, { "name": "myclabs/deep-copy", @@ -4292,16 +4334,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.13.2", + "version": "v4.15.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077" + "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", + "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", "shasum": "" }, "require": { @@ -4342,9 +4384,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.2" }, - "time": "2021-11-30T19:35:32+00:00" + "time": "2022-11-12T15:38:23+00:00" }, { "name": "phar-io/manifest", @@ -4457,249 +4499,22 @@ }, "time": "2022-02-21T01:04:05+00:00" }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", - "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" - }, - "time": "2020-06-27T09:03:43+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.3.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", - "shasum": "" - }, - "require": { - "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" - }, - "require-dev": { - "mockery/mockery": "~1.3.2", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" - }, - "time": "2021-10-19T17:43:47+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.6.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706", - "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "*", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "support": { - "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.0" - }, - "time": "2022-01-04T19:58:01+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "v1.15.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.2", - "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0", - "sebastian/recursion-context": "^3.0 || ^4.0" - }, - "require-dev": { - "phpspec/phpspec": "^6.0 || ^7.0", - "phpunit/phpunit": "^8.0 || ^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "support": { - "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" - }, - "time": "2021-12-08T12:19:24+00:00" - }, { "name": "phpstan/phpstan", - "version": "1.4.8", + "version": "1.9.4", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "2a6d6704b17c4db6190cc3104056c0aad740cb15" + "reference": "d03bccee595e2146b7c9d174486b84f4dc61b0f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/2a6d6704b17c4db6190cc3104056c0aad740cb15", - "reference": "2a6d6704b17c4db6190cc3104056c0aad740cb15", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d03bccee595e2146b7c9d174486b84f4dc61b0f2", + "reference": "d03bccee595e2146b7c9d174486b84f4dc61b0f2", "shasum": "" }, "require": { - "php": "^7.1|^8.0" + "php": "^7.2|^8.0" }, "conflict": { "phpstan/phpstan-shim": "*" @@ -4709,11 +4524,6 @@ "phpstan.phar" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, "autoload": { "files": [ "bootstrap.php" @@ -4724,9 +4534,13 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.4.8" + "source": "https://github.com/phpstan/phpstan/tree/1.9.4" }, "funding": [ { @@ -4737,45 +4551,39 @@ "url": "https://github.com/phpstan", "type": "github" }, - { - "url": "https://www.patreon.com/phpstan", - "type": "patreon" - }, { "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", "type": "tidelift" } ], - "time": "2022-03-04T13:03:56+00:00" + "time": "2022-12-17T13:33:52+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", - "version": "1.0.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-deprecation-rules.git", - "reference": "e5ccafb0dd8d835dd65d8d7a1a0d2b1b75414682" + "reference": "2c6792eda026d9c474c14aa018aed312686714db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/e5ccafb0dd8d835dd65d8d7a1a0d2b1b75414682", - "reference": "e5ccafb0dd8d835dd65d8d7a1a0d2b1b75414682", + "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/2c6792eda026d9c474c14aa018aed312686714db", + "reference": "2c6792eda026d9c474c14aa018aed312686714db", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0", - "phpstan/phpstan": "^1.0" + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.9.3" }, "require-dev": { "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-php-parser": "^1.1", "phpstan/phpstan-phpunit": "^1.0", "phpunit/phpunit": "^9.5" }, "type": "phpstan-extension", "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - }, "phpstan": { "includes": [ "rules.neon" @@ -4794,29 +4602,29 @@ "description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.", "support": { "issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues", - "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.0.0" + "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.1.1" }, - "time": "2021-09-23T11:02:21+00:00" + "time": "2022-12-13T14:26:20+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.15", + "version": "9.2.23", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f" + "reference": "9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f", - "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c", + "reference": "9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.13.0", + "nikic/php-parser": "^4.14", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -4865,7 +4673,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.23" }, "funding": [ { @@ -4873,7 +4681,7 @@ "type": "github" } ], - "time": "2022-03-07T09:28:20+00:00" + "time": "2022-12-28T12:41:10+00:00" }, { "name": "phpunit/php-file-iterator", @@ -5118,16 +4926,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.18", + "version": "9.5.27", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "1b5856028273bfd855e60a887278857d872ec67a" + "reference": "a2bc7ffdca99f92d959b3f2270529334030bba38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1b5856028273bfd855e60a887278857d872ec67a", - "reference": "1b5856028273bfd855e60a887278857d872ec67a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a2bc7ffdca99f92d959b3f2270529334030bba38", + "reference": "a2bc7ffdca99f92d959b3f2270529334030bba38", "shasum": "" }, "require": { @@ -5142,7 +4950,6 @@ "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", - "phpspec/prophecy": "^1.12.1", "phpunit/php-code-coverage": "^9.2.13", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", @@ -5150,20 +4957,16 @@ "phpunit/php-timer": "^5.0.2", "sebastian/cli-parser": "^1.0.1", "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.5", + "sebastian/comparator": "^4.0.8", "sebastian/diff": "^4.0.3", "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.3", + "sebastian/exporter": "^4.0.5", "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3.4", + "sebastian/type": "^3.2", "sebastian/version": "^3.0.2" }, - "require-dev": { - "ext-pdo": "*", - "phpspec/prophecy-phpunit": "^2.0.1" - }, "suggest": { "ext-soap": "*", "ext-xdebug": "*" @@ -5205,7 +5008,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.18" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.27" }, "funding": [ { @@ -5215,9 +5018,13 @@ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" } ], - "time": "2022-03-08T06:52:28+00:00" + "time": "2022-12-09T07:31:23+00:00" }, { "name": "psr/http-client", @@ -5440,16 +5247,16 @@ }, { "name": "sebastian/comparator", - "version": "4.0.6", + "version": "4.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382" + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", "shasum": "" }, "require": { @@ -5502,7 +5309,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" }, "funding": [ { @@ -5510,7 +5317,7 @@ "type": "github" } ], - "time": "2020-10-26T15:49:45+00:00" + "time": "2022-09-14T12:41:17+00:00" }, { "name": "sebastian/complexity", @@ -5637,16 +5444,16 @@ }, { "name": "sebastian/environment", - "version": "5.1.3", + "version": "5.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac" + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", "shasum": "" }, "require": { @@ -5688,7 +5495,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.3" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" }, "funding": [ { @@ -5696,20 +5503,20 @@ "type": "github" } ], - "time": "2020-09-28T05:52:38+00:00" + "time": "2022-04-03T09:37:03+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", "shasum": "" }, "require": { @@ -5765,7 +5572,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" }, "funding": [ { @@ -5773,7 +5580,7 @@ "type": "github" } ], - "time": "2021-11-11T14:18:36+00:00" + "time": "2022-09-14T06:03:37+00:00" }, { "name": "sebastian/global-state", @@ -6128,28 +5935,28 @@ }, { "name": "sebastian/type", - "version": "2.3.4", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" + "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", + "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", "shasum": "" }, "require": { "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -6172,7 +5979,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" + "source": "https://github.com/sebastianbergmann/type/tree/3.2.0" }, "funding": [ { @@ -6180,7 +5987,7 @@ "type": "github" } ], - "time": "2021-06-15T12:49:02+00:00" + "time": "2022-09-12T14:47:03+00:00" }, { "name": "sebastian/version", @@ -6237,16 +6044,16 @@ }, { "name": "symfony/browser-kit", - "version": "v5.4.3", + "version": "v5.4.11", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "18e73179c6a33d520de1b644941eba108dd811ad" + "reference": "081fe28a26b6bd671dea85ef3a4b5003f3c88027" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/18e73179c6a33d520de1b644941eba108dd811ad", - "reference": "18e73179c6a33d520de1b644941eba108dd811ad", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/081fe28a26b6bd671dea85ef3a4b5003f3c88027", + "reference": "081fe28a26b6bd671dea85ef3a4b5003f3c88027", "shasum": "" }, "require": { @@ -6289,7 +6096,7 @@ "description": "Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/browser-kit/tree/v5.4.3" + "source": "https://github.com/symfony/browser-kit/tree/v5.4.11" }, "funding": [ { @@ -6305,20 +6112,20 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2022-07-27T15:50:05+00:00" }, { "name": "symfony/css-selector", - "version": "v5.4.3", + "version": "v5.4.17", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "b0a190285cd95cb019237851205b8140ef6e368e" + "reference": "052ef49b660f9ad2a3adb311c555c9bc11ba61f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/b0a190285cd95cb019237851205b8140ef6e368e", - "reference": "b0a190285cd95cb019237851205b8140ef6e368e", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/052ef49b660f9ad2a3adb311c555c9bc11ba61f4", + "reference": "052ef49b660f9ad2a3adb311c555c9bc11ba61f4", "shasum": "" }, "require": { @@ -6355,7 +6162,7 @@ "description": "Converts CSS selectors to XPath expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/css-selector/tree/v5.4.3" + "source": "https://github.com/symfony/css-selector/tree/v5.4.17" }, "funding": [ { @@ -6371,20 +6178,20 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2022-12-23T11:40:44+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.0", + "version": "v2.5.2", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8" + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/6f981ee24cf69ee7ce9736146d1c57c2780598a8", - "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", "shasum": "" }, "require": { @@ -6422,7 +6229,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" }, "funding": [ { @@ -6438,20 +6245,20 @@ "type": "tidelift" } ], - "time": "2021-07-12T14:48:14+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/dom-crawler", - "version": "v5.4.6", + "version": "v5.4.17", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "c0bda97480d96337bd3866026159a8b358665457" + "reference": "32a07d910edc138a1dd5508c17c6b9bc1eb27a1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/c0bda97480d96337bd3866026159a8b358665457", - "reference": "c0bda97480d96337bd3866026159a8b358665457", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/32a07d910edc138a1dd5508c17c6b9bc1eb27a1b", + "reference": "32a07d910edc138a1dd5508c17c6b9bc1eb27a1b", "shasum": "" }, "require": { @@ -6497,7 +6304,7 @@ "description": "Eases DOM navigation for HTML and XML documents", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dom-crawler/tree/v5.4.6" + "source": "https://github.com/symfony/dom-crawler/tree/v5.4.17" }, "funding": [ { @@ -6513,20 +6320,20 @@ "type": "tidelift" } ], - "time": "2022-03-02T12:42:23+00:00" + "time": "2022-12-22T10:31:03+00:00" }, { "name": "symfony/finder", - "version": "v5.4.3", + "version": "v5.4.17", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "231313534dded84c7ecaa79d14bc5da4ccb69b7d" + "reference": "40c08632019838dfb3350f18cf5563b8080055fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/231313534dded84c7ecaa79d14bc5da4ccb69b7d", - "reference": "231313534dded84c7ecaa79d14bc5da4ccb69b7d", + "url": "https://api.github.com/repos/symfony/finder/zipball/40c08632019838dfb3350f18cf5563b8080055fc", + "reference": "40c08632019838dfb3350f18cf5563b8080055fc", "shasum": "" }, "require": { @@ -6560,7 +6367,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.4.3" + "source": "https://github.com/symfony/finder/tree/v5.4.17" }, "funding": [ { @@ -6576,7 +6383,7 @@ "type": "tidelift" } ], - "time": "2022-01-26T16:34:36+00:00" + "time": "2022-12-22T10:31:03+00:00" }, { "name": "theseer/tokenizer", @@ -6627,64 +6434,6 @@ } ], "time": "2021-07-28T10:34:58+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.10.0", - "source": { - "type": "git", - "url": "https://github.com/webmozarts/assert.git", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<4.6.1 || 4.6.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.5.13" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "support": { - "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.10.0" - }, - "time": "2021-03-09T10:59:23+00:00" } ], "aliases": [], @@ -6699,11 +6448,12 @@ "ext-curl": "*", "ext-zip": "*", "ext-dom": "*", - "ext-libxml": "*" + "ext-libxml": "*", + "ext-gd": "*" }, "platform-dev": [], "platform-overrides": { "php": "7.3.6" }, - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.3.0" } diff --git a/index.php b/index.php index b6b86e1..2821a44 100644 --- a/index.php +++ b/index.php @@ -3,7 +3,7 @@ /** * @package Grav.Core * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/blueprints/config/system.yaml b/system/blueprints/config/system.yaml index 787fcd5..09e8083 100644 --- a/system/blueprints/config/system.yaml +++ b/system/blueprints/config/system.yaml @@ -1156,6 +1156,13 @@ form: local6: local6 local7: local7 + log.syslog.tag: + type: text + size: small + label: PLUGIN_ADMIN.SYSLOG_TAG + help: PLUGIN_ADMIN.SYSLOG_TAG_HELP + placeholder: "grav" + debugger: type: tab title: PLUGIN_ADMIN.DEBUGGER diff --git a/system/blueprints/flex/user-accounts.yaml b/system/blueprints/flex/user-accounts.yaml index 8d336f9..74baeb6 100644 --- a/system/blueprints/flex/user-accounts.yaml +++ b/system/blueprints/flex/user-accounts.yaml @@ -125,6 +125,17 @@ config: - username - fullname + relationships: + media: + type: media + cardinality: to-many + avatar: + type: media + cardinality: to-one +# roles: +# type: user-groups +# cardinality: to-many + blueprints: configure: fields: diff --git a/system/config/system.yaml b/system/config/system.yaml index 380d650..2ffd02a 100644 --- a/system/config/system.yaml +++ b/system/config/system.yaml @@ -35,6 +35,7 @@ home: pages: type: regular # EXPERIMENTAL: Page type: regular or flex + dirs: ['page://'] # Advanced functionality, allows for multiple page paths theme: quark # Default theme (defaults to "quark" theme) order: by: default # Order pages by "default", "alpha" or "date" @@ -144,6 +145,7 @@ log: handler: file # Log handler. Currently supported: file | syslog syslog: facility: local6 # Syslog facilities output + tag: grav # Syslog tag. Default: "grav". debugger: enabled: false # Enable Grav debugger and following settings diff --git a/system/defines.php b/system/defines.php index 5f743db..803ab45 100644 --- a/system/defines.php +++ b/system/defines.php @@ -3,13 +3,13 @@ /** * @package Grav\Core * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ // Some standard defines define('GRAV', true); -define('GRAV_VERSION', '1.7.31'); +define('GRAV_VERSION', '1.7.38'); define('GRAV_SCHEMA', '1.7.0_2020-11-20_1'); define('GRAV_TESTING', false); diff --git a/system/install.php b/system/install.php index 5c9440f..05e6949 100644 --- a/system/install.php +++ b/system/install.php @@ -2,7 +2,7 @@ /** * @package Grav\Core * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/router.php b/system/router.php index c19f814..2c9eefc 100644 --- a/system/router.php +++ b/system/router.php @@ -3,7 +3,7 @@ /** * @package Grav\Core * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Assets.php b/system/src/Grav/Common/Assets.php index 621a140..125a518 100644 --- a/system/src/Grav/Common/Assets.php +++ b/system/src/Grav/Common/Assets.php @@ -3,7 +3,7 @@ /** * @package Grav\Common * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Assets/BaseAsset.php b/system/src/Grav/Common/Assets/BaseAsset.php index d062d75..c1d67ce 100644 --- a/system/src/Grav/Common/Assets/BaseAsset.php +++ b/system/src/Grav/Common/Assets/BaseAsset.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Assets * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Assets/BlockAssets.php b/system/src/Grav/Common/Assets/BlockAssets.php index 7d97960..de9984f 100644 --- a/system/src/Grav/Common/Assets/BlockAssets.php +++ b/system/src/Grav/Common/Assets/BlockAssets.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Assets * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Assets/Css.php b/system/src/Grav/Common/Assets/Css.php index ea6b388..4c80ead 100644 --- a/system/src/Grav/Common/Assets/Css.php +++ b/system/src/Grav/Common/Assets/Css.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Assets * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Assets/InlineCss.php b/system/src/Grav/Common/Assets/InlineCss.php index 4984db4..ab53eb9 100644 --- a/system/src/Grav/Common/Assets/InlineCss.php +++ b/system/src/Grav/Common/Assets/InlineCss.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Assets * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Assets/InlineJs.php b/system/src/Grav/Common/Assets/InlineJs.php index e38a51a..c591c3e 100644 --- a/system/src/Grav/Common/Assets/InlineJs.php +++ b/system/src/Grav/Common/Assets/InlineJs.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Assets * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Assets/InlineJsModule.php b/system/src/Grav/Common/Assets/InlineJsModule.php index 42ce6f1..2eaf138 100644 --- a/system/src/Grav/Common/Assets/InlineJsModule.php +++ b/system/src/Grav/Common/Assets/InlineJsModule.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Assets * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Assets/Js.php b/system/src/Grav/Common/Assets/Js.php index 8687a86..048cf17 100644 --- a/system/src/Grav/Common/Assets/Js.php +++ b/system/src/Grav/Common/Assets/Js.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Assets * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Assets/JsModule.php b/system/src/Grav/Common/Assets/JsModule.php index 5c2a836..519b9d9 100644 --- a/system/src/Grav/Common/Assets/JsModule.php +++ b/system/src/Grav/Common/Assets/JsModule.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Assets * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Assets/Link.php b/system/src/Grav/Common/Assets/Link.php index ecafcea..8ab193e 100644 --- a/system/src/Grav/Common/Assets/Link.php +++ b/system/src/Grav/Common/Assets/Link.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Assets * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Assets/Pipeline.php b/system/src/Grav/Common/Assets/Pipeline.php index 0010d7b..e828a68 100644 --- a/system/src/Grav/Common/Assets/Pipeline.php +++ b/system/src/Grav/Common/Assets/Pipeline.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Assets * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Assets/Traits/AssetUtilsTrait.php b/system/src/Grav/Common/Assets/Traits/AssetUtilsTrait.php index 0e3f392..e2d8981 100644 --- a/system/src/Grav/Common/Assets/Traits/AssetUtilsTrait.php +++ b/system/src/Grav/Common/Assets/Traits/AssetUtilsTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Assets\Traits * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Assets/Traits/LegacyAssetsTrait.php b/system/src/Grav/Common/Assets/Traits/LegacyAssetsTrait.php index c1ef0a3..28372a6 100644 --- a/system/src/Grav/Common/Assets/Traits/LegacyAssetsTrait.php +++ b/system/src/Grav/Common/Assets/Traits/LegacyAssetsTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Assets\Traits * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Assets/Traits/TestingAssetsTrait.php b/system/src/Grav/Common/Assets/Traits/TestingAssetsTrait.php index b11b439..a16eb37 100644 --- a/system/src/Grav/Common/Assets/Traits/TestingAssetsTrait.php +++ b/system/src/Grav/Common/Assets/Traits/TestingAssetsTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Assets\Traits * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Backup/Backups.php b/system/src/Grav/Common/Backup/Backups.php index ff4789d..aa84fdf 100644 --- a/system/src/Grav/Common/Backup/Backups.php +++ b/system/src/Grav/Common/Backup/Backups.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Backup * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Browser.php b/system/src/Grav/Common/Browser.php index ffc8da3..a5fbaed 100644 --- a/system/src/Grav/Common/Browser.php +++ b/system/src/Grav/Common/Browser.php @@ -3,7 +3,7 @@ /** * @package Grav\Common * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Cache.php b/system/src/Grav/Common/Cache.php index ed40a08..2e92190 100644 --- a/system/src/Grav/Common/Cache.php +++ b/system/src/Grav/Common/Cache.php @@ -3,7 +3,7 @@ /** * @package Grav\Common * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Composer.php b/system/src/Grav/Common/Composer.php index 667edf2..caf5eb1 100644 --- a/system/src/Grav/Common/Composer.php +++ b/system/src/Grav/Common/Composer.php @@ -3,7 +3,7 @@ /** * @package Grav\Common * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Config/CompiledBase.php b/system/src/Grav/Common/Config/CompiledBase.php index b462b4c..999b0c0 100644 --- a/system/src/Grav/Common/Config/CompiledBase.php +++ b/system/src/Grav/Common/Config/CompiledBase.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Config * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Config/CompiledBlueprints.php b/system/src/Grav/Common/Config/CompiledBlueprints.php index e838591..df9d1be 100644 --- a/system/src/Grav/Common/Config/CompiledBlueprints.php +++ b/system/src/Grav/Common/Config/CompiledBlueprints.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Config * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Config/CompiledConfig.php b/system/src/Grav/Common/Config/CompiledConfig.php index 2db6de5..4513133 100644 --- a/system/src/Grav/Common/Config/CompiledConfig.php +++ b/system/src/Grav/Common/Config/CompiledConfig.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Config * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Config/CompiledLanguages.php b/system/src/Grav/Common/Config/CompiledLanguages.php index 0a26686..cd7f904 100644 --- a/system/src/Grav/Common/Config/CompiledLanguages.php +++ b/system/src/Grav/Common/Config/CompiledLanguages.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Config * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Config/Config.php b/system/src/Grav/Common/Config/Config.php index ca027bf..e814d3e 100644 --- a/system/src/Grav/Common/Config/Config.php +++ b/system/src/Grav/Common/Config/Config.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Config * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Config/ConfigFileFinder.php b/system/src/Grav/Common/Config/ConfigFileFinder.php index 28f9dc1..68f8161 100644 --- a/system/src/Grav/Common/Config/ConfigFileFinder.php +++ b/system/src/Grav/Common/Config/ConfigFileFinder.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Config * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Config/Languages.php b/system/src/Grav/Common/Config/Languages.php index 05798c5..44d92f1 100644 --- a/system/src/Grav/Common/Config/Languages.php +++ b/system/src/Grav/Common/Config/Languages.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Config * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Config/Setup.php b/system/src/Grav/Common/Config/Setup.php index f8ce943..68db799 100644 --- a/system/src/Grav/Common/Config/Setup.php +++ b/system/src/Grav/Common/Config/Setup.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Config * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -182,13 +182,14 @@ class Setup extends Data // If no environment is set, make sure we get one (CLI or hostname). if (null === $environment) { if (defined('GRAV_CLI')) { + $request = null; + $uri = null; $environment = 'cli'; } else { /** @var ServerRequestInterface $request */ $request = $container['request']; - $host = $request->getUri()->getHost(); - - $environment = Utils::substrToString($host, ':'); + $uri = $request->getUri(); + $environment = $uri->getHost(); } } diff --git a/system/src/Grav/Common/Data/Blueprint.php b/system/src/Grav/Common/Data/Blueprint.php index ef6aef5..c13d9a9 100644 --- a/system/src/Grav/Common/Data/Blueprint.php +++ b/system/src/Grav/Common/Data/Blueprint.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Data * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -515,7 +515,7 @@ class Blueprint extends BlueprintForm $success = $this->resolveActions($user, $actions); } if (!$success) { - $this->addPropertyRecursive($field, 'validate', ['ignore' => true]); + static::addPropertyRecursive($field, 'validate', ['ignore' => true]); } } @@ -566,7 +566,7 @@ class Blueprint extends BlueprintForm } if ($matches) { - $this->addPropertyRecursive($field, 'validate', ['ignore' => true]); + static::addPropertyRecursive($field, 'validate', ['ignore' => true]); return; } } @@ -577,7 +577,7 @@ class Blueprint extends BlueprintForm * @param mixed $value * @return void */ - protected function addPropertyRecursive(array &$field, $property, $value) + public static function addPropertyRecursive(array &$field, $property, $value) { if (is_array($value) && isset($field[$property]) && is_array($field[$property])) { $field[$property] = array_merge_recursive($field[$property], $value); @@ -587,7 +587,7 @@ class Blueprint extends BlueprintForm if (!empty($field['fields'])) { foreach ($field['fields'] as $key => &$child) { - $this->addPropertyRecursive($child, $property, $value); + static::addPropertyRecursive($child, $property, $value); } } } diff --git a/system/src/Grav/Common/Data/BlueprintSchema.php b/system/src/Grav/Common/Data/BlueprintSchema.php index 8cc6303..137e042 100644 --- a/system/src/Grav/Common/Data/BlueprintSchema.php +++ b/system/src/Grav/Common/Data/BlueprintSchema.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Data * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Data/Blueprints.php b/system/src/Grav/Common/Data/Blueprints.php index dfdd46f..60dd8be 100644 --- a/system/src/Grav/Common/Data/Blueprints.php +++ b/system/src/Grav/Common/Data/Blueprints.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Data * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Data/Data.php b/system/src/Grav/Common/Data/Data.php index 0f09b2d..92d890e 100644 --- a/system/src/Grav/Common/Data/Data.php +++ b/system/src/Grav/Common/Data/Data.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Data * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Data/DataInterface.php b/system/src/Grav/Common/Data/DataInterface.php index a4bc214..44d77eb 100644 --- a/system/src/Grav/Common/Data/DataInterface.php +++ b/system/src/Grav/Common/Data/DataInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Data * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Data/Validation.php b/system/src/Grav/Common/Data/Validation.php index 569ea51..a551fb5 100644 --- a/system/src/Grav/Common/Data/Validation.php +++ b/system/src/Grav/Common/Data/Validation.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Data * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -246,7 +246,9 @@ class Validation return false; } - $max = (int)($params['max'] ?? 0); + $multiline = isset($params['multiline']) && $params['multiline']; + + $max = (int)($params['max'] ?? ($multiline ? 65536 : 2048)); if ($max && $len > $max) { return false; } @@ -256,7 +258,7 @@ class Validation return false; } - if ((!isset($params['multiline']) || !$params['multiline']) && preg_match('/\R/um', $value)) { + if (!$multiline && preg_match('/\R/um', $value)) { return false; } @@ -317,6 +319,10 @@ class Validation */ public static function typeCommaList($value, array $params, array $field) { + if (!isset($params['max'])) { + $params['max'] = 2048; + } + return is_array($value) ? true : self::typeText($value, $params, $field); } @@ -379,6 +385,10 @@ class Validation */ public static function typePassword($value, array $params, array $field) { + if (!isset($params['max'])) { + $params['max'] = 256; + } + return self::typeText($value, $params, $field); } @@ -621,6 +631,10 @@ class Validation */ public static function typeEmail($value, array $params, array $field) { + if (!isset($params['max'])) { + $params['max'] = 320; + } + $values = !is_array($value) ? explode(',', preg_replace('/\s+/', '', $value)) : $value; foreach ($values as $val) { @@ -642,6 +656,10 @@ class Validation */ public static function typeUrl($value, array $params, array $field) { + if (!isset($params['max'])) { + $params['max'] = 2048; + } + return self::typeText($value, $params, $field) && filter_var($value, FILTER_VALIDATE_URL); } diff --git a/system/src/Grav/Common/Data/ValidationException.php b/system/src/Grav/Common/Data/ValidationException.php index 9a3d900..fa82e2b 100644 --- a/system/src/Grav/Common/Data/ValidationException.php +++ b/system/src/Grav/Common/Data/ValidationException.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Data * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Debugger.php b/system/src/Grav/Common/Debugger.php index e7b1624..da9eaa6 100644 --- a/system/src/Grav/Common/Debugger.php +++ b/system/src/Grav/Common/Debugger.php @@ -3,7 +3,7 @@ /** * @package Grav\Common * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Errors/BareHandler.php b/system/src/Grav/Common/Errors/BareHandler.php index 9093827..2d824cb 100644 --- a/system/src/Grav/Common/Errors/BareHandler.php +++ b/system/src/Grav/Common/Errors/BareHandler.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Errors * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Errors/Errors.php b/system/src/Grav/Common/Errors/Errors.php index 92f885b..9357ba6 100644 --- a/system/src/Grav/Common/Errors/Errors.php +++ b/system/src/Grav/Common/Errors/Errors.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Errors * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Errors/SimplePageHandler.php b/system/src/Grav/Common/Errors/SimplePageHandler.php index 80c4f96..4b0db05 100644 --- a/system/src/Grav/Common/Errors/SimplePageHandler.php +++ b/system/src/Grav/Common/Errors/SimplePageHandler.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Errors * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Errors/SystemFacade.php b/system/src/Grav/Common/Errors/SystemFacade.php index edf2b53..04645ce 100644 --- a/system/src/Grav/Common/Errors/SystemFacade.php +++ b/system/src/Grav/Common/Errors/SystemFacade.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Errors * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -43,4 +43,25 @@ class SystemFacade extends \Whoops\Util\SystemFacade $handler(); } } + + + /** + * @param int $httpCode + * + * @return int + */ + public function setHttpResponseCode($httpCode) + { + if (!headers_sent()) { + // Ensure that no 'location' header is present as otherwise this + // will override the HTTP code being set here, and mask the + // expected error page. + header_remove('location'); + + // Work around PHP bug #8218 (8.0.17 & 8.1.4). + header_remove('Content-Encoding'); + } + + return http_response_code($httpCode); + } } diff --git a/system/src/Grav/Common/File/CompiledFile.php b/system/src/Grav/Common/File/CompiledFile.php index 2228422..0654568 100644 --- a/system/src/Grav/Common/File/CompiledFile.php +++ b/system/src/Grav/Common/File/CompiledFile.php @@ -3,13 +3,15 @@ /** * @package Grav\Common\File * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ namespace Grav\Common\File; use Exception; +use Grav\Common\Debugger; +use Grav\Common\Grav; use Grav\Common\Utils; use RocketTheme\Toolbox\File\PhpFile; use RuntimeException; @@ -32,9 +34,10 @@ trait CompiledFile public function content($var = null) { try { + $filename = $this->filename; // If nothing has been loaded, attempt to get pre-compiled version of the file first. if ($var === null && $this->raw === null && $this->content === null) { - $key = md5($this->filename); + $key = md5($filename); $file = PhpFile::instance(CACHE_DIR . "compiled/files/{$key}{$this->extension}.php"); $modified = $this->modified(); @@ -48,39 +51,49 @@ trait CompiledFile $class = get_class($this); + $size = filesize($filename); $cache = $file->exists() ? $file->content() : null; // Load real file if cache isn't up to date (or is invalid). if (!isset($cache['@class']) || $cache['@class'] !== $class || $cache['modified'] !== $modified - || $cache['filename'] !== $this->filename + || ($cache['size'] ?? null) !== $size + || $cache['filename'] !== $filename ) { // Attempt to lock the file for writing. try { - $file->lock(false); + $locked = $file->lock(false); } catch (Exception $e) { - // Another process has locked the file; we will check this in a bit. + $locked = false; + + /** @var Debugger $debugger */ + $debugger = Grav::instance()['debugger']; + $debugger->addMessage(sprintf('%s(): Cannot obtain a lock for compiling cache file for %s: %s', __METHOD__, $this->filename, $e->getMessage()), 'warning'); } // Decode RAW file into compiled array. $data = (array)$this->decode($this->raw()); $cache = [ '@class' => $class, - 'filename' => $this->filename, + 'filename' => $filename, 'modified' => $modified, + 'size' => $size, 'data' => $data ]; // If compiled file wasn't already locked by another process, save it. - if ($file->locked() !== false) { + if ($locked) { $file->save($cache); $file->unlock(); // Compile cached file into bytecode cache - if (function_exists('opcache_invalidate')) { + if (function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN)) { + $lockName = $file->filename(); + // Silence error if function exists, but is restricted. - @opcache_invalidate($file->filename(), true); + @opcache_invalidate($lockName, true); + @opcache_compile_file($lockName); } } } @@ -89,12 +102,71 @@ trait CompiledFile $this->content = $cache['data']; } } catch (Exception $e) { - throw new RuntimeException(sprintf('Failed to read %s: %s', Utils::basename($this->filename), $e->getMessage()), 500, $e); + throw new RuntimeException(sprintf('Failed to read %s: %s', Utils::basename($filename), $e->getMessage()), 500, $e); } return parent::content($var); } + /** + * Save file. + * + * @param mixed $data Optional data to be saved, usually array. + * @return void + * @throws RuntimeException + */ + public function save($data = null) + { + // Make sure that the cache file is always up to date! + $key = md5($this->filename); + $file = PhpFile::instance(CACHE_DIR . "compiled/files/{$key}{$this->extension}.php"); + try { + $locked = $file->lock(); + } catch (Exception $e) { + $locked = false; + + /** @var Debugger $debugger */ + $debugger = Grav::instance()['debugger']; + $debugger->addMessage(sprintf('%s(): Cannot obtain a lock for compiling cache file for %s: %s', __METHOD__, $this->filename, $e->getMessage()), 'warning'); + } + + parent::save($data); + + if ($locked) { + $modified = $this->modified(); + $filename = $this->filename; + $class = get_class($this); + $size = filesize($filename); + + // windows doesn't play nicely with this as it can't read when locked + if (!Utils::isWindows()) { + // Reload data from the filesystem. This ensures that we always cache the correct data (see issue #2282). + $this->raw = $this->content = null; + $data = (array)$this->decode($this->raw()); + } + + // Decode data into compiled array. + $cache = [ + '@class' => $class, + 'filename' => $filename, + 'modified' => $modified, + 'size' => $size, + 'data' => $data + ]; + + $file->save($cache); + $file->unlock(); + + // Compile cached file into bytecode cache + if (function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN)) { + $lockName = $file->filename(); + // Silence error if function exists, but is restricted. + @opcache_invalidate($lockName, true); + @opcache_compile_file($lockName); + } + } + } + /** * Serialize file. * diff --git a/system/src/Grav/Common/File/CompiledJsonFile.php b/system/src/Grav/Common/File/CompiledJsonFile.php index e8347bb..cb78922 100644 --- a/system/src/Grav/Common/File/CompiledJsonFile.php +++ b/system/src/Grav/Common/File/CompiledJsonFile.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\File * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/File/CompiledMarkdownFile.php b/system/src/Grav/Common/File/CompiledMarkdownFile.php index 1083111..dd1bb0a 100644 --- a/system/src/Grav/Common/File/CompiledMarkdownFile.php +++ b/system/src/Grav/Common/File/CompiledMarkdownFile.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\File * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/File/CompiledYamlFile.php b/system/src/Grav/Common/File/CompiledYamlFile.php index 0f0c64f..4e5a231 100644 --- a/system/src/Grav/Common/File/CompiledYamlFile.php +++ b/system/src/Grav/Common/File/CompiledYamlFile.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\File * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Filesystem/Archiver.php b/system/src/Grav/Common/Filesystem/Archiver.php index 4c291a5..9e68137 100644 --- a/system/src/Grav/Common/Filesystem/Archiver.php +++ b/system/src/Grav/Common/Filesystem/Archiver.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Filesystem * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Filesystem/Folder.php b/system/src/Grav/Common/Filesystem/Folder.php index 8dac2e5..9465790 100644 --- a/system/src/Grav/Common/Filesystem/Folder.php +++ b/system/src/Grav/Common/Filesystem/Folder.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Filesystem * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -31,32 +31,34 @@ abstract class Folder /** * Recursively find the last modified time under given path. * - * @param string $path + * @param array $paths * @return int */ - public static function lastModifiedFolder($path) + public static function lastModifiedFolder(array $paths): int { - if (!file_exists($path)) { - return 0; - } - $last_modified = 0; /** @var UniformResourceLocator $locator */ $locator = Grav::instance()['locator']; $flags = RecursiveDirectoryIterator::SKIP_DOTS; - if ($locator->isStream($path)) { - $directory = $locator->getRecursiveIterator($path, $flags); - } else { - $directory = new RecursiveDirectoryIterator($path, $flags); - } - $filter = new RecursiveFolderFilterIterator($directory); - $iterator = new RecursiveIteratorIterator($filter, RecursiveIteratorIterator::SELF_FIRST); - foreach ($iterator as $dir) { - $dir_modified = $dir->getMTime(); - if ($dir_modified > $last_modified) { - $last_modified = $dir_modified; + foreach ($paths as $path) { + if (!file_exists($path)) { + return 0; + } + if ($locator->isStream($path)) { + $directory = $locator->getRecursiveIterator($path, $flags); + } else { + $directory = new RecursiveDirectoryIterator($path, $flags); + } + $filter = new RecursiveFolderFilterIterator($directory); + $iterator = new RecursiveIteratorIterator($filter, RecursiveIteratorIterator::SELF_FIRST); + + foreach ($iterator as $dir) { + $dir_modified = $dir->getMTime(); + if ($dir_modified > $last_modified) { + $last_modified = $dir_modified; + } } } @@ -66,38 +68,40 @@ abstract class Folder /** * Recursively find the last modified time under given path by file. * - * @param string $path + * @param array $paths * @param string $extensions which files to search for specifically * @return int */ - public static function lastModifiedFile($path, $extensions = 'md|yaml') + public static function lastModifiedFile(array $paths, $extensions = 'md|yaml'): int { - if (!file_exists($path)) { - return 0; - } - $last_modified = 0; /** @var UniformResourceLocator $locator */ $locator = Grav::instance()['locator']; $flags = RecursiveDirectoryIterator::SKIP_DOTS; - if ($locator->isStream($path)) { - $directory = $locator->getRecursiveIterator($path, $flags); - } else { - $directory = new RecursiveDirectoryIterator($path, $flags); - } - $recursive = new RecursiveIteratorIterator($directory, RecursiveIteratorIterator::SELF_FIRST); - $iterator = new RegexIterator($recursive, '/^.+\.'.$extensions.'$/i'); - /** @var RecursiveDirectoryIterator $file */ - foreach ($iterator as $filepath => $file) { - try { - $file_modified = $file->getMTime(); - if ($file_modified > $last_modified) { - $last_modified = $file_modified; + foreach($paths as $path) { + if (!file_exists($path)) { + return 0; + } + if ($locator->isStream($path)) { + $directory = $locator->getRecursiveIterator($path, $flags); + } else { + $directory = new RecursiveDirectoryIterator($path, $flags); + } + $recursive = new RecursiveIteratorIterator($directory, RecursiveIteratorIterator::SELF_FIRST); + $iterator = new RegexIterator($recursive, '/^.+\.'.$extensions.'$/i'); + + /** @var RecursiveDirectoryIterator $file */ + foreach ($iterator as $file) { + try { + $file_modified = $file->getMTime(); + if ($file_modified > $last_modified) { + $last_modified = $file_modified; + } + } catch (Exception $e) { + Grav::instance()['log']->error('Could not process file: ' . $e->getMessage()); } - } catch (Exception $e) { - Grav::instance()['log']->error('Could not process file: ' . $e->getMessage()); } } @@ -107,28 +111,30 @@ abstract class Folder /** * Recursively md5 hash all files in a path * - * @param string $path + * @param array $paths * @return string */ - public static function hashAllFiles($path) + public static function hashAllFiles(array $paths): string { $files = []; - if (file_exists($path)) { - $flags = RecursiveDirectoryIterator::SKIP_DOTS; + foreach ($paths as $path) { + if (file_exists($path)) { + $flags = RecursiveDirectoryIterator::SKIP_DOTS; - /** @var UniformResourceLocator $locator */ - $locator = Grav::instance()['locator']; - if ($locator->isStream($path)) { - $directory = $locator->getRecursiveIterator($path, $flags); - } else { - $directory = new RecursiveDirectoryIterator($path, $flags); - } + /** @var UniformResourceLocator $locator */ + $locator = Grav::instance()['locator']; + if ($locator->isStream($path)) { + $directory = $locator->getRecursiveIterator($path, $flags); + } else { + $directory = new RecursiveDirectoryIterator($path, $flags); + } - $iterator = new RecursiveIteratorIterator($directory, RecursiveIteratorIterator::SELF_FIRST); + $iterator = new RecursiveIteratorIterator($directory, RecursiveIteratorIterator::SELF_FIRST); - foreach ($iterator as $file) { - $files[] = $file->getPathname() . '?'. $file->getMTime(); + foreach ($iterator as $file) { + $files[] = $file->getPathname() . '?'. $file->getMTime(); + } } } diff --git a/system/src/Grav/Common/Filesystem/RecursiveDirectoryFilterIterator.php b/system/src/Grav/Common/Filesystem/RecursiveDirectoryFilterIterator.php index 75c19bc..929629c 100644 --- a/system/src/Grav/Common/Filesystem/RecursiveDirectoryFilterIterator.php +++ b/system/src/Grav/Common/Filesystem/RecursiveDirectoryFilterIterator.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Filesystem * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Filesystem/RecursiveFolderFilterIterator.php b/system/src/Grav/Common/Filesystem/RecursiveFolderFilterIterator.php index 12d6c6b..70f4340 100644 --- a/system/src/Grav/Common/Filesystem/RecursiveFolderFilterIterator.php +++ b/system/src/Grav/Common/Filesystem/RecursiveFolderFilterIterator.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Filesystem * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Filesystem/ZipArchiver.php b/system/src/Grav/Common/Filesystem/ZipArchiver.php index 4f2a9ee..4b7a3ca 100644 --- a/system/src/Grav/Common/Filesystem/ZipArchiver.php +++ b/system/src/Grav/Common/Filesystem/ZipArchiver.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Filesystem * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/FlexCollection.php b/system/src/Grav/Common/Flex/FlexCollection.php index 704e21f..3a9116c 100644 --- a/system/src/Grav/Common/Flex/FlexCollection.php +++ b/system/src/Grav/Common/Flex/FlexCollection.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/FlexIndex.php b/system/src/Grav/Common/Flex/FlexIndex.php index f903c88..317a9a0 100644 --- a/system/src/Grav/Common/Flex/FlexIndex.php +++ b/system/src/Grav/Common/Flex/FlexIndex.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/FlexObject.php b/system/src/Grav/Common/Flex/FlexObject.php index 887d7a3..39c63bc 100644 --- a/system/src/Grav/Common/Flex/FlexObject.php +++ b/system/src/Grav/Common/Flex/FlexObject.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/Traits/FlexCollectionTrait.php b/system/src/Grav/Common/Flex/Traits/FlexCollectionTrait.php index b919b40..077daca 100644 --- a/system/src/Grav/Common/Flex/Traits/FlexCollectionTrait.php +++ b/system/src/Grav/Common/Flex/Traits/FlexCollectionTrait.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/Traits/FlexCommonTrait.php b/system/src/Grav/Common/Flex/Traits/FlexCommonTrait.php index 9291a42..b652c93 100644 --- a/system/src/Grav/Common/Flex/Traits/FlexCommonTrait.php +++ b/system/src/Grav/Common/Flex/Traits/FlexCommonTrait.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/Traits/FlexGravTrait.php b/system/src/Grav/Common/Flex/Traits/FlexGravTrait.php index c34b89d..c995185 100644 --- a/system/src/Grav/Common/Flex/Traits/FlexGravTrait.php +++ b/system/src/Grav/Common/Flex/Traits/FlexGravTrait.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/Traits/FlexIndexTrait.php b/system/src/Grav/Common/Flex/Traits/FlexIndexTrait.php index a71eb99..253fe8e 100644 --- a/system/src/Grav/Common/Flex/Traits/FlexIndexTrait.php +++ b/system/src/Grav/Common/Flex/Traits/FlexIndexTrait.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/Traits/FlexObjectTrait.php b/system/src/Grav/Common/Flex/Traits/FlexObjectTrait.php index 3c81f07..2f0adfa 100644 --- a/system/src/Grav/Common/Flex/Traits/FlexObjectTrait.php +++ b/system/src/Grav/Common/Flex/Traits/FlexObjectTrait.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/Types/Generic/GenericCollection.php b/system/src/Grav/Common/Flex/Types/Generic/GenericCollection.php index e4ec3d4..8f74703 100644 --- a/system/src/Grav/Common/Flex/Types/Generic/GenericCollection.php +++ b/system/src/Grav/Common/Flex/Types/Generic/GenericCollection.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/Types/Generic/GenericIndex.php b/system/src/Grav/Common/Flex/Types/Generic/GenericIndex.php index fdba503..0053398 100644 --- a/system/src/Grav/Common/Flex/Types/Generic/GenericIndex.php +++ b/system/src/Grav/Common/Flex/Types/Generic/GenericIndex.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/Types/Generic/GenericObject.php b/system/src/Grav/Common/Flex/Types/Generic/GenericObject.php index eba642b..ab0028f 100644 --- a/system/src/Grav/Common/Flex/Types/Generic/GenericObject.php +++ b/system/src/Grav/Common/Flex/Types/Generic/GenericObject.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/Types/Pages/PageCollection.php b/system/src/Grav/Common/Flex/Types/Pages/PageCollection.php index b6c5230..9442d0f 100644 --- a/system/src/Grav/Common/Flex/Types/Pages/PageCollection.php +++ b/system/src/Grav/Common/Flex/Types/Pages/PageCollection.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/Types/Pages/PageIndex.php b/system/src/Grav/Common/Flex/Types/Pages/PageIndex.php index f3978bc..6ad36ef 100644 --- a/system/src/Grav/Common/Flex/Types/Pages/PageIndex.php +++ b/system/src/Grav/Common/Flex/Types/Pages/PageIndex.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -454,7 +454,7 @@ class PageIndex extends FlexPageIndex implements PageCollectionInterface continue; } - // Get the main key without template and langauge. + // Get the main key without template and language. [$main_key,] = explode('|', $entry['storage_key'] . '|', 2); // Update storage key and language. @@ -527,10 +527,7 @@ class PageIndex extends FlexPageIndex implements PageCollectionInterface $language = $options['lang']; $status = 'error'; - $msg = null; $response = []; - $children = null; - $sub_route = null; $extra = null; // Handle leaf_route @@ -610,12 +607,12 @@ class PageIndex extends FlexPageIndex implements PageCollectionInterface $children = $page->children(); /** @var PageIndex $children */ $children = $children->getIndex(); - $selectedChildren = $children->filterBy($filters, true); + $selectedChildren = $children->filterBy($filters + ['language' => $language], true); /** @var Header $header */ $header = $page->header(); - if (!$field && $header->get('admin.children_display_order') === 'collection' && ($orderby = $header->get('content.order.by'))) { + if (!$field && $header->get('admin.children_display_order', 'collection') === 'collection' && ($orderby = $header->get('content.order.by'))) { // Use custom sorting by page header. $sortby = $orderby; $order = $header->get('content.order.dir', $order); diff --git a/system/src/Grav/Common/Flex/Types/Pages/PageObject.php b/system/src/Grav/Common/Flex/Types/Pages/PageObject.php index a05f0eb..db6c2c5 100644 --- a/system/src/Grav/Common/Flex/Types/Pages/PageObject.php +++ b/system/src/Grav/Common/Flex/Types/Pages/PageObject.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -242,6 +242,7 @@ class PageObject extends FlexPageObject { /** @var PageCollection $siblings */ $siblings = $variables['siblings']; + /** @var PageObject $sibling */ foreach ($siblings as $sibling) { $sibling->save(false); } @@ -585,38 +586,46 @@ class PageObject extends FlexPageObject */ public function filterBy(array $filters, bool $recursive = false): bool { + $language = $filters['language'] ?? null; + if (null !== $language) { + /** @var PageObject $test */ + $test = $this->getTranslation($language) ?? $this; + } else { + $test = $this; + } + foreach ($filters as $key => $value) { switch ($key) { case 'search': - $matches = $this->search((string)$value) > 0.0; + $matches = $test->search((string)$value) > 0.0; break; case 'page_type': $types = $value ? explode(',', $value) : []; - $matches = in_array($this->template(), $types, true); + $matches = in_array($test->template(), $types, true); break; case 'extension': - $matches = Utils::contains((string)$value, $this->extension()); + $matches = Utils::contains((string)$value, $test->extension()); break; case 'routable': - $matches = $this->isRoutable() === (bool)$value; + $matches = $test->isRoutable() === (bool)$value; break; case 'published': - $matches = $this->isPublished() === (bool)$value; + $matches = $test->isPublished() === (bool)$value; break; case 'visible': - $matches = $this->isVisible() === (bool)$value; + $matches = $test->isVisible() === (bool)$value; break; case 'module': - $matches = $this->isModule() === (bool)$value; + $matches = $test->isModule() === (bool)$value; break; case 'page': - $matches = $this->isPage() === (bool)$value; + $matches = $test->isPage() === (bool)$value; break; case 'folder': - $matches = $this->isPage() === !$value; + $matches = $test->isPage() === !$value; break; case 'translated': - $matches = $this->hasTranslation() === (bool)$value; + $matches = $test->hasTranslation() === (bool)$value; break; default: $matches = true; diff --git a/system/src/Grav/Common/Flex/Types/Pages/Storage/PageStorage.php b/system/src/Grav/Common/Flex/Types/Pages/Storage/PageStorage.php index f590e36..136a64a 100644 --- a/system/src/Grav/Common/Flex/Types/Pages/Storage/PageStorage.php +++ b/system/src/Grav/Common/Flex/Types/Pages/Storage/PageStorage.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/Types/Pages/Traits/PageContentTrait.php b/system/src/Grav/Common/Flex/Types/Pages/Traits/PageContentTrait.php index 9a2c7c3..355c583 100644 --- a/system/src/Grav/Common/Flex/Types/Pages/Traits/PageContentTrait.php +++ b/system/src/Grav/Common/Flex/Types/Pages/Traits/PageContentTrait.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/Types/Pages/Traits/PageLegacyTrait.php b/system/src/Grav/Common/Flex/Types/Pages/Traits/PageLegacyTrait.php index 98f3949..bb8e728 100644 --- a/system/src/Grav/Common/Flex/Types/Pages/Traits/PageLegacyTrait.php +++ b/system/src/Grav/Common/Flex/Types/Pages/Traits/PageLegacyTrait.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/Types/Pages/Traits/PageRoutableTrait.php b/system/src/Grav/Common/Flex/Types/Pages/Traits/PageRoutableTrait.php index ace74dc..1608ee3 100644 --- a/system/src/Grav/Common/Flex/Types/Pages/Traits/PageRoutableTrait.php +++ b/system/src/Grav/Common/Flex/Types/Pages/Traits/PageRoutableTrait.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/Types/Pages/Traits/PageTranslateTrait.php b/system/src/Grav/Common/Flex/Types/Pages/Traits/PageTranslateTrait.php index a30ae1a..6f1b943 100644 --- a/system/src/Grav/Common/Flex/Types/Pages/Traits/PageTranslateTrait.php +++ b/system/src/Grav/Common/Flex/Types/Pages/Traits/PageTranslateTrait.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/Types/UserGroups/UserGroupCollection.php b/system/src/Grav/Common/Flex/Types/UserGroups/UserGroupCollection.php index 3a91d77..d322581 100644 --- a/system/src/Grav/Common/Flex/Types/UserGroups/UserGroupCollection.php +++ b/system/src/Grav/Common/Flex/Types/UserGroups/UserGroupCollection.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/Types/UserGroups/UserGroupIndex.php b/system/src/Grav/Common/Flex/Types/UserGroups/UserGroupIndex.php index 66de52e..1d75d0b 100644 --- a/system/src/Grav/Common/Flex/Types/UserGroups/UserGroupIndex.php +++ b/system/src/Grav/Common/Flex/Types/UserGroups/UserGroupIndex.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/Types/UserGroups/UserGroupObject.php b/system/src/Grav/Common/Flex/Types/UserGroups/UserGroupObject.php index 4a59d52..d1e4c40 100644 --- a/system/src/Grav/Common/Flex/Types/UserGroups/UserGroupObject.php +++ b/system/src/Grav/Common/Flex/Types/UserGroups/UserGroupObject.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/Types/Users/Storage/UserFileStorage.php b/system/src/Grav/Common/Flex/Types/Users/Storage/UserFileStorage.php index 664f24f..d8b4914 100644 --- a/system/src/Grav/Common/Flex/Types/Users/Storage/UserFileStorage.php +++ b/system/src/Grav/Common/Flex/Types/Users/Storage/UserFileStorage.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/Types/Users/Storage/UserFolderStorage.php b/system/src/Grav/Common/Flex/Types/Users/Storage/UserFolderStorage.php index a037f0e..774fa96 100644 --- a/system/src/Grav/Common/Flex/Types/Users/Storage/UserFolderStorage.php +++ b/system/src/Grav/Common/Flex/Types/Users/Storage/UserFolderStorage.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/Types/Users/Traits/UserObjectLegacyTrait.php b/system/src/Grav/Common/Flex/Types/Users/Traits/UserObjectLegacyTrait.php index 07acf66..813e13c 100644 --- a/system/src/Grav/Common/Flex/Types/Users/Traits/UserObjectLegacyTrait.php +++ b/system/src/Grav/Common/Flex/Types/Users/Traits/UserObjectLegacyTrait.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/Types/Users/UserCollection.php b/system/src/Grav/Common/Flex/Types/Users/UserCollection.php index f5641e7..5fb4641 100644 --- a/system/src/Grav/Common/Flex/Types/Users/UserCollection.php +++ b/system/src/Grav/Common/Flex/Types/Users/UserCollection.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Flex/Types/Users/UserIndex.php b/system/src/Grav/Common/Flex/Types/Users/UserIndex.php index 4a33b73..cc1a705 100644 --- a/system/src/Grav/Common/Flex/Types/Users/UserIndex.php +++ b/system/src/Grav/Common/Flex/Types/Users/UserIndex.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -30,7 +30,7 @@ use function is_string; */ class UserIndex extends FlexIndex implements UserCollectionInterface { - public const VERSION = parent::VERSION . '.1'; + public const VERSION = parent::VERSION . '.2'; /** * @param FlexStorageInterface $storage @@ -50,7 +50,7 @@ class UserIndex extends FlexIndex implements UserCollectionInterface // return $index['index']; //} - // Load up to date index. + // Load up-to-date index. $entries = parent::loadEntriesFromStorage($storage); return static::updateIndexFile($storage, $index['index'], $entries, ['force_update' => $force]); @@ -142,9 +142,11 @@ class UserIndex extends FlexIndex implements UserCollectionInterface } elseif ($field === 'flex_key') { $user = $this->withKeyField('flex_key')->get($query); } elseif ($field === 'email') { - $user = $this->withKeyField('email')->get($query); + $email = mb_strtolower($query); + $user = $this->withKeyField('email')->get($email); } elseif ($field === 'username') { - $user = $this->get(static::filterUsername($query, $this->getFlexDirectory()->getStorage())); + $username = static::filterUsername($query, $this->getFlexDirectory()->getStorage()); + $user = $this->get($username); } else { $user = $this->__call('find', [$query, $field]); } diff --git a/system/src/Grav/Common/Flex/Types/Users/UserObject.php b/system/src/Grav/Common/Flex/Types/Users/UserObject.php index 9dec972..39f47e7 100644 --- a/system/src/Grav/Common/Flex/Types/Users/UserObject.php +++ b/system/src/Grav/Common/Flex/Types/Users/UserObject.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -31,6 +31,7 @@ use Grav\Common\Flex\Types\UserGroups\UserGroupIndex; use Grav\Common\User\Interfaces\UserInterface; use Grav\Common\User\Traits\UserTrait; use Grav\Common\Utils; +use Grav\Framework\Contracts\Relationships\ToOneRelationshipInterface; use Grav\Framework\File\Formatter\JsonFormatter; use Grav\Framework\File\Formatter\YamlFormatter; use Grav\Framework\Filesystem\Filesystem; @@ -38,7 +39,10 @@ use Grav\Framework\Flex\Flex; use Grav\Framework\Flex\FlexDirectory; use Grav\Framework\Flex\Storage\FileStorage; use Grav\Framework\Flex\Traits\FlexMediaTrait; +use Grav\Framework\Flex\Traits\FlexRelationshipsTrait; use Grav\Framework\Form\FormFlashFile; +use Grav\Framework\Media\MediaIdentifier; +use Grav\Framework\Media\UploadedMediaObject; use Psr\Http\Message\UploadedFileInterface; use RocketTheme\Toolbox\Event\Event; use RocketTheme\Toolbox\File\FileInterface; @@ -77,6 +81,7 @@ class UserObject extends FlexObject implements UserInterface, Countable } use UserTrait; use UserObjectLegacyTrait; + use FlexRelationshipsTrait; /** @var Closure|null */ static public $authorizeCallable; @@ -672,6 +677,81 @@ class UserObject extends FlexObject implements UserInterface, Countable return $folder; } + /** + * @param string $name + * @return array|object|null + * @internal + */ + public function initRelationship(string $name) + { + switch ($name) { + case 'media': + $list = []; + foreach ($this->getMedia()->all() as $filename => $object) { + $list[] = $this->buildMediaObject(null, $filename, $object); + } + + return $list; + case 'avatar': + return $this->buildMediaObject('avatar', basename($this->getAvatarUrl()), $this->getAvatarImage()); + } + + throw new \InvalidArgumentException(sprintf('%s: Relationship %s does not exist', $this->getFlexType(), $name)); + } + + /** + * @return bool Return true if relationships were updated. + */ + protected function updateRelationships(): bool + { + $modified = $this->getRelationships()->getModified(); + if ($modified) { + foreach ($modified as $relationship) { + $name = $relationship->getName(); + switch ($name) { + case 'avatar': + \assert($relationship instanceof ToOneRelationshipInterface); + $this->updateAvatarRelationship($relationship); + break; + default: + throw new \InvalidArgumentException(sprintf('%s: Relationship %s cannot be modified', $this->getFlexType(), $name), 400); + } + } + + $this->resetRelationships(); + + return true; + } + + return false; + } + + /** + * @param ToOneRelationshipInterface $relationship + */ + protected function updateAvatarRelationship(ToOneRelationshipInterface $relationship): void + { + $files = []; + $avatar = $this->getAvatarImage(); + if ($avatar) { + $files['avatar'][$avatar->filename] = null; + } + + $identifier = $relationship->getIdentifier(); + if ($identifier) { + \assert($identifier instanceof MediaIdentifier); + $object = $identifier->getObject(); + if ($object instanceof UploadedMediaObject) { + $uploadedFile = $object->getUploadedFile(); + if ($uploadedFile) { + $files['avatar'][$uploadedFile->getClientFilename()] = $uploadedFile; + } + } + } + + $this->update([], $files); + } + /** * @param string $name * @return Blueprint diff --git a/system/src/Grav/Common/Form/FormFlash.php b/system/src/Grav/Common/Form/FormFlash.php index 7acaf7f..f77a7e4 100644 --- a/system/src/Grav/Common/Form/FormFlash.php +++ b/system/src/Grav/Common/Form/FormFlash.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Form * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/AbstractCollection.php b/system/src/Grav/Common/GPM/AbstractCollection.php index 91fa69e..bff3c56 100644 --- a/system/src/Grav/Common/GPM/AbstractCollection.php +++ b/system/src/Grav/Common/GPM/AbstractCollection.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\GPM * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Common/AbstractPackageCollection.php b/system/src/Grav/Common/GPM/Common/AbstractPackageCollection.php index 7b918e0..9559358 100644 --- a/system/src/Grav/Common/GPM/Common/AbstractPackageCollection.php +++ b/system/src/Grav/Common/GPM/Common/AbstractPackageCollection.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\GPM * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Common/CachedCollection.php b/system/src/Grav/Common/GPM/Common/CachedCollection.php index c3b62e5..cd71ce2 100644 --- a/system/src/Grav/Common/GPM/Common/CachedCollection.php +++ b/system/src/Grav/Common/GPM/Common/CachedCollection.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\GPM * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Common/Package.php b/system/src/Grav/Common/GPM/Common/Package.php index 5d96011..cf5a804 100644 --- a/system/src/Grav/Common/GPM/Common/Package.php +++ b/system/src/Grav/Common/GPM/Common/Package.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\GPM * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/GPM.php b/system/src/Grav/Common/GPM/GPM.php index 7031945..60c927a 100644 --- a/system/src/Grav/Common/GPM/GPM.php +++ b/system/src/Grav/Common/GPM/GPM.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\GPM * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -12,6 +12,7 @@ namespace Grav\Common\GPM; use Exception; use Grav\Common\Grav; use Grav\Common\Filesystem\Folder; +use Grav\Common\HTTP\Response; use Grav\Common\Inflector; use Grav\Common\Iterator; use Grav\Common\Utils; diff --git a/system/src/Grav/Common/GPM/Installer.php b/system/src/Grav/Common/GPM/Installer.php index 8a1a530..71f9bd8 100644 --- a/system/src/Grav/Common/GPM/Installer.php +++ b/system/src/Grav/Common/GPM/Installer.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\GPM * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Licenses.php b/system/src/Grav/Common/GPM/Licenses.php index e932bd4..b62fee5 100644 --- a/system/src/Grav/Common/GPM/Licenses.php +++ b/system/src/Grav/Common/GPM/Licenses.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\GPM * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Local/AbstractPackageCollection.php b/system/src/Grav/Common/GPM/Local/AbstractPackageCollection.php index bc7ceab..83ba3e9 100644 --- a/system/src/Grav/Common/GPM/Local/AbstractPackageCollection.php +++ b/system/src/Grav/Common/GPM/Local/AbstractPackageCollection.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\GPM * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Local/Package.php b/system/src/Grav/Common/GPM/Local/Package.php index 08444a7..87a422d 100644 --- a/system/src/Grav/Common/GPM/Local/Package.php +++ b/system/src/Grav/Common/GPM/Local/Package.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\GPM * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Local/Packages.php b/system/src/Grav/Common/GPM/Local/Packages.php index b63b93b..4a1de0b 100644 --- a/system/src/Grav/Common/GPM/Local/Packages.php +++ b/system/src/Grav/Common/GPM/Local/Packages.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\GPM * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Local/Plugins.php b/system/src/Grav/Common/GPM/Local/Plugins.php index a1626f8..5d4eade 100644 --- a/system/src/Grav/Common/GPM/Local/Plugins.php +++ b/system/src/Grav/Common/GPM/Local/Plugins.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\GPM * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Local/Themes.php b/system/src/Grav/Common/GPM/Local/Themes.php index d153794..3780dbd 100644 --- a/system/src/Grav/Common/GPM/Local/Themes.php +++ b/system/src/Grav/Common/GPM/Local/Themes.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\GPM * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Remote/AbstractPackageCollection.php b/system/src/Grav/Common/GPM/Remote/AbstractPackageCollection.php index 02e98e7..31b1676 100644 --- a/system/src/Grav/Common/GPM/Remote/AbstractPackageCollection.php +++ b/system/src/Grav/Common/GPM/Remote/AbstractPackageCollection.php @@ -3,15 +3,15 @@ /** * @package Grav\Common\GPM * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ namespace Grav\Common\GPM\Remote; use Grav\Common\Grav; +use Grav\Common\HTTP\Response; use Grav\Common\GPM\Common\AbstractPackageCollection as BaseCollection; -use Grav\Common\GPM\Response; use \Doctrine\Common\Cache\FilesystemCache; use RuntimeException; diff --git a/system/src/Grav/Common/GPM/Remote/GravCore.php b/system/src/Grav/Common/GPM/Remote/GravCore.php index 2998975..efe1199 100644 --- a/system/src/Grav/Common/GPM/Remote/GravCore.php +++ b/system/src/Grav/Common/GPM/Remote/GravCore.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\GPM * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Remote/Package.php b/system/src/Grav/Common/GPM/Remote/Package.php index 5193255..6db3477 100644 --- a/system/src/Grav/Common/GPM/Remote/Package.php +++ b/system/src/Grav/Common/GPM/Remote/Package.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\GPM * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Remote/Packages.php b/system/src/Grav/Common/GPM/Remote/Packages.php index 0ac2ef9..82acc80 100644 --- a/system/src/Grav/Common/GPM/Remote/Packages.php +++ b/system/src/Grav/Common/GPM/Remote/Packages.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\GPM * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Remote/Plugins.php b/system/src/Grav/Common/GPM/Remote/Plugins.php index 8383cd7..6451c80 100644 --- a/system/src/Grav/Common/GPM/Remote/Plugins.php +++ b/system/src/Grav/Common/GPM/Remote/Plugins.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\GPM * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Remote/Themes.php b/system/src/Grav/Common/GPM/Remote/Themes.php index a8ee9fa..63663c5 100644 --- a/system/src/Grav/Common/GPM/Remote/Themes.php +++ b/system/src/Grav/Common/GPM/Remote/Themes.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\GPM * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Upgrader.php b/system/src/Grav/Common/GPM/Upgrader.php index b3e6869..5f25594 100644 --- a/system/src/Grav/Common/GPM/Upgrader.php +++ b/system/src/Grav/Common/GPM/Upgrader.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\GPM * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Getters.php b/system/src/Grav/Common/Getters.php index ed03499..73e3997 100644 --- a/system/src/Grav/Common/Getters.php +++ b/system/src/Grav/Common/Getters.php @@ -3,7 +3,7 @@ /** * @package Grav\Common * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Grav.php b/system/src/Grav/Common/Grav.php index b9b44a4..ccdcaa0 100644 --- a/system/src/Grav/Common/Grav.php +++ b/system/src/Grav/Common/Grav.php @@ -3,7 +3,7 @@ /** * @package Grav\Common * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -48,6 +48,7 @@ use Grav\Common\Service\TaskServiceProvider; use Grav\Common\Twig\Twig; use Grav\Framework\DI\Container; use Grav\Framework\Psr7\Response; +use Grav\Framework\RequestHandler\Middlewares\MultipartRequestSupport; use Grav\Framework\RequestHandler\RequestHandler; use Grav\Framework\Route\Route; use Grav\Framework\Session\Messages; @@ -117,6 +118,7 @@ class Grav extends Container * @var array All middleware processors that are processed in $this->process() */ protected $middleware = [ + 'multipartRequestSupport', 'initializeProcessor', 'pluginsProcessor', 'themesProcessor', @@ -259,6 +261,9 @@ class Grav extends Container $container = new Container( [ + 'multipartRequestSupport' => function () { + return new MultipartRequestSupport(); + }, 'initializeProcessor' => function () { return new InitializeProcessor($this); }, @@ -341,6 +346,23 @@ class Grav extends Container } } + /** + * Clean any output buffers. Useful when exiting from the application. + * + * Please use $grav->close() and $grav->redirect() instead of calling this one! + * + * @return void + */ + public function cleanOutputBuffers(): void + { + // Make sure nothing extra gets written to the response. + while (ob_get_level()) { + ob_end_clean(); + } + // Work around PHP bug #8218 (8.0.17 & 8.1.4). + header_remove('Content-Encoding'); + } + /** * Terminates Grav request with a response. * @@ -351,10 +373,7 @@ class Grav extends Container */ public function close(ResponseInterface $response): void { - // Make sure nothing extra gets written to the response. - while (ob_get_level()) { - ob_end_clean(); - } + $this->cleanOutputBuffers(); // Close the session. if (isset($this['session'])) { @@ -400,7 +419,7 @@ class Grav extends Container /** * @param ResponseInterface $response * @return never-return - * @deprecated 1.7 Do not use + * @deprecated 1.7 Use $grav->close() instead. */ public function exit(ResponseInterface $response): void { diff --git a/system/src/Grav/Common/GravTrait.php b/system/src/Grav/Common/GravTrait.php index 5416286..9eedd9c 100644 --- a/system/src/Grav/Common/GravTrait.php +++ b/system/src/Grav/Common/GravTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Common * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/HTTP/Client.php b/system/src/Grav/Common/HTTP/Client.php index c85d6b2..a90dd36 100644 --- a/system/src/Grav/Common/HTTP/Client.php +++ b/system/src/Grav/Common/HTTP/Client.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\HTTP * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/HTTP/Response.php b/system/src/Grav/Common/HTTP/Response.php index 4a5bc8b..77ca36f 100644 --- a/system/src/Grav/Common/HTTP/Response.php +++ b/system/src/Grav/Common/HTTP/Response.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\HTTP * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Helpers/Base32.php b/system/src/Grav/Common/Helpers/Base32.php index 0d1c21a..246458f 100644 --- a/system/src/Grav/Common/Helpers/Base32.php +++ b/system/src/Grav/Common/Helpers/Base32.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Helpers * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Helpers/Excerpts.php b/system/src/Grav/Common/Helpers/Excerpts.php index a62c7e5..ee2a2ec 100644 --- a/system/src/Grav/Common/Helpers/Excerpts.php +++ b/system/src/Grav/Common/Helpers/Excerpts.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Helpers * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Helpers/Exif.php b/system/src/Grav/Common/Helpers/Exif.php index a7dc973..1859d6f 100644 --- a/system/src/Grav/Common/Helpers/Exif.php +++ b/system/src/Grav/Common/Helpers/Exif.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Helpers * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Helpers/LogViewer.php b/system/src/Grav/Common/Helpers/LogViewer.php index cf5ffe9..060e561 100644 --- a/system/src/Grav/Common/Helpers/LogViewer.php +++ b/system/src/Grav/Common/Helpers/LogViewer.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Helpers * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Helpers/Truncator.php b/system/src/Grav/Common/Helpers/Truncator.php index 03c3eea..318079c 100644 --- a/system/src/Grav/Common/Helpers/Truncator.php +++ b/system/src/Grav/Common/Helpers/Truncator.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Helpers * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Helpers/YamlLinter.php b/system/src/Grav/Common/Helpers/YamlLinter.php index b31180f..4460fd4 100644 --- a/system/src/Grav/Common/Helpers/YamlLinter.php +++ b/system/src/Grav/Common/Helpers/YamlLinter.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Helpers * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Inflector.php b/system/src/Grav/Common/Inflector.php index 216b733..03e22ac 100644 --- a/system/src/Grav/Common/Inflector.php +++ b/system/src/Grav/Common/Inflector.php @@ -3,7 +3,7 @@ /** * @package Grav\Common * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Iterator.php b/system/src/Grav/Common/Iterator.php index 5db7bd0..20e719e 100644 --- a/system/src/Grav/Common/Iterator.php +++ b/system/src/Grav/Common/Iterator.php @@ -3,7 +3,7 @@ /** * @package Grav\Common * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Language/Language.php b/system/src/Grav/Common/Language/Language.php index fe006ed..bfeca42 100644 --- a/system/src/Grav/Common/Language/Language.php +++ b/system/src/Grav/Common/Language/Language.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Language * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Language/LanguageCodes.php b/system/src/Grav/Common/Language/LanguageCodes.php index 3fa4948..24ecdd6 100644 --- a/system/src/Grav/Common/Language/LanguageCodes.php +++ b/system/src/Grav/Common/Language/LanguageCodes.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Language * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -153,6 +153,8 @@ class LanguageCodes 'vi' => [ 'name' => 'Vietnamese', 'nativeName' => 'Tiếng Việt' ], 'wo' => [ 'name' => 'Wolof', 'nativeName' => 'Wolof' ], 'xh' => [ 'name' => 'Xhosa', 'nativeName' => 'isiXhosa' ], + 'yi' => [ 'name' => 'Yiddish', 'nativeName' => 'ייִדיש', 'orientation' => 'rtl' ], + 'ydd' => [ 'name' => 'Yiddish', 'nativeName' => 'ייִדיש', 'orientation' => 'rtl' ], 'zh' => [ 'name' => 'Chinese (Simplified)', 'nativeName' => '中文 (简体)' ], 'zh-CN' => [ 'name' => 'Chinese (Simplified)', 'nativeName' => '中文 (简体)' ], 'zh-TW' => [ 'name' => 'Chinese (Traditional)', 'nativeName' => '正體中文 (繁體)' ], diff --git a/system/src/Grav/Common/Markdown/Parsedown.php b/system/src/Grav/Common/Markdown/Parsedown.php index f0d8a48..634a174 100644 --- a/system/src/Grav/Common/Markdown/Parsedown.php +++ b/system/src/Grav/Common/Markdown/Parsedown.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Markdown * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Markdown/ParsedownExtra.php b/system/src/Grav/Common/Markdown/ParsedownExtra.php index ef450fe..0081372 100644 --- a/system/src/Grav/Common/Markdown/ParsedownExtra.php +++ b/system/src/Grav/Common/Markdown/ParsedownExtra.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Markdown * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php index a593dd7..b97b129 100644 --- a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php +++ b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Markdown * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Media/Interfaces/AudioMediaInterface.php b/system/src/Grav/Common/Media/Interfaces/AudioMediaInterface.php index 6465d6b..a57762f 100644 --- a/system/src/Grav/Common/Media/Interfaces/AudioMediaInterface.php +++ b/system/src/Grav/Common/Media/Interfaces/AudioMediaInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Media/Interfaces/ImageManipulateInterface.php b/system/src/Grav/Common/Media/Interfaces/ImageManipulateInterface.php index eb38ea8..8ad545f 100644 --- a/system/src/Grav/Common/Media/Interfaces/ImageManipulateInterface.php +++ b/system/src/Grav/Common/Media/Interfaces/ImageManipulateInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Media/Interfaces/ImageMediaInterface.php b/system/src/Grav/Common/Media/Interfaces/ImageMediaInterface.php index cbf8f1d..a8b7159 100644 --- a/system/src/Grav/Common/Media/Interfaces/ImageMediaInterface.php +++ b/system/src/Grav/Common/Media/Interfaces/ImageMediaInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Media/Interfaces/MediaCollectionInterface.php b/system/src/Grav/Common/Media/Interfaces/MediaCollectionInterface.php index 62c531c..92ef972 100644 --- a/system/src/Grav/Common/Media/Interfaces/MediaCollectionInterface.php +++ b/system/src/Grav/Common/Media/Interfaces/MediaCollectionInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Media/Interfaces/MediaFileInterface.php b/system/src/Grav/Common/Media/Interfaces/MediaFileInterface.php index c20e4de..39fbb9f 100644 --- a/system/src/Grav/Common/Media/Interfaces/MediaFileInterface.php +++ b/system/src/Grav/Common/Media/Interfaces/MediaFileInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Media/Interfaces/MediaInterface.php b/system/src/Grav/Common/Media/Interfaces/MediaInterface.php index 273556a..ffa0008 100644 --- a/system/src/Grav/Common/Media/Interfaces/MediaInterface.php +++ b/system/src/Grav/Common/Media/Interfaces/MediaInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Media/Interfaces/MediaLinkInterface.php b/system/src/Grav/Common/Media/Interfaces/MediaLinkInterface.php index 41747be..25a6f16 100644 --- a/system/src/Grav/Common/Media/Interfaces/MediaLinkInterface.php +++ b/system/src/Grav/Common/Media/Interfaces/MediaLinkInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Media/Interfaces/MediaObjectInterface.php b/system/src/Grav/Common/Media/Interfaces/MediaObjectInterface.php index 9334759..aefe046 100644 --- a/system/src/Grav/Common/Media/Interfaces/MediaObjectInterface.php +++ b/system/src/Grav/Common/Media/Interfaces/MediaObjectInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -158,14 +158,6 @@ interface MediaObjectInterface extends \Grav\Framework\Media\Interfaces\MediaObj */ public function thumbnail($type = 'auto'); - /** - * Return URL to file. - * - * @param bool $reset - * @return string - */ - public function url($reset = true); - /** * Turn the current Medium into a Link * @@ -221,18 +213,6 @@ interface MediaObjectInterface extends \Grav\Framework\Media\Interfaces\MediaObj #[\ReturnTypeWillChange] public function __call($method, $args); - /** - * Get value by using dot notation for nested arrays/objects. - * - * @example $value = $this->get('this.is.my.nested.variable'); - * - * @param string $name Dot separated path to the requested value. - * @param mixed $default Default value (or null). - * @param string|null $separator Separator, defaults to '.' - * @return mixed Value. - */ - public function get($name, $default = null, $separator = null); - /** * Set value by using dot notation for nested arrays/objects. * diff --git a/system/src/Grav/Common/Media/Interfaces/MediaPlayerInterface.php b/system/src/Grav/Common/Media/Interfaces/MediaPlayerInterface.php index fbe6f65..a41811b 100644 --- a/system/src/Grav/Common/Media/Interfaces/MediaPlayerInterface.php +++ b/system/src/Grav/Common/Media/Interfaces/MediaPlayerInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Media/Interfaces/MediaUploadInterface.php b/system/src/Grav/Common/Media/Interfaces/MediaUploadInterface.php index 7362599..26efc33 100644 --- a/system/src/Grav/Common/Media/Interfaces/MediaUploadInterface.php +++ b/system/src/Grav/Common/Media/Interfaces/MediaUploadInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Media/Interfaces/VideoMediaInterface.php b/system/src/Grav/Common/Media/Interfaces/VideoMediaInterface.php index 6d42fef..0673eb4 100644 --- a/system/src/Grav/Common/Media/Interfaces/VideoMediaInterface.php +++ b/system/src/Grav/Common/Media/Interfaces/VideoMediaInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Media/Traits/AudioMediaTrait.php b/system/src/Grav/Common/Media/Traits/AudioMediaTrait.php index a083472..7e95656 100644 --- a/system/src/Grav/Common/Media/Traits/AudioMediaTrait.php +++ b/system/src/Grav/Common/Media/Traits/AudioMediaTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Media/Traits/ImageLoadingTrait.php b/system/src/Grav/Common/Media/Traits/ImageLoadingTrait.php index 75e23ca..c79efaf 100644 --- a/system/src/Grav/Common/Media/Traits/ImageLoadingTrait.php +++ b/system/src/Grav/Common/Media/Traits/ImageLoadingTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Media/Traits/ImageMediaTrait.php b/system/src/Grav/Common/Media/Traits/ImageMediaTrait.php index c1c46dc..9a0ad82 100644 --- a/system/src/Grav/Common/Media/Traits/ImageMediaTrait.php +++ b/system/src/Grav/Common/Media/Traits/ImageMediaTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Media/Traits/MediaFileTrait.php b/system/src/Grav/Common/Media/Traits/MediaFileTrait.php index 63906fc..2691e2a 100644 --- a/system/src/Grav/Common/Media/Traits/MediaFileTrait.php +++ b/system/src/Grav/Common/Media/Traits/MediaFileTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Media/Traits/MediaObjectTrait.php b/system/src/Grav/Common/Media/Traits/MediaObjectTrait.php index 85ed6d2..fd0994e 100644 --- a/system/src/Grav/Common/Media/Traits/MediaObjectTrait.php +++ b/system/src/Grav/Common/Media/Traits/MediaObjectTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Media/Traits/MediaPlayerTrait.php b/system/src/Grav/Common/Media/Traits/MediaPlayerTrait.php index 7e59d64..0fcb733 100644 --- a/system/src/Grav/Common/Media/Traits/MediaPlayerTrait.php +++ b/system/src/Grav/Common/Media/Traits/MediaPlayerTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Media/Traits/MediaTrait.php b/system/src/Grav/Common/Media/Traits/MediaTrait.php index 14bfa90..1ab4f1e 100644 --- a/system/src/Grav/Common/Media/Traits/MediaTrait.php +++ b/system/src/Grav/Common/Media/Traits/MediaTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Media/Traits/MediaUploadTrait.php b/system/src/Grav/Common/Media/Traits/MediaUploadTrait.php index 88591f6..46eadea 100644 --- a/system/src/Grav/Common/Media/Traits/MediaUploadTrait.php +++ b/system/src/Grav/Common/Media/Traits/MediaUploadTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Media/Traits/StaticResizeTrait.php b/system/src/Grav/Common/Media/Traits/StaticResizeTrait.php index d8a4b08..1065f9d 100644 --- a/system/src/Grav/Common/Media/Traits/StaticResizeTrait.php +++ b/system/src/Grav/Common/Media/Traits/StaticResizeTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Media/Traits/ThumbnailMediaTrait.php b/system/src/Grav/Common/Media/Traits/ThumbnailMediaTrait.php index 100b532..a86a4b0 100644 --- a/system/src/Grav/Common/Media/Traits/ThumbnailMediaTrait.php +++ b/system/src/Grav/Common/Media/Traits/ThumbnailMediaTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Media/Traits/VideoMediaTrait.php b/system/src/Grav/Common/Media/Traits/VideoMediaTrait.php index 07f0c3f..ddb3cf0 100644 --- a/system/src/Grav/Common/Media/Traits/VideoMediaTrait.php +++ b/system/src/Grav/Common/Media/Traits/VideoMediaTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Collection.php b/system/src/Grav/Common/Page/Collection.php index 987b8d9..b025d5f 100644 --- a/system/src/Grav/Common/Page/Collection.php +++ b/system/src/Grav/Common/Page/Collection.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Header.php b/system/src/Grav/Common/Page/Header.php index c18b58d..50b284b 100644 --- a/system/src/Grav/Common/Page/Header.php +++ b/system/src/Grav/Common/Page/Header.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Interfaces/PageCollectionInterface.php b/system/src/Grav/Common/Page/Interfaces/PageCollectionInterface.php index 493ab43..6518401 100644 --- a/system/src/Grav/Common/Page/Interfaces/PageCollectionInterface.php +++ b/system/src/Grav/Common/Page/Interfaces/PageCollectionInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Interfaces/PageContentInterface.php b/system/src/Grav/Common/Page/Interfaces/PageContentInterface.php index a80972b..a37fcef 100644 --- a/system/src/Grav/Common/Page/Interfaces/PageContentInterface.php +++ b/system/src/Grav/Common/Page/Interfaces/PageContentInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Interfaces/PageInterface.php b/system/src/Grav/Common/Page/Interfaces/PageInterface.php index 56fc891..c7ea047 100644 --- a/system/src/Grav/Common/Page/Interfaces/PageInterface.php +++ b/system/src/Grav/Common/Page/Interfaces/PageInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Interfaces/PagesSourceInterface.php b/system/src/Grav/Common/Page/Interfaces/PagesSourceInterface.php index ff4ebda..adaee6b 100644 --- a/system/src/Grav/Common/Page/Interfaces/PagesSourceInterface.php +++ b/system/src/Grav/Common/Page/Interfaces/PagesSourceInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Markdown/Excerpts.php b/system/src/Grav/Common/Page/Markdown/Excerpts.php index 17f9cbf..ab3a905 100644 --- a/system/src/Grav/Common/Page/Markdown/Excerpts.php +++ b/system/src/Grav/Common/Page/Markdown/Excerpts.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Media.php b/system/src/Grav/Common/Page/Media.php index 6c0a6c3..e79cd94 100644 --- a/system/src/Grav/Common/Page/Media.php +++ b/system/src/Grav/Common/Page/Media.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -152,7 +152,7 @@ class Media extends AbstractMedia foreach ($iterator as $file => $info) { // Ignore folders and Markdown files. $filename = $info->getFilename(); - if (!$info->isFile() || $info->getExtension() === 'md' || $filename === 'frontmatter.yaml' || strpos($filename, '.') === 0) { + if (!$info->isFile() || $info->getExtension() === 'md' || $filename === 'frontmatter.yaml' || $filename === 'media.json' || strpos($filename, '.') === 0) { continue; } diff --git a/system/src/Grav/Common/Page/Medium/AbstractMedia.php b/system/src/Grav/Common/Page/Medium/AbstractMedia.php index 9b3650b..4ba9ff8 100644 --- a/system/src/Grav/Common/Page/Medium/AbstractMedia.php +++ b/system/src/Grav/Common/Page/Medium/AbstractMedia.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/AudioMedium.php b/system/src/Grav/Common/Page/Medium/AudioMedium.php index cc53f81..f37c651 100644 --- a/system/src/Grav/Common/Page/Medium/AudioMedium.php +++ b/system/src/Grav/Common/Page/Medium/AudioMedium.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/GlobalMedia.php b/system/src/Grav/Common/Page/Medium/GlobalMedia.php index 20f63ad..ee694e7 100644 --- a/system/src/Grav/Common/Page/Medium/GlobalMedia.php +++ b/system/src/Grav/Common/Page/Medium/GlobalMedia.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/ImageFile.php b/system/src/Grav/Common/Page/Medium/ImageFile.php index 1aae7ee..66b601b 100644 --- a/system/src/Grav/Common/Page/Medium/ImageFile.php +++ b/system/src/Grav/Common/Page/Medium/ImageFile.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/ImageMedium.php b/system/src/Grav/Common/Page/Medium/ImageMedium.php index 42d8f0e..d215465 100644 --- a/system/src/Grav/Common/Page/Medium/ImageMedium.php +++ b/system/src/Grav/Common/Page/Medium/ImageMedium.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -361,8 +361,8 @@ class ImageMedium extends Medium implements ImageMediaInterface, ImageManipulate // Scaling operations $scale = ($scale ?? $config->get('system.images.watermark.scale', 100)) / 100; - $wwidth = $this->get('width') * $scale; - $wheight = $this->get('height') * $scale; + $wwidth = (int)$this->get('width') * $scale; + $wheight = (int)$this->get('height') * $scale; $watermark->resize($wwidth, $wheight); // Position operations @@ -377,11 +377,11 @@ class ImageMedium extends Medium implements ImageMediaInterface, ImageManipulate break; case 'bottom': - $positionY = $this->get('height')-$wheight; + $positionY = (int)$this->get('height')-$wheight; break; case 'center': - $positionY = ($this->get('height')/2) - ($wheight/2); + $positionY = ((int)$this->get('height')/2) - ($wheight/2); break; } @@ -392,11 +392,11 @@ class ImageMedium extends Medium implements ImageMediaInterface, ImageManipulate break; case 'right': - $positionX = $this->get('width')-$wwidth; + $positionX = (int)$this->get('width')-$wwidth; break; case 'center': - $positionX = ($this->get('width')/2) - ($wwidth/2); + $positionX = ((int)$this->get('width')/2) - ($wwidth/2); break; } diff --git a/system/src/Grav/Common/Page/Medium/Link.php b/system/src/Grav/Common/Page/Medium/Link.php index c76d8c1..01d3c13 100644 --- a/system/src/Grav/Common/Page/Medium/Link.php +++ b/system/src/Grav/Common/Page/Medium/Link.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/Medium.php b/system/src/Grav/Common/Page/Medium/Medium.php index 0891c0c..4f089d1 100644 --- a/system/src/Grav/Common/Page/Medium/Medium.php +++ b/system/src/Grav/Common/Page/Medium/Medium.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/MediumFactory.php b/system/src/Grav/Common/Page/Medium/MediumFactory.php index 913f198..9001515 100644 --- a/system/src/Grav/Common/Page/Medium/MediumFactory.php +++ b/system/src/Grav/Common/Page/Medium/MediumFactory.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/ParsedownHtmlTrait.php b/system/src/Grav/Common/Page/Medium/ParsedownHtmlTrait.php index 4ab2fb5..b817328 100644 --- a/system/src/Grav/Common/Page/Medium/ParsedownHtmlTrait.php +++ b/system/src/Grav/Common/Page/Medium/ParsedownHtmlTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/RenderableInterface.php b/system/src/Grav/Common/Page/Medium/RenderableInterface.php index 1ee6a96..4c2046f 100644 --- a/system/src/Grav/Common/Page/Medium/RenderableInterface.php +++ b/system/src/Grav/Common/Page/Medium/RenderableInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/StaticImageMedium.php b/system/src/Grav/Common/Page/Medium/StaticImageMedium.php index 9780100..a01cd18 100644 --- a/system/src/Grav/Common/Page/Medium/StaticImageMedium.php +++ b/system/src/Grav/Common/Page/Medium/StaticImageMedium.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/StaticResizeTrait.php b/system/src/Grav/Common/Page/Medium/StaticResizeTrait.php index caaa7e2..3c14495 100644 --- a/system/src/Grav/Common/Page/Medium/StaticResizeTrait.php +++ b/system/src/Grav/Common/Page/Medium/StaticResizeTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/ThumbnailImageMedium.php b/system/src/Grav/Common/Page/Medium/ThumbnailImageMedium.php index 1e4d862..8b54cfb 100644 --- a/system/src/Grav/Common/Page/Medium/ThumbnailImageMedium.php +++ b/system/src/Grav/Common/Page/Medium/ThumbnailImageMedium.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/VectorImageMedium.php b/system/src/Grav/Common/Page/Medium/VectorImageMedium.php index c44f35a..18a5d27 100644 --- a/system/src/Grav/Common/Page/Medium/VectorImageMedium.php +++ b/system/src/Grav/Common/Page/Medium/VectorImageMedium.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/VideoMedium.php b/system/src/Grav/Common/Page/Medium/VideoMedium.php index 0e629dc..8642f7f 100644 --- a/system/src/Grav/Common/Page/Medium/VideoMedium.php +++ b/system/src/Grav/Common/Page/Medium/VideoMedium.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index 25f8ff6..14e7a12 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -622,7 +622,12 @@ class Page implements PageInterface $headers['Vary'] = 'Accept-Encoding'; } - return $headers; + + // Added new Headers event + $headers_obj = (object) $headers; + Grav::instance()->fireEvent('onPageHeaders', new Event(['headers' => $headers_obj])); + + return (array)$headers_obj; } /** diff --git a/system/src/Grav/Common/Page/Pages.php b/system/src/Grav/Common/Page/Pages.php index ec48b51..9282a8f 100644 --- a/system/src/Grav/Common/Page/Pages.php +++ b/system/src/Grav/Common/Page/Pages.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -88,6 +88,8 @@ class Pages /** @var string */ protected $check_method; /** @var string */ + protected $simple_pages_hash; + /** @var string */ protected $pages_cache_id; /** @var bool */ protected $initialized = false; @@ -100,6 +102,7 @@ class Pages /** @var string|null */ protected static $home_route; + /** * Constructor * @@ -1712,10 +1715,7 @@ class Pages /** @var Language $language */ $language = $this->grav['language']; - $pages_dir = $locator->findResource('page://'); - if (!is_string($pages_dir)) { - throw new RuntimeException('Internal Error'); - } + $pages_dirs = $this->getPagesPaths(); // Set active language $this->active_lang = $language->getActive(); @@ -1731,16 +1731,17 @@ class Pages $hash = 0; break; case 'folder': - $hash = Folder::lastModifiedFolder($pages_dir); + $hash = Folder::lastModifiedFolder($pages_dirs); break; case 'hash': - $hash = Folder::hashAllFiles($pages_dir); + $hash = Folder::hashAllFiles($pages_dirs); break; default: - $hash = Folder::lastModifiedFile($pages_dir); + $hash = Folder::lastModifiedFile($pages_dirs); } - $this->pages_cache_id = md5($pages_dir . $hash . $language->getActive() . $config->checksum()); + $this->simple_pages_hash = json_encode($pages_dirs) . $hash . $config->checksum(); + $this->pages_cache_id = md5($this->simple_pages_hash . $language->getActive()); /** @var Cache $cache */ $cache = $this->grav['cache']; @@ -1760,18 +1761,39 @@ class Pages $this->grav['debugger']->addMessage('Page cache disabled, rebuilding pages..'); } - $this->resetPages($pages_dir); + $this->resetPages($pages_dirs); + } + + protected function getPagesPaths(): array + { + $grav = Grav::instance(); + $locator = $grav['locator']; + $paths = []; + + $dirs = (array) $grav['config']->get('system.pages.dirs', ['page://']); + foreach ($dirs as $dir) { + $path = $locator->findResource($dir); + if (file_exists($path)) { + $paths[] = $path; + } + } + + return $paths; } /** * Accessible method to manually reset the pages cache * - * @param string $pages_dir + * @param array $pages_dirs */ - public function resetPages($pages_dir): void + public function resetPages(array $pages_dirs): void { $this->sort = []; - $this->recurse($pages_dir); + + foreach ($pages_dirs as $dir) { + $this->recurse($dir); + } + $this->buildRoutes(); // cache if needed @@ -1795,7 +1817,7 @@ class Pages * @throws RuntimeException * @internal */ - protected function recurse($directory, PageInterface $parent = null) + protected function recurse(string $directory, PageInterface $parent = null) { $directory = rtrim($directory, DS); $page = new Page; @@ -2177,7 +2199,7 @@ class Pages * @param array $list * @return array */ - protected function arrayShuffle($list) + protected function arrayShuffle(array $list): array { $keys = array_keys($list); shuffle($keys); @@ -2193,7 +2215,7 @@ class Pages /** * @return string */ - protected function getVersion() + protected function getVersion(): string { return $this->directory ? 'flex' : 'regular'; } @@ -2204,10 +2226,20 @@ class Pages * this is particularly useful to know if pages have changed and you want * to sync another cache with pages cache - works best in `onPagesInitialized()` * - * @return string + * @return null|string */ - public function getPagesCacheId() + public function getPagesCacheId(): ?string { return $this->pages_cache_id; } + + /** + * Get the simple pages hash that is not md5 encoded, and isn't specific to language + * + * @return null|string + */ + public function getSimplePagesHash(): ?string + { + return $this->simple_pages_hash; + } } diff --git a/system/src/Grav/Common/Page/Types.php b/system/src/Grav/Common/Page/Types.php index 420c588..ffe49a2 100644 --- a/system/src/Grav/Common/Page/Types.php +++ b/system/src/Grav/Common/Page/Types.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Page * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Plugin.php b/system/src/Grav/Common/Plugin.php index 30e5344..73bcfb6 100644 --- a/system/src/Grav/Common/Plugin.php +++ b/system/src/Grav/Common/Plugin.php @@ -3,7 +3,7 @@ /** * @package Grav\Common * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Plugins.php b/system/src/Grav/Common/Plugins.php index 42b1593..935a208 100644 --- a/system/src/Grav/Common/Plugins.php +++ b/system/src/Grav/Common/Plugins.php @@ -3,7 +3,7 @@ /** * @package Grav\Common * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/AssetsProcessor.php b/system/src/Grav/Common/Processors/AssetsProcessor.php index e460fb0..9e626b3 100644 --- a/system/src/Grav/Common/Processors/AssetsProcessor.php +++ b/system/src/Grav/Common/Processors/AssetsProcessor.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Processors * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/BackupsProcessor.php b/system/src/Grav/Common/Processors/BackupsProcessor.php index 83e8a0c..1d5595a 100644 --- a/system/src/Grav/Common/Processors/BackupsProcessor.php +++ b/system/src/Grav/Common/Processors/BackupsProcessor.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Processors * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/DebuggerAssetsProcessor.php b/system/src/Grav/Common/Processors/DebuggerAssetsProcessor.php index a3d5a51..0f55e29 100644 --- a/system/src/Grav/Common/Processors/DebuggerAssetsProcessor.php +++ b/system/src/Grav/Common/Processors/DebuggerAssetsProcessor.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Processors * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/Events/RequestHandlerEvent.php b/system/src/Grav/Common/Processors/Events/RequestHandlerEvent.php index 30f6195..3bf89fe 100644 --- a/system/src/Grav/Common/Processors/Events/RequestHandlerEvent.php +++ b/system/src/Grav/Common/Processors/Events/RequestHandlerEvent.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Processors * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/InitializeProcessor.php b/system/src/Grav/Common/Processors/InitializeProcessor.php index 04e06ed..234b08c 100644 --- a/system/src/Grav/Common/Processors/InitializeProcessor.php +++ b/system/src/Grav/Common/Processors/InitializeProcessor.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Processors * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -251,7 +251,8 @@ class InitializeProcessor extends ProcessorBase $log->popHandler(); $facility = $config->get('system.log.syslog.facility', 'local6'); - $logHandler = new SyslogHandler('grav', $facility); + $tag = $config->get('system.log.syslog.tag', 'grav'); + $logHandler = new SyslogHandler($tag, $facility); $formatter = new LineFormatter("%channel%.%level_name%: %message% %extra%"); $logHandler->setFormatter($formatter); diff --git a/system/src/Grav/Common/Processors/PagesProcessor.php b/system/src/Grav/Common/Processors/PagesProcessor.php index 3338e0c..14a09bb 100644 --- a/system/src/Grav/Common/Processors/PagesProcessor.php +++ b/system/src/Grav/Common/Processors/PagesProcessor.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Processors * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/PluginsProcessor.php b/system/src/Grav/Common/Processors/PluginsProcessor.php index ae87901..41c9f65 100644 --- a/system/src/Grav/Common/Processors/PluginsProcessor.php +++ b/system/src/Grav/Common/Processors/PluginsProcessor.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Processors * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/ProcessorBase.php b/system/src/Grav/Common/Processors/ProcessorBase.php index 9353391..eaa9805 100644 --- a/system/src/Grav/Common/Processors/ProcessorBase.php +++ b/system/src/Grav/Common/Processors/ProcessorBase.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Processors * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/ProcessorInterface.php b/system/src/Grav/Common/Processors/ProcessorInterface.php index 0aed195..c38de03 100644 --- a/system/src/Grav/Common/Processors/ProcessorInterface.php +++ b/system/src/Grav/Common/Processors/ProcessorInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Processors * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/RenderProcessor.php b/system/src/Grav/Common/Processors/RenderProcessor.php index e12cc45..dab4f01 100644 --- a/system/src/Grav/Common/Processors/RenderProcessor.php +++ b/system/src/Grav/Common/Processors/RenderProcessor.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Processors * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/RequestProcessor.php b/system/src/Grav/Common/Processors/RequestProcessor.php index bad410c..48a6200 100644 --- a/system/src/Grav/Common/Processors/RequestProcessor.php +++ b/system/src/Grav/Common/Processors/RequestProcessor.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Processors * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/SchedulerProcessor.php b/system/src/Grav/Common/Processors/SchedulerProcessor.php index 722bfcc..743e738 100644 --- a/system/src/Grav/Common/Processors/SchedulerProcessor.php +++ b/system/src/Grav/Common/Processors/SchedulerProcessor.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Processors * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/TasksProcessor.php b/system/src/Grav/Common/Processors/TasksProcessor.php index 29f3458..b17bfd6 100644 --- a/system/src/Grav/Common/Processors/TasksProcessor.php +++ b/system/src/Grav/Common/Processors/TasksProcessor.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Processors * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/ThemesProcessor.php b/system/src/Grav/Common/Processors/ThemesProcessor.php index 60d089e..8ce6813 100644 --- a/system/src/Grav/Common/Processors/ThemesProcessor.php +++ b/system/src/Grav/Common/Processors/ThemesProcessor.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Processors * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/TwigProcessor.php b/system/src/Grav/Common/Processors/TwigProcessor.php index ffc1032..c71dabc 100644 --- a/system/src/Grav/Common/Processors/TwigProcessor.php +++ b/system/src/Grav/Common/Processors/TwigProcessor.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Processors * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Scheduler/Cron.php b/system/src/Grav/Common/Scheduler/Cron.php index 0103839..86ef193 100644 --- a/system/src/Grav/Common/Scheduler/Cron.php +++ b/system/src/Grav/Common/Scheduler/Cron.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Scheduler * @author Originally based on jqCron by Arnaud Buathier modified for Grav integration - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Scheduler/IntervalTrait.php b/system/src/Grav/Common/Scheduler/IntervalTrait.php index 5f7406b..8ce20a1 100644 --- a/system/src/Grav/Common/Scheduler/IntervalTrait.php +++ b/system/src/Grav/Common/Scheduler/IntervalTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Scheduler * @author Originally based on peppeocchi/php-cron-scheduler modified for Grav integration - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Scheduler/Job.php b/system/src/Grav/Common/Scheduler/Job.php index 4156119..4de0028 100644 --- a/system/src/Grav/Common/Scheduler/Job.php +++ b/system/src/Grav/Common/Scheduler/Job.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Scheduler * @author Originally based on peppeocchi/php-cron-scheduler modified for Grav integration - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Scheduler/Scheduler.php b/system/src/Grav/Common/Scheduler/Scheduler.php index 19eb9ea..1a1750b 100644 --- a/system/src/Grav/Common/Scheduler/Scheduler.php +++ b/system/src/Grav/Common/Scheduler/Scheduler.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Scheduler * @author Originally based on peppeocchi/php-cron-scheduler modified for Grav integration - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Security.php b/system/src/Grav/Common/Security.php index 779e619..519095c 100644 --- a/system/src/Grav/Common/Security.php +++ b/system/src/Grav/Common/Security.php @@ -3,7 +3,7 @@ /** * @package Grav\Common * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -97,7 +97,7 @@ class Security */ public static function detectXssFromPages(Pages $pages, $route = true, callable $status = null) { - $routes = $pages->routes(); + $routes = $pages->getList(null, 0, true); // Remove duplicate for homepage unset($routes['/']); @@ -110,26 +110,23 @@ class Security 'steps' => count($routes), ]); - foreach ($routes as $path) { + foreach (array_keys($routes) as $route) { $status && $status([ 'type' => 'progress', ]); try { - $page = $pages->get($path); + $page = $pages->find($route); + if ($page->exists()) { + // call the content to load/cache it + $header = (array) $page->header(); + $content = $page->value('content'); - // call the content to load/cache it - $header = (array) $page->header(); - $content = $page->value('content'); + $data = ['header' => $header, 'content' => $content]; + $results = static::detectXssFromArray($data); - $data = ['header' => $header, 'content' => $content]; - $results = static::detectXssFromArray($data); - - if (!empty($results)) { - if ($route) { - $list[$page->route()] = $results; - } else { - $list[$page->filePathClean()] = $results; + if (!empty($results)) { + $list[$page->rawRoute()] = $results; } } } catch (Exception $e) { @@ -222,7 +219,8 @@ class Security $string = html_entity_decode($string, ENT_NOQUOTES | ENT_HTML5, 'UTF-8'); // Strip whitespace characters - $string = preg_replace('!\s!u', '', $string); + $string = preg_replace('!\s!u', ' ', $string); + $stripped = preg_replace('!\s!u', '', $string); // Set the patterns we'll test against $patterns = [ @@ -245,7 +243,7 @@ class Security // Iterate over rules and return label if fail foreach ($patterns as $name => $regex) { if (!empty($enabled_rules[$name])) { - if (preg_match($regex, $string) || preg_match($regex, $orig)) { + if (preg_match($regex, $string) || preg_match($regex, $stripped) || preg_match($regex, $orig)) { return $name; } } diff --git a/system/src/Grav/Common/Service/AccountsServiceProvider.php b/system/src/Grav/Common/Service/AccountsServiceProvider.php index 60f26e5..4706122 100644 --- a/system/src/Grav/Common/Service/AccountsServiceProvider.php +++ b/system/src/Grav/Common/Service/AccountsServiceProvider.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Service * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Service/AssetsServiceProvider.php b/system/src/Grav/Common/Service/AssetsServiceProvider.php index 54a44a1..9a04667 100644 --- a/system/src/Grav/Common/Service/AssetsServiceProvider.php +++ b/system/src/Grav/Common/Service/AssetsServiceProvider.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Service * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Service/BackupsServiceProvider.php b/system/src/Grav/Common/Service/BackupsServiceProvider.php index 58f5021..0617c47 100644 --- a/system/src/Grav/Common/Service/BackupsServiceProvider.php +++ b/system/src/Grav/Common/Service/BackupsServiceProvider.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Service * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Service/ConfigServiceProvider.php b/system/src/Grav/Common/Service/ConfigServiceProvider.php index e65e228..a050c1e 100644 --- a/system/src/Grav/Common/Service/ConfigServiceProvider.php +++ b/system/src/Grav/Common/Service/ConfigServiceProvider.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Service * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Service/ErrorServiceProvider.php b/system/src/Grav/Common/Service/ErrorServiceProvider.php index 02d38c9..c58b2fd 100644 --- a/system/src/Grav/Common/Service/ErrorServiceProvider.php +++ b/system/src/Grav/Common/Service/ErrorServiceProvider.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Service * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Service/FilesystemServiceProvider.php b/system/src/Grav/Common/Service/FilesystemServiceProvider.php index 1dde5b3..19bac29 100644 --- a/system/src/Grav/Common/Service/FilesystemServiceProvider.php +++ b/system/src/Grav/Common/Service/FilesystemServiceProvider.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Service * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Service/FlexServiceProvider.php b/system/src/Grav/Common/Service/FlexServiceProvider.php index e7b283a..8cac426 100644 --- a/system/src/Grav/Common/Service/FlexServiceProvider.php +++ b/system/src/Grav/Common/Service/FlexServiceProvider.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Service * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -97,7 +97,9 @@ class FlexServiceProvider implements ServiceProviderInterface 'options' => [ 'file' => 'user', 'pattern' => '{FOLDER}/{KEY:2}/{KEY}/{FILE}{EXT}', - 'key' => 'storage_key' + 'key' => 'storage_key', + 'indexed' => true, + 'case_sensitive' => false ], ]; } @@ -107,7 +109,9 @@ class FlexServiceProvider implements ServiceProviderInterface 'class' => UserFileStorage::class, 'options' => [ 'pattern' => '{FOLDER}/{KEY}{EXT}', - 'key' => 'username' + 'key' => 'username', + 'indexed' => true, + 'case_sensitive' => false ], ]; } diff --git a/system/src/Grav/Common/Service/InflectorServiceProvider.php b/system/src/Grav/Common/Service/InflectorServiceProvider.php index f43a446..239d2b9 100644 --- a/system/src/Grav/Common/Service/InflectorServiceProvider.php +++ b/system/src/Grav/Common/Service/InflectorServiceProvider.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Service * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Service/LoggerServiceProvider.php b/system/src/Grav/Common/Service/LoggerServiceProvider.php index 43a67ca..6eb0a9d 100644 --- a/system/src/Grav/Common/Service/LoggerServiceProvider.php +++ b/system/src/Grav/Common/Service/LoggerServiceProvider.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Service * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Service/OutputServiceProvider.php b/system/src/Grav/Common/Service/OutputServiceProvider.php index 2dbd343..23f7a7a 100644 --- a/system/src/Grav/Common/Service/OutputServiceProvider.php +++ b/system/src/Grav/Common/Service/OutputServiceProvider.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Service * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Service/PagesServiceProvider.php b/system/src/Grav/Common/Service/PagesServiceProvider.php index fa6631e..52ef5ea 100644 --- a/system/src/Grav/Common/Service/PagesServiceProvider.php +++ b/system/src/Grav/Common/Service/PagesServiceProvider.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Service * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Service/RequestServiceProvider.php b/system/src/Grav/Common/Service/RequestServiceProvider.php index a44c735..ad6a861 100644 --- a/system/src/Grav/Common/Service/RequestServiceProvider.php +++ b/system/src/Grav/Common/Service/RequestServiceProvider.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Service * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Service/SchedulerServiceProvider.php b/system/src/Grav/Common/Service/SchedulerServiceProvider.php index 13918fb..5769286 100644 --- a/system/src/Grav/Common/Service/SchedulerServiceProvider.php +++ b/system/src/Grav/Common/Service/SchedulerServiceProvider.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Service * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Service/SessionServiceProvider.php b/system/src/Grav/Common/Service/SessionServiceProvider.php index 80e24b4..0fbe49b 100644 --- a/system/src/Grav/Common/Service/SessionServiceProvider.php +++ b/system/src/Grav/Common/Service/SessionServiceProvider.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Service * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Service/StreamsServiceProvider.php b/system/src/Grav/Common/Service/StreamsServiceProvider.php index f501b49..93ebd1b 100644 --- a/system/src/Grav/Common/Service/StreamsServiceProvider.php +++ b/system/src/Grav/Common/Service/StreamsServiceProvider.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Service * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Service/TaskServiceProvider.php b/system/src/Grav/Common/Service/TaskServiceProvider.php index 2989e9d..ce5ec64 100644 --- a/system/src/Grav/Common/Service/TaskServiceProvider.php +++ b/system/src/Grav/Common/Service/TaskServiceProvider.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Service * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Session.php b/system/src/Grav/Common/Session.php index 513143e..14d09a2 100644 --- a/system/src/Grav/Common/Session.php +++ b/system/src/Grav/Common/Session.php @@ -3,13 +3,14 @@ /** * @package Grav\Common * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ namespace Grav\Common; use Grav\Common\Form\FormFlash; +use Grav\Events\BeforeSessionStartEvent; use Grav\Events\SessionStartEvent; use Grav\Plugin\Form\Forms; use JsonException; @@ -177,6 +178,17 @@ class Session extends \Grav\Framework\Session\Session return null; } + /** + * @return void + */ + protected function onBeforeSessionStart(): void + { + $event = new BeforeSessionStartEvent($this); + + $grav = Grav::instance(); + $grav->dispatchEvent($event); + } + /** * @return void */ diff --git a/system/src/Grav/Common/Taxonomy.php b/system/src/Grav/Common/Taxonomy.php index 5079a25..1b336bd 100644 --- a/system/src/Grav/Common/Taxonomy.php +++ b/system/src/Grav/Common/Taxonomy.php @@ -3,7 +3,7 @@ /** * @package Grav\Common * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Theme.php b/system/src/Grav/Common/Theme.php index 6013129..0ed2788 100644 --- a/system/src/Grav/Common/Theme.php +++ b/system/src/Grav/Common/Theme.php @@ -3,7 +3,7 @@ /** * @package Grav\Common * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Themes.php b/system/src/Grav/Common/Themes.php index 3567cca..e3ce636 100644 --- a/system/src/Grav/Common/Themes.php +++ b/system/src/Grav/Common/Themes.php @@ -3,7 +3,7 @@ /** * @package Grav\Common * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/Exception/TwigException.php b/system/src/Grav/Common/Twig/Exception/TwigException.php index 7605de4..3a2e155 100644 --- a/system/src/Grav/Common/Twig/Exception/TwigException.php +++ b/system/src/Grav/Common/Twig/Exception/TwigException.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig\Exception * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/Extension/FilesystemExtension.php b/system/src/Grav/Common/Twig/Extension/FilesystemExtension.php index 0ae793e..a06ed05 100644 --- a/system/src/Grav/Common/Twig/Extension/FilesystemExtension.php +++ b/system/src/Grav/Common/Twig/Extension/FilesystemExtension.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/Extension/GravExtension.php b/system/src/Grav/Common/Twig/Extension/GravExtension.php index 52e2a18..f3a122e 100644 --- a/system/src/Grav/Common/Twig/Extension/GravExtension.php +++ b/system/src/Grav/Common/Twig/Extension/GravExtension.php @@ -3,12 +3,13 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ namespace Grav\Common\Twig\Extension; +use CallbackFilterIterator; use Cron\CronExpression; use Grav\Common\Config\Config; use Grav\Common\Data\Data; @@ -41,6 +42,7 @@ use JsonSerializable; use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator; use Traversable; use Twig\Environment; +use Twig\Error\RuntimeError; use Twig\Extension\AbstractExtension; use Twig\Extension\GlobalsInterface; use Twig\Loader\FilesystemLoader; @@ -145,6 +147,7 @@ class GravExtension extends AbstractExtension implements GlobalsInterface new TwigFilter('yaml_encode', [$this, 'yamlEncodeFilter']), new TwigFilter('yaml_decode', [$this, 'yamlDecodeFilter']), new TwigFilter('nicecron', [$this, 'niceCronFilter']), + new TwigFilter('replace_last', [$this, 'replaceLastFilter']), // Translations new TwigFilter('t', [$this, 'translate'], ['needs_environment' => true]), @@ -166,6 +169,9 @@ class GravExtension extends AbstractExtension implements GlobalsInterface // PHP methods new TwigFilter('count', 'count'), new TwigFilter('array_diff', 'array_diff'), + + // Security fix + new TwigFilter('filter', [$this, 'filterFilter'], ['needs_environment' => true]), ]; } @@ -194,6 +200,7 @@ class GravExtension extends AbstractExtension implements GlobalsInterface new TwigFunction('gist', [$this, 'gistFunc']), new TwigFunction('nonce_field', [$this, 'nonceFieldFunc']), new TwigFunction('pathinfo', 'pathinfo'), + new TwigFunction('parseurl', 'parse_url'), new TwigFunction('random_string', [$this, 'randomStringFunc']), new TwigFunction('repeat', [$this, 'repeatFunc']), new TwigFunction('regex_replace', [$this, 'regexReplace']), @@ -547,6 +554,21 @@ class GravExtension extends AbstractExtension implements GlobalsInterface return $cron->getText('en'); } + /** + * @param string|mixed $str + * @param string $search + * @param string $replace + * @return string|mixed + */ + public function replaceLastFilter($str, $search, $replace) + { + if (is_string($str) && ($pos = mb_strrpos($str, $search)) !== false) { + $str = mb_substr($str, 0, $pos) . $replace . mb_substr($str, $pos + mb_strlen($search)); + } + + return $str; + } + /** * Get Cron object for a crontab 'at' format * @@ -1659,4 +1681,20 @@ class GravExtension extends AbstractExtension implements GlobalsInterface return is_string($var); } } + + /** + * @param Environment $env + * @param array $array + * @param callable|string $arrow + * @return array|CallbackFilterIterator + * @throws RuntimeError + */ + function filterFilter(Environment $env, $array, $arrow) + { + if (is_string($arrow) && Utils::isDangerousFunction($arrow)) { + throw new RuntimeError('Twig |filter("' . $arrow . '") is not allowed.'); + } + + return twig_array_filter($env, $array, $arrow); + } } diff --git a/system/src/Grav/Common/Twig/Node/TwigNodeCache.php b/system/src/Grav/Common/Twig/Node/TwigNodeCache.php index e05e372..64a13a6 100644 --- a/system/src/Grav/Common/Twig/Node/TwigNodeCache.php +++ b/system/src/Grav/Common/Twig/Node/TwigNodeCache.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/Node/TwigNodeLink.php b/system/src/Grav/Common/Twig/Node/TwigNodeLink.php index a468633..7be655a 100644 --- a/system/src/Grav/Common/Twig/Node/TwigNodeLink.php +++ b/system/src/Grav/Common/Twig/Node/TwigNodeLink.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/Node/TwigNodeMarkdown.php b/system/src/Grav/Common/Twig/Node/TwigNodeMarkdown.php index 4637db7..2eaae8c 100644 --- a/system/src/Grav/Common/Twig/Node/TwigNodeMarkdown.php +++ b/system/src/Grav/Common/Twig/Node/TwigNodeMarkdown.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/Node/TwigNodeRender.php b/system/src/Grav/Common/Twig/Node/TwigNodeRender.php index dbce3c6..e2bcf06 100644 --- a/system/src/Grav/Common/Twig/Node/TwigNodeRender.php +++ b/system/src/Grav/Common/Twig/Node/TwigNodeRender.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/Node/TwigNodeScript.php b/system/src/Grav/Common/Twig/Node/TwigNodeScript.php index 03554bd..5726283 100644 --- a/system/src/Grav/Common/Twig/Node/TwigNodeScript.php +++ b/system/src/Grav/Common/Twig/Node/TwigNodeScript.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/Node/TwigNodeStyle.php b/system/src/Grav/Common/Twig/Node/TwigNodeStyle.php index 1c3568c..5a1dfd1 100644 --- a/system/src/Grav/Common/Twig/Node/TwigNodeStyle.php +++ b/system/src/Grav/Common/Twig/Node/TwigNodeStyle.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/Node/TwigNodeSwitch.php b/system/src/Grav/Common/Twig/Node/TwigNodeSwitch.php index 7bd368e..3aa0889 100644 --- a/system/src/Grav/Common/Twig/Node/TwigNodeSwitch.php +++ b/system/src/Grav/Common/Twig/Node/TwigNodeSwitch.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/Node/TwigNodeThrow.php b/system/src/Grav/Common/Twig/Node/TwigNodeThrow.php index 41ca15d..7ccf771 100644 --- a/system/src/Grav/Common/Twig/Node/TwigNodeThrow.php +++ b/system/src/Grav/Common/Twig/Node/TwigNodeThrow.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/Node/TwigNodeTryCatch.php b/system/src/Grav/Common/Twig/Node/TwigNodeTryCatch.php index 1213b7c..9f0af14 100644 --- a/system/src/Grav/Common/Twig/Node/TwigNodeTryCatch.php +++ b/system/src/Grav/Common/Twig/Node/TwigNodeTryCatch.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserCache.php b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserCache.php index 1cf2191..d3658b2 100644 --- a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserCache.php +++ b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserCache.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserLink.php b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserLink.php index 2cb0208..b9fb21f 100644 --- a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserLink.php +++ b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserLink.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserMarkdown.php b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserMarkdown.php index 49e34e6..f3d55c0 100644 --- a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserMarkdown.php +++ b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserMarkdown.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserRender.php b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserRender.php index de16266..9572f9b 100644 --- a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserRender.php +++ b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserRender.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserScript.php b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserScript.php index b943a25..4cc575f 100644 --- a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserScript.php +++ b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserScript.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserStyle.php b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserStyle.php index 0687395..03f9fd0 100644 --- a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserStyle.php +++ b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserStyle.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserSwitch.php b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserSwitch.php index c63fe95..b52c729 100644 --- a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserSwitch.php +++ b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserSwitch.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. * @origin https://gist.github.com/maxgalbu/9409182 */ diff --git a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserThrow.php b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserThrow.php index 41f415d..f99f454 100644 --- a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserThrow.php +++ b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserThrow.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserTryCatch.php b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserTryCatch.php index 9930632..21f9694 100644 --- a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserTryCatch.php +++ b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserTryCatch.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/Twig.php b/system/src/Grav/Common/Twig/Twig.php index 39ae3c6..66a9d78 100644 --- a/system/src/Grav/Common/Twig/Twig.php +++ b/system/src/Grav/Common/Twig/Twig.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/TwigClockworkDataSource.php b/system/src/Grav/Common/Twig/TwigClockworkDataSource.php index 407a05e..310eb7f 100644 --- a/system/src/Grav/Common/Twig/TwigClockworkDataSource.php +++ b/system/src/Grav/Common/Twig/TwigClockworkDataSource.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/TwigClockworkDumper.php b/system/src/Grav/Common/Twig/TwigClockworkDumper.php index c960cf2..ce430de 100644 --- a/system/src/Grav/Common/Twig/TwigClockworkDumper.php +++ b/system/src/Grav/Common/Twig/TwigClockworkDumper.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/TwigEnvironment.php b/system/src/Grav/Common/Twig/TwigEnvironment.php index dba8846..36f1b96 100644 --- a/system/src/Grav/Common/Twig/TwigEnvironment.php +++ b/system/src/Grav/Common/Twig/TwigEnvironment.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/TwigExtension.php b/system/src/Grav/Common/Twig/TwigExtension.php index 07c442e..df857db 100644 --- a/system/src/Grav/Common/Twig/TwigExtension.php +++ b/system/src/Grav/Common/Twig/TwigExtension.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/WriteCacheFileTrait.php b/system/src/Grav/Common/Twig/WriteCacheFileTrait.php index 575a281..d88eff9 100644 --- a/system/src/Grav/Common/Twig/WriteCacheFileTrait.php +++ b/system/src/Grav/Common/Twig/WriteCacheFileTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Twig * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Uri.php b/system/src/Grav/Common/Uri.php index 76d9a99..c192438 100644 --- a/system/src/Grav/Common/Uri.php +++ b/system/src/Grav/Common/Uri.php @@ -3,7 +3,7 @@ /** * @package Grav\Common * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/User/Access.php b/system/src/Grav/Common/User/Access.php index 96f4d96..54b276b 100644 --- a/system/src/Grav/Common/User/Access.php +++ b/system/src/Grav/Common/User/Access.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\User * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/User/Authentication.php b/system/src/Grav/Common/User/Authentication.php index c32fd62..613db79 100644 --- a/system/src/Grav/Common/User/Authentication.php +++ b/system/src/Grav/Common/User/Authentication.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\User * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/User/DataUser/User.php b/system/src/Grav/Common/User/DataUser/User.php index 9cd3904..dfa178a 100644 --- a/system/src/Grav/Common/User/DataUser/User.php +++ b/system/src/Grav/Common/User/DataUser/User.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\User * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/User/DataUser/UserCollection.php b/system/src/Grav/Common/User/DataUser/UserCollection.php index d0ada09..4682d77 100644 --- a/system/src/Grav/Common/User/DataUser/UserCollection.php +++ b/system/src/Grav/Common/User/DataUser/UserCollection.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\User * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -112,11 +112,12 @@ class UserCollection implements UserCollectionInterface // If not found, try the fields if (!$user->exists()) { + $query = mb_strtolower($query); foreach ($files as $file) { if (Utils::endsWith($file, YAML_EXT)) { $find_user = $this->load(trim(Utils::pathinfo($file, PATHINFO_FILENAME))); foreach ($fields as $field) { - if (isset($find_user[$field]) && $find_user[$field] === $query) { + if (isset($find_user[$field]) && mb_strtolower($find_user[$field]) === $query) { return $find_user; } } diff --git a/system/src/Grav/Common/User/Group.php b/system/src/Grav/Common/User/Group.php index 9be619a..92585f5 100644 --- a/system/src/Grav/Common/User/Group.php +++ b/system/src/Grav/Common/User/Group.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\User * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/User/Interfaces/AuthorizeInterface.php b/system/src/Grav/Common/User/Interfaces/AuthorizeInterface.php index 1aeb004..670a83e 100644 --- a/system/src/Grav/Common/User/Interfaces/AuthorizeInterface.php +++ b/system/src/Grav/Common/User/Interfaces/AuthorizeInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\User * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/User/Interfaces/UserCollectionInterface.php b/system/src/Grav/Common/User/Interfaces/UserCollectionInterface.php index 5bcfbc0..b380182 100644 --- a/system/src/Grav/Common/User/Interfaces/UserCollectionInterface.php +++ b/system/src/Grav/Common/User/Interfaces/UserCollectionInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\User * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/User/Interfaces/UserGroupInterface.php b/system/src/Grav/Common/User/Interfaces/UserGroupInterface.php index c18388c..b7bbcff 100644 --- a/system/src/Grav/Common/User/Interfaces/UserGroupInterface.php +++ b/system/src/Grav/Common/User/Interfaces/UserGroupInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\User * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/User/Interfaces/UserInterface.php b/system/src/Grav/Common/User/Interfaces/UserInterface.php index dcd014c..2dbeb5c 100644 --- a/system/src/Grav/Common/User/Interfaces/UserInterface.php +++ b/system/src/Grav/Common/User/Interfaces/UserInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\User * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/User/Traits/UserTrait.php b/system/src/Grav/Common/User/Traits/UserTrait.php index 91c41aa..77cb6c3 100644 --- a/system/src/Grav/Common/User/Traits/UserTrait.php +++ b/system/src/Grav/Common/User/Traits/UserTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\User * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/User/User.php b/system/src/Grav/Common/User/User.php index b38c72e..a02cc69 100644 --- a/system/src/Grav/Common/User/User.php +++ b/system/src/Grav/Common/User/User.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\User * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Utils.php b/system/src/Grav/Common/Utils.php index 145a893..078a49a 100644 --- a/system/src/Grav/Common/Utils.php +++ b/system/src/Grav/Common/Utils.php @@ -3,7 +3,7 @@ /** * @package Grav\Common * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -83,6 +83,7 @@ abstract class Utils $resource = false; if (static::contains((string)$input, '://')) { + // Url contains a scheme (https:// , user:// etc). /** @var UniformResourceLocator $locator */ $locator = $grav['locator']; @@ -134,6 +135,16 @@ abstract class Utils $resource = $locator->findResource($input, false); } } else { + // Just a path. + /** @var Pages $pages */ + $pages = $grav['pages']; + + // Is this a page? + $page = $pages->find($input, true); + if ($page && $page->routable()) { + return $page->url($domain); + } + $root = preg_quote($uri->rootUrl(), '#'); $pattern = '#(' . $root . '$|' . $root . '/)#'; if (!empty($root) && preg_match($pattern, $input, $matches)) { @@ -657,18 +668,17 @@ abstract class Utils */ public static function download($file, $force_download = true, $sec = 0, $bytes = 1024, array $options = []) { + $grav = Grav::instance(); + if (file_exists($file)) { // fire download event - Grav::instance()->fireEvent('onBeforeDownload', new Event(['file' => $file, 'options' => &$options])); + $grav->fireEvent('onBeforeDownload', new Event(['file' => $file, 'options' => &$options])); $file_parts = static::pathinfo($file); $mimetype = $options['mime'] ?? static::getMimeByExtension($file_parts['extension']); $size = filesize($file); // File size - // clean all buffers - while (ob_get_level()) { - ob_end_clean(); - } + $grav->cleanOutputBuffers(); // required for IE, otherwise Content-Disposition may be ignored if (ini_get('zlib.output_compression')) { @@ -703,8 +713,8 @@ abstract class Utils $new_length = $size; header('Content-Length: ' . $size); - if (Grav::instance()['config']->get('system.cache.enabled')) { - $expires = $options['expires'] ?? Grav::instance()['config']->get('system.pages.expires'); + if ($grav['config']->get('system.cache.enabled')) { + $expires = $options['expires'] ?? $grav['config']->get('system.pages.expires'); if ($expires > 0) { $expires_date = gmdate('D, d M Y H:i:s T', time() + $expires); header('Cache-Control: max-age=' . $expires); diff --git a/system/src/Grav/Common/Yaml.php b/system/src/Grav/Common/Yaml.php index 0758599..ef287f3 100644 --- a/system/src/Grav/Common/Yaml.php +++ b/system/src/Grav/Common/Yaml.php @@ -3,7 +3,7 @@ /** * @package Grav\Common * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Application/Application.php b/system/src/Grav/Console/Application/Application.php index 873b94e..2b3a7f5 100644 --- a/system/src/Grav/Console/Application/Application.php +++ b/system/src/Grav/Console/Application/Application.php @@ -3,7 +3,7 @@ /** * @package Grav\Console * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Application/CommandLoader/PluginCommandLoader.php b/system/src/Grav/Console/Application/CommandLoader/PluginCommandLoader.php index adf6447..1f5753c 100644 --- a/system/src/Grav/Console/Application/CommandLoader/PluginCommandLoader.php +++ b/system/src/Grav/Console/Application/CommandLoader/PluginCommandLoader.php @@ -3,7 +3,7 @@ /** * @package Grav\Console * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Application/GpmApplication.php b/system/src/Grav/Console/Application/GpmApplication.php index f9e6b61..d334102 100644 --- a/system/src/Grav/Console/Application/GpmApplication.php +++ b/system/src/Grav/Console/Application/GpmApplication.php @@ -3,7 +3,7 @@ /** * @package Grav\Console * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Application/GravApplication.php b/system/src/Grav/Console/Application/GravApplication.php index f06dae6..5d6cfed 100644 --- a/system/src/Grav/Console/Application/GravApplication.php +++ b/system/src/Grav/Console/Application/GravApplication.php @@ -3,7 +3,7 @@ /** * @package Grav\Console * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Application/PluginApplication.php b/system/src/Grav/Console/Application/PluginApplication.php index e365b1e..64b9b6d 100644 --- a/system/src/Grav/Console/Application/PluginApplication.php +++ b/system/src/Grav/Console/Application/PluginApplication.php @@ -3,7 +3,7 @@ /** * @package Grav\Console * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Cli/BackupCommand.php b/system/src/Grav/Console/Cli/BackupCommand.php index 1fe84ea..37596e2 100644 --- a/system/src/Grav/Console/Cli/BackupCommand.php +++ b/system/src/Grav/Console/Cli/BackupCommand.php @@ -3,7 +3,7 @@ /** * @package Grav\Console\Cli * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Cli/CleanCommand.php b/system/src/Grav/Console/Cli/CleanCommand.php index e6b8f98..41aab2b 100644 --- a/system/src/Grav/Console/Cli/CleanCommand.php +++ b/system/src/Grav/Console/Cli/CleanCommand.php @@ -3,7 +3,7 @@ /** * @package Grav\Console\Cli * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Cli/ClearCacheCommand.php b/system/src/Grav/Console/Cli/ClearCacheCommand.php index 7550dd9..882be21 100644 --- a/system/src/Grav/Console/Cli/ClearCacheCommand.php +++ b/system/src/Grav/Console/Cli/ClearCacheCommand.php @@ -3,7 +3,7 @@ /** * @package Grav\Console\Cli * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Cli/ComposerCommand.php b/system/src/Grav/Console/Cli/ComposerCommand.php index 0dc9bcd..6a23c4e 100644 --- a/system/src/Grav/Console/Cli/ComposerCommand.php +++ b/system/src/Grav/Console/Cli/ComposerCommand.php @@ -3,7 +3,7 @@ /** * @package Grav\Console\Cli * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Cli/InstallCommand.php b/system/src/Grav/Console/Cli/InstallCommand.php index 33198cb..6a47164 100644 --- a/system/src/Grav/Console/Cli/InstallCommand.php +++ b/system/src/Grav/Console/Cli/InstallCommand.php @@ -3,7 +3,7 @@ /** * @package Grav\Console\Cli * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -147,7 +147,7 @@ class InstallCommand extends GravCommand foreach ($this->config['git'] as $repo => $data) { $path = $this->destination . DS . $data['path']; if (!file_exists($path)) { - exec('cd "' . $this->destination . '" && git clone -b ' . $data['branch'] . ' --depth 1 ' . $data['url'] . ' ' . $data['path'], $output, $return); + exec('cd ' . escapeshellarg($this->destination) . ' && git clone -b ' . $data['branch'] . ' --depth 1 ' . $data['url'] . ' ' . $data['path'], $output, $return); if (!$return) { $io->writeln('SUCCESS cloned ' . $data['url'] . ' -> ' . $path . ''); diff --git a/system/src/Grav/Console/Cli/LogViewerCommand.php b/system/src/Grav/Console/Cli/LogViewerCommand.php index d7e127e..8c26af2 100644 --- a/system/src/Grav/Console/Cli/LogViewerCommand.php +++ b/system/src/Grav/Console/Cli/LogViewerCommand.php @@ -3,7 +3,7 @@ /** * @package Grav\Console\Cli * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Cli/NewProjectCommand.php b/system/src/Grav/Console/Cli/NewProjectCommand.php index 7abbc4e..4121669 100644 --- a/system/src/Grav/Console/Cli/NewProjectCommand.php +++ b/system/src/Grav/Console/Cli/NewProjectCommand.php @@ -3,7 +3,7 @@ /** * @package Grav\Console\Cli * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Cli/PageSystemValidatorCommand.php b/system/src/Grav/Console/Cli/PageSystemValidatorCommand.php index 3a69600..ef46fcd 100644 --- a/system/src/Grav/Console/Cli/PageSystemValidatorCommand.php +++ b/system/src/Grav/Console/Cli/PageSystemValidatorCommand.php @@ -3,7 +3,7 @@ /** * @package Grav\Console\Cli * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Cli/SandboxCommand.php b/system/src/Grav/Console/Cli/SandboxCommand.php index 0ba2850..f7b308a 100644 --- a/system/src/Grav/Console/Cli/SandboxCommand.php +++ b/system/src/Grav/Console/Cli/SandboxCommand.php @@ -3,7 +3,7 @@ /** * @package Grav\Console\Cli * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Cli/SchedulerCommand.php b/system/src/Grav/Console/Cli/SchedulerCommand.php index 91fc57d..35e20e3 100644 --- a/system/src/Grav/Console/Cli/SchedulerCommand.php +++ b/system/src/Grav/Console/Cli/SchedulerCommand.php @@ -3,7 +3,7 @@ /** * @package Grav\Console\Cli * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Cli/SecurityCommand.php b/system/src/Grav/Console/Cli/SecurityCommand.php index b6cb662..5feacce 100644 --- a/system/src/Grav/Console/Cli/SecurityCommand.php +++ b/system/src/Grav/Console/Cli/SecurityCommand.php @@ -3,7 +3,7 @@ /** * @package Grav\Console\Cli * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Cli/ServerCommand.php b/system/src/Grav/Console/Cli/ServerCommand.php index 29b423e..1fd8c9b 100644 --- a/system/src/Grav/Console/Cli/ServerCommand.php +++ b/system/src/Grav/Console/Cli/ServerCommand.php @@ -3,7 +3,7 @@ /** * @package Grav\Console\Cli * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Cli/YamlLinterCommand.php b/system/src/Grav/Console/Cli/YamlLinterCommand.php index 75a7559..452fc6d 100644 --- a/system/src/Grav/Console/Cli/YamlLinterCommand.php +++ b/system/src/Grav/Console/Cli/YamlLinterCommand.php @@ -3,7 +3,7 @@ /** * @package Grav\Console\Cli * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/ConsoleCommand.php b/system/src/Grav/Console/ConsoleCommand.php index c522c88..15fc88a 100644 --- a/system/src/Grav/Console/ConsoleCommand.php +++ b/system/src/Grav/Console/ConsoleCommand.php @@ -3,7 +3,7 @@ /** * @package Grav\Console * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/ConsoleTrait.php b/system/src/Grav/Console/ConsoleTrait.php index 0af4075..479b08c 100644 --- a/system/src/Grav/Console/ConsoleTrait.php +++ b/system/src/Grav/Console/ConsoleTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Console * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -288,7 +288,7 @@ trait ConsoleTrait { $composer = Composer::getComposerExecutor(); - return system($composer . ' --working-dir="'.$path.'" --no-interaction --no-dev --prefer-dist -o '. $action); + return system($composer . ' --working-dir=' . escapeshellarg($path) . ' --no-interaction --no-dev --prefer-dist -o '. $action); } /** diff --git a/system/src/Grav/Console/Gpm/DirectInstallCommand.php b/system/src/Grav/Console/Gpm/DirectInstallCommand.php index fbb0220..704f628 100644 --- a/system/src/Grav/Console/Gpm/DirectInstallCommand.php +++ b/system/src/Grav/Console/Gpm/DirectInstallCommand.php @@ -3,19 +3,18 @@ /** * @package Grav\Console\Gpm * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ namespace Grav\Console\Gpm; use Exception; -use Grav\Common\Cache; use Grav\Common\Grav; use Grav\Common\Filesystem\Folder; +use Grav\Common\HTTP\Response; use Grav\Common\GPM\GPM; use Grav\Common\GPM\Installer; -use Grav\Common\GPM\Response; use Grav\Console\GpmCommand; use RuntimeException; use Symfony\Component\Console\Input\InputArgument; diff --git a/system/src/Grav/Console/Gpm/IndexCommand.php b/system/src/Grav/Console/Gpm/IndexCommand.php index 367322b..1930a2d 100644 --- a/system/src/Grav/Console/Gpm/IndexCommand.php +++ b/system/src/Grav/Console/Gpm/IndexCommand.php @@ -3,7 +3,7 @@ /** * @package Grav\Console\Gpm * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Gpm/InfoCommand.php b/system/src/Grav/Console/Gpm/InfoCommand.php index c6f8552..493563f 100644 --- a/system/src/Grav/Console/Gpm/InfoCommand.php +++ b/system/src/Grav/Console/Gpm/InfoCommand.php @@ -3,7 +3,7 @@ /** * @package Grav\Console\Gpm * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Gpm/InstallCommand.php b/system/src/Grav/Console/Gpm/InstallCommand.php index d25ebe3..f16b5be 100644 --- a/system/src/Grav/Console/Gpm/InstallCommand.php +++ b/system/src/Grav/Console/Gpm/InstallCommand.php @@ -3,7 +3,7 @@ /** * @package Grav\Console\Gpm * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -11,10 +11,10 @@ namespace Grav\Console\Gpm; use Exception; use Grav\Common\Filesystem\Folder; +use Grav\Common\HTTP\Response; use Grav\Common\GPM\GPM; use Grav\Common\GPM\Installer; use Grav\Common\GPM\Licenses; -use Grav\Common\GPM\Response; use Grav\Common\GPM\Remote\Package; use Grav\Common\Grav; use Grav\Common\Utils; @@ -485,7 +485,7 @@ class InstallCommand extends GpmCommand { $io = $this->getIO(); - exec('cd ' . $this->destination); + exec('cd ' . escapeshellarg($this->destination)); $to = $this->destination . DS . $package->install_path; $from = $this->getSymlinkSource($package); diff --git a/system/src/Grav/Console/Gpm/SelfupgradeCommand.php b/system/src/Grav/Console/Gpm/SelfupgradeCommand.php index a3d53ff..ccf3b49 100644 --- a/system/src/Grav/Console/Gpm/SelfupgradeCommand.php +++ b/system/src/Grav/Console/Gpm/SelfupgradeCommand.php @@ -3,7 +3,7 @@ /** * @package Grav\Console\Gpm * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -11,8 +11,8 @@ namespace Grav\Console\Gpm; use Exception; use Grav\Common\Filesystem\Folder; +use Grav\Common\HTTP\Response; use Grav\Common\GPM\Installer; -use Grav\Common\GPM\Response; use Grav\Common\GPM\Upgrader; use Grav\Common\Grav; use Grav\Console\GpmCommand; diff --git a/system/src/Grav/Console/Gpm/UninstallCommand.php b/system/src/Grav/Console/Gpm/UninstallCommand.php index a3db657..33f86a3 100644 --- a/system/src/Grav/Console/Gpm/UninstallCommand.php +++ b/system/src/Grav/Console/Gpm/UninstallCommand.php @@ -3,7 +3,7 @@ /** * @package Grav\Console\Gpm * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Gpm/UpdateCommand.php b/system/src/Grav/Console/Gpm/UpdateCommand.php index 73c5c9e..bd92c54 100644 --- a/system/src/Grav/Console/Gpm/UpdateCommand.php +++ b/system/src/Grav/Console/Gpm/UpdateCommand.php @@ -3,7 +3,7 @@ /** * @package Grav\Console\Gpm * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Gpm/VersionCommand.php b/system/src/Grav/Console/Gpm/VersionCommand.php index 8629196..0bc83e4 100644 --- a/system/src/Grav/Console/Gpm/VersionCommand.php +++ b/system/src/Grav/Console/Gpm/VersionCommand.php @@ -3,7 +3,7 @@ /** * @package Grav\Console\Gpm * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/GpmCommand.php b/system/src/Grav/Console/GpmCommand.php index a14eb47..2a64dbd 100644 --- a/system/src/Grav/Console/GpmCommand.php +++ b/system/src/Grav/Console/GpmCommand.php @@ -3,7 +3,7 @@ /** * @package Grav\Console * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/GravCommand.php b/system/src/Grav/Console/GravCommand.php index 7db18e2..9d7e2f4 100644 --- a/system/src/Grav/Console/GravCommand.php +++ b/system/src/Grav/Console/GravCommand.php @@ -3,7 +3,7 @@ /** * @package Grav\Console * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Plugin/PluginListCommand.php b/system/src/Grav/Console/Plugin/PluginListCommand.php index 0226614..0e8baf7 100644 --- a/system/src/Grav/Console/Plugin/PluginListCommand.php +++ b/system/src/Grav/Console/Plugin/PluginListCommand.php @@ -3,7 +3,7 @@ /** * @package Grav\Console\Plugin * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/TerminalObjects/Table.php b/system/src/Grav/Console/TerminalObjects/Table.php index 153993d..b741bd4 100644 --- a/system/src/Grav/Console/TerminalObjects/Table.php +++ b/system/src/Grav/Console/TerminalObjects/Table.php @@ -3,7 +3,7 @@ /** * @package Grav\Console\TerminalObjects * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Events/BeforeSessionStartEvent.php b/system/src/Grav/Events/BeforeSessionStartEvent.php new file mode 100644 index 0000000..ef6037c --- /dev/null +++ b/system/src/Grav/Events/BeforeSessionStartEvent.php @@ -0,0 +1,36 @@ +start() right before session_start() call. + * + * @property SessionInterface $session Session instance. + */ +class BeforeSessionStartEvent extends Event +{ + /** @var SessionInterface */ + public $session; + + public function __construct(SessionInterface $session) + { + $this->session = $session; + } + + public function __debugInfo(): array + { + return (array)$this; + } +} diff --git a/system/src/Grav/Events/FlexRegisterEvent.php b/system/src/Grav/Events/FlexRegisterEvent.php index b02ed1d..3d4d3c7 100644 --- a/system/src/Grav/Events/FlexRegisterEvent.php +++ b/system/src/Grav/Events/FlexRegisterEvent.php @@ -3,7 +3,7 @@ /** * @package Grav\Events * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Events/PermissionsRegisterEvent.php b/system/src/Grav/Events/PermissionsRegisterEvent.php index 434dcfa..7120a3a 100644 --- a/system/src/Grav/Events/PermissionsRegisterEvent.php +++ b/system/src/Grav/Events/PermissionsRegisterEvent.php @@ -3,7 +3,7 @@ /** * @package Grav\Events * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Events/PluginsLoadedEvent.php b/system/src/Grav/Events/PluginsLoadedEvent.php index 13e2226..41adf4c 100644 --- a/system/src/Grav/Events/PluginsLoadedEvent.php +++ b/system/src/Grav/Events/PluginsLoadedEvent.php @@ -3,7 +3,7 @@ /** * @package Grav\Events * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Events/SessionStartEvent.php b/system/src/Grav/Events/SessionStartEvent.php index fc4f364..94a1820 100644 --- a/system/src/Grav/Events/SessionStartEvent.php +++ b/system/src/Grav/Events/SessionStartEvent.php @@ -3,7 +3,7 @@ /** * @package Grav\Events * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Acl/Access.php b/system/src/Grav/Framework/Acl/Access.php index 45cf2bf..8708e63 100644 --- a/system/src/Grav/Framework/Acl/Access.php +++ b/system/src/Grav/Framework/Acl/Access.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Acl * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Acl/Action.php b/system/src/Grav/Framework/Acl/Action.php index 6251c3c..3160a10 100644 --- a/system/src/Grav/Framework/Acl/Action.php +++ b/system/src/Grav/Framework/Acl/Action.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Acl * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Acl/Permissions.php b/system/src/Grav/Framework/Acl/Permissions.php index e54590a..db26820 100644 --- a/system/src/Grav/Framework/Acl/Permissions.php +++ b/system/src/Grav/Framework/Acl/Permissions.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Acl * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Acl/PermissionsReader.php b/system/src/Grav/Framework/Acl/PermissionsReader.php index 350fc96..f2214f6 100644 --- a/system/src/Grav/Framework/Acl/PermissionsReader.php +++ b/system/src/Grav/Framework/Acl/PermissionsReader.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Acl * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Acl/RecursiveActionIterator.php b/system/src/Grav/Framework/Acl/RecursiveActionIterator.php index 1fb9a60..cbde180 100644 --- a/system/src/Grav/Framework/Acl/RecursiveActionIterator.php +++ b/system/src/Grav/Framework/Acl/RecursiveActionIterator.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Acl * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Cache/AbstractCache.php b/system/src/Grav/Framework/Cache/AbstractCache.php index b6d00a3..978a1b6 100644 --- a/system/src/Grav/Framework/Cache/AbstractCache.php +++ b/system/src/Grav/Framework/Cache/AbstractCache.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Cache * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Cache/Adapter/ChainCache.php b/system/src/Grav/Framework/Cache/Adapter/ChainCache.php index bca940f..a0a8193 100644 --- a/system/src/Grav/Framework/Cache/Adapter/ChainCache.php +++ b/system/src/Grav/Framework/Cache/Adapter/ChainCache.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Cache * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Cache/Adapter/DoctrineCache.php b/system/src/Grav/Framework/Cache/Adapter/DoctrineCache.php index 15afed3..b65ec32 100644 --- a/system/src/Grav/Framework/Cache/Adapter/DoctrineCache.php +++ b/system/src/Grav/Framework/Cache/Adapter/DoctrineCache.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Cache * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Cache/Adapter/FileCache.php b/system/src/Grav/Framework/Cache/Adapter/FileCache.php index 7f1d5e7..085528b 100644 --- a/system/src/Grav/Framework/Cache/Adapter/FileCache.php +++ b/system/src/Grav/Framework/Cache/Adapter/FileCache.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Cache * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php b/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php index 21cd89c..d128a68 100644 --- a/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php +++ b/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Cache * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Cache/Adapter/SessionCache.php b/system/src/Grav/Framework/Cache/Adapter/SessionCache.php index 02fe7c9..c5fecaa 100644 --- a/system/src/Grav/Framework/Cache/Adapter/SessionCache.php +++ b/system/src/Grav/Framework/Cache/Adapter/SessionCache.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Cache * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Cache/CacheInterface.php b/system/src/Grav/Framework/Cache/CacheInterface.php index 03dfa7a..9bb8b63 100644 --- a/system/src/Grav/Framework/Cache/CacheInterface.php +++ b/system/src/Grav/Framework/Cache/CacheInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Cache * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Cache/CacheTrait.php b/system/src/Grav/Framework/Cache/CacheTrait.php index 37dd6c9..5a6bb2a 100644 --- a/system/src/Grav/Framework/Cache/CacheTrait.php +++ b/system/src/Grav/Framework/Cache/CacheTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Cache * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -157,9 +157,6 @@ trait CacheTrait $this->validateKeys($keys); $keys = array_unique($keys); $keys = array_combine($keys, $keys); - if (empty($keys)) { - return []; - } $list = $this->doGetMultiple($keys, $this->miss); diff --git a/system/src/Grav/Framework/Cache/Exception/CacheException.php b/system/src/Grav/Framework/Cache/Exception/CacheException.php index db33883..890aac2 100644 --- a/system/src/Grav/Framework/Cache/Exception/CacheException.php +++ b/system/src/Grav/Framework/Cache/Exception/CacheException.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Cache * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Cache/Exception/InvalidArgumentException.php b/system/src/Grav/Framework/Cache/Exception/InvalidArgumentException.php index 70c0418..8c27de7 100644 --- a/system/src/Grav/Framework/Cache/Exception/InvalidArgumentException.php +++ b/system/src/Grav/Framework/Cache/Exception/InvalidArgumentException.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Cache * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Collection/AbstractFileCollection.php b/system/src/Grav/Framework/Collection/AbstractFileCollection.php index 500aea8..08a279d 100644 --- a/system/src/Grav/Framework/Collection/AbstractFileCollection.php +++ b/system/src/Grav/Framework/Collection/AbstractFileCollection.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Collection * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Collection/AbstractIndexCollection.php b/system/src/Grav/Framework/Collection/AbstractIndexCollection.php index 02916d9..de5d7cb 100644 --- a/system/src/Grav/Framework/Collection/AbstractIndexCollection.php +++ b/system/src/Grav/Framework/Collection/AbstractIndexCollection.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Collection * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Collection/AbstractLazyCollection.php b/system/src/Grav/Framework/Collection/AbstractLazyCollection.php index b0a93f5..8f0b981 100644 --- a/system/src/Grav/Framework/Collection/AbstractLazyCollection.php +++ b/system/src/Grav/Framework/Collection/AbstractLazyCollection.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Collection * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Collection/ArrayCollection.php b/system/src/Grav/Framework/Collection/ArrayCollection.php index cad02f2..2826cf6 100644 --- a/system/src/Grav/Framework/Collection/ArrayCollection.php +++ b/system/src/Grav/Framework/Collection/ArrayCollection.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Collection * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Collection/CollectionInterface.php b/system/src/Grav/Framework/Collection/CollectionInterface.php index e098dd6..39e5692 100644 --- a/system/src/Grav/Framework/Collection/CollectionInterface.php +++ b/system/src/Grav/Framework/Collection/CollectionInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Collection * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Collection/FileCollection.php b/system/src/Grav/Framework/Collection/FileCollection.php index bae0e7b..7314a78 100644 --- a/system/src/Grav/Framework/Collection/FileCollection.php +++ b/system/src/Grav/Framework/Collection/FileCollection.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Collection * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Collection/FileCollectionInterface.php b/system/src/Grav/Framework/Collection/FileCollectionInterface.php index 1b56da9..04024d5 100644 --- a/system/src/Grav/Framework/Collection/FileCollectionInterface.php +++ b/system/src/Grav/Framework/Collection/FileCollectionInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Collection * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Compat/Serializable.php b/system/src/Grav/Framework/Compat/Serializable.php index 22e4648..9e81281 100644 --- a/system/src/Grav/Framework/Compat/Serializable.php +++ b/system/src/Grav/Framework/Compat/Serializable.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Compat * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/ContentBlock/ContentBlock.php b/system/src/Grav/Framework/ContentBlock/ContentBlock.php index 7259df0..345e9ba 100644 --- a/system/src/Grav/Framework/ContentBlock/ContentBlock.php +++ b/system/src/Grav/Framework/ContentBlock/ContentBlock.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\ContentBlock * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/ContentBlock/ContentBlockInterface.php b/system/src/Grav/Framework/ContentBlock/ContentBlockInterface.php index bb0e46f..74d6cbd 100644 --- a/system/src/Grav/Framework/ContentBlock/ContentBlockInterface.php +++ b/system/src/Grav/Framework/ContentBlock/ContentBlockInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\ContentBlock * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/ContentBlock/HtmlBlock.php b/system/src/Grav/Framework/ContentBlock/HtmlBlock.php index 69d417c..dfeb924 100644 --- a/system/src/Grav/Framework/ContentBlock/HtmlBlock.php +++ b/system/src/Grav/Framework/ContentBlock/HtmlBlock.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\ContentBlock * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/ContentBlock/HtmlBlockInterface.php b/system/src/Grav/Framework/ContentBlock/HtmlBlockInterface.php index b151d7b..2191d67 100644 --- a/system/src/Grav/Framework/ContentBlock/HtmlBlockInterface.php +++ b/system/src/Grav/Framework/ContentBlock/HtmlBlockInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\ContentBlock * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Contracts/Media/MediaObjectInterface.php b/system/src/Grav/Framework/Contracts/Media/MediaObjectInterface.php new file mode 100644 index 0000000..75b80f0 --- /dev/null +++ b/system/src/Grav/Framework/Contracts/Media/MediaObjectInterface.php @@ -0,0 +1,52 @@ +|ArrayAccess + * @phpstan-pure + */ + public function getIdentifierMeta(); +} diff --git a/system/src/Grav/Framework/Contracts/Relationships/RelationshipInterface.php b/system/src/Grav/Framework/Contracts/Relationships/RelationshipInterface.php new file mode 100644 index 0000000..c0a7edf --- /dev/null +++ b/system/src/Grav/Framework/Contracts/Relationships/RelationshipInterface.php @@ -0,0 +1,81 @@ + + */ +interface RelationshipInterface extends Countable, IteratorAggregate, JsonSerializable, Serializable +{ + /** + * @return string + * @phpstan-pure + */ + public function getName(): string; + + /** + * @return string + * @phpstan-pure + */ + public function getType(): string; + + /** + * @return bool + * @phpstan-pure + */ + public function isModified(): bool; + + /** + * @return string + * @phpstan-pure + */ + public function getCardinality(): string; + + /** + * @return P + * @phpstan-pure + */ + public function getParent(): IdentifierInterface; + + /** + * @param string $id + * @param string|null $type + * @return bool + * @phpstan-pure + */ + public function has(string $id, string $type = null): bool; + + /** + * @param T $identifier + * @return bool + * @phpstan-pure + */ + public function hasIdentifier(IdentifierInterface $identifier): bool; + + /** + * @param T $identifier + * @return bool + */ + public function addIdentifier(IdentifierInterface $identifier): bool; + + /** + * @param T|null $identifier + * @return bool + */ + public function removeIdentifier(IdentifierInterface $identifier = null): bool; + + /** + * @return iterable + */ + public function getIterator(): iterable; +} diff --git a/system/src/Grav/Framework/Contracts/Relationships/RelationshipsInterface.php b/system/src/Grav/Framework/Contracts/Relationships/RelationshipsInterface.php new file mode 100644 index 0000000..4bd90a3 --- /dev/null +++ b/system/src/Grav/Framework/Contracts/Relationships/RelationshipsInterface.php @@ -0,0 +1,53 @@ +> + * @extends Iterator> + */ +interface RelationshipsInterface extends Countable, ArrayAccess, Iterator, JsonSerializable +{ + /** + * @return bool + * @phpstan-pure + */ + public function isModified(): bool; + + /** + * @return array + */ + public function getModified(): array; + + /** + * @return int + * @phpstan-pure + */ + public function count(): int; + + /** + * @param string $offset + * @return RelationshipInterface|null + */ + public function offsetGet($offset): ?RelationshipInterface; + + /** + * @return RelationshipInterface|null + */ + public function current(): ?RelationshipInterface; + + /** + * @return string + * @phpstan-pure + */ + public function key(): string; +} diff --git a/system/src/Grav/Framework/Contracts/Relationships/ToManyRelationshipInterface.php b/system/src/Grav/Framework/Contracts/Relationships/ToManyRelationshipInterface.php new file mode 100644 index 0000000..723bef6 --- /dev/null +++ b/system/src/Grav/Framework/Contracts/Relationships/ToManyRelationshipInterface.php @@ -0,0 +1,55 @@ + + */ +interface ToManyRelationshipInterface extends RelationshipInterface +{ + /** + * @param positive-int $pos + * @return IdentifierInterface|null + */ + public function getNthIdentifier(int $pos): ?IdentifierInterface; + + /** + * @param string $id + * @param string|null $type + * @return T|null + * @phpstan-pure + */ + public function getIdentifier(string $id, string $type = null): ?IdentifierInterface; + + /** + * @param string $id + * @param string|null $type + * @return T|null + * @phpstan-pure + */ + public function getObject(string $id, string $type = null): ?object; + + /** + * @param iterable $identifiers + * @return bool + */ + public function addIdentifiers(iterable $identifiers): bool; + + /** + * @param iterable $identifiers + * @return bool + */ + public function replaceIdentifiers(iterable $identifiers): bool; + + /** + * @param iterable $identifiers + * @return bool + */ + public function removeIdentifiers(iterable $identifiers): bool; +} diff --git a/system/src/Grav/Framework/Contracts/Relationships/ToOneRelationshipInterface.php b/system/src/Grav/Framework/Contracts/Relationships/ToOneRelationshipInterface.php new file mode 100644 index 0000000..0e6aeb9 --- /dev/null +++ b/system/src/Grav/Framework/Contracts/Relationships/ToOneRelationshipInterface.php @@ -0,0 +1,37 @@ + + */ +interface ToOneRelationshipInterface extends RelationshipInterface +{ + /** + * @param string|null $id + * @param string|null $type + * @return T|null + * @phpstan-pure + */ + public function getIdentifier(string $id = null, string $type = null): ?IdentifierInterface; + + /** + * @param string|null $id + * @param string|null $type + * @return T|null + * @phpstan-pure + */ + public function getObject(string $id = null, string $type = null): ?object; + + /** + * @param T|null $identifier + * @return bool + */ + public function replaceIdentifier(IdentifierInterface $identifier = null): bool; +} diff --git a/system/src/Grav/Framework/Controller/Traits/ControllerResponseTrait.php b/system/src/Grav/Framework/Controller/Traits/ControllerResponseTrait.php index 24e1fc2..3063de5 100644 --- a/system/src/Grav/Framework/Controller/Traits/ControllerResponseTrait.php +++ b/system/src/Grav/Framework/Controller/Traits/ControllerResponseTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Controller * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/DI/Container.php b/system/src/Grav/Framework/DI/Container.php index dde0da3..1b071bb 100644 --- a/system/src/Grav/Framework/DI/Container.php +++ b/system/src/Grav/Framework/DI/Container.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\DI * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/File/AbstractFile.php b/system/src/Grav/Framework/File/AbstractFile.php index b216ea6..105f98a 100644 --- a/system/src/Grav/Framework/File/AbstractFile.php +++ b/system/src/Grav/Framework/File/AbstractFile.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\File * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/File/CsvFile.php b/system/src/Grav/Framework/File/CsvFile.php index 7eba91e..2468ccc 100644 --- a/system/src/Grav/Framework/File/CsvFile.php +++ b/system/src/Grav/Framework/File/CsvFile.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\File * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/File/DataFile.php b/system/src/Grav/Framework/File/DataFile.php index 189db53..4f51830 100644 --- a/system/src/Grav/Framework/File/DataFile.php +++ b/system/src/Grav/Framework/File/DataFile.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\File * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/File/File.php b/system/src/Grav/Framework/File/File.php index b1a1c4f..73f841c 100644 --- a/system/src/Grav/Framework/File/File.php +++ b/system/src/Grav/Framework/File/File.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\File * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/File/Formatter/AbstractFormatter.php b/system/src/Grav/Framework/File/Formatter/AbstractFormatter.php index 6a6981b..87bfce7 100644 --- a/system/src/Grav/Framework/File/Formatter/AbstractFormatter.php +++ b/system/src/Grav/Framework/File/Formatter/AbstractFormatter.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\File\Formatter * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/File/Formatter/CsvFormatter.php b/system/src/Grav/Framework/File/Formatter/CsvFormatter.php index 37ab5bb..72ff7a8 100644 --- a/system/src/Grav/Framework/File/Formatter/CsvFormatter.php +++ b/system/src/Grav/Framework/File/Formatter/CsvFormatter.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\File\Formatter * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/File/Formatter/IniFormatter.php b/system/src/Grav/Framework/File/Formatter/IniFormatter.php index ecf67d1..a41a060 100644 --- a/system/src/Grav/Framework/File/Formatter/IniFormatter.php +++ b/system/src/Grav/Framework/File/Formatter/IniFormatter.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\File\Formatter * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/File/Formatter/JsonFormatter.php b/system/src/Grav/Framework/File/Formatter/JsonFormatter.php index 2bd6c79..32b06ef 100644 --- a/system/src/Grav/Framework/File/Formatter/JsonFormatter.php +++ b/system/src/Grav/Framework/File/Formatter/JsonFormatter.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\File\Formatter * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/File/Formatter/MarkdownFormatter.php b/system/src/Grav/Framework/File/Formatter/MarkdownFormatter.php index e36276a..00ba879 100644 --- a/system/src/Grav/Framework/File/Formatter/MarkdownFormatter.php +++ b/system/src/Grav/Framework/File/Formatter/MarkdownFormatter.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\File\Formatter * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/File/Formatter/SerializeFormatter.php b/system/src/Grav/Framework/File/Formatter/SerializeFormatter.php index 25aee81..8feafcf 100644 --- a/system/src/Grav/Framework/File/Formatter/SerializeFormatter.php +++ b/system/src/Grav/Framework/File/Formatter/SerializeFormatter.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\File\Formatter * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/File/Formatter/YamlFormatter.php b/system/src/Grav/Framework/File/Formatter/YamlFormatter.php index 31aff2c..0aa9691 100644 --- a/system/src/Grav/Framework/File/Formatter/YamlFormatter.php +++ b/system/src/Grav/Framework/File/Formatter/YamlFormatter.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\File\Formatter * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/File/IniFile.php b/system/src/Grav/Framework/File/IniFile.php index 0807ee3..4da83e9 100644 --- a/system/src/Grav/Framework/File/IniFile.php +++ b/system/src/Grav/Framework/File/IniFile.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\File * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/File/Interfaces/FileFormatterInterface.php b/system/src/Grav/Framework/File/Interfaces/FileFormatterInterface.php index 78714af..79c55fd 100644 --- a/system/src/Grav/Framework/File/Interfaces/FileFormatterInterface.php +++ b/system/src/Grav/Framework/File/Interfaces/FileFormatterInterface.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\File * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/File/Interfaces/FileInterface.php b/system/src/Grav/Framework/File/Interfaces/FileInterface.php index f2cc288..02d376b 100644 --- a/system/src/Grav/Framework/File/Interfaces/FileInterface.php +++ b/system/src/Grav/Framework/File/Interfaces/FileInterface.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\File * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/File/JsonFile.php b/system/src/Grav/Framework/File/JsonFile.php index 7751e84..89af083 100644 --- a/system/src/Grav/Framework/File/JsonFile.php +++ b/system/src/Grav/Framework/File/JsonFile.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\File * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/File/MarkdownFile.php b/system/src/Grav/Framework/File/MarkdownFile.php index a79d5ce..bcabf41 100644 --- a/system/src/Grav/Framework/File/MarkdownFile.php +++ b/system/src/Grav/Framework/File/MarkdownFile.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\File * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/File/YamlFile.php b/system/src/Grav/Framework/File/YamlFile.php index c4300ad..97d5a70 100644 --- a/system/src/Grav/Framework/File/YamlFile.php +++ b/system/src/Grav/Framework/File/YamlFile.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\File * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Filesystem/Filesystem.php b/system/src/Grav/Framework/Filesystem/Filesystem.php index ddbbab0..79de64c 100644 --- a/system/src/Grav/Framework/Filesystem/Filesystem.php +++ b/system/src/Grav/Framework/Filesystem/Filesystem.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Filesystem * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Filesystem/Interfaces/FilesystemInterface.php b/system/src/Grav/Framework/Filesystem/Interfaces/FilesystemInterface.php index 4006c8f..98da126 100644 --- a/system/src/Grav/Framework/Filesystem/Interfaces/FilesystemInterface.php +++ b/system/src/Grav/Framework/Filesystem/Interfaces/FilesystemInterface.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Filesystem * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Flex.php b/system/src/Grav/Framework/Flex/Flex.php index 4d662d1..34c05f1 100644 --- a/system/src/Grav/Framework/Flex/Flex.php +++ b/system/src/Grav/Framework/Flex/Flex.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/FlexCollection.php b/system/src/Grav/Framework/Flex/FlexCollection.php index 186c60a..373758c 100644 --- a/system/src/Grav/Framework/Flex/FlexCollection.php +++ b/system/src/Grav/Framework/Flex/FlexCollection.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -147,6 +147,10 @@ class FlexCollection extends ObjectCollection implements FlexCollectionInterface */ public function search(string $search, $properties = null, array $options = null) { + $directory = $this->getFlexDirectory(); + $properties = $directory->getSearchProperties($properties); + $options = $directory->getSearchOptions($options); + $matching = $this->call('search', [$search, $properties, $options]); $matching = array_filter($matching); diff --git a/system/src/Grav/Framework/Flex/FlexDirectory.php b/system/src/Grav/Framework/Flex/FlexDirectory.php index f96633b..4fcf917 100644 --- a/system/src/Grav/Framework/Flex/FlexDirectory.php +++ b/system/src/Grav/Framework/Flex/FlexDirectory.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -170,6 +170,44 @@ class FlexDirectory implements FlexDirectoryInterface return null === $name ? $this->config : $this->config->get($name, $default); } + /** + * @param string|string[]|null $properties + * @return array + */ + public function getSearchProperties($properties = null): array + { + if (null !== $properties) { + return (array)$properties; + } + + $properties = $this->getConfig('data.search.fields'); + if (!$properties) { + $fields = $this->getConfig('admin.views.list.fields') ?? $this->getConfig('admin.list.fields', []); + foreach ($fields as $property => $value) { + if (!empty($value['link'])) { + $properties[] = $property; + } + } + } + + return $properties; + } + + /** + * @param array|null $options + * @return array + */ + public function getSearchOptions(array $options = null): array + { + if (empty($options['merge'])) { + return $options ?? (array)$this->getConfig('data.search.options'); + } + + unset($options['merge']); + + return $options + (array)$this->getConfig('data.search.options'); + } + /** * @param string|null $name * @param array $options @@ -750,6 +788,7 @@ class FlexDirectory implements FlexDirectoryInterface public function reloadIndex(): void { $this->getCache('index')->clear(); + $this->getIndex()::loadEntriesFromStorage($this->getStorage()); $this->indexes = []; $this->objects = []; @@ -797,6 +836,9 @@ class FlexDirectory implements FlexDirectoryInterface $blueprint->addDynamicHandler('flex', function (array &$field, $property, array &$call) { $this->dynamicFlexField($field, $property, $call); }); + $blueprint->addDynamicHandler('authorize', function (array &$field, $property, array &$call) { + $this->dynamicAuthorizeField($field, $property, $call); + }); if ($context) { $blueprint->setContext($context); @@ -878,6 +920,40 @@ class FlexDirectory implements FlexDirectoryInterface if (is_array($value) && isset($field[$property]) && is_array($field[$property])) { $value = $this->mergeArrays($field[$property], $value); } + $value = $not ? !$value : $value; + + if ($property === 'ignore' && $value) { + Blueprint::addPropertyRecursive($field, 'validate', ['ignore' => true]); + } else { + $field[$property] = $value; + } + } + } + + /** + * @param array $field + * @param string $property + * @param array $call + * @return void + */ + protected function dynamicAuthorizeField(array &$field, $property, array $call): void + { + $params = (array)$call['params']; + $object = $call['object'] ?? null; + $permission = array_shift($params); + $not = false; + if (str_starts_with($permission, '!')) { + $permission = substr($permission, 1); + $not = true; + } elseif (str_starts_with($permission, 'not ')) { + $permission = substr($permission, 4); + $not = true; + } + $permission = trim($permission); + + if ($object) { + $value = $object->isAuthorized($permission) ?? false; + $field[$property] = $not ? !$value : $value; } } diff --git a/system/src/Grav/Framework/Flex/FlexDirectoryForm.php b/system/src/Grav/Framework/Flex/FlexDirectoryForm.php index 709f418..52835c0 100644 --- a/system/src/Grav/Framework/Flex/FlexDirectoryForm.php +++ b/system/src/Grav/Framework/Flex/FlexDirectoryForm.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -275,6 +275,7 @@ class FlexDirectoryForm implements FlexDirectoryFormInterface, JsonSerializable 'unique_id' => $this->getUniqueId(), 'form_name' => $this->getName(), 'folder' => $this->getFlashFolder(), + 'id' => $this->getFlashId(), 'directory' => $this->getDirectory() ]; diff --git a/system/src/Grav/Framework/Flex/FlexForm.php b/system/src/Grav/Framework/Flex/FlexForm.php index a1263f6..0cefc7f 100644 --- a/system/src/Grav/Framework/Flex/FlexForm.php +++ b/system/src/Grav/Framework/Flex/FlexForm.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -326,6 +326,7 @@ class FlexForm implements FlexObjectFormInterface, JsonSerializable 'unique_id' => $this->getUniqueId(), 'form_name' => $this->getName(), 'folder' => $this->getFlashFolder(), + 'id' => $this->getFlashId(), 'object' => $this->getObject() ]; diff --git a/system/src/Grav/Framework/Flex/FlexFormFlash.php b/system/src/Grav/Framework/Flex/FlexFormFlash.php index 3f52cdb..95feee9 100644 --- a/system/src/Grav/Framework/Flex/FlexFormFlash.php +++ b/system/src/Grav/Framework/Flex/FlexFormFlash.php @@ -3,7 +3,7 @@ /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/FlexIdentifier.php b/system/src/Grav/Framework/Flex/FlexIdentifier.php new file mode 100644 index 0000000..ec47ed8 --- /dev/null +++ b/system/src/Grav/Framework/Flex/FlexIdentifier.php @@ -0,0 +1,75 @@ + + */ +class FlexIdentifier extends Identifier +{ + /** @var string */ + private $keyField; + /** @var FlexObjectInterface|null */ + private $object = null; + + /** + * @param FlexObjectInterface $object + * @return FlexIdentifier + */ + public static function createFromObject(FlexObjectInterface $object): FlexIdentifier + { + $instance = new static($object->getKey(), $object->getFlexType(), 'key'); + $instance->setObject($object); + + return $instance; + } + + /** + * IdentifierInterface constructor. + * @param string $id + * @param string $type + * @param string $keyField + */ + public function __construct(string $id, string $type, string $keyField = 'key') + { + parent::__construct($id, $type); + + $this->keyField = $keyField; + } + + /** + * @return T + */ + public function getObject(): ?FlexObjectInterface + { + if (!isset($this->object)) { + /** @var Flex $flex */ + $flex = Grav::instance()['flex']; + + $this->object = $flex->getObject($this->getId(), $this->getType(), $this->keyField); + } + + return $this->object; + } + + /** + * @param T $object + */ + public function setObject(FlexObjectInterface $object): void + { + $type = $this->getType(); + if ($type !== $object->getFlexType()) { + throw new RuntimeException(sprintf('Object has to be type %s, %s given', $type, $object->getFlexType())); + } + + $this->object = $object; + } +} diff --git a/system/src/Grav/Framework/Flex/FlexIndex.php b/system/src/Grav/Framework/Flex/FlexIndex.php index 54438af..612ef42 100644 --- a/system/src/Grav/Framework/Flex/FlexIndex.php +++ b/system/src/Grav/Framework/Flex/FlexIndex.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -162,6 +162,10 @@ class FlexIndex extends ObjectIndex implements FlexIndexInterface */ public function search(string $search, $properties = null, array $options = null) { + $directory = $this->getFlexDirectory(); + $properties = $directory->getSearchProperties($properties); + $options = $directory->getSearchOptions($options); + return $this->__call('search', [$search, $properties, $options]); } diff --git a/system/src/Grav/Framework/Flex/FlexObject.php b/system/src/Grav/Framework/Flex/FlexObject.php index afc656c..2450e4e 100644 --- a/system/src/Grav/Framework/Flex/FlexObject.php +++ b/system/src/Grav/Framework/Flex/FlexObject.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -287,17 +287,9 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface */ public function search(string $search, $properties = null, array $options = null): float { - $properties = (array)($properties ?? $this->getFlexDirectory()->getConfig('data.search.fields')); - if (!$properties) { - $fields = $this->getFlexDirectory()->getConfig('admin.views.list.fields') ?? $this->getFlexDirectory()->getConfig('admin.list.fields', []); - foreach ($fields as $property => $value) { - if (!empty($value['link'])) { - $properties[] = $property; - } - } - } - - $options = $options ?? (array)$this->getFlexDirectory()->getConfig('data.search.options'); + $directory = $this->getFlexDirectory(); + $properties = $directory->getSearchProperties($properties); + $options = $directory->getSearchOptions($options); $weight = 0; foreach ($properties as $property) { diff --git a/system/src/Grav/Framework/Flex/Interfaces/FlexAuthorizeInterface.php b/system/src/Grav/Framework/Flex/Interfaces/FlexAuthorizeInterface.php index c1025a4..965bf62 100644 --- a/system/src/Grav/Framework/Flex/Interfaces/FlexAuthorizeInterface.php +++ b/system/src/Grav/Framework/Flex/Interfaces/FlexAuthorizeInterface.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Interfaces/FlexCollectionInterface.php b/system/src/Grav/Framework/Flex/Interfaces/FlexCollectionInterface.php index d14b69f..cd29c1b 100644 --- a/system/src/Grav/Framework/Flex/Interfaces/FlexCollectionInterface.php +++ b/system/src/Grav/Framework/Flex/Interfaces/FlexCollectionInterface.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Interfaces/FlexCommonInterface.php b/system/src/Grav/Framework/Flex/Interfaces/FlexCommonInterface.php index 7c1975f..e86c371 100644 --- a/system/src/Grav/Framework/Flex/Interfaces/FlexCommonInterface.php +++ b/system/src/Grav/Framework/Flex/Interfaces/FlexCommonInterface.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Interfaces/FlexDirectoryFormInterface.php b/system/src/Grav/Framework/Flex/Interfaces/FlexDirectoryFormInterface.php index 203c766..d7c6814 100644 --- a/system/src/Grav/Framework/Flex/Interfaces/FlexDirectoryFormInterface.php +++ b/system/src/Grav/Framework/Flex/Interfaces/FlexDirectoryFormInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Interfaces/FlexDirectoryInterface.php b/system/src/Grav/Framework/Flex/Interfaces/FlexDirectoryInterface.php index a77df95..cd8f256 100644 --- a/system/src/Grav/Framework/Flex/Interfaces/FlexDirectoryInterface.php +++ b/system/src/Grav/Framework/Flex/Interfaces/FlexDirectoryInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Interfaces/FlexFormInterface.php b/system/src/Grav/Framework/Flex/Interfaces/FlexFormInterface.php index ba9996a..2c778ef 100644 --- a/system/src/Grav/Framework/Flex/Interfaces/FlexFormInterface.php +++ b/system/src/Grav/Framework/Flex/Interfaces/FlexFormInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Interfaces/FlexIndexInterface.php b/system/src/Grav/Framework/Flex/Interfaces/FlexIndexInterface.php index d8f8ba3..5dc8f4b 100644 --- a/system/src/Grav/Framework/Flex/Interfaces/FlexIndexInterface.php +++ b/system/src/Grav/Framework/Flex/Interfaces/FlexIndexInterface.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Interfaces/FlexInterface.php b/system/src/Grav/Framework/Flex/Interfaces/FlexInterface.php index f1376a5..0c04636 100644 --- a/system/src/Grav/Framework/Flex/Interfaces/FlexInterface.php +++ b/system/src/Grav/Framework/Flex/Interfaces/FlexInterface.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Interfaces/FlexObjectFormInterface.php b/system/src/Grav/Framework/Flex/Interfaces/FlexObjectFormInterface.php index 190a963..f3c29f7 100644 --- a/system/src/Grav/Framework/Flex/Interfaces/FlexObjectFormInterface.php +++ b/system/src/Grav/Framework/Flex/Interfaces/FlexObjectFormInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Interfaces/FlexObjectInterface.php b/system/src/Grav/Framework/Flex/Interfaces/FlexObjectInterface.php index d02bc8b..c4670b1 100644 --- a/system/src/Grav/Framework/Flex/Interfaces/FlexObjectInterface.php +++ b/system/src/Grav/Framework/Flex/Interfaces/FlexObjectInterface.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Interfaces/FlexStorageInterface.php b/system/src/Grav/Framework/Flex/Interfaces/FlexStorageInterface.php index 4209924..e5158d7 100644 --- a/system/src/Grav/Framework/Flex/Interfaces/FlexStorageInterface.php +++ b/system/src/Grav/Framework/Flex/Interfaces/FlexStorageInterface.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Interfaces/FlexTranslateInterface.php b/system/src/Grav/Framework/Flex/Interfaces/FlexTranslateInterface.php index 8df11fa..93ac932 100644 --- a/system/src/Grav/Framework/Flex/Interfaces/FlexTranslateInterface.php +++ b/system/src/Grav/Framework/Flex/Interfaces/FlexTranslateInterface.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Pages/FlexPageCollection.php b/system/src/Grav/Framework/Flex/Pages/FlexPageCollection.php index 5901557..356c113 100644 --- a/system/src/Grav/Framework/Flex/Pages/FlexPageCollection.php +++ b/system/src/Grav/Framework/Flex/Pages/FlexPageCollection.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Pages/FlexPageIndex.php b/system/src/Grav/Framework/Flex/Pages/FlexPageIndex.php index 5bb5517..54ebeaf 100644 --- a/system/src/Grav/Framework/Flex/Pages/FlexPageIndex.php +++ b/system/src/Grav/Framework/Flex/Pages/FlexPageIndex.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Pages/FlexPageObject.php b/system/src/Grav/Framework/Flex/Pages/FlexPageObject.php index e700424..ea8694b 100644 --- a/system/src/Grav/Framework/Flex/Pages/FlexPageObject.php +++ b/system/src/Grav/Framework/Flex/Pages/FlexPageObject.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Pages/Traits/PageAuthorsTrait.php b/system/src/Grav/Framework/Flex/Pages/Traits/PageAuthorsTrait.php index d0934e1..d7d47f1 100644 --- a/system/src/Grav/Framework/Flex/Pages/Traits/PageAuthorsTrait.php +++ b/system/src/Grav/Framework/Flex/Pages/Traits/PageAuthorsTrait.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Pages/Traits/PageContentTrait.php b/system/src/Grav/Framework/Flex/Pages/Traits/PageContentTrait.php index 43dfee1..bdda602 100644 --- a/system/src/Grav/Framework/Flex/Pages/Traits/PageContentTrait.php +++ b/system/src/Grav/Framework/Flex/Pages/Traits/PageContentTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Pages/Traits/PageLegacyTrait.php b/system/src/Grav/Framework/Flex/Pages/Traits/PageLegacyTrait.php index d753803..a36b9f0 100644 --- a/system/src/Grav/Framework/Flex/Pages/Traits/PageLegacyTrait.php +++ b/system/src/Grav/Framework/Flex/Pages/Traits/PageLegacyTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Pages/Traits/PageRoutableTrait.php b/system/src/Grav/Framework/Flex/Pages/Traits/PageRoutableTrait.php index c4c8cd7..9161bc8 100644 --- a/system/src/Grav/Framework/Flex/Pages/Traits/PageRoutableTrait.php +++ b/system/src/Grav/Framework/Flex/Pages/Traits/PageRoutableTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Pages/Traits/PageTranslateTrait.php b/system/src/Grav/Framework/Flex/Pages/Traits/PageTranslateTrait.php index 4bec685..726dc4b 100644 --- a/system/src/Grav/Framework/Flex/Pages/Traits/PageTranslateTrait.php +++ b/system/src/Grav/Framework/Flex/Pages/Traits/PageTranslateTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Storage/AbstractFilesystemStorage.php b/system/src/Grav/Framework/Flex/Storage/AbstractFilesystemStorage.php index ee04c51..237ca52 100644 --- a/system/src/Grav/Framework/Flex/Storage/AbstractFilesystemStorage.php +++ b/system/src/Grav/Framework/Flex/Storage/AbstractFilesystemStorage.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Storage/FileStorage.php b/system/src/Grav/Framework/Flex/Storage/FileStorage.php index 1864439..ae444a5 100644 --- a/system/src/Grav/Framework/Flex/Storage/FileStorage.php +++ b/system/src/Grav/Framework/Flex/Storage/FileStorage.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Storage/FolderStorage.php b/system/src/Grav/Framework/Flex/Storage/FolderStorage.php index 600e989..70ba66f 100644 --- a/system/src/Grav/Framework/Flex/Storage/FolderStorage.php +++ b/system/src/Grav/Framework/Flex/Storage/FolderStorage.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Storage/SimpleStorage.php b/system/src/Grav/Framework/Flex/Storage/SimpleStorage.php index 73e2b06..9c448d1 100644 --- a/system/src/Grav/Framework/Flex/Storage/SimpleStorage.php +++ b/system/src/Grav/Framework/Flex/Storage/SimpleStorage.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Traits/FlexAuthorizeTrait.php b/system/src/Grav/Framework/Flex/Traits/FlexAuthorizeTrait.php index ef4c433..7b1240d 100644 --- a/system/src/Grav/Framework/Flex/Traits/FlexAuthorizeTrait.php +++ b/system/src/Grav/Framework/Flex/Traits/FlexAuthorizeTrait.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Traits/FlexMediaTrait.php b/system/src/Grav/Framework/Flex/Traits/FlexMediaTrait.php index ad437eb..6c69d20 100644 --- a/system/src/Grav/Framework/Flex/Traits/FlexMediaTrait.php +++ b/system/src/Grav/Framework/Flex/Traits/FlexMediaTrait.php @@ -5,7 +5,7 @@ namespace Grav\Framework\Flex\Traits; /** * @package Grav\Framework\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -22,6 +22,9 @@ use Grav\Framework\Cache\CacheInterface; use Grav\Framework\Filesystem\Filesystem; use Grav\Framework\Flex\FlexDirectory; use Grav\Framework\Form\FormFlashFile; +use Grav\Framework\Media\Interfaces\MediaObjectInterface; +use Grav\Framework\Media\MediaObject; +use Grav\Framework\Media\UploadedMediaObject; use Psr\Http\Message\UploadedFileInterface; use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator; use RuntimeException; @@ -30,7 +33,6 @@ use function in_array; use function is_array; use function is_callable; use function is_int; -use function is_object; use function is_string; use function strpos; @@ -297,6 +299,55 @@ trait FlexMediaTrait ]; } + /** + * @param string|null $field + * @param string $filename + * @param MediaObjectInterface|null $image + * @return MediaObject|UploadedMediaObject + */ + protected function buildMediaObject(?string $field, string $filename, MediaObjectInterface $image = null) + { + if (!$image) { + $media = $field ? $this->getMediaField($field) : null; + if ($media) { + $image = $media[$filename]; + } + } + + return new MediaObject($field, $filename, $image, $this); + } + + /** + * @param string|null $field + * @return array + */ + protected function buildMediaList(?string $field): array + { + $names = $field ? (array)$this->getNestedProperty($field) : []; + $media = $field ? $this->getMediaField($field) : null; + if (null === $media) { + $media = $this->getMedia(); + } + + $list = []; + foreach ($names as $key => $val) { + $name = is_string($val) ? $val : $key; + $medium = $media[$name]; + if ($medium) { + if ($medium->uploaded_file) { + $upload = $medium->uploaded_file; + $id = $upload instanceof FormFlashFile ? $upload->getId() : "{$field}-{$name}"; + + $list[] = new UploadedMediaObject($id, $field, $name, $upload); + } else { + $list[] = $this->buildMediaObject($field, $name, $medium); + } + } + } + + return $list; + } + /** * @param array $files * @return void @@ -375,7 +426,7 @@ trait FlexMediaTrait $updated = false; foreach ($this->getUpdatedMedia() as $filename => $upload) { if (is_array($upload)) { - // Uses new format with [UploadedFileInterface, array]. + /** @var array{UploadedFileInterface,array} $upload */ $settings = $upload[1]; if (isset($settings['destination']) && $settings['destination'] === $media->getPath()) { $upload = $upload[0]; @@ -388,6 +439,7 @@ trait FlexMediaTrait $updated = true; if ($medium) { $medium->uploaded = true; + $medium->uploaded_file = $upload; $media->add($filename, $medium); } elseif (is_callable([$media, 'hide'])) { $media->hide($filename); diff --git a/system/src/Grav/Framework/Flex/Traits/FlexRelatedDirectoryTrait.php b/system/src/Grav/Framework/Flex/Traits/FlexRelatedDirectoryTrait.php index de98359..7428195 100644 --- a/system/src/Grav/Framework/Flex/Traits/FlexRelatedDirectoryTrait.php +++ b/system/src/Grav/Framework/Flex/Traits/FlexRelatedDirectoryTrait.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Common\Flex * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Flex/Traits/FlexRelationshipsTrait.php b/system/src/Grav/Framework/Flex/Traits/FlexRelationshipsTrait.php new file mode 100644 index 0000000..2a73eba --- /dev/null +++ b/system/src/Grav/Framework/Flex/Traits/FlexRelationshipsTrait.php @@ -0,0 +1,61 @@ +_relationships)) { + $blueprint = $this->getBlueprint(); + $options = $blueprint->get('config/relationships', []); + $parent = FlexIdentifier::createFromObject($this); + + $this->_relationships = new Relationships($parent, $options); + } + + return $this->_relationships; + } + + /** + * @param string $name + * @return RelationshipInterface|null + */ + public function getRelationship(string $name): ?RelationshipInterface + { + return $this->getRelationships()[$name]; + } + + protected function resetRelationships(): void + { + $this->_relationships = null; + } + + /** + * @param iterable $collection + * @return array + */ + protected function buildFlexIdentifierList(iterable $collection): array + { + $list = []; + foreach ($collection as $object) { + $list[] = FlexIdentifier::createFromObject($object); + } + + return $list; + } +} diff --git a/system/src/Grav/Framework/Form/FormFlash.php b/system/src/Grav/Framework/Form/FormFlash.php index 863eb4a..5e22ef7 100644 --- a/system/src/Grav/Framework/Form/FormFlash.php +++ b/system/src/Grav/Framework/Form/FormFlash.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Form * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -31,6 +31,8 @@ class FormFlash implements FormFlashInterface /** @var bool */ protected $exists; /** @var string */ + protected $id; + /** @var string */ protected $sessionId; /** @var string */ protected $uniqueId; @@ -75,9 +77,12 @@ class FormFlash implements FormFlashInterface }); } - $this->sessionId = $config['session_id'] ?? 'no-session'; + $this->id = $config['id'] ?? ''; + $this->sessionId = $config['session_id'] ?? ''; $this->uniqueId = $config['unique_id'] ?? ''; + $this->setUser($config['user'] ?? null); + $folder = $config['folder'] ?? ($this->sessionId ? 'tmp://forms/' . $this->sessionId : ''); /** @var UniformResourceLocator $locator */ @@ -133,6 +138,14 @@ class FormFlash implements FormFlashInterface return $data; } + /** + * @inheritDoc + */ + public function getId(): string + { + return $this->id && $this->uniqueId ? $this->id . '/' . $this->uniqueId : ''; + } + /** * @inheritDoc */ @@ -390,8 +403,8 @@ class FormFlash implements FormFlashInterface */ public function clearFiles() { - foreach ($this->files as $field => $files) { - foreach ($files as $name => $upload) { + foreach ($this->files as $files) { + foreach ($files as $upload) { $this->removeTmpFile($upload['tmp_name'] ?? ''); } } @@ -406,6 +419,7 @@ class FormFlash implements FormFlashInterface { return [ 'form' => $this->formName, + 'id' => $this->getId(), 'unique_id' => $this->uniqueId, 'url' => $this->url, 'user' => $this->user, diff --git a/system/src/Grav/Framework/Form/FormFlashFile.php b/system/src/Grav/Framework/Form/FormFlashFile.php index 65af544..3f96ed8 100644 --- a/system/src/Grav/Framework/Form/FormFlashFile.php +++ b/system/src/Grav/Framework/Form/FormFlashFile.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Form * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -28,6 +28,8 @@ use function sprintf; */ class FormFlashFile implements UploadedFileInterface, JsonSerializable { + /** @var string */ + private $id; /** @var string */ private $field; /** @var bool */ @@ -45,6 +47,7 @@ class FormFlashFile implements UploadedFileInterface, JsonSerializable */ public function __construct(string $field, array $upload, FormFlash $flash) { + $this->id = $flash->getId() ?: $flash->getUniqueId(); $this->field = $field; $this->upload = $upload; $this->flash = $flash; @@ -107,6 +110,11 @@ class FormFlashFile implements UploadedFileInterface, JsonSerializable } } + public function getId(): string + { + return $this->id; + } + /** * @return string */ @@ -222,6 +230,7 @@ class FormFlashFile implements UploadedFileInterface, JsonSerializable public function __debugInfo() { return [ + 'id:private' => $this->id, 'field:private' => $this->field, 'moved:private' => $this->moved, 'upload:private' => $this->upload, diff --git a/system/src/Grav/Framework/Form/Interfaces/FormFactoryInterface.php b/system/src/Grav/Framework/Form/Interfaces/FormFactoryInterface.php index 6a85f66..6a21a35 100644 --- a/system/src/Grav/Framework/Form/Interfaces/FormFactoryInterface.php +++ b/system/src/Grav/Framework/Form/Interfaces/FormFactoryInterface.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Form * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Form/Interfaces/FormFlashInterface.php b/system/src/Grav/Framework/Form/Interfaces/FormFlashInterface.php index 44bee02..631ace5 100644 --- a/system/src/Grav/Framework/Form/Interfaces/FormFlashInterface.php +++ b/system/src/Grav/Framework/Form/Interfaces/FormFlashInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Form * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -22,6 +22,13 @@ interface FormFlashInterface extends \JsonSerializable */ public function __construct($config); + /** + * Get unique form flash id if set. + * + * @return string + */ + public function getId(): string; + /** * Get session Id associated to this form instance. * diff --git a/system/src/Grav/Framework/Form/Interfaces/FormInterface.php b/system/src/Grav/Framework/Form/Interfaces/FormInterface.php index 0edfc42..c8827dc 100644 --- a/system/src/Grav/Framework/Form/Interfaces/FormInterface.php +++ b/system/src/Grav/Framework/Form/Interfaces/FormInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Form * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Form/Traits/FormTrait.php b/system/src/Grav/Framework/Form/Traits/FormTrait.php index 710d8b0..1dad5c7 100644 --- a/system/src/Grav/Framework/Form/Traits/FormTrait.php +++ b/system/src/Grav/Framework/Form/Traits/FormTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Form * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -453,10 +453,10 @@ trait FormTrait 'session_id' => $this->getSessionId(), 'unique_id' => $this->getUniqueId(), 'form_name' => $this->getName(), - 'folder' => $this->getFlashFolder() + 'folder' => $this->getFlashFolder(), + 'id' => $this->getFlashId() ]; - $this->flash = new FormFlash($config); $this->flash->setUrl($grav['uri']->url)->setUser($grav['user'] ?? null); } @@ -486,7 +486,8 @@ trait FormTrait 'session_id' => $this->getSessionId(), 'unique_id' => $uniqueId, 'form_name' => $name, - 'folder' => $this->getFlashFolder() + 'folder' => $this->getFlashFolder(), + 'id' => $this->getFlashId() ]; $flash = new FormFlash($config); if ($flash->exists() && $flash->getFormName() === $name) { @@ -614,6 +615,28 @@ trait FormTrait return strpos($path, '!!') === false ? rtrim($path, '/') : null; } + /** + * @return string|null + */ + protected function getFlashId(): ?string + { + // Fill template token keys/value pairs. + $dataMap = [ + '[FORM_NAME]' => $this->getName(), + '[SESSIONID]' => 'session', + '[USERNAME]' => '!!', + '[USERNAME_OR_SESSIONID]' => '!!', + '[ACCOUNT]' => 'account' + ]; + + $flashLookupFolder = $this->getFlashLookupFolder(); + + $path = str_replace(array_keys($dataMap), array_values($dataMap), $flashLookupFolder); + + // Make sure we only return valid paths. + return strpos($path, '!!') === false ? rtrim($path, '/') : null; + } + /** * @return string */ diff --git a/system/src/Grav/Framework/Interfaces/RenderInterface.php b/system/src/Grav/Framework/Interfaces/RenderInterface.php index 5bc6e58..d58c7d4 100644 --- a/system/src/Grav/Framework/Interfaces/RenderInterface.php +++ b/system/src/Grav/Framework/Interfaces/RenderInterface.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Interfaces * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Logger/Processors/UserProcessor.php b/system/src/Grav/Framework/Logger/Processors/UserProcessor.php index f0ebef1..714f176 100644 --- a/system/src/Grav/Framework/Logger/Processors/UserProcessor.php +++ b/system/src/Grav/Framework/Logger/Processors/UserProcessor.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Logger * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Media/Interfaces/MediaCollectionInterface.php b/system/src/Grav/Framework/Media/Interfaces/MediaCollectionInterface.php index 2bac98f..0879b81 100644 --- a/system/src/Grav/Framework/Media/Interfaces/MediaCollectionInterface.php +++ b/system/src/Grav/Framework/Media/Interfaces/MediaCollectionInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Media/Interfaces/MediaInterface.php b/system/src/Grav/Framework/Media/Interfaces/MediaInterface.php index 8688ad1..42b27cb 100644 --- a/system/src/Grav/Framework/Media/Interfaces/MediaInterface.php +++ b/system/src/Grav/Framework/Media/Interfaces/MediaInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Media/Interfaces/MediaManipulationInterface.php b/system/src/Grav/Framework/Media/Interfaces/MediaManipulationInterface.php index bca9a22..9973a6d 100644 --- a/system/src/Grav/Framework/Media/Interfaces/MediaManipulationInterface.php +++ b/system/src/Grav/Framework/Media/Interfaces/MediaManipulationInterface.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Media/Interfaces/MediaObjectInterface.php b/system/src/Grav/Framework/Media/Interfaces/MediaObjectInterface.php index f4409c5..6624a1e 100644 --- a/system/src/Grav/Framework/Media/Interfaces/MediaObjectInterface.php +++ b/system/src/Grav/Framework/Media/Interfaces/MediaObjectInterface.php @@ -3,15 +3,45 @@ /** * @package Grav\Framework\Media * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ namespace Grav\Framework\Media\Interfaces; +use Psr\Http\Message\UploadedFileInterface; + /** * Class implements media object interface. + * + * @property UploadedFileInterface|null $uploaded_file */ interface MediaObjectInterface { + /** + * Returns an array containing the file metadata + * + * @return array + */ + public function getMeta(); + + /** + * Return URL to file. + * + * @param bool $reset + * @return string + */ + public function url($reset = true); + + /** + * Get value by using dot notation for nested arrays/objects. + * + * @example $value = $this->get('this.is.my.nested.variable'); + * + * @param string $name Dot separated path to the requested value. + * @param mixed $default Default value (or null). + * @param string|null $separator Separator, defaults to '.' + * @return mixed Value. + */ + public function get($name, $default = null, $separator = null); } diff --git a/system/src/Grav/Framework/Media/MediaIdentifier.php b/system/src/Grav/Framework/Media/MediaIdentifier.php new file mode 100644 index 0000000..986e997 --- /dev/null +++ b/system/src/Grav/Framework/Media/MediaIdentifier.php @@ -0,0 +1,150 @@ + + */ +class MediaIdentifier extends Identifier +{ + /** @var MediaObjectInterface|null */ + private $object = null; + + /** + * @param MediaObjectInterface $object + * @return MediaIdentifier + */ + public static function createFromObject(MediaObjectInterface $object): MediaIdentifier + { + $instance = new static($object->getId()); + $instance->setObject($object); + + return $instance; + } + + /** + * @param string $id + */ + public function __construct(string $id) + { + parent::__construct($id, 'media'); + } + + /** + * @return T + */ + public function getObject(): ?MediaObjectInterface + { + if (!isset($this->object)) { + $type = $this->getType(); + $id = $this->getId(); + + $parts = explode('/', $id); + if ($type === 'media' && str_starts_with($id, 'uploads/')) { + array_shift($parts); + [, $folder, $uniqueId, $field, $filename] = $this->findFlash($parts); + + $flash = $this->getFlash($folder, $uniqueId); + if ($flash->exists()) { + + $uploadedFile = $flash->getFilesByField($field)[$filename] ?? null; + + $this->object = UploadedMediaObject::createFromFlash($flash, $field, $filename, $uploadedFile); + } + } else { + $type = array_shift($parts); + $key = array_shift($parts); + $field = array_shift($parts); + $filename = implode('/', $parts); + + $flexObject = $this->getFlexObject($type, $key); + if ($flexObject && method_exists($flexObject, 'getMediaField') && method_exists($flexObject, 'getMedia')) { + $media = $field !== 'media' ? $flexObject->getMediaField($field) : $flexObject->getMedia(); + $image = null; + if ($media) { + $image = $media[$filename]; + } + + $this->object = new MediaObject($field, $filename, $image, $flexObject); + } + } + + if (!isset($this->object)) { + throw new \RuntimeException(sprintf('Object not found for identifier {type: "%s", id: "%s"}', $type, $id)); + } + } + + return $this->object; + } + + /** + * @param T $object + */ + public function setObject(MediaObjectInterface $object): void + { + $type = $this->getType(); + $objectType = $object->getType(); + + if ($type !== $objectType) { + throw new \RuntimeException(sprintf('Object has to be type %s, %s given', $type, $objectType)); + } + + $this->object = $object; + } + + protected function findFlash(array $parts): ?array + { + $type = array_shift($parts); + if ($type === 'account') { + /** @var UserInterface|null $user */ + $user = Grav::instance()['user'] ?? null; + $folder = $user->getMediaFolder(); + } else { + $folder = 'tmp://'; + } + + if (!$folder) { + return null; + } + + do { + $part = array_shift($parts); + $folder .= "/{$part}"; + } while (!str_starts_with($part, 'flex-')); + + $uniqueId = array_shift($parts); + $field = array_shift($parts); + $filename = implode('/', $parts); + + return [$type, $folder, $uniqueId, $field, $filename]; + } + + protected function getFlash(string $folder, string $uniqueId): FlexFormFlash + { + $config = [ + 'unique_id' => $uniqueId, + 'folder' => $folder + ]; + + return new FlexFormFlash($config); + } + + protected function getFlexObject(string $type, string $key): ?FlexObjectInterface + { + /** @var Flex $flex */ + $flex = Grav::instance()['flex']; + + return $flex->getObject($key, $type); + } +} diff --git a/system/src/Grav/Framework/Media/MediaObject.php b/system/src/Grav/Framework/Media/MediaObject.php new file mode 100644 index 0000000..8a438bf --- /dev/null +++ b/system/src/Grav/Framework/Media/MediaObject.php @@ -0,0 +1,215 @@ +field = $field; + $this->filename = $filename; + $this->media = $media; + $this->object = $object; + } + + /** + * @return string + */ + public function getType(): string + { + return 'media'; + } + + /** + * @return string + */ + public function getId(): string + { + $field = $this->field; + $object = $this->object; + $path = $field ? "/{$field}/" : '/media/'; + + return $object->getType() . '/' . $object->getKey() . $path . basename($this->filename); + } + + /** + * @return bool + */ + public function exists(): bool + { + return $this->media !== null; + } + + /** + * @return array + */ + public function getMeta(): array + { + if (!isset($this->media)) { + return []; + } + + return $this->media->getMeta(); + } + + /** + * @param string $field + * @return mixed|null + */ + public function get(string $field) + { + if (!isset($this->media)) { + return null; + } + + return $this->media->get($field); + } + + /** + * @return string + */ + public function getUrl(): string + { + if (!isset($this->media)) { + return ''; + } + + return $this->media->url(); + } + + /** + * Create media response. + * + * @param array $actions + * @return Response + */ + public function createResponse(array $actions): ResponseInterface + { + if (!isset($this->media)) { + return $this->create404Response($actions); + } + + $media = $this->media; + + if ($actions) { + $media = $this->processMediaActions($media, $actions); + } + + // FIXME: This only works for images + if (!$media instanceof ImageMedium) { + throw new \RuntimeException('Not Implemented', 500); + } + + $filename = $media->path(false); + $time = filemtime($filename); + $size = filesize($filename); + $body = fopen($filename, 'rb'); + $headers = [ + 'Content-Type' => $media->get('mime'), + 'Last-Modified' => gmdate('D, d M Y H:i:s', $time) . ' GMT', + 'ETag' => sprintf('%x-%x', $size, $time) + ]; + + return new Response(200, $headers, $body); + } + + /** + * Process media actions + * + * @param GravMediaObjectInterface $medium + * @param array $actions + * @return GravMediaObjectInterface + */ + protected function processMediaActions(GravMediaObjectInterface $medium, array $actions): GravMediaObjectInterface + { + // loop through actions for the image and call them + foreach ($actions as $method => $params) { + $matches = []; + + if (preg_match('/\[(.*)]/', $params, $matches)) { + $args = [explode(',', $matches[1])]; + } else { + $args = explode(',', $params); + } + + try { + $medium->{$method}(...$args); + } catch (Throwable $e) { + // Ignore all errors for now and just skip the action. + } + } + + return $medium; + } + + /** + * @param array $actions + * @return Response + */ + protected function create404Response(array $actions): Response + { + // Display placeholder image. + $filename = static::$placeholderImage; + + $time = filemtime($filename); + $size = filesize($filename); + $body = fopen($filename, 'rb'); + $headers = [ + 'Content-Type' => 'image/svg', + 'Last-Modified' => gmdate('D, d M Y H:i:s', $time) . ' GMT', + 'ETag' => sprintf('%x-%x', $size, $time) + ]; + + return new Response(404, $headers, $body); + } + + /** + * @return array + */ + public function jsonSerialize(): array + { + return [ + 'type' => $this->getType(), + 'id' => $this->getId() + ]; + } + + /** + * @return string[] + */ + public function __debugInfo(): array + { + return $this->jsonSerialize(); + } +} diff --git a/system/src/Grav/Framework/Media/UploadedMediaObject.php b/system/src/Grav/Framework/Media/UploadedMediaObject.php new file mode 100644 index 0000000..0fe12e1 --- /dev/null +++ b/system/src/Grav/Framework/Media/UploadedMediaObject.php @@ -0,0 +1,172 @@ +getId(); + + return new static($id, $field, $filename, $uploadedFile); + } + + /** + * @param string $id + * @param string|null $field + * @param string $filename + * @param UploadedFileInterface|null $uploadedFile + */ + public function __construct(string $id, ?string $field, string $filename, ?UploadedFileInterface $uploadedFile = null) + { + $this->id = $id; + $this->field = $field; + $this->filename = $filename; + $this->uploadedFile = $uploadedFile; + if ($uploadedFile) { + $this->meta = [ + 'filename' => $uploadedFile->getClientFilename(), + 'mime' => $uploadedFile->getClientMediaType(), + 'size' => $uploadedFile->getSize() + ]; + } else { + $this->meta = []; + } + } + + /** + * @return string + */ + public function getType(): string + { + return 'media'; + } + + /** + * @return string + */ + public function getId(): string + { + $id = $this->id; + $field = $this->field; + $path = $field ? "/{$field}/" : ''; + + return 'uploads/' . $id . $path . basename($this->filename); + } + + /** + * @return bool + */ + public function exists(): bool + { + //return $this->uploadedFile !== null; + return false; + } + + /** + * @return array + */ + public function getMeta(): array + { + return $this->meta; + } + + /** + * @param string $field + * @return mixed|null + */ + public function get(string $field) + { + return $this->meta[$field] ?? null; + } + + /** + * @return string + */ + public function getUrl(): string + { + return ''; + } + + /** + * @return UploadedFileInterface|null + */ + public function getUploadedFile(): ?UploadedFileInterface + { + return $this->uploadedFile; + } + + /** + * @param array $actions + * @return Response + */ + public function createResponse(array $actions): ResponseInterface + { + // Display placeholder image. + $filename = static::$placeholderImage; + + $time = filemtime($filename); + $size = filesize($filename); + $body = fopen($filename, 'rb'); + $headers = [ + 'Content-Type' => 'image/svg', + 'Last-Modified' => gmdate('D, d M Y H:i:s', $time) . ' GMT', + 'ETag' => sprintf('%x-%x', $size, $time) + ]; + + return new Response(404, $headers, $body); + } + + /** + * @return array + */ + public function jsonSerialize(): array + { + return [ + 'type' => $this->getType(), + 'id' => $this->getId() + ]; + } + + /** + * @return string[] + */ + public function __debugInfo(): array + { + return $this->jsonSerialize(); + } +} diff --git a/system/src/Grav/Framework/Mime/MimeTypes.php b/system/src/Grav/Framework/Mime/MimeTypes.php index e3a5ea8..147ea22 100644 --- a/system/src/Grav/Framework/Mime/MimeTypes.php +++ b/system/src/Grav/Framework/Mime/MimeTypes.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Mime * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Access/ArrayAccessTrait.php b/system/src/Grav/Framework/Object/Access/ArrayAccessTrait.php index 4b67599..67d048d 100644 --- a/system/src/Grav/Framework/Object/Access/ArrayAccessTrait.php +++ b/system/src/Grav/Framework/Object/Access/ArrayAccessTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Access/NestedArrayAccessTrait.php b/system/src/Grav/Framework/Object/Access/NestedArrayAccessTrait.php index d9acb10..942e387 100644 --- a/system/src/Grav/Framework/Object/Access/NestedArrayAccessTrait.php +++ b/system/src/Grav/Framework/Object/Access/NestedArrayAccessTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Access/NestedPropertyCollectionTrait.php b/system/src/Grav/Framework/Object/Access/NestedPropertyCollectionTrait.php index 561b6fe..066e25e 100644 --- a/system/src/Grav/Framework/Object/Access/NestedPropertyCollectionTrait.php +++ b/system/src/Grav/Framework/Object/Access/NestedPropertyCollectionTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Access/NestedPropertyTrait.php b/system/src/Grav/Framework/Object/Access/NestedPropertyTrait.php index 64107e0..87737dc 100644 --- a/system/src/Grav/Framework/Object/Access/NestedPropertyTrait.php +++ b/system/src/Grav/Framework/Object/Access/NestedPropertyTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Access/OverloadedPropertyTrait.php b/system/src/Grav/Framework/Object/Access/OverloadedPropertyTrait.php index f417fba..0b82d96 100644 --- a/system/src/Grav/Framework/Object/Access/OverloadedPropertyTrait.php +++ b/system/src/Grav/Framework/Object/Access/OverloadedPropertyTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/ArrayObject.php b/system/src/Grav/Framework/Object/ArrayObject.php index a38864c..964dba1 100644 --- a/system/src/Grav/Framework/Object/ArrayObject.php +++ b/system/src/Grav/Framework/Object/ArrayObject.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php b/system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php index e29370a..77ae78e 100644 --- a/system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php +++ b/system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Base/ObjectTrait.php b/system/src/Grav/Framework/Object/Base/ObjectTrait.php index 86df8c7..d8289dc 100644 --- a/system/src/Grav/Framework/Object/Base/ObjectTrait.php +++ b/system/src/Grav/Framework/Object/Base/ObjectTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Collection/ObjectExpressionVisitor.php b/system/src/Grav/Framework/Object/Collection/ObjectExpressionVisitor.php index e8b12b7..a939989 100644 --- a/system/src/Grav/Framework/Object/Collection/ObjectExpressionVisitor.php +++ b/system/src/Grav/Framework/Object/Collection/ObjectExpressionVisitor.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Identifiers/Identifier.php b/system/src/Grav/Framework/Object/Identifiers/Identifier.php new file mode 100644 index 0000000..69f41d2 --- /dev/null +++ b/system/src/Grav/Framework/Object/Identifiers/Identifier.php @@ -0,0 +1,66 @@ +id = $id; + $this->type = $type; + } + + /** + * @return string + * @phpstan-pure + */ + public function getId(): string + { + return $this->id; + } + + /** + * @return string + * @phpstan-pure + */ + public function getType(): string + { + return $this->type; + } + + /** + * @return array + */ + public function jsonSerialize(): array + { + return [ + 'type' => $this->type, + 'id' => $this->id + ]; + } + + /** + * @return array + */ + public function __debugInfo(): array + { + return $this->jsonSerialize(); + } +} diff --git a/system/src/Grav/Framework/Object/Interfaces/NestedObjectCollectionInterface.php b/system/src/Grav/Framework/Object/Interfaces/NestedObjectCollectionInterface.php index 9f00bab..35e29d6 100644 --- a/system/src/Grav/Framework/Object/Interfaces/NestedObjectCollectionInterface.php +++ b/system/src/Grav/Framework/Object/Interfaces/NestedObjectCollectionInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Interfaces/NestedObjectInterface.php b/system/src/Grav/Framework/Object/Interfaces/NestedObjectInterface.php index c144d8e..214ff02 100644 --- a/system/src/Grav/Framework/Object/Interfaces/NestedObjectInterface.php +++ b/system/src/Grav/Framework/Object/Interfaces/NestedObjectInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Interfaces/ObjectCollectionInterface.php b/system/src/Grav/Framework/Object/Interfaces/ObjectCollectionInterface.php index bd25f61..579abb8 100644 --- a/system/src/Grav/Framework/Object/Interfaces/ObjectCollectionInterface.php +++ b/system/src/Grav/Framework/Object/Interfaces/ObjectCollectionInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Interfaces/ObjectInterface.php b/system/src/Grav/Framework/Object/Interfaces/ObjectInterface.php index bc4d45d..3cd51d3 100644 --- a/system/src/Grav/Framework/Object/Interfaces/ObjectInterface.php +++ b/system/src/Grav/Framework/Object/Interfaces/ObjectInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/LazyObject.php b/system/src/Grav/Framework/Object/LazyObject.php index 6be2558..a0561ad 100644 --- a/system/src/Grav/Framework/Object/LazyObject.php +++ b/system/src/Grav/Framework/Object/LazyObject.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/ObjectCollection.php b/system/src/Grav/Framework/Object/ObjectCollection.php index 94392af..d38da55 100644 --- a/system/src/Grav/Framework/Object/ObjectCollection.php +++ b/system/src/Grav/Framework/Object/ObjectCollection.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/ObjectIndex.php b/system/src/Grav/Framework/Object/ObjectIndex.php index ab495bd..01f06dc 100644 --- a/system/src/Grav/Framework/Object/ObjectIndex.php +++ b/system/src/Grav/Framework/Object/ObjectIndex.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Property/ArrayPropertyTrait.php b/system/src/Grav/Framework/Object/Property/ArrayPropertyTrait.php index 8ab4c41..ad38f18 100644 --- a/system/src/Grav/Framework/Object/Property/ArrayPropertyTrait.php +++ b/system/src/Grav/Framework/Object/Property/ArrayPropertyTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Property/LazyPropertyTrait.php b/system/src/Grav/Framework/Object/Property/LazyPropertyTrait.php index e689259..ce3b916 100644 --- a/system/src/Grav/Framework/Object/Property/LazyPropertyTrait.php +++ b/system/src/Grav/Framework/Object/Property/LazyPropertyTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Property/MixedPropertyTrait.php b/system/src/Grav/Framework/Object/Property/MixedPropertyTrait.php index 1b57aab..1e1c25a 100644 --- a/system/src/Grav/Framework/Object/Property/MixedPropertyTrait.php +++ b/system/src/Grav/Framework/Object/Property/MixedPropertyTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Property/ObjectPropertyTrait.php b/system/src/Grav/Framework/Object/Property/ObjectPropertyTrait.php index bb0195d..7de23f9 100644 --- a/system/src/Grav/Framework/Object/Property/ObjectPropertyTrait.php +++ b/system/src/Grav/Framework/Object/Property/ObjectPropertyTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/PropertyObject.php b/system/src/Grav/Framework/Object/PropertyObject.php index d9cdde8..10a2bf1 100644 --- a/system/src/Grav/Framework/Object/PropertyObject.php +++ b/system/src/Grav/Framework/Object/PropertyObject.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Pagination/AbstractPagination.php b/system/src/Grav/Framework/Pagination/AbstractPagination.php index a4d902a..bb3eb96 100644 --- a/system/src/Grav/Framework/Pagination/AbstractPagination.php +++ b/system/src/Grav/Framework/Pagination/AbstractPagination.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Pagination * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Pagination/AbstractPaginationPage.php b/system/src/Grav/Framework/Pagination/AbstractPaginationPage.php index 072fea7..ae6d7d3 100644 --- a/system/src/Grav/Framework/Pagination/AbstractPaginationPage.php +++ b/system/src/Grav/Framework/Pagination/AbstractPaginationPage.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Pagination * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Pagination/Interfaces/PaginationInterface.php b/system/src/Grav/Framework/Pagination/Interfaces/PaginationInterface.php index 1a82147..dfbd9fd 100644 --- a/system/src/Grav/Framework/Pagination/Interfaces/PaginationInterface.php +++ b/system/src/Grav/Framework/Pagination/Interfaces/PaginationInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Pagination * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Pagination/Interfaces/PaginationPageInterface.php b/system/src/Grav/Framework/Pagination/Interfaces/PaginationPageInterface.php index 26c0692..62b2371 100644 --- a/system/src/Grav/Framework/Pagination/Interfaces/PaginationPageInterface.php +++ b/system/src/Grav/Framework/Pagination/Interfaces/PaginationPageInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Pagination * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Pagination/Pagination.php b/system/src/Grav/Framework/Pagination/Pagination.php index 8f2fa20..529dd73 100644 --- a/system/src/Grav/Framework/Pagination/Pagination.php +++ b/system/src/Grav/Framework/Pagination/Pagination.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Pagination * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Pagination/PaginationPage.php b/system/src/Grav/Framework/Pagination/PaginationPage.php index e64abe9..e5d592b 100644 --- a/system/src/Grav/Framework/Pagination/PaginationPage.php +++ b/system/src/Grav/Framework/Pagination/PaginationPage.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Pagination * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Psr7/AbstractUri.php b/system/src/Grav/Framework/Psr7/AbstractUri.php index 145437a..1de1870 100644 --- a/system/src/Grav/Framework/Psr7/AbstractUri.php +++ b/system/src/Grav/Framework/Psr7/AbstractUri.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Psr7 * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Psr7/Request.php b/system/src/Grav/Framework/Psr7/Request.php index 795a1a4..41deec8 100644 --- a/system/src/Grav/Framework/Psr7/Request.php +++ b/system/src/Grav/Framework/Psr7/Request.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Psr7 * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Psr7/Response.php b/system/src/Grav/Framework/Psr7/Response.php index 6189c4a..cb66c3b 100644 --- a/system/src/Grav/Framework/Psr7/Response.php +++ b/system/src/Grav/Framework/Psr7/Response.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Psr7 * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Psr7/ServerRequest.php b/system/src/Grav/Framework/Psr7/ServerRequest.php index cb5bcbb..d8df986 100644 --- a/system/src/Grav/Framework/Psr7/ServerRequest.php +++ b/system/src/Grav/Framework/Psr7/ServerRequest.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Psr7 * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Psr7/Stream.php b/system/src/Grav/Framework/Psr7/Stream.php index 6546bdc..7645d2d 100644 --- a/system/src/Grav/Framework/Psr7/Stream.php +++ b/system/src/Grav/Framework/Psr7/Stream.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Psr7 * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Psr7/Traits/MessageDecoratorTrait.php b/system/src/Grav/Framework/Psr7/Traits/MessageDecoratorTrait.php index c09a03c..f5e3c74 100644 --- a/system/src/Grav/Framework/Psr7/Traits/MessageDecoratorTrait.php +++ b/system/src/Grav/Framework/Psr7/Traits/MessageDecoratorTrait.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Psr7 * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Psr7/Traits/RequestDecoratorTrait.php b/system/src/Grav/Framework/Psr7/Traits/RequestDecoratorTrait.php index 49f2a92..72552cd 100644 --- a/system/src/Grav/Framework/Psr7/Traits/RequestDecoratorTrait.php +++ b/system/src/Grav/Framework/Psr7/Traits/RequestDecoratorTrait.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Psr7 * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Psr7/Traits/ResponseDecoratorTrait.php b/system/src/Grav/Framework/Psr7/Traits/ResponseDecoratorTrait.php index 4bbc736..c92067f 100644 --- a/system/src/Grav/Framework/Psr7/Traits/ResponseDecoratorTrait.php +++ b/system/src/Grav/Framework/Psr7/Traits/ResponseDecoratorTrait.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Psr7 * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Psr7/Traits/ServerRequestDecoratorTrait.php b/system/src/Grav/Framework/Psr7/Traits/ServerRequestDecoratorTrait.php index 9222219..f429694 100644 --- a/system/src/Grav/Framework/Psr7/Traits/ServerRequestDecoratorTrait.php +++ b/system/src/Grav/Framework/Psr7/Traits/ServerRequestDecoratorTrait.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Psr7 * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Psr7/Traits/StreamDecoratorTrait.php b/system/src/Grav/Framework/Psr7/Traits/StreamDecoratorTrait.php index 448323f..de81af1 100644 --- a/system/src/Grav/Framework/Psr7/Traits/StreamDecoratorTrait.php +++ b/system/src/Grav/Framework/Psr7/Traits/StreamDecoratorTrait.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Psr7 * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Psr7/Traits/UploadedFileDecoratorTrait.php b/system/src/Grav/Framework/Psr7/Traits/UploadedFileDecoratorTrait.php index eec3add..c873b83 100644 --- a/system/src/Grav/Framework/Psr7/Traits/UploadedFileDecoratorTrait.php +++ b/system/src/Grav/Framework/Psr7/Traits/UploadedFileDecoratorTrait.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Psr7 * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Psr7/Traits/UriDecorationTrait.php b/system/src/Grav/Framework/Psr7/Traits/UriDecorationTrait.php index 73adb64..e635ab1 100644 --- a/system/src/Grav/Framework/Psr7/Traits/UriDecorationTrait.php +++ b/system/src/Grav/Framework/Psr7/Traits/UriDecorationTrait.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Psr7 * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Psr7/UploadedFile.php b/system/src/Grav/Framework/Psr7/UploadedFile.php index c3ed62e..30e75cb 100644 --- a/system/src/Grav/Framework/Psr7/UploadedFile.php +++ b/system/src/Grav/Framework/Psr7/UploadedFile.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Psr7 * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Psr7/Uri.php b/system/src/Grav/Framework/Psr7/Uri.php index 63fe04e..ec7719c 100644 --- a/system/src/Grav/Framework/Psr7/Uri.php +++ b/system/src/Grav/Framework/Psr7/Uri.php @@ -5,7 +5,7 @@ declare(strict_types=1); /** * @package Grav\Framework\Psr7 * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Relationships/Relationships.php b/system/src/Grav/Framework/Relationships/Relationships.php new file mode 100644 index 0000000..6485682 --- /dev/null +++ b/system/src/Grav/Framework/Relationships/Relationships.php @@ -0,0 +1,217 @@ + + */ +class Relationships implements RelationshipsInterface +{ + /** @var P */ + protected $parent; + /** @var array */ + protected $options; + + /** @var RelationshipInterface[] */ + protected $relationships; + + /** + * Relationships constructor. + * @param P $parent + * @param array $options + */ + public function __construct(IdentifierInterface $parent, array $options) + { + $this->parent = $parent; + $this->options = $options; + $this->relationships = []; + } + + /** + * @return bool + * @phpstan-pure + */ + public function isModified(): bool + { + return !empty($this->getModified()); + } + + /** + * @return RelationshipInterface[] + * @phpstan-pure + */ + public function getModified(): array + { + $list = []; + foreach ($this->relationships as $name => $relationship) { + if ($relationship->isModified()) { + $list[$name] = $relationship; + } + } + + return $list; + } + + /** + * @return int + * @phpstan-pure + */ + public function count(): int + { + return count($this->options); + } + + /** + * @param string $offset + * @return bool + * @phpstan-pure + */ + public function offsetExists($offset): bool + { + return isset($this->options[$offset]); + } + + /** + * @param string $offset + * @return RelationshipInterface|null + */ + public function offsetGet($offset): ?RelationshipInterface + { + if (!isset($this->relationships[$offset])) { + $options = $this->options[$offset] ?? null; + if (null === $options) { + return null; + } + + $this->relationships[$offset] = $this->createRelationship($offset, $options); + } + + return $this->relationships[$offset]; + } + + /** + * @param string $offset + * @param mixed $value + * @return never-return + */ + public function offsetSet($offset, $value) + { + throw new RuntimeException('Setting relationship is not supported', 500); + } + + /** + * @param string $offset + * @return never-return + */ + public function offsetUnset($offset) + { + throw new RuntimeException('Removing relationship is not allowed', 500); + } + + /** + * @return RelationshipInterface|null + */ + public function current(): ?RelationshipInterface + { + $name = key($this->options); + if ($name === null) { + return null; + } + + return $this->offsetGet($name); + } + + /** + * @return string + * @phpstan-pure + */ + public function key(): string + { + return key($this->options); + } + + /** + * @return void + * @phpstan-pure + */ + public function next(): void + { + next($this->options); + } + + /** + * @return void + * @phpstan-pure + */ + public function rewind(): void + { + reset($this->options); + } + + /** + * @return bool + * @phpstan-pure + */ + public function valid(): bool + { + return key($this->options) !== null; + } + + /** + * @return array + */ + public function jsonSerialize(): array + { + $list = []; + foreach ($this as $name => $relationship) { + $list[$name] = $relationship->jsonSerialize(); + } + + return $list; + } + + /** + * @param string $name + * @param array $options + * @return ToOneRelationship|ToManyRelationship + */ + private function createRelationship(string $name, array $options): RelationshipInterface + { + $data = null; + + $parent = $this->parent; + if ($parent instanceof FlexIdentifier) { + $object = $parent->getObject(); + if (!method_exists($object, 'initRelationship')) { + throw new RuntimeException(sprintf('Bad relationship %s', $name), 500); + } + + $data = $object->initRelationship($name); + } + + $cardinality = $options['cardinality'] ?? ''; + switch ($cardinality) { + case 'to-one': + $relationship = new ToOneRelationship($parent, $name, $options, $data); + break; + case 'to-many': + $relationship = new ToManyRelationship($parent, $name, $options, $data ?? []); + break; + default: + throw new RuntimeException(sprintf('Bad relationship cardinality %s', $cardinality), 500); + } + + return $relationship; + } +} diff --git a/system/src/Grav/Framework/Relationships/ToManyRelationship.php b/system/src/Grav/Framework/Relationships/ToManyRelationship.php new file mode 100644 index 0000000..3ea501b --- /dev/null +++ b/system/src/Grav/Framework/Relationships/ToManyRelationship.php @@ -0,0 +1,259 @@ + + */ +class ToManyRelationship implements ToManyRelationshipInterface +{ + /** @template-use RelationshipTrait */ + use RelationshipTrait; + use Serializable; + + /** @var IdentifierInterface[] */ + protected $identifiers = []; + + /** + * ToManyRelationship constructor. + * @param string $name + * @param IdentifierInterface $parent + * @param iterable $identifiers + */ + public function __construct(IdentifierInterface $parent, string $name, array $options, iterable $identifiers = []) + { + $this->parent = $parent; + $this->name = $name; + + $this->parseOptions($options); + $this->addIdentifiers($identifiers); + + $this->modified = false; + } + + /** + * @return string + * @phpstan-pure + */ + public function getCardinality(): string + { + return 'to-many'; + } + + /** + * @return int + * @phpstan-pure + */ + public function count(): int + { + return count($this->identifiers); + } + + /** + * @return array + */ + public function fetch(): array + { + $list = []; + foreach ($this->identifiers as $identifier) { + if (is_callable([$identifier, 'getObject'])) { + $identifier = $identifier->getObject(); + } + $list[] = $identifier; + } + + return $list; + } + + /** + * @param string $id + * @param string|null $type + * @return bool + * @phpstan-pure + */ + public function has(string $id, string $type = null): bool + { + return $this->getIdentifier($id, $type) !== null; + } + + /** + * @param positive-int $pos + * @return IdentifierInterface|null + */ + public function getNthIdentifier(int $pos): ?IdentifierInterface + { + $items = array_keys($this->identifiers); + $key = $items[$pos - 1] ?? null; + if (null === $key) { + return null; + } + + return $this->identifiers[$key] ?? null; + } + + /** + * @param string $id + * @param string|null $type + * @return IdentifierInterface|null + * @phpstan-pure + */ + public function getIdentifier(string $id, string $type = null): ?IdentifierInterface + { + if (null === $type) { + $type = $this->getType(); + } + + if ($type === 'media' && !str_contains($id, '/')) { + $name = $this->name; + $id = $this->parent->getType() . '/' . $this->parent->getId() . '/'. $name . '/' . $id; + } + + $key = "{$type}/{$id}"; + + return $this->identifiers[$key] ?? null; + } + + /** + * @param string $id + * @param string|null $type + * @return T|null + */ + public function getObject(string $id, string $type = null): ?object + { + $identifier = $this->getIdentifier($id, $type); + if ($identifier && is_callable([$identifier, 'getObject'])) { + $identifier = $identifier->getObject(); + } + + return $identifier; + } + + /** + * @param IdentifierInterface $identifier + * @return bool + */ + public function addIdentifier(IdentifierInterface $identifier): bool + { + return $this->addIdentifiers([$identifier]); + } + + /** + * @param IdentifierInterface|null $identifier + * @return bool + */ + public function removeIdentifier(IdentifierInterface $identifier = null): bool + { + return !$identifier || $this->removeIdentifiers([$identifier]); + } + + /** + * @param iterable $identifiers + * @return bool + */ + public function addIdentifiers(iterable $identifiers): bool + { + foreach ($identifiers as $identifier) { + $type = $identifier->getType(); + $id = $identifier->getId(); + $key = "{$type}/{$id}"; + + $this->identifiers[$key] = $this->checkIdentifier($identifier); + $this->modified = true; + } + + return true; + } + + /** + * @param iterable $identifiers + * @return bool + */ + public function replaceIdentifiers(iterable $identifiers): bool + { + $this->identifiers = []; + $this->modified = true; + + return $this->addIdentifiers($identifiers); + } + + /** + * @param iterable $identifiers + * @return bool + */ + public function removeIdentifiers(iterable $identifiers): bool + { + foreach ($identifiers as $identifier) { + $type = $identifier->getType(); + $id = $identifier->getId(); + $key = "{$type}/{$id}"; + + unset($this->identifiers[$key]); + $this->modified = true; + } + + return true; + } + + /** + * @return iterable + * @phpstan-pure + */ + public function getIterator(): iterable + { + return new ArrayIterator($this->identifiers); + } + + /** + * @return array + */ + public function jsonSerialize(): array + { + $list = []; + foreach ($this->getIterator() as $item) { + $list[] = $item->jsonSerialize(); + } + + return $list; + } + + /** + * @return array + */ + public function __serialize(): array + { + return [ + 'parent' => $this->parent, + 'name' => $this->name, + 'type' => $this->type, + 'options' => $this->options, + 'modified' => $this->modified, + 'identifiers' => $this->identifiers, + ]; + } + + /** + * @param array $data + * @return void + */ + public function __unserialize(array $data): void + { + $this->parent = $data['parent']; + $this->name = $data['name']; + $this->type = $data['type']; + $this->options = $data['options']; + $this->modified = $data['modified']; + $this->identifiers = $data['identifiers']; + } +} diff --git a/system/src/Grav/Framework/Relationships/ToOneRelationship.php b/system/src/Grav/Framework/Relationships/ToOneRelationship.php new file mode 100644 index 0000000..9b09651 --- /dev/null +++ b/system/src/Grav/Framework/Relationships/ToOneRelationship.php @@ -0,0 +1,207 @@ + + */ +class ToOneRelationship implements ToOneRelationshipInterface +{ + /** @template-use RelationshipTrait */ + use RelationshipTrait; + use Serializable; + + /** @var IdentifierInterface|null */ + protected $identifier = null; + + public function __construct(IdentifierInterface $parent, string $name, array $options, IdentifierInterface $identifier = null) + { + $this->parent = $parent; + $this->name = $name; + + $this->parseOptions($options); + $this->replaceIdentifier($identifier); + + $this->modified = false; + } + + /** + * @return string + * @phpstan-pure + */ + public function getCardinality(): string + { + return 'to-one'; + } + + /** + * @return int + * @phpstan-pure + */ + public function count(): int + { + return $this->identifier ? 1 : 0; + } + + /** + * @return object|null + */ + public function fetch(): ?object + { + $identifier = $this->identifier; + if (is_callable([$identifier, 'getObject'])) { + $identifier = $identifier->getObject(); + } + + return $identifier; + } + + + /** + * @param string|null $id + * @param string|null $type + * @return bool + * @phpstan-pure + */ + public function has(string $id = null, string $type = null): bool + { + return $this->getIdentifier($id, $type) !== null; + } + + /** + * @param string|null $id + * @param string|null $type + * @return IdentifierInterface|null + * @phpstan-pure + */ + public function getIdentifier(string $id = null, string $type = null): ?IdentifierInterface + { + if ($id && $this->getType() === 'media' && !str_contains($id, '/')) { + $name = $this->name; + $id = $this->parent->getType() . '/' . $this->parent->getId() . '/'. $name . '/' . $id; + } + + $identifier = $this->identifier ?? null; + if (null === $identifier || ($type && $type !== $identifier->getType()) || ($id && $id !== $identifier->getId())) { + return null; + } + + return $identifier; + } + + /** + * @param string|null $id + * @param string|null $type + * @return T|null + */ + public function getObject(string $id = null, string $type = null): ?object + { + $identifier = $this->getIdentifier($id, $type); + if ($identifier && is_callable([$identifier, 'getObject'])) { + $identifier = $identifier->getObject(); + } + + return $identifier; + } + + /** + * @param IdentifierInterface $identifier + * @return bool + */ + public function addIdentifier(IdentifierInterface $identifier): bool + { + $this->identifier = $this->checkIdentifier($identifier); + $this->modified = true; + + return true; + } + + /** + * @param IdentifierInterface|null $identifier + * @return bool + */ + public function replaceIdentifier(IdentifierInterface $identifier = null): bool + { + if ($identifier === null) { + $this->identifier = null; + $this->modified = true; + + return true; + } + + return $this->addIdentifier($identifier); + } + + /** + * @param IdentifierInterface|null $identifier + * @return bool + */ + public function removeIdentifier(IdentifierInterface $identifier = null): bool + { + if (null === $identifier || $this->has($identifier->getId(), $identifier->getType())) { + $this->identifier = null; + $this->modified = true; + + return true; + } + + return false; + } + + /** + * @return iterable + * @phpstan-pure + */ + public function getIterator(): iterable + { + return new ArrayIterator((array)$this->identifier); + } + + /** + * @return array|null + */ + public function jsonSerialize(): ?array + { + return $this->identifier ? $this->identifier->jsonSerialize() : null; + } + + /** + * @return array + */ + public function __serialize(): array + { + return [ + 'parent' => $this->parent, + 'name' => $this->name, + 'type' => $this->type, + 'options' => $this->options, + 'modified' => $this->modified, + 'identifier' => $this->identifier, + ]; + } + + /** + * @param array $data + * @return void + */ + public function __unserialize(array $data): void + { + $this->parent = $data['parent']; + $this->name = $data['name']; + $this->type = $data['type']; + $this->options = $data['options']; + $this->modified = $data['modified']; + $this->identifier = $data['identifier']; + } +} diff --git a/system/src/Grav/Framework/Relationships/Traits/RelationshipTrait.php b/system/src/Grav/Framework/Relationships/Traits/RelationshipTrait.php new file mode 100644 index 0000000..dbe146f --- /dev/null +++ b/system/src/Grav/Framework/Relationships/Traits/RelationshipTrait.php @@ -0,0 +1,128 @@ +name; + } + + /** + * @return string + * @phpstan-pure + */ + public function getType(): string + { + return $this->type; + } + + /** + * @return bool + * @phpstan-pure + */ + public function isModified(): bool + { + return $this->modified; + } + + /** + * @return IdentifierInterface + * @phpstan-pure + */ + public function getParent(): IdentifierInterface + { + return $this->parent; + } + + /** + * @param IdentifierInterface $identifier + * @return bool + * @phpstan-pure + */ + public function hasIdentifier(IdentifierInterface $identifier): bool + { + return $this->getIdentifier($identifier->getId(), $identifier->getType()) !== null; + } + + /** + * @return int + * @phpstan-pure + */ + abstract public function count(): int; + + /** + * @return void + * @phpstan-pure + */ + public function check(): void + { + $min = $this->options['min'] ?? 0; + $max = $this->options['max'] ?? 0; + + if ($min || $max) { + $count = $this->count(); + if ($min && $count < $min) { + throw new RuntimeException(sprintf('%s relationship has too few objects in it', $this->name)); + } + if ($max && $count > $max) { + throw new RuntimeException(sprintf('%s relationship has too many objects in it', $this->name)); + } + } + } + + /** + * @param IdentifierInterface $identifier + * @return IdentifierInterface + */ + private function checkIdentifier(IdentifierInterface $identifier): IdentifierInterface + { + if ($this->type !== $identifier->getType()) { + throw new RuntimeException(sprintf('Bad identifier type %s', $identifier->getType())); + } + + if (get_class($identifier) !== Identifier::class) { + return $identifier; + } + + if ($this->type === 'media') { + return new MediaIdentifier($identifier->getId()); + } + + return new FlexIdentifier($identifier->getId(), $identifier->getType()); + } + + private function parseOptions(array $options): void + { + $this->type = $options['type']; + $this->options = $options; + } +} diff --git a/system/src/Grav/Framework/RequestHandler/Exception/InvalidArgumentException.php b/system/src/Grav/Framework/RequestHandler/Exception/InvalidArgumentException.php index 2456ea1..01ab154 100644 --- a/system/src/Grav/Framework/RequestHandler/Exception/InvalidArgumentException.php +++ b/system/src/Grav/Framework/RequestHandler/Exception/InvalidArgumentException.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\RequestHandler * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/RequestHandler/Exception/NotFoundException.php b/system/src/Grav/Framework/RequestHandler/Exception/NotFoundException.php index ce79ab2..9588f4c 100644 --- a/system/src/Grav/Framework/RequestHandler/Exception/NotFoundException.php +++ b/system/src/Grav/Framework/RequestHandler/Exception/NotFoundException.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\RequestHandler * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/RequestHandler/Exception/NotHandledException.php b/system/src/Grav/Framework/RequestHandler/Exception/NotHandledException.php index 7b4a0e7..6e983cb 100644 --- a/system/src/Grav/Framework/RequestHandler/Exception/NotHandledException.php +++ b/system/src/Grav/Framework/RequestHandler/Exception/NotHandledException.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\RequestHandler * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/RequestHandler/Exception/PageExpiredException.php b/system/src/Grav/Framework/RequestHandler/Exception/PageExpiredException.php index f752167..ec58e46 100644 --- a/system/src/Grav/Framework/RequestHandler/Exception/PageExpiredException.php +++ b/system/src/Grav/Framework/RequestHandler/Exception/PageExpiredException.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\RequestHandler * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/RequestHandler/Exception/RequestException.php b/system/src/Grav/Framework/RequestHandler/Exception/RequestException.php index 678b267..b5521d5 100644 --- a/system/src/Grav/Framework/RequestHandler/Exception/RequestException.php +++ b/system/src/Grav/Framework/RequestHandler/Exception/RequestException.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\RequestHandler * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/RequestHandler/Middlewares/Exceptions.php b/system/src/Grav/Framework/RequestHandler/Middlewares/Exceptions.php index 36ef3a5..cf2d3b2 100644 --- a/system/src/Grav/Framework/RequestHandler/Middlewares/Exceptions.php +++ b/system/src/Grav/Framework/RequestHandler/Middlewares/Exceptions.php @@ -1,14 +1,12 @@ -getHeaderLine('content-type'); + $method = $request->getMethod(); + if (!str_starts_with($contentType, 'multipart/form-data') || !in_array($method, ['PUT', 'PATH'], true)) { + return $handler->handle($request); + } + + $boundary = explode('; boundary=', $contentType, 2)[1] ?? ''; + $parts = explode("--{$boundary}", $request->getBody()->getContents()); + $parts = array_slice($parts, 1, count($parts) - 2); + + $params = []; + $files = []; + foreach ($parts as $part) { + $this->processPart($params, $files, $part); + } + + return $handler->handle($request->withParsedBody($params)->withUploadedFiles($files)); + } + + /** + * @param array $params + * @param array $files + * @param string $part + * @return void + */ + protected function processPart(array &$params, array &$files, string $part): void + { + $part = ltrim($part, "\r\n"); + [$rawHeaders, $body] = explode("\r\n\r\n", $part, 2); + + // Parse headers. + $rawHeaders = explode("\r\n", $rawHeaders); + $headers = array_reduce( + $rawHeaders, + static function (array $headers, $header) { + [$name, $value] = explode(':', $header); + $headers[strtolower($name)] = ltrim($value, ' '); + + return $headers; + }, + [] + ); + + if (!isset($headers['content-disposition'])) { + return; + } + + // Parse content disposition header. + $contentDisposition = $headers['content-disposition']; + preg_match('/^(.+); *name="([^"]+)"(; *filename="([^"]+)")?/', $contentDisposition, $matches); + $name = $matches[2]; + $filename = $matches[4] ?? null; + + if ($filename !== null) { + $stream = Stream::create($body); + $this->addFile($files, $name, new UploadedFile($stream, strlen($body), UPLOAD_ERR_OK, $filename, $headers['content-type'] ?? null)); + } elseif (strpos($contentDisposition, 'filename') !== false) { + // Not uploaded file. + $stream = Stream::create(''); + $this->addFile($files, $name, new UploadedFile($stream, 0, UPLOAD_ERR_NO_FILE)); + } else { + // Regular field. + $params[$name] = substr($body, 0, -2); + } + } + + /** + * @param array $files + * @param string $name + * @param UploadedFileInterface $file + * @return void + */ + protected function addFile(array &$files, string $name, UploadedFileInterface $file): void + { + if (strpos($name, '[]') === strlen($name) - 2) { + $name = substr($name, 0, -2); + + if (isset($files[$name]) && is_array($files[$name])) { + $files[$name][] = $file; + } else { + $files[$name] = [$file]; + } + } else { + $files[$name] = $file; + } + } +} diff --git a/system/src/Grav/Framework/RequestHandler/RequestHandler.php b/system/src/Grav/Framework/RequestHandler/RequestHandler.php index 2ce2427..069808f 100644 --- a/system/src/Grav/Framework/RequestHandler/RequestHandler.php +++ b/system/src/Grav/Framework/RequestHandler/RequestHandler.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\RequestHandler * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php b/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php index ff82889..0bce73e 100644 --- a/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php +++ b/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\RequestHandler * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -28,10 +28,10 @@ trait RequestHandlerTrait protected $middleware; /** @var callable */ - private $handler; + protected $handler; /** @var ContainerInterface|null */ - private $container; + protected $container; /** * {@inheritdoc} diff --git a/system/src/Grav/Framework/Route/Route.php b/system/src/Grav/Framework/Route/Route.php index d4d9078..6f94988 100644 --- a/system/src/Grav/Framework/Route/Route.php +++ b/system/src/Grav/Framework/Route/Route.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Route * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Route/RouteFactory.php b/system/src/Grav/Framework/Route/RouteFactory.php index fa1a76c..8d14e9a 100644 --- a/system/src/Grav/Framework/Route/RouteFactory.php +++ b/system/src/Grav/Framework/Route/RouteFactory.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Route * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Session/Exceptions/SessionException.php b/system/src/Grav/Framework/Session/Exceptions/SessionException.php index a07e87d..7354660 100644 --- a/system/src/Grav/Framework/Session/Exceptions/SessionException.php +++ b/system/src/Grav/Framework/Session/Exceptions/SessionException.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Session * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Session/Messages.php b/system/src/Grav/Framework/Session/Messages.php index 37c62a9..0b921e1 100644 --- a/system/src/Grav/Framework/Session/Messages.php +++ b/system/src/Grav/Framework/Session/Messages.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Session * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Session/Session.php b/system/src/Grav/Framework/Session/Session.php index 108563e..0dd9aed 100644 --- a/system/src/Grav/Framework/Session/Session.php +++ b/system/src/Grav/Framework/Session/Session.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Session * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ @@ -317,6 +317,8 @@ class Session implements SessionInterface $this->removeCookie(); + $this->onBeforeSessionStart(); + $success = @session_start($this->options); if (!$success) { $last = error_get_last(); @@ -456,6 +458,10 @@ class Session implements SessionInterface return \PHP_SAPI !== 'cli' ? \PHP_SESSION_ACTIVE === session_status() : false; } + protected function onBeforeSessionStart(): void + { + } + protected function onSessionStart(): void { } diff --git a/system/src/Grav/Framework/Session/SessionInterface.php b/system/src/Grav/Framework/Session/SessionInterface.php index fa2873d..85d0bd8 100644 --- a/system/src/Grav/Framework/Session/SessionInterface.php +++ b/system/src/Grav/Framework/Session/SessionInterface.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Session * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Uri/Uri.php b/system/src/Grav/Framework/Uri/Uri.php index 6355a1f..2b9b1a3 100644 --- a/system/src/Grav/Framework/Uri/Uri.php +++ b/system/src/Grav/Framework/Uri/Uri.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Uri * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Uri/UriFactory.php b/system/src/Grav/Framework/Uri/UriFactory.php index ebfec03..f70194e 100644 --- a/system/src/Grav/Framework/Uri/UriFactory.php +++ b/system/src/Grav/Framework/Uri/UriFactory.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Uri * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Uri/UriPartsFilter.php b/system/src/Grav/Framework/Uri/UriPartsFilter.php index 260711b..ab2ed1b 100644 --- a/system/src/Grav/Framework/Uri/UriPartsFilter.php +++ b/system/src/Grav/Framework/Uri/UriPartsFilter.php @@ -3,7 +3,7 @@ /** * @package Grav\Framework\Uri * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Installer/Install.php b/system/src/Grav/Installer/Install.php index 0f23e89..bba2729 100644 --- a/system/src/Grav/Installer/Install.php +++ b/system/src/Grav/Installer/Install.php @@ -3,7 +3,7 @@ /** * @package Grav\Installer * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Installer/InstallException.php b/system/src/Grav/Installer/InstallException.php index cdd5b7a..67c2dcc 100644 --- a/system/src/Grav/Installer/InstallException.php +++ b/system/src/Grav/Installer/InstallException.php @@ -3,7 +3,7 @@ /** * @package Grav\Installer * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Installer/Versions.php b/system/src/Grav/Installer/Versions.php index 92a64ce..dcba347 100644 --- a/system/src/Grav/Installer/Versions.php +++ b/system/src/Grav/Installer/Versions.php @@ -3,7 +3,7 @@ /** * @package Grav\Installer * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Installer/YamlUpdater.php b/system/src/Grav/Installer/YamlUpdater.php index fe1c7f1..42be7ad 100644 --- a/system/src/Grav/Installer/YamlUpdater.php +++ b/system/src/Grav/Installer/YamlUpdater.php @@ -3,7 +3,7 @@ /** * @package Grav\Installer * - * @copyright Copyright (c) 2015 - 2022 Trilby Media, LLC. All rights reserved. + * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/user/config/versions.yaml b/user/config/versions.yaml index 092f378..21f36c8 100644 --- a/user/config/versions.yaml +++ b/user/config/versions.yaml @@ -1,9 +1,10 @@ core: grav: - version: 1.7.31 + version: 1.7.38 schema: 1.7.0_2020-11-20_1 history: - { version: 1.7.16, date: '2021-06-10 14:03:35' } - { version: 1.7.21, date: '2021-09-16 12:41:14' } - { version: 1.7.25, date: '2021-12-06 12:22:00' } - { version: 1.7.31, date: '2022-03-15 08:48:47' } + - { version: 1.7.38, date: '2023-01-03 15:06:08' }