diff --git a/user/plugins/admin/themes/grav/templates/partials/nav-quick-tray.html.twig b/user/plugins/admin/themes/grav/templates/partials/nav-quick-tray.html.twig
index 13f4e95..bbc2d76 100644
--- a/user/plugins/admin/themes/grav/templates/partials/nav-quick-tray.html.twig
+++ b/user/plugins/admin/themes/grav/templates/partials/nav-quick-tray.html.twig
@@ -18,7 +18,7 @@
{% endif %}
{% if item.route %}
-
+
{% else %}
diff --git a/user/plugins/admin/themes/grav/templates/partials/nav-user-avatar.html.twig b/user/plugins/admin/themes/grav/templates/partials/nav-user-avatar.html.twig
index 27c61dc..245d4c1 100644
--- a/user/plugins/admin/themes/grav/templates/partials/nav-user-avatar.html.twig
+++ b/user/plugins/admin/themes/grav/templates/partials/nav-user-avatar.html.twig
@@ -1,2 +1,2 @@
{% set user_avatar = admin.user.getAvatarUrl() %}
-
+
diff --git a/user/plugins/admin/themes/grav/templates/partials/noscript.html.twig b/user/plugins/admin/themes/grav/templates/partials/noscript.html.twig
new file mode 100644
index 0000000..8f2e2ed
--- /dev/null
+++ b/user/plugins/admin/themes/grav/templates/partials/noscript.html.twig
@@ -0,0 +1,42 @@
+
+
+
+
+
+
{{ "PLUGIN_ADMIN.ERROR"|tu }}
+
+
+
+ {{ "PLUGIN_ADMIN.ADMIN_NOSCRIPT_MSG"|tu }}
+
+
+
+
+
+
diff --git a/user/plugins/admin/themes/grav/templates/partials/plugins-list.html.twig b/user/plugins/admin/themes/grav/templates/partials/plugins-list.html.twig
index e960780..b46b4ab 100644
--- a/user/plugins/admin/themes/grav/templates/partials/plugins-list.html.twig
+++ b/user/plugins/admin/themes/grav/templates/partials/plugins-list.html.twig
@@ -42,7 +42,7 @@
{% if isTestingRelease %}test release {% endif %}
- {% if (not installing and (plugin.form.fields.enabled.type != 'hidden' and plugin.form.fields.tabs.fields.login.fields.enabled.type != 'hidden')) %}
+ {% if (not installing and (plugin.form.fields.enabled.type != 'hidden' and plugin.form.fields.tabs.fields.options.fields.enabled.type != 'hidden')) %}
diff --git a/user/plugins/admin/vendor/composer/ClassLoader.php b/user/plugins/admin/vendor/composer/ClassLoader.php
index dc02dfb..fce8549 100644
--- a/user/plugins/admin/vendor/composer/ClassLoader.php
+++ b/user/plugins/admin/vendor/composer/ClassLoader.php
@@ -279,7 +279,7 @@ class ClassLoader
*/
public function setApcuPrefix($apcuPrefix)
{
- $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
+ $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
}
/**
@@ -377,7 +377,7 @@ class ClassLoader
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
- $search = $subPath.'\\';
+ $search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
diff --git a/user/plugins/admin/vendor/composer/installed.json b/user/plugins/admin/vendor/composer/installed.json
index 039ff9b..e18b692 100644
--- a/user/plugins/admin/vendor/composer/installed.json
+++ b/user/plugins/admin/vendor/composer/installed.json
@@ -1,27 +1,26 @@
[
{
"name": "composer/semver",
- "version": "1.4.2",
- "version_normalized": "1.4.2.0",
+ "version": "1.5.1",
+ "version_normalized": "1.5.1.0",
"source": {
"type": "git",
"url": "https://github.com/composer/semver.git",
- "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573"
+ "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/composer/semver/zipball/c7cb9a2095a074d131b65a8a0cd294479d785573",
- "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573",
+ "url": "https://api.github.com/repos/composer/semver/zipball/c6bea70230ef4dd483e6bbcab6005f682ed3a8de",
+ "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de",
"shasum": ""
},
"require": {
"php": "^5.3.2 || ^7.0"
},
"require-dev": {
- "phpunit/phpunit": "^4.5 || ^5.0.5",
- "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0"
+ "phpunit/phpunit": "^4.5 || ^5.0.5"
},
- "time": "2016-08-30T16:08:34+00:00",
+ "time": "2020-01-13T12:06:48+00:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -164,6 +163,7 @@
"security",
"xml",
"zf"
- ]
+ ],
+ "abandoned": "laminas/laminas-xml"
}
]
diff --git a/user/plugins/admin/vendor/composer/semver/CHANGELOG.md b/user/plugins/admin/vendor/composer/semver/CHANGELOG.md
index febedc9..ee0c2ef 100644
--- a/user/plugins/admin/vendor/composer/semver/CHANGELOG.md
+++ b/user/plugins/admin/vendor/composer/semver/CHANGELOG.md
@@ -3,6 +3,15 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
+### [1.5.1] 2020-01-13
+
+ * Fixed: Parsing of aliased version was not validating the alias to be a valid version
+
+### [1.5.0] 2019-03-19
+
+ * Added: some support for date versions (e.g. 201903) in `~` operator
+ * Fixed: support for stabilities in `~` operator was inconsistent
+
### [1.4.2] 2016-08-30
* Fixed: collapsing of complex constraints lead to buggy constraints
@@ -57,6 +66,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Namespace: `Composer\Test\Package\LinkConstraint` -> `Composer\Test\Semver\Constraint`
* Changed: code style using php-cs-fixer.
+[1.5.1]: https://github.com/composer/semver/compare/1.5.0...1.5.1
+[1.5.0]: https://github.com/composer/semver/compare/1.4.2...1.5.0
+[1.4.2]: https://github.com/composer/semver/compare/1.4.1...1.4.2
[1.4.1]: https://github.com/composer/semver/compare/1.4.0...1.4.1
[1.4.0]: https://github.com/composer/semver/compare/1.3.0...1.4.0
[1.3.0]: https://github.com/composer/semver/compare/1.2.0...1.3.0
diff --git a/user/plugins/admin/vendor/composer/semver/composer.json b/user/plugins/admin/vendor/composer/semver/composer.json
index b0400cd..981e7d1 100644
--- a/user/plugins/admin/vendor/composer/semver/composer.json
+++ b/user/plugins/admin/vendor/composer/semver/composer.json
@@ -34,8 +34,7 @@
"php": "^5.3.2 || ^7.0"
},
"require-dev": {
- "phpunit/phpunit": "^4.5 || ^5.0.5",
- "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0"
+ "phpunit/phpunit": "^4.5 || ^5.0.5"
},
"autoload": {
"psr-4": {
diff --git a/user/plugins/admin/vendor/composer/semver/src/Constraint/AbstractConstraint.php b/user/plugins/admin/vendor/composer/semver/src/Constraint/AbstractConstraint.php
index be83f75..7b5270f 100644
--- a/user/plugins/admin/vendor/composer/semver/src/Constraint/AbstractConstraint.php
+++ b/user/plugins/admin/vendor/composer/semver/src/Constraint/AbstractConstraint.php
@@ -11,7 +11,7 @@
namespace Composer\Semver\Constraint;
-trigger_error('The ' . __CLASS__ . ' abstract class is deprecated, there is no replacement for it, it will be removed in the next major version.', E_USER_DEPRECATED);
+trigger_error('The ' . __NAMESPACE__ . '\AbstractConstraint abstract class is deprecated, there is no replacement for it, it will be removed in the next major version.', E_USER_DEPRECATED);
/**
* Base constraint class.
diff --git a/user/plugins/admin/vendor/composer/semver/src/Constraint/Constraint.php b/user/plugins/admin/vendor/composer/semver/src/Constraint/Constraint.php
index 7a21eb4..c8c90f0 100644
--- a/user/plugins/admin/vendor/composer/semver/src/Constraint/Constraint.php
+++ b/user/plugins/admin/vendor/composer/semver/src/Constraint/Constraint.php
@@ -184,7 +184,7 @@ class Constraint implements ConstraintInterface
// '!=' operator is match when other operator is not '==' operator or version is not match
// these kinds of comparisons always have a solution
if ($isNonEqualOp || $isProviderNonEqualOp) {
- return !$isEqualOp && !$isProviderEqualOp
+ return (!$isEqualOp && !$isProviderEqualOp)
|| $this->versionCompare($provider->version, $this->version, '!=', $compareBranches);
}
@@ -197,13 +197,9 @@ class Constraint implements ConstraintInterface
if ($this->versionCompare($provider->version, $this->version, self::$transOpInt[$this->operator], $compareBranches)) {
// special case, e.g. require >= 1.0 and provide < 1.0
// 1.0 >= 1.0 but 1.0 is outside of the provided interval
- if ($provider->version === $this->version
+ return !($provider->version === $this->version
&& self::$transOpInt[$provider->operator] === $providerNoEqualOp
- && self::$transOpInt[$this->operator] !== $noEqualOp) {
- return false;
- }
-
- return true;
+ && self::$transOpInt[$this->operator] !== $noEqualOp);
}
return false;
diff --git a/user/plugins/admin/vendor/composer/semver/src/Constraint/EmptyConstraint.php b/user/plugins/admin/vendor/composer/semver/src/Constraint/EmptyConstraint.php
index faba56b..cb89cd2 100644
--- a/user/plugins/admin/vendor/composer/semver/src/Constraint/EmptyConstraint.php
+++ b/user/plugins/admin/vendor/composer/semver/src/Constraint/EmptyConstraint.php
@@ -46,7 +46,7 @@ class EmptyConstraint implements ConstraintInterface
return $this->prettyString;
}
- return $this->__toString();
+ return (string) $this;
}
/**
diff --git a/user/plugins/admin/vendor/composer/semver/src/Constraint/MultiConstraint.php b/user/plugins/admin/vendor/composer/semver/src/Constraint/MultiConstraint.php
index 0c547af..f8a60e4 100644
--- a/user/plugins/admin/vendor/composer/semver/src/Constraint/MultiConstraint.php
+++ b/user/plugins/admin/vendor/composer/semver/src/Constraint/MultiConstraint.php
@@ -102,7 +102,7 @@ class MultiConstraint implements ConstraintInterface
return $this->prettyString;
}
- return $this->__toString();
+ return (string) $this;
}
/**
diff --git a/user/plugins/admin/vendor/composer/semver/src/Semver.php b/user/plugins/admin/vendor/composer/semver/src/Semver.php
index 0225bb5..3ab2b68 100644
--- a/user/plugins/admin/vendor/composer/semver/src/Semver.php
+++ b/user/plugins/admin/vendor/composer/semver/src/Semver.php
@@ -37,9 +37,9 @@ class Semver
$versionParser = self::$versionParser;
$provider = new Constraint('==', $versionParser->normalize($version));
- $constraints = $versionParser->parseConstraints($constraints);
+ $parsedConstraints = $versionParser->parseConstraints($constraints);
- return $constraints->matches($provider);
+ return $parsedConstraints->matches($provider);
}
/**
diff --git a/user/plugins/admin/vendor/composer/semver/src/VersionParser.php b/user/plugins/admin/vendor/composer/semver/src/VersionParser.php
index 359c18c..9a7d0db 100644
--- a/user/plugins/admin/vendor/composer/semver/src/VersionParser.php
+++ b/user/plugins/admin/vendor/composer/semver/src/VersionParser.php
@@ -52,11 +52,12 @@ class VersionParser
{
$version = preg_replace('{#.+$}i', '', $version);
- if ('dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4)) {
+ if (strpos($version, 'dev-') === 0 || '-dev' === substr($version, -4)) {
return 'dev';
}
preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match);
+
if (!empty($match[3])) {
return 'dev';
}
@@ -107,6 +108,9 @@ class VersionParser
// strip off aliasing
if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
+ // verify that the alias is a version without constraint
+ $this->normalize($match[2]);
+
$version = $match[1];
}
@@ -116,7 +120,7 @@ class VersionParser
}
// if requirement is branch-like, use full name
- if ('dev-' === strtolower(substr($version, 0, 4))) {
+ if (stripos($version, 'dev-') === 0) {
return 'dev-' . substr($version, 4);
}
@@ -236,6 +240,7 @@ class VersionParser
$orConstraints = preg_split('{\s*\|\|?\s*}', trim($constraints));
$orGroups = array();
+
foreach ($orConstraints as $constraints) {
$andConstraints = preg_split('{(?< ,]) *(? 1) {
@@ -268,9 +273,9 @@ class VersionParser
&& 2 === count($orGroups[0]->getConstraints())
&& 2 === count($orGroups[1]->getConstraints())
&& ($a = (string) $orGroups[0])
- && substr($a, 0, 3) === '[>=' && (false !== ($posA = strpos($a, '<', 4)))
+ && strpos($a, '[>=') === 0 && (false !== ($posA = strpos($a, '<', 4)))
&& ($b = (string) $orGroups[1])
- && substr($b, 0, 3) === '[>=' && (false !== ($posB = strpos($b, '<', 4)))
+ && strpos($b, '[>=') === 0 && (false !== ($posB = strpos($b, '<', 4)))
&& substr($a, $posA + 2, -1) === substr($b, 4, $posB - 5)
) {
$constraint = new MultiConstraint(array(
@@ -314,7 +319,7 @@ class VersionParser
// version, to ensure that unstable instances of the current version are allowed. However, if a stability
// suffix is added to the constraint, then a >= match on the current version is used instead.
if (preg_match('{^~>?' . $versionRegex . '$}i', $constraint, $matches)) {
- if (substr($constraint, 0, 2) === '~>') {
+ if (strpos($constraint, '~>') === 0) {
throw new \UnexpectedValueException(
'Could not parse version constraint ' . $constraint . ': ' .
'Invalid operator "~>", you probably meant to use the "~" operator'
@@ -322,11 +327,11 @@ class VersionParser
}
// Work out which position in the version we are operating at
- if (isset($matches[4]) && '' !== $matches[4]) {
+ if (isset($matches[4]) && '' !== $matches[4] && null !== $matches[4]) {
$position = 4;
- } elseif (isset($matches[3]) && '' !== $matches[3]) {
+ } elseif (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
$position = 3;
- } elseif (isset($matches[2]) && '' !== $matches[2]) {
+ } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
$position = 2;
} else {
$position = 1;
@@ -334,19 +339,11 @@ class VersionParser
// Calculate the stability suffix
$stabilitySuffix = '';
- if (!empty($matches[5])) {
- $stabilitySuffix .= '-' . $this->expandStability($matches[5]) . (!empty($matches[6]) ? $matches[6] : '');
- }
-
- if (!empty($matches[7])) {
+ if (empty($matches[5]) && empty($matches[7])) {
$stabilitySuffix .= '-dev';
}
- if (!$stabilitySuffix) {
- $stabilitySuffix = '-dev';
- }
-
- $lowVersion = $this->manipulateVersionString($matches, $position, 0) . $stabilitySuffix;
+ $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
$lowerBound = new Constraint('>=', $lowVersion);
// For upper bound, we increment the position of one more significance,
@@ -368,9 +365,9 @@ class VersionParser
// versions 0.X >=0.1.0, and no updates for versions 0.0.X
if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) {
// Work out which position in the version we are operating at
- if ('0' !== $matches[1] || '' === $matches[2]) {
+ if ('0' !== $matches[1] || '' === $matches[2] || null === $matches[2]) {
$position = 1;
- } elseif ('0' !== $matches[2] || '' === $matches[3]) {
+ } elseif ('0' !== $matches[2] || '' === $matches[3] || null === $matches[3]) {
$position = 2;
} else {
$position = 3;
@@ -401,9 +398,9 @@ class VersionParser
// Any of X, x, or * may be used to "stand in" for one of the numeric values in the [major, minor, patch] tuple.
// A partial version range is treated as an X-Range, so the special character is in fact optional.
if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) {
- if (isset($matches[3]) && '' !== $matches[3]) {
+ if (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
$position = 3;
- } elseif (isset($matches[2]) && '' !== $matches[2]) {
+ } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
$position = 2;
} else {
$position = 1;
@@ -462,11 +459,11 @@ class VersionParser
try {
$version = $this->normalize($matches[2]);
- if (!empty($stabilityModifier) && $this->parseStability($version) === 'stable') {
+ if (!empty($stabilityModifier) && self::parseStability($version) === 'stable') {
$version .= '-' . $stabilityModifier;
} elseif ('<' === $matches[1] || '>=' === $matches[1]) {
if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
- if (substr($matches[2], 0, 4) !== 'dev-') {
+ if (strpos($matches[2], 'dev-') !== 0) {
$version .= '-dev';
}
}
@@ -511,7 +508,7 @@ class VersionParser
// Return null on a carry overflow
if ($i === 1) {
- return;
+ return null;
}
}
}
diff --git a/user/plugins/email/CHANGELOG.md b/user/plugins/email/CHANGELOG.md
index 6c3d940..faf0d7d 100644
--- a/user/plugins/email/CHANGELOG.md
+++ b/user/plugins/email/CHANGELOG.md
@@ -1,3 +1,44 @@
+# v3.0.9
+## 06/08/2020
+
+1. [](#improved)
+ * Disable password autocomplete in password field
+ * Don't save empty string in password field [#134](https://github.com/getgrav/grav-plugin-email/issues/134)
+
+# v3.0.8
+## 04/27/2020
+
+1. [](#improved)
+ * Updated vendor library files
+ * Use Grav's Parsedown class
+
+# v3.0.7
+## 03/05/2020
+
+1. [](#improved)
+ * Updated email validator library
+1. [](#bugfix)
+ * Fixed `Invalid resource theme://` on CLI command `test-email` on Grav 1.6.21 and later versions [#128](https://github.com/getgrav/grav-plugin-email/issues/128)
+
+# v3.0.6
+## 02/11/2020
+
+1. [](#improved)
+ * Updated email validator library
+
+# v3.0.5
+## 02/03/2020
+
+1. [](#bugfix)
+ * Fixed a date in changelog (no other changes)
+
+# v3.0.4
+## 01/17/2020
+
+1. [](#improved)
+ * Added ZOHO configuration example
+ * Updated SwiftMailer library for PHP 7.4 support
+
# v3.0.3
## 08/16/2019
diff --git a/user/plugins/email/README.md b/user/plugins/email/README.md
index 7881a48..823b1ef 100644
--- a/user/plugins/email/README.md
+++ b/user/plugins/email/README.md
@@ -159,6 +159,25 @@ mailer:
It's that easy!
+#### ZOHO
+
+ZOHO is a popular solution for hosted email due to it's great 'FREE' tier. It's paid options are also very reasonable and combined with the latest UI updates and outstanding security features, it's a solid email option.
+
+In order to get ZOHO working with Grav, you need to send email via a user account. You can either use your users' password or generate an **App Password** via your ZOHO account (clicking on your avatar once logged in), then navigating to `Two Factor Authentication -> App Passwords -> Generate`. Just enter a unique app name (i.e. `Grav Website`).
+
+NOTE: The SMTP host required can be found in `Settings -> Mail - > Mail Accounts -> POP/IMAP -> SMTP`. This will provide the SMTP server for this account (it may not be `imap.zoho.com` depending on what region you are in)
+
+```
+mailer:
+ engine: smtp
+ smtp:
+ server: smtp.zoho.com
+ port: 587
+ encryption: tls
+ user: 'ZOHO_EMAIL_ADDRESS'
+ password: 'ZOHO_EMAIL_PASSWORD'
+```
+
#### Sendmail
Although not as reliable as SMTP not providing as much debug information, sendmail is a simple option as long as your hosting provider is not blocking the default SMTP port `25`:
diff --git a/user/plugins/email/blueprints.yaml b/user/plugins/email/blueprints.yaml
index 6a9d74a..f5b7979 100644
--- a/user/plugins/email/blueprints.yaml
+++ b/user/plugins/email/blueprints.yaml
@@ -1,5 +1,7 @@
name: Email
-version: 3.0.3
+slug: email
+type: plugin
+version: 3.0.9
testing: false
description: Enables the emailing system for Grav
icon: envelope
@@ -18,6 +20,7 @@ dependencies:
form:
validation: loose
+
fields:
enabled:
type: hidden
@@ -168,13 +171,13 @@ form:
mailer.smtp.user:
type: text
size: medium
- autocomplete: nope
+ autocomplete: 'off'
label: PLUGIN_EMAIL.SMTP_LOGIN_NAME
mailer.smtp.password:
type: password
size: medium
- autocomplete: nope
+ autocomplete: 'new-password'
label: PLUGIN_EMAIL.SMTP_PASSWORD
sendmail_config:
diff --git a/user/plugins/email/classes/Email.php b/user/plugins/email/classes/Email.php
index 4626053..fb90d0c 100644
--- a/user/plugins/email/classes/Email.php
+++ b/user/plugins/email/classes/Email.php
@@ -4,6 +4,7 @@ namespace Grav\Plugin\Email;
use Grav\Common\Config\Config;
use Grav\Common\Grav;
use Grav\Common\Language\Language;
+use Grav\Common\Markdown\Parsedown;
use Grav\Common\Twig\Twig;
use Grav\Framework\Form\Interfaces\FormInterface;
use \Monolog\Logger;
@@ -178,7 +179,7 @@ class Email
$body = $twig->processString($value, $vars);
if ($params['process_markdown']) {
- $parsedown = new \Parsedown();
+ $parsedown = new Parsedown();
$body = $parsedown->text($body);
}
@@ -202,7 +203,7 @@ class Email
$body = !empty($body_part['body']) ? $twig->processString($body_part['body'], $vars) : null;
if ($params['process_markdown']) {
- $parsedown = new \Parsedown();
+ $parsedown = new Parsedown();
$body = $parsedown->text($body);
}
diff --git a/user/plugins/email/cli/ClearQueueFailuresCommand.php b/user/plugins/email/cli/ClearQueueFailuresCommand.php
index 13fe9f2..d430cfe 100644
--- a/user/plugins/email/cli/ClearQueueFailuresCommand.php
+++ b/user/plugins/email/cli/ClearQueueFailuresCommand.php
@@ -40,6 +40,11 @@ class ClearQueueFailuresCommand extends ConsoleCommand
*/
protected function serve()
{
+ // TODO: remove when requiring Grav 1.7+
+ if (method_exists($this, 'initializeGrav')) {
+ $this->initializeGrav();
+ }
+
$grav = Grav::instance();
$this->output->writeln('');
diff --git a/user/plugins/email/cli/FlushQueueCommand.php b/user/plugins/email/cli/FlushQueueCommand.php
index 166ec8a..e0f2d0e 100644
--- a/user/plugins/email/cli/FlushQueueCommand.php
+++ b/user/plugins/email/cli/FlushQueueCommand.php
@@ -40,6 +40,11 @@ class FlushQueueCommand extends ConsoleCommand
*/
protected function serve()
{
+ // TODO: remove when requiring Grav 1.7+
+ if (method_exists($this, 'initializeGrav')) {
+ $this->initializeGrav();
+ }
+
$grav = Grav::instance();
$this->output->writeln('');
diff --git a/user/plugins/email/cli/TestEmailCommand.php b/user/plugins/email/cli/TestEmailCommand.php
index f18e9ed..974fb72 100644
--- a/user/plugins/email/cli/TestEmailCommand.php
+++ b/user/plugins/email/cli/TestEmailCommand.php
@@ -59,6 +59,11 @@ class TestEmailCommand extends ConsoleCommand
*/
protected function serve()
{
+ // TODO: remove when requiring Grav 1.7+
+ if (method_exists($this, 'initializeGrav')) {
+ $this->initializeThemes();
+ }
+
$grav = Grav::instance();
$this->output->writeln('');
@@ -69,8 +74,6 @@ class TestEmailCommand extends ConsoleCommand
$this->output->writeln('');
- require_once __DIR__ . '/../vendor/autoload.php';
-
$grav['Email'] = new Email();
$to = $this->input->getOption('to') ?: $grav['config']->get('plugins.email.to');
@@ -86,8 +89,6 @@ class TestEmailCommand extends ConsoleCommand
$body = $grav['language']->translate(['PLUGIN_EMAIL.TEST_EMAIL_BODY', $configuration]);
}
- // This is the old way....
- // $sent = EmailUtils::sendEmail($subject, $body, $email_to);
$sent = EmailUtils::sendEmail(['subject'=>$subject, 'body'=>$body, 'to'=>$to]);
if ($sent) {
diff --git a/user/plugins/email/composer.lock b/user/plugins/email/composer.lock
index 54c2bad..662cb34 100644
--- a/user/plugins/email/composer.lock
+++ b/user/plugins/email/composer.lock
@@ -8,30 +8,35 @@
"packages": [
{
"name": "doctrine/lexer",
- "version": "v1.0.1",
+ "version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/lexer.git",
- "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c"
+ "reference": "5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c",
- "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c",
+ "url": "https://api.github.com/repos/doctrine/lexer/zipball/5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6",
+ "reference": "5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6",
"shasum": ""
},
"require": {
- "php": ">=5.3.2"
+ "php": "^7.2"
+ },
+ "require-dev": {
+ "doctrine/coding-standard": "^6.0",
+ "phpstan/phpstan": "^0.11.8",
+ "phpunit/phpunit": "^8.2"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.0.x-dev"
+ "dev-master": "1.2.x-dev"
}
},
"autoload": {
- "psr-0": {
- "Doctrine\\Common\\Lexer\\": "lib/"
+ "psr-4": {
+ "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer"
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -39,48 +44,52 @@
"MIT"
],
"authors": [
- {
- "name": "Roman Borschel",
- "email": "roman@code-factory.org"
- },
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
+ {
+ "name": "Roman Borschel",
+ "email": "roman@code-factory.org"
+ },
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
- "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.",
- "homepage": "http://www.doctrine-project.org",
+ "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.",
+ "homepage": "https://www.doctrine-project.org/projects/lexer.html",
"keywords": [
+ "annotations",
+ "docblock",
"lexer",
- "parser"
+ "parser",
+ "php"
],
- "time": "2014-09-09T13:34:57+00:00"
+ "time": "2019-10-30T14:39:59+00:00"
},
{
"name": "egulias/email-validator",
- "version": "2.1.7",
+ "version": "2.1.17",
"source": {
"type": "git",
"url": "https://github.com/egulias/EmailValidator.git",
- "reference": "709f21f92707308cdf8f9bcfa1af4cb26586521e"
+ "reference": "ade6887fd9bd74177769645ab5c474824f8a418a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/709f21f92707308cdf8f9bcfa1af4cb26586521e",
- "reference": "709f21f92707308cdf8f9bcfa1af4cb26586521e",
+ "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/ade6887fd9bd74177769645ab5c474824f8a418a",
+ "reference": "ade6887fd9bd74177769645ab5c474824f8a418a",
"shasum": ""
},
"require": {
"doctrine/lexer": "^1.0.1",
- "php": ">= 5.5"
+ "php": ">=5.5",
+ "symfony/polyfill-intl-idn": "^1.10"
},
"require-dev": {
- "dominicsayers/isemail": "dev-master",
- "phpunit/phpunit": "^4.8.35||^5.7||^6.0",
+ "dominicsayers/isemail": "^3.0.7",
+ "phpunit/phpunit": "^4.8.36|^7.5.15",
"satooshi/php-coveralls": "^1.0.1"
},
"suggest": {
@@ -89,7 +98,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.0.x-dev"
+ "dev-master": "2.1.x-dev"
}
},
"autoload": {
@@ -115,20 +124,20 @@
"validation",
"validator"
],
- "time": "2018-12-04T22:38:24+00:00"
+ "time": "2020-02-13T22:36:52+00:00"
},
{
"name": "swiftmailer/swiftmailer",
- "version": "v6.2.0",
+ "version": "v6.2.3",
"source": {
"type": "git",
"url": "https://github.com/swiftmailer/swiftmailer.git",
- "reference": "6fa3232ff9d3f8237c0fae4b7ff05e1baa4cd707"
+ "reference": "149cfdf118b169f7840bbe3ef0d4bc795d1780c9"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/6fa3232ff9d3f8237c0fae4b7ff05e1baa4cd707",
- "reference": "6fa3232ff9d3f8237c0fae4b7ff05e1baa4cd707",
+ "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/149cfdf118b169f7840bbe3ef0d4bc795d1780c9",
+ "reference": "149cfdf118b169f7840bbe3ef0d4bc795d1780c9",
"shasum": ""
},
"require": {
@@ -177,20 +186,20 @@
"mail",
"mailer"
],
- "time": "2019-03-10T07:52:41+00:00"
+ "time": "2019-11-12T09:31:26+00:00"
},
{
"name": "symfony/polyfill-iconv",
- "version": "v1.10.0",
+ "version": "v1.15.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-iconv.git",
- "reference": "97001cfc283484c9691769f51cdf25259037eba2"
+ "reference": "ad6d62792bfbcfc385dd34b424d4fcf9712a32c8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/97001cfc283484c9691769f51cdf25259037eba2",
- "reference": "97001cfc283484c9691769f51cdf25259037eba2",
+ "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/ad6d62792bfbcfc385dd34b424d4fcf9712a32c8",
+ "reference": "ad6d62792bfbcfc385dd34b424d4fcf9712a32c8",
"shasum": ""
},
"require": {
@@ -202,7 +211,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.9-dev"
+ "dev-master": "1.15-dev"
}
},
"autoload": {
@@ -236,26 +245,40 @@
"portable",
"shim"
],
- "time": "2018-09-21T06:26:08+00:00"
+ "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": "2020-03-09T19:04:49+00:00"
},
{
"name": "symfony/polyfill-intl-idn",
- "version": "v1.10.0",
+ "version": "v1.15.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-idn.git",
- "reference": "89de1d44f2c059b266f22c9cc9124ddc4cd0987a"
+ "reference": "47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/89de1d44f2c059b266f22c9cc9124ddc4cd0987a",
- "reference": "89de1d44f2c059b266f22c9cc9124ddc4cd0987a",
+ "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf",
+ "reference": "47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"symfony/polyfill-mbstring": "^1.3",
- "symfony/polyfill-php72": "^1.9"
+ "symfony/polyfill-php72": "^1.10"
},
"suggest": {
"ext-intl": "For best performance"
@@ -263,7 +286,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.9-dev"
+ "dev-master": "1.15-dev"
}
},
"autoload": {
@@ -279,13 +302,13 @@
"MIT"
],
"authors": [
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- },
{
"name": "Laurent Bassin",
"email": "laurent@bassin.info"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions",
@@ -298,20 +321,34 @@
"portable",
"shim"
],
- "time": "2018-09-30T16:36:12+00:00"
+ "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": "2020-03-09T19:04:49+00:00"
},
{
"name": "symfony/polyfill-mbstring",
- "version": "v1.10.0",
+ "version": "v1.15.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
- "reference": "c79c051f5b3a46be09205c73b80b346e4153e494"
+ "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494",
- "reference": "c79c051f5b3a46be09205c73b80b346e4153e494",
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/81ffd3a9c6d707be22e3012b827de1c9775fc5ac",
+ "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac",
"shasum": ""
},
"require": {
@@ -323,7 +360,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.9-dev"
+ "dev-master": "1.15-dev"
}
},
"autoload": {
@@ -357,20 +394,34 @@
"portable",
"shim"
],
- "time": "2018-09-21T13:07:52+00:00"
+ "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": "2020-03-09T19:04:49+00:00"
},
{
"name": "symfony/polyfill-php72",
- "version": "v1.10.0",
+ "version": "v1.15.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php72.git",
- "reference": "9050816e2ca34a8e916c3a0ae8b9c2fccf68b631"
+ "reference": "37b0976c78b94856543260ce09b460a7bc852747"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9050816e2ca34a8e916c3a0ae8b9c2fccf68b631",
- "reference": "9050816e2ca34a8e916c3a0ae8b9c2fccf68b631",
+ "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/37b0976c78b94856543260ce09b460a7bc852747",
+ "reference": "37b0976c78b94856543260ce09b460a7bc852747",
"shasum": ""
},
"require": {
@@ -379,7 +430,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.9-dev"
+ "dev-master": "1.15-dev"
}
},
"autoload": {
@@ -412,7 +463,21 @@
"portable",
"shim"
],
- "time": "2018-09-21T13:07:52+00:00"
+ "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": "2020-02-27T09:26:54+00:00"
}
],
"packages-dev": [],
@@ -424,5 +489,6 @@
"platform": {
"php": ">=7.1.3"
},
- "platform-dev": []
+ "platform-dev": [],
+ "plugin-api-version": "1.1.0"
}
diff --git a/user/plugins/email/email.php b/user/plugins/email/email.php
index ec82f3b..8879aed 100644
--- a/user/plugins/email/email.php
+++ b/user/plugins/email/email.php
@@ -1,6 +1,7 @@
['onFormProcessed', 0],
'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0],
'onSchedulerInitialized' => ['onSchedulerInitialized', 0],
+ 'onAdminSave' => ['onAdminSave', 0],
];
}
@@ -48,6 +50,28 @@ class EmailPlugin extends Plugin
$twig->twig_paths[] = __DIR__ . '/templates';
}
+ /**
+ * Force compile during save if admin plugin save
+ *
+ * @param Event $event
+ */
+ public function onAdminSave(Event $event)
+ {
+ /** @var Data $obj */
+ $obj = $event['object'];
+
+
+
+ if ($obj instanceof Data && $obj->blueprints()->getFilename() === 'email/blueprints') {
+ $current_pw = $this->grav['config']->get('plugins.email.mailer.smtp.password');
+ $new_pw = $obj->get('mailer.smtp.password');
+ if (!empty($current_pw) && empty($new_pw)) {
+ $obj->set('mailer.smtp.password', $current_pw);
+ }
+
+ }
+ }
+
/**
* Send email when processing the form data.
*
diff --git a/user/plugins/email/vendor/composer/ClassLoader.php b/user/plugins/email/vendor/composer/ClassLoader.php
index dc02dfb..fce8549 100644
--- a/user/plugins/email/vendor/composer/ClassLoader.php
+++ b/user/plugins/email/vendor/composer/ClassLoader.php
@@ -279,7 +279,7 @@ class ClassLoader
*/
public function setApcuPrefix($apcuPrefix)
{
- $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
+ $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
}
/**
@@ -377,7 +377,7 @@ class ClassLoader
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
- $search = $subPath.'\\';
+ $search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
diff --git a/user/plugins/email/vendor/composer/autoload_files.php b/user/plugins/email/vendor/composer/autoload_files.php
index de081a8..e5ea67d 100644
--- a/user/plugins/email/vendor/composer/autoload_files.php
+++ b/user/plugins/email/vendor/composer/autoload_files.php
@@ -8,7 +8,7 @@ $baseDir = dirname($vendorDir);
return array(
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php',
- 'def43f6c87e4f8dfd0c9e1b1bab14fe8' => $vendorDir . '/symfony/polyfill-iconv/bootstrap.php',
'f598d06aa772fa33d905e87be6398fb1' => $vendorDir . '/symfony/polyfill-intl-idn/bootstrap.php',
+ 'def43f6c87e4f8dfd0c9e1b1bab14fe8' => $vendorDir . '/symfony/polyfill-iconv/bootstrap.php',
'2c102faa651ef8ea5874edb585946bce' => $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php',
);
diff --git a/user/plugins/email/vendor/composer/autoload_namespaces.php b/user/plugins/email/vendor/composer/autoload_namespaces.php
index 4a6f5de..b7fc012 100644
--- a/user/plugins/email/vendor/composer/autoload_namespaces.php
+++ b/user/plugins/email/vendor/composer/autoload_namespaces.php
@@ -6,5 +6,4 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
- 'Doctrine\\Common\\Lexer\\' => array($vendorDir . '/doctrine/lexer/lib'),
);
diff --git a/user/plugins/email/vendor/composer/autoload_psr4.php b/user/plugins/email/vendor/composer/autoload_psr4.php
index a57e1d7..fc16de3 100644
--- a/user/plugins/email/vendor/composer/autoload_psr4.php
+++ b/user/plugins/email/vendor/composer/autoload_psr4.php
@@ -13,4 +13,5 @@ return array(
'Grav\\Plugin\\Email\\' => array($baseDir . '/classes'),
'Grav\\Plugin\\Console\\' => array($baseDir . '/cli'),
'Egulias\\EmailValidator\\' => array($vendorDir . '/egulias/email-validator/EmailValidator'),
+ 'Doctrine\\Common\\Lexer\\' => array($vendorDir . '/doctrine/lexer/lib/Doctrine/Common/Lexer'),
);
diff --git a/user/plugins/email/vendor/composer/autoload_real.php b/user/plugins/email/vendor/composer/autoload_real.php
index 909cb26..28cad00 100644
--- a/user/plugins/email/vendor/composer/autoload_real.php
+++ b/user/plugins/email/vendor/composer/autoload_real.php
@@ -13,6 +13,9 @@ class ComposerAutoloaderInitdec5d78def1384d1f20996ded9d7efbf
}
}
+ /**
+ * @return \Composer\Autoload\ClassLoader
+ */
public static function getLoader()
{
if (null !== self::$loader) {
diff --git a/user/plugins/email/vendor/composer/autoload_static.php b/user/plugins/email/vendor/composer/autoload_static.php
index a61cec6..bc5ecc5 100644
--- a/user/plugins/email/vendor/composer/autoload_static.php
+++ b/user/plugins/email/vendor/composer/autoload_static.php
@@ -9,8 +9,8 @@ class ComposerStaticInitdec5d78def1384d1f20996ded9d7efbf
public static $files = array (
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
'25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php',
- 'def43f6c87e4f8dfd0c9e1b1bab14fe8' => __DIR__ . '/..' . '/symfony/polyfill-iconv/bootstrap.php',
'f598d06aa772fa33d905e87be6398fb1' => __DIR__ . '/..' . '/symfony/polyfill-intl-idn/bootstrap.php',
+ 'def43f6c87e4f8dfd0c9e1b1bab14fe8' => __DIR__ . '/..' . '/symfony/polyfill-iconv/bootstrap.php',
'2c102faa651ef8ea5874edb585946bce' => __DIR__ . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php',
);
@@ -31,6 +31,10 @@ class ComposerStaticInitdec5d78def1384d1f20996ded9d7efbf
array (
'Egulias\\EmailValidator\\' => 23,
),
+ 'D' =>
+ array (
+ 'Doctrine\\Common\\Lexer\\' => 22,
+ ),
);
public static $prefixDirsPsr4 = array (
@@ -62,15 +66,9 @@ class ComposerStaticInitdec5d78def1384d1f20996ded9d7efbf
array (
0 => __DIR__ . '/..' . '/egulias/email-validator/EmailValidator',
),
- );
-
- public static $prefixesPsr0 = array (
- 'D' =>
+ 'Doctrine\\Common\\Lexer\\' =>
array (
- 'Doctrine\\Common\\Lexer\\' =>
- array (
- 0 => __DIR__ . '/..' . '/doctrine/lexer/lib',
- ),
+ 0 => __DIR__ . '/..' . '/doctrine/lexer/lib/Doctrine/Common/Lexer',
),
);
@@ -83,7 +81,6 @@ class ComposerStaticInitdec5d78def1384d1f20996ded9d7efbf
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitdec5d78def1384d1f20996ded9d7efbf::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitdec5d78def1384d1f20996ded9d7efbf::$prefixDirsPsr4;
- $loader->prefixesPsr0 = ComposerStaticInitdec5d78def1384d1f20996ded9d7efbf::$prefixesPsr0;
$loader->classMap = ComposerStaticInitdec5d78def1384d1f20996ded9d7efbf::$classMap;
}, null, ClassLoader::class);
diff --git a/user/plugins/email/vendor/composer/installed.json b/user/plugins/email/vendor/composer/installed.json
index 67ebd75..485a035 100644
--- a/user/plugins/email/vendor/composer/installed.json
+++ b/user/plugins/email/vendor/composer/installed.json
@@ -1,33 +1,38 @@
[
{
"name": "doctrine/lexer",
- "version": "v1.0.1",
- "version_normalized": "1.0.1.0",
+ "version": "1.2.0",
+ "version_normalized": "1.2.0.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/lexer.git",
- "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c"
+ "reference": "5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c",
- "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c",
+ "url": "https://api.github.com/repos/doctrine/lexer/zipball/5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6",
+ "reference": "5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6",
"shasum": ""
},
"require": {
- "php": ">=5.3.2"
+ "php": "^7.2"
},
- "time": "2014-09-09T13:34:57+00:00",
+ "require-dev": {
+ "doctrine/coding-standard": "^6.0",
+ "phpstan/phpstan": "^0.11.8",
+ "phpunit/phpunit": "^8.2"
+ },
+ "time": "2019-10-30T14:39:59+00:00",
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.0.x-dev"
+ "dev-master": "1.2.x-dev"
}
},
"installation-source": "dist",
"autoload": {
- "psr-0": {
- "Doctrine\\Common\\Lexer\\": "lib/"
+ "psr-4": {
+ "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer"
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -35,58 +40,62 @@
"MIT"
],
"authors": [
- {
- "name": "Roman Borschel",
- "email": "roman@code-factory.org"
- },
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
+ {
+ "name": "Roman Borschel",
+ "email": "roman@code-factory.org"
+ },
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
- "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.",
- "homepage": "http://www.doctrine-project.org",
+ "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.",
+ "homepage": "https://www.doctrine-project.org/projects/lexer.html",
"keywords": [
+ "annotations",
+ "docblock",
"lexer",
- "parser"
+ "parser",
+ "php"
]
},
{
"name": "egulias/email-validator",
- "version": "2.1.7",
- "version_normalized": "2.1.7.0",
+ "version": "2.1.17",
+ "version_normalized": "2.1.17.0",
"source": {
"type": "git",
"url": "https://github.com/egulias/EmailValidator.git",
- "reference": "709f21f92707308cdf8f9bcfa1af4cb26586521e"
+ "reference": "ade6887fd9bd74177769645ab5c474824f8a418a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/709f21f92707308cdf8f9bcfa1af4cb26586521e",
- "reference": "709f21f92707308cdf8f9bcfa1af4cb26586521e",
+ "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/ade6887fd9bd74177769645ab5c474824f8a418a",
+ "reference": "ade6887fd9bd74177769645ab5c474824f8a418a",
"shasum": ""
},
"require": {
"doctrine/lexer": "^1.0.1",
- "php": ">= 5.5"
+ "php": ">=5.5",
+ "symfony/polyfill-intl-idn": "^1.10"
},
"require-dev": {
- "dominicsayers/isemail": "dev-master",
- "phpunit/phpunit": "^4.8.35||^5.7||^6.0",
+ "dominicsayers/isemail": "^3.0.7",
+ "phpunit/phpunit": "^4.8.36|^7.5.15",
"satooshi/php-coveralls": "^1.0.1"
},
"suggest": {
"ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation"
},
- "time": "2018-12-04T22:38:24+00:00",
+ "time": "2020-02-13T22:36:52+00:00",
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.0.x-dev"
+ "dev-master": "2.1.x-dev"
}
},
"installation-source": "dist",
@@ -116,17 +125,17 @@
},
{
"name": "swiftmailer/swiftmailer",
- "version": "v6.2.0",
- "version_normalized": "6.2.0.0",
+ "version": "v6.2.3",
+ "version_normalized": "6.2.3.0",
"source": {
"type": "git",
"url": "https://github.com/swiftmailer/swiftmailer.git",
- "reference": "6fa3232ff9d3f8237c0fae4b7ff05e1baa4cd707"
+ "reference": "149cfdf118b169f7840bbe3ef0d4bc795d1780c9"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/6fa3232ff9d3f8237c0fae4b7ff05e1baa4cd707",
- "reference": "6fa3232ff9d3f8237c0fae4b7ff05e1baa4cd707",
+ "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/149cfdf118b169f7840bbe3ef0d4bc795d1780c9",
+ "reference": "149cfdf118b169f7840bbe3ef0d4bc795d1780c9",
"shasum": ""
},
"require": {
@@ -144,7 +153,7 @@
"ext-intl": "Needed to support internationalized email addresses",
"true/punycode": "Needed to support internationalized email addresses, if ext-intl is not installed"
},
- "time": "2019-03-10T07:52:41+00:00",
+ "time": "2019-11-12T09:31:26+00:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -180,17 +189,17 @@
},
{
"name": "symfony/polyfill-iconv",
- "version": "v1.10.0",
- "version_normalized": "1.10.0.0",
+ "version": "v1.15.0",
+ "version_normalized": "1.15.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-iconv.git",
- "reference": "97001cfc283484c9691769f51cdf25259037eba2"
+ "reference": "ad6d62792bfbcfc385dd34b424d4fcf9712a32c8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/97001cfc283484c9691769f51cdf25259037eba2",
- "reference": "97001cfc283484c9691769f51cdf25259037eba2",
+ "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/ad6d62792bfbcfc385dd34b424d4fcf9712a32c8",
+ "reference": "ad6d62792bfbcfc385dd34b424d4fcf9712a32c8",
"shasum": ""
},
"require": {
@@ -199,11 +208,11 @@
"suggest": {
"ext-iconv": "For best performance"
},
- "time": "2018-09-21T06:26:08+00:00",
+ "time": "2020-03-09T19:04:49+00:00",
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.9-dev"
+ "dev-master": "1.15-dev"
}
},
"installation-source": "dist",
@@ -237,36 +246,50 @@
"polyfill",
"portable",
"shim"
+ ],
+ "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"
+ }
]
},
{
"name": "symfony/polyfill-intl-idn",
- "version": "v1.10.0",
- "version_normalized": "1.10.0.0",
+ "version": "v1.15.0",
+ "version_normalized": "1.15.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-idn.git",
- "reference": "89de1d44f2c059b266f22c9cc9124ddc4cd0987a"
+ "reference": "47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/89de1d44f2c059b266f22c9cc9124ddc4cd0987a",
- "reference": "89de1d44f2c059b266f22c9cc9124ddc4cd0987a",
+ "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf",
+ "reference": "47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"symfony/polyfill-mbstring": "^1.3",
- "symfony/polyfill-php72": "^1.9"
+ "symfony/polyfill-php72": "^1.10"
},
"suggest": {
"ext-intl": "For best performance"
},
- "time": "2018-09-30T16:36:12+00:00",
+ "time": "2020-03-09T19:04:49+00:00",
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.9-dev"
+ "dev-master": "1.15-dev"
}
},
"installation-source": "dist",
@@ -283,13 +306,13 @@
"MIT"
],
"authors": [
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- },
{
"name": "Laurent Bassin",
"email": "laurent@bassin.info"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions",
@@ -301,21 +324,35 @@
"polyfill",
"portable",
"shim"
+ ],
+ "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"
+ }
]
},
{
"name": "symfony/polyfill-mbstring",
- "version": "v1.10.0",
- "version_normalized": "1.10.0.0",
+ "version": "v1.15.0",
+ "version_normalized": "1.15.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
- "reference": "c79c051f5b3a46be09205c73b80b346e4153e494"
+ "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494",
- "reference": "c79c051f5b3a46be09205c73b80b346e4153e494",
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/81ffd3a9c6d707be22e3012b827de1c9775fc5ac",
+ "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac",
"shasum": ""
},
"require": {
@@ -324,11 +361,11 @@
"suggest": {
"ext-mbstring": "For best performance"
},
- "time": "2018-09-21T13:07:52+00:00",
+ "time": "2020-03-09T19:04:49+00:00",
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.9-dev"
+ "dev-master": "1.15-dev"
}
},
"installation-source": "dist",
@@ -362,31 +399,45 @@
"polyfill",
"portable",
"shim"
+ ],
+ "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"
+ }
]
},
{
"name": "symfony/polyfill-php72",
- "version": "v1.10.0",
- "version_normalized": "1.10.0.0",
+ "version": "v1.15.0",
+ "version_normalized": "1.15.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php72.git",
- "reference": "9050816e2ca34a8e916c3a0ae8b9c2fccf68b631"
+ "reference": "37b0976c78b94856543260ce09b460a7bc852747"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9050816e2ca34a8e916c3a0ae8b9c2fccf68b631",
- "reference": "9050816e2ca34a8e916c3a0ae8b9c2fccf68b631",
+ "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/37b0976c78b94856543260ce09b460a7bc852747",
+ "reference": "37b0976c78b94856543260ce09b460a7bc852747",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
- "time": "2018-09-21T13:07:52+00:00",
+ "time": "2020-02-27T09:26:54+00:00",
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.9-dev"
+ "dev-master": "1.15-dev"
}
},
"installation-source": "dist",
@@ -419,6 +470,20 @@
"polyfill",
"portable",
"shim"
+ ],
+ "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"
+ }
]
}
]
diff --git a/user/plugins/email/vendor/doctrine/lexer/LICENSE b/user/plugins/email/vendor/doctrine/lexer/LICENSE
index 5e781fc..e8fdec4 100644
--- a/user/plugins/email/vendor/doctrine/lexer/LICENSE
+++ b/user/plugins/email/vendor/doctrine/lexer/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2006-2013 Doctrine Project
+Copyright (c) 2006-2018 Doctrine Project
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
diff --git a/user/plugins/email/vendor/doctrine/lexer/README.md b/user/plugins/email/vendor/doctrine/lexer/README.md
index 66f4430..e1b419a 100644
--- a/user/plugins/email/vendor/doctrine/lexer/README.md
+++ b/user/plugins/email/vendor/doctrine/lexer/README.md
@@ -1,5 +1,9 @@
# Doctrine Lexer
+Build Status: [](https://travis-ci.org/doctrine/lexer)
+
Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
This lexer is used in Doctrine Annotations and in Doctrine ORM (DQL).
+
+https://www.doctrine-project.org/projects/lexer.html
diff --git a/user/plugins/email/vendor/doctrine/lexer/composer.json b/user/plugins/email/vendor/doctrine/lexer/composer.json
index 8cd694c..0d8e5ad 100644
--- a/user/plugins/email/vendor/doctrine/lexer/composer.json
+++ b/user/plugins/email/vendor/doctrine/lexer/composer.json
@@ -1,9 +1,15 @@
{
"name": "doctrine/lexer",
"type": "library",
- "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.",
- "keywords": ["lexer", "parser"],
- "homepage": "http://www.doctrine-project.org",
+ "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.",
+ "keywords": [
+ "php",
+ "parser",
+ "lexer",
+ "annotations",
+ "docblock"
+ ],
+ "homepage": "https://www.doctrine-project.org/projects/lexer.html",
"license": "MIT",
"authors": [
{"name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com"},
@@ -11,14 +17,25 @@
{"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"}
],
"require": {
- "php": ">=5.3.2"
+ "php": "^7.2"
+ },
+ "require-dev": {
+ "doctrine/coding-standard": "^6.0",
+ "phpstan/phpstan": "^0.11.8",
+ "phpunit/phpunit": "^8.2"
},
"autoload": {
- "psr-0": { "Doctrine\\Common\\Lexer\\": "lib/" }
+ "psr-4": { "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" }
+ },
+ "autoload-dev": {
+ "psr-4": { "Doctrine\\Tests\\": "tests/Doctrine" }
},
"extra": {
"branch-alias": {
- "dev-master": "1.0.x-dev"
+ "dev-master": "1.2.x-dev"
}
+ },
+ "config": {
+ "sort-packages": true
}
}
diff --git a/user/plugins/email/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php b/user/plugins/email/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php
index 399a552..385643a 100644
--- a/user/plugins/email/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php
+++ b/user/plugins/email/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php
@@ -1,31 +1,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;
+
/**
* Base class for writing simple lexers, i.e. for creating small DSLs.
- *
- * @since 2.0
- * @author Guilherme Blanco
- * @author Jonathan Wage
- * @author Roman Borschel
*/
abstract class AbstractLexer
{
@@ -47,36 +37,43 @@ abstract class AbstractLexer
*
* @var array
*/
- private $tokens = array();
+ private $tokens = [];
/**
* Current lexer position in input string.
*
- * @var integer
+ * @var int
*/
private $position = 0;
/**
* Current peek of current lexer position.
*
- * @var integer
+ * @var int
*/
private $peek = 0;
/**
* The next token in the input.
*
- * @var array
+ * @var array|null
*/
public $lookahead;
/**
* The last matched/seen token.
*
- * @var array
+ * @var array|null
*/
public $token;
+ /**
+ * Composed regex for input parsing.
+ *
+ * @var string
+ */
+ private $regex;
+
/**
* Sets the input data to be tokenized.
*
@@ -90,7 +87,7 @@ abstract class AbstractLexer
public function setInput($input)
{
$this->input = $input;
- $this->tokens = array();
+ $this->tokens = [];
$this->reset();
$this->scan($input);
@@ -104,9 +101,9 @@ abstract class AbstractLexer
public function reset()
{
$this->lookahead = null;
- $this->token = null;
- $this->peek = 0;
- $this->position = 0;
+ $this->token = null;
+ $this->peek = 0;
+ $this->position = 0;
}
/**
@@ -122,7 +119,7 @@ abstract class AbstractLexer
/**
* Resets the lexer position on the input to the given position.
*
- * @param integer $position Position to place the lexical scanner.
+ * @param int $position Position to place the lexical scanner.
*
* @return void
*/
@@ -132,9 +129,9 @@ abstract class AbstractLexer
}
/**
- * Retrieve the original lexer's input until a given position.
+ * Retrieve the original lexer's input until a given position.
*
- * @param integer $position
+ * @param int $position
*
* @return string
*/
@@ -146,13 +143,13 @@ abstract class AbstractLexer
/**
* Checks whether a given token matches the current lookahead.
*
- * @param integer|string $token
+ * @param int|string $token
*
- * @return boolean
+ * @return bool
*/
public function isNextToken($token)
{
- return null !== $this->lookahead && $this->lookahead['type'] === $token;
+ return $this->lookahead !== null && $this->lookahead['type'] === $token;
}
/**
@@ -160,23 +157,23 @@ abstract class AbstractLexer
*
* @param array $tokens
*
- * @return boolean
+ * @return bool
*/
public function isNextTokenAny(array $tokens)
{
- return null !== $this->lookahead && in_array($this->lookahead['type'], $tokens, true);
+ return $this->lookahead !== null && in_array($this->lookahead['type'], $tokens, true);
}
/**
* Moves to the next token in the input string.
*
- * @return boolean
+ * @return bool
*/
public function moveNext()
{
- $this->peek = 0;
- $this->token = $this->lookahead;
- $this->lookahead = (isset($this->tokens[$this->position]))
+ $this->peek = 0;
+ $this->token = $this->lookahead;
+ $this->lookahead = isset($this->tokens[$this->position])
? $this->tokens[$this->position++] : null;
return $this->lookahead !== null;
@@ -199,10 +196,10 @@ abstract class AbstractLexer
/**
* Checks if given value is identical to the given token.
*
- * @param mixed $value
- * @param integer $token
+ * @param mixed $value
+ * @param int|string $token
*
- * @return boolean
+ * @return bool
*/
public function isA($value, $token)
{
@@ -218,9 +215,9 @@ abstract class AbstractLexer
{
if (isset($this->tokens[$this->position + $this->peek])) {
return $this->tokens[$this->position + $this->peek++];
- } else {
- return null;
}
+
+ return null;
}
/**
@@ -230,8 +227,9 @@ abstract class AbstractLexer
*/
public function glimpse()
{
- $peek = $this->peek();
+ $peek = $this->peek();
$this->peek = 0;
+
return $peek;
}
@@ -244,10 +242,8 @@ abstract class AbstractLexer
*/
protected function scan($input)
{
- static $regex;
-
- if ( ! isset($regex)) {
- $regex = sprintf(
+ if (! isset($this->regex)) {
+ $this->regex = sprintf(
'/(%s)|%s/%s',
implode(')|(', $this->getCatchablePatterns()),
implode('|', $this->getNonCatchablePatterns()),
@@ -255,32 +251,37 @@ abstract class AbstractLexer
);
}
- $flags = PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE;
- $matches = preg_split($regex, $input, -1, $flags);
+ $flags = PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE;
+ $matches = preg_split($this->regex, $input, -1, $flags);
+
+ if ($matches === false) {
+ // Work around https://bugs.php.net/78122
+ $matches = [[$input, 0]];
+ }
foreach ($matches as $match) {
// Must remain before 'value' assignment since it can change content
$type = $this->getType($match[0]);
- $this->tokens[] = array(
+ $this->tokens[] = [
'value' => $match[0],
'type' => $type,
'position' => $match[1],
- );
+ ];
}
}
/**
* Gets the literal for a given token.
*
- * @param integer $token
+ * @param int|string $token
*
- * @return string
+ * @return int|string
*/
public function getLiteral($token)
{
- $className = get_class($this);
- $reflClass = new \ReflectionClass($className);
+ $className = static::class;
+ $reflClass = new ReflectionClass($className);
$constants = $reflClass->getConstants();
foreach ($constants as $name => $value) {
@@ -299,7 +300,7 @@ abstract class AbstractLexer
*/
protected function getModifiers()
{
- return 'i';
+ return 'iu';
}
/**
@@ -321,7 +322,7 @@ abstract class AbstractLexer
*
* @param string $value
*
- * @return integer
+ * @return int|string|null
*/
abstract protected function getType(&$value);
}
diff --git a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/EmailLexer.php b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/EmailLexer.php
index 882c968..cb47c01 100644
--- a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/EmailLexer.php
+++ b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/EmailLexer.php
@@ -73,25 +73,73 @@ class EmailLexer extends AbstractLexer
'\0' => self::C_NUL,
);
+ /**
+ * @var bool
+ */
protected $hasInvalidTokens = false;
- protected $previous;
+ /**
+ * @var array
+ *
+ * @psalm-var array{value:string, type:null|int, position:int}|array
+ */
+ protected $previous = [];
+ /**
+ * The last matched/seen token.
+ *
+ * @var array
+ *
+ * @psalm-var array{value:string, type:null|int, position:int}
+ */
+ public $token;
+
+ /**
+ * The next token in the input.
+ *
+ * @var array|null
+ */
+ public $lookahead;
+
+ /**
+ * @psalm-var array{value:'', type:null, position:0}
+ */
+ private static $nullToken = [
+ 'value' => '',
+ 'type' => null,
+ 'position' => 0,
+ ];
+
+ public function __construct()
+ {
+ $this->previous = $this->token = self::$nullToken;
+ $this->lookahead = null;
+ }
+
+ /**
+ * @return void
+ */
public function reset()
{
$this->hasInvalidTokens = false;
parent::reset();
+ $this->previous = $this->token = self::$nullToken;
}
+ /**
+ * @return bool
+ */
public function hasInvalidTokens()
{
return $this->hasInvalidTokens;
}
/**
- * @param $type
+ * @param int $type
* @throws \UnexpectedValueException
* @return boolean
+ *
+ * @psalm-suppress InvalidScalarArgument
*/
public function find($type)
{
@@ -107,7 +155,7 @@ class EmailLexer extends AbstractLexer
/**
* getPrevious
*
- * @return array token
+ * @return array
*/
public function getPrevious()
{
@@ -122,8 +170,10 @@ class EmailLexer extends AbstractLexer
public function moveNext()
{
$this->previous = $this->token;
+ $hasNext = parent::moveNext();
+ $this->token = $this->token ?: self::$nullToken;
- return parent::moveNext();
+ return $hasNext;
}
/**
@@ -179,6 +229,11 @@ class EmailLexer extends AbstractLexer
return self::GENERIC;
}
+ /**
+ * @param string $value
+ *
+ * @return bool
+ */
protected function isValid($value)
{
if (isset($this->charValue[$value])) {
@@ -189,7 +244,7 @@ class EmailLexer extends AbstractLexer
}
/**
- * @param $value
+ * @param string $value
* @return bool
*/
protected function isNullType($value)
@@ -202,7 +257,7 @@ class EmailLexer extends AbstractLexer
}
/**
- * @param $value
+ * @param string $value
* @return bool
*/
protected function isUTF8Invalid($value)
@@ -214,6 +269,9 @@ class EmailLexer extends AbstractLexer
return false;
}
+ /**
+ * @return string
+ */
protected function getModifiers()
{
return 'iu';
diff --git a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/EmailParser.php b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/EmailParser.php
index d0627d8..6b7bad6 100644
--- a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/EmailParser.php
+++ b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/EmailParser.php
@@ -17,11 +17,33 @@ class EmailParser
{
const EMAIL_MAX_LENGTH = 254;
- protected $warnings;
+ /**
+ * @var array
+ */
+ protected $warnings = [];
+
+ /**
+ * @var string
+ */
protected $domainPart = '';
+
+ /**
+ * @var string
+ */
protected $localPart = '';
+ /**
+ * @var EmailLexer
+ */
protected $lexer;
+
+ /**
+ * @var LocalPart
+ */
protected $localPartParser;
+
+ /**
+ * @var DomainPart
+ */
protected $domainPartParser;
public function __construct(EmailLexer $lexer)
@@ -29,11 +51,10 @@ class EmailParser
$this->lexer = $lexer;
$this->localPartParser = new LocalPart($this->lexer);
$this->domainPartParser = new DomainPart($this->lexer);
- $this->warnings = new \SplObjectStorage();
}
/**
- * @param $str
+ * @param string $str
* @return array
*/
public function parse($str)
@@ -57,6 +78,9 @@ class EmailParser
return array('local' => $this->localPart, 'domain' => $this->domainPart);
}
+ /**
+ * @return Warning\Warning[]
+ */
public function getWarnings()
{
$localPartWarnings = $this->localPartParser->getWarnings();
@@ -68,11 +92,17 @@ class EmailParser
return $this->warnings;
}
+ /**
+ * @return string
+ */
public function getParsedDomainPart()
{
return $this->domainPart;
}
+ /**
+ * @param string $email
+ */
protected function setParts($email)
{
$parts = explode('@', $email);
@@ -80,6 +110,9 @@ class EmailParser
$this->localPart = $parts[0];
}
+ /**
+ * @return bool
+ */
protected function hasAtToken()
{
$this->lexer->moveNext();
diff --git a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/EmailValidator.php b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/EmailValidator.php
index 44b4b93..a30f21d 100644
--- a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/EmailValidator.php
+++ b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/EmailValidator.php
@@ -13,12 +13,12 @@ class EmailValidator
private $lexer;
/**
- * @var array
+ * @var Warning\Warning[]
*/
- protected $warnings;
+ protected $warnings = [];
/**
- * @var InvalidEmail
+ * @var InvalidEmail|null
*/
protected $error;
@@ -28,7 +28,7 @@ class EmailValidator
}
/**
- * @param $email
+ * @param string $email
* @param EmailValidation $emailValidation
* @return bool
*/
@@ -58,7 +58,7 @@ class EmailValidator
}
/**
- * @return InvalidEmail
+ * @return InvalidEmail|null
*/
public function getError()
{
diff --git a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Exception/ExpectingQPair.php b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Exception/ExpectingQPair.php
index 2502811..a738eeb 100644
--- a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Exception/ExpectingQPair.php
+++ b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Exception/ExpectingQPair.php
@@ -2,7 +2,7 @@
namespace Egulias\EmailValidator\Exception;
-class ExpectedQPair extends InvalidEmail
+class ExpectingQPair extends InvalidEmail
{
const CODE = 136;
const REASON = "Expecting QPAIR";
diff --git a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Exception/NoDNSRecord.php b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Exception/NoDNSRecord.php
index 86ca21d..0aa5fa7 100644
--- a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Exception/NoDNSRecord.php
+++ b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Exception/NoDNSRecord.php
@@ -2,8 +2,6 @@
namespace Egulias\EmailValidator\Exception;
-use Egulias\EmailValidator\Exception\InvalidEmail;
-
class NoDNSRecord extends InvalidEmail
{
const CODE = 5;
diff --git a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Parser/DomainPart.php b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Parser/DomainPart.php
index 51769de..0613e31 100644
--- a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Parser/DomainPart.php
+++ b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Parser/DomainPart.php
@@ -35,27 +35,17 @@ use Egulias\EmailValidator\Warning\TLD;
class DomainPart extends Parser
{
const DOMAIN_MAX_LENGTH = 254;
+
+ /**
+ * @var string
+ */
protected $domainPart = '';
public function parse($domainPart)
{
$this->lexer->moveNext();
- if ($this->lexer->token['type'] === EmailLexer::S_DOT) {
- throw new DotAtStart();
- }
-
- if ($this->lexer->token['type'] === EmailLexer::S_EMPTY) {
- throw new NoDomainPart();
- }
- if ($this->lexer->token['type'] === EmailLexer::S_HYPHEN) {
- throw new DomainHyphened();
- }
-
- if ($this->lexer->token['type'] === EmailLexer::S_OPENPARENTHESIS) {
- $this->warnings[DeprecatedComment::CODE] = new DeprecatedComment();
- $this->parseDomainComments();
- }
+ $this->performDomainStartChecks();
$domain = $this->doParseDomainPart();
@@ -77,11 +67,50 @@ class DomainPart extends Parser
$this->domainPart = $domain;
}
+ private function performDomainStartChecks()
+ {
+ $this->checkInvalidTokensAfterAT();
+ $this->checkEmptyDomain();
+
+ if ($this->lexer->token['type'] === EmailLexer::S_OPENPARENTHESIS) {
+ $this->warnings[DeprecatedComment::CODE] = new DeprecatedComment();
+ $this->parseDomainComments();
+ }
+ }
+
+ private function checkEmptyDomain()
+ {
+ $thereIsNoDomain = $this->lexer->token['type'] === EmailLexer::S_EMPTY ||
+ ($this->lexer->token['type'] === EmailLexer::S_SP &&
+ !$this->lexer->isNextToken(EmailLexer::GENERIC));
+
+ if ($thereIsNoDomain) {
+ throw new NoDomainPart();
+ }
+ }
+
+ private function checkInvalidTokensAfterAT()
+ {
+ if ($this->lexer->token['type'] === EmailLexer::S_DOT) {
+ throw new DotAtStart();
+ }
+ if ($this->lexer->token['type'] === EmailLexer::S_HYPHEN) {
+ throw new DomainHyphened();
+ }
+ }
+
+ /**
+ * @return string
+ */
public function getDomainPart()
{
return $this->domainPart;
}
+ /**
+ * @param string $addressLiteral
+ * @param int $maxGroups
+ */
public function checkIPV6Tag($addressLiteral, $maxGroups = 8)
{
$prev = $this->lexer->getPrevious();
@@ -125,6 +154,9 @@ class DomainPart extends Parser
}
}
+ /**
+ * @return string
+ */
protected function doParseDomainPart()
{
$domain = '';
@@ -166,12 +198,12 @@ class DomainPart extends Parser
$domain .= $this->lexer->token['value'];
$this->lexer->moveNext();
- } while ($this->lexer->token);
+ } while (null !== $this->lexer->token['type']);
return $domain;
}
- private function checkNotAllowedChars($token)
+ private function checkNotAllowedChars(array $token)
{
$notAllowed = [EmailLexer::S_BACKSLASH => true, EmailLexer::S_SLASH=> true];
if (isset($notAllowed[$token['type']])) {
@@ -179,6 +211,9 @@ class DomainPart extends Parser
}
}
+ /**
+ * @return string|false
+ */
protected function parseDomainLiteral()
{
if ($this->lexer->isNextToken(EmailLexer::S_COLON)) {
@@ -195,6 +230,9 @@ class DomainPart extends Parser
return $this->doParseDomainLiteral();
}
+ /**
+ * @return string|false
+ */
protected function doParseDomainLiteral()
{
$IPv6TAG = false;
@@ -262,6 +300,11 @@ class DomainPart extends Parser
return $addressLiteral;
}
+ /**
+ * @param string $addressLiteral
+ *
+ * @return string|false
+ */
protected function checkIPV4Tag($addressLiteral)
{
$matchesIP = array();
@@ -279,13 +322,13 @@ class DomainPart extends Parser
return false;
}
// Convert IPv4 part to IPv6 format for further testing
- $addressLiteral = substr($addressLiteral, 0, $index) . '0:0';
+ $addressLiteral = substr($addressLiteral, 0, (int) $index) . '0:0';
}
return $addressLiteral;
}
- protected function checkDomainPartExceptions($prev)
+ protected function checkDomainPartExceptions(array $prev)
{
$invalidDomainTokens = array(
EmailLexer::S_DQUOTE => true,
@@ -320,6 +363,9 @@ class DomainPart extends Parser
}
}
+ /**
+ * @return bool
+ */
protected function hasBrackets()
{
if ($this->lexer->token['type'] !== EmailLexer::S_OPENBRACKET) {
@@ -335,7 +381,7 @@ class DomainPart extends Parser
return true;
}
- protected function checkLabelLength($prev)
+ protected function checkLabelLength(array $prev)
{
if ($this->lexer->token['type'] === EmailLexer::S_DOT &&
$prev['type'] === EmailLexer::GENERIC &&
diff --git a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Parser/LocalPart.php b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Parser/LocalPart.php
index 8ab16ab..3c21f34 100644
--- a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Parser/LocalPart.php
+++ b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Parser/LocalPart.php
@@ -5,7 +5,6 @@ namespace Egulias\EmailValidator\Parser;
use Egulias\EmailValidator\Exception\DotAtEnd;
use Egulias\EmailValidator\Exception\DotAtStart;
use Egulias\EmailValidator\EmailLexer;
-use Egulias\EmailValidator\EmailValidator;
use Egulias\EmailValidator\Exception\ExpectingAT;
use Egulias\EmailValidator\Exception\ExpectingATEXT;
use Egulias\EmailValidator\Exception\UnclosedQuotedString;
@@ -20,9 +19,10 @@ class LocalPart extends Parser
$parseDQuote = true;
$closingQuote = false;
$openedParenthesis = 0;
+ $totalLength = 0;
- while ($this->lexer->token['type'] !== EmailLexer::S_AT && $this->lexer->token) {
- if ($this->lexer->token['type'] === EmailLexer::S_DOT && !$this->lexer->getPrevious()) {
+ while ($this->lexer->token['type'] !== EmailLexer::S_AT && null !== $this->lexer->token['type']) {
+ if ($this->lexer->token['type'] === EmailLexer::S_DOT && null === $this->lexer->getPrevious()['type']) {
throw new DotAtStart();
}
@@ -35,12 +35,13 @@ class LocalPart extends Parser
$this->parseComments();
$openedParenthesis += $this->getOpenedParenthesis();
}
+
if ($this->lexer->token['type'] === EmailLexer::S_CLOSEPARENTHESIS) {
if ($openedParenthesis === 0) {
throw new UnopenedComment();
- } else {
- $openedParenthesis--;
}
+
+ $openedParenthesis--;
}
$this->checkConsecutiveDots();
@@ -58,15 +59,18 @@ class LocalPart extends Parser
$this->parseFWS();
}
+ $totalLength += strlen($this->lexer->token['value']);
$this->lexer->moveNext();
}
- $prev = $this->lexer->getPrevious();
- if (strlen($prev['value']) > LocalTooLong::LOCAL_PART_LENGTH) {
+ if ($totalLength > LocalTooLong::LOCAL_PART_LENGTH) {
$this->warnings[LocalTooLong::CODE] = new LocalTooLong();
}
}
+ /**
+ * @return bool
+ */
protected function parseDoubleQuote()
{
$parseAgain = true;
@@ -86,7 +90,7 @@ class LocalPart extends Parser
$this->lexer->moveNext();
- while ($this->lexer->token['type'] !== EmailLexer::S_DQUOTE && $this->lexer->token) {
+ while ($this->lexer->token['type'] !== EmailLexer::S_DQUOTE && null !== $this->lexer->token['type']) {
$parseAgain = false;
if (isset($special[$this->lexer->token['type']]) && $setSpecialsWarning) {
$this->warnings[CFWSWithFWS::CODE] = new CFWSWithFWS();
@@ -118,7 +122,10 @@ class LocalPart extends Parser
return $parseAgain;
}
- protected function isInvalidToken($token, $closingQuote)
+ /**
+ * @param bool $closingQuote
+ */
+ protected function isInvalidToken(array $token, $closingQuote)
{
$forbidden = array(
EmailLexer::S_COMMA,
diff --git a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Parser/Parser.php b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Parser/Parser.php
index e5042e1..d0673b9 100644
--- a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Parser/Parser.php
+++ b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Parser/Parser.php
@@ -8,7 +8,7 @@ use Egulias\EmailValidator\Exception\ConsecutiveDot;
use Egulias\EmailValidator\Exception\CRLFAtTheEnd;
use Egulias\EmailValidator\Exception\CRLFX2;
use Egulias\EmailValidator\Exception\CRNoLF;
-use Egulias\EmailValidator\Exception\ExpectedQPair;
+use Egulias\EmailValidator\Exception\ExpectingQPair;
use Egulias\EmailValidator\Exception\ExpectingATEXT;
use Egulias\EmailValidator\Exception\ExpectingCTEXT;
use Egulias\EmailValidator\Exception\UnclosedComment;
@@ -21,8 +21,19 @@ use Egulias\EmailValidator\Warning\QuotedString;
abstract class Parser
{
+ /**
+ * @var \Egulias\EmailValidator\Warning\Warning[]
+ */
protected $warnings = [];
+
+ /**
+ * @var EmailLexer
+ */
protected $lexer;
+
+ /**
+ * @var int
+ */
protected $openedParenthesis = 0;
public function __construct(EmailLexer $lexer)
@@ -30,11 +41,17 @@ abstract class Parser
$this->lexer = $lexer;
}
+ /**
+ * @return \Egulias\EmailValidator\Warning\Warning[]
+ */
public function getWarnings()
{
return $this->warnings;
}
+ /**
+ * @param string $str
+ */
abstract public function parse($str);
/** @return int */
@@ -50,7 +67,7 @@ abstract class Parser
{
if (!($this->lexer->token['type'] === EmailLexer::INVALID
|| $this->lexer->token['type'] === EmailLexer::C_DEL)) {
- throw new ExpectedQPair();
+ throw new ExpectingQPair();
}
$this->warnings[QuotedPart::CODE] =
@@ -80,6 +97,9 @@ abstract class Parser
}
}
+ /**
+ * @return bool
+ */
protected function isUnclosedComment()
{
try {
@@ -122,6 +142,9 @@ abstract class Parser
}
}
+ /**
+ * @return bool
+ */
protected function isFWS()
{
if ($this->escaped()) {
@@ -140,11 +163,14 @@ abstract class Parser
return false;
}
+ /**
+ * @return bool
+ */
protected function escaped()
{
$previous = $this->lexer->getPrevious();
- if ($previous['type'] === EmailLexer::S_BACKSLASH
+ if ($previous && $previous['type'] === EmailLexer::S_BACKSLASH
&&
$this->lexer->token['type'] !== EmailLexer::GENERIC
) {
@@ -154,6 +180,9 @@ abstract class Parser
return false;
}
+ /**
+ * @return bool
+ */
protected function warnEscaping()
{
if ($this->lexer->token['type'] !== EmailLexer::S_BACKSLASH) {
@@ -174,6 +203,11 @@ abstract class Parser
}
+ /**
+ * @param bool $hasClosingQuote
+ *
+ * @return bool
+ */
protected function checkDQUOTE($hasClosingQuote)
{
if ($this->lexer->token['type'] !== EmailLexer::S_DQUOTE) {
diff --git a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/DNSCheckValidation.php b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/DNSCheckValidation.php
index e5c3e5d..da13253 100644
--- a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/DNSCheckValidation.php
+++ b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/DNSCheckValidation.php
@@ -15,13 +15,13 @@ class DNSCheckValidation implements EmailValidation
private $warnings = [];
/**
- * @var InvalidEmail
+ * @var InvalidEmail|null
*/
private $error;
-
+
public function __construct()
{
- if (!extension_loaded('intl')) {
+ if (!function_exists('idn_to_ascii')) {
throw new \LogicException(sprintf('The %s class requires the Intl extension.', __CLASS__));
}
}
@@ -49,6 +49,11 @@ class DNSCheckValidation implements EmailValidation
return $this->warnings;
}
+ /**
+ * @param string $host
+ *
+ * @return bool
+ */
protected function checkDNS($host)
{
$variant = INTL_IDNA_VARIANT_2003;
diff --git a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/Exception/EmptyValidationList.php b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/Exception/EmptyValidationList.php
index 775ad16..ee7c41a 100644
--- a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/Exception/EmptyValidationList.php
+++ b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/Exception/EmptyValidationList.php
@@ -6,6 +6,9 @@ use Exception;
class EmptyValidationList extends \InvalidArgumentException
{
+ /**
+ * @param int $code
+ */
public function __construct($code = 0, Exception $previous = null)
{
parent::__construct("Empty validation list is not allowed", $code, $previous);
diff --git a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/MultipleErrors.php b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/MultipleErrors.php
index d5e87d8..3be5973 100644
--- a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/MultipleErrors.php
+++ b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/MultipleErrors.php
@@ -9,16 +9,22 @@ class MultipleErrors extends InvalidEmail
const CODE = 999;
const REASON = "Accumulated errors for multiple validations";
/**
- * @var array
+ * @var InvalidEmail[]
*/
private $errors = [];
+ /**
+ * @param InvalidEmail[] $errors
+ */
public function __construct(array $errors)
{
$this->errors = $errors;
parent::__construct();
}
+ /**
+ * @return InvalidEmail[]
+ */
public function getErrors()
{
return $this->errors;
diff --git a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/MultipleValidationWithAnd.php b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/MultipleValidationWithAnd.php
index ce161ac..feb2240 100644
--- a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/MultipleValidationWithAnd.php
+++ b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/MultipleValidationWithAnd.php
@@ -30,12 +30,12 @@ class MultipleValidationWithAnd implements EmailValidation
private $warnings = [];
/**
- * @var MultipleErrors
+ * @var MultipleErrors|null
*/
private $error;
/**
- * @var bool
+ * @var int
*/
private $mode;
@@ -79,6 +79,12 @@ class MultipleValidationWithAnd implements EmailValidation
return $result;
}
+ /**
+ * @param \Egulias\EmailValidator\Exception\InvalidEmail|null $possibleError
+ * @param \Egulias\EmailValidator\Exception\InvalidEmail[] $errors
+ *
+ * @return \Egulias\EmailValidator\Exception\InvalidEmail[]
+ */
private function addNewError($possibleError, array $errors)
{
if (null !== $possibleError) {
@@ -88,13 +94,20 @@ class MultipleValidationWithAnd implements EmailValidation
return $errors;
}
+ /**
+ * @param bool $result
+ *
+ * @return bool
+ */
private function shouldStop($result)
{
return !$result && $this->mode === self::STOP_ON_ERROR;
}
/**
- * {@inheritdoc}
+ * Returns the validation errors.
+ *
+ * @return MultipleErrors|null
*/
public function getError()
{
diff --git a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/NoRFCWarningsValidation.php b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/NoRFCWarningsValidation.php
index e4bf0cc..6b31e54 100644
--- a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/NoRFCWarningsValidation.php
+++ b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/NoRFCWarningsValidation.php
@@ -9,7 +9,7 @@ use Egulias\EmailValidator\Validation\Error\RFCWarnings;
class NoRFCWarningsValidation extends RFCValidation
{
/**
- * @var InvalidEmail
+ * @var InvalidEmail|null
*/
private $error;
diff --git a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/RFCValidation.php b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/RFCValidation.php
index c4ffe35..8781e0b 100644
--- a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/RFCValidation.php
+++ b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/RFCValidation.php
@@ -9,7 +9,7 @@ use Egulias\EmailValidator\Exception\InvalidEmail;
class RFCValidation implements EmailValidation
{
/**
- * @var EmailParser
+ * @var EmailParser|null
*/
private $parser;
@@ -19,7 +19,7 @@ class RFCValidation implements EmailValidation
private $warnings = [];
/**
- * @var InvalidEmail
+ * @var InvalidEmail|null
*/
private $error;
diff --git a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/SpoofCheckValidation.php b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/SpoofCheckValidation.php
index 4721f0d..e10bfab 100644
--- a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/SpoofCheckValidation.php
+++ b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Validation/SpoofCheckValidation.php
@@ -10,7 +10,7 @@ use \Spoofchecker;
class SpoofCheckValidation implements EmailValidation
{
/**
- * @var InvalidEmail
+ * @var InvalidEmail|null
*/
private $error;
@@ -21,6 +21,9 @@ class SpoofCheckValidation implements EmailValidation
}
}
+ /**
+ * @psalm-suppress InvalidArgument
+ */
public function isValid($email, EmailLexer $emailLexer)
{
$checker = new Spoofchecker();
@@ -33,6 +36,9 @@ class SpoofCheckValidation implements EmailValidation
return $this->error === null;
}
+ /**
+ * @return InvalidEmail|null
+ */
public function getError()
{
return $this->error;
diff --git a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Warning/QuotedPart.php b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Warning/QuotedPart.php
index 7be9e6a..36a4265 100644
--- a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Warning/QuotedPart.php
+++ b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Warning/QuotedPart.php
@@ -6,6 +6,10 @@ class QuotedPart extends Warning
{
const CODE = 36;
+ /**
+ * @param scalar $prevToken
+ * @param scalar $postToken
+ */
public function __construct($prevToken, $postToken)
{
$this->message = "Deprecated Quoted String found between $prevToken and $postToken";
diff --git a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Warning/QuotedString.php b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Warning/QuotedString.php
index e9d56e1..817e4e8 100644
--- a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Warning/QuotedString.php
+++ b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Warning/QuotedString.php
@@ -6,6 +6,10 @@ class QuotedString extends Warning
{
const CODE = 11;
+ /**
+ * @param scalar $prevToken
+ * @param scalar $postToken
+ */
public function __construct($prevToken, $postToken)
{
$this->message = "Quoted String found between $prevToken and $postToken";
diff --git a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Warning/Warning.php b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Warning/Warning.php
index ec6a365..bce7e7a 100644
--- a/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Warning/Warning.php
+++ b/user/plugins/email/vendor/egulias/email-validator/EmailValidator/Warning/Warning.php
@@ -5,19 +5,36 @@ namespace Egulias\EmailValidator\Warning;
abstract class Warning
{
const CODE = 0;
- protected $message;
- protected $rfcNumber;
+ /**
+ * @var string
+ */
+ protected $message = '';
+
+ /**
+ * @var int
+ */
+ protected $rfcNumber = 0;
+
+ /**
+ * @return string
+ */
public function message()
{
return $this->message;
}
+ /**
+ * @return int
+ */
public function code()
{
return self::CODE;
}
+ /**
+ * @return int
+ */
public function RFCNumber()
{
return $this->rfcNumber;
diff --git a/user/plugins/email/vendor/egulias/email-validator/README.md b/user/plugins/email/vendor/egulias/email-validator/README.md
index 008669c..b5b0d85 100644
--- a/user/plugins/email/vendor/egulias/email-validator/README.md
+++ b/user/plugins/email/vendor/egulias/email-validator/README.md
@@ -1,5 +1,5 @@
# EmailValidator
-[](https://travis-ci.org/egulias/EmailValidator) [](https://coveralls.io/r/egulias/EmailValidator?branch=master) [](https://scrutinizer-ci.com/g/egulias/EmailValidator/?branch=master) [](https://insight.sensiolabs.com/projects/22ba6692-9c02-42e5-a65d-1c5696bfffc6)
+[](https://travis-ci.org/egulias/EmailValidator) [](https://coveralls.io/r/egulias/EmailValidator?branch=master) [](https://scrutinizer-ci.com/g/egulias/EmailValidator/?branch=master) [](https://insight.sensiolabs.com/projects/22ba6692-9c02-42e5-a65d-1c5696bfffc6)
=============================
## Suported RFCs ##
This library aims to support:
@@ -16,7 +16,7 @@ RFC 5321, 5322, 6530, 6531, 6532.
Run the command below to install via Composer
```shell
-composer require egulias/email-validator "~2.1"
+composer require egulias/email-validator
```
## Getting Started ##
diff --git a/user/plugins/email/vendor/egulias/email-validator/composer.json b/user/plugins/email/vendor/egulias/email-validator/composer.json
index 5423e9f..595caff 100644
--- a/user/plugins/email/vendor/egulias/email-validator/composer.json
+++ b/user/plugins/email/vendor/egulias/email-validator/composer.json
@@ -2,7 +2,6 @@
"name": "egulias/email-validator",
"description": "A library for validating emails against several RFCs",
"homepage": "https://github.com/egulias/EmailValidator",
- "type": "Library",
"keywords": ["email", "validation", "validator", "emailvalidation", "emailvalidator"],
"license": "MIT",
"authors": [
@@ -10,23 +9,18 @@
],
"extra": {
"branch-alias": {
- "dev-master": "2.0.x-dev"
+ "dev-master": "2.1.x-dev"
}
},
- "repositories": [
- {
- "type": "git",
- "url": "https://github.com/dominicsayers/isemail"
- }
- ],
- "require": {
- "php": ">= 5.5",
- "doctrine/lexer": "^1.0.1"
+ "require": {
+ "php": ">=5.5",
+ "doctrine/lexer": "^1.0.1",
+ "symfony/polyfill-intl-idn": "^1.10"
},
- "require-dev" : {
+ "require-dev": {
"satooshi/php-coveralls": "^1.0.1",
- "phpunit/phpunit": "^4.8.35||^5.7||^6.0",
- "dominicsayers/isemail": "dev-master"
+ "phpunit/phpunit": "^4.8.36|^7.5.15",
+ "dominicsayers/isemail": "^3.0.7"
},
"suggest": {
"ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation"
@@ -38,7 +32,7 @@
},
"autoload-dev": {
"psr-4": {
- "Egulias\\Tests\\": "test"
+ "Egulias\\Tests\\": "Tests"
}
}
}
diff --git a/user/plugins/email/vendor/egulias/email-validator/phpunit.xml.dist b/user/plugins/email/vendor/egulias/email-validator/phpunit.xml.dist
index b0812f9..1122406 100644
--- a/user/plugins/email/vendor/egulias/email-validator/phpunit.xml.dist
+++ b/user/plugins/email/vendor/egulias/email-validator/phpunit.xml.dist
@@ -8,7 +8,6 @@
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
- syntaxCheck="false"
bootstrap="vendor/autoload.php"
>
@@ -19,8 +18,8 @@
-
- ./vendor
-
+
+ ./EmailValidator/
+
diff --git a/user/plugins/email/vendor/egulias/email-validator/psalm.baseline.xml b/user/plugins/email/vendor/egulias/email-validator/psalm.baseline.xml
new file mode 100644
index 0000000..f81df72
--- /dev/null
+++ b/user/plugins/email/vendor/egulias/email-validator/psalm.baseline.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ self::$nullToken
+
+
+
+
+ parse
+
+
+
+
+ Spoofchecker
+ Spoofchecker
+
+
+
diff --git a/user/plugins/email/vendor/egulias/email-validator/psalm.xml b/user/plugins/email/vendor/egulias/email-validator/psalm.xml
new file mode 100644
index 0000000..fb17dc8
--- /dev/null
+++ b/user/plugins/email/vendor/egulias/email-validator/psalm.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/user/plugins/email/vendor/swiftmailer/swiftmailer/CHANGES b/user/plugins/email/vendor/swiftmailer/swiftmailer/CHANGES
index 95a6df6..ad0c815 100644
--- a/user/plugins/email/vendor/swiftmailer/swiftmailer/CHANGES
+++ b/user/plugins/email/vendor/swiftmailer/swiftmailer/CHANGES
@@ -1,6 +1,22 @@
Changelog
=========
+6.2.2 (2019-11-12)
+------------------
+
+ * no changes
+
+6.2.2 (2019-11-12)
+------------------
+
+ * fixed cmopat with PHP 7.4
+ * fixed error message when connecting to a stream raises an error before connect()
+
+6.2.1 (2019-04-21)
+------------------
+
+ * reverted "deprecated Swift_CharacterStream_ArrayCharacterStream and Swift_CharacterStream_NgCharacterStream in favor of Swift_CharacterStream_CharacterStream"
+
6.2.0 (2019-03-10)
------------------
diff --git a/user/plugins/email/vendor/swiftmailer/swiftmailer/README b/user/plugins/email/vendor/swiftmailer/swiftmailer/README
deleted file mode 100644
index a41b660..0000000
--- a/user/plugins/email/vendor/swiftmailer/swiftmailer/README
+++ /dev/null
@@ -1,15 +0,0 @@
-Swift Mailer
-------------
-
-Swift Mailer is a component based mailing solution for PHP 7.
-It is released under the MIT license.
-
-Homepage: https://swiftmailer.symfony.com/
-Documentation: https://swiftmailer.symfony.com/docs/introduction.html
-Bugs: https://github.com/swiftmailer/swiftmailer/issues
-Repository: https://github.com/swiftmailer/swiftmailer
-
-Swift Mailer is highly object-oriented by design and lends itself
-to use in complex web application with a great deal of flexibility.
-
-For full details on usage, see the documentation.
diff --git a/user/plugins/email/vendor/swiftmailer/swiftmailer/README.md b/user/plugins/email/vendor/swiftmailer/swiftmailer/README.md
new file mode 100644
index 0000000..e718bc6
--- /dev/null
+++ b/user/plugins/email/vendor/swiftmailer/swiftmailer/README.md
@@ -0,0 +1,19 @@
+Swift Mailer
+------------
+
+Swift Mailer is a component based mailing solution for PHP 7.
+It is released under the MIT license.
+
+Swift Mailer is highly object-oriented by design and lends itself
+to use in complex web application with a great deal of flexibility.
+
+For full details on usage, read the [documentation](https://swiftmailer.symfony.com/docs/introduction.html).
+
+Sponsors
+--------
+
+
diff --git a/user/plugins/email/vendor/swiftmailer/swiftmailer/doc/messages.rst b/user/plugins/email/vendor/swiftmailer/swiftmailer/doc/messages.rst
index fac402c..a3431a4 100644
--- a/user/plugins/email/vendor/swiftmailer/swiftmailer/doc/messages.rst
+++ b/user/plugins/email/vendor/swiftmailer/swiftmailer/doc/messages.rst
@@ -520,9 +520,8 @@ Setting ``To:`` Recipients
or ``addTo()`` methods of the message.
To set ``To:`` recipients, create the message object using either ``new
-Swift_Message( ... )`` or ``new Swift_Message( ... )``, then call the
-``setTo()`` method with a complete array of addresses, or use the ``addTo()``
-method to iteratively add recipients.
+Swift_Message( ... )``, then call the ``setTo()`` method with a complete array
+of addresses, or use the ``addTo()`` method to iteratively add recipients.
The ``setTo()`` method accepts input in various formats as described earlier in
this chapter. The ``addTo()`` method takes either one or two parameters. The
@@ -558,9 +557,8 @@ Setting ``Cc:`` Recipients
message.
To set ``Cc:`` recipients, create the message object using either ``new
-Swift_Message( ... )`` or ``new Swift_Message( ... )``, then call the
-``setCc()`` method with a complete array of addresses, or use the ``addCc()``
-method to iteratively add recipients.
+Swift_Message( ... )``, then call the ``setCc()`` method with a complete array
+of addresses, or use the ``addCc()`` method to iteratively add recipients.
The ``setCc()`` method accepts input in various formats as described earlier in
this chapter. The ``addCc()`` method takes either one or two parameters. The
@@ -596,9 +594,8 @@ Setting ``Bcc:`` Recipients
it, and are set with the ``setBcc()`` or ``addBcc()`` methods of the message.
To set ``Bcc:`` recipients, create the message object using either ``new
-Swift_Message( ... )`` or ``new Swift_Message( ... )``, then call the
-``setBcc()`` method with a complete array of addresses, or use the ``addBcc()``
-method to iteratively add recipients.
+Swift_Message( ... )``, then call the ``setBcc()`` method with a complete array
+of addresses, or use the ``addBcc()`` method to iteratively add recipients.
The ``setBcc()`` method accepts input in various formats as described earlier
in this chapter. The ``addBcc()`` method takes either one or two parameters.
diff --git a/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php b/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php
index 7eb7634..daf75fb 100644
--- a/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php
+++ b/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php
@@ -15,7 +15,7 @@
*/
abstract class Swift
{
- const VERSION = '6.2.0';
+ const VERSION = '6.2.3';
public static $initialized = false;
public static $inits = [];
diff --git a/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php b/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php
index c2fb1d5..887658c 100644
--- a/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php
+++ b/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php
@@ -8,8 +8,6 @@
* file that was distributed with this source code.
*/
-@trigger_error(sprintf('The "%s" class is deprecated since Swiftmailer 6.2; use "%s" instead.', Swift_CharacterStream_ArrayCharacterStream::class, Swift_CharacterStream_CharacterStream::class), E_USER_DEPRECATED);
-
/**
* A CharacterStream implementation which stores characters in an internal array.
*
diff --git a/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/CharacterStream.php b/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/CharacterStream.php
deleted file mode 100644
index 7ce97ae..0000000
--- a/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/CharacterStream.php
+++ /dev/null
@@ -1,227 +0,0 @@
-
- */
-class Swift_CharacterStream_CharacterStream implements Swift_CharacterStream
-{
- /**
- * The char reader (lazy-loaded) for the current charset.
- *
- * @var Swift_CharacterReader
- */
- private $charReader;
-
- /**
- * A factory for creating CharacterReader instances.
- *
- * @var Swift_CharacterReaderFactory
- */
- private $charReaderFactory;
-
- /**
- * The character set this stream is using.
- *
- * @var string
- */
- private $charset;
-
- /**
- * The data's stored as-is.
- *
- * @var string
- */
- private $datas = '';
-
- /**
- * Number of bytes in the stream.
- *
- * @var int
- */
- private $datasSize = 0;
-
- /**
- * Map.
- *
- * @var mixed
- */
- private $map;
-
- /**
- * Map Type.
- *
- * @var int
- */
- private $mapType = 0;
-
- /**
- * Number of characters in the stream.
- *
- * @var int
- */
- private $charCount = 0;
-
- /**
- * Position in the stream.
- *
- * @var int
- */
- private $currentPos = 0;
-
- /**
- * Constructor.
- *
- * @param string $charset
- */
- public function __construct(Swift_CharacterReaderFactory $factory, $charset)
- {
- $this->setCharacterReaderFactory($factory);
- $this->setCharacterSet($charset);
- }
-
- /* -- Changing parameters of the stream -- */
-
- /**
- * Set the character set used in this CharacterStream.
- *
- * @param string $charset
- */
- public function setCharacterSet($charset)
- {
- $this->charset = $charset;
- $this->charReader = null;
- $this->mapType = 0;
- }
-
- /**
- * Set the CharacterReaderFactory for multi charset support.
- */
- public function setCharacterReaderFactory(Swift_CharacterReaderFactory $factory)
- {
- $this->charReaderFactory = $factory;
- }
-
- public function flushContents()
- {
- $this->datas = null;
- $this->map = null;
- $this->charCount = 0;
- $this->currentPos = 0;
- $this->datasSize = 0;
- }
-
- public function importByteStream(Swift_OutputByteStream $os)
- {
- $this->flushContents();
- $blocks = 512;
- $os->setReadPointer(0);
- while (false !== ($read = $os->read($blocks))) {
- $this->write($read);
- }
- }
-
- public function importString($string)
- {
- $this->flushContents();
- $this->write($string);
- }
-
- public function read($length)
- {
- if ($this->currentPos >= $this->charCount) {
- return false;
- }
- $ret = false;
- $length = ($this->currentPos + $length > $this->charCount) ? $this->charCount - $this->currentPos : $length;
- switch ($this->mapType) {
- case Swift_CharacterReader::MAP_TYPE_FIXED_LEN:
- $len = $length * $this->map;
- $ret = substr($this->datas,
- $this->currentPos * $this->map,
- $len);
- $this->currentPos += $length;
- break;
-
- case Swift_CharacterReader::MAP_TYPE_INVALID:
- $ret = '';
- for (; $this->currentPos < $length; ++$this->currentPos) {
- if (isset($this->map[$this->currentPos])) {
- $ret .= '?';
- } else {
- $ret .= $this->datas[$this->currentPos];
- }
- }
- break;
-
- case Swift_CharacterReader::MAP_TYPE_POSITIONS:
- $end = $this->currentPos + $length;
- $end = $end > $this->charCount ? $this->charCount : $end;
- $ret = '';
- $start = 0;
- if ($this->currentPos > 0) {
- $start = $this->map['p'][$this->currentPos - 1];
- }
- $to = $start;
- for (; $this->currentPos < $end; ++$this->currentPos) {
- if (isset($this->map['i'][$this->currentPos])) {
- $ret .= substr($this->datas, $start, $to - $start).'?';
- $start = $this->map['p'][$this->currentPos];
- } else {
- $to = $this->map['p'][$this->currentPos];
- }
- }
- $ret .= substr($this->datas, $start, $to - $start);
- break;
- }
-
- return $ret;
- }
-
- public function readBytes($length)
- {
- $read = $this->read($length);
- if (false !== $read) {
- $ret = array_map('ord', str_split($read, 1));
-
- return $ret;
- }
-
- return false;
- }
-
- public function setPointer($charOffset)
- {
- if ($this->charCount < $charOffset) {
- $charOffset = $this->charCount;
- }
- $this->currentPos = $charOffset;
- }
-
- public function write($chars)
- {
- if (!isset($this->charReader)) {
- $this->charReader = $this->charReaderFactory->getReaderFor(
- $this->charset);
- $this->map = [];
- $this->mapType = $this->charReader->getMapType();
- }
- $ignored = '';
- $this->datas .= $chars;
- $this->charCount += $this->charReader->getCharPositions(substr($this->datas, $this->datasSize), $this->datasSize, $this->map, $ignored);
- if (false !== $ignored) {
- $this->datasSize = strlen($this->datas) - strlen($ignored);
- } else {
- $this->datasSize = strlen($this->datas);
- }
- }
-}
diff --git a/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/NgCharacterStream.php b/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/NgCharacterStream.php
index d606776..a733063 100644
--- a/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/NgCharacterStream.php
+++ b/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/NgCharacterStream.php
@@ -8,13 +8,255 @@
* file that was distributed with this source code.
*/
-@trigger_error(sprintf('The "%s" class is deprecated since Swiftmailer 6.2; use "%s" instead.', Swift_CharacterStream_NgCharacterStream::class, Swift_CharacterStream_CharacterStream::class), E_USER_DEPRECATED);
-
/**
* A CharacterStream implementation which stores characters in an internal array.
*
* @author Xavier De Cock
*/
-class Swift_CharacterStream_NgCharacterStream extends Swift_CharacterStream_CharacterStream
+class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
{
+ /**
+ * The char reader (lazy-loaded) for the current charset.
+ *
+ * @var Swift_CharacterReader
+ */
+ private $charReader;
+
+ /**
+ * A factory for creating CharacterReader instances.
+ *
+ * @var Swift_CharacterReaderFactory
+ */
+ private $charReaderFactory;
+
+ /**
+ * The character set this stream is using.
+ *
+ * @var string
+ */
+ private $charset;
+
+ /**
+ * The data's stored as-is.
+ *
+ * @var string
+ */
+ private $datas = '';
+
+ /**
+ * Number of bytes in the stream.
+ *
+ * @var int
+ */
+ private $datasSize = 0;
+
+ /**
+ * Map.
+ *
+ * @var mixed
+ */
+ private $map;
+
+ /**
+ * Map Type.
+ *
+ * @var int
+ */
+ private $mapType = 0;
+
+ /**
+ * Number of characters in the stream.
+ *
+ * @var int
+ */
+ private $charCount = 0;
+
+ /**
+ * Position in the stream.
+ *
+ * @var int
+ */
+ private $currentPos = 0;
+
+ /**
+ * Constructor.
+ *
+ * @param string $charset
+ */
+ public function __construct(Swift_CharacterReaderFactory $factory, $charset)
+ {
+ $this->setCharacterReaderFactory($factory);
+ $this->setCharacterSet($charset);
+ }
+
+ /* -- Changing parameters of the stream -- */
+
+ /**
+ * Set the character set used in this CharacterStream.
+ *
+ * @param string $charset
+ */
+ public function setCharacterSet($charset)
+ {
+ $this->charset = $charset;
+ $this->charReader = null;
+ $this->mapType = 0;
+ }
+
+ /**
+ * Set the CharacterReaderFactory for multi charset support.
+ */
+ public function setCharacterReaderFactory(Swift_CharacterReaderFactory $factory)
+ {
+ $this->charReaderFactory = $factory;
+ }
+
+ /**
+ * @see Swift_CharacterStream::flushContents()
+ */
+ public function flushContents()
+ {
+ $this->datas = null;
+ $this->map = null;
+ $this->charCount = 0;
+ $this->currentPos = 0;
+ $this->datasSize = 0;
+ }
+
+ /**
+ * @see Swift_CharacterStream::importByteStream()
+ */
+ public function importByteStream(Swift_OutputByteStream $os)
+ {
+ $this->flushContents();
+ $blocks = 512;
+ $os->setReadPointer(0);
+ while (false !== ($read = $os->read($blocks))) {
+ $this->write($read);
+ }
+ }
+
+ /**
+ * @see Swift_CharacterStream::importString()
+ *
+ * @param string $string
+ */
+ public function importString($string)
+ {
+ $this->flushContents();
+ $this->write($string);
+ }
+
+ /**
+ * @see Swift_CharacterStream::read()
+ *
+ * @param int $length
+ *
+ * @return string
+ */
+ public function read($length)
+ {
+ if ($this->currentPos >= $this->charCount) {
+ return false;
+ }
+ $ret = false;
+ $length = ($this->currentPos + $length > $this->charCount) ? $this->charCount - $this->currentPos : $length;
+ switch ($this->mapType) {
+ case Swift_CharacterReader::MAP_TYPE_FIXED_LEN:
+ $len = $length * $this->map;
+ $ret = substr($this->datas,
+ $this->currentPos * $this->map,
+ $len);
+ $this->currentPos += $length;
+ break;
+
+ case Swift_CharacterReader::MAP_TYPE_INVALID:
+ $ret = '';
+ for (; $this->currentPos < $length; ++$this->currentPos) {
+ if (isset($this->map[$this->currentPos])) {
+ $ret .= '?';
+ } else {
+ $ret .= $this->datas[$this->currentPos];
+ }
+ }
+ break;
+
+ case Swift_CharacterReader::MAP_TYPE_POSITIONS:
+ $end = $this->currentPos + $length;
+ $end = $end > $this->charCount ? $this->charCount : $end;
+ $ret = '';
+ $start = 0;
+ if ($this->currentPos > 0) {
+ $start = $this->map['p'][$this->currentPos - 1];
+ }
+ $to = $start;
+ for (; $this->currentPos < $end; ++$this->currentPos) {
+ if (isset($this->map['i'][$this->currentPos])) {
+ $ret .= substr($this->datas, $start, $to - $start).'?';
+ $start = $this->map['p'][$this->currentPos];
+ } else {
+ $to = $this->map['p'][$this->currentPos];
+ }
+ }
+ $ret .= substr($this->datas, $start, $to - $start);
+ break;
+ }
+
+ return $ret;
+ }
+
+ /**
+ * @see Swift_CharacterStream::readBytes()
+ *
+ * @param int $length
+ *
+ * @return int[]
+ */
+ public function readBytes($length)
+ {
+ $read = $this->read($length);
+ if (false !== $read) {
+ $ret = array_map('ord', str_split($read, 1));
+
+ return $ret;
+ }
+
+ return false;
+ }
+
+ /**
+ * @see Swift_CharacterStream::setPointer()
+ *
+ * @param int $charOffset
+ */
+ public function setPointer($charOffset)
+ {
+ if ($this->charCount < $charOffset) {
+ $charOffset = $this->charCount;
+ }
+ $this->currentPos = $charOffset;
+ }
+
+ /**
+ * @see Swift_CharacterStream::write()
+ *
+ * @param string $chars
+ */
+ public function write($chars)
+ {
+ if (!isset($this->charReader)) {
+ $this->charReader = $this->charReaderFactory->getReaderFor(
+ $this->charset);
+ $this->map = [];
+ $this->mapType = $this->charReader->getMapType();
+ }
+ $ignored = '';
+ $this->datas .= $chars;
+ $this->charCount += $this->charReader->getCharPositions(substr($this->datas, $this->datasSize), $this->datasSize, $this->map, $ignored);
+ if (false !== $ignored) {
+ $this->datasSize = strlen($this->datas) - strlen($ignored);
+ } else {
+ $this->datasSize = strlen($this->datas);
+ }
+ }
}
diff --git a/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php b/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php
index ab17f5c..5f7b8ac 100644
--- a/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php
+++ b/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php
@@ -264,13 +264,16 @@ class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableIn
$options = array_merge($options, $this->params['stream_context_options']);
}
$streamContext = stream_context_create($options);
- $this->stream = @stream_socket_client($host.':'.$this->params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $streamContext);
- if (false === $this->stream) {
- throw new Swift_TransportException(
- 'Connection could not be established with host '.$this->params['host'].
- ' ['.$errstr.' #'.$errno.']'
- );
+
+ set_error_handler(function ($type, $msg) {
+ throw new Swift_TransportException('Connection could not be established with host '.$this->params['host'].' :'.$msg);
+ });
+ try {
+ $this->stream = stream_socket_client($host.':'.$this->params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $streamContext);
+ } finally {
+ restore_error_handler();
}
+
if (!empty($this->params['blocking'])) {
stream_set_blocking($this->stream, 1);
} else {
diff --git a/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/dependency_maps/mime_deps.php b/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/dependency_maps/mime_deps.php
index 975945b..307756c 100644
--- a/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/dependency_maps/mime_deps.php
+++ b/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/dependency_maps/mime_deps.php
@@ -84,7 +84,7 @@ Swift_DependencyContainer::getInstance()
->withDependencies(['mime.charstream'])
->register('mime.charstream')
- ->asNewInstanceOf('Swift_CharacterStream_CharacterStream')
+ ->asNewInstanceOf('Swift_CharacterStream_NgCharacterStream')
->withDependencies(['mime.characterreaderfactory', 'properties.charset'])
->register('mime.bytecanonicalizer')
diff --git a/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/swiftmailer_generate_mimes_config.php b/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/swiftmailer_generate_mimes_config.php
index 7120db1..3b940b7 100644
--- a/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/swiftmailer_generate_mimes_config.php
+++ b/user/plugins/email/vendor/swiftmailer/swiftmailer/lib/swiftmailer_generate_mimes_config.php
@@ -173,7 +173,7 @@ function generateUpToDateMimeArray()
ksort($valid_mime_types);
// combine mime types and extensions array
- $output = "$preamble\$swift_mime_types = array(\n ".implode($valid_mime_types, ",\n ")."\n);";
+ $output = "$preamble\$swift_mime_types = array(\n ".implode(",\n ", $valid_mime_types)."\n);";
// write mime_types.php config file
@file_put_contents('./mime_types.php', $output);
diff --git a/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php b/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php
index deea362..5bbf067 100644
--- a/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php
+++ b/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php
@@ -20,7 +20,7 @@ class Swift_Encoder_QpEncoderAcceptanceTest extends \PHPUnit\Framework\TestCase
}
$encoding = $encodingDir;
- $charStream = new Swift_CharacterStream_CharacterStream(
+ $charStream = new Swift_CharacterStream_ArrayCharacterStream(
$this->factory, $encoding);
$encoder = new Swift_Encoder_QpEncoder($charStream);
diff --git a/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php b/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php
index e28cc93..20c68d5 100644
--- a/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php
+++ b/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php
@@ -20,7 +20,7 @@ class Swift_Encoder_Rfc2231EncoderAcceptanceTest extends \PHPUnit\Framework\Test
}
$encoding = $encodingDir;
- $charStream = new Swift_CharacterStream_CharacterStream(
+ $charStream = new Swift_CharacterStream_ArrayCharacterStream(
$this->factory, $encoding);
$encoder = new Swift_Encoder_Rfc2231Encoder($charStream);
diff --git a/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php b/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php
index e931dda..920faed 100644
--- a/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php
+++ b/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php
@@ -18,10 +18,10 @@ class Swift_Mime_AttachmentAcceptanceTest extends \PHPUnit\Framework\TestCase
$this->contentEncoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder();
$headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(
- new Swift_CharacterStream_CharacterStream($factory, 'utf-8')
+ new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
);
$paramEncoder = new Swift_Encoder_Rfc2231Encoder(
- new Swift_CharacterStream_CharacterStream($factory, 'utf-8')
+ new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
);
$this->emailValidator = new EmailValidator();
$this->idGenerator = new Swift_Mime_IdGenerator('example.com');
diff --git a/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php b/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php
index a4a6395..26d1a9b 100644
--- a/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php
+++ b/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php
@@ -25,7 +25,7 @@ class Swift_Mime_ContentEncoder_QpContentEncoderAcceptanceTest extends \PHPUnit\
}
$encoding = $encodingDir;
- $charStream = new Swift_CharacterStream_CharacterStream(
+ $charStream = new Swift_CharacterStream_NgCharacterStream(
$this->factory, $encoding);
$encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream);
diff --git a/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php b/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php
index dbe5592..5603a67 100644
--- a/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php
+++ b/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php
@@ -18,10 +18,10 @@ class Swift_Mime_EmbeddedFileAcceptanceTest extends \PHPUnit\Framework\TestCase
$this->contentEncoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder();
$headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(
- new Swift_CharacterStream_CharacterStream($factory, 'utf-8')
+ new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
);
$paramEncoder = new Swift_Encoder_Rfc2231Encoder(
- new Swift_CharacterStream_CharacterStream($factory, 'utf-8')
+ new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
);
$this->emailValidator = new EmailValidator();
$this->idGenerator = new Swift_Mime_IdGenerator('example.com');
diff --git a/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php b/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php
index ec3ad72..5a12daa 100644
--- a/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php
+++ b/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php
@@ -16,7 +16,7 @@ class Swift_Mime_MimePartAcceptanceTest extends \PHPUnit\Framework\TestCase
);
$factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
$this->contentEncoder = new Swift_Mime_ContentEncoder_QpContentEncoder(
- new Swift_CharacterStream_CharacterStream($factory, 'utf-8'),
+ new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'),
new Swift_StreamFilters_ByteArrayReplacementFilter(
[[0x0D, 0x0A], [0x0D], [0x0A]],
[[0x0A], [0x0A], [0x0D, 0x0A]]
@@ -24,10 +24,10 @@ class Swift_Mime_MimePartAcceptanceTest extends \PHPUnit\Framework\TestCase
);
$headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(
- new Swift_CharacterStream_CharacterStream($factory, 'utf-8')
+ new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
);
$paramEncoder = new Swift_Encoder_Rfc2231Encoder(
- new Swift_CharacterStream_CharacterStream($factory, 'utf-8')
+ new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
);
$this->emailValidator = new EmailValidator();
$this->idGenerator = new Swift_Mime_IdGenerator('example.com');
diff --git a/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug206Test.php b/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug206Test.php
index da75d59..67c9551 100644
--- a/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug206Test.php
+++ b/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug206Test.php
@@ -10,10 +10,10 @@ class Swift_Bug206Test extends \PHPUnit\Framework\TestCase
{
$factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
$headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(
- new Swift_CharacterStream_CharacterStream($factory, 'utf-8')
+ new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
);
$paramEncoder = new Swift_Encoder_Rfc2231Encoder(
- new Swift_CharacterStream_CharacterStream($factory, 'utf-8')
+ new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
);
$emailValidator = new EmailValidator();
$this->factory = new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $emailValidator);
diff --git a/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug650Test.php b/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug650Test.php
index 60da76d..31036c6 100644
--- a/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug650Test.php
+++ b/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug650Test.php
@@ -13,7 +13,7 @@ class Swift_Bug650Test extends \PHPUnit\Framework\TestCase
public function testMailboxHeaderEncoding($name, $expectedEncodedName)
{
$factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
- $charStream = new Swift_CharacterStream_CharacterStream($factory, 'utf-8');
+ $charStream = new Swift_CharacterStream_NgCharacterStream($factory, 'utf-8');
$encoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder($charStream);
$header = new Swift_Mime_Headers_MailboxHeader('To', $encoder, new EmailValidator());
$header->setCharset('utf-8');
diff --git a/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterStream/ArrayCharacterStreamTest.php b/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterStream/ArrayCharacterStreamTest.php
index 3500f9f..d0158a2 100644
--- a/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterStream/ArrayCharacterStreamTest.php
+++ b/user/plugins/email/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterStream/ArrayCharacterStreamTest.php
@@ -1,8 +1,5 @@
getMockery('Swift_Mime_SimpleHeaderSet');
diff --git a/user/plugins/email/vendor/symfony/polyfill-iconv/LICENSE b/user/plugins/email/vendor/symfony/polyfill-iconv/LICENSE
index 24fa32c..4cd8bdd 100644
--- a/user/plugins/email/vendor/symfony/polyfill-iconv/LICENSE
+++ b/user/plugins/email/vendor/symfony/polyfill-iconv/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2015-2018 Fabien Potencier
+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
diff --git a/user/plugins/email/vendor/symfony/polyfill-iconv/README.md b/user/plugins/email/vendor/symfony/polyfill-iconv/README.md
index 2421831..b0c8984 100644
--- a/user/plugins/email/vendor/symfony/polyfill-iconv/README.md
+++ b/user/plugins/email/vendor/symfony/polyfill-iconv/README.md
@@ -2,8 +2,8 @@ Symfony Polyfill / Iconv
========================
This component provides a native PHP implementation of the
-[php.net/iconv](http://php.net/iconv) functions
-(short of [`ob_iconv_handler`](http://php.net/manual/en/function.ob-iconv-handler.php)).
+[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).
diff --git a/user/plugins/email/vendor/symfony/polyfill-iconv/Resources/charset/translit.php b/user/plugins/email/vendor/symfony/polyfill-iconv/Resources/charset/translit.php
index 829ea12..ed59858 100644
--- a/user/plugins/email/vendor/symfony/polyfill-iconv/Resources/charset/translit.php
+++ b/user/plugins/email/vendor/symfony/polyfill-iconv/Resources/charset/translit.php
@@ -866,6 +866,7 @@ static $data = array (
'㋼' => '(ヰ)',
'㋽' => '(ヱ)',
'㋾' => '(ヲ)',
+ '㋿' => '令和',
'㌀' => 'アパート',
'㌁' => 'アルファ',
'㌂' => 'アンペア',
@@ -3133,6 +3134,7 @@ static $data = array (
'🈸' => '申',
'🈹' => '割',
'🈺' => '営',
+ '🈻' => '配',
'🉀' => '〔本〕',
'🉁' => '〔三〕',
'🉂' => '〔二〕',
@@ -3878,6 +3880,104 @@ static $data = array (
'ỽ' => 'v',
'Ỿ' => 'Y',
'ỿ' => 'y',
+ 'Ⱡ' => 'L',
+ 'ⱡ' => 'l',
+ 'Ɫ' => 'L',
+ 'Ᵽ' => 'P',
+ 'Ɽ' => 'R',
+ 'ⱥ' => 'a',
+ 'ⱦ' => 't',
+ 'Ⱨ' => 'H',
+ 'ⱨ' => 'h',
+ 'Ⱪ' => 'K',
+ 'ⱪ' => 'k',
+ 'Ⱬ' => 'Z',
+ 'ⱬ' => 'z',
+ 'Ɱ' => 'M',
+ 'ⱱ' => 'v',
+ 'Ⱳ' => 'W',
+ 'ⱳ' => 'w',
+ 'ⱴ' => 'v',
+ 'ⱸ' => 'e',
+ 'ⱺ' => 'o',
+ 'Ȿ' => 'S',
+ 'Ɀ' => 'Z',
+ 'ꜰ' => 'F',
+ 'ꜱ' => 'S',
+ 'Ꜳ' => 'AA',
+ 'ꜳ' => 'aa',
+ 'Ꜵ' => 'AO',
+ 'ꜵ' => 'ao',
+ 'Ꜷ' => 'AU',
+ 'ꜷ' => 'au',
+ 'Ꜹ' => 'AV',
+ 'ꜹ' => 'av',
+ 'Ꜻ' => 'AV',
+ 'ꜻ' => 'av',
+ 'Ꜽ' => 'AY',
+ 'ꜽ' => 'ay',
+ 'Ꝁ' => 'K',
+ 'ꝁ' => 'k',
+ 'Ꝃ' => 'K',
+ 'ꝃ' => 'k',
+ 'Ꝅ' => 'K',
+ 'ꝅ' => 'k',
+ 'Ꝇ' => 'L',
+ 'ꝇ' => 'l',
+ 'Ꝉ' => 'L',
+ 'ꝉ' => 'l',
+ 'Ꝋ' => 'O',
+ 'ꝋ' => 'o',
+ 'Ꝍ' => 'O',
+ 'ꝍ' => 'o',
+ 'Ꝏ' => 'OO',
+ 'ꝏ' => 'oo',
+ 'Ꝑ' => 'P',
+ 'ꝑ' => 'p',
+ 'Ꝓ' => 'P',
+ 'ꝓ' => 'p',
+ 'Ꝕ' => 'P',
+ 'ꝕ' => 'p',
+ 'Ꝗ' => 'Q',
+ 'ꝗ' => 'q',
+ 'Ꝙ' => 'Q',
+ 'ꝙ' => 'q',
+ 'Ꝟ' => 'V',
+ 'ꝟ' => 'v',
+ 'Ꝡ' => 'VY',
+ 'ꝡ' => 'vy',
+ 'Ꝥ' => 'TH',
+ 'ꝥ' => 'th',
+ 'Ꝧ' => 'TH',
+ 'ꝧ' => 'th',
+ 'ꝱ' => 'd',
+ 'ꝲ' => 'l',
+ 'ꝳ' => 'm',
+ 'ꝴ' => 'n',
+ 'ꝵ' => 'r',
+ 'ꝶ' => 'R',
+ 'ꝷ' => 't',
+ 'Ꝺ' => 'D',
+ 'ꝺ' => 'd',
+ 'Ꝼ' => 'F',
+ 'ꝼ' => 'f',
+ 'Ꞇ' => 'T',
+ 'ꞇ' => 't',
+ 'Ꞑ' => 'N',
+ 'ꞑ' => 'n',
+ 'Ꞓ' => 'C',
+ 'ꞓ' => 'c',
+ 'Ꞡ' => 'G',
+ 'ꞡ' => 'g',
+ 'Ꞣ' => 'K',
+ 'ꞣ' => 'k',
+ 'Ꞥ' => 'N',
+ 'ꞥ' => 'n',
+ 'Ꞧ' => 'R',
+ 'ꞧ' => 'r',
+ 'Ꞩ' => 'S',
+ 'ꞩ' => 's',
+ 'Ɦ' => 'H',
'©' => '(C)',
'®' => '(R)',
'₠' => 'CE',
@@ -3887,8 +3987,28 @@ static $data = array (
'₧' => 'Pts',
'₺' => 'TL',
'₹' => 'Rs',
+ '℗' => '(P)',
+ '℘' => 'P',
'℞' => 'Rx',
'〇' => '0',
+ ' ' => ' ',
+ ' ' => ' ',
+ ' ' => ' ',
+ ' ' => ' ',
+ ' ' => ' ',
+ ' ' => ' ',
+ ' ' => ' ',
+ ' ' => ' ',
+ ' ' => ' ',
+ ' ' => ' ',
+ ' ' => ' ',
+ 'ʹ' => '\'',
+ 'ʺ' => '"',
+ 'ʻ' => '\'',
+ 'ʼ' => '\'',
+ 'ʽ' => '\'',
+ 'ˈ' => '\'',
+ 'ˋ' => '`',
'‘' => '\'',
'’' => '\'',
'‚' => ',',
@@ -3904,6 +4024,7 @@ static $data = array (
'»' => '>>',
'‹' => '<',
'›' => '>',
+ '' => '-',
'‐' => '-',
'‑' => '-',
'‒' => '-',
@@ -3912,6 +4033,12 @@ static $data = array (
'―' => '-',
'︱' => '-',
'︲' => '-',
+ '˂' => '<',
+ '˃' => '>',
+ '˄' => '^',
+ 'ˆ' => '^',
+ 'ː' => ':',
+ '˜' => '~',
'‖' => '||',
'⁄' => '/',
'⁅' => '[',
@@ -3952,6 +4079,8 @@ static $data = array (
'﹈' => ']',
'×' => '*',
'÷' => '/',
+ '˖' => '+',
+ '˗' => '-',
'−' => '-',
'∕' => '/',
'∖' => '\\',
diff --git a/user/plugins/email/vendor/symfony/polyfill-iconv/bootstrap.php b/user/plugins/email/vendor/symfony/polyfill-iconv/bootstrap.php
index 5274732..e59d196 100644
--- a/user/plugins/email/vendor/symfony/polyfill-iconv/bootstrap.php
+++ b/user/plugins/email/vendor/symfony/polyfill-iconv/bootstrap.php
@@ -11,12 +11,14 @@
use Symfony\Polyfill\Iconv as p;
-if (!function_exists('iconv')) {
+if (!defined('ICONV_IMPL')) {
define('ICONV_IMPL', 'Symfony');
define('ICONV_VERSION', '1.0');
define('ICONV_MIME_DECODE_STRICT', 1);
define('ICONV_MIME_DECODE_CONTINUE_ON_ERROR', 2);
+}
+if (!function_exists('iconv')) {
function iconv($from, $to, $s) { return p\Iconv::iconv($from, $to, $s); }
function iconv_get_encoding($type = 'all') { return p\Iconv::iconv_get_encoding($type); }
function iconv_set_encoding($type, $charset) { return p\Iconv::iconv_set_encoding($type, $charset); }
diff --git a/user/plugins/email/vendor/symfony/polyfill-iconv/composer.json b/user/plugins/email/vendor/symfony/polyfill-iconv/composer.json
index 816e6bd..6c940ac 100644
--- a/user/plugins/email/vendor/symfony/polyfill-iconv/composer.json
+++ b/user/plugins/email/vendor/symfony/polyfill-iconv/composer.json
@@ -28,7 +28,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "1.9-dev"
+ "dev-master": "1.15-dev"
}
}
}
diff --git a/user/plugins/email/vendor/symfony/polyfill-intl-idn/Idn.php b/user/plugins/email/vendor/symfony/polyfill-intl-idn/Idn.php
index f205f39..adb718d 100644
--- a/user/plugins/email/vendor/symfony/polyfill-intl-idn/Idn.php
+++ b/user/plugins/email/vendor/symfony/polyfill-intl-idn/Idn.php
@@ -43,6 +43,9 @@ namespace Symfony\Polyfill\Intl\Idn;
*/
final class Idn
{
+ const INTL_IDNA_VARIANT_2003 = 0;
+ const INTL_IDNA_VARIANT_UTS46 = 1;
+
private static $encodeTable = array(
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
@@ -60,18 +63,18 @@ final class Idn
public static function idn_to_ascii($domain, $options, $variant, &$idna_info = array())
{
- if (\PHP_VERSION_ID >= 70200 && INTL_IDNA_VARIANT_2003 === $variant) {
+ if (\PHP_VERSION_ID >= 70200 && self::INTL_IDNA_VARIANT_2003 === $variant) {
@trigger_error('idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated', E_USER_DEPRECATED);
}
- if (INTL_IDNA_VARIANT_UTS46 === $variant) {
+ if (self::INTL_IDNA_VARIANT_UTS46 === $variant) {
$domain = mb_strtolower($domain, 'utf-8');
}
$parts = explode('.', $domain);
- foreach ($parts as &$part) {
- if ('' === $part) {
+ foreach ($parts as $i => &$part) {
+ if ('' === $part && \count($parts) > 1 + $i) {
return false;
}
if (false === $part = self::encodePart($part)) {
@@ -92,7 +95,7 @@ final class Idn
public static function idn_to_utf8($domain, $options, $variant, &$idna_info = array())
{
- if (\PHP_VERSION_ID >= 70200 && INTL_IDNA_VARIANT_2003 === $variant) {
+ if (\PHP_VERSION_ID >= 70200 && self::INTL_IDNA_VARIANT_2003 === $variant) {
@trigger_error('idn_to_utf8(): INTL_IDNA_VARIANT_2003 is deprecated', E_USER_DEPRECATED);
}
diff --git a/user/plugins/email/vendor/symfony/polyfill-intl-idn/LICENSE b/user/plugins/email/vendor/symfony/polyfill-intl-idn/LICENSE
index ad399a7..3f853aa 100644
--- a/user/plugins/email/vendor/symfony/polyfill-intl-idn/LICENSE
+++ b/user/plugins/email/vendor/symfony/polyfill-intl-idn/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2018 Fabien Potencier
+Copyright (c) 2018-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
diff --git a/user/plugins/email/vendor/symfony/polyfill-intl-idn/README.md b/user/plugins/email/vendor/symfony/polyfill-intl-idn/README.md
index 5fd8c6e..2e75f2e 100644
--- a/user/plugins/email/vendor/symfony/polyfill-intl-idn/README.md
+++ b/user/plugins/email/vendor/symfony/polyfill-intl-idn/README.md
@@ -1,7 +1,7 @@
Symfony Polyfill / Intl: Idn
============================
-This component provides `idn_to_ascii` and `idn_to_utf8` functions to users who run php versions without the intl extension.
+This component provides [`idn_to_ascii`](https://php.net/idn-to-ascii) and [`idn_to_utf8`](https://php.net/idn-to-utf8) functions to users who run php versions without the [Intl](https://php.net/intl) extension.
More information can be found in the
[main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md).
diff --git a/user/plugins/email/vendor/symfony/polyfill-intl-idn/bootstrap.php b/user/plugins/email/vendor/symfony/polyfill-intl-idn/bootstrap.php
index c6e3921..b29d4e5 100644
--- a/user/plugins/email/vendor/symfony/polyfill-intl-idn/bootstrap.php
+++ b/user/plugins/email/vendor/symfony/polyfill-intl-idn/bootstrap.php
@@ -11,7 +11,7 @@
use Symfony\Polyfill\Intl\Idn as p;
-if (!function_exists('idn_to_ascii')) {
+if (!defined('IDNA_DEFAULT')) {
define('U_IDNA_PROHIBITED_ERROR', 66560);
define('U_IDNA_ERROR_START', 66560);
define('U_IDNA_UNASSIGNED_ERROR', 66561);
@@ -48,7 +48,9 @@ if (!function_exists('idn_to_ascii')) {
define('IDNA_ERROR_INVALID_ACE_LABEL', 1024);
define('IDNA_ERROR_BIDI', 2048);
define('IDNA_ERROR_CONTEXTJ', 4096);
+}
+if (!function_exists('idn_to_ascii')) {
if (PHP_VERSION_ID < 70400) {
function idn_to_ascii($domain, $options = IDNA_DEFAULT, $variant = INTL_IDNA_VARIANT_2003, &$idna_info = array()) { return p\Idn::idn_to_ascii($domain, $options, $variant, $idna_info); }
function idn_to_utf8($domain, $options = IDNA_DEFAULT, $variant = INTL_IDNA_VARIANT_2003, &$idna_info = array()) { return p\Idn::idn_to_utf8($domain, $options, $variant, $idna_info); }
diff --git a/user/plugins/email/vendor/symfony/polyfill-intl-idn/composer.json b/user/plugins/email/vendor/symfony/polyfill-intl-idn/composer.json
index 8f46fbd..ef2c006 100644
--- a/user/plugins/email/vendor/symfony/polyfill-intl-idn/composer.json
+++ b/user/plugins/email/vendor/symfony/polyfill-intl-idn/composer.json
@@ -18,7 +18,7 @@
"require": {
"php": ">=5.3.3",
"symfony/polyfill-mbstring": "^1.3",
- "symfony/polyfill-php72": "^1.9"
+ "symfony/polyfill-php72": "^1.10"
},
"autoload": {
"psr-4": { "Symfony\\Polyfill\\Intl\\Idn\\": "" },
@@ -30,7 +30,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "1.9-dev"
+ "dev-master": "1.15-dev"
}
}
}
diff --git a/user/plugins/email/vendor/symfony/polyfill-mbstring/LICENSE b/user/plugins/email/vendor/symfony/polyfill-mbstring/LICENSE
index 24fa32c..4cd8bdd 100644
--- a/user/plugins/email/vendor/symfony/polyfill-mbstring/LICENSE
+++ b/user/plugins/email/vendor/symfony/polyfill-mbstring/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2015-2018 Fabien Potencier
+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
diff --git a/user/plugins/email/vendor/symfony/polyfill-mbstring/Mbstring.php b/user/plugins/email/vendor/symfony/polyfill-mbstring/Mbstring.php
index a5e4a8f..15503bc 100644
--- a/user/plugins/email/vendor/symfony/polyfill-mbstring/Mbstring.php
+++ b/user/plugins/email/vendor/symfony/polyfill-mbstring/Mbstring.php
@@ -35,6 +35,7 @@ namespace Symfony\Polyfill\Mbstring;
* - mb_strlen - Get string length
* - mb_strpos - Find position of first occurrence of string in a string
* - mb_strrpos - Find position of last occurrence of a string in a string
+ * - mb_str_split - Convert a string to an array
* - mb_strtolower - Make a string lowercase
* - mb_strtoupper - Make a string uppercase
* - mb_substitute_character - Set/Get substitution character
@@ -511,7 +512,9 @@ final class Mbstring
$offset = 0;
} elseif ($offset = (int) $offset) {
if ($offset < 0) {
- $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
+ if (0 > $offset += self::mb_strlen($needle)) {
+ $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
+ }
$offset = 0;
} else {
$haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
@@ -523,6 +526,45 @@ final class Mbstring
return false !== $pos ? $offset + $pos : false;
}
+ public static function mb_str_split($string, $split_length = 1, $encoding = null)
+ {
+ if (null !== $string && !\is_scalar($string) && !(\is_object($string) && \method_exists($string, '__toString'))) {
+ trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', E_USER_WARNING);
+
+ return null;
+ }
+
+ if (1 > $split_length = (int) $split_length) {
+ trigger_error('The length of each segment must be greater than zero', E_USER_WARNING);
+
+ return false;
+ }
+
+ if (null === $encoding) {
+ $encoding = mb_internal_encoding();
+ }
+
+ if ('UTF-8' === $encoding = self::getEncoding($encoding)) {
+ $rx = '/(';
+ while (65535 < $split_length) {
+ $rx .= '.{65535}';
+ $split_length -= 65535;
+ }
+ $rx .= '.{'.$split_length.'})/us';
+
+ return preg_split($rx, $string, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
+ }
+
+ $result = array();
+ $length = mb_strlen($string, $encoding);
+
+ for ($i = 0; $i < $length; $i += $split_length) {
+ $result[] = mb_substr($string, $i, $split_length, $encoding);
+ }
+
+ return $result;
+ }
+
public static function mb_strtolower($s, $encoding = null)
{
return self::mb_convert_case($s, MB_CASE_LOWER, $encoding);
@@ -546,7 +588,7 @@ final class Mbstring
{
$encoding = self::getEncoding($encoding);
if ('CP850' === $encoding || 'ASCII' === $encoding) {
- return substr($s, $start, null === $length ? 2147483647 : $length);
+ return (string) substr($s, $start, null === $length ? 2147483647 : $length);
}
if ($start < 0) {
@@ -786,11 +828,16 @@ final class Mbstring
return self::$internalEncoding;
}
+ if ('UTF-8' === $encoding) {
+ return 'UTF-8';
+ }
+
$encoding = strtoupper($encoding);
if ('8BIT' === $encoding || 'BINARY' === $encoding) {
return 'CP850';
}
+
if ('UTF8' === $encoding) {
return 'UTF-8';
}
diff --git a/user/plugins/email/vendor/symfony/polyfill-mbstring/README.md b/user/plugins/email/vendor/symfony/polyfill-mbstring/README.md
index 342e828..4efb599 100644
--- a/user/plugins/email/vendor/symfony/polyfill-mbstring/README.md
+++ b/user/plugins/email/vendor/symfony/polyfill-mbstring/README.md
@@ -2,7 +2,7 @@ Symfony Polyfill / Mbstring
===========================
This component provides a partial, native PHP implementation for the
-[Mbstring](http://php.net/mbstring) extension.
+[Mbstring](https://php.net/mbstring) extension.
More information can be found in the
[main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md).
diff --git a/user/plugins/email/vendor/symfony/polyfill-mbstring/bootstrap.php b/user/plugins/email/vendor/symfony/polyfill-mbstring/bootstrap.php
index 2fdcc5a..8c8225c 100644
--- a/user/plugins/email/vendor/symfony/polyfill-mbstring/bootstrap.php
+++ b/user/plugins/email/vendor/symfony/polyfill-mbstring/bootstrap.php
@@ -11,11 +11,13 @@
use Symfony\Polyfill\Mbstring as p;
-if (!function_exists('mb_strlen')) {
+if (!defined('MB_CASE_UPPER')) {
define('MB_CASE_UPPER', 0);
define('MB_CASE_LOWER', 1);
define('MB_CASE_TITLE', 2);
+}
+if (!function_exists('mb_strlen')) {
function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); }
function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); }
function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); }
@@ -56,3 +58,7 @@ if (!function_exists('mb_chr')) {
function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); }
function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); }
}
+
+if (!function_exists('mb_str_split')) {
+ function mb_str_split($string, $split_length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $split_length, $encoding); }
+}
diff --git a/user/plugins/email/vendor/symfony/polyfill-mbstring/composer.json b/user/plugins/email/vendor/symfony/polyfill-mbstring/composer.json
index 50ea12f..02b8896 100644
--- a/user/plugins/email/vendor/symfony/polyfill-mbstring/composer.json
+++ b/user/plugins/email/vendor/symfony/polyfill-mbstring/composer.json
@@ -28,7 +28,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "1.9-dev"
+ "dev-master": "1.15-dev"
}
}
}
diff --git a/user/plugins/email/vendor/symfony/polyfill-php72/LICENSE b/user/plugins/email/vendor/symfony/polyfill-php72/LICENSE
index 24fa32c..4cd8bdd 100644
--- a/user/plugins/email/vendor/symfony/polyfill-php72/LICENSE
+++ b/user/plugins/email/vendor/symfony/polyfill-php72/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2015-2018 Fabien Potencier
+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
diff --git a/user/plugins/email/vendor/symfony/polyfill-php72/README.md b/user/plugins/email/vendor/symfony/polyfill-php72/README.md
index 82c45f7..8ac181e 100644
--- a/user/plugins/email/vendor/symfony/polyfill-php72/README.md
+++ b/user/plugins/email/vendor/symfony/polyfill-php72/README.md
@@ -16,7 +16,7 @@ Moved to core since 7.2 (was in the optional XML extension earlier):
- [`utf8_decode`](https://php.net/utf8_decode)
Also, it provides a constant added to PHP 7.2:
-- [`PHP_OS_FAMILY`](http://php.net/manual/en/reserved.constants.php#constant.php-os-family)
+- [`PHP_OS_FAMILY`](https://php.net/reserved.constants#constant.php-os-family)
More information can be found in the
[main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md).
diff --git a/user/plugins/email/vendor/symfony/polyfill-php72/composer.json b/user/plugins/email/vendor/symfony/polyfill-php72/composer.json
index 5d66ef7..27901f2 100644
--- a/user/plugins/email/vendor/symfony/polyfill-php72/composer.json
+++ b/user/plugins/email/vendor/symfony/polyfill-php72/composer.json
@@ -25,7 +25,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "1.9-dev"
+ "dev-master": "1.15-dev"
}
}
}
diff --git a/user/plugins/form/CHANGELOG.md b/user/plugins/form/CHANGELOG.md
index fd0e7e5..7a741a6 100644
--- a/user/plugins/form/CHANGELOG.md
+++ b/user/plugins/form/CHANGELOG.md
@@ -1,3 +1,124 @@
+# v4.1.1
+## 09/01/2020
+
+1. [](#bugfix)
+ * Key field should not escape the value
+
+# v4.1.0
+## 07/29/2020
+
+1. [](#new)
+ * Support JSON based form submissions
+1. [](#improved)
+ * Improved handling of error messages with more details + translation [#428](https://github.com/getgrav/grav-plugin-form/pull/428) [#429](https://github.com/getgrav/grav-plugin-form/pull/429)
+ * Various improvements for nested form data in `data.html.twig` and `data.txt.twig`
+ * Use `|length` rather than `|count` twig filter
+ * Various language updates
+1. [](#bugfix)
+ * Disabled the EXIF library for Dropzone for fixing the orientation as it was getting applied twice [#1923](https://github.com/getgrav/grav-plugin-admin/issues/1923)
+ * Forked Dropzone fo fix issue with Resize + EXIF orientation [#1923](https://github.com/getgrav/grav-plugin-admin/issues/1923)
+
+# v4.0.10
+## 06/08/2020
+
+1. [](#improved)
+ * Updated languages
+1. [](#bugfix)
+ * Fixed redirect causing empty form on homepage forms with no action set
+
+# v4.0.9
+## 06/03/2020
+
+1. [](#bugfix)
+ * Fixed bad `id` attribute on `checkbox` field [#421](https://github.com/getgrav/grav-plugin-form/issues/421)
+ * Show the `description` span even for an empty description [#313](https://github.com/getgrav/grav-plugin-form/pull/313)
+
+# v4.0.8
+## 04/30/2020
+
+1. [](#bugfix)
+ * Fixed issue with `force_bool` in `toggle` field to be more robust
+
+# v4.0.7
+## 04/27/2020
+
+1. [](#new)
+ * Added ability to hide form fields in `data.html.twig` and `data.txt.twig` with `field.store: false`
+1. [](#improved)
+ * Updated node dependencies
+ * Added new `force_bool: true|false` option to `toggle` field to cast strings for use in BC situations
+1. [](#bugfix)
+ * Fix markdown links in changelog [#415](https://github.com/getgrav/grav-plugin-form/pull/415)
+
+# v4.0.6
+## 03/19/2020
+1. [](#new)
+ * CHANGE: Form labels are now displayed in `raw` format so you can use HTML in them
+ * Added support for `name` attribute on buttons [#411](https://github.com/getgrav/grav-plugin-form/issues/411)
+1. [](#improved)
+ * Added support for `classes` option in `avatar` field
+ * Recompiled JS with latest NPM libraries
+1. [](#bugfix)
+ * Fixed password field outputting the contents to HTML (will now always be empty when loading the page)
+ * Escape default output in `formdata.html.twig` [#384](https://github.com/getgrav/grav-plugin-form/issues/384)
+ * Better JS rendering of captcha field scripts for VueJS template compatibility
+
+# v4.0.5
+## 03/05/2020
+
+1. [](#bugfix)
+ * Fixed form actions that post to page anchors should not have current base_url added (e.g. `#contact-us`)
+ * Fixed toggleable buttons no longer holding false state [#406](https://github.com/getgrav/grav-plugin-form/issues/406)
+
+# v4.0.4
+## 02/25/2020
+
+1. [](#bugfix)
+ * Fix for `enctype` in multipart forms [#408](https://github.com/getgrav/grav-plugin-form/issues/408)
+
+# v4.0.3
+## 02/11/2020
+
+1. [](#new)
+ * Pass phpstan level 1 tests
+
+# v4.0.2
+## 02/03/2020
+
+1. [](#improved)
+ * Allow checkbox field to have custom value, default to 1
+1. [](#bugfix)
+ * Fixed `toggle` field not working with `toggleable: true`
+ * Fixed fatal error when form type is disabled
+
+# v4.0.1
+## 01/02/2020
+
+1. [](#improved)
+ * Improve Grav 1.7 support by not using deprecated `$page->modular()` call
+ * Use form scope if it is defined
+1. [](#bugfix)
+ * Fixed bad HTML in select, radio, key, toggle, checkbox ad textarea when using tabindex attribute
+ * Fixed bad looking `tabs` field with a single tab in admin
+
+# v4.0.0
+## 11/06/2019
+
+1. [](#new)
+ * Added `tabindex` to global attributes of default field
+ * Add ability to Sanitize SVGs on upload (Grav 1.7+ required)
+1. [](#improved)
+ * Deprecate `select_optgroup` as `select` can handle optgroups now
+ * Added missing tabindex checks
+ * Refactored field inheritance to make things more reliable
+ * Removed jQuery dependency for the reCaptcha field and VanillaJS-ified it instead
+ * Removed a stray `dump()` command
+ * Refactored the base `templates/forms/default` twig templates to make things more extensible
+ * Added a new `templates/forms/layouts` set of twit templates to allow for easier customization
+1. [](#bugfix)
+ * Fixed `Badly encoded JSON data` warning when uploading files [grav#2663](https://github.com/getgrav/grav/issues/2663)
+ * Fixed a number of escaping issues [#368](https://github.com/getgrav/grav-plugin-form/issues/368)
+
# v3.0.9
## 09/19/2019
@@ -14,7 +135,7 @@
* Change form save action location to `user-data://` stream [#353](https://github.com/getgrav/grav-plugin-form/issues/353)
* Updated `eu`, `fr` and `pl` language
* Make `Form::initialize()` chainable
- * Added `folder` option to `save:` action with fallback
+ * Added `folder` option to `save:` action with fallback
1. [](#bugfix)
* Fixed Submit & Redirect not working as expected [#355](https://github.com/getgrav/grav-plugin-form/issues/355)
* Fixed oversensitive refresh prevention [#354](https://github.com/getgrav/grav-plugin-form/issues/354)
diff --git a/user/plugins/form/README.md b/user/plugins/form/README.md
index fb9e682..d171e9e 100644
--- a/user/plugins/form/README.md
+++ b/user/plugins/form/README.md
@@ -26,4 +26,12 @@ The Learn site has two pages describing how to use the Form Plugin:
# Using email
-Note: when using email functionality in your forms, make sure you have configured the Email plugin correctly. In particular, make sure you configured the "Email from" and "Email to" email addresses in the Email plugin with your email address
+Note: when using email functionality in your forms, make sure you have configured the Email plugin correctly. In particular, make sure you configured the "Email from" and "Email to" email addresses in the Email plugin with your email address.
+
+# NOTES:
+
+As of version **Form version 4.0.6**, form labels are now being output with the `|raw` filter. If you wish to show HTML in your form label, ie `Root Folder `, then you need to escape that in your form definition:
+
+```yaml
+label: Root Folder <root>
+```
diff --git a/user/plugins/form/app/fields/file.js b/user/plugins/form/app/fields/file.js
index fd546f1..cd8e34c 100644
--- a/user/plugins/form/app/fields/file.js
+++ b/user/plugins/form/app/fields/file.js
@@ -1,6 +1,6 @@
import $ from 'jquery';
import Dropzone from 'dropzone';
-import EXIF from 'exif-js';
+// import EXIF from 'exif-js';
import {config, translations} from 'grav-form';
// translations
@@ -28,7 +28,7 @@ const DropzoneMediaConfig = {
previewTemplate: ''
};
-window.EXIF = EXIF;
+// window.EXIF = EXIF;
export default class FilesField {
constructor({container = '.dropzone.files-upload', options = {}} = {}) {
diff --git a/user/plugins/form/assets/form.min.js b/user/plugins/form/assets/form.min.js
index a5183f8..89ff0af 100644
--- a/user/plugins/form/assets/form.min.js
+++ b/user/plugins/form/assets/form.min.js
@@ -1,36 +1,36 @@
-!function(e){function a(a){for(var n,i,s=a[0],l=a[1],d=a[2],c=0,f=[];c':" ';return this.isValueOnly()?e+='\n \n
\n '+a+"\n ":e+='\n
\n \n \n '+a+"\n ",e+='\n \n \n
'}}]),e}(),u=function(){function e(){var a=this;s(this,e),l.on("input",'[data-grav-array-type="key"], [data-grav-array-type="value"]',function(e){return a.actionInput(e)}),l.on("click touch",'[data-grav-array-action]:not([data-grav-array-action="sort"])',function(e){return a.actionEvent(e)}),this.arrays=(0,r.default)(),(0,r.default)('[data-grav-field="array"]').each(function(e,t){return a.addArray(t)}),(0,r.default)("body").on("mutation._grav",this._onAddedNodes.bind(this))}return n(e,[{key:"addArray",value:function(e){(e=(0,r.default)(e)).find('[data-grav-array-type="container"]').each(function(e,a){(a=(0,r.default)(a)).data("array-sort")||a[0].hasAttribute("data-array-nosort")||a.data("array-sort",new o.default(a.get(0),{handle:".fa-bars",animation:150}))})}},{key:"actionInput",value:function(e){var a=(0,r.default)(e.target),t=a.data("grav-array-type");this._setTemplate(a);var n=a.data("array-template"),o="key"===t?a:a.siblings('[data-grav-array-type="key"]:first'),i="value"===t?a:a.siblings('[data-grav-array-type="value"]:first'),s=n.isValueOnly()?this.getIndexFor(a):o.val();s=s.toString().replace(/\[/g,"%5B").replace(/]/g,"%5D");var l=n.getName()+"["+s+"]";i.attr("name",i.val()?l:n.getName()),this.refreshNames(n)}},{key:"actionEvent",value:function(e){e&&e.preventDefault();var a=(0,r.default)(e.target),t=a.data("grav-array-action"),n=a.parents('[data-grav-array-type="container"]');this._setTemplate(a),this[t+"Action"](a),n[n.find("> div").length>1?"removeClass":"addClass"]("one-child")}},{key:"addAction",value:function(e){var a=e.data("array-template");e.closest('[data-grav-array-type="row"]').after(a.getNewRow())}},{key:"remAction",value:function(e){var a=e.data("array-template"),t=e.closest('[data-grav-array-type="row"]');if(!t.siblings().length){var n=(0,r.default)(a.getNewRow());t.after(n),n.find('[data-grav-array-type="value"]:last').attr("name",a.getName())}t.remove(),this.refreshNames(a)}},{key:"refreshNames",value:function(e){if(e.isValueOnly()){var a=e.container.find('> div > [data-grav-array-type="row"]'),t=a.find('[name]:not([name=""])');t.each(function(e,a){var t=(a=(0,r.default)(a)).attr("name");t=t.replace(/\[\d+\]$/,"["+e+"]"),a.attr("name",t)}),t.length||a.find('[data-grav-array-type="value"]').attr("name",e.getName())}}},{key:"getIndexFor",value:function(e){var a=e.data("array-template"),t=e.closest('[data-grav-array-type="row"]');return a.container.find((a.isValueOnly()?"> div ":"")+' > [data-grav-array-type="row"]').index(t)}},{key:"_setTemplate",value:function(e){e.data("array-template")||e.data("array-template",new d(e.closest("[data-grav-array-name]")))}},{key:"_onAddedNodes",value:function(e,a){var t=this,n=(0,r.default)(a).find('[data-grav-field="array"]');n.length&&n.each(function(e,a){a=(0,r.default)(a),~t.arrays.index(a)||t.addArray(a)})}}]),e}();a.default=u;a.Instance=new u},"./app/fields/file.js":
+/*! exports provided: default, Instance */function(e,a,t){"use strict";t.r(a),t.d(a,"default",function(){return u}),t.d(a,"Instance",function(){return p});var n=t(/*! jquery */"jquery"),c=t.n(n),r=t(/*! sortablejs */"./node_modules/sortablejs/modular/sortable.esm.js");function o(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}function i(e,a){for(var t=0;t
'):" ');return this.isValueOnly()?e+='\n \n
\n '.concat(a,"\n "):e+='\n
\n \n \n ').concat(a,"\n "),e+='\n \n \n
'}}]),a}(),u=function(){function e(){var t=this;o(this,e),l.on("input",'[data-grav-array-type="key"], [data-grav-array-type="value"]',function(e){return t.actionInput(e)}),l.on("click touch",'[data-grav-array-action]:not([data-grav-array-action="sort"])',function(e){return t.actionEvent(e)}),this.arrays=c()(),c()('[data-grav-field="array"]').each(function(e,a){return t.addArray(a)}),c()("body").on("mutation._grav",this._onAddedNodes.bind(this))}return s(e,[{key:"addArray",value:function(e){(e=c()(e)).find('[data-grav-array-type="container"]').each(function(e,a){(a=c()(a)).data("array-sort")||a[0].hasAttribute("data-array-nosort")||a.data("array-sort",new r.default(a.get(0),{handle:".fa-bars",animation:150}))})}},{key:"actionInput",value:function(e){var a=c()(e.target),t=a.data("grav-array-type");this._setTemplate(a);var n=a.data("array-template"),r="key"===t?a:a.siblings('[data-grav-array-type="key"]:first'),o="value"===t?a:a.siblings('[data-grav-array-type="value"]:first'),i=n.isValueOnly()?this.getIndexFor(a):r.val();i=i.toString().replace(/\[/g,"%5B").replace(/]/g,"%5D");var s="".concat(n.getName(),"[").concat(i,"]");o.attr("name",o.val()?s:n.getName()),this.refreshNames(n)}},{key:"actionEvent",value:function(e){e&&e.preventDefault();var a=c()(e.target),t=a.data("grav-array-action"),n=a.parents('[data-grav-array-type="container"]');this._setTemplate(a),this["".concat(t,"Action")](a);var r=n.find("> div");n[1
div > [data-grav-array-type="row"]'),t=a.find('[name]:not([name=""])');t.each(function(e,a){var t=(a=c()(a)).attr("name");t=t.replace(/\[\d+\]$/,"[".concat(e,"]")),a.attr("name",t)}),t.length||a.find('[data-grav-array-type="value"]').attr("name",e.getName())}}},{key:"getIndexFor",value:function(e){var a=e.data("array-template"),t=e.closest('[data-grav-array-type="row"]');return a.container.find("".concat(a.isValueOnly()?"> div ":"",' > [data-grav-array-type="row"]')).index(t)}},{key:"_setTemplate",value:function(e){e.data("array-template")||e.data("array-template",new d(e.closest("[data-grav-array-name]")))}},{key:"_onAddedNodes",value:function(e,a){var t=this,n=c()(a).find('[data-grav-field="array"]');n.length&&n.each(function(e,a){a=c()(a),~t.arrays.index(a)||t.addArray(a)})}}]),e}(),p=new u},"./app/fields/file.js":
/*!****************************!*\
!*** ./app/fields/file.js ***!
\****************************/
-/*! no static exports found */function(e,a,t){"use strict";(function(e){Object.defineProperty(a,"__esModule",{value:!0}),a.Instances=void 0;var n=function(){function e(e,a){for(var t=0;t0&&void 0!==arguments[0]?arguments[0]:{},t=e.container,n=void 0===t?".dropzone.files-upload":t,i=e.options,l=void 0===i?{}:i;!function(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}(this,a),this.container=(0,r.default)(n),this.container.length&&(this.urls={},u.previewTemplate=(0,r.default)("#dropzone-template").html(),this.options=Object.assign({},d,u,{klass:this,url:this.container.data("file-url-add")||s.config.current_url,acceptedFiles:this.container.data("media-types"),init:this.initDropzone},this.container.data("dropzone-options"),l),this.dropzone=new o.default(n,this.options),this.dropzone.on("complete",this.onDropzoneComplete.bind(this)),this.dropzone.on("success",this.onDropzoneSuccess.bind(this)),this.dropzone.on("removedfile",this.onDropzoneRemovedFile.bind(this)),this.dropzone.on("sending",this.onDropzoneSending.bind(this)),this.dropzone.on("error",this.onDropzoneError.bind(this)))}return n(a,[{key:"initDropzone",value:function(){var e=this,a=this.options.klass.container.find("[data-file]"),t=this;a.length&&a.each(function(a,n){var i=(n=(0,r.default)(n)).data("file"),s={name:i.name,size:i.size,type:i.type,status:o.default.ADDED,accepted:!0,url:e.options.url,removeUrl:i.remove,data:i};t.files.push(s),t.options.addedfile.call(t,s),s.type.match(/^image\//)&&t.options.thumbnail.call(t,s,i.path),n.remove()})}},{key:"getURI",value:function(){return this.container.data("mediaUri")||""}},{key:"onDropzoneSending",value:function(e,a,t){var n=this.container.closest("form"),r=n.find('[name="__unique_form_id__"]');t.append("__form-name__",n.find('[name="__form-name__"]').val()),r.length&&t.append("__unique_form_id__",r.val()),t.append("__form-file-uploader__",1),t.append("name",this.options.dotNotation),t.append("form-nonce",s.config.form_nonce),t.append("task","filesupload"),t.append("uri",this.getURI())}},{key:"onDropzoneSuccess",value:function(a,t,n){if(this.options.reloadPage&&e.location.reload(),t.session){a.sessionParams=t.session,a.removeUrl=this.options.url;var r=this.container.find('[name][type="hidden"]'),o=r.val();r.val(o+" ")}return this.handleError({file:a,data:t,mode:"removeFile",msg:""+s.translations.PLUGIN_FORM.FILE_ERROR_UPLOAD+" "+a.name+"
\n "+t.message+" "})}},{key:"onDropzoneComplete",value:function(a){if(!a.accepted&&!a.rejected){var t={status:"error",message:s.translations.PLUGIN_FORM.FILE_UNSUPPORTED+": "+a.name.match(/\..+/).join("")};return this.handleError({file:a,data:t,mode:"removeFile",msg:""+s.translations.PLUGIN_FORM.FILE_ERROR_ADD+" "+a.name+"
\n "+t.message+" "})}this.options.reloadPage&&e.location.reload()}},{key:"onDropzoneRemovedFile",value:function(a){var t=this;if(a.accepted&&!a.rejected){var n=this.container.closest("form"),o=n.find('[name="__unique_form_id__"]'),i=a.removeUrl||this.urls.delete||location.href+".json",l=(i||"").match(/path:(.*)\//),d=new FormData;d.append("filename",a.name),d.append("__form-name__",n.find('[name="__form-name__"]').val()),d.append("name",this.options.dotNotation),d.append("form-nonce",s.config.form_nonce),d.append("uri",this.getURI()),a.sessionParams&&(d.append("__form-file-remover__","1"),d.append("session",a.sessionParams)),o.length&&d.append("__unique_form_id__",o.val()),r.default.ajax({url:i,data:d,method:"POST",contentType:!1,processData:!1,success:function(){if(l){l=e.atob(l[1]);var a=t.container.find('[name][type="hidden"]'),n=JSON.parse(a.val()||"{}");delete n[l],a.val(JSON.stringify(n))}}})}}},{key:"onDropzoneError",value:function(e,a,t){var n=t&&a.error?a.error.message:a;return(0,r.default)(e.previewElement).find("[data-dz-errormessage]").html(n),this.handleError({file:e,data:{status:"error"},msg:""+n+" "})}},{key:"handleError",value:function(e){return!0}}]),a}();a.default=c;var f=[],p=(0,r.default)(),v=function(e,a){var t=(0,r.default)(a).find(".dropzone.files-upload");t.length&&t.each(function(e,a){a=(0,r.default)(a),~p.index(a)||m(a)})},m=function(e){var a=(e=(0,r.default)(e)).find('input[type="file"]'),t=e.data("grav-file-settings")||{};t.accept&&~t.accept.indexOf("*")&&(t.accept=[""]);var n={url:e.data("file-url-add")||(e.closest("form").attr("action")||s.config.current_url)+".json",paramName:t.paramName||"file",dotNotation:t.name||"file",acceptedFiles:t.accept?t.accept.join(","):a.attr("accept")||e.data("media-types"),maxFilesize:t.filesize||256,maxFiles:t.limit||null,resizeWidth:t.resizeWidth||null,resizeHeight:t.resizeHeight||null,resizeQuality:t.resizeQuality||null,accept:function(e,a){var n=t.resolution,r="";if(!n)return a();if(null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles)return a(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",e);var o=new FileReader;if(!n.min&&(t.resizeWidth||t.resizeHeight||!n.max))return a(r);o.onload=function(e){var o=new Image;o.src=e.target.result,o.onload=function(){var e=this;n.min&&Object.keys(n.min).forEach(function(a){e[a]n.max[a]&&(r+=s.translations.PLUGIN_FORM.RESOLUTION_MAX.replace(/{{attr}}/g,a).replace(/{{max}}/g,n.max[a]))}),a(r)}},o.readAsDataURL(e)}};p=p.add(e),e=e[0],f.push(new c({container:e,options:n}))};a.Instances=((0,r.default)(document).ready(function(){(0,r.default)(".dropzone.files-upload").each(function(e,a){return m(a)}),(0,r.default)("body").on("mutation._grav",v)}),f)}).call(this,t(/*! ./../../node_modules/webpack/buildin/global.js */"./node_modules/webpack/buildin/global.js"))},"./app/fields/form.js":
+/*! exports provided: default, Instances */function(e,v,h){"use strict";h.r(v),function(s){h.d(v,"default",function(){return r}),h.d(v,"Instances",function(){return m});var e=h(/*! jquery */"jquery"),c=h.n(e),a=h(/*! dropzone */"./node_modules/dropzone/dist/dropzone.js"),i=h.n(a),l=h(/*! grav-form */"grav-form");function n(e,a){for(var t=0;t".concat(l.translations.PLUGIN_FORM.FILE_ERROR_UPLOAD," ").concat(e.name," \n ").concat(a.message," ")})}},{key:"onDropzoneComplete",value:function(e){if(!e.accepted&&!e.rejected){var a={status:"error",message:"".concat(l.translations.PLUGIN_FORM.FILE_UNSUPPORTED,": ").concat(e.name.match(/\..+/).join(""))};return this.handleError({file:e,data:a,mode:"removeFile",msg:"".concat(l.translations.PLUGIN_FORM.FILE_ERROR_ADD," ").concat(e.name,"
\n ").concat(a.message," ")})}this.options.reloadPage&&s.location.reload()}},{key:"onDropzoneRemovedFile",value:function(e){var t=this;if(e.accepted&&!e.rejected){var a=this.container.closest("form"),n=a.find('[name="__unique_form_id__"]'),r=e.removeUrl||this.urls.delete||"".concat(location.href,".json"),o=(r||"").match(/path:(.*)\//),i=new FormData;i.append("filename",e.name),i.append("__form-name__",a.find('[name="__form-name__"]').val()),i.append("name",this.options.dotNotation),i.append("form-nonce",l.config.form_nonce),i.append("uri",this.getURI()),e.sessionParams&&(i.append("__form-file-remover__","1"),i.append("session",e.sessionParams)),n.length&&i.append("__unique_form_id__",n.val()),c.a.ajax({url:r,data:i,method:"POST",contentType:!1,processData:!1,success:function(){if(o){o=s.atob(o[1]);var e=t.container.find('[name][type="hidden"]'),a=JSON.parse(e.val()||"{}");delete a[o],e.val(JSON.stringify(a))}}})}}},{key:"onDropzoneError",value:function(e,a,t){var n=t&&a.error?a.error.message:a;return c()(e.previewElement).find("[data-dz-errormessage]").html(n),this.handleError({file:e,data:{status:"error"},msg:"".concat(n," ")})}},{key:"handleError",value:function(){return!0}}])&&n(e.prototype,a),t&&n(e,t),o}(),p=[],f=c()(),o=function(e){var a=(e=c()(e)).find('input[type="file"]'),o=e.data("grav-file-settings")||{};o.accept&&~o.accept.indexOf("*")&&(o.accept=[""]);var t={url:e.data("file-url-add")||(e.closest("form").attr("action")||l.config.current_url)+".json",paramName:o.paramName||"file",dotNotation:o.name||"file",acceptedFiles:o.accept?o.accept.join(","):a.attr("accept")||e.data("media-types"),maxFilesize:o.filesize||256,maxFiles:o.limit||null,resizeWidth:o.resizeWidth||null,resizeHeight:o.resizeHeight||null,resizeQuality:o.resizeQuality||null,accept:function(e,t){var n=o.resolution,r="";if(!n)return t();if(null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles)return t(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",e);var a=new FileReader;if(!n.min&&(o.resizeWidth||o.resizeHeight||!n.max))return t(r);a.onload=function(e){var a=new Image;a.src=e.target.result,a.onload=function(){var a=this;n.min&&Object.keys(n.min).forEach(function(e){a[e]n.max[e]&&(r+=l.translations.PLUGIN_FORM.RESOLUTION_MAX.replace(/{{attr}}/g,e).replace(/{{max}}/g,n.max[e]))}),t(r)}},a.readAsDataURL(e)}};f=f.add(e),e=e[0],p.push(new r({container:e,options:t}))},m=(c()(document).ready(function(){c()(".dropzone.files-upload").each(function(e,a){return o(a)}),c()("body").on("mutation._grav",t)}),p)}.call(this,h(/*! ./../../node_modules/webpack/buildin/global.js */"./node_modules/webpack/buildin/global.js"))},"./app/fields/form.js":
/*!****************************!*\
!*** ./app/fields/form.js ***!
\****************************/
-/*! no static exports found */function(e,a,t){"use strict";var n,r=t(/*! jquery */"jquery"),o=(n=r)&&n.__esModule?n:{default:n};(0,o.default)(document).ready(function(){var e=(0,o.default)("form").filter(function(e){return(0,o.default)(e).find('[name="__form-name__"]')});e.length&&e.each(function(e,a){!function(e){var a='[data-grav-field="toggleable"] input[type="checkbox"]';(e=(0,o.default)(e)).on("change",a,function(e){var a=(0,o.default)(e.target),t=a.is(":checked"),n=a.closest(".form-field"),r=n.find("label.toggleable"),i=n.find(".form-data"),s=i.find("input, select, textarea, button");r.add(i).css("opacity",t?"":.7),s.map(function(e,a){var n=a.selectize;a=(0,o.default)(a),n?n[t?"enable":"disable"]():a.prop("disabled",!t)})}),e.find(a).trigger("change")}(a),function(e){e=(0,o.default)(e);var a=[];["input","select","label[for]","textarea",".selectize-control"].forEach(function(e){a.push(".form-field-toggleable .form-data "+e)}),e.on("mousedown",a.join(", "),function(e){var a=(0,o.default)(e.target),t=a.prop("for"),n=(a.hasClass("selectize-control")||a.parents(".selectize-control")).length;if(t&&(a=(0,o.default)('[id="'+t+'"]')),n&&(a=a.closest(".selectize-control").siblings("select[name]")),!a.prop("disabled"))return!0;a.closest(".form-field").find('[data-grav-field="toggleable"] input[type="checkbox"]').trigger("click")})}(a)})})},"./app/fields/index.js":
+/*! no exports provided */function(e,a,t){"use strict";t.r(a);var n=t(/*! jquery */"jquery"),s=t.n(n);s()(document).ready(function(){var e=s()("form").filter(function(e){return s()(e).find('[name="__form-name__"]')});e.length&&e.each(function(e,a){var t,n;t=a,n='[data-grav-field="toggleable"] input[type="checkbox"]',(t=s()(t)).on("change",n,function(e){var a=s()(e.target),n=a.is(":checked"),t=a.closest(".form-field"),r=t.find("label.toggleable"),o=t.find(".form-data"),i=o.find("input, select, textarea, button");r.add(o).css("opacity",n?"":.7),i.map(function(e,a){var t=a.selectize;a=s()(a),t?t[n?"enable":"disable"]():a.prop("disabled",!n)})}),t.find(n).trigger("change"),function(e){e=s()(e);var a=[];["input","select","label[for]","textarea",".selectize-control"].forEach(function(e){a.push("".concat(".form-field-toggleable .form-data"," ").concat(e))}),e.on("mousedown",a.join(", "),function(e){var a=s()(e.target),t=a.prop("for"),n=(a.hasClass("selectize-control")||a.parents(".selectize-control")).length;if(t&&(a=s()('[id="'.concat(t,'"]'))),n&&(a=a.closest(".selectize-control").siblings("select[name]")),!a.prop("disabled"))return!0;a.closest(".form-field").find('[data-grav-field="toggleable"] input[type="checkbox"]').trigger("click")})}(a)})})},"./app/fields/index.js":
/*!*****************************!*\
!*** ./app/fields/index.js ***!
\*****************************/
-/*! no static exports found */function(e,a,t){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),t(/*! ./form */"./app/fields/form.js");var n=s(t(/*! ./file */"./app/fields/file.js")),r=s(t(/*! ./array */"./app/fields/array.js")),o=t(/*! ./media */"./app/fields/media.js"),i=s(o);function s(e){return e&&e.__esModule?e:{default:e}}t(/*! ./tabs */"./app/fields/tabs.js"),a.default={FileInstances:n.default,ArrayInstances:r.default,Media:{PageMedia:i.default,PageMediaInstances:o.Instance}}},"./app/fields/media.js":
+/*! exports provided: default */function(e,a,t){"use strict";t.r(a);t(/*! ./form */"./app/fields/form.js");var n=t(/*! ./file */"./app/fields/file.js"),r=t(/*! ./array */"./app/fields/array.js"),o=t(/*! ./media */"./app/fields/media.js");t(/*! ./tabs */"./app/fields/tabs.js");a.default={FileInstances:n.default,ArrayInstances:r.default,Media:{PageMedia:o.default,PageMediaInstances:o.Instance}}},"./app/fields/media.js":
/*!*****************************!*\
!*** ./app/fields/media.js ***!
\*****************************/
-/*! no static exports found */function(e,a,t){"use strict";(function(e){Object.defineProperty(a,"__esModule",{value:!0}),a.Instance=void 0;var n=function(){function e(e,a){for(var t=0;t\n \n
\n
\n
\n
\n
\n ✔
\n ✘
\n
\n '+s.translations.PLUGIN_FORM.DELETE+" \n ").trim(),f=function(a){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=e.container,n=void 0===a?"#grav-dropzone":a,r=e.options,i=void 0===r?{}:r;!function(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}(this,t);var d=(0,o.default)("#dropzone-media-template").html()||c;i=Object.assign(i,{previewTemplate:d});var f=u(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,{container:n,options:i}));if(!f.container.length)return u(f);f.urls={fetch:f.container.data("media-url")+"/task"+s.config.param_sep+"listmedia",add:f.container.data("media-url")+"/task"+s.config.param_sep+"addmedia",delete:f.container.data("media-url")+"/task"+s.config.param_sep+"delmedia"},f.dropzone.options.url=f.urls.add,(void 0===f.options.fetchMedia||f.options.fetchMedia)&&f.fetchMedia();var p=(0,o.default)('[name="'+f.container.data("dropzone-field")+'"]');return p.length&&(f.sortable=new l.default(f.container.get(0),{animation:150,setData:function(e,a){a=(0,o.default)(a),f.dropzone.disable(),a.addClass("hide-backface"),e.effectAllowed="copy"},onSort:function(){var e=[];f.container.find("[data-dz-name]").each(function(a,t){var n=(t=(0,o.default)(t)).text().trim();e.push(n)}),p.val(e.join(","))}})),f}return function(e,a){if("function"!=typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function, not "+typeof a);e.prototype=Object.create(a&&a.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),a&&(Object.setPrototypeOf?Object.setPrototypeOf(e,a):e.__proto__=a)}(t,i.default),n(t,[{key:"onDropzoneRemovedFile",value:function(a){var t=this;if(a.accepted&&!a.rejected){var n=this.container.closest("form"),r=n.find('[name="__unique_form_id__"]'),i=a.removeUrl||this.urls.delete||location.href+".json",l=(i||"").match(/path:(.*)\//),d=new FormData;d.append("filename",a.name),d.append("__form-name__",n.find('[name="__form-name__"]').val()),r.length&&d.append("__unique_form_id__",r.val()),d.append("name",this.options.dotNotation),d.append("form-nonce",s.config.form_nonce),a.sessionParams&&(d.append("__form-file-remover__","1"),d.append("session",a.sessionParams)),o.default.ajax({url:i,data:d,method:"POST",contentType:!1,processData:!1,success:function(){if(l){l=e.atob(l[1]);var a=t.container.find('[name][type="hidden"]'),n=JSON.parse(a.val()||"{}");delete n[l],a.val(JSON.stringify(n))}}})}}},{key:"fetchMedia",value:function(){var e=this,a={order:this.container.closest(".form-field").find('[name="data[header][media_order]"]').val()},t=this.urls.fetch;o.default.ajax({url:t,method:"POST",data:a,success:function(a){if("string"==typeof a||a instanceof String)return!1;a=a.results,Object.keys(a).forEach(function(t){var n=a[t],r={name:t,size:n.size,accepted:!0,extras:n};e.dropzone.files.push(r),e.dropzone.options.addedfile.call(e.dropzone,r),e.dropzone.options.thumbnail.call(e.dropzone,r,n.url)}),e.container.find(".dz-preview").prop("draggable","true")}})}},{key:"onDropzoneSending",value:function(e,a,t){t.append("name",this.options.dotNotation),t.append("admin-nonce",s.config.admin_nonce)}},{key:"onDropzoneComplete",value:function(e){r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"onDropzoneComplete",this).call(this,e),this.sortable.options.onSort(),(0,o.default)(".dz-preview").prop("draggable","true")}},{key:"onDropzoneRemovedFile",value:function(e){for(var a,n=arguments.length,o=Array(n>1?n-1:0),i=1;i').concat(u.translations.PLUGIN_FORM.DELETE,"\n ").trim(),a=function(){!function(e,a){if("function"!=typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(a&&a.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),a&&v(e,a)}(l,n["default"]);var e,a,t,c=i(l);function l(){var t,e=01?n-1:0),r=1;r=a.length)break;a[o++].apply(this,i)}}return this}},{key:"off",value:function(e,t){if(!this._callbacks||0===arguments.length)return this._callbacks={},this;var n=this._callbacks[e];if(!n)return this;if(1===arguments.length)return delete this._callbacks[e],this;for(var i=0;i=n.length)break;var i=n[t++];if(/(^| )dz-message($| )/.test(i.className)){e=i,i.className="dz-message";break}}e||(e=o.createElement('
'),this.element.appendChild(e));var r=e.getElementsByTagName("span")[0];return r&&(null!=r.textContent?r.textContent=this.options.dictFallbackMessage:null!=r.innerText&&(r.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize:function(e,t,n,i){var r={srcX:0,srcY:0,srcWidth:e.width,srcHeight:e.height},o=e.width/e.height;null==t&&null==n?(t=r.srcWidth,n=r.srcHeight):null==t?t=n*o:null==n&&(n=t/o);var a=(t=Math.min(t,r.srcWidth))/(n=Math.min(n,r.srcHeight));if(r.srcWidth>t||r.srcHeight>n)if("crop"===i)o>a?(r.srcHeight=e.height,r.srcWidth=r.srcHeight*a):(r.srcWidth=e.width,r.srcHeight=r.srcWidth/a);else{if("contain"!==i)throw new Error("Unknown resizeMethod '"+i+"'");o>a?n=t/o:t=n*o}return r.srcX=(e.width-r.srcWidth)/2,r.srcY=(e.height-r.srcHeight)/2,r.trgWidth=t,r.trgHeight=n,r},transformFile:function(e,t){return(this.options.resizeWidth||this.options.resizeHeight)&&e.type.match(/image.*/)?this.resizeImage(e,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,t):t(e)},previewTemplate:'\n
\n
\n
\n
\n
\n
\n Check \n \n \n \n \n \n
\n
\n
\n Error \n \n \n \n \n \n \n \n
\n
',drop:function(e){return this.element.classList.remove("dz-drag-hover")},dragstart:function(e){},dragend:function(e){return this.element.classList.remove("dz-drag-hover")},dragenter:function(e){return this.element.classList.add("dz-drag-hover")},dragover:function(e){return this.element.classList.add("dz-drag-hover")},dragleave:function(e){return this.element.classList.remove("dz-drag-hover")},paste:function(e){},reset:function(){return this.element.classList.remove("dz-started")},addedfile:function(e){var t=this;if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer){e.previewElement=o.createElement(this.options.previewTemplate.trim()),e.previewTemplate=e.previewElement,this.previewsContainer.appendChild(e.previewElement);for(var n=0,i=i=e.previewElement.querySelectorAll("[data-dz-name]");;){if(n>=i.length)break;var r=i[n++];r.textContent=e.name}for(var a=0,s=s=e.previewElement.querySelectorAll("[data-dz-size]");!(a>=s.length);)(r=s[a++]).innerHTML=this.filesize(e.size);this.options.addRemoveLinks&&(e._removeLink=o.createElement(''+this.options.dictRemoveFile+" "),e.previewElement.appendChild(e._removeLink));for(var l=function(n){return n.preventDefault(),n.stopPropagation(),e.status===o.UPLOADING?o.confirm(t.options.dictCancelUploadConfirmation,function(){return t.removeFile(e)}):t.options.dictRemoveFileConfirmation?o.confirm(t.options.dictRemoveFileConfirmation,function(){return t.removeFile(e)}):t.removeFile(e)},u=0,d=d=e.previewElement.querySelectorAll("[data-dz-remove]");;){if(u>=d.length)break;d[u++].addEventListener("click",l)}}},removedfile:function(e){return null!=e.previewElement&&null!=e.previewElement.parentNode&&e.previewElement.parentNode.removeChild(e.previewElement),this._updateMaxFilesReachedClass()},thumbnail:function(e,t){if(e.previewElement){e.previewElement.classList.remove("dz-file-preview");for(var n=0,i=i=e.previewElement.querySelectorAll("[data-dz-thumbnail]");;){if(n>=i.length)break;var r=i[n++];r.alt=e.name,r.src=t}return setTimeout(function(){return e.previewElement.classList.add("dz-image-preview")},1)}},error:function(e,t){if(e.previewElement){e.previewElement.classList.add("dz-error"),"String"!=typeof t&&t.error&&(t=t.error);for(var n=0,i=i=e.previewElement.querySelectorAll("[data-dz-errormessage]");;){if(n>=i.length)break;i[n++].textContent=t}}},errormultiple:function(){},processing:function(e){if(e.previewElement&&(e.previewElement.classList.add("dz-processing"),e._removeLink))return e._removeLink.innerHTML=this.options.dictCancelUpload},processingmultiple:function(){},uploadprogress:function(e,t,n){if(e.previewElement)for(var i=0,r=r=e.previewElement.querySelectorAll("[data-dz-uploadprogress]");;){if(i>=r.length)break;var o=r[i++];"PROGRESS"===o.nodeName?o.value=t:o.style.width=t+"%"}},totaluploadprogress:function(){},sending:function(){},sendingmultiple:function(){},success:function(e){if(e.previewElement)return e.previewElement.classList.add("dz-success")},successmultiple:function(){},canceled:function(e){return this.emit("error",e,this.options.dictUploadCanceled)},canceledmultiple:function(){},complete:function(e){if(e._removeLink&&(e._removeLink.innerHTML=this.options.dictRemoveFile),e.previewElement)return e.previewElement.classList.add("dz-complete")},completemultiple:function(){},maxfilesexceeded:function(){},maxfilesreached:function(){},queuecomplete:function(){},addedfiles:function(){}},this.prototype._thumbnailQueue=[],this.prototype._processingThumbnail=!1}},{key:"extend",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i=o.length)break;var a=o[r++];for(var s in a){var l=a[s];e[s]=l}}return e}}]),t(o,[{key:"getAcceptedFiles",value:function(){return this.files.filter(function(e){return e.accepted}).map(function(e){return e})}},{key:"getRejectedFiles",value:function(){return this.files.filter(function(e){return!e.accepted}).map(function(e){return e})}},{key:"getFilesWithStatus",value:function(e){return this.files.filter(function(t){return t.status===e}).map(function(e){return e})}},{key:"getQueuedFiles",value:function(){return this.getFilesWithStatus(o.QUEUED)}},{key:"getUploadingFiles",value:function(){return this.getFilesWithStatus(o.UPLOADING)}},{key:"getAddedFiles",value:function(){return this.getFilesWithStatus(o.ADDED)}},{key:"getActiveFiles",value:function(){return this.files.filter(function(e){return e.status===o.UPLOADING||e.status===o.QUEUED}).map(function(e){return e})}},{key:"init",value:function(){var e=this;if("form"===this.element.tagName&&this.element.setAttribute("enctype","multipart/form-data"),this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")&&this.element.appendChild(o.createElement(''+this.options.dictDefaultMessage+"
")),this.clickableElements.length){!function t(){return e.hiddenFileInput&&e.hiddenFileInput.parentNode.removeChild(e.hiddenFileInput),e.hiddenFileInput=document.createElement("input"),e.hiddenFileInput.setAttribute("type","file"),(null===e.options.maxFiles||e.options.maxFiles>1)&&e.hiddenFileInput.setAttribute("multiple","multiple"),e.hiddenFileInput.className="dz-hidden-input",null!==e.options.acceptedFiles&&e.hiddenFileInput.setAttribute("accept",e.options.acceptedFiles),null!==e.options.capture&&e.hiddenFileInput.setAttribute("capture",e.options.capture),e.hiddenFileInput.style.visibility="hidden",e.hiddenFileInput.style.position="absolute",e.hiddenFileInput.style.top="0",e.hiddenFileInput.style.left="0",e.hiddenFileInput.style.height="0",e.hiddenFileInput.style.width="0",o.getElement(e.options.hiddenInputContainer,"hiddenInputContainer").appendChild(e.hiddenFileInput),e.hiddenFileInput.addEventListener("change",function(){var n=e.hiddenFileInput.files;if(n.length)for(var i=0,r=r=n;!(i>=r.length);){var o=r[i++];e.addFile(o)}return e.emit("addedfiles",n),t()})}()}this.URL=null!==window.URL?window.URL:window.webkitURL;for(var t=0,n=n=this.events;;){if(t>=n.length)break;var i=n[t++];this.on(i,this.options[i])}this.on("uploadprogress",function(){return e.updateTotalUploadProgress()}),this.on("removedfile",function(){return e.updateTotalUploadProgress()}),this.on("canceled",function(t){return e.emit("complete",t)}),this.on("complete",function(t){if(0===e.getAddedFiles().length&&0===e.getUploadingFiles().length&&0===e.getQueuedFiles().length)return setTimeout(function(){return e.emit("queuecomplete")},0)});var r=function(e){return e.stopPropagation(),e.preventDefault?e.preventDefault():e.returnValue=!1};return this.listeners=[{element:this.element,events:{dragstart:function(t){return e.emit("dragstart",t)},dragenter:function(t){return r(t),e.emit("dragenter",t)},dragover:function(t){var n=void 0;try{n=t.dataTransfer.effectAllowed}catch(e){}return t.dataTransfer.dropEffect="move"===n||"linkMove"===n?"move":"copy",r(t),e.emit("dragover",t)},dragleave:function(t){return e.emit("dragleave",t)},drop:function(t){return r(t),e.drop(t)},dragend:function(t){return e.emit("dragend",t)}}}],this.clickableElements.forEach(function(t){return e.listeners.push({element:t,events:{click:function(n){return(t!==e.element||n.target===e.element||o.elementInside(n.target,e.element.querySelector(".dz-message")))&&e.hiddenFileInput.click(),!0}}})}),this.enable(),this.options.init.call(this)}},{key:"destroy",value:function(){return this.disable(),this.removeAllFiles(!0),(null!=this.hiddenFileInput?this.hiddenFileInput.parentNode:void 0)&&(this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=null),delete this.element.dropzone,o.instances.splice(o.instances.indexOf(this),1)}},{key:"updateTotalUploadProgress",value:function(){var e=void 0,t=0,n=0;if(this.getActiveFiles().length){for(var i=0,r=r=this.getActiveFiles();;){if(i>=r.length)break;var o=r[i++];t+=o.upload.bytesSent,n+=o.upload.total}e=100*t/n}else e=100;return this.emit("totaluploadprogress",e,n,t)}},{key:"_getParamName",value:function(e){return"function"==typeof this.options.paramName?this.options.paramName(e):this.options.paramName+(this.options.uploadMultiple?"["+e+"]":"")}},{key:"_renameFile",value:function(e){return"function"!=typeof this.options.renameFile?e.name:this.options.renameFile(e)}},{key:"getFallbackForm",value:function(){var e,t=void 0;if(e=this.getExistingFallback())return e;var n='';var i=o.createElement(n);return"FORM"!==this.element.tagName?(t=o.createElement('')).appendChild(i):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),null!=t?t:i}},{key:"getExistingFallback",value:function(){for(var e=function(e){for(var t=0,n=n=e;;){if(t>=n.length)break;var i=n[t++];if(/(^| )fallback($| )/.test(i.className))return i}},t=["div","form"],n=0;n0){for(var i=["tb","gb","mb","kb","b"],r=0;r=Math.pow(this.options.filesizeBase,4-r)/10){t=e/Math.pow(this.options.filesizeBase,4-r),n=o;break}}t=Math.round(10*t)/10}return""+t+" "+this.options.dictFileSizeUnits[n]}},{key:"_updateMaxFilesReachedClass",value:function(){return null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")}},{key:"drop",value:function(e){if(e.dataTransfer){this.emit("drop",e);for(var t=[],n=0;n=n.length)break;var i=n[t++];this.addFile(i)}}},{key:"_addFilesFromItems",value:function(e){var t=this;return function(){for(var n=[],i=0,r=r=e;;){if(i>=r.length)break;var o,a=r[i++];null!=a.webkitGetAsEntry&&(o=a.webkitGetAsEntry())?o.isFile?n.push(t.addFile(a.getAsFile())):o.isDirectory?n.push(t._addFilesFromDirectory(o,o.name)):n.push(void 0):null!=a.getAsFile&&(null==a.kind||"file"===a.kind)?n.push(t.addFile(a.getAsFile())):n.push(void 0)}return n}()}},{key:"_addFilesFromDirectory",value:function(e,t){var n=this,i=e.createReader(),r=function(e){return t=console,n="log",i=function(t){return t.log(e)},void 0!==t&&null!==t&&"function"==typeof t[n]?i(t,n):void 0;var t,n,i};return function e(){return i.readEntries(function(i){if(i.length>0){for(var r=0,o=o=i;!(r>=o.length);){var a=o[r++];a.isFile?a.file(function(e){if(!n.options.ignoreHiddenFiles||"."!==e.name.substring(0,1))return e.fullPath=t+"/"+e.name,n.addFile(e)}):a.isDirectory&&n._addFilesFromDirectory(a,t+"/"+a.name)}e()}return null},r)}()}},{key:"accept",value:function(e,t){return this.options.maxFilesize&&e.size>1024*this.options.maxFilesize*1024?t(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(e.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):o.isValidFile(e,this.options.acceptedFiles)?null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(t(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",e)):this.options.accept.call(this,e,t):t(this.options.dictInvalidFileType)}},{key:"addFile",value:function(e){var t=this;return e.upload={uuid:o.uuidv4(),progress:0,total:e.size,bytesSent:0,filename:this._renameFile(e),chunked:this.options.chunking&&(this.options.forceChunking||e.size>this.options.chunkSize),totalChunkCount:Math.ceil(e.size/this.options.chunkSize)},this.files.push(e),e.status=o.ADDED,this.emit("addedfile",e),this._enqueueThumbnail(e),this.accept(e,function(n){return n?(e.accepted=!1,t._errorProcessing([e],n)):(e.accepted=!0,t.options.autoQueue&&t.enqueueFile(e)),t._updateMaxFilesReachedClass()})}},{key:"enqueueFiles",value:function(e){for(var t=0,n=n=e;;){if(t>=n.length)break;var i=n[t++];this.enqueueFile(i)}return null}},{key:"enqueueFile",value:function(e){var t=this;if(e.status!==o.ADDED||!0!==e.accepted)throw new Error("This file can't be queued because it has already been processed or was rejected.");if(e.status=o.QUEUED,this.options.autoProcessQueue)return setTimeout(function(){return t.processQueue()},0)}},{key:"_enqueueThumbnail",value:function(e){var t=this;if(this.options.createImageThumbnails&&e.type.match(/image.*/)&&e.size<=1024*this.options.maxThumbnailFilesize*1024)return this._thumbnailQueue.push(e),setTimeout(function(){return t._processThumbnailQueue()},0)}},{key:"_processThumbnailQueue",value:function(){var e=this;if(!this._processingThumbnail&&0!==this._thumbnailQueue.length){this._processingThumbnail=!0;var t=this._thumbnailQueue.shift();return this.createThumbnail(t,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,!0,function(n){return e.emit("thumbnail",t,n),e._processingThumbnail=!1,e._processThumbnailQueue()})}}},{key:"removeFile",value:function(e){if(e.status===o.UPLOADING&&this.cancelUpload(e),this.files=a(this.files,e),this.emit("removedfile",e),0===this.files.length)return this.emit("reset")}},{key:"removeAllFiles",value:function(e){null==e&&(e=!1);for(var t=0,n=n=this.files.slice();;){if(t>=n.length)break;var i=n[t++];(i.status!==o.UPLOADING||e)&&this.removeFile(i)}return null}},{key:"resizeImage",value:function(e,t,n,i,r){var a=this;return this.createThumbnail(e,t,n,i,!0,function(t,n){if(null==n)return r(e);var i=a.options.resizeMimeType;null==i&&(i=e.type);var s=n.toDataURL(i,a.options.resizeQuality);return"image/jpeg"!==i&&"image/jpg"!==i||(s=u.restore(e.dataURL,s)),r(o.dataURItoBlob(s))})}},{key:"createThumbnail",value:function(e,t,n,i,r,o){var a=this,s=new FileReader;return s.onload=function(){if(e.dataURL=s.result,"image/svg+xml"!==e.type)return a.createThumbnailFromUrl(e,t,n,i,r,o);null!=o&&o(s.result)},s.readAsDataURL(e)}},{key:"createThumbnailFromUrl",value:function(e,t,n,i,r,o,a){var s=this,u=document.createElement("img");return a&&(u.crossOrigin=a),u.onload=function(){var a=function(e){return e(1)};return"undefined"!=typeof EXIF&&null!==EXIF&&r&&(a=function(e){return EXIF.getData(u,function(){return e(EXIF.getTag(this,"Orientation"))})}),a(function(r){e.width=u.width,e.height=u.height;var a=s.options.resize.call(s,e,t,n,i),d=document.createElement("canvas"),c=d.getContext("2d");switch(d.width=a.trgWidth,d.height=a.trgHeight,r>4&&(d.width=a.trgHeight,d.height=a.trgWidth),r){case 2:c.translate(d.width,0),c.scale(-1,1);break;case 3:c.translate(d.width,d.height),c.rotate(Math.PI);break;case 4:c.translate(0,d.height),c.scale(1,-1);break;case 5:c.rotate(.5*Math.PI),c.scale(1,-1);break;case 6:c.rotate(.5*Math.PI),c.translate(0,-d.width);break;case 7:c.rotate(.5*Math.PI),c.translate(d.height,-d.width),c.scale(-1,1);break;case 8:c.rotate(-.5*Math.PI),c.translate(-d.height,0)}l(c,u,null!=a.srcX?a.srcX:0,null!=a.srcY?a.srcY:0,a.srcWidth,a.srcHeight,null!=a.trgX?a.trgX:0,null!=a.trgY?a.trgY:0,a.trgWidth,a.trgHeight);var h=d.toDataURL("image/png");if(null!=o)return o(h,d)})},null!=o&&(u.onerror=o),u.src=e.dataURL}},{key:"processQueue",value:function(){var e=this.options.parallelUploads,t=this.getUploadingFiles().length,n=t;if(!(t>=e)){var i=this.getQueuedFiles();if(i.length>0){if(this.options.uploadMultiple)return this.processFiles(i.slice(0,e-t));for(;n=n.length)break;var i=n[t++];i.processing=!0,i.status=o.UPLOADING,this.emit("processing",i)}return this.options.uploadMultiple&&this.emit("processingmultiple",e),this.uploadFiles(e)}},{key:"_getFilesWithXhr",value:function(e){return this.files.filter(function(t){return t.xhr===e}).map(function(e){return e})}},{key:"cancelUpload",value:function(e){if(e.status===o.UPLOADING){for(var t=this._getFilesWithXhr(e.xhr),n=0,i=i=t;;){if(n>=i.length)break;i[n++].status=o.CANCELED}void 0!==e.xhr&&e.xhr.abort();for(var r=0,a=a=t;;){if(r>=a.length)break;var s=a[r++];this.emit("canceled",s)}this.options.uploadMultiple&&this.emit("canceledmultiple",t)}else e.status!==o.ADDED&&e.status!==o.QUEUED||(e.status=o.CANCELED,this.emit("canceled",e),this.options.uploadMultiple&&this.emit("canceledmultiple",[e]));if(this.options.autoProcessQueue)return this.processQueue()}},{key:"resolveOption",value:function(e){if("function"==typeof e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i=i.upload.totalChunkCount)){0;var a=n*t.options.chunkSize,s=Math.min(a+t.options.chunkSize,i.size),l={name:t._getParamName(0),data:r.webkitSlice?r.webkitSlice(a,s):r.slice(a,s),filename:i.upload.filename,chunkIndex:n};i.upload.chunks[n]={file:i,index:n,dataBlock:l,status:o.UPLOADING,progress:0,retries:0},t._uploadData(e,[l])}};if(i.upload.finishedChunkUpload=function(n){var r=!0;n.status=o.SUCCESS,n.dataBlock=null,n.xhr=null;for(var s=0;s=a.length)break;a[r++].xhr=i}e[0].upload.chunked&&(e[0].upload.chunks[t[0].chunkIndex].xhr=i);var s=this.resolveOption(this.options.method,e),l=this.resolveOption(this.options.url,e);i.open(s,l,!0),i.timeout=this.resolveOption(this.options.timeout,e),i.withCredentials=!!this.options.withCredentials,i.onload=function(t){n._finishedUploading(e,i,t)},i.onerror=function(){n._handleUploadError(e,i)},(null!=i.upload?i.upload:i).onprogress=function(t){return n._updateFilesUploadProgress(e,i,t)};var u={Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"};for(var d in this.options.headers&&o.extend(u,this.options.headers),u){var c=u[d];c&&i.setRequestHeader(d,c)}var h=new FormData;if(this.options.params){var p=this.options.params;for(var f in"function"==typeof p&&(p=p.call(this,e,i,e[0].upload.chunked?this._getChunk(e[0],i):null)),p){var m=p[f];h.append(f,m)}}for(var g=0,v=v=e;;){if(g>=v.length)break;var b=v[g++];this.emit("sending",b,i,h)}this.options.uploadMultiple&&this.emit("sendingmultiple",e,i,h),this._addFormElementData(h);for(var y=0;y=n.length)break;var i=n[t++],r=i.getAttribute("name"),o=i.getAttribute("type");if(o&&(o=o.toLowerCase()),void 0!==r&&null!==r)if("SELECT"===i.tagName&&i.hasAttribute("multiple"))for(var a=0,s=s=i.options;;){if(a>=s.length)break;var l=s[a++];l.selected&&e.append(r,l.value)}else(!o||"checkbox"!==o&&"radio"!==o||i.checked)&&e.append(r,i.value)}}},{key:"_updateFilesUploadProgress",value:function(e,t,n){var i=void 0;if(void 0!==n){if(i=100*n.loaded/n.total,e[0].upload.chunked){var r=e[0],o=this._getChunk(r,t);o.progress=i,o.total=n.total,o.bytesSent=n.loaded;r.upload.progress=0,r.upload.total=0,r.upload.bytesSent=0;for(var a=0;a=l.length)break;var u=l[s++];u.upload.progress=i,u.upload.total=n.total,u.upload.bytesSent=n.loaded}for(var d=0,c=c=e;;){if(d>=c.length)break;var h=c[d++];this.emit("uploadprogress",h,h.upload.progress,h.upload.bytesSent)}}else{var p=!0;i=100;for(var f=0,m=m=e;;){if(f>=m.length)break;var g=m[f++];100===g.upload.progress&&g.upload.bytesSent===g.upload.total||(p=!1),g.upload.progress=i,g.upload.bytesSent=g.upload.total}if(p)return;for(var v=0,b=b=e;;){if(v>=b.length)break;var y=b[v++];this.emit("uploadprogress",y,i,y.upload.bytesSent)}}}},{key:"_finishedUploading",value:function(e,t,n){var i=void 0;if(e[0].status!==o.CANCELED&&4===t.readyState){if("arraybuffer"!==t.responseType&&"blob"!==t.responseType&&(i=t.responseText,t.getResponseHeader("content-type")&&~t.getResponseHeader("content-type").indexOf("application/json")))try{i=JSON.parse(i)}catch(e){n=e,i="Invalid JSON response from server."}this._updateFilesUploadProgress(e),200<=t.status&&t.status<300?e[0].upload.chunked?e[0].upload.finishedChunkUpload(this._getChunk(e[0],t)):this._finished(e,i,n):this._handleUploadError(e,t,i)}}},{key:"_handleUploadError",value:function(e,t,n){if(e[0].status!==o.CANCELED){if(e[0].upload.chunked&&this.options.retryChunks){var i=this._getChunk(e[0],t);if(i.retries++=a.length)break;a[r++];this._errorProcessing(e,n||this.options.dictResponseError.replace("{{statusCode}}",t.status),t)}}}},{key:"submitRequest",value:function(e,t,n){e.send(t)}},{key:"_finished",value:function(e,t,n){for(var i=0,r=r=e;;){if(i>=r.length)break;var a=r[i++];a.status=o.SUCCESS,this.emit("success",a,t,n),this.emit("complete",a)}if(this.options.uploadMultiple&&(this.emit("successmultiple",e,t,n),this.emit("completemultiple",e)),this.options.autoProcessQueue)return this.processQueue()}},{key:"_errorProcessing",value:function(e,t,n){for(var i=0,r=r=e;;){if(i>=r.length)break;var a=r[i++];a.status=o.ERROR,this.emit("error",a,t,n),this.emit("complete",a)}if(this.options.uploadMultiple&&(this.emit("errormultiple",e,t,n),this.emit("completemultiple",e)),this.options.autoProcessQueue)return this.processQueue()}}],[{key:"uuidv4",value:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}}]),o}();o.initClass(),o.version="5.5.1",o.options={},o.optionsForElement=function(e){return e.getAttribute("id")?o.options[s(e.getAttribute("id"))]:void 0},o.instances=[],o.forElement=function(e){if("string"==typeof e&&(e=document.querySelector(e)),null==(null!=e?e.dropzone:void 0))throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");return e.dropzone},o.autoDiscover=!0,o.discover=function(){var e=void 0;if(document.querySelectorAll)e=document.querySelectorAll(".dropzone");else{e=[];var t=function(t){return function(){for(var n=[],i=0,r=r=t;;){if(i>=r.length)break;var o=r[i++];/(^| )dropzone($| )/.test(o.className)?n.push(e.push(o)):n.push(void 0)}return n}()};t(document.getElementsByTagName("div")),t(document.getElementsByTagName("form"))}return function(){for(var t=[],n=0,i=i=e;;){if(n>=i.length)break;var r=i[n++];!1!==o.optionsForElement(r)?t.push(new o(r)):t.push(void 0)}return t}()},o.blacklistedBrowsers=[/opera.*(Macintosh|Windows Phone).*version\/12/i],o.isBrowserSupported=function(){var e=!0;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if("classList"in document.createElement("a"))for(var t=0,n=n=o.blacklistedBrowsers;;){if(t>=n.length)break;n[t++].test(navigator.userAgent)&&(e=!1)}else e=!1;else e=!1;return e},o.dataURItoBlob=function(e){for(var t=atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],i=new ArrayBuffer(t.length),r=new Uint8Array(i),o=0,a=t.length,s=0<=a;s?o<=a:o>=a;s?o++:o--)r[o]=t.charCodeAt(o);return new Blob([i],{type:n})};var a=function(e,t){return e.filter(function(e){return e!==t}).map(function(e){return e})},s=function(e){return e.replace(/[\-_](\w)/g,function(e){return e.charAt(1).toUpperCase()})};o.createElement=function(e){var t=document.createElement("div");return t.innerHTML=e,t.childNodes[0]},o.elementInside=function(e,t){if(e===t)return!0;for(;e=e.parentNode;)if(e===t)return!0;return!1},o.getElement=function(e,t){var n=void 0;if("string"==typeof e?n=document.querySelector(e):null!=e.nodeType&&(n=e),null==n)throw new Error("Invalid `"+t+"` option provided. Please provide a CSS selector or a plain HTML element.");return n},o.getElements=function(e,t){var n=void 0,i=void 0;if(e instanceof Array){i=[];try{for(var r=0,o=o=e;!(r>=o.length);)n=o[r++],i.push(this.getElement(n,t))}catch(e){i=null}}else if("string"==typeof e){i=[];for(var a=0,s=s=document.querySelectorAll(e);!(a>=s.length);)n=s[a++],i.push(n)}else null!=e.nodeType&&(i=[e]);if(null==i||!i.length)throw new Error("Invalid `"+t+"` option provided. Please provide a CSS selector, a plain HTML element or a list of those.");return i},o.confirm=function(e,t,n){return window.confirm(e)?t():null!=n?n():void 0},o.isValidFile=function(e,t){if(!t)return!0;t=t.split(",");for(var n=e.type,i=n.replace(/\/.*$/,""),r=0,o=o=t;;){if(r>=o.length)break;var a=o[r++];if("."===(a=a.trim()).charAt(0)){if(-1!==e.name.toLowerCase().indexOf(a.toLowerCase(),e.name.length-a.length))return!0}else if(/\/\*$/.test(a)){if(i===a.replace(/\/.*$/,""))return!0}else if(n===a)return!0}return!1},"undefined"!=typeof jQuery&&null!==jQuery&&(jQuery.fn.dropzone=function(e){return this.each(function(){return new o(this,e)})}),void 0!==e&&null!==e?e.exports=o:window.Dropzone=o,o.ADDED="added",o.QUEUED="queued",o.ACCEPTED=o.QUEUED,o.UPLOADING="uploading",o.PROCESSING=o.UPLOADING,o.CANCELED="canceled",o.ERROR="error",o.SUCCESS="success";var l=function(e,t,n,i,r,o,a,s,l,u){var d=function(e){e.naturalWidth;var t=e.naturalHeight,n=document.createElement("canvas");n.width=1,n.height=t;var i=n.getContext("2d");i.drawImage(e,0,0);for(var r=i.getImageData(1,0,1,t).data,o=0,a=t,s=t;s>o;)0===r[4*(s-1)+3]?a=s:o=s,s=a+o>>1;var l=s/t;return 0===l?1:l}(t);return e.drawImage(t,n,i,r,o,a,s,l,u/d)},u=function(){function e(){i(this,e)}return t(e,null,[{key:"initClass",value:function(){this.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}},{key:"encode64",value:function(e){for(var t="",n=void 0,i=void 0,r="",o=void 0,a=void 0,s=void 0,l="",u=0;o=(n=e[u++])>>2,a=(3&n)<<4|(i=e[u++])>>4,s=(15&i)<<2|(r=e[u++])>>6,l=63&r,isNaN(i)?s=l=64:isNaN(r)&&(l=64),t=t+this.KEY_STR.charAt(o)+this.KEY_STR.charAt(a)+this.KEY_STR.charAt(s)+this.KEY_STR.charAt(l),n=i=r="",o=a=s=l="",ue.length)break}return n}},{key:"decode64",value:function(e){var t=void 0,n=void 0,i="",r=void 0,o=void 0,a="",s=0,l=[];for(/[^A-Za-z0-9\+\/\=]/g.exec(e),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");t=this.KEY_STR.indexOf(e.charAt(s++))<<2|(r=this.KEY_STR.indexOf(e.charAt(s++)))>>4,n=(15&r)<<4|(o=this.KEY_STR.indexOf(e.charAt(s++)))>>2,i=(3&o)<<6|(a=this.KEY_STR.indexOf(e.charAt(s++))),l.push(t),64!==o&&l.push(n),64!==a&&l.push(i),t=n=i="",r=o=a="",s")+8,u=(s=s.substring(s.indexOf("4?p:t+8,a=[],l=0;l4?p:t+8,h-1);case 3:if(1==h)return e.getUint16(t+8,!r);for(o=h>2?p:t+8,a=[],l=0;le.byteLength)return{};var o=m(e,t,t+r,l,i);if(o.Compression)switch(o.Compression){case 6:if(o.JpegIFOffset&&o.JpegIFByteCount){var a=t+o.JpegIFOffset,s=o.JpegIFByteCount;o.blob=new Blob([new Uint8Array(e.buffer,a,s)],{type:"image/jpeg"})}}else o.PhotometricInterpretation;return o}(e,h,p,n),i}function y(e){var t={};if(1==e.nodeType){if(e.attributes.length>0){t["@attributes"]={};for(var n=0;n0)for(var n=0;n '),this.element.appendChild(e));var l=e.getElementsByTagName("span")[0];return l&&(null!=l.textContent?l.textContent=this.options.dictFallbackMessage:null!=l.innerText&&(l.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize:function(e,t,n,i){var o={srcX:0,srcY:0,srcWidth:e.width,srcHeight:e.height},r=e.width/e.height;null==t&&null==n?(t=o.srcWidth,n=o.srcHeight):null==t?t=n*r:null==n&&(n=t/r);var a=(t=Math.min(t,o.srcWidth))/(n=Math.min(n,o.srcHeight));if(o.srcWidth>t||o.srcHeight>n)if("crop"===i)a\n \n \n
\n
\n \n
\n Check \n \n \n \n \n
\n \n
\n Error \n \n \n \n \n \n \n
\n',drop:function(){return this.element.classList.remove("dz-drag-hover")},dragstart:function(){},dragend:function(){return this.element.classList.remove("dz-drag-hover")},dragenter:function(){return this.element.classList.add("dz-drag-hover")},dragover:function(){return this.element.classList.add("dz-drag-hover")},dragleave:function(){return this.element.classList.remove("dz-drag-hover")},paste:function(){},reset:function(){return this.element.classList.remove("dz-started")},addedfile:function(t){var n=this;if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer){t.previewElement=D.createElement(this.options.previewTemplate.trim()),t.previewTemplate=t.previewElement,this.previewsContainer.appendChild(t.previewElement);var e=!0,i=!1,o=void 0;try{for(var r,a=t.previewElement.querySelectorAll("[data-dz-name]")[Symbol.iterator]();!(e=(r=a.next()).done);e=!0){var l=r.value;l.textContent=t.name}}catch(e){i=!0,o=e}finally{try{e||null==a.return||a.return()}finally{if(i)throw o}}var s=!0,u=!1,c=void 0;try{for(var d,h=t.previewElement.querySelectorAll("[data-dz-size]")[Symbol.iterator]();!(s=(d=h.next()).done);s=!0)(l=d.value).innerHTML=this.filesize(t.size)}catch(e){u=!0,c=e}finally{try{s||null==h.return||h.return()}finally{if(u)throw c}}this.options.addRemoveLinks&&(t._removeLink=D.createElement(''.concat(this.options.dictRemoveFile," ")),t.previewElement.appendChild(t._removeLink));var p=function(e){return e.preventDefault(),e.stopPropagation(),t.status===D.UPLOADING?D.confirm(n.options.dictCancelUploadConfirmation,function(){return n.removeFile(t)}):n.options.dictRemoveFileConfirmation?D.confirm(n.options.dictRemoveFileConfirmation,function(){return n.removeFile(t)}):n.removeFile(t)},f=!0,v=!1,m=void 0;try{for(var g,y=t.previewElement.querySelectorAll("[data-dz-remove]")[Symbol.iterator]();!(f=(g=y.next()).done);f=!0){g.value.addEventListener("click",p)}}catch(e){v=!0,m=e}finally{try{f||null==y.return||y.return()}finally{if(v)throw m}}}},removedfile:function(e){return null!=e.previewElement&&null!=e.previewElement.parentNode&&e.previewElement.parentNode.removeChild(e.previewElement),this._updateMaxFilesReachedClass()},thumbnail:function(e,t){if(e.previewElement){e.previewElement.classList.remove("dz-file-preview");var n=!0,i=!1,o=void 0;try{for(var r,a=e.previewElement.querySelectorAll("[data-dz-thumbnail]")[Symbol.iterator]();!(n=(r=a.next()).done);n=!0){var l=r.value;l.alt=e.name,l.src=t}}catch(e){i=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(i)throw o}}return setTimeout(function(){return e.previewElement.classList.add("dz-image-preview")},1)}},error:function(e,t){if(e.previewElement){e.previewElement.classList.add("dz-error"),"String"!=typeof t&&t.error&&(t=t.error);var n=!0,i=!1,o=void 0;try{for(var r,a=e.previewElement.querySelectorAll("[data-dz-errormessage]")[Symbol.iterator]();!(n=(r=a.next()).done);n=!0){r.value.textContent=t}}catch(e){i=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(i)throw o}}}},errormultiple:function(){},processing:function(e){if(e.previewElement&&(e.previewElement.classList.add("dz-processing"),e._removeLink))return e._removeLink.innerHTML=this.options.dictCancelUpload},processingmultiple:function(){},uploadprogress:function(e,t){if(e.previewElement){var n=!0,i=!1,o=void 0;try{for(var r,a=e.previewElement.querySelectorAll("[data-dz-uploadprogress]")[Symbol.iterator]();!(n=(r=a.next()).done);n=!0){var l=r.value;"PROGRESS"===l.nodeName?l.value=t:l.style.width="".concat(t,"%")}}catch(e){i=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(i)throw o}}}},totaluploadprogress:function(){},sending:function(){},sendingmultiple:function(){},success:function(e){if(e.previewElement)return e.previewElement.classList.add("dz-success")},successmultiple:function(){},canceled:function(e){return this.emit("error",e,this.options.dictUploadCanceled)},canceledmultiple:function(){},complete:function(e){if(e._removeLink&&(e._removeLink.innerHTML=this.options.dictRemoveFile),e.previewElement)return e.previewElement.classList.add("dz-complete")},completemultiple:function(){},maxfilesexceeded:function(){},maxfilesreached:function(){},queuecomplete:function(){},addedfiles:function(){}},this.prototype._thumbnailQueue=[],this.prototype._processingThumbnail=!1}},{key:"extend",value:function(e){for(var t=arguments.length,n=new Array(1'.concat(this.options.dictDefaultMessage," "))),this.clickableElements.length){!function l(){return s.hiddenFileInput&&s.hiddenFileInput.parentNode.removeChild(s.hiddenFileInput),s.hiddenFileInput=document.createElement("input"),s.hiddenFileInput.setAttribute("type","file"),(null===s.options.maxFiles||1".concat(this.options.dictFallbackText,"")),n+=' ');var i=D.createElement(n);return"FORM"!==this.element.tagName?(t=D.createElement(''))).appendChild(i):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),null!=t?t:i}},{key:"getExistingFallback",value:function(){for(var e=function(e){var t=!0,n=!1,i=void 0;try{for(var o,r=e[Symbol.iterator]();!(t=(o=r.next()).done);t=!0){var a=o.value;if(/(^| )fallback($| )/.test(a.className))return a}}catch(e){n=!0,i=e}finally{try{t||null==r.return||r.return()}finally{if(n)throw i}}},t=0,n=["div","form"];t".concat(t," ").concat(this.options.dictFileSizeUnits[n])}},{key:"_updateMaxFilesReachedClass",value:function(){return null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")}},{key:"drop",value:function(e){if(e.dataTransfer){this.emit("drop",e);for(var t=[],n=0;n1024*this.options.maxFilesize*1024?t(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(e.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):D.isValidFile(e,this.options.acceptedFiles)?null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(t(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",e)):this.options.accept.call(this,e,t):t(this.options.dictInvalidFileType)}},{key:"addFile",value:function(t){var n=this;t.upload={uuid:D.uuidv4(),progress:0,total:t.size,bytesSent:0,filename:this._renameFile(t)},this.files.push(t),t.status=D.ADDED,this.emit("addedfile",t),this._enqueueThumbnail(t),this.accept(t,function(e){e?(t.accepted=!1,n._errorProcessing([t],e)):(t.accepted=!0,n.options.autoQueue&&n.enqueueFile(t)),n._updateMaxFilesReachedClass()})}},{key:"enqueueFiles",value:function(e){var t=!0,n=!1,i=void 0;try{for(var o,r=e[Symbol.iterator]();!(t=(o=r.next()).done);t=!0){var a=o.value;this.enqueueFile(a)}}catch(e){n=!0,i=e}finally{try{t||null==r.return||r.return()}finally{if(n)throw i}}return null}},{key:"enqueueFile",value:function(e){var t=this;if(e.status!==D.ADDED||!0!==e.accepted)throw new Error("This file can't be queued because it has already been processed or was rejected.");if(e.status=D.QUEUED,this.options.autoProcessQueue)return setTimeout(function(){return t.processQueue()},0)}},{key:"_enqueueThumbnail",value:function(e){var t=this;if(this.options.createImageThumbnails&&e.type.match(/image.*/)&&e.size<=1024*this.options.maxThumbnailFilesize*1024)return this._thumbnailQueue.push(e),setTimeout(function(){return t._processThumbnailQueue()},0)}},{key:"_processThumbnailQueue",value:function(){var t=this;if(!this._processingThumbnail&&0!==this._thumbnailQueue.length){this._processingThumbnail=!0;var n=this._thumbnailQueue.shift();return this.createThumbnail(n,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,!0,function(e){return t.emit("thumbnail",n,e),t._processingThumbnail=!1,t._processThumbnailQueue()})}}},{key:"removeFile",value:function(e){if(e.status===D.UPLOADING&&this.cancelUpload(e),this.files=d(this.files,e),this.emit("removedfile",e),0===this.files.length)return this.emit("reset")}},{key:"removeAllFiles",value:function(e){null==e&&(e=!1);var t=!0,n=!1,i=void 0;try{for(var o,r=this.files.slice()[Symbol.iterator]();!(t=(o=r.next()).done);t=!0){var a=o.value;a.status===D.UPLOADING&&!e||this.removeFile(a)}}catch(e){n=!0,i=e}finally{try{t||null==r.return||r.return()}finally{if(n)throw i}}return null}},{key:"resizeImage",value:function(o,e,t,n,r){var a=this;return this.createThumbnail(o,e,t,n,!0,function(e,t){if(null==t)return r(o);var n=a.options.resizeMimeType;null==n&&(n=o.type);var i=t.toDataURL(n,a.options.resizeQuality);return r(D.dataURItoBlob(i))})}},{key:"createThumbnail",value:function(e,t,n,i,o,r){var a=this,l=new FileReader;l.onload=function(){e.dataURL=l.result,"image/svg+xml"!==e.type?a.createThumbnailFromUrl(e,t,n,i,o,r):null!=r&&r(l.result)},l.readAsDataURL(e)}},{key:"displayExistingFile",value:function(t,e,n,i,o){var r=this,a=!(4u.options.chunkSize),s[0].upload.totalChunkCount=Math.ceil(t.size/u.options.chunkSize)}if(s[0].upload.chunked){var o=s[0],r=e[0];o.upload.chunks=[];var i=function(){for(var e=0;void 0!==o.upload.chunks[e];)e++;if(!(e>=o.upload.totalChunkCount)){0;var t=e*u.options.chunkSize,n=Math.min(t+u.options.chunkSize,o.size),i={name:u._getParamName(0),data:r.webkitSlice?r.webkitSlice(t,n):r.slice(t,n),filename:o.upload.filename,chunkIndex:e};o.upload.chunks[e]={file:o,index:e,dataBlock:i,status:D.UPLOADING,progress:0,retries:0},u._uploadData(s,[i])}};if(o.upload.finishedChunkUpload=function(e){var t=!0;e.status=D.SUCCESS,e.dataBlock=null,e.xhr=null;for(var n=0;n>1}var s=l/t;return 0==s?1:s}(t);return e.drawImage(t,n,i,o,r,a,l,s,u/c)};(function(){function e(){u(this,e)}return t(e,null,[{key:"initClass",value:function(){this.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}},{key:"encode64",value:function(e){for(var t="",n=void 0,i=void 0,o="",r=void 0,a=void 0,l=void 0,s="",u=0;r=(n=e[u++])>>2,a=(3&n)<<4|(i=e[u++])>>4,l=(15&i)<<2|(o=e[u++])>>6,s=63&o,isNaN(i)?l=s=64:isNaN(o)&&(s=64),t=t+this.KEY_STR.charAt(r)+this.KEY_STR.charAt(a)+this.KEY_STR.charAt(l)+this.KEY_STR.charAt(s),n=i=o="",r=a=l=s="",ue.length)break}return n}},{key:"decode64",value:function(e){var t=void 0,n=void 0,i="",o=void 0,r=void 0,a="",l=0,s=[];for(/[^A-Za-z0-9\+\/\=]/g.exec(e),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");t=this.KEY_STR.indexOf(e.charAt(l++))<<2|(o=this.KEY_STR.indexOf(e.charAt(l++)))>>4,n=(15&o)<<4|(r=this.KEY_STR.indexOf(e.charAt(l++)))>>2,i=(3&r)<<6|(a=this.KEY_STR.indexOf(e.charAt(l++))),s.push(t),64!==r&&s.push(n),64!==a&&s.push(i),t=n=i="",o=r=a="",l
+ * @author owenm
* @license MIT
*/
-/**!
- * Sortable
- * @author RubaXa
- * @license MIT
- */
-!function(o){"use strict";void 0===(r="function"==typeof(i=o)?i.call(t,n,t,e):i)||(e.exports=r)}(function(){"use strict";if("undefined"==typeof window||!window.document)return function(){throw new Error("Sortable.js requires a window with a document")};var e,t,n,i,r,o,a,s,l,u,d,c,h,p,f,m,g,v,b,y,k,w={},F=/\s+/g,C=/left|right|inline/,S="Sortable"+(new Date).getTime(),x=window,E=x.document,D=x.parseInt,_=x.setTimeout,T=x.jQuery||x.Zepto,P=x.Polymer,I=!1,U="draggable"in E.createElement("div"),z=!navigator.userAgent.match(/(?:Trident.*rv[ :]?11\.|msie)/i)&&((k=E.createElement("x")).style.cssText="pointer-events:auto","auto"===k.style.pointerEvents),L=!1,A=Math.abs,M=Math.min,R=[],N=[],O=ie(function(e,t,n){if(n&&t.scroll){var i,r,o,a,d,c,h=n[S],p=t.scrollSensitivity,f=t.scrollSpeed,m=e.clientX,g=e.clientY,v=window.innerWidth,b=window.innerHeight;if(l!==n&&(s=t.scroll,l=n,u=t.scrollFn,!0===s)){s=n;do{if(s.offsetWidth-1:r==e)}}var n={},i=e.group;i&&"object"==typeof i||(i={name:i}),n.name=i.name,n.checkPull=t(i.pull,!0),n.checkPut=t(i.put),n.revertClone=i.revertClone,e.group=n};try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){I={capture:!1,passive:!1}}}))}catch(e){}function G(e,t){if(!e||!e.nodeType||1!==e.nodeType)throw"Sortable: `el` must be HTMLElement, and not "+{}.toString.call(e);this.el=e,this.options=t=re({},t),e[S]=this;var n={group:Math.random(),sort:!0,disabled:!1,store:null,handle:null,scroll:!0,scrollSensitivity:30,scrollSpeed:10,draggable:/[uo]l/i.test(e.nodeName)?"li":">*",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,setData:function(e,t){e.setData("Text",t.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==G.supportPointer};for(var i in n)!(i in t)&&(t[i]=n[i]);for(var r in B(t),this)"_"===r.charAt(0)&&"function"==typeof this[r]&&(this[r]=this[r].bind(this));this.nativeDraggable=!t.forceFallback&&U,W(e,"mousedown",this._onTapStart),W(e,"touchstart",this._onTapStart),t.supportPointer&&W(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(W(e,"dragover",this),W(e,"dragenter",this)),N.push(this._onDragOver),t.store&&this.sort(t.store.get(this))}function Y(t,n){"clone"!==t.lastPullMode&&(n=!0),i&&i.state!==n&&(Q(i,"display",n?"none":""),n||i.state&&(t.options.group.revertClone?(r.insertBefore(i,o),t._animate(e,i)):r.insertBefore(i,e)),i.state=n)}function H(e,t,n){if(e){n=n||E;do{if(">*"===t&&e.parentNode===n||ne(e,t))return e}while(e=X(e))}return null}function X(e){var t=e.host;return t&&t.nodeType?t:e.parentNode}function W(e,t,n){e.addEventListener(t,n,I)}function j(e,t,n){e.removeEventListener(t,n,I)}function q(e,t,n){if(e)if(e.classList)e.classList[n?"add":"remove"](t);else{var i=(" "+e.className+" ").replace(F," ").replace(" "+t+" "," ");e.className=(i+(n?" "+t:"")).replace(F," ")}}function Q(e,t,n){var i=e&&e.style;if(i){if(void 0===n)return E.defaultView&&E.defaultView.getComputedStyle?n=E.defaultView.getComputedStyle(e,""):e.currentStyle&&(n=e.currentStyle),void 0===t?n:n[t];t in i||(t="-webkit-"+t),i[t]=n+("string"==typeof n?"":"px")}}function V(e,t,n){if(e){var i=e.getElementsByTagName(t),r=0,o=i.length;if(n)for(;r*"!==t&&!ne(e,t)||n++;return n}function ne(e,t){if(e){var n=(t=t.split(".")).shift().toUpperCase(),i=new RegExp("\\s("+t.join("|")+")(?=\\s)","g");return!(""!==n&&e.nodeName.toUpperCase()!=n||t.length&&((" "+e.className+" ").match(i)||[]).length!=t.length)}return!1}function ie(e,t){var n,i;return function(){void 0===n&&(n=arguments,i=this,_(function(){1===n.length?e.call(i,n[0]):e.apply(i,n),n=void 0},t))}}function re(e,t){if(e&&t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function oe(e){return P&&P.dom?P.dom(e).cloneNode(!0):T?T(e).clone(!0)[0]:e.cloneNode(!0)}function ae(e){return _(e,0)}function se(e){return clearTimeout(e)}return G.prototype={constructor:G,_onTapStart:function(t){var n,i=this,r=this.el,o=this.options,s=o.preventOnFilter,l=t.type,u=t.touches&&t.touches[0],d=(u||t).target,c=t.target.shadowRoot&&t.path&&t.path[0]||d,h=o.filter;if(function(e){var t=e.getElementsByTagName("input"),n=t.length;for(;n--;){var i=t[n];i.checked&&R.push(i)}}(r),!e&&!(/mousedown|pointerdown/.test(l)&&0!==t.button||o.disabled)&&!c.isContentEditable&&(d=H(d,o.draggable,r))&&a!==d){if(n=te(d,o.draggable),"function"==typeof h){if(h.call(this,t,d,this))return K(i,c,"filter",d,r,r,n),void(s&&t.preventDefault())}else if(h&&(h=h.split(",").some(function(e){if(e=H(c,e.trim(),r))return K(i,e,"filter",d,r,r,n),!0})))return void(s&&t.preventDefault());o.handle&&!H(c,o.handle,r)||this._prepareDragStart(t,u,d,n)}},_prepareDragStart:function(n,i,s,l){var u,d=this,c=d.el,h=d.options,f=c.ownerDocument;s&&!e&&s.parentNode===c&&(v=n,r=c,t=(e=s).parentNode,o=e.nextSibling,a=s,m=h.group,p=l,this._lastX=(i||n).clientX,this._lastY=(i||n).clientY,e.style["will-change"]="all",u=function(){d._disableDelayedDrag(),e.draggable=d.nativeDraggable,q(e,h.chosenClass,!0),d._triggerDragStart(n,i),K(d,r,"choose",e,r,r,p)},h.ignore.split(",").forEach(function(t){V(e,t.trim(),Z)}),W(f,"mouseup",d._onDrop),W(f,"touchend",d._onDrop),W(f,"touchcancel",d._onDrop),W(f,"selectstart",d),h.supportPointer&&W(f,"pointercancel",d._onDrop),h.delay?(W(f,"mouseup",d._disableDelayedDrag),W(f,"touchend",d._disableDelayedDrag),W(f,"touchcancel",d._disableDelayedDrag),W(f,"mousemove",d._disableDelayedDrag),W(f,"touchmove",d._disableDelayedDrag),h.supportPointer&&W(f,"pointermove",d._disableDelayedDrag),d._dragStartTimer=_(u,h.delay)):u())},_disableDelayedDrag:function(){var e=this.el.ownerDocument;clearTimeout(this._dragStartTimer),j(e,"mouseup",this._disableDelayedDrag),j(e,"touchend",this._disableDelayedDrag),j(e,"touchcancel",this._disableDelayedDrag),j(e,"mousemove",this._disableDelayedDrag),j(e,"touchmove",this._disableDelayedDrag),j(e,"pointermove",this._disableDelayedDrag)},_triggerDragStart:function(t,n){(n=n||("touch"==t.pointerType?t:null))?(v={target:e,clientX:n.clientX,clientY:n.clientY},this._onDragStart(v,"touch")):this.nativeDraggable?(W(e,"dragend",this),W(r,"dragstart",this._onDragStart)):this._onDragStart(v,!0);try{E.selection?ae(function(){E.selection.empty()}):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(){if(r&&e){var t=this.options;q(e,t.ghostClass,!0),q(e,t.dragClass,!1),G.active=this,K(this,r,"start",e,r,r,p)}else this._nulling()},_emulateDragOver:function(){if(b){if(this._lastX===b.clientX&&this._lastY===b.clientY)return;this._lastX=b.clientX,this._lastY=b.clientY,z||Q(n,"display","none");var e=E.elementFromPoint(b.clientX,b.clientY),t=e,i=N.length;if(e&&e.shadowRoot&&(t=e=e.shadowRoot.elementFromPoint(b.clientX,b.clientY)),t)do{if(t[S]){for(;i--;)N[i]({clientX:b.clientX,clientY:b.clientY,target:e,rootEl:t});break}e=t}while(t=t.parentNode);z||Q(n,"display","")}},_onTouchMove:function(e){if(v){var t=this.options,i=t.fallbackTolerance,r=t.fallbackOffset,o=e.touches?e.touches[0]:e,a=o.clientX-v.clientX+r.x,s=o.clientY-v.clientY+r.y,l=e.touches?"translate3d("+a+"px,"+s+"px,0)":"translate("+a+"px,"+s+"px)";if(!G.active){if(i&&M(A(o.clientX-this._lastX),A(o.clientY-this._lastY))5||t.clientX-(n.left+n.width)>5}(f,a)){if(0!==f.children.length&&f.children[0]!==n&&f===a.target&&(s=f.lastElementChild),s){if(s.animated)return;u=s.getBoundingClientRect()}Y(k,w),!1!==J(r,f,e,l,s,u,a)&&(e.contains(f)||(f.appendChild(e),t=f),this._animate(l,e),s&&this._animate(u,s))}else if(s&&!s.animated&&s!==e&&void 0!==s.parentNode[S]){d!==s&&(d=s,c=Q(s),h=Q(s.parentNode));var E=(u=s.getBoundingClientRect()).right-u.left,D=u.bottom-u.top,T=C.test(c.cssFloat+c.display)||"flex"==h.display&&0===h["flex-direction"].indexOf("row"),P=s.offsetWidth>e.offsetWidth,I=s.offsetHeight>e.offsetHeight,U=(T?(a.clientX-u.left)/E:(a.clientY-u.top)/D)>.5,z=s.nextElementSibling,A=!1;if(T){var M=e.offsetTop,R=s.offsetTop;A=M===R?s.previousElementSibling===e&&!P||U&&P:s.previousElementSibling===e||e.previousElementSibling===s?(a.clientY-u.top)/D>.5:R>M}else F||(A=z!==e&&!I||U&&I);var N=J(r,f,e,l,s,u,a,A);!1!==N&&(1!==N&&-1!==N||(A=1===N),L=!0,_($,30),Y(k,w),e.contains(f)||(A&&!z?f.appendChild(e):s.parentNode.insertBefore(e,A?z:s)),t=e.parentNode,this._animate(l,e),this._animate(u,s))}}},_animate:function(e,t){var n=this.options.animation;if(n){var i=t.getBoundingClientRect();1===e.nodeType&&(e=e.getBoundingClientRect()),Q(t,"transition","none"),Q(t,"transform","translate3d("+(e.left-i.left)+"px,"+(e.top-i.top)+"px,0)"),t.offsetWidth,Q(t,"transition","all "+n+"ms"),Q(t,"transform","translate3d(0,0,0)"),clearTimeout(t.animated),t.animated=_(function(){Q(t,"transition",""),Q(t,"transform",""),t.animated=!1},n)}},_offUpEvents:function(){var e=this.el.ownerDocument;j(E,"touchmove",this._onTouchMove),j(E,"pointermove",this._onTouchMove),j(e,"mouseup",this._onDrop),j(e,"touchend",this._onDrop),j(e,"pointerup",this._onDrop),j(e,"touchcancel",this._onDrop),j(e,"pointercancel",this._onDrop),j(e,"selectstart",this)},_onDrop:function(a){var s=this.el,l=this.options;clearInterval(this._loopId),clearInterval(w.pid),clearTimeout(this._dragStartTimer),se(this._cloneId),se(this._dragStartId),j(E,"mouseover",this),j(E,"mousemove",this._onTouchMove),this.nativeDraggable&&(j(E,"drop",this),j(s,"dragstart",this._onDragStart)),this._offUpEvents(),a&&(y&&(a.preventDefault(),!l.dropBubble&&a.stopPropagation()),n&&n.parentNode&&n.parentNode.removeChild(n),r!==t&&"clone"===G.active.lastPullMode||i&&i.parentNode&&i.parentNode.removeChild(i),e&&(this.nativeDraggable&&j(e,"dragend",this),Z(e),e.style["will-change"]="",q(e,this.options.ghostClass,!1),q(e,this.options.chosenClass,!1),K(this,r,"unchoose",e,t,r,p),r!==t?(f=te(e,l.draggable))>=0&&(K(null,t,"add",e,t,r,p,f),K(this,r,"remove",e,t,r,p,f),K(null,t,"sort",e,t,r,p,f),K(this,r,"sort",e,t,r,p,f)):e.nextSibling!==o&&(f=te(e,l.draggable))>=0&&(K(this,r,"update",e,t,r,p,f),K(this,r,"sort",e,t,r,p,f)),G.active&&(null!=f&&-1!==f||(f=p),K(this,r,"end",e,t,r,p,f),this.save()))),this._nulling()},_nulling:function(){r=e=t=n=o=i=a=s=l=v=b=y=f=d=c=g=m=G.active=null,R.forEach(function(e){e.checked=!0}),R.length=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragover":case"dragenter":e&&(this._onDragOver(t),function(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move");e.preventDefault()}(t));break;case"mouseover":this._onDrop(t);break;case"selectstart":t.preventDefault()}},toArray:function(){for(var e,t=[],n=this.el.children,i=0,r=n.length,o=this.options;i"===t[0]&&(t=t.substring(1)),e))try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(e){return}}function q(e,t,n,i){if(e){n=n||document;do{if(null!=t&&(">"!==t[0]||e.parentNode===n)&&v(e,t)||i&&e===n)return e;if(e===n)break}while(e=(o=e).host&&o!==document&&o.host.nodeType?o.host:o.parentNode)}var o;return null}var m,g=/\s+/g;function Q(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var i=(" "+e.className+" ").replace(g," ").replace(" "+t+" "," ");e.className=(i+(n?" "+t:"")).replace(g," ")}}function G(e,t,n){var i=e&&e.style;if(i){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(n=e.currentStyle),void 0===t?n:n[t];t in i||-1!==t.indexOf("webkit")||(t="-webkit-"+t),i[t]=n+("string"==typeof n?"":"px")}}function y(e,t){var n="";if("string"==typeof e)n=e;else do{var i=G(e,"transform");i&&"none"!==i&&(n=i+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function b(e,t,n){if(e){var i=e.getElementsByTagName(t),o=0,r=i.length;if(n)for(;o=t.left-n&&r<=t.right+n,o=a>=t.top-n&&a<=t.bottom+n;return n&&i&&o?l=e:void 0}}),l);if(t){var n={};for(var i in e)e.hasOwnProperty(i)&&(n[i]=e[i]);n.target=n.rootEl=t,n.preventDefault=void 0,n.stopPropagation=void 0,t[ee]._onDragOver(n)}}var r,a,l}function Pe(e){ie&&ie.parentNode[ee]._isOutsideThisEl(e.target)}function Re(e,t){if(!e||!e.nodeType||1!==e.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=a({},t),e[ee]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return ze(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(e,t){e.setData("Text",t.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==Re.supportPointer&&"PointerEvent"in window,emptyInsertThreshold:5};for(var i in N.initializePlugins(this,e,n),n)i in t||(t[i]=n[i]);for(var o in Ie(t),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!t.forceFallback&&Ae,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?p(e,"pointerdown",this._onTapStart):(p(e,"mousedown",this._onTapStart),p(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(p(e,"dragover",this),p(e,"dragenter",this)),Ee.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),a(this,T())}function Ue(e,t,n,i,o,r,a,l){var s,u,c=e[ee],d=c.options.onMove;return!window.CustomEvent||w||E?(s=document.createEvent("Event")).initEvent("move",!0,!0):s=new CustomEvent("move",{bubbles:!0,cancelable:!0}),s.to=t,s.from=e,s.dragged=n,s.draggedRect=i,s.related=o||t,s.relatedRect=r||K(t),s.willInsertAfter=l,s.originalEvent=a,e.dispatchEvent(s),d&&(u=d.call(c,s,a)),u}function Be(e){e.draggable=!1}function He(){xe=!1}function Ye(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,n=t.length,i=0;n--;)i+=t.charCodeAt(n);return i.toString(36)}function Xe(e){return setTimeout(e,0)}function je(e){return clearTimeout(e)}Re.prototype={constructor:Re,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(ve=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,ie):this.options.direction},_onTapStart:function(t){if(t.cancelable){var n=this,i=this.el,e=this.options,o=e.preventOnFilter,r=t.type,a=t.touches&&t.touches[0]||t.pointerType&&"touch"===t.pointerType&&t,l=(a||t).target,s=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||l,u=e.filter;if(!function(e){De.length=0;var t=e.getElementsByTagName("input"),n=t.length;for(;n--;){var i=t[n];i.checked&&De.push(i)}}(i),!ie&&!(/mousedown|pointerdown/.test(r)&&0!==t.button||e.disabled||s.isContentEditable||(l=q(l,e.draggable,i,!1))&&l.animated||L===l)){if(U=$(l),B=$(l,e.draggable),"function"==typeof u){if(u.call(this,t,l,this))return ne({sortable:n,rootEl:s,name:"filter",targetEl:l,toEl:i,fromEl:i}),te("filter",n,{evt:t}),void(o&&t.cancelable&&t.preventDefault())}else if(u=u&&u.split(",").some(function(e){if(e=q(s,e.trim(),i,!1))return ne({sortable:n,rootEl:e,name:"filter",targetEl:l,fromEl:i,toEl:i}),te("filter",n,{evt:t}),!0}))return void(o&&t.cancelable&&t.preventDefault());e.handle&&!q(s,e.handle,i,!1)||this._prepareDragStart(t,a,l)}}},_prepareDragStart:function(e,t,n){var i,o=this,r=o.el,a=o.options,l=r.ownerDocument;if(n&&!ie&&n.parentNode===r){var s=K(n);if(ae=r,oe=(ie=n).parentNode,le=ie.nextSibling,L=n,ce=a.group,H={target:Re.dragged=ie,clientX:(t||e).clientX,clientY:(t||e).clientY},he=H.clientX-s.left,pe=H.clientY-s.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,ie.style["will-change"]="all",i=function(){te("delayEnded",o,{evt:e}),Re.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!u&&o.nativeDraggable&&(ie.draggable=!0),o._triggerDragStart(e,t),ne({sortable:o,name:"choose",originalEvent:e}),Q(ie,a.chosenClass,!0))},a.ignore.split(",").forEach(function(e){b(ie,e.trim(),Be)}),p(l,"dragover",Le),p(l,"mousemove",Le),p(l,"touchmove",Le),p(l,"mouseup",o._onDrop),p(l,"touchend",o._onDrop),p(l,"touchcancel",o._onDrop),u&&this.nativeDraggable&&(this.options.touchStartThreshold=4,ie.draggable=!0),te("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(E||w))i();else{if(Re.eventCanceled)return void this._onDrop();p(l,"mouseup",o._disableDelayedDrag),p(l,"touchend",o._disableDelayedDrag),p(l,"touchcancel",o._disableDelayedDrag),p(l,"mousemove",o._delayedDragTouchMoveHandler),p(l,"touchmove",o._delayedDragTouchMoveHandler),a.supportPointer&&p(l,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(i,a.delay)}}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){ie&&Be(ie),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;f(e,"mouseup",this._disableDelayedDrag),f(e,"touchend",this._disableDelayedDrag),f(e,"touchcancel",this._disableDelayedDrag),f(e,"mousemove",this._delayedDragTouchMoveHandler),f(e,"touchmove",this._delayedDragTouchMoveHandler),f(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?p(document,"pointermove",this._onTouchMove):p(document,t?"touchmove":"mousemove",this._onTouchMove):(p(ie,"dragend",this),p(ae,"dragstart",this._onDragStart));try{document.selection?Xe(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(be=!1,ae&&ie){te("dragStarted",this,{evt:t}),this.nativeDraggable&&p(document,"dragover",Pe);var n=this.options;e||Q(ie,n.dragClass,!1),Q(ie,n.ghostClass,!0),Re.active=this,e&&this._appendGhost(),ne({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(Y){this._lastX=Y.clientX,this._lastY=Y.clientY,Ne();for(var e=document.elementFromPoint(Y.clientX,Y.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(Y.clientX,Y.clientY))!==t;)t=e;if(ie.parentNode[ee]._isOutsideThisEl(e),t)do{if(t[ee]){if(t[ee]._onDragOver({clientX:Y.clientX,clientY:Y.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);Oe()}},_onTouchMove:function(e){if(H){var t=this.options,n=t.fallbackTolerance,i=t.fallbackOffset,o=e.touches?e.touches[0]:e,r=re&&y(re,!0),a=re&&r&&r.a,l=re&&r&&r.d,s=Fe&&ye&&S(ye),u=(o.clientX-H.clientX+i.x)/(a||1)+(s?s[0]-Ce[0]:0)/(a||1),c=(o.clientY-H.clientY+i.y)/(l||1)+(s?s[1]-Ce[1]:0)/(l||1);if(!Re.active&&!be){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))B.right+10||P.clientX<=B.right&&P.clientY>B.bottom&&P.clientX>=B.left:P.clientX>B.right&&P.clientY>B.top||P.clientX<=B.right&&P.clientY>B.bottom+10)||v.animated)){if(s.parentNode===l){o=K(s);var m,g,y,b=ie.parentNode!==l,w=(F=ie.animated&&ie.toRect||i,T=s.animated&&s.toRect||o,M=(A=a)?F.left:F.top,z=A?F.right:F.bottom,I=A?F.width:F.height,N=A?T.left:T.top,O=A?T.right:T.bottom,L=A?T.width:T.height,!(M===N||z===O||M+I/2===N+L/2)),E=a?"top":"left",k=V(s,"top","top")||V(ie,"top","top"),S=k?k.scrollTop:void 0;if(ve!==s&&(g=o[E],ke=!1,Se=!w&&t.invertSwap||b),0!==(m=function(e,t,n,i,o,r,a,l){var s=i?e.clientY:e.clientX,u=i?n.height:n.width,c=i?n.top:n.left,d=i?n.bottom:n.right,h=!1;if(!a)if(l&&gemodular()) {
+ while ($page && $page->modularTwig()) {
$header = $page->header();
$header->never_cache_twig = true;
$page = $page->parent();
@@ -546,7 +547,11 @@ class Form implements FormInterface, \ArrayAccess
// json_response
return [
'status' => 'error',
- 'message' => sprintf($language->translate('PLUGIN_FORM.FILEUPLOAD_UNABLE_TO_UPLOAD', null, true), $filename, $this->upload_errors[$upload['file']['error']])
+ 'message' => sprintf(
+ $language->translate('PLUGIN_FORM.FILEUPLOAD_UNABLE_TO_UPLOAD', null, true),
+ $filename,
+ $this->getFileUploadError($upload['file']['error'], $language)
+ )
];
}
@@ -652,6 +657,11 @@ class Form implements FormInterface, \ArrayAccess
$upload['file']['name'] = $filename;
$upload['file']['path'] = $path;
+ // Special Sanitization for SVG
+ if (method_exists('Grav\Common\Security', 'sanitizeSVG') && Utils::contains($mime, 'svg', false)) {
+ Security::sanitizeSVG($upload['file']['tmp_name']);
+ }
+
// We need to store the file into flash object or it will not be available upon save later on.
$flash = $this->getFlash();
$flash->setUrl($url)->setUser($grav['user'] ?? null);
@@ -693,6 +703,54 @@ class Form implements FormInterface, \ArrayAccess
exit;
}
+ /**
+ * Return an error message for a PHP file upload error code
+ * https://www.php.net/manual/en/features.file-upload.errors.php
+ *
+ * @param int $error PHP file upload error code
+ * @param Language|null $language
+ * @return string File upload error message
+ */
+ public function getFileUploadError(int $error, Language $language = null): string
+ {
+ if (!$language) {
+ $grav = Grav::instance();
+
+ /** @var Language $language */
+ $language = $grav['language'];
+ }
+
+ switch ($error) {
+ case UPLOAD_ERR_OK:
+ $item = 'FILEUPLOAD_ERR_OK';
+ break;
+ case UPLOAD_ERR_INI_SIZE:
+ $item = 'FILEUPLOAD_ERR_INI_SIZE';
+ break;
+ case UPLOAD_ERR_FORM_SIZE:
+ $item = 'FILEUPLOAD_ERR_FORM_SIZE';
+ break;
+ case UPLOAD_ERR_PARTIAL:
+ $item = 'FILEUPLOAD_ERR_PARTIAL';
+ break;
+ case UPLOAD_ERR_NO_FILE:
+ $item = 'FILEUPLOAD_ERR_NO_FILE';
+ break;
+ case UPLOAD_ERR_NO_TMP_DIR:
+ $item = 'FILEUPLOAD_ERR_NO_TMP_DIR';
+ break;
+ case UPLOAD_ERR_CANT_WRITE:
+ $item = 'FILEUPLOAD_ERR_CANT_WRITE';
+ break;
+ case UPLOAD_ERR_EXTENSION:
+ $item = 'FILEUPLOAD_ERR_EXTENSION';
+ break;
+ default:
+ $item = 'FILEUPLOAD_ERR_UNKNOWN';
+ }
+ return $language->translate('PLUGIN_FORM.'.$item);
+ }
+
/**
* Removes a file from the flash object session, before it gets saved.
*/
@@ -854,7 +912,7 @@ class Form implements FormInterface, \ArrayAccess
/**
* @return string
- * @deprecated 3.0 Use $this->getName() instead
+ * @deprecated 3.0 Use $form->getName() instead
*/
public function name(): string
{
@@ -863,7 +921,7 @@ class Form implements FormInterface, \ArrayAccess
/**
* @return array
- * @deprecated 3.0 Use $this->getFields() instead
+ * @deprecated 3.0 Use $form->getFields() instead
*/
public function fields(): array
{
@@ -872,7 +930,7 @@ class Form implements FormInterface, \ArrayAccess
/**
* @return PageInterface
- * @deprecated 3.0 Use $this->getPage() instead
+ * @deprecated 3.0 Use $form->getPage() instead
*/
public function page(): PageInterface
{
@@ -882,7 +940,7 @@ class Form implements FormInterface, \ArrayAccess
/**
* Backwards compatibility
*
- * @deprecated 3.0
+ * @deprecated 3.0 Calling $form->filter() is not needed anymore (does nothing)
*/
public function filter(): void
{
@@ -995,7 +1053,7 @@ class Form implements FormInterface, \ArrayAccess
public function getPagePathFromToken($path)
{
- return Utils::getPagePathFromToken($path, $this->page());
+ return Utils::getPagePathFromToken($path, $this->getPage());
}
/**
diff --git a/user/plugins/form/form.php b/user/plugins/form/form.php
index 8efa9a0..29f073f 100644
--- a/user/plugins/form/form.php
+++ b/user/plugins/form/form.php
@@ -1,4 +1,5 @@
grav['forms'] = function () {
$forms = new Forms();
@@ -156,7 +158,7 @@ class FormPlugin extends Plugin
// Force never_cache_twig if modular form (recursively up)
$current = $page;
- while ($current && $current->modular()) {
+ while ($current && $current->modularTwig()) {
$header = $current->header();
$header->never_cache_twig = true;
@@ -218,9 +220,9 @@ class FormPlugin extends Plugin
// Enable form events if there's a POST
if ($this->shouldProcessForm()) {
$this->enable([
- 'onFormProcessed' => ['onFormProcessed', 0],
+ 'onFormProcessed' => ['onFormProcessed', 0],
'onFormValidationError' => ['onFormValidationError', 0],
- 'onFormFieldTypes' => ['onFormFieldTypes', 0],
+ 'onFormFieldTypes' => ['onFormFieldTypes', 0],
]);
/** @var Uri $uri */
@@ -233,8 +235,9 @@ class FormPlugin extends Plugin
if ($form instanceof Form) {
// Post the form
$isJson = $uri->extension() === 'json';
+ $task = $uri->post('task') ?? $uri->param('task');
+
if ($isJson) {
- $task = $uri->post('task') ?? $uri->param('task');
if ($task === 'store-state') {
$this->json_response = $form->storeState();
} elseif ($task === 'clear-state') {
@@ -244,8 +247,9 @@ class FormPlugin extends Plugin
} elseif ($task === 'file-upload' || $uri->post('__form-file-uploader__')) {
$this->json_response = $form->uploadFiles();
}
- } else {
- $task = $uri->post('task');
+ }
+
+ if (empty($this->json_response)) {
if ($task === 'clear-state') {
$form->getFlash()->delete();
$redirect = $form->getBlueprint()->get('form/clear_redirect_url') ?? $page->route();
@@ -329,9 +333,9 @@ class FormPlugin extends Plugin
new \Twig_SimpleFunction('forms', [$this, 'getForm'])
);
- $this->grav['twig']->twig()->getExtension('Twig_Extension_Core')->setEscaper('yaml', function($twig, $string, $charset) {
+ $this->grav['twig']->twig()->getExtension('Twig_Extension_Core')->setEscaper('yaml', function ($twig, $string, $charset) {
return Yaml::dump($string);
- }
+ }
);
}
@@ -399,6 +403,9 @@ class FormPlugin extends Plugin
$ip = Uri::ip();
$recaptcha = new ReCaptcha($secret);
+ if (extension_loaded('curl')) {
+ $recaptcha = new ReCaptcha($secret, new CurlPost());
+ }
// get captcha version
$captcha_version = $captcha_config['version'] ?? 2;
@@ -427,13 +434,13 @@ class FormPlugin extends Plugin
$type = $field['type'] ?? 'text';
$field_message = $field['recaptcha_not_validated'] ?? null;
if ($type === 'captcha' && $field_message) {
- $message = $field_message;
+ $message = $field_message;
break;
}
}
$this->grav->fireEvent('onFormValidationError', new Event([
- 'form' => $form,
+ 'form' => $form,
'message' => $message
]));
@@ -448,16 +455,16 @@ class FormPlugin extends Plugin
$label = $params['label'] ?? 'Timestamp';
$format = $params['format'] ?? 'Y-m-d H:i:s';
$blueprint = $form->value()->blueprints();
- $blueprint->set('form/fields/timestamp', ['name'=>'timestamp', 'label'=> $label, 'type'=>'hidden']);
+ $blueprint->set('form/fields/timestamp', ['name' => 'timestamp', 'label' => $label, 'type' => 'hidden']);
$now = new \DateTime('now');
$date_string = $now->format($format);
$form->setFields($blueprint->fields());
- $form->setData('timestamp',$date_string);
+ $form->setData('timestamp', $date_string);
break;
case 'ip':
$label = $params['label'] ?? 'User IP';
$blueprint = $form->value()->blueprints();
- $blueprint->set('form/fields/ip', ['name'=>'ip', 'label'=> $label, 'type'=>'hidden']);
+ $blueprint->set('form/fields/ip', ['name' => 'ip', 'label' => $label, 'type' => 'hidden']);
$form->setFields($blueprint->fields());
$form->setData('ip', Uri::ip());
break;
@@ -503,7 +510,7 @@ class FormPlugin extends Plugin
if (!$route || $route[0] !== '/') {
/** @var Uri $uri */
$uri = $this->grav['uri'];
- $route = rtrim($uri->route(), '/'). '/' . ($route ?: '');
+ $route = rtrim($uri->route(), '/') . '/' . ($route ?: '');
}
/** @var Twig $twig */
@@ -523,8 +530,8 @@ class FormPlugin extends Plugin
break;
case 'remember':
foreach ($params as $remember_field) {
- $field_cookie = 'forms-'.$form['name'].'-'.$remember_field;
- setcookie($field_cookie, $form->value($remember_field), time()+60*60*24*60);
+ $field_cookie = 'forms-' . $form['name'] . '-' . $remember_field;
+ setcookie($field_cookie, $form->value($remember_field), time() + 60 * 60 * 24 * 60);
}
break;
case 'upload':
@@ -547,7 +554,7 @@ class FormPlugin extends Plugin
throw new \RuntimeException('Form save: \'operation: add\' is only supported with a static filename');
}
- $filename = $prefix . $this->udate($format, $raw_format) . $postfix. $ext;
+ $filename = $prefix . $this->udate($format, $raw_format) . $postfix . $ext;
}
/** @var Twig $twig */
@@ -562,7 +569,7 @@ class FormPlugin extends Plugin
$locator = $this->grav['locator'];
$path = $locator->findResource('user-data://', true);
$dir = $path . DS . $folder;
- $fullFileName = $dir. DS . $filename;
+ $fullFileName = $dir . DS . $filename;
if (!empty($params['raw']) || !empty($params['template'])) {
// Save data as it comes from the form.
@@ -673,7 +680,7 @@ class FormPlugin extends Plugin
/**
* Handle form validation error
*
- * @param Event $event An event object
+ * @param Event $event An event object
* @throws \Exception
*/
public function onFormValidationError(Event $event)
@@ -708,10 +715,14 @@ class FormPlugin extends Plugin
* Add a form to the forms plugin
*
* @param string|null $page_route
- * @param FormInterface $form
+ * @param FormInterface|null $form
*/
- public function addForm(?string $page_route, FormInterface $form)
+ public function addForm(?string $page_route, ?FormInterface $form)
{
+ if (null === $form) {
+ return;
+ }
+
$name = $form->getName();
if (!isset($this->forms[$page_route][$name])) {
@@ -813,7 +824,7 @@ class FormPlugin extends Plugin
'key' => [
'input@' => false
],
- 'section' => [
+ 'section' => [
'input@' => false
],
'spacer' => [
@@ -915,7 +926,7 @@ class FormPlugin extends Plugin
}
if (isset($form->refresh_prevention)) {
- $refresh_prevention = (bool) $form->refresh_prevention;
+ $refresh_prevention = (bool)$form->refresh_prevention;
} else {
$refresh_prevention = $this->config->get('plugins.form.refresh_prevention', false);
}
@@ -1072,7 +1083,7 @@ class FormPlugin extends Plugin
* Create unix timestamp for storing the data into the filesystem.
*
* @param string $format
- * @param bool $raw
+ * @param bool $raw
*
* @return string
*/
diff --git a/user/plugins/form/gulpfile.js b/user/plugins/form/gulpfile.js
index 60f7191..d0c2770 100644
--- a/user/plugins/form/gulpfile.js
+++ b/user/plugins/form/gulpfile.js
@@ -1,19 +1,19 @@
'use strict';
-var gulp = require('gulp'),
- util = require('util'),
- path = require('path'),
- immutable = require('immutable'),
- gulpWebpack = require('gulp-webpack'),
- webpack = require('webpack'),
- sourcemaps = require('gulp-sourcemaps'),
- exec = require('child_process').execSync,
- sass = require('gulp-sass'),
- cleancss = require('gulp-clean-css'),
- csscomb = require('gulp-csscomb'),
- rename = require('gulp-rename'),
- autoprefixer = require('gulp-autoprefixer'),
- pwd = exec('pwd').toString();
+var gulp = require('gulp');
+var util = require('util');
+var path = require('path');
+var immutable = require('immutable');
+var gulpWebpack = require('gulp-webpack');
+var webpack = require('webpack');
+var sourcemaps = require('gulp-sourcemaps');
+var exec = require('child_process').execSync;
+var sass = require('gulp-sass');
+var cleancss = require('gulp-clean-css');
+var csscomb = require('gulp-csscomb');
+var rename = require('gulp-rename');
+var autoprefixer = require('gulp-autoprefixer');
+var pwd = exec('pwd').toString();
// configure the paths
var watch_dir = './scss/**/*.scss';
@@ -24,23 +24,23 @@ var paths = {
source: src_dir
};
-var plugins = {},
- base = immutable.fromJS(require('./webpack.conf.js')),
- options = {
- prod: base.mergeDeep({
- devtool: 'source-map',
- optimization: {minimize: true},
- plugins: [
- new webpack.DefinePlugin({
- 'process.env': { NODE_ENV: '"production"' }
- }),
- new webpack.ProvidePlugin(plugins)
- ],
- output: {
- filename: 'form.min.js'
- }
- })
- };
+var plugins = {};
+var base = immutable.fromJS(require('./webpack.conf.js'));
+var options = {
+ prod: base.mergeDeep({
+ devtool: 'source-map',
+ optimization: {minimize: true},
+ plugins: [
+ new webpack.DefinePlugin({
+ 'process.env': { NODE_ENV: '"production"' }
+ }),
+ new webpack.ProvidePlugin(plugins)
+ ],
+ output: {
+ filename: 'form.min.js'
+ }
+ })
+};
// var compileJS = function(watch) {
// var prodOpts = options.prod.set('watch', watch);
@@ -65,7 +65,7 @@ var compileCSS = function() {
suffix: '.min'
}))
.pipe(gulp.dest(dest_dir));
-}
+};
// gulp.task('js', function() {
// compileJS(false);
@@ -81,4 +81,4 @@ gulp.task('watch', function() {
});
gulp.task('all', ['css']);
-gulp.task('default', ['all']);
\ No newline at end of file
+gulp.task('default', ['all']);
diff --git a/user/plugins/form/languages.yaml b/user/plugins/form/languages.yaml
index 797be03..ca2e4b7 100644
--- a/user/plugins/form/languages.yaml
+++ b/user/plugins/form/languages.yaml
@@ -31,6 +31,15 @@ en:
FILEUPLOAD_PREVENT_SELF: 'Cannot use "%s" outside of pages.'
FILEUPLOAD_UNABLE_TO_UPLOAD: 'Unable to upload file %s: %s'
FILEUPLOAD_UNABLE_TO_MOVE: 'Unable to move file %s to "%s"'
+ FILEUPLOAD_ERR_OK: 'There is no error, the file uploaded with success'
+ FILEUPLOAD_ERR_INI_SIZE: 'The uploaded file exceeds the max upload size'
+ FILEUPLOAD_ERR_FORM_SIZE: 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML'
+ FILEUPLOAD_ERR_PARTIAL: 'The uploaded file was only partially uploaded'
+ FILEUPLOAD_ERR_NO_FILE: 'No file was uploaded'
+ FILEUPLOAD_ERR_NO_TMP_DIR: 'Missing a temporary folder'
+ FILEUPLOAD_ERR_CANT_WRITE: 'Failed to write file to disk'
+ FILEUPLOAD_ERR_EXTENSION: 'A PHP extension stopped the file upload'
+ FILEUPLOAD_ERR_UNKNOWN: 'Unknown file upload error'
DROPZONE_CANCEL_UPLOAD: 'Cancel upload'
DROPZONE_CANCEL_UPLOAD_CONFIRMATION: 'Are you sure you want to cancel this upload?'
DROPZONE_DEFAULT_MESSAGE: 'Drop your files here or click in this area '
@@ -241,6 +250,7 @@ fr:
NOT_VALIDATED: "Formulaire non validé. Un ou plusieurs champs obligatoires sont manquants."
NONCE_NOT_VALIDATED: "Oups, un problème est survenu. Veuillez vérifier votre saisie et soumettre à nouveau le formulaire."
FILES: "Fichiers chargés"
+ FORM_ALREADY_SUBMITTED: "Le formulaire a déjà été envoyé."
ALLOW_MULTIPLE: "Autoriser plus d'un fichier"
ALLOW_MULTIPLE_HELP: "Permet la sélection de plusieurs fichiers pour chargement."
DESTINATION: "Destination"
@@ -436,6 +446,7 @@ hu:
NOT_VALIDATED: "Érvénytelen az űrlap. Egy vagy több kötelező mező nincs kitöltve."
NONCE_NOT_VALIDATED: "Upsz, van egy kis probléma, kérlek nézd át az űrlapot, majd küldd el újra."
FILES: "Fájlok Feltöltése"
+ FORM_ALREADY_SUBMITTED: "Ez az űrlap már el lett küldve."
ALLOW_MULTIPLE: "Több fájl feltöltése"
ALLOW_MULTIPLE_HELP: "Engedélyezi egyszerre több állomány feltöltését."
DESTINATION: "Feltöltés Helye"
@@ -443,6 +454,58 @@ hu:
ACCEPT: "Engedélyezett MIME-típusok"
ACCEPT_HELP: "A feltölthető állományok MIME-típusainak listája"
ERROR_VALIDATING_CAPTCHA: "Hiba lépett fel a Captcha validálása során"
+ DATA_SUMMARY: "Üzenet összesítő:"
+ NO_FORM_DATA: "Űrlap adatok nem elérhetőek."
+ RECAPTCHA: "reCAPTCHA"
+ RECAPTCHA_VERSION: "Verzió"
+ RECAPTCHA_VERSION_V2_CHECKBOX: "v2 - Kijelölőnégyzet"
+ RECAPTCHA_VERSION_V2_INVISIBLE: "v2 - Láthatatlan"
+ RECAPTCHA_VERSION_V3_LATEST: "v3 - Legutolsó"
+ RECAPTCHA_THEME: "Téma"
+ RECAPTCHA_THEME_LIGHT: "Világos téma"
+ RECAPTCHA_THEME_DARK: "Sötét téma"
+ RECAPTCHA_SITE_KEY: "Site kulcs"
+ RECAPTCHA_SITE_KEY_HELP: "További információért látogass el ide a https://developers.google.com/recaptcha webhelyre."
+ RECAPTCHA_SECRET_KEY: "Secret kulcs"
+ RECAPTCHA_SECRET_KEY_HELP: "További információért látogass el ide a https://developers.google.com/recaptcha webhelyre."
+ GENERAL: "Általános"
+ USE_BUILT_IN_CSS: "Alapértelmezett CSS használata"
+ USE_INLINE_CSS: "Beágyazott CSS használata"
+ FILEUPLOAD_PREVENT_SELF: '"%s" nem használható oldalakon kívül.'
+ FILEUPLOAD_UNABLE_TO_UPLOAD: 'Sikertelen fájlfeltöltés %s: %s'
+ FILEUPLOAD_UNABLE_TO_MOVE: '%s áthelyezése sikertelen ide: "%s"'
+ DROPZONE_CANCEL_UPLOAD: 'Feltöltés megszakítása'
+ DROPZONE_CANCEL_UPLOAD_CONFIRMATION: 'Biztos megszakítsuk a feltöltést?'
+ DROPZONE_DEFAULT_MESSAGE: 'Húzza a fájlokat ide vagy kattintson a területre '
+ DROPZONE_FALLBACK_MESSAGE: 'A böngésző nem támogatja a drag and drop fájlfeltöltéseket.'
+ DROPZONE_FALLBACK_TEXT: 'Kérjük használja a kompatibilitási űrlapot vagy a hagyományos fájfeltöltést.'
+ DROPZONE_FILE_TOO_BIG: 'Túl nagy állomány ({{filesize}}MiB). Maximum fájlméret: {{maxFilesize}}MiB.'
+ DROPZONE_INVALID_FILE_TYPE: "Ilyen típusú fájlok feltöltése nem megengedett."
+ DROPZONE_MAX_FILES_EXCEEDED: "További fájlok feltöltése nem megengedett, elérte a maximumot."
+ DROPZONE_REMOVE_FILE: "Fájl eltávolítása"
+ DROPZONE_REMOVE_FILE_CONFIRMATION: 'Biztos az eltávolításban?'
+ DROPZONE_RESPONSE_ERROR: "Szerver hiba, kód: {{statusCode}}."
+ YES: "Igen"
+ NO: "Nem"
+ REFRESH_PREVENTION: "Újratöltési védelem"
+ REFRESH_PREVENTION_HELP: "Az űrlap egyedi azonosítójának használata annak érdekében hogy az űrlap ne legyen újrafeldolgozva oldalfrissítés esetén."
+ LIMIT: "Limit"
+ LIMIT_HELP: "Az egy mezőben megadható fájlok maximális száma. (multiple required)"
+ FILESIZE: "Maximum fájlméret"
+ FILESIZE_HELP: "Maximum engedélyezett fájlméret (MB-ban), 0 = Rendszer alapértelmezés használata."
+ AVOID_OVERWRITING: "Felülírás elkerülése"
+ AVOID_OVERWRITING_HELP: "A már létező fájlok felülírásának elkerülése, dátum előtag hozzáadásával a fájlnévhez."
+ RANDOM_NAME: "Véletlenszerű név"
+ RANDOM_NAME_HELP: "Generáljon egy 15 karakter hosszú véletlenszerű nevet a feltöltött fájloknak."
+ CLIENT_SIDE_VALIDATION: "Kliens oldali validáció"
+ CLIENT_SIDE_VALIDATION_HELP: "Az űrlapok HTML5 kliens oldali validációt használnak alapértelmezésként, mint első védelmi vonal."
+ INLINE_ERRORS: "Beágyazott hibaüzenetek"
+ INLINE_ERRORS_HELP: "Beágyazott kontextuális űrlaphibák megjelenítése, hasznos ha a 'Kliens oldali validáció' ki van kapcsolva."
+ RESOLUTION_MIN: "A(z) {{attr}} érték kisebb mint a minimum {{min}}px "
+ RESOLUTION_MAX: "A(z) {{attr}} érték nagyobb mint a maximum {{max}}px "
+ DESTINATION_NOT_SPECIFIED: "A feltöltés helye nincs megadva."
+ INVALID_MIME_TYPE: "MIME-típus %s nem engedélyezett. Állomány: %s."
+ INVALID_FILE_EXTENSION: "A(z) %s állomány kiterjesztése nem engedélyezett."
it:
PLUGIN_FORM:
diff --git a/user/plugins/form/package.json b/user/plugins/form/package.json
index d0ffada..241a1b5 100644
--- a/user/plugins/form/package.json
+++ b/user/plugins/form/package.json
@@ -12,35 +12,34 @@
"author": "Team Grav",
"license": "MIT",
"dependencies": {
- "dropzone": "^5.5.1",
+ "dropzone": "getgrav/dropzone#master",
"exif-js": "^2.3.0",
- "sortablejs": "^1.7.0"
+ "sortablejs": "^1.10.2"
},
"devDependencies": {
- "babel-core": "^6.26.3",
- "babel-eslint": "^8.2.6",
- "babel-loader": "^7.1.5",
+ "@babel/core": "^7.9.0",
+ "@babel/preset-env": "^7.9.0",
+ "babel-eslint": "^10.1.0",
+ "babel-loader": "^8.1.0",
"babel-polyfill": "^6.26.0",
- "babel-preset-es2015": "^6.24.1",
- "babel-preset-stage-3": "^6.24.1",
- "css-loader": "^1.0.0",
- "eslint": "^5.6.0",
- "eslint-loader": "^2.1.1",
+ "css-loader": "^3.4.2",
+ "eslint": "^6.8.0",
+ "eslint-loader": "^3.0.4",
"exports-loader": "^0.7.0",
- "gulp": "latest",
- "gulp-autoprefixer": "latest",
- "gulp-clean-css": "^3.10.0",
- "gulp-csscomb": "^3.0.8",
- "gulp-rename": "^1.4.0",
- "gulp-sass": "^4.0.1",
- "gulp-sourcemaps": "^2.6.4",
+ "gulp": "^4.0.2",
+ "gulp-autoprefixer": "^7.0.1",
+ "gulp-clean-css": "^4.3.0",
+ "gulp-csscomb": "^3.1.0",
+ "gulp-rename": "^2.0.0",
+ "gulp-sass": "^4.0.2",
+ "gulp-sourcemaps": "^2.6.5",
"gulp-webpack": "^1.5.0",
"immutable": "^4.0.0-rc.12",
"imports-loader": "^0.8.0",
"json-loader": "^0.5.7",
- "style-loader": "^0.23.0",
- "uglifyjs-webpack-plugin": "^2.0.1",
- "webpack": "^4.19.1",
- "webpack-cli": "^3.1.0"
+ "style-loader": "^1.1.3",
+ "uglifyjs-webpack-plugin": "^2.2.0",
+ "webpack": "^4.42.1",
+ "webpack-cli": "^3.3.11"
}
}
diff --git a/user/plugins/form/templates/forms/default/data.html.twig b/user/plugins/form/templates/forms/default/data.html.twig
index 0b394c7..5b00ec8 100644
--- a/user/plugins/form/templates/forms/default/data.html.twig
+++ b/user/plugins/form/templates/forms/default/data.html.twig
@@ -2,41 +2,57 @@
{% import _self as self %}
{% for index, field in fields %}
- {% set input = attribute(field, "input@") %}
-
- {% if input is null or input == true %}
-
- {% if form.value(scope ~ field.name) %}
- {% block field %}
-
- {% block field_label %}
-
{{ field.label|t|e }} :
- {% endblock %}
-
- {% block field_value %}
- {% if field.type == 'checkboxes' %}
-
- {% set use_keys = field.use is defined and field.use == 'keys' %}
- {% for key,value in form.value(scope ~ field.name) %}
- {% set index = (use_keys ? key : value) %}
- {{ field.options[index]|e }}
- {% endfor %}
-
- {% elseif field.type == 'checkbox' %}
- {{ (form.value(scope ~ field.name) == 1) ? "GRAV.YES"|t|e : "GRAV.NO"|t|e }}
- {% elseif field.type == 'select' %}
- {{ field.options[form.value(scope ~ field.name)]|e }}
- {% else %}
- {{ string(form.value(scope ~ field.name))|nl2br }}
- {% endif %}
- {% endblock %}
-
- {% endblock %}
- {% endif %}
+ {%- set show_field = attribute(field, "input@") ?? field.store ?? true %}
+ {% if field.fields %}
+ {%- set new_scope = field.nest_id ? scope ~ field.name ~ '.' : scope -%}
+ {{- self.render_field(form, field.fields, new_scope) }}
{% else %}
- {% if field.fields %}
- {% set new_scope = field.nest_id ? scope ~ field.name ~ '.' : scope %}
- {{ self.render_field(form, field.fields, new_scope) }}
+ {% if show_field %}
+ {%- set value = form.value(scope ~ (field.name ?? index)) -%}
+ {% if value %}
+ {% block field %}
+
+ {% block field_label %}
+
{{ field.label|t|e }} :
+ {% endblock %}
+
+ {% block field_value %}
+ {% if field.type == 'checkboxes' %}
+
+ {% set use_keys = field.use is defined and field.use == 'keys' %}
+ {% for key,value in form.value(scope ~ field.name) %}
+ {% set index = (use_keys ? key : value) %}
+ {{ field.options[index]|e }}
+ {% endfor %}
+
+ {% elseif field.type == 'checkbox' %}
+ {{ (form.value(scope ~ field.name) == 1) ? "GRAV.YES"|t|e : "GRAV.NO"|t|e }}
+ {% elseif field.type == 'select' %}
+ {{ field.options[form.value(scope ~ field.name)]|e }}
+ {% else %}
+ {% set value = form.value(scope ~ field.name) %}
+ {% if value is iterable %}
+
+ {% for val in value %}
+ {% if val is iterable %}
+
+ {% for v in val %}
+ {{ string(v)|e }}
+ {% endfor %}
+
+ {% else %}
+ {{ string(val)|e }}
+ {% endif %}
+ {% endfor %}
+
+ {% else %}
+ {{ string(value)|e|nl2br }}
+ {% endif %}
+ {% endif %}
+ {% endblock %}
+
+ {% endblock %}
+ {% endif %}
{% endif %}
{% endif %}
{% endfor %}
@@ -45,4 +61,3 @@
{% import _self as macro %}
{{ macro.render_field(form, form.fields, '') }}
-
diff --git a/user/plugins/form/templates/forms/default/data.txt.twig b/user/plugins/form/templates/forms/default/data.txt.twig
index 20fe474..c34fdf4 100644
--- a/user/plugins/form/templates/forms/default/data.txt.twig
+++ b/user/plugins/form/templates/forms/default/data.txt.twig
@@ -1,14 +1,16 @@
{%- macro render_field(form, fields, scope) %}
{%- import _self as self %}
{%- for index, field in fields %}
- {%- set input = attribute(field, "input@") %}
- {%- if input is null or input == true %}
- {%- set value = form.value(scope ~ (field.name ?? index)) %}
- {{- scope ~ (field.name ?? index) }}: {{ string(value is iterable ? value|json_encode : value|escape('yaml')) ~ "\r\n" }}
- {%- else %}
- {%- if field.fields %}
+ {%- set show_field = attribute(field, "input@") ?? field.store ?? true %}
+ {%- if field.fields %}
{%- set new_scope = field.nest_id ? scope ~ field.name ~ '.' : scope -%}
{{- self.render_field(form, field.fields, new_scope) }}
+ {%- else %}
+ {%- if show_field %}
+ {%- set value = form.value(scope ~ (field.name ?? index)) -%}
+ {%- if value -%}
+ {{- field.label }}: {{ string(value is iterable ? value|json_encode : value|e) ~ "\r\n" }}
+ {%- endif -%}
{%- endif %}
{%- endif %}
{%- endfor %}
@@ -16,4 +18,4 @@
{%- import _self as macro %}
{%- autoescape false %}
{{- macro.render_field(form, form.fields, '') ~ "\r\n" }}
-{%- endautoescape %}
\ No newline at end of file
+{%- endautoescape %}
diff --git a/user/plugins/form/templates/forms/default/field.html.twig b/user/plugins/form/templates/forms/default/field.html.twig
index 68a87e7..e47b2c9 100644
--- a/user/plugins/form/templates/forms/default/field.html.twig
+++ b/user/plugins/form/templates/forms/default/field.html.twig
@@ -1,4 +1,7 @@
-{% if not field.validate.ignore %}
+{% if not field.validate.ignore %}
+
+{% use 'forms/layouts/field-variables.html.twig' %}
+{% block field_override_variables_before %}{% endblock %}
{% set field_name = (scope ~ field.name)|fieldName %}
{% set vertical = field.style == 'vertical' %}
@@ -7,11 +10,11 @@
{% set toggleable = field.toggleable ?? false %}
{% if toggleable %}
{% set originalValue = originalValue is defined ? originalValue : value %}
- {% set toggleableChecked = originalValue is not null and originalValue is not empty %}
+ {% set toggleableChecked = originalValue is not null %}
{% elseif field.overridable %}
{% set toggleable = true %}
{% set default = form.getDefaultValue(field.name) ?? field.default %}
- {% set toggleableChecked = value != default %}
+ {% set toggleableChecked = value is not null and value != default %}
{% endif %}
{% set cookie_name = 'forms-' ~ form.name ~ '-' ~ field.name %}
@@ -27,6 +30,12 @@
{# DEPRECATED: Needed by old form fields; remove when backwards compatibility breaks are allowed #}
{% set isDisabledToggleable = toggleable and not toggleableChecked %}
+{% if toggleable %}
+ {% set form_field_toggleable %}
+ {% include 'forms/default/toggleable.html.twig' with {checked: toggleableChecked} %}
+ {% endset %}
+{% endif %}
+
{% set errors = attribute(form.messages, field.name) %}
{% set required = client_side_validation and field.validate.required in ['on', 'true', 1] %}
{% set autofocus = (inline_errors == false) and field.autofocus in ['on', 'true', 1] %}
@@ -35,105 +44,112 @@
{% set autofocus = true %}
{% endif %}
-{% block field %}
-
+{# Show Label logic #}
+{% set show_label = field.label is not same as(false) and field.display_label is not same as(false )%}
+
+{# Label Classes #}
+{% set layout_form_field_outer_label_classes = ((form_field_outer_label_classes ?: 'form-label') ~ ' ' ~ field.labelclasses)|trim %}
+{% set layout_form_field_label_classes = (form_field_label_classes ?: 'inline')|trim %}
+{% set form_field_label_trim = toggleable ? 'toggleable' %}
+
+{# Field Outer Data classes #}
+{% set layout_form_field_outer_data_classes = ((form_field_outer_data_classes ?: ' form-data') ~ ' ' ~ field.dataclasses)|trim %}
+
+{# Field Wrapper classes #}
+{% set layout_form_field_wrapper_classes = ((form_field_wrapper_classes ?: ' form-input-wrapper') ~ ' ' ~ field.wrapper_classes)|trim %}
+
+{# Field input classes #}
+{% if field|of_type('array') %}
+ {% if field.classes %}
+ {% set field = field|merge({'classes': field.classes ~ ' ' ~ block('field_input_classes')|trim }) %}
+ {% else %}
+ {% set field = field|merge({'classes': block('field_input_classes') }) %}
+ {% endif %}
+{% endif %}
+{% set layout_form_field_input_classes = (form_field_input_classes ~ ' ' ~ field.classes)|trim %}
+
+{# Inline error classes #}
+{% set form_field_inline_error_classes = form_field_inline_error_classes ?: ' form-errors' %}
+
+{# Field extra classes #}
+{% set form_field_extra_wrapper_classes = 'form-extra-wrapper ' ~ field.wrapper_classes %}
+
+{# Field For #}
+{% set form_field_for = toggleable ? 'toggleable_' ~ field.name : field.id|e %}
+
+{# Field Label #}
+{% set form_field_label = field.markdown ? field.label|markdown(false) : field.label %}
+{% set form_field_label = form_field_label|default(field.name|capitalize)|t %}
+
+{# Field Help #}
+{% if field.help %}
+ {% set form_field_help = field.markdown ? field.help|t|markdown(false)|e : field.help|t|e %}
+{% endif %}
+
+{# Field Requied #}
+{% set form_field_required = field.validate.required in ['on', 'true', 1] ? true : false %}
+
+{# Field Description #}
+{% set form_field_description = field.markdown ? field.description|t|markdown(false)|raw : field.description|t|raw %}
+
+{% extends 'forms/layouts/field.html.twig' %}
+
+{% block global_attributes %}
+ data-grav-field="{{ field.type }}"
+ data-grav-disabled="{{ toggleable and toggleableChecked }}"
+ data-grav-default="{{ field.default|json_encode()|e('html_attr') }}"
{% endblock %}
+{% block input_attributes %}
+ class="{{ layout_form_field_input_classes|trim }} {{ field.size }}"
+ {% if field.id is defined %}id="{{ field.id|e }}" {% endif %}
+ {% if field.style is defined %}style="{{ field.style|e }}" {% endif %}
+ {% if field.disabled or isDisabledToggleable %}disabled="disabled"{% endif %}
+ {% if field.placeholder %}placeholder="{{ field.placeholder|t|e('html_attr') }}"{% endif %}
+ {% if autofocus %}autofocus="autofocus"{% endif %}
+ {% if field.novalidate in ['on', 'true', 1] %}novalidate="novalidate"{% endif %}
+ {% if field.readonly in ['on', 'true', 1] %}readonly="readonly"{% endif %}
+ {% if field.autocomplete is defined %}autocomplete="{{ field.autocomplete }}"{% endif %}
+ {% if field.autocapitalize in ['off', 'characters', 'words', 'sentences'] %}autocapitalize="{{ field.autocapitalize }}"{% endif %}
+ {% if field.inputmode in ['none', 'text', 'decimal', 'numeric', 'tel', 'search', 'email', 'url'] %}inputmode="{{ field.inputmode }}"{% endif %}
+ {% if field.tabindex %}tabindex="{{ field.tabindex }}"{% endif %}
+ {% if field.spellcheck in ['true', 'false'] %}spellcheck="{{ field.spellcheck }}"{% endif %}
+ {% if required %}required="required"{% endif %}
+ {% if field.validate.pattern %}pattern="{{ field.validate.pattern|e }}"{% endif %}
+ {% if field.validate.message %}title="{{ field.validate.message|t|e }}"
+ {% elseif field.title is defined %}title="{{ field.title|t|e }}" {% endif %}
+
+ {# Support key/value and .name/.value styles #}
+ {% if field.attributes is defined %}
+ {% for key,attribute in field.attributes %}
+ {% if attribute|of_type('array') %}
+ {{ attribute.name }}="{{ attribute.value|e('html_attr') }}"
+ {% else %}
+ {{ key }}="{{ attribute|e('html_attr') }}"
+ {% endif %}
+ {% endfor %}
+ {% endif %}
+
+ {# Support for Custom data attributes#}
+ {% if field.datasets %}
+ {% for key, attribute in field.datasets %}
+ data-{{ key }}="{{ attribute|e('html_attr') }}"
+ {% endfor %}
+ {% endif %}
+{% endblock %}
+
+
+
{% endif %}
diff --git a/user/plugins/form/templates/forms/default/fields.html.twig b/user/plugins/form/templates/forms/default/fields.html.twig
index 2baf312..8e88096 100644
--- a/user/plugins/form/templates/forms/default/fields.html.twig
+++ b/user/plugins/form/templates/forms/default/fields.html.twig
@@ -6,10 +6,10 @@
{% endif %}
{% set value = form ? form.value(field_name) : data.value(field_name) %}
- {% block field_open %}{% endblock %}
+ {% block inner_markup_field_open %}{% endblock %}
{% block field %}
{% include ["forms/fields/#{field.type}/#{field.type}.html.twig", 'forms/fields/text/text.html.twig'] %}
{% endblock %}
- {% block field_close %}{% endblock %}
+ {% block inner_markup_field_close %}{% endblock %}
{% endif %}
{% endfor %}
diff --git a/user/plugins/form/templates/forms/default/form.html.twig b/user/plugins/form/templates/forms/default/form.html.twig
index f44d5f0..8174dd1 100644
--- a/user/plugins/form/templates/forms/default/form.html.twig
+++ b/user/plugins/form/templates/forms/default/form.html.twig
@@ -4,13 +4,16 @@
{% include 'partials/form-messages.html.twig' %}
-{% set scope = scope ?: 'data.' %}
+{% set scope = scope ?: form.scope is defined ? form.scope : 'data.' %}
{% set multipart = '' %}
{% set blueprints = blueprints ?? form.blueprint() %}
{% set method = form.method|upper|default('POST') %}
{% set client_side_validation = form.client_side_validation is not null ? form.client_side_validation : config.plugins.form.client_side_validation|default(true) %}
{% set inline_errors = form.inline_errors is not null ? form.inline_errors : config.plugins.form.inline_errors(false) %}
+{% set data = data ?? form.data %}
+{% set context = context ?? data %}
+
{% for field in form.fields %}
{% if (method == 'POST' and field.type == 'file') %}
{% set multipart = ' enctype="multipart/form-data"' %}
@@ -18,10 +21,10 @@
{% endfor %}
{% set action = form.action ?: page.route ~ uri.params %}
-{% set action = action starts with 'http' ? action : base_url ~ action %}
-
+{% set action = (action starts with 'http') or (action starts with '#') ? action : base_url ~ action %}
+{% set action = action|trim('/', 'right') %}
{% if (action == base_url_relative) %}
- {% set action = base_url_relative ~ '/' ~ page.slug %}
+ {% set action = base_url_relative ~ '/' %}
{% endif %}
{% if form.keep_alive %}
@@ -44,88 +47,129 @@
window.GravForm.translations = Object.assign({}, window.GravForm.translations || {}, { PLUGIN_FORM: {} });
", {'group': 'bottom', 'position': 'before'}) %}
-
{% if config.forms.dropzone.enabled %}
diff --git a/user/plugins/form/templates/forms/fields/avatar/avatar.html.twig b/user/plugins/form/templates/forms/fields/avatar/avatar.html.twig
index ad05794..8776dbb 100644
--- a/user/plugins/form/templates/forms/fields/avatar/avatar.html.twig
+++ b/user/plugins/form/templates/forms/fields/avatar/avatar.html.twig
@@ -3,8 +3,8 @@
{% block field %}
{% set avatar = form.value('avatar') %}
{% if avatar %}
-
+
{% else %}
-
+
{% endif %}
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/user/plugins/form/templates/forms/fields/captcha/captcha.html.twig b/user/plugins/form/templates/forms/fields/captcha/captcha.html.twig
index 694e45b..f9a654a 100644
--- a/user/plugins/form/templates/forms/fields/captcha/captcha.html.twig
+++ b/user/plugins/form/templates/forms/fields/captcha/captcha.html.twig
@@ -10,11 +10,11 @@
{% block input %}
{% if not site_key %}
-
+
{% elseif config.plugins.form.recaptcha.version == 3 %}
- {#{% do assets.addJs('https://www.google.com/recaptcha/api.js?render='~site_key) %}#}
-
- #}
+
{% elseif config.plugins.form.recaptcha.version == '2-invisible' %}
-
{% else %}
-