(Grav GitSync) Automatic Commit from dan

This commit is contained in:
dan 2022-04-15 11:29:38 +12:00 committed by GitSync
parent 0707f0b5de
commit f9d63ecb17
196 changed files with 3373 additions and 25355 deletions

View File

@ -0,0 +1,32 @@
---
title: 'More privacy for your browser (Firefox, Librewolf, Tor, Iceraven & Pale Moon)'
published: true
date: '14-04-2022 23:00'
taxonomy:
category:
- news
tag:
- tutorials
- desktop
- android
- browser
- firefox
- tor
- palemoon
- iceraven
aura:
author: dan
---
# Browser
We have added a guide to achieve more privacy for your browser in our wiki for [Desktop](https://wiki.techsaviours.org/en/desktop/services/browser) and [Android](https://wiki.techsaviours.org/en/phone/apps/browser).
## Desktop
It includes [Firefox](https://www.mozilla.org/en-US/firefox/new/) (vanilla) with [arkenfoxs user.js](https://github.com/arkenfox/user.js), [Librewolf](https://librewolf.net/), [Tor Browser](https://www.torproject.org/) and [Pale Moon](https://www.palemoon.org/).
## Android
It includes [Iceraven](https://github.com/fork-maintainers/iceraven-browser) (via [FFUpdater](https://github.com/Tobi823/ffupdater)) and Tor Browser ([Guardian Project](https://guardianproject.info/)).
# Special thanks
Special thanks to [Werwolf](https://fosstodon.org/web/@werwolf) for the Pale Moon and user.js tutorials at https://blackgnu.net/.

View File

@ -1,7 +1,26 @@
# v1.10.32
## 03/28/2022
1. [](#new)
* Require **Grav 1.7.32**, **Form 6.0.0**, **Login 3.7.0**, **Email 3.1.6** and **Flex Objects 1.2.0**
2. [](#improved)
* List field: Support for default values other than key/value [#2255](https://github.com/getgrav/grav-plugin-admin/issues/2255)
* Added question icon to admin fields with help text [#2261](https://github.com/getgrav/grav-plugin-admin/issues/2261)
3. [](#bugfix)
* Fix nested `toggleable`: originalValue now checks with `??` instead of `is defined`
# v1.10.31
## 03/14/2022
1. [](#new)
* Added new local Multiavatar (local generation). **This will be default in Grav 1.8**
2. [](#bugfix)
* Patch `collection.js` [#2235](https://github.com/getgrav/grav-plugin-admin/issues/2235)
# v1.10.30.2
## 02/09/2022
1. [](#bugfix)
2. [](#bugfix)
* Fixed regression preventing new `elements` field from saving its state
# v1.10.30.1

View File

@ -82,7 +82,6 @@ class AdminPlugin extends Plugin
{
return [
'onPluginsInitialized' => [
['autoload', 100001],
['setup', 100000],
['onPluginsInitialized', 1001]
],
@ -176,8 +175,6 @@ class AdminPlugin extends Plugin
}
/**
* [onPluginsInitialized:100000] Composer autoload.
*
* @return ClassLoader
*/
public function autoload(): ClassLoader

View File

@ -1,7 +1,7 @@
name: Admin Panel
slug: admin
type: plugin
version: 1.10.30.2
version: 1.10.32
description: Adds an advanced administration panel to manage your site
icon: empire
author:
@ -15,11 +15,11 @@ docs: https://github.com/getgrav/grav-plugin-admin/blob/develop/README.md
license: MIT
dependencies:
- { name: grav, version: '>=1.7.30' }
- { name: form, version: '>=5.1.0' }
- { name: login, version: '>=3.6.2' }
- { name: email, version: '>=3.1.0' }
- { name: flex-objects, version: '>=1.1.0' }
- { name: grav, version: '>=1.7.32' }
- { name: form, version: '>=6.0.0' }
- { name: login, version: '>=3.7.0' }
- { name: email, version: '>=3.1.6' }
- { name: flex-objects, version: '>=1.2.0' }
form:
validation: loose

View File

@ -190,16 +190,16 @@
},
{
"name": "scssphp/scssphp",
"version": "v1.10.0",
"version": "v1.10.2",
"source": {
"type": "git",
"url": "https://github.com/scssphp/scssphp.git",
"reference": "9699a52a862da4efb43985943afa17150155dd3d"
"reference": "387f4f4abf5d99f16be16314c5ab856f81c82f46"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/scssphp/scssphp/zipball/9699a52a862da4efb43985943afa17150155dd3d",
"reference": "9699a52a862da4efb43985943afa17150155dd3d",
"url": "https://api.github.com/repos/scssphp/scssphp/zipball/387f4f4abf5d99f16be16314c5ab856f81c82f46",
"reference": "387f4f4abf5d99f16be16314c5ab856f81c82f46",
"shasum": ""
},
"require": {
@ -258,9 +258,9 @@
],
"support": {
"issues": "https://github.com/scssphp/scssphp/issues",
"source": "https://github.com/scssphp/scssphp/tree/v1.10.0"
"source": "https://github.com/scssphp/scssphp/tree/v1.10.2"
},
"time": "2022-01-06T18:16:18+00:00"
"time": "2022-03-02T21:15:09+00:00"
}
],
"packages-dev": [
@ -506,29 +506,30 @@
},
{
"name": "doctrine/instantiator",
"version": "1.4.0",
"version": "1.4.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
"reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b"
"reference": "10dcfce151b967d20fde1b34ae6640712c3891bc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b",
"reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc",
"reference": "10dcfce151b967d20fde1b34ae6640712c3891bc",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"require-dev": {
"doctrine/coding-standard": "^8.0",
"doctrine/coding-standard": "^9",
"ext-pdo": "*",
"ext-phar": "*",
"phpbench/phpbench": "^0.13 || 1.0.0-alpha2",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0"
"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"
},
"type": "library",
"autoload": {
@ -555,7 +556,7 @@
],
"support": {
"issues": "https://github.com/doctrine/instantiator/issues",
"source": "https://github.com/doctrine/instantiator/tree/1.4.0"
"source": "https://github.com/doctrine/instantiator/tree/1.4.1"
},
"funding": [
{
@ -571,7 +572,7 @@
"type": "tidelift"
}
],
"time": "2020-11-10T18:47:58+00:00"
"time": "2022-03-03T08:28:38+00:00"
},
{
"name": "facebook/webdriver",
@ -730,12 +731,12 @@
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\": "src/"
},
"files": [
"src/functions_include.php"
]
],
"psr-4": {
"GuzzleHttp\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -792,12 +793,12 @@
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Promise\\": "src/"
},
"files": [
"src/functions_include.php"
]
],
"psr-4": {
"GuzzleHttp\\Promise\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -851,16 +852,16 @@
},
{
"name": "guzzlehttp/psr7",
"version": "1.8.3",
"version": "1.8.5",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "1afdd860a2566ed3c2b0b4a3de6e23434a79ec85"
"reference": "337e3ad8e5716c15f9657bd214d16cc5e69df268"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/1afdd860a2566ed3c2b0b4a3de6e23434a79ec85",
"reference": "1afdd860a2566ed3c2b0b4a3de6e23434a79ec85",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/337e3ad8e5716c15f9657bd214d16cc5e69df268",
"reference": "337e3ad8e5716c15f9657bd214d16cc5e69df268",
"shasum": ""
},
"require": {
@ -941,7 +942,7 @@
],
"support": {
"issues": "https://github.com/guzzle/psr7/issues",
"source": "https://github.com/guzzle/psr7/tree/1.8.3"
"source": "https://github.com/guzzle/psr7/tree/1.8.5"
},
"funding": [
{
@ -957,29 +958,33 @@
"type": "tidelift"
}
],
"time": "2021-10-05T13:56:00+00:00"
"time": "2022-03-20T21:51:18+00:00"
},
{
"name": "myclabs/deep-copy",
"version": "1.10.2",
"version": "1.11.0",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220"
"reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220",
"reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614",
"reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"conflict": {
"doctrine/collections": "<1.6.8",
"doctrine/common": "<2.13.3 || >=3,<3.2.2"
},
"require-dev": {
"doctrine/collections": "^1.0",
"doctrine/common": "^2.6",
"phpunit/phpunit": "^7.1"
"doctrine/collections": "^1.6.8",
"doctrine/common": "^2.13.3 || ^3.2.2",
"phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13"
},
"type": "library",
"autoload": {
@ -1004,7 +1009,7 @@
],
"support": {
"issues": "https://github.com/myclabs/DeepCopy/issues",
"source": "https://github.com/myclabs/DeepCopy/tree/1.10.2"
"source": "https://github.com/myclabs/DeepCopy/tree/1.11.0"
},
"funding": [
{
@ -1012,7 +1017,7 @@
"type": "tidelift"
}
],
"time": "2020-11-13T09:40:50+00:00"
"time": "2022-03-03T13:19:32+00:00"
},
{
"name": "phar-io/manifest",
@ -2613,16 +2618,16 @@
},
{
"name": "symfony/console",
"version": "v4.4.37",
"version": "v4.4.38",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "0259f01dbf9d77badddbbf4c2abb681f24c9cac6"
"reference": "5a50085bf5460f0c0d60a50b58388c1249826b8a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/0259f01dbf9d77badddbbf4c2abb681f24c9cac6",
"reference": "0259f01dbf9d77badddbbf4c2abb681f24c9cac6",
"url": "https://api.github.com/repos/symfony/console/zipball/5a50085bf5460f0c0d60a50b58388c1249826b8a",
"reference": "5a50085bf5460f0c0d60a50b58388c1249826b8a",
"shasum": ""
},
"require": {
@ -2683,7 +2688,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.37"
"source": "https://github.com/symfony/console/tree/v4.4.38"
},
"funding": [
{
@ -2699,7 +2704,7 @@
"type": "tidelift"
}
],
"time": "2022-01-26T16:15:26+00:00"
"time": "2022-01-30T21:23:57+00:00"
},
{
"name": "symfony/css-selector",
@ -2836,16 +2841,16 @@
},
{
"name": "symfony/dom-crawler",
"version": "v4.4.37",
"version": "v4.4.39",
"source": {
"type": "git",
"url": "https://github.com/symfony/dom-crawler.git",
"reference": "60d36408a3a48500bcc6e30d9f831e51d04d7fa4"
"reference": "4e9215a8b533802ba84a3cc5bd3c43103e7a6dc3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/60d36408a3a48500bcc6e30d9f831e51d04d7fa4",
"reference": "60d36408a3a48500bcc6e30d9f831e51d04d7fa4",
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/4e9215a8b533802ba84a3cc5bd3c43103e7a6dc3",
"reference": "4e9215a8b533802ba84a3cc5bd3c43103e7a6dc3",
"shasum": ""
},
"require": {
@ -2890,7 +2895,7 @@
"description": "Eases DOM navigation for HTML and XML documents",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/dom-crawler/tree/v4.4.37"
"source": "https://github.com/symfony/dom-crawler/tree/v4.4.39"
},
"funding": [
{
@ -2906,7 +2911,7 @@
"type": "tidelift"
}
],
"time": "2022-01-02T09:41:36+00:00"
"time": "2022-02-25T10:38:15+00:00"
},
{
"name": "symfony/event-dispatcher",
@ -3135,7 +3140,7 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.24.0",
"version": "v1.25.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
@ -3167,12 +3172,12 @@
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [
"bootstrap.php"
]
],
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -3197,7 +3202,7 @@
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0"
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0"
},
"funding": [
{
@ -3217,7 +3222,7 @@
},
{
"name": "symfony/polyfill-intl-idn",
"version": "v1.24.0",
"version": "v1.25.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-idn.git",
@ -3284,7 +3289,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.24.0"
"source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.25.0"
},
"funding": [
{
@ -3304,7 +3309,7 @@
},
{
"name": "symfony/polyfill-intl-normalizer",
"version": "v1.24.0",
"version": "v1.25.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
@ -3368,7 +3373,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.24.0"
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.25.0"
},
"funding": [
{
@ -3388,7 +3393,7 @@
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.24.0",
"version": "v1.25.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
@ -3420,12 +3425,12 @@
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [
"bootstrap.php"
]
],
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -3451,7 +3456,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.24.0"
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0"
},
"funding": [
{
@ -3471,16 +3476,16 @@
},
{
"name": "symfony/polyfill-php80",
"version": "v1.24.0",
"version": "v1.25.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "57b712b08eddb97c762a8caa32c84e037892d2e9"
"reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/57b712b08eddb97c762a8caa32c84e037892d2e9",
"reference": "57b712b08eddb97c762a8caa32c84e037892d2e9",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4407588e0d3f1f52efb65fbe92babe41f37fe50c",
"reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c",
"shasum": ""
},
"require": {
@ -3534,7 +3539,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.24.0"
"source": "https://github.com/symfony/polyfill-php80/tree/v1.25.0"
},
"funding": [
{
@ -3550,7 +3555,7 @@
"type": "tidelift"
}
],
"time": "2021-09-13T13:58:33+00:00"
"time": "2022-03-04T08:16:47+00:00"
},
{
"name": "symfony/process",

View File

@ -1137,3 +1137,6 @@ PLUGIN_ADMIN:
ACTIVATION_REQUIRED: "Activation required to configure"
SESSION_SECURE_HTTPS: "Secure (HTTPS)"
SESSION_SECURE_HTTPS_HELP: "Set session secure on HTTPS but not on HTTP. Has no effect if you have above Secure setting set to true. Set to false if your site jumps between HTTP and HTTPS."
AVATAR: "Avatar Generator"
AVATAR_HELP: "Multiavatar is a locally generated avatar. Gravatar is an external service that uses your email address to pull a preconfigured Avatar remotely"
AVATAR_HASH: "NOTE: Optional Avatar custom 'hash' string"

View File

@ -218,7 +218,7 @@ export default class CollectionsField {
? observedValue
: index);
['name', 'data-grav-field-name', 'for', 'id', 'data-grav-file-settings', 'data-file-post-add', 'data-file-post-remove', 'data-grav-array-name'].forEach((prop) => {
['name', 'data-grav-field-name', 'for', 'id', 'data-grav-file-settings', 'data-file-post-add', 'data-file-post-remove', 'data-grav-array-name', 'data-grav-elements'].forEach((prop) => {
item.find('[' + prop + '], [_' + prop + ']').each(function() {
let element = $(this);
let indexes = [];

View File

@ -1514,4 +1514,7 @@ span.range-append {
.jqCron-container.disable .jqCron-selector-title {
background: #ffffff !important; }
.hint-icon {
color: #06A599; }
/*# sourceMappingURL=preset.css.map */

File diff suppressed because one or more lines are too long

View File

@ -1004,6 +1004,11 @@ form label {
margin: 0; }
form label [data-hint] {
display: inline; }
form label .hint-icon {
opacity: 0.7;
transition: 0.5s opacity; }
form label:hover .hint-icon {
opacity: 1.0; }
form label.inline {
display: inline;
vertical-align: middle;
@ -2743,7 +2748,7 @@ table.noflex {
font-size: 1.1rem;
margin: 0;
linep-height: 1.2; }
.user-details .gravatar {
.user-details .avatar {
font-size: 0.9rem;
padding: 0; }
@media only all and (max-width: 47.938em) {

File diff suppressed because one or more lines are too long

View File

@ -5869,7 +5869,7 @@ var CollectionsField = /*#__PURE__*/function () {
var hasCustomKey = observed.length;
var currentKey = item.data('collection-key-backup');
item.attr('data-collection-key', hasCustomKey ? observedValue : index);
['name', 'data-grav-field-name', 'for', 'id', 'data-grav-file-settings', 'data-file-post-add', 'data-file-post-remove', 'data-grav-array-name'].forEach(function (prop) {
['name', 'data-grav-field-name', 'for', 'id', 'data-grav-file-settings', 'data-file-post-add', 'data-file-post-remove', 'data-grav-array-name', 'data-grav-elements'].forEach(function (prop) {
item.find('[' + prop + '], [_' + prop + ']').each(function () {
var element = external_jQuery_default()(this);
var indexes = [];
@ -15265,4 +15265,4 @@ module.exports = jQuery;
/******/ Grav = __webpack_exports__;
/******/
/******/ })()
;
;

View File

@ -2366,3 +2366,7 @@ body .bootstrap-datetimepicker-widget {
.jqCron-container.disable .jqCron-selector-title {
background: $content-bg !important;
}
.hint-icon {
color: $notice_bg;
}

View File

@ -1114,7 +1114,7 @@ body.sidebar-quickopen #admin-main {
linep-height: 1.2;
}
.gravatar {
.avatar {
font-size: 0.9rem;
padding: 0;
}

View File

@ -164,6 +164,14 @@ form {
display: inline;
}
.hint-icon {
opacity: 0.7;
transition: 0.5s opacity;
}
&:hover .hint-icon {
opacity: 1.0;
}
&.inline {
display: inline;
vertical-align: middle;
@ -484,7 +492,6 @@ form {
position: relative;
padding: 0 0 0 2rem;
margin-right: 15px;
}
label:before {
content:"";

View File

@ -4,7 +4,7 @@
{% set default = field.default %}
{% set toggleable = field.toggleable ?? false %}
{% if toggleable %}
{% set originalValue = originalValue is defined ? originalValue : value %}
{% set originalValue = originalValue ?? value %}
{% set toggleableChecked = originalValue is not null %}
{% endif %}
@ -48,7 +48,7 @@
{% if field.markdown %}
<span class="hint--bottom" data-hint="{{ field.help|t|markdown(false) }}">{{ field.label|t|markdown(false)|raw }}</span>
{% else %}
<span class="hint--bottom" data-hint="{{ field.help|t }}">{{ field.label|t|raw }}</span>
<span class="hint--bottom" data-hint="{{ field.help|t }}">{{ field.label|t|raw }} <i class="hint-icon fa fa-question-circle" aria-hidden="true"></i></span>
{% endif %}
{% else %}
{% if field.markdown %}

View File

@ -1,6 +1,5 @@
{% extends "forms/field.html.twig" %}
{% set originalValue = originalValue is defined ? originalValue : value %}
{% set value = (value is null ? field.default : value) %}
{% set pattern = '^#([a-fA-F0-9]{6})|(rgba\\(\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*((0.[0-9]+)|(1.00)|1.0|1)\\s*\\))$' %}
{% block input %}

View File

@ -1,8 +1,5 @@
{% extends "forms/field.html.twig" %}
{% set originalValue = value %}
{% set value = (value is null ? field.default : value) %}
{% block input %}
<div class="colorbar current-scheme">
{% include 'forms/default/fields.html.twig' with {name: field.name, fields: field.fields} %}

View File

@ -70,10 +70,7 @@
{% endif %}
{% set field_templates = include_form_field(child.type, field_layout, default_layout) %}
{% if default_layout != 'key' %}
{% set originalValue = child_value %}
{% endif %}
{% include field_templates with { field: child, value: child_value } %}
{% include field_templates with { field: child, value: child_value, originalValue: null } %}
{% endif %}
{% endfor %}
{% endif %}

View File

@ -1,6 +1,4 @@
{% extends "forms/field.html.twig" %}
{% set originalValue = originalValue is defined ? originalValue : value %}
{% set value = (value is null ? field.default : value) %}
{% block global_attributes %}
data-grav-iconpicker

View File

@ -90,17 +90,20 @@
{% set child_value = val %}
{% else %}
{% set child_value = form ? form.value(child.name) : data.value(child.name) %}
{# Look for a default value for that field #}
{% if child_value is null and val[child_name|trim('.', 'left')] is defined %}
{% set child_value = val[child_name|trim('.', 'left')] %}
{% endif %}
{% endif %}
{% set field_templates = include_form_field(child.type, field_layout, default_layout) %}
{% set template_data = { field: child, value: child_value } %}
{% set template_data = { field: child, value: child_value, originalValue: null } %}
{% if default_layout != 'key' %}
{% set originalValue = child_value %}
{% if child.type == 'fieldset' %}
{% set template_data = template_data|merge({val: child_value}) %}
{% endif %}
{% endif %}
{%- include field_templates with template_data -%}
{% endif %}
{% endfor %}

View File

@ -1,8 +1,5 @@
{% extends "forms/fields/text/text.html.twig" %}
{% set originalValue = value %}
{% set value = (value is null ? field.default : value) %}
{% set unique_identifier = random_string() %}
{% block global_attributes %}

View File

@ -1,2 +1,2 @@
{% set user_avatar = admin.user.getAvatarUrl() %}
<img src="{{ ('?' not in user_avatar) and (not user_avatar starts with 'data:') ? user_avatar ~ '?s=80' : user_avatar }}" />
<img src="{{ user_avatar ~ '?s=80' }}" />

View File

@ -1 +1,10 @@
<p class="gravatar">{{ "PLUGIN_ADMIN.AVATAR_BY"|t }} <a href="https://gravatar.com" target="_blank" rel="noopener noreferrer">gravatar.com</a>. {{ "PLUGIN_ADMIN.AVATAR_UPLOAD_OWN"|t }}</p>
<p class="avatar">
{{ "PLUGIN_ADMIN.AVATAR_BY"|t }}
{% if config.system.accounts.avatar == 'gravatar' %}
<a href="https://gravatar.com" target="_blank" rel="noopener noreferrer">gravatar.com</a>.
{% else %}
<a href="https://multiavatar.com/" target="_blank" rel="noopener noreferrer">Multiavatar</a>.
{% endif %}
{{ "PLUGIN_ADMIN.AVATAR_UPLOAD_OWN"|t }}</p>

View File

@ -1,5 +1,2 @@
{% if data.avatar %}
<label><img src="{{ data.getAvatarUrl() }}" /></label>
{% else %}
<label><img referrerpolicy="no-referrer" src="https://www.gravatar.com/avatar/{{ data.email|md5 }}?s=200" /></label>
{% endif %}
{% set user_avatar = data.getAvatarUrl() %}
<label><img referrerpolicy="no-referrer" src="{{ user_avatar ~ '?s=200' }}" /></label>

View File

@ -193,17 +193,17 @@
},
{
"name": "scssphp/scssphp",
"version": "v1.10.0",
"version_normalized": "1.10.0.0",
"version": "v1.10.2",
"version_normalized": "1.10.2.0",
"source": {
"type": "git",
"url": "https://github.com/scssphp/scssphp.git",
"reference": "9699a52a862da4efb43985943afa17150155dd3d"
"reference": "387f4f4abf5d99f16be16314c5ab856f81c82f46"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/scssphp/scssphp/zipball/9699a52a862da4efb43985943afa17150155dd3d",
"reference": "9699a52a862da4efb43985943afa17150155dd3d",
"url": "https://api.github.com/repos/scssphp/scssphp/zipball/387f4f4abf5d99f16be16314c5ab856f81c82f46",
"reference": "387f4f4abf5d99f16be16314c5ab856f81c82f46",
"shasum": ""
},
"require": {
@ -226,7 +226,7 @@
"ext-iconv": "Can be used as fallback when ext-mbstring is not available",
"ext-mbstring": "For best performance, mbstring should be installed as it is faster than ext-iconv"
},
"time": "2022-01-06T18:16:18+00:00",
"time": "2022-03-02T21:15:09+00:00",
"bin": [
"bin/pscss"
],
@ -264,7 +264,7 @@
],
"support": {
"issues": "https://github.com/scssphp/scssphp/issues",
"source": "https://github.com/scssphp/scssphp/tree/v1.10.0"
"source": "https://github.com/scssphp/scssphp/tree/v1.10.2"
},
"install-path": "../scssphp/scssphp"
}

View File

@ -5,7 +5,7 @@
'type' => 'grav-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '9317a497fbe62505ab8159be67cc6d365d21201f',
'reference' => '5c1e6d6d52f8fc8e0540b5599e736e25ea20c446',
'name' => 'getgrav/grav-plugin-admin',
'dev' => false,
),
@ -16,7 +16,7 @@
'type' => 'grav-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '9317a497fbe62505ab8159be67cc6d365d21201f',
'reference' => '5c1e6d6d52f8fc8e0540b5599e736e25ea20c446',
'dev_requirement' => false,
),
'laminas/laminas-xml' => array(
@ -53,12 +53,12 @@
'dev_requirement' => false,
),
'scssphp/scssphp' => array(
'pretty_version' => 'v1.10.0',
'version' => '1.10.0.0',
'pretty_version' => 'v1.10.2',
'version' => '1.10.2.0',
'type' => 'library',
'install_path' => __DIR__ . '/../scssphp/scssphp',
'aliases' => array(),
'reference' => '9699a52a862da4efb43985943afa17150155dd3d',
'reference' => '387f4f4abf5d99f16be16314c5ab856f81c82f46',
'dev_requirement' => false,
),
'symfony/polyfill-php72' => array(

View File

@ -50,16 +50,16 @@
"type": "package",
"package": {
"name": "sass/sass-spec",
"version": "2021.11.30",
"version": "2022.02.24",
"source": {
"type": "git",
"url": "https://github.com/sass/sass-spec.git",
"reference": "ee5b460ac84b1ce27b86e22c0252b4296444cf3a"
"reference": "f41b9bfb9a3013392f2136c79f7f3356f15fb8ba"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sass/sass-spec/zipball/ee5b460ac84b1ce27b86e22c0252b4296444cf3a",
"reference": "ee5b460ac84b1ce27b86e22c0252b4296444cf3a",
"url": "https://api.github.com/repos/sass/sass-spec/zipball/f41b9bfb9a3013392f2136c79f7f3356f15fb8ba",
"reference": "f41b9bfb9a3013392f2136c79f7f3356f15fb8ba",
"shasum": ""
}
}

View File

@ -166,7 +166,7 @@ class Compiler
/**
* @var array
* @phpstan-var array<string, array{0: callable, 1: array|null}>
* @phpstan-var array<string, array{0: callable, 1: string[]|null}>
*/
protected $userFunctions = [];
/**
@ -211,9 +211,15 @@ class Compiler
private $charset = true;
/**
* @var string|\ScssPhp\ScssPhp\Formatter
* @var Formatter
*/
protected $formatter = Expanded::class;
protected $formatter;
/**
* @var string
* @phpstan-var class-string<Formatter>
*/
private $configuredFormatter = Expanded::class;
/**
* @var Environment
@ -381,7 +387,7 @@ class Compiler
'encoding' => $this->encoding,
'sourceMap' => serialize($this->sourceMap),
'sourceMapOptions' => $this->sourceMapOptions,
'formatter' => $this->formatter,
'formatter' => $this->configuredFormatter,
'legacyImportPath' => $this->legacyCwdImportPath,
];
@ -502,7 +508,7 @@ class Compiler
$tree = $this->parser->parse($source);
$this->parser = null;
$this->formatter = new $this->formatter();
$this->formatter = new $this->configuredFormatter();
$this->rootBlock = null;
$this->rootEnv = $this->pushEnv($tree);
@ -529,6 +535,7 @@ class Compiler
$sourceMapGenerator = new SourceMapGenerator($this->sourceMapOptions);
}
}
assert($this->scope !== null);
$out = $this->formatter->format($this->scope, $sourceMapGenerator);
@ -542,6 +549,7 @@ class Compiler
$sourceMap = null;
if (! empty($out) && $this->sourceMap && $this->sourceMap !== self::SOURCE_MAP_NONE) {
assert($sourceMapGenerator !== null);
$sourceMap = $sourceMapGenerator->generateJson($prefix);
$sourceMapUrl = null;
@ -671,7 +679,7 @@ class Compiler
/**
* Push extends
*
* @param array $target
* @param string[] $target
* @param array $origin
* @param array|null $block
*
@ -714,9 +722,9 @@ class Compiler
$out->sourceLine = $this->env->block->sourceLine;
$out->sourceColumn = $this->env->block->sourceColumn;
} else {
$out->sourceName = null;
$out->sourceLine = null;
$out->sourceColumn = null;
$out->sourceName = isset($this->sourceNames[$this->sourceIndex]) ? $this->sourceNames[$this->sourceIndex] : '(stdin)';
$out->sourceLine = $this->sourceLine;
$out->sourceColumn = $this->sourceColumn;
}
return $out;
@ -734,6 +742,7 @@ class Compiler
$this->rootBlock = $this->scope = $this->makeOutputBlock(Type::T_ROOT);
$this->compileChildrenNoReturn($rootBlock->children, $this->scope);
assert($this->scope !== null);
$this->flattenSelectors($this->scope);
$this->missingSelectors();
}
@ -815,6 +824,7 @@ class Compiler
}
if ($placeholderSelector && 0 === \count($block->selectors) && null !== $parentKey) {
assert($block->parent !== null);
unset($block->parent->children[$parentKey]);
return;
@ -1287,6 +1297,7 @@ class Compiler
$mediaQueries = $this->compileMediaQuery($this->multiplyMedia($this->env));
if (! empty($mediaQueries)) {
assert($this->scope !== null);
$previousScope = $this->scope;
$parentScope = $this->mediaParent($this->scope);
@ -1452,7 +1463,7 @@ class Compiler
if (
! $selfParent->selectors &&
isset($block->parent) && $block->parent &&
isset($block->parent) &&
isset($block->parent->selectors) && $block->parent->selectors
) {
$selfParent = $block->parent;
@ -1460,13 +1471,15 @@ class Compiler
$this->env = $this->filterWithWithout($envs, $with, $without);
assert($this->scope !== null);
$saveScope = $this->scope;
$this->scope = $this->filterScopeWithWithout($saveScope, $with, $without);
// propagate selfParent to the children where they still can be useful
$this->compileChildrenNoReturn($block->children, $this->scope, $selfParent);
$this->scope = $this->completeScope($this->scope, $saveScope);
assert($this->scope !== null);
$this->completeScope($this->scope, $saveScope);
$this->scope = $saveScope;
$this->env = $this->extractEnv($envs);
@ -1490,6 +1503,7 @@ class Compiler
if ($scope->type === Type::T_ROOT) {
return $scope;
}
assert($this->rootBlock !== null);
// start from the root
while ($scope->parent && $scope->parent->type !== Type::T_ROOT) {
@ -1557,7 +1571,7 @@ class Compiler
*/
protected function completeScope($scope, $previousScope)
{
if (! $scope->type && (! $scope->selectors || ! \count($scope->selectors)) && \count($scope->lines)) {
if (! $scope->type && ! $scope->selectors && \count($scope->lines)) {
$scope->selectors = $this->findScopeSelectors($previousScope, $scope->depth);
}
@ -1768,10 +1782,12 @@ class Compiler
$this->scope = $this->makeOutputBlock($block->type, $selectors);
$this->scope->depth = 1;
assert($this->scope->parent !== null);
$this->scope->parent->children[] = $this->scope;
$this->compileChildrenNoReturn($block->children, $this->scope);
assert($this->scope !== null);
$this->scope = $this->scope->parent;
$this->env = $this->extractEnv($envs);
@ -1829,6 +1845,7 @@ class Compiler
$this->pushEnv($block);
$this->scope = $this->makeOutputBlock($block->type, $selectors);
assert($this->scope->parent !== null);
$this->scope->parent->children[] = $this->scope;
// wrap assign children in a block
@ -1862,6 +1879,7 @@ class Compiler
$this->compileChildrenNoReturn($block->children, $this->scope);
assert($this->scope !== null);
$this->scope = $this->scope->parent;
$this->popEnv();
@ -1890,10 +1908,12 @@ class Compiler
protected function compileBlock(Block $block)
{
$env = $this->pushEnv($block);
assert($block->selectors !== null);
$env->selectors = $this->evalSelectors($block->selectors);
$out = $this->makeOutputBlock(null);
assert($this->scope !== null);
$this->scope->children[] = $out;
if (\count($block->children)) {
@ -1911,6 +1931,7 @@ class Compiler
// and revert for the following children of the same block
if ($selfParentSelectors) {
assert($block->selfParent !== null);
$block->selfParent->selectors = $selfParentSelectors;
}
}
@ -1966,6 +1987,7 @@ class Compiler
$out = $this->makeOutputBlock(Type::T_COMMENT);
$out->lines[] = $this->compileCommentValue($block, true);
assert($this->scope !== null);
$this->scope->children[] = $out;
}
@ -1980,7 +2002,11 @@ class Compiler
{
$this->shouldEvaluate = false;
$selectors = array_map([$this, 'evalSelector'], $selectors);
$evaluatedSelectors = [];
foreach ($selectors as $selector) {
$evaluatedSelectors[] = $this->evalSelector($selector);
}
$selectors = $evaluatedSelectors;
// after evaluating interpolates, we might need a second pass
if ($this->shouldEvaluate) {
@ -2008,6 +2034,8 @@ class Compiler
* @param array $selector
*
* @return array
*
* @phpstan-impure
*/
protected function evalSelector($selector)
{
@ -2020,6 +2048,8 @@ class Compiler
* @param array $part
*
* @return array
*
* @phpstan-impure
*/
protected function evalSelectorPart($part)
{
@ -2033,8 +2063,8 @@ class Compiler
}
} elseif (
\is_string($p) && \strlen($p) >= 2 &&
($first = $p[0]) && ($first === '"' || $first === "'") &&
substr($p, -1) === $first
($p[0] === '"' || $p[0] === "'") &&
substr($p, -1) === $p[0]
) {
$p = substr($p, 1, -1);
}
@ -2401,7 +2431,7 @@ class Compiler
$queryString = $this->compileMediaQuery([$queryList[$kql]]);
$queryString = reset($queryString);
if (strpos($queryString, '@media ') === 0) {
if ($queryString !== false && strpos($queryString, '@media ') === 0) {
$queryString = substr($queryString, 7);
$queries = [];
@ -2857,7 +2887,7 @@ class Compiler
$this->sourceIndex = isset($child[Parser::SOURCE_INDEX]) ? $child[Parser::SOURCE_INDEX] : null;
$this->sourceLine = isset($child[Parser::SOURCE_LINE]) ? $child[Parser::SOURCE_LINE] : -1;
$this->sourceColumn = isset($child[Parser::SOURCE_COLUMN]) ? $child[Parser::SOURCE_COLUMN] : -1;
} elseif (\is_array($child) && isset($child[1]->sourceLine)) {
} elseif (\is_array($child) && isset($child[1]->sourceLine) && $child[1] instanceof Block) {
$this->sourceIndex = $child[1]->sourceIndex;
$this->sourceLine = $child[1]->sourceLine;
$this->sourceColumn = $child[1]->sourceColumn;
@ -3093,6 +3123,7 @@ class Compiler
if (! $selectors && isset($child['selfParent'])) {
$selectors = $this->multiplySelectors($this->env, $child['selfParent']);
}
assert($selectors !== null);
if (\count($result) > 1) {
$replacement = implode(', ', $result);
@ -3255,7 +3286,7 @@ EOL;
// and assign this fake parent to childs
$selfParent = null;
if (isset($child['selfParent']) && isset($child['selfParent']->selectors)) {
if (isset($child['selfParent']) && $child['selfParent'] instanceof Block && isset($child['selfParent']->selectors)) {
$selfParent = $child['selfParent'];
} else {
$parentSelectors = $this->multiplySelectors($this->env);
@ -3265,7 +3296,7 @@ EOL;
$parent->selectors = $parentSelectors;
foreach ($mixin->children as $k => $child) {
if (isset($child[1]) && \is_object($child[1]) && $child[1] instanceof Block) {
if (isset($child[1]) && $child[1] instanceof Block) {
$mixin->children[$k][1]->parent = $parent;
}
}
@ -3371,6 +3402,8 @@ EOL;
default:
throw $this->error("unknown child type: $child[0]");
}
return null;
}
/**
@ -3505,32 +3538,24 @@ EOL;
$ucLType = ucfirst($ltype);
$ucRType = ucfirst($rtype);
$shouldEval = $inParens || $inExp;
// this tries:
// 1. op[op name][left type][right type]
// 2. op[left type][right type] (passing the op as first arg
// 2. op[left type][right type] (passing the op as first arg)
// 3. op[op name]
$fn = "op${ucOpName}${ucLType}${ucRType}";
if (\is_callable([$this, $fn = "op${ucOpName}${ucLType}${ucRType}"])) {
$out = $this->$fn($left, $right, $shouldEval);
} elseif (\is_callable([$this, $fn = "op${ucLType}${ucRType}"])) {
$out = $this->$fn($op, $left, $right, $shouldEval);
} elseif (\is_callable([$this, $fn = "op${ucOpName}"])) {
$out = $this->$fn($left, $right, $shouldEval);
} else {
$out = null;
}
if (
\is_callable([$this, $fn]) ||
(($fn = "op${ucLType}${ucRType}") &&
\is_callable([$this, $fn]) &&
$passOp = true) ||
(($fn = "op${ucOpName}") &&
\is_callable([$this, $fn]) &&
$genOp = true)
) {
$shouldEval = $inParens || $inExp;
if (isset($passOp)) {
$out = $this->$fn($op, $left, $right, $shouldEval);
} else {
$out = $this->$fn($left, $right, $shouldEval);
}
if (isset($out)) {
return $out;
}
if (isset($out)) {
return $out;
}
return $this->expToString($value);
@ -3872,6 +3897,7 @@ EOL;
}
if (($f = $this->getBuiltinFunction($normalizedName)) && \is_callable($f)) {
/** @var string $libName */
$libName = $f[1];
$prototype = isset(static::$$libName) ? static::$$libName : null;
@ -5517,11 +5543,11 @@ EOL;
{
switch ($style) {
case OutputStyle::EXPANDED:
$this->formatter = Expanded::class;
$this->configuredFormatter = Expanded::class;
break;
case OutputStyle::COMPRESSED:
$this->formatter = Compressed::class;
$this->configuredFormatter = Compressed::class;
break;
default:
@ -5539,6 +5565,8 @@ EOL;
* @return void
*
* @deprecated Use {@see setOutputStyle} instead.
*
* @phpstan-param class-string<Formatter> $formatterName
*/
public function setFormatter($formatterName)
{
@ -5547,7 +5575,7 @@ EOL;
}
@trigger_error('The method "setFormatter" is deprecated. Use "setOutputStyle" instead.', E_USER_DEPRECATED);
$this->formatter = $formatterName;
$this->configuredFormatter = $formatterName;
}
/**
@ -5688,6 +5716,10 @@ EOL;
// see if tree is cached
$realPath = realpath($path);
if ($realPath === false) {
$realPath = $path;
}
if (substr($path, -5) === '.sass') {
$this->sourceIndex = \count($this->sourceNames);
$this->sourceNames[] = $path;
@ -6031,6 +6063,8 @@ EOL;
*
* @param string $msg Message with optional sprintf()-style vararg parameters
*
* @return never
*
* @throws \ScssPhp\ScssPhp\Exception\CompilerException
*
* @deprecated use "error" and throw the exception in the caller instead.
@ -6050,7 +6084,8 @@ EOL;
*
* @internal
*
* @param string $msg Message with optional sprintf()-style vararg parameters
* @param string $msg Message with optional sprintf()-style vararg parameters
* @param bool|float|int|string|null ...$args
*
* @return CompilerException
*/
@ -6168,6 +6203,8 @@ EOL;
*
* @param string $name
*
* @return void
*
* @throws \Exception
*/
protected function handleImportLoop($name)
@ -6362,6 +6399,9 @@ EOL;
if (\in_array($functionName, ['libRgb', 'libRgba', 'libHsl', 'libHsla'])) {
// notation 100 127 255 / 0 is in fact a simple list of 4 values
foreach ($args as $k => $arg) {
if (!isset($arg[1])) {
continue; // This happens when using a trailing comma
}
if ($arg[1][0] === Type::T_LIST && \count($arg[1][2]) === 3) {
$args[$k][1][2] = $this->extractSlashAlphaInColorFunction($arg[1][2]);
}
@ -6794,7 +6834,7 @@ EOL;
$prototype = ['arguments' => [], 'rest_argument' => null];
$originalRestArgumentName = null;
foreach ($argDef as $i => $arg) {
foreach ($argDef as $arg) {
list($name, $default, $isVariable) = $arg;
$normalizedName = str_replace('_', '-', $name);
@ -7262,6 +7302,8 @@ EOL;
protected function coerceString($value)
{
if ($value[0] === Type::T_STRING) {
assert(\is_array($value));
return $value;
}
@ -7365,6 +7407,7 @@ EOL;
if ($value[0] !== Type::T_LIST) {
throw $this->error('expecting list, %s received', $value[0]);
}
assert(\is_array($value));
return $value;
}
@ -7534,7 +7577,7 @@ EOL;
$h = 60 * ($green - $blue) / $d;
} elseif ($green == $max) {
$h = 60 * ($blue - $red) / $d + 120;
} elseif ($blue == $max) {
} else {
$h = 60 * ($red - $green) / $d + 240;
}
}
@ -7613,9 +7656,9 @@ EOL;
*
* @api
*
* @param int $hue H from 0 to 360
* @param int $whiteness W from 0 to 100
* @param int $blackness B from 0 to 100
* @param int|float $hue H from 0 to 360
* @param int|float $whiteness W from 0 to 100
* @param int|float $blackness B from 0 to 100
*
* @return array
*/
@ -7666,7 +7709,7 @@ EOL;
$h = 60 * ($green - $blue) / $d;
} elseif ($green == $max) {
$h = 60 * ($blue - $red) / $d + 120;
} elseif ($blue == $max) {
} else {
$h = 60 * ($red - $green) / $d + 240;
}
}
@ -7790,6 +7833,14 @@ EOL;
['channels'],
['red', 'green', 'blue'],
['red', 'green', 'blue', 'alpha'] ];
/**
* @param array $args
* @param array $kwargs
* @param string $funcName
*
* @return array
*/
protected function libRgb($args, $kwargs, $funcName = 'rgb')
{
switch (\count($args)) {
@ -7872,14 +7923,7 @@ EOL;
$scale = $operation === 'scale';
$change = $operation === 'change';
/**
* @param string $name
* @param float|int $max
* @param bool $checkPercent
* @param bool $assertPercent
*
* @return float|int|null
*/
/** @phpstan-var callable(string, float|int, bool=, bool=): (float|int|null) $getParam */
$getParam = function ($name, $max, $checkPercent = false, $assertPercent = false) use (&$kwargs, $scale, $change) {
if (!isset($kwargs[$name])) {
return null;
@ -7938,7 +7982,6 @@ EOL;
$hasRgb = $red !== null || $green !== null || $blue !== null;
$hasSL = $saturation !== null || $lightness !== null;
$hasWB = $whiteness !== null || $blackness !== null;
$found = false;
if ($hasRgb && ($hasSL || $hasWB || $hue !== null)) {
throw new SassScriptException(sprintf('RGB parameters may not be passed along with %s parameters.', $hasWB ? 'HWB' : 'HSL'));
@ -8159,6 +8202,14 @@ EOL;
['hue', 'saturation'],
['hue', 'saturation', 'lightness'],
['hue', 'saturation', 'lightness', 'alpha'] ];
/**
* @param array $args
* @param array $kwargs
* @param string $funcName
*
* @return array|null
*/
protected function libHsl($args, $kwargs, $funcName = 'hsl')
{
$args_to_check = $args;
@ -8183,7 +8234,7 @@ EOL;
throw new SassScriptException('Missing argument $lightness.');
}
foreach ($kwargs as $k => $arg) {
foreach ($kwargs as $arg) {
if (in_array($arg[0], [Type::T_FUNCTION_CALL, Type::T_FUNCTION]) && in_array($arg[1], ['min', 'max'])) {
return null;
}
@ -9350,7 +9401,7 @@ will be an error in future versions of Sass.\n on line $line of $fname";
$index = $index - 1;
}
if ($index < 0) {
$index = Util::mbStrlen($stringContent) + 1 + $index;
$index = max(Util::mbStrlen($stringContent) + 1 + $index, 0);
}
$string[2] = [
@ -10003,6 +10054,8 @@ will be an error in future versions of Sass.\n on line $line of $fname";
$selectorsMap[] = $this->getSelectorArg($arg, 'selector', true);
}
assert(!empty($selectorsMap));
$envs = [];
foreach ($selectorsMap as $selectors) {

View File

@ -22,7 +22,8 @@ namespace ScssPhp\ScssPhp\Exception;
class ParserException extends \Exception implements SassException
{
/**
* @var array
* @var array|null
* @phpstan-var array{string, int, int}|null
*/
private $sourcePosition;
@ -30,6 +31,9 @@ class ParserException extends \Exception implements SassException
* Get source position
*
* @api
*
* @return array|null
* @phpstan-return array{string, int, int}|null
*/
public function getSourcePosition()
{
@ -42,6 +46,10 @@ class ParserException extends \Exception implements SassException
* @api
*
* @param array $sourcePosition
*
* @return void
*
* @phpstan-param array{string, int, int} $sourcePosition
*/
public function setSourcePosition($sourcePosition)
{

View File

@ -286,9 +286,18 @@ abstract class Formatter
ob_start();
$this->block($block);
try {
$this->block($block);
} catch (\Exception $e) {
ob_end_clean();
throw $e;
} catch (\Throwable $e) {
ob_end_clean();
throw $e;
}
$out = ob_get_clean();
assert($out !== false);
return $out;
}
@ -331,6 +340,8 @@ abstract class Formatter
// If the written line starts is empty, adding a mapping would add it for
// a non-existent column as we are at the end of the line
if ($line !== '') {
assert($this->currentBlock->sourceLine !== null);
assert($this->currentBlock->sourceName !== null);
$this->sourceMapGenerator->addMapping(
$this->currentLine,
$this->currentColumn,
@ -346,6 +357,8 @@ abstract class Formatter
}
if ($lastLine !== '') {
assert($this->currentBlock->sourceLine !== null);
assert($this->currentBlock->sourceName !== null);
$this->sourceMapGenerator->addMapping(
$this->currentLine,
$this->currentColumn,

View File

@ -57,7 +57,9 @@ class Expanded extends Formatter
foreach ($block->lines as $index => $line) {
if (substr($line, 0, 2) === '/*') {
$block->lines[$index] = preg_replace('/\r\n?|\n|\f/', $this->break, $line);
$replacedLine = preg_replace('/\r\n?|\n|\f/', $this->break, $line);
assert($replacedLine !== null);
$block->lines[$index] = $replacedLine;
}
}

View File

@ -68,7 +68,9 @@ class Nested extends Formatter
foreach ($block->lines as $index => $line) {
if (substr($line, 0, 2) === '/*') {
$block->lines[$index] = preg_replace('/\r\n?|\n|\f/', $this->break, $line);
$replacedLine = preg_replace('/\r\n?|\n|\f/', $this->break, $line);
assert($replacedLine !== null);
$block->lines[$index] = $replacedLine;
}
}

View File

@ -22,7 +22,7 @@ namespace ScssPhp\ScssPhp\Formatter;
class OutputBlock
{
/**
* @var string
* @var string|null
*/
public $type;

View File

@ -27,6 +27,7 @@ use ScssPhp\ScssPhp\Block\WhileBlock;
use ScssPhp\ScssPhp\Exception\ParserException;
use ScssPhp\ScssPhp\Logger\LoggerInterface;
use ScssPhp\ScssPhp\Logger\QuietLogger;
use ScssPhp\ScssPhp\Node\Number;
/**
* Parser
@ -85,10 +86,6 @@ class Parser
* @var array<int, int>
*/
private $sourcePositions;
/**
* @var array|null
*/
private $charset;
/**
* The current offset in the buffer
*
@ -147,11 +144,9 @@ class Parser
{
$this->sourceName = $sourceName ?: '(stdin)';
$this->sourceIndex = $sourceIndex;
$this->charset = null;
$this->utf8 = ! $encoding || strtolower($encoding) === 'utf-8';
$this->patternModifiers = $this->utf8 ? 'Aisu' : 'Ais';
$this->commentsSeen = [];
$this->commentsSeen = [];
$this->allowVars = true;
$this->cssOnly = $cssOnly;
$this->logger = $logger ?: new QuietLogger();
@ -255,7 +250,6 @@ class Parser
if ($this->cache) {
$cacheKey = $this->sourceName . ':' . md5($buffer);
$parseOptions = [
'charset' => $this->charset,
'utf8' => $this->utf8,
];
$v = $this->cache->getCache('parse', $cacheKey, $parseOptions);
@ -296,11 +290,8 @@ class Parser
throw $this->parseError('unclosed block');
}
if ($this->charset) {
array_unshift($this->env->children, $this->charset);
}
$this->restoreEncoding();
assert($this->env !== null);
if ($this->cache) {
$this->cache->setCache('parse', $cacheKey, $this->env, $parseOptions);
@ -380,8 +371,8 @@ class Parser
*
* @api
*
* @param string $buffer
* @param string|array $out
* @param string $buffer
* @param array $out
*
* @return bool
*/
@ -827,18 +818,6 @@ class Parser
$this->valueList($charset) &&
$this->end()
) {
if (! isset($this->charset)) {
$statement = [Type::T_CHARSET, $charset];
list($line, $column) = $this->getSourcePosition($s);
$statement[static::SOURCE_LINE] = $line;
$statement[static::SOURCE_COLUMN] = $column;
$statement[static::SOURCE_INDEX] = $this->sourceIndex;
$this->charset = $statement;
}
return true;
}
@ -1074,6 +1053,8 @@ class Parser
$block = $this->popBlock();
if (! isset($block->type) || $block->type !== Type::T_IF) {
assert($this->env !== null);
if ($this->env->parent) {
$this->append(null); // collect comments before next statement if needed
}
@ -1093,6 +1074,7 @@ class Parser
// collect comments just after the block closing if needed
if ($this->eatWhiteDefault) {
$this->whitespace();
assert($this->env !== null);
if ($this->env->comments) {
$this->append(null);
@ -1161,6 +1143,7 @@ class Parser
// collect comments at the beginning of a block if needed
if ($this->eatWhiteDefault) {
$this->whitespace();
assert($this->env !== null);
if ($this->env->comments) {
$this->append(null);
@ -1195,6 +1178,7 @@ class Parser
*/
protected function popBlock()
{
assert($this->env !== null);
// collect comments ending just before of a block closing
if ($this->env->comments) {
@ -1245,6 +1229,8 @@ class Parser
* Seek to position in input stream (or return current position in input stream)
*
* @param int $where
*
* @return void
*/
protected function seek($where)
{
@ -1257,6 +1243,8 @@ class Parser
* @param array|false $parsed
* @param int $startPos
*
* @return array
*
* @throws ParserException
*/
protected function assertPlainCssValid($parsed, $startPos = null)
@ -1288,7 +1276,7 @@ class Parser
* @param array $parsed
* @param bool $allowExpression
*
* @return bool|array
* @return array|false
*/
protected function isPlainCssValidElement($parsed, $allowExpression = false)
{
@ -1468,6 +1456,8 @@ class Parser
* @param string $delim Delimiter
*
* @return bool True if match; false otherwise
*
* @phpstan-impure
*/
protected function matchString(&$m, $delim)
{
@ -1508,6 +1498,8 @@ class Parser
* @param bool $eatWhitespace
*
* @return bool
*
* @phpstan-impure
*/
protected function match($regex, &$out, $eatWhitespace = null)
{
@ -1537,6 +1529,8 @@ class Parser
* @param bool $eatWhitespace
*
* @return bool
*
* @phpstan-impure
*/
protected function matchChar($char, $eatWhitespace = null)
{
@ -1565,6 +1559,8 @@ class Parser
* @param bool $eatWhitespace
*
* @return bool
*
* @phpstan-impure
*/
protected function literal($what, $len, $eatWhitespace = null)
{
@ -1589,6 +1585,8 @@ class Parser
* Match some whitespace
*
* @return bool
*
* @phpstan-impure
*/
protected function whitespace()
{
@ -1640,20 +1638,20 @@ class Parser
if (! $comment) {
// single part static comment
$this->appendComment([Type::T_COMMENT, $c]);
$commentStatement = [Type::T_COMMENT, $c];
} else {
$comment[] = $c;
$staticComment = substr($this->buffer, $startCommentCount, $endCommentCount - $startCommentCount);
$commentStatement = [Type::T_COMMENT, $staticComment, [Type::T_STRING, '', $comment]];
list($line, $column) = $this->getSourcePosition($startCommentCount);
$commentStatement[self::SOURCE_LINE] = $line;
$commentStatement[self::SOURCE_COLUMN] = $column;
$commentStatement[self::SOURCE_INDEX] = $this->sourceIndex;
$this->appendComment($commentStatement);
}
list($line, $column) = $this->getSourcePosition($startCommentCount);
$commentStatement[self::SOURCE_LINE] = $line;
$commentStatement[self::SOURCE_COLUMN] = $column;
$commentStatement[self::SOURCE_INDEX] = $this->sourceIndex;
$this->appendComment($commentStatement);
$this->commentsSeen[$startCommentCount] = true;
$this->count = $endCommentCount;
} else {
@ -1675,9 +1673,13 @@ class Parser
* Append comment to current block
*
* @param array $comment
*
* @return void
*/
protected function appendComment($comment)
{
assert($this->env !== null);
if (! $this->discardComments) {
$this->env->comments[] = $comment;
}
@ -1688,9 +1690,13 @@ class Parser
*
* @param array|null $statement
* @param int $pos
*
* @return void
*/
protected function append($statement, $pos = null)
{
assert($this->env !== null);
if (! \is_null($statement)) {
! $this->cssOnly || ($statement = $this->assertPlainCssValid($statement, $pos));
@ -1720,11 +1726,15 @@ class Parser
*/
protected function last()
{
assert($this->env !== null);
$i = \count($this->env->children) - 1;
if (isset($this->env->children[$i])) {
return $this->env->children[$i];
}
return null;
}
/**
@ -2069,10 +2079,12 @@ class Parser
/**
* Parse directive value list that considers $vars as keyword
*
* @param array $out
* @param bool|string $endChar
* @param array $out
* @param string|false $endChar
*
* @return bool
*
* @phpstan-impure
*/
protected function directiveValue(&$out, $endChar = false)
{
@ -2211,6 +2223,7 @@ class Parser
{
$s = $this->count;
$items = [];
/** @var array|Number|null $value */
$value = null;
while ($this->$parseItem($value)) {
@ -2224,9 +2237,12 @@ class Parser
$trailing_delim = true;
} else {
assert(\is_array($value) || $value instanceof Number);
// if no delim watch that a keyword didn't eat the single/double quote
// from the following starting string
if ($value[0] === Type::T_KEYWORD) {
assert(\is_array($value));
/** @var string $word */
$word = $value[1];
$last_char = substr($word, -1);
@ -2251,8 +2267,10 @@ class Parser
$this->count--;
}
/** @var array|Number|null $nextValue */
$nextValue = null;
if ($this->$parseItem($nextValue)) {
assert(\is_array($nextValue) || $nextValue instanceof Number);
if ($nextValue[0] === Type::T_KEYWORD && $nextValue[1] === $last_char) {
// bad try, forget it
$this->seek($currentCount);
@ -2306,6 +2324,8 @@ class Parser
* @param bool $lookForExp
*
* @return bool
*
* @phpstan-impure
*/
protected function expression(&$out, $listOnly = false, $lookForExp = true)
{
@ -2366,12 +2386,14 @@ class Parser
/**
* Parse expression specifically checking for lists in parenthesis or brackets
*
* @param array $out
* @param int $s
* @param string $closingParen
* @param array $allowedTypes
* @param array $out
* @param int $s
* @param string $closingParen
* @param string[] $allowedTypes
*
* @return bool
*
* @phpstan-param array<Type::*> $allowedTypes
*/
protected function enclosedExpression(&$out, $s, $closingParen = ')', $allowedTypes = [Type::T_LIST, Type::T_MAP])
{
@ -4016,7 +4038,7 @@ class Parser
*
* @param array $value
*
* @return array
* @return string[]
*/
protected function stripAssignmentFlags(&$value)
{
@ -4043,7 +4065,7 @@ class Parser
*
* @param array $selectors
*
* @return string
* @return bool
*/
protected function stripOptionalFlag(&$selectors)
{
@ -4092,6 +4114,8 @@ class Parser
* Extract line numbers from buffer
*
* @param string $buffer
*
* @return void
*/
private function extractLineNumbers($buffer)
{
@ -4116,6 +4140,7 @@ class Parser
* @param int $pos
*
* @return array
* @phpstan-return array{int, int}
*/
private function getSourcePosition($pos)
{

View File

@ -107,7 +107,7 @@ class SourceMapGenerator
*/
public function __construct(array $options = [])
{
$this->options = array_merge($this->defaultOptions, $options);
$this->options = array_replace($this->defaultOptions, $options);
$this->encoder = new Base64VLQ();
}
@ -140,7 +140,7 @@ class SourceMapGenerator
*
* @param string $content The content to write
*
* @return string
* @return string|null
*
* @throws \ScssPhp\ScssPhp\Exception\CompilerException If the file could not be saved
* @deprecated
@ -148,6 +148,7 @@ class SourceMapGenerator
public function saveMap($content)
{
$file = $this->options['sourceMapWriteTo'];
assert($file !== null);
$dir = \dirname($file);
// directory does not exist
@ -201,7 +202,7 @@ class SourceMapGenerator
// A list of original sources used by the 'mappings' entry.
$sourceMap['sources'] = [];
foreach ($this->sources as $sourceUri => $sourceFilename) {
foreach ($this->sources as $sourceFilename) {
$sourceMap['sources'][] = $this->normalizeFilename($sourceFilename);
}
@ -223,7 +224,15 @@ class SourceMapGenerator
unset($sourceMap['sourceRoot']);
}
return json_encode($sourceMap, JSON_UNESCAPED_SLASHES);
$jsonSourceMap = json_encode($sourceMap, JSON_UNESCAPED_SLASHES);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \RuntimeException(json_last_error_msg());
}
assert($jsonSourceMap !== false);
return $jsonSourceMap;
}
/**

View File

@ -19,5 +19,5 @@ namespace ScssPhp\ScssPhp;
*/
class Version
{
const VERSION = '1.10.0';
const VERSION = '1.10.2';
}

View File

@ -1,5 +1,15 @@
# v3.2.0
## 03/28/2022
1. [](#new)
* Require **Grav 1.7.32** and **Form 6.0.0**
1. [](#improved)
* Added access email message object inside the twig template file
2. [](#bugfix)
* Fixed twig not being initialized when building an email message
# v3.1.5
## 01/03/22
## 01/03/2022
1. [](#improved)
* Updated to Swiftmailer `v6.3.0` with PHP 8.1 compatibility [#157](https://github.com/getgrav/grav-plugin-email/issues/157)

View File

@ -1,7 +1,7 @@
name: Email
slug: email
type: plugin
version: 3.1.5
version: 3.2.0
testing: false
description: Enables the emailing system for Grav
icon: envelope
@ -15,8 +15,8 @@ bugs: https://github.com/getgrav/grav-plugin-email/issues
license: MIT
dependencies:
- { name: grav, version: '>=1.6.0' }
- { name: form, version: '>=3.0.3' }
- { name: grav, version: '>=1.7.32' }
- { name: form, version: '>=6.0.0' }
form:
validation: loose

View File

@ -136,6 +136,7 @@ class Email
{
/** @var Twig $twig */
$twig = Grav::instance()['twig'];
$twig->init();
/** @var Config $config */
$config = Grav::instance()['config'];
@ -143,6 +144,9 @@ class Email
/** @var Language $language */
$language = Grav::instance()['language'];
// Create message object.
$message = $this->message();
// Extend parameters with defaults.
$params += [
'bcc' => $config->get('plugins.email.bcc', []),
@ -159,12 +163,10 @@ class Email
'to' => $config->get('plugins.email.to'),
'to_name' => $config->get('plugins.email.to_name'),
'process_markdown' => false,
'template' => false
'template' => false,
'message' => $message
];
// Create message object.
$message = $this->message();
if (!$params['to']) {
throw new \RuntimeException($language->translate('PLUGIN_EMAIL.PLEASE_CONFIGURE_A_TO_ADDRESS'));
}
@ -233,7 +235,9 @@ class Email
break;
case 'subject':
$message->setSubject($twig->processString($language->translate($value), $vars));
if ($value) {
$message->setSubject($twig->processString($language->translate($value), $vars));
}
break;
case 'to':

View File

@ -20,14 +20,24 @@
"docs": "https://github.com/getgrav/grav-plugin-email/blob/master/README.md"
},
"require": {
"php": ">=7.1.3",
"php": ">=7.3.6",
"swiftmailer/swiftmailer": "~6.0"
},
"replace": {
"symfony/polyfill-iconv": "*",
"symfony/polyfill-mbstring": "*",
"symfony/polyfill-php72": "*"
},
"autoload": {
"psr-4": {
"Grav\\Plugin\\Email\\": "classes/",
"Grav\\Plugin\\Console\\": "cli/"
},
"classmap": ["email.php"]
},
"config": {
"platform": {
"php": "7.3.6"
}
}
}

View File

@ -4,36 +4,32 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "a841aff1de7e0364fe3e92ecd7b2fb56",
"content-hash": "87a959e0f18deeaf7c499a59c3c059bf",
"packages": [
{
"name": "doctrine/lexer",
"version": "1.2.1",
"version": "1.2.3",
"source": {
"type": "git",
"url": "https://github.com/doctrine/lexer.git",
"reference": "e864bbf5904cb8f5bb334f99209b48018522f042"
"reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/lexer/zipball/e864bbf5904cb8f5bb334f99209b48018522f042",
"reference": "e864bbf5904cb8f5bb334f99209b48018522f042",
"url": "https://api.github.com/repos/doctrine/lexer/zipball/c268e882d4dbdd85e36e4ad69e02dc284f89d229",
"reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
"php": "^7.1 || ^8.0"
},
"require-dev": {
"doctrine/coding-standard": "^6.0",
"phpstan/phpstan": "^0.11.8",
"phpunit/phpunit": "^8.2"
"doctrine/coding-standard": "^9.0",
"phpstan/phpstan": "^1.3",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"vimeo/psalm": "^4.11"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer"
@ -68,7 +64,7 @@
],
"support": {
"issues": "https://github.com/doctrine/lexer/issues",
"source": "https://github.com/doctrine/lexer/tree/1.2.1"
"source": "https://github.com/doctrine/lexer/tree/1.2.3"
},
"funding": [
{
@ -84,7 +80,7 @@
"type": "tidelift"
}
],
"time": "2020-05-25T17:44:05+00:00"
"time": "2022-02-28T11:07:21+00:00"
},
{
"name": "egulias/email-validator",
@ -230,98 +226,18 @@
"abandoned": "symfony/mailer",
"time": "2021-10-18T15:26:12+00:00"
},
{
"name": "symfony/polyfill-iconv",
"version": "v1.23.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-iconv.git",
"reference": "63b5bb7db83e5673936d6e3b8b3e022ff6474933"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/63b5bb7db83e5673936d6e3b8b3e022ff6474933",
"reference": "63b5bb7db83e5673936d6e3b8b3e022ff6474933",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"suggest": {
"ext-iconv": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Iconv\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Iconv extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"iconv",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-iconv/tree/v1.23.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2021-05-27T09:27:20+00:00"
},
{
"name": "symfony/polyfill-intl-idn",
"version": "v1.23.0",
"version": "v1.25.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-idn.git",
"reference": "65bd267525e82759e7d8c4e8ceea44f398838e65"
"reference": "749045c69efb97c70d25d7463abba812e91f3a44"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/65bd267525e82759e7d8c4e8ceea44f398838e65",
"reference": "65bd267525e82759e7d8c4e8ceea44f398838e65",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/749045c69efb97c70d25d7463abba812e91f3a44",
"reference": "749045c69efb97c70d25d7463abba812e91f3a44",
"shasum": ""
},
"require": {
@ -343,12 +259,12 @@
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Intl\\Idn\\": ""
},
"files": [
"bootstrap.php"
]
],
"psr-4": {
"Symfony\\Polyfill\\Intl\\Idn\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -379,7 +295,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.23.0"
"source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.25.0"
},
"funding": [
{
@ -395,11 +311,11 @@
"type": "tidelift"
}
],
"time": "2021-05-27T09:27:20+00:00"
"time": "2021-09-14T14:02:44+00:00"
},
{
"name": "symfony/polyfill-intl-normalizer",
"version": "v1.23.0",
"version": "v1.25.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
@ -428,12 +344,12 @@
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Intl\\Normalizer\\": ""
},
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Intl\\Normalizer\\": ""
},
"classmap": [
"Resources/stubs"
]
@ -463,7 +379,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0"
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.25.0"
},
"funding": [
{
@ -480,162 +396,6 @@
}
],
"time": "2021-02-19T12:13:01+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.23.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6",
"reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"suggest": {
"ext-mbstring": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2021-05-27T12:26:48+00:00"
},
{
"name": "symfony/polyfill-php72",
"version": "v1.23.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php72.git",
"reference": "9a142215a36a3888e30d0a9eeea9766764e96976"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9a142215a36a3888e30d0a9eeea9766764e96976",
"reference": "9a142215a36a3888e30d0a9eeea9766764e96976",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php72\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php72/tree/v1.23.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2021-05-27T09:17:38+00:00"
}
],
"packages-dev": [],
@ -645,8 +405,11 @@
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=7.1.3"
"php": ">=7.3.6"
},
"platform-dev": [],
"plugin-api-version": "2.1.0"
"platform-overrides": {
"php": "7.3.6"
},
"plugin-api-version": "2.2.0"
}

View File

@ -1,6 +1,7 @@
<?php
namespace Grav\Plugin;
use Composer\Autoload\ClassLoader;
use Grav\Common\Data\Data;
use Grav\Common\Plugin;
use Grav\Plugin\Email\Email;
@ -27,16 +28,22 @@ class EmailPlugin extends Plugin
];
}
/**
* @return ClassLoader
*/
public function autoload(): ClassLoader
{
return require __DIR__ . '/vendor/autoload.php';
}
/**
* Initialize emailing.
*/
public function onPluginsInitialized()
{
require_once __DIR__ . '/vendor/autoload.php';
$this->email = new Email();
if ($this->email->enabled()) {
if ($this->email::enabled()) {
$this->grav['Email'] = $this->email;
}
}

View File

@ -149,7 +149,7 @@ class ClassLoader
/**
* @return string[] Array of classname => path
* @psalm-var array<string, string>
* @psalm-return array<string, string>
*/
public function getClassMap()
{

View File

@ -7,9 +7,6 @@ $baseDir = dirname($vendorDir);
return array(
'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php',
'f598d06aa772fa33d905e87be6398fb1' => $vendorDir . '/symfony/polyfill-intl-idn/bootstrap.php',
'def43f6c87e4f8dfd0c9e1b1bab14fe8' => $vendorDir . '/symfony/polyfill-iconv/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'2c102faa651ef8ea5874edb585946bce' => $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php',
);

View File

@ -6,11 +6,8 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Symfony\\Polyfill\\Php72\\' => array($vendorDir . '/symfony/polyfill-php72'),
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
'Symfony\\Polyfill\\Intl\\Normalizer\\' => array($vendorDir . '/symfony/polyfill-intl-normalizer'),
'Symfony\\Polyfill\\Intl\\Idn\\' => array($vendorDir . '/symfony/polyfill-intl-idn'),
'Symfony\\Polyfill\\Iconv\\' => array($vendorDir . '/symfony/polyfill-iconv'),
'Grav\\Plugin\\Email\\' => array($baseDir . '/classes'),
'Grav\\Plugin\\Console\\' => array($baseDir . '/cli'),
'Egulias\\EmailValidator\\' => array($vendorDir . '/egulias/email-validator/src'),

View File

@ -65,11 +65,16 @@ class ComposerAutoloaderInit73924571ea6ee98bb12d10ff20aff2ab
}
}
/**
* @param string $fileIdentifier
* @param string $file
* @return void
*/
function composerRequire73924571ea6ee98bb12d10ff20aff2ab($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
require $file;
}
}

View File

@ -8,21 +8,15 @@ class ComposerStaticInit73924571ea6ee98bb12d10ff20aff2ab
{
public static $files = array (
'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php',
'f598d06aa772fa33d905e87be6398fb1' => __DIR__ . '/..' . '/symfony/polyfill-intl-idn/bootstrap.php',
'def43f6c87e4f8dfd0c9e1b1bab14fe8' => __DIR__ . '/..' . '/symfony/polyfill-iconv/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
'2c102faa651ef8ea5874edb585946bce' => __DIR__ . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php',
);
public static $prefixLengthsPsr4 = array (
'S' =>
array (
'Symfony\\Polyfill\\Php72\\' => 23,
'Symfony\\Polyfill\\Mbstring\\' => 26,
'Symfony\\Polyfill\\Intl\\Normalizer\\' => 33,
'Symfony\\Polyfill\\Intl\\Idn\\' => 26,
'Symfony\\Polyfill\\Iconv\\' => 23,
),
'G' =>
array (
@ -40,14 +34,6 @@ class ComposerStaticInit73924571ea6ee98bb12d10ff20aff2ab
);
public static $prefixDirsPsr4 = array (
'Symfony\\Polyfill\\Php72\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-php72',
),
'Symfony\\Polyfill\\Mbstring\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
),
'Symfony\\Polyfill\\Intl\\Normalizer\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer',
@ -56,10 +42,6 @@ class ComposerStaticInit73924571ea6ee98bb12d10ff20aff2ab
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-intl-idn',
),
'Symfony\\Polyfill\\Iconv\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-iconv',
),
'Grav\\Plugin\\Email\\' =>
array (
0 => __DIR__ . '/../..' . '/classes',

View File

@ -2,34 +2,30 @@
"packages": [
{
"name": "doctrine/lexer",
"version": "1.2.1",
"version_normalized": "1.2.1.0",
"version": "1.2.3",
"version_normalized": "1.2.3.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/lexer.git",
"reference": "e864bbf5904cb8f5bb334f99209b48018522f042"
"reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/lexer/zipball/e864bbf5904cb8f5bb334f99209b48018522f042",
"reference": "e864bbf5904cb8f5bb334f99209b48018522f042",
"url": "https://api.github.com/repos/doctrine/lexer/zipball/c268e882d4dbdd85e36e4ad69e02dc284f89d229",
"reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
"php": "^7.1 || ^8.0"
},
"require-dev": {
"doctrine/coding-standard": "^6.0",
"phpstan/phpstan": "^0.11.8",
"phpunit/phpunit": "^8.2"
"doctrine/coding-standard": "^9.0",
"phpstan/phpstan": "^1.3",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"vimeo/psalm": "^4.11"
},
"time": "2020-05-25T17:44:05+00:00",
"time": "2022-02-28T11:07:21+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
@ -65,7 +61,7 @@
],
"support": {
"issues": "https://github.com/doctrine/lexer/issues",
"source": "https://github.com/doctrine/lexer/tree/1.2.1"
"source": "https://github.com/doctrine/lexer/tree/1.2.3"
},
"funding": [
{
@ -233,102 +229,19 @@
"abandoned": "symfony/mailer",
"install-path": "../swiftmailer/swiftmailer"
},
{
"name": "symfony/polyfill-iconv",
"version": "v1.23.0",
"version_normalized": "1.23.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-iconv.git",
"reference": "63b5bb7db83e5673936d6e3b8b3e022ff6474933"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/63b5bb7db83e5673936d6e3b8b3e022ff6474933",
"reference": "63b5bb7db83e5673936d6e3b8b3e022ff6474933",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"suggest": {
"ext-iconv": "For best performance"
},
"time": "2021-05-27T09:27:20+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Iconv\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Iconv extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"iconv",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-iconv/tree/v1.23.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"install-path": "../symfony/polyfill-iconv"
},
{
"name": "symfony/polyfill-intl-idn",
"version": "v1.23.0",
"version_normalized": "1.23.0.0",
"version": "v1.25.0",
"version_normalized": "1.25.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-idn.git",
"reference": "65bd267525e82759e7d8c4e8ceea44f398838e65"
"reference": "749045c69efb97c70d25d7463abba812e91f3a44"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/65bd267525e82759e7d8c4e8ceea44f398838e65",
"reference": "65bd267525e82759e7d8c4e8ceea44f398838e65",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/749045c69efb97c70d25d7463abba812e91f3a44",
"reference": "749045c69efb97c70d25d7463abba812e91f3a44",
"shasum": ""
},
"require": {
@ -339,7 +252,7 @@
"suggest": {
"ext-intl": "For best performance"
},
"time": "2021-05-27T09:27:20+00:00",
"time": "2021-09-14T14:02:44+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -352,12 +265,12 @@
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Intl\\Idn\\": ""
},
"files": [
"bootstrap.php"
]
],
"psr-4": {
"Symfony\\Polyfill\\Intl\\Idn\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -388,7 +301,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.23.0"
"source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.25.0"
},
"funding": [
{
@ -408,8 +321,8 @@
},
{
"name": "symfony/polyfill-intl-normalizer",
"version": "v1.23.0",
"version_normalized": "1.23.0.0",
"version": "v1.25.0",
"version_normalized": "1.25.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
@ -440,12 +353,12 @@
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Intl\\Normalizer\\": ""
},
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Intl\\Normalizer\\": ""
},
"classmap": [
"Resources/stubs"
]
@ -475,7 +388,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0"
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.25.0"
},
"funding": [
{
@ -492,170 +405,8 @@
}
],
"install-path": "../symfony/polyfill-intl-normalizer"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.23.1",
"version_normalized": "1.23.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6",
"reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"suggest": {
"ext-mbstring": "For best performance"
},
"time": "2021-05-27T12:26:48+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"install-path": "../symfony/polyfill-mbstring"
},
{
"name": "symfony/polyfill-php72",
"version": "v1.23.0",
"version_normalized": "1.23.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php72.git",
"reference": "9a142215a36a3888e30d0a9eeea9766764e96976"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9a142215a36a3888e30d0a9eeea9766764e96976",
"reference": "9a142215a36a3888e30d0a9eeea9766764e96976",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"time": "2021-05-27T09:17:38+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php72\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php72/tree/v1.23.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"install-path": "../symfony/polyfill-php72"
}
],
"dev": true,
"dev": false,
"dev-package-names": []
}

View File

@ -5,18 +5,18 @@
'type' => 'grav-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'da36c458eae6fd7d7e27282a9d5bec0b9cf78aae',
'reference' => '6ab4ab743d351b196fa32aa7885651e6b7e2e6d4',
'name' => 'getgrav/grav-plugin-email',
'dev' => true,
'dev' => false,
),
'versions' => array(
'doctrine/lexer' => array(
'pretty_version' => '1.2.1',
'version' => '1.2.1.0',
'pretty_version' => '1.2.3',
'version' => '1.2.3.0',
'type' => 'library',
'install_path' => __DIR__ . '/../doctrine/lexer',
'aliases' => array(),
'reference' => 'e864bbf5904cb8f5bb334f99209b48018522f042',
'reference' => 'c268e882d4dbdd85e36e4ad69e02dc284f89d229',
'dev_requirement' => false,
),
'egulias/email-validator' => array(
@ -34,7 +34,7 @@
'type' => 'grav-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'da36c458eae6fd7d7e27282a9d5bec0b9cf78aae',
'reference' => '6ab4ab743d351b196fa32aa7885651e6b7e2e6d4',
'dev_requirement' => false,
),
'swiftmailer/swiftmailer' => array(
@ -47,26 +47,23 @@
'dev_requirement' => false,
),
'symfony/polyfill-iconv' => array(
'pretty_version' => 'v1.23.0',
'version' => '1.23.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-iconv',
'aliases' => array(),
'reference' => '63b5bb7db83e5673936d6e3b8b3e022ff6474933',
'dev_requirement' => false,
'replaced' => array(
0 => '*',
),
),
'symfony/polyfill-intl-idn' => array(
'pretty_version' => 'v1.23.0',
'version' => '1.23.0.0',
'pretty_version' => 'v1.25.0',
'version' => '1.25.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-intl-idn',
'aliases' => array(),
'reference' => '65bd267525e82759e7d8c4e8ceea44f398838e65',
'reference' => '749045c69efb97c70d25d7463abba812e91f3a44',
'dev_requirement' => false,
),
'symfony/polyfill-intl-normalizer' => array(
'pretty_version' => 'v1.23.0',
'version' => '1.23.0.0',
'pretty_version' => 'v1.25.0',
'version' => '1.25.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-intl-normalizer',
'aliases' => array(),
@ -74,22 +71,16 @@
'dev_requirement' => false,
),
'symfony/polyfill-mbstring' => array(
'pretty_version' => 'v1.23.1',
'version' => '1.23.1.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
'aliases' => array(),
'reference' => '9174a3d80210dca8daa7f31fec659150bbeabfc6',
'dev_requirement' => false,
'replaced' => array(
0 => '*',
),
),
'symfony/polyfill-php72' => array(
'pretty_version' => 'v1.23.0',
'version' => '1.23.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php72',
'aliases' => array(),
'reference' => '9a142215a36a3888e30d0a9eeea9766764e96976',
'dev_requirement' => false,
'replaced' => array(
0 => '*',
),
),
),
);

View File

@ -4,8 +4,8 @@
$issues = array();
if (!(PHP_VERSION_ID >= 70200)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.0". You are running ' . PHP_VERSION . '.';
if (!(PHP_VERSION_ID >= 70306)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.3.6". You are running ' . PHP_VERSION . '.';
}
if ($issues) {

View File

@ -1,6 +1,6 @@
# Doctrine Lexer
Build Status: [![Build Status](https://travis-ci.org/doctrine/lexer.svg?branch=master)](https://travis-ci.org/doctrine/lexer)
[![Build Status](https://github.com/doctrine/lexer/workflows/Continuous%20Integration/badge.svg)](https://github.com/doctrine/lexer/actions)
Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.

View File

@ -17,12 +17,13 @@
{"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"}
],
"require": {
"php": "^7.2 || ^8.0"
"php": "^7.1 || ^8.0"
},
"require-dev": {
"doctrine/coding-standard": "^6.0",
"phpstan/phpstan": "^0.11.8",
"phpunit/phpunit": "^8.2"
"doctrine/coding-standard": "^9.0",
"phpstan/phpstan": "^1.3",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"vimeo/psalm": "^4.11"
},
"autoload": {
"psr-4": { "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" }
@ -30,12 +31,11 @@
"autoload-dev": {
"psr-4": { "Doctrine\\Tests\\": "tests/Doctrine" }
},
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"config": {
"allow-plugins": {
"composer/package-versions-deprecated": true,
"dealerdirect/phpcodesniffer-composer-installer": true
},
"sort-packages": true
}
}

View File

@ -5,17 +5,21 @@ declare(strict_types=1);
namespace Doctrine\Common\Lexer;
use ReflectionClass;
use const PREG_SPLIT_DELIM_CAPTURE;
use const PREG_SPLIT_NO_EMPTY;
use const PREG_SPLIT_OFFSET_CAPTURE;
use function implode;
use function in_array;
use function preg_split;
use function sprintf;
use function substr;
use const PREG_SPLIT_DELIM_CAPTURE;
use const PREG_SPLIT_NO_EMPTY;
use const PREG_SPLIT_OFFSET_CAPTURE;
/**
* Base class for writing simple lexers, i.e. for creating small DSLs.
*
* @psalm-type Token = array{value: int|string, type:string|int|null, position:int}
*/
abstract class AbstractLexer
{
@ -35,7 +39,8 @@ abstract class AbstractLexer
* parameter, none)
* - 'position' : the position of the token in the input string
*
* @var array
* @var mixed[][]
* @psalm-var list<Token>
*/
private $tokens = [];
@ -56,21 +61,23 @@ abstract class AbstractLexer
/**
* The next token in the input.
*
* @var array|null
* @var mixed[]|null
* @psalm-var Token|null
*/
public $lookahead;
/**
* The last matched/seen token.
*
* @var array|null
* @var mixed[]|null
* @psalm-var Token|null
*/
public $token;
/**
* Composed regex for input parsing.
*
* @var string
* @var string|null
*/
private $regex;
@ -143,25 +150,25 @@ abstract class AbstractLexer
/**
* Checks whether a given token matches the current lookahead.
*
* @param int|string $token
* @param int|string $type
*
* @return bool
*/
public function isNextToken($token)
public function isNextToken($type)
{
return $this->lookahead !== null && $this->lookahead['type'] === $token;
return $this->lookahead !== null && $this->lookahead['type'] === $type;
}
/**
* Checks whether any of the given tokens matches the current lookahead.
*
* @param array $tokens
* @param list<int|string> $types
*
* @return bool
*/
public function isNextTokenAny(array $tokens)
public function isNextTokenAny(array $types)
{
return $this->lookahead !== null && in_array($this->lookahead['type'], $tokens, true);
return $this->lookahead !== null && in_array($this->lookahead['type'], $types, true);
}
/**
@ -209,7 +216,8 @@ abstract class AbstractLexer
/**
* Moves the lookahead token forward.
*
* @return array|null The next token or NULL if there are no more tokens ahead.
* @return mixed[]|null The next token or NULL if there are no more tokens ahead.
* @psalm-return Token|null
*/
public function peek()
{
@ -223,7 +231,8 @@ abstract class AbstractLexer
/**
* Peeks at the next token, returns it and immediately resets the peek.
*
* @return array|null The next token or NULL if there are no more tokens ahead.
* @return mixed[]|null The next token or NULL if there are no more tokens ahead.
* @psalm-return Token|null
*/
public function glimpse()
{
@ -306,14 +315,14 @@ abstract class AbstractLexer
/**
* Lexical catchable patterns.
*
* @return array
* @return string[]
*/
abstract protected function getCatchablePatterns();
/**
* Lexical non-catchable patterns.
*
* @return array
* @return string[]
*/
abstract protected function getNonCatchablePatterns();

View File

@ -0,0 +1,15 @@
<?xml version="1.0"?>
<psalm
errorLevel="5"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="lib/Doctrine/Common/Lexer" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>

View File

@ -1,744 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Polyfill\Iconv;
/**
* iconv implementation in pure PHP, UTF-8 centric.
*
* Implemented:
* - iconv - Convert string to requested character encoding
* - iconv_mime_decode - Decodes a MIME header field
* - iconv_mime_decode_headers - Decodes multiple MIME header fields at once
* - iconv_get_encoding - Retrieve internal configuration variables of iconv extension
* - iconv_set_encoding - Set current setting for character encoding conversion
* - iconv_mime_encode - Composes a MIME header field
* - iconv_strlen - Returns the character count of string
* - iconv_strpos - Finds position of first occurrence of a needle within a haystack
* - iconv_strrpos - Finds the last occurrence of a needle within a haystack
* - iconv_substr - Cut out part of a string
*
* Charsets available for conversion are defined by files
* in the charset/ directory and by Iconv::$alias below.
* You're welcome to send back any addition you make.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @internal
*/
final class Iconv
{
public const ERROR_ILLEGAL_CHARACTER = 'iconv(): Detected an illegal character in input string';
public const ERROR_WRONG_CHARSET = 'iconv(): Wrong charset, conversion from `%s\' to `%s\' is not allowed';
public static $inputEncoding = 'utf-8';
public static $outputEncoding = 'utf-8';
public static $internalEncoding = 'utf-8';
private static $alias = [
'utf8' => 'utf-8',
'ascii' => 'us-ascii',
'tis-620' => 'iso-8859-11',
'cp1250' => 'windows-1250',
'cp1251' => 'windows-1251',
'cp1252' => 'windows-1252',
'cp1253' => 'windows-1253',
'cp1254' => 'windows-1254',
'cp1255' => 'windows-1255',
'cp1256' => 'windows-1256',
'cp1257' => 'windows-1257',
'cp1258' => 'windows-1258',
'shift-jis' => 'cp932',
'shift_jis' => 'cp932',
'latin1' => 'iso-8859-1',
'latin2' => 'iso-8859-2',
'latin3' => 'iso-8859-3',
'latin4' => 'iso-8859-4',
'latin5' => 'iso-8859-9',
'latin6' => 'iso-8859-10',
'latin7' => 'iso-8859-13',
'latin8' => 'iso-8859-14',
'latin9' => 'iso-8859-15',
'latin10' => 'iso-8859-16',
'iso8859-1' => 'iso-8859-1',
'iso8859-2' => 'iso-8859-2',
'iso8859-3' => 'iso-8859-3',
'iso8859-4' => 'iso-8859-4',
'iso8859-5' => 'iso-8859-5',
'iso8859-6' => 'iso-8859-6',
'iso8859-7' => 'iso-8859-7',
'iso8859-8' => 'iso-8859-8',
'iso8859-9' => 'iso-8859-9',
'iso8859-10' => 'iso-8859-10',
'iso8859-11' => 'iso-8859-11',
'iso8859-12' => 'iso-8859-12',
'iso8859-13' => 'iso-8859-13',
'iso8859-14' => 'iso-8859-14',
'iso8859-15' => 'iso-8859-15',
'iso8859-16' => 'iso-8859-16',
'iso_8859-1' => 'iso-8859-1',
'iso_8859-2' => 'iso-8859-2',
'iso_8859-3' => 'iso-8859-3',
'iso_8859-4' => 'iso-8859-4',
'iso_8859-5' => 'iso-8859-5',
'iso_8859-6' => 'iso-8859-6',
'iso_8859-7' => 'iso-8859-7',
'iso_8859-8' => 'iso-8859-8',
'iso_8859-9' => 'iso-8859-9',
'iso_8859-10' => 'iso-8859-10',
'iso_8859-11' => 'iso-8859-11',
'iso_8859-12' => 'iso-8859-12',
'iso_8859-13' => 'iso-8859-13',
'iso_8859-14' => 'iso-8859-14',
'iso_8859-15' => 'iso-8859-15',
'iso_8859-16' => 'iso-8859-16',
'iso88591' => 'iso-8859-1',
'iso88592' => 'iso-8859-2',
'iso88593' => 'iso-8859-3',
'iso88594' => 'iso-8859-4',
'iso88595' => 'iso-8859-5',
'iso88596' => 'iso-8859-6',
'iso88597' => 'iso-8859-7',
'iso88598' => 'iso-8859-8',
'iso88599' => 'iso-8859-9',
'iso885910' => 'iso-8859-10',
'iso885911' => 'iso-8859-11',
'iso885912' => 'iso-8859-12',
'iso885913' => 'iso-8859-13',
'iso885914' => 'iso-8859-14',
'iso885915' => 'iso-8859-15',
'iso885916' => 'iso-8859-16',
];
private static $translitMap = [];
private static $convertMap = [];
private static $errorHandler;
private static $lastError;
private static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4];
private static $isValidUtf8;
public static function iconv($inCharset, $outCharset, $str)
{
$str = (string) $str;
if ('' === $str) {
return '';
}
// Prepare for //IGNORE and //TRANSLIT
$translit = $ignore = '';
$outCharset = strtolower($outCharset);
$inCharset = strtolower($inCharset);
if ('' === $outCharset) {
$outCharset = 'iso-8859-1';
}
if ('' === $inCharset) {
$inCharset = 'iso-8859-1';
}
do {
$loop = false;
if ('//translit' === substr($outCharset, -10)) {
$loop = $translit = true;
$outCharset = substr($outCharset, 0, -10);
}
if ('//ignore' === substr($outCharset, -8)) {
$loop = $ignore = true;
$outCharset = substr($outCharset, 0, -8);
}
} while ($loop);
do {
$loop = false;
if ('//translit' === substr($inCharset, -10)) {
$loop = true;
$inCharset = substr($inCharset, 0, -10);
}
if ('//ignore' === substr($inCharset, -8)) {
$loop = true;
$inCharset = substr($inCharset, 0, -8);
}
} while ($loop);
if (isset(self::$alias[$inCharset])) {
$inCharset = self::$alias[$inCharset];
}
if (isset(self::$alias[$outCharset])) {
$outCharset = self::$alias[$outCharset];
}
// Load charset maps
if (('utf-8' !== $inCharset && !self::loadMap('from.', $inCharset, $inMap))
|| ('utf-8' !== $outCharset && !self::loadMap('to.', $outCharset, $outMap))) {
trigger_error(sprintf(self::ERROR_WRONG_CHARSET, $inCharset, $outCharset));
return false;
}
if ('utf-8' !== $inCharset) {
// Convert input to UTF-8
$result = '';
if (self::mapToUtf8($result, $inMap, $str, $ignore)) {
$str = $result;
} else {
$str = false;
}
self::$isValidUtf8 = true;
} else {
self::$isValidUtf8 = preg_match('//u', $str);
if (!self::$isValidUtf8 && !$ignore) {
trigger_error(self::ERROR_ILLEGAL_CHARACTER);
return false;
}
if ('utf-8' === $outCharset) {
// UTF-8 validation
$str = self::utf8ToUtf8($str, $ignore);
}
}
if ('utf-8' !== $outCharset && false !== $str) {
// Convert output to UTF-8
$result = '';
if (self::mapFromUtf8($result, $outMap, $str, $ignore, $translit)) {
return $result;
}
return false;
}
return $str;
}
public static function iconv_mime_decode_headers($str, $mode = 0, $charset = null)
{
if (null === $charset) {
$charset = self::$internalEncoding;
}
if (false !== strpos($str, "\r")) {
$str = strtr(str_replace("\r\n", "\n", $str), "\r", "\n");
}
$str = explode("\n\n", $str, 2);
$headers = [];
$str = preg_split('/\n(?![ \t])/', $str[0]);
foreach ($str as $str) {
$str = self::iconv_mime_decode($str, $mode, $charset);
if (false === $str) {
return false;
}
$str = explode(':', $str, 2);
if (2 === \count($str)) {
if (isset($headers[$str[0]])) {
if (!\is_array($headers[$str[0]])) {
$headers[$str[0]] = [$headers[$str[0]]];
}
$headers[$str[0]][] = ltrim($str[1]);
} else {
$headers[$str[0]] = ltrim($str[1]);
}
}
}
return $headers;
}
public static function iconv_mime_decode($str, $mode = 0, $charset = null)
{
if (null === $charset) {
$charset = self::$internalEncoding;
}
if (\ICONV_MIME_DECODE_CONTINUE_ON_ERROR & $mode) {
$charset .= '//IGNORE';
}
if (false !== strpos($str, "\r")) {
$str = strtr(str_replace("\r\n", "\n", $str), "\r", "\n");
}
$str = preg_split('/\n(?![ \t])/', rtrim($str), 2);
$str = preg_replace('/[ \t]*\n[ \t]+/', ' ', rtrim($str[0]));
$str = preg_split('/=\?([^?]+)\?([bqBQ])\?(.*?)\?=/', $str, -1, \PREG_SPLIT_DELIM_CAPTURE);
$result = self::iconv('utf-8', $charset, $str[0]);
if (false === $result) {
return false;
}
$i = 1;
$len = \count($str);
while ($i < $len) {
$c = strtolower($str[$i]);
if ((\ICONV_MIME_DECODE_CONTINUE_ON_ERROR & $mode)
&& 'utf-8' !== $c
&& !isset(self::$alias[$c])
&& !self::loadMap('from.', $c, $d)) {
$d = false;
} elseif ('B' === strtoupper($str[$i + 1])) {
$d = base64_decode($str[$i + 2]);
} else {
$d = rawurldecode(strtr(str_replace('%', '%25', $str[$i + 2]), '=_', '% '));
}
if (false !== $d) {
if ('' !== $d) {
if ('' === $d = self::iconv($c, $charset, $d)) {
$str[$i + 3] = substr($str[$i + 3], 1);
} else {
$result .= $d;
}
}
$d = self::iconv('utf-8', $charset, $str[$i + 3]);
if ('' !== trim($d)) {
$result .= $d;
}
} elseif (\ICONV_MIME_DECODE_CONTINUE_ON_ERROR & $mode) {
$result .= "=?{$str[$i]}?{$str[$i + 1]}?{$str[$i + 2]}?={$str[$i + 3]}";
} else {
$result = false;
break;
}
$i += 4;
}
return $result;
}
public static function iconv_get_encoding($type = 'all')
{
switch ($type) {
case 'input_encoding': return self::$inputEncoding;
case 'output_encoding': return self::$outputEncoding;
case 'internal_encoding': return self::$internalEncoding;
}
return [
'input_encoding' => self::$inputEncoding,
'output_encoding' => self::$outputEncoding,
'internal_encoding' => self::$internalEncoding,
];
}
public static function iconv_set_encoding($type, $charset)
{
switch ($type) {
case 'input_encoding': self::$inputEncoding = $charset; break;
case 'output_encoding': self::$outputEncoding = $charset; break;
case 'internal_encoding': self::$internalEncoding = $charset; break;
default: return false;
}
return true;
}
public static function iconv_mime_encode($fieldName, $fieldValue, $pref = null)
{
if (!\is_array($pref)) {
$pref = [];
}
$pref += [
'scheme' => 'B',
'input-charset' => self::$internalEncoding,
'output-charset' => self::$internalEncoding,
'line-length' => 76,
'line-break-chars' => "\r\n",
];
if (preg_match('/[\x80-\xFF]/', $fieldName)) {
$fieldName = '';
}
$scheme = strtoupper(substr($pref['scheme'], 0, 1));
$in = strtolower($pref['input-charset']);
$out = strtolower($pref['output-charset']);
if ('utf-8' !== $in && false === $fieldValue = self::iconv($in, 'utf-8', $fieldValue)) {
return false;
}
preg_match_all('/./us', $fieldValue, $chars);
$chars = $chars[0] ?? [];
$lineBreak = (int) $pref['line-length'];
$lineStart = "=?{$pref['output-charset']}?{$scheme}?";
$lineLength = \strlen($fieldName) + 2 + \strlen($lineStart) + 2;
$lineOffset = \strlen($lineStart) + 3;
$lineData = '';
$fieldValue = [];
$Q = 'Q' === $scheme;
foreach ($chars as $c) {
if ('utf-8' !== $out && false === $c = self::iconv('utf-8', $out, $c)) {
return false;
}
$o = $Q
? $c = preg_replace_callback(
'/[=_\?\x00-\x1F\x80-\xFF]/',
[__CLASS__, 'qpByteCallback'],
$c
)
: base64_encode($lineData.$c);
if (isset($o[$lineBreak - $lineLength])) {
if (!$Q) {
$lineData = base64_encode($lineData);
}
$fieldValue[] = $lineStart.$lineData.'?=';
$lineLength = $lineOffset;
$lineData = '';
}
$lineData .= $c;
$Q && $lineLength += \strlen($c);
}
if ('' !== $lineData) {
if (!$Q) {
$lineData = base64_encode($lineData);
}
$fieldValue[] = $lineStart.$lineData.'?=';
}
return $fieldName.': '.implode($pref['line-break-chars'].' ', $fieldValue);
}
public static function iconv_strlen($s, $encoding = null)
{
static $hasXml = null;
if (null === $hasXml) {
$hasXml = \extension_loaded('xml');
}
if ($hasXml) {
return self::strlen1($s, $encoding);
}
return self::strlen2($s, $encoding);
}
public static function strlen1($s, $encoding = null)
{
if (null === $encoding) {
$encoding = self::$internalEncoding;
}
if (0 !== stripos($encoding, 'utf-8') && false === $s = self::iconv($encoding, 'utf-8', $s)) {
return false;
}
return \strlen(utf8_decode($s));
}
public static function strlen2($s, $encoding = null)
{
if (null === $encoding) {
$encoding = self::$internalEncoding;
}
if (0 !== stripos($encoding, 'utf-8') && false === $s = self::iconv($encoding, 'utf-8', $s)) {
return false;
}
$ulenMask = self::$ulenMask;
$i = 0;
$j = 0;
$len = \strlen($s);
while ($i < $len) {
$u = $s[$i] & "\xF0";
$i += $ulenMask[$u] ?? 1;
++$j;
}
return $j;
}
public static function iconv_strpos($haystack, $needle, $offset = 0, $encoding = null)
{
if (null === $encoding) {
$encoding = self::$internalEncoding;
}
if (0 !== stripos($encoding, 'utf-8')) {
if (false === $haystack = self::iconv($encoding, 'utf-8', $haystack)) {
return false;
}
if (false === $needle = self::iconv($encoding, 'utf-8', $needle)) {
return false;
}
}
if ($offset = (int) $offset) {
$haystack = self::iconv_substr($haystack, $offset, 2147483647, 'utf-8');
}
$pos = strpos($haystack, $needle);
return false === $pos ? false : ($offset + ($pos ? self::iconv_strlen(substr($haystack, 0, $pos), 'utf-8') : 0));
}
public static function iconv_strrpos($haystack, $needle, $encoding = null)
{
if (null === $encoding) {
$encoding = self::$internalEncoding;
}
if (0 !== stripos($encoding, 'utf-8')) {
if (false === $haystack = self::iconv($encoding, 'utf-8', $haystack)) {
return false;
}
if (false === $needle = self::iconv($encoding, 'utf-8', $needle)) {
return false;
}
}
$pos = isset($needle[0]) ? strrpos($haystack, $needle) : false;
return false === $pos ? false : self::iconv_strlen($pos ? substr($haystack, 0, $pos) : $haystack, 'utf-8');
}
public static function iconv_substr($s, $start, $length = 2147483647, $encoding = null)
{
if (null === $encoding) {
$encoding = self::$internalEncoding;
}
if (0 !== stripos($encoding, 'utf-8')) {
$encoding = null;
} elseif (false === $s = self::iconv($encoding, 'utf-8', $s)) {
return false;
}
$s = (string) $s;
$slen = self::iconv_strlen($s, 'utf-8');
$start = (int) $start;
if (0 > $start) {
$start += $slen;
}
if (0 > $start) {
if (\PHP_VERSION_ID < 80000) {
return false;
}
$start = 0;
}
if ($start >= $slen) {
return \PHP_VERSION_ID >= 80000 ? '' : false;
}
$rx = $slen - $start;
if (0 > $length) {
$length += $rx;
}
if (0 === $length) {
return '';
}
if (0 > $length) {
return \PHP_VERSION_ID >= 80000 ? '' : false;
}
if ($length > $rx) {
$length = $rx;
}
$rx = '/^'.($start ? self::pregOffset($start) : '').'('.self::pregOffset($length).')/u';
$s = preg_match($rx, $s, $s) ? $s[1] : '';
if (null === $encoding) {
return $s;
}
return self::iconv('utf-8', $encoding, $s);
}
private static function loadMap($type, $charset, &$map)
{
if (!isset(self::$convertMap[$type.$charset])) {
if (false === $map = self::getData($type.$charset)) {
if ('to.' === $type && self::loadMap('from.', $charset, $map)) {
$map = array_flip($map);
} else {
return false;
}
}
self::$convertMap[$type.$charset] = $map;
} else {
$map = self::$convertMap[$type.$charset];
}
return true;
}
private static function utf8ToUtf8($str, $ignore)
{
$ulenMask = self::$ulenMask;
$valid = self::$isValidUtf8;
$u = $str;
$i = $j = 0;
$len = \strlen($str);
while ($i < $len) {
if ($str[$i] < "\x80") {
$u[$j++] = $str[$i++];
} else {
$ulen = $str[$i] & "\xF0";
$ulen = $ulenMask[$ulen] ?? 1;
$uchr = substr($str, $i, $ulen);
if (1 === $ulen || !($valid || preg_match('/^.$/us', $uchr))) {
if ($ignore) {
++$i;
continue;
}
trigger_error(self::ERROR_ILLEGAL_CHARACTER);
return false;
}
$i += $ulen;
$u[$j++] = $uchr[0];
isset($uchr[1]) && 0 !== ($u[$j++] = $uchr[1])
&& isset($uchr[2]) && 0 !== ($u[$j++] = $uchr[2])
&& isset($uchr[3]) && 0 !== ($u[$j++] = $uchr[3]);
}
}
return substr($u, 0, $j);
}
private static function mapToUtf8(&$result, array $map, $str, $ignore)
{
$len = \strlen($str);
for ($i = 0; $i < $len; ++$i) {
if (isset($str[$i + 1], $map[$str[$i].$str[$i + 1]])) {
$result .= $map[$str[$i].$str[++$i]];
} elseif (isset($map[$str[$i]])) {
$result .= $map[$str[$i]];
} elseif (!$ignore) {
trigger_error(self::ERROR_ILLEGAL_CHARACTER);
return false;
}
}
return true;
}
private static function mapFromUtf8(&$result, array $map, $str, $ignore, $translit)
{
$ulenMask = self::$ulenMask;
$valid = self::$isValidUtf8;
if ($translit && !self::$translitMap) {
self::$translitMap = self::getData('translit');
}
$i = 0;
$len = \strlen($str);
while ($i < $len) {
if ($str[$i] < "\x80") {
$uchr = $str[$i++];
} else {
$ulen = $str[$i] & "\xF0";
$ulen = $ulenMask[$ulen] ?? 1;
$uchr = substr($str, $i, $ulen);
if ($ignore && (1 === $ulen || !($valid || preg_match('/^.$/us', $uchr)))) {
++$i;
continue;
}
$i += $ulen;
}
if (isset($map[$uchr])) {
$result .= $map[$uchr];
} elseif ($translit) {
if (isset(self::$translitMap[$uchr])) {
$uchr = self::$translitMap[$uchr];
} elseif ($uchr >= "\xC3\x80") {
$uchr = \Normalizer::normalize($uchr, \Normalizer::NFD);
if ($uchr[0] < "\x80") {
$uchr = $uchr[0];
} elseif ($ignore) {
continue;
} else {
return false;
}
} elseif ($ignore) {
continue;
} else {
return false;
}
$str = $uchr.substr($str, $i);
$len = \strlen($str);
$i = 0;
} elseif (!$ignore) {
return false;
}
}
return true;
}
private static function qpByteCallback(array $m)
{
return '='.strtoupper(dechex(\ord($m[0])));
}
private static function pregOffset($offset)
{
$rx = [];
$offset = (int) $offset;
while ($offset > 65535) {
$rx[] = '.{65535}';
$offset -= 65535;
}
return implode('', $rx).'.{'.$offset.'}';
}
private static function getData($file)
{
if (file_exists($file = __DIR__.'/Resources/charset/'.$file.'.php')) {
return require $file;
}
return false;
}
}

View File

@ -1,19 +0,0 @@
Copyright (c) 2015-2019 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -1,14 +0,0 @@
Symfony Polyfill / Iconv
========================
This component provides a native PHP implementation of the
[php.net/iconv](https://php.net/iconv) functions
(short of [`ob_iconv_handler`](https://php.net/ob-iconv-handler)).
More information can be found in the
[main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md).
License
=======
This library is released under the [MIT license](LICENSE).

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More