Файловый менеджер - Редактировать - /home/clickysoft/public_html/jmapi5.clickysoft.net/mime.zip
Назад
PK 6K�Z�ӆ)� � BodyRendererInterface.phpnu �[��� <?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Mime; /** * @author Fabien Potencier <fabien@symfony.com> */ interface BodyRendererInterface { public function render(Message $message): void; } PK 6K�Z��"� � RawMessage.phpnu �[��� <?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Mime; use Symfony\Component\Mime\Exception\LogicException; /** * @author Fabien Potencier <fabien@symfony.com> */ class RawMessage { /** @var iterable<string>|string|resource */ private $message; private bool $isGeneratorClosed; /** * @param iterable<string>|string|resource $message */ public function __construct(mixed $message) { $this->message = $message; } public function __destruct() { if (\is_resource($this->message)) { fclose($this->message); } } public function toString(): string { if (\is_string($this->message)) { return $this->message; } if (\is_resource($this->message)) { return stream_get_contents($this->message, -1, 0); } $message = ''; foreach ($this->message as $chunk) { $message .= $chunk; } return $this->message = $message; } public function toIterable(): iterable { if ($this->isGeneratorClosed ?? false) { trigger_deprecation('symfony/mime', '6.4', 'Sending an email with a closed generator is deprecated and will throw in 7.0.'); // throw new LogicException('Unable to send the email as its generator is already closed.'); } if (\is_string($this->message)) { yield $this->message; return; } if (\is_resource($this->message)) { rewind($this->message); while ($line = fgets($this->message)) { yield $line; } return; } if ($this->message instanceof \Generator) { $message = fopen('php://temp', 'w+'); foreach ($this->message as $chunk) { fwrite($message, $chunk); yield $chunk; } $this->isGeneratorClosed = !$this->message->valid(); $this->message = $message; return; } foreach ($this->message as $chunk) { yield $chunk; } } /** * @return void * * @throws LogicException if the message is not valid */ public function ensureValidity() { } public function __serialize(): array { return [$this->toString()]; } public function __unserialize(array $data): void { [$this->message] = $data; } } PK 6K�Zc�i�~ ~ 5 HtmlToTextConverter/LeagueHtmlToMarkdownConverter.phpnu �[��� <?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Mime\HtmlToTextConverter; use League\HTMLToMarkdown\HtmlConverter; use League\HTMLToMarkdown\HtmlConverterInterface; /** * @author Fabien Potencier <fabien@symfony.com> */ class LeagueHtmlToMarkdownConverter implements HtmlToTextConverterInterface { public function __construct( private HtmlConverterInterface $converter = new HtmlConverter([ 'hard_break' => true, 'strip_tags' => true, 'remove_nodes' => 'head style', ]), ) { } public function convert(string $html, string $charset): string { return $this->converter->convert($html); } } PK 6K�Z�>G�M M 2 HtmlToTextConverter/DefaultHtmlToTextConverter.phpnu �[��� <?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Mime\HtmlToTextConverter; /** * @author Fabien Potencier <fabien@symfony.com> */ class DefaultHtmlToTextConverter implements HtmlToTextConverterInterface { public function convert(string $html, string $charset): string { return strip_tags(preg_replace('{<(head|style)\b.*?</\1>}is', '', $html)); } } PK 6K�ZS�"o o 4 HtmlToTextConverter/HtmlToTextConverterInterface.phpnu �[��� <?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Mime\HtmlToTextConverter; /** * @author Fabien Potencier <fabien@symfony.com> */ interface HtmlToTextConverterInterface { /** * Converts an HTML representation of a Message to a text representation. * * The output must use the same charset as the HTML one. */ public function convert(string $html, string $charset): string; } PK 6K�Z�7j� � composer.jsonnu �[��� { "name": "symfony/mime", "type": "library", "description": "Allows manipulating MIME messages", "keywords": ["mime", "mime-type"], "homepage": "https://symfony.com", "license": "MIT", "authors": [ { "name": "Fabien Potencier", "email": "fabien@symfony.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], "require": { "php": ">=8.1", "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-intl-idn": "^1.10", "symfony/polyfill-mbstring": "^1.0" }, "require-dev": { "egulias/email-validator": "^2.1.10|^3.1|^4", "league/html-to-markdown": "^5.0", "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", "symfony/dependency-injection": "^5.4|^6.0|^7.0", "symfony/process": "^5.4|^6.4|^7.0", "symfony/property-access": "^5.4|^6.0|^7.0", "symfony/property-info": "^5.4|^6.0|^7.0", "symfony/serializer": "^6.4.3|^7.0.3" }, "conflict": { "egulias/email-validator": "~3.0.0", "phpdocumentor/reflection-docblock": "<3.2.2", "phpdocumentor/type-resolver": "<1.4.0", "symfony/mailer": "<5.4", "symfony/serializer": "<6.4.3|>7.0,<7.0.3" }, "autoload": { "psr-4": { "Symfony\\Component\\Mime\\": "" }, "exclude-from-classmap": [ "/Tests/" ] }, "minimum-stability": "dev" } PK 6K�Z �)R> > . DependencyInjection/AddMimeTypeGuesserPass.phpnu �[��� <?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Mime\DependencyInjection; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; /** * Registers custom mime types guessers. * * @author Fabien Potencier <fabien@symfony.com> */ class AddMimeTypeGuesserPass implements CompilerPassInterface { /** * @return void */ public function process(ContainerBuilder $container) { if ($container->has('mime_types')) { $definition = $container->findDefinition('mime_types'); foreach ($container->findTaggedServiceIds('mime.mime_type_guesser', true) as $id => $attributes) { $definition->addMethodCall('registerGuesser', [new Reference($id)]); } } } } PK 6K�Z"Gg g DraftEmail.phpnu �[��� <?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Mime; use Symfony\Component\Mime\Header\Headers; use Symfony\Component\Mime\Part\AbstractPart; /** * @author Kevin Bond <kevinbond@gmail.com> */ class DraftEmail extends Email { public function __construct(?Headers $headers = null, ?AbstractPart $body = null) { parent::__construct($headers, $body); $this->getHeaders()->addTextHeader('X-Unsent', '1'); } /** * Override default behavior as draft emails do not require From/Sender/Date/Message-ID headers. * These are added by the client that actually sends the email. */ public function getPreparedHeaders(): Headers { $headers = clone $this->getHeaders(); if (!$headers->has('MIME-Version')) { $headers->addTextHeader('MIME-Version', '1.0'); } $headers->remove('Bcc'); return $headers; } } PK 6K�Z+��� � Part/TextPart.phpnu �[��� <?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Mime\Part; use Symfony\Component\Mime\Encoder\Base64ContentEncoder; use Symfony\Component\Mime\Encoder\ContentEncoderInterface; use Symfony\Component\Mime\Encoder\EightBitContentEncoder; use Symfony\Component\Mime\Encoder\QpContentEncoder; use Symfony\Component\Mime\Exception\InvalidArgumentException; use Symfony\Component\Mime\Header\Headers; /** * @author Fabien Potencier <fabien@symfony.com> */ class TextPart extends AbstractPart { /** @internal */ protected Headers $_headers; private static array $encoders = []; /** @var resource|string|File */ private $body; private ?string $charset; private string $subtype; private ?string $disposition = null; private ?string $name = null; private string $encoding; private ?bool $seekable = null; /** * @param resource|string|File $body Use a File instance to defer loading the file until rendering */ public function __construct($body, ?string $charset = 'utf-8', string $subtype = 'plain', ?string $encoding = null) { parent::__construct(); if (!\is_string($body) && !\is_resource($body) && !$body instanceof File) { throw new \TypeError(sprintf('The body of "%s" must be a string, a resource, or an instance of "%s" (got "%s").', self::class, File::class, get_debug_type($body))); } if ($body instanceof File) { $path = $body->getPath(); if ((is_file($path) && !is_readable($path)) || is_dir($path)) { throw new InvalidArgumentException(sprintf('Path "%s" is not readable.', $path)); } } $this->body = $body; $this->charset = $charset; $this->subtype = $subtype; $this->seekable = \is_resource($body) ? stream_get_meta_data($body)['seekable'] && 0 === fseek($body, 0, \SEEK_CUR) : null; if (null === $encoding) { $this->encoding = $this->chooseEncoding(); } else { if ('quoted-printable' !== $encoding && 'base64' !== $encoding && '8bit' !== $encoding) { throw new InvalidArgumentException(sprintf('The encoding must be one of "quoted-printable", "base64", or "8bit" ("%s" given).', $encoding)); } $this->encoding = $encoding; } } public function getMediaType(): string { return 'text'; } public function getMediaSubtype(): string { return $this->subtype; } /** * @param string $disposition one of attachment, inline, or form-data * * @return $this */ public function setDisposition(string $disposition): static { $this->disposition = $disposition; return $this; } /** * @return ?string null or one of attachment, inline, or form-data */ public function getDisposition(): ?string { return $this->disposition; } /** * Sets the name of the file (used by FormDataPart). * * @return $this */ public function setName(string $name): static { $this->name = $name; return $this; } /** * Gets the name of the file. */ public function getName(): ?string { return $this->name; } public function getBody(): string { if ($this->body instanceof File) { if (false === $ret = @file_get_contents($this->body->getPath())) { throw new InvalidArgumentException(error_get_last()['message']); } return $ret; } if (null === $this->seekable) { return $this->body; } if ($this->seekable) { rewind($this->body); } return stream_get_contents($this->body) ?: ''; } public function bodyToString(): string { return $this->getEncoder()->encodeString($this->getBody(), $this->charset); } public function bodyToIterable(): iterable { if ($this->body instanceof File) { $path = $this->body->getPath(); if (false === $handle = @fopen($path, 'r', false)) { throw new InvalidArgumentException(sprintf('Unable to open path "%s".', $path)); } yield from $this->getEncoder()->encodeByteStream($handle); } elseif (null !== $this->seekable) { if ($this->seekable) { rewind($this->body); } yield from $this->getEncoder()->encodeByteStream($this->body); } else { yield $this->getEncoder()->encodeString($this->body); } } public function getPreparedHeaders(): Headers { $headers = parent::getPreparedHeaders(); $headers->setHeaderBody('Parameterized', 'Content-Type', $this->getMediaType().'/'.$this->getMediaSubtype()); if ($this->charset) { $headers->setHeaderParameter('Content-Type', 'charset', $this->charset); } if ($this->name && 'form-data' !== $this->disposition) { $headers->setHeaderParameter('Content-Type', 'name', $this->name); } $headers->setHeaderBody('Text', 'Content-Transfer-Encoding', $this->encoding); if (!$headers->has('Content-Disposition') && null !== $this->disposition) { $headers->setHeaderBody('Parameterized', 'Content-Disposition', $this->disposition); if ($this->name) { $headers->setHeaderParameter('Content-Disposition', 'name', $this->name); } } return $headers; } public function asDebugString(): string { $str = parent::asDebugString(); if (null !== $this->charset) { $str .= ' charset: '.$this->charset; } if (null !== $this->disposition) { $str .= ' disposition: '.$this->disposition; } return $str; } private function getEncoder(): ContentEncoderInterface { if ('8bit' === $this->encoding) { return self::$encoders[$this->encoding] ??= new EightBitContentEncoder(); } if ('quoted-printable' === $this->encoding) { return self::$encoders[$this->encoding] ??= new QpContentEncoder(); } return self::$encoders[$this->encoding] ??= new Base64ContentEncoder(); } private function chooseEncoding(): string { if (null === $this->charset) { return 'base64'; } return 'quoted-printable'; } public function __sleep(): array { // convert resources to strings for serialization if (null !== $this->seekable) { $this->body = $this->getBody(); $this->seekable = null; } $this->_headers = $this->getHeaders(); return ['_headers', 'body', 'charset', 'subtype', 'disposition', 'name', 'encoding']; } /** * @return void */ public function __wakeup() { $r = new \ReflectionProperty(AbstractPart::class, 'headers'); $r->setValue($this, $this->_headers); unset($this->_headers); } } PK 6K�Z���� Part/SMimePart.phpnu �[��� <?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Mime\Part; use Symfony\Component\Mime\Header\Headers; /** * @author Sebastiaan Stok <s.stok@rollerscapes.net> */ class SMimePart extends AbstractPart { /** @internal */ protected Headers $_headers; private iterable|string $body; private string $type; private string $subtype; private array $parameters; public function __construct(iterable|string $body, string $type, string $subtype, array $parameters) { parent::__construct(); $this->body = $body; $this->type = $type; $this->subtype = $subtype; $this->parameters = $parameters; } public function getMediaType(): string { return $this->type; } public function getMediaSubtype(): string { return $this->subtype; } public function bodyToString(): string { if (\is_string($this->body)) { return $this->body; } $body = ''; foreach ($this->body as $chunk) { $body .= $chunk; } $this->body = $body; return $body; } public function bodyToIterable(): iterable { if (\is_string($this->body)) { yield $this->body; return; } $body = ''; foreach ($this->body as $chunk) { $body .= $chunk; yield $chunk; } $this->body = $body; } public function getPreparedHeaders(): Headers { $headers = clone parent::getHeaders(); $headers->setHeaderBody('Parameterized', 'Content-Type', $this->getMediaType().'/'.$this->getMediaSubtype()); foreach ($this->parameters as $name => $value) { $headers->setHeaderParameter('Content-Type', $name, $value); } return $headers; } public function __sleep(): array { // convert iterables to strings for serialization if (is_iterable($this->body)) { $this->body = $this->bodyToString(); } $this->_headers = $this->getHeaders(); return ['_headers', 'body', 'type', 'subtype', 'parameters']; } public function __wakeup(): void { $r = new \ReflectionProperty(AbstractPart::class, 'headers'); $r->setValue($this, $this->_headers); unset($this->_headers); } } PK 6K�Zkgs+G G Part/File.phpnu �[��� <?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Mime\Part; use Symfony\Component\Mime\MimeTypes; /** * @author Fabien Potencier <fabien@symfony.com> */ class File { private static MimeTypes $mimeTypes; public function __construct( private string $path, private ?string $filename = null, ) { } public function getPath(): string { return $this->path; } public function getContentType(): string { $ext = strtolower(pathinfo($this->path, \PATHINFO_EXTENSION)); self::$mimeTypes ??= new MimeTypes(); return self::$mimeTypes->getMimeTypes($ext)[0] ?? 'application/octet-stream'; } public function getSize(): int { return filesize($this->path); } public function getFilename(): string { return $this->filename ??= basename($this->getPath()); } } PK 6K�Zr�M� � Part/DataPart.phpnu �[��� <?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Mime\Part; use Symfony\Component\Mime\Exception\InvalidArgumentException; use Symfony\Component\Mime\Header\Headers; /** * @author Fabien Potencier <fabien@symfony.com> */ class DataPart extends TextPart { /** @internal */ protected array $_parent; private ?string $filename = null; private string $mediaType; private ?string $cid = null; /** * @param resource|string|File $body Use a File instance to defer loading the file until rendering */ public function __construct($body, ?string $filename = null, ?string $contentType = null, ?string $encoding = null) { if ($body instanceof File && !$filename) { $filename = $body->getFilename(); } $contentType ??= $body instanceof File ? $body->getContentType() : 'application/octet-stream'; [$this->mediaType, $subtype] = explode('/', $contentType); parent::__construct($body, null, $subtype, $encoding); if (null !== $filename) { $this->filename = $filename; $this->setName($filename); } $this->setDisposition('attachment'); } public static function fromPath(string $path, ?string $name = null, ?string $contentType = null): self { return new self(new File($path), $name, $contentType); } /** * @return $this */ public function asInline(): static { return $this->setDisposition('inline'); } /** * @return $this */ public function setContentId(string $cid): static { if (!str_contains($cid, '@')) { throw new InvalidArgumentException(sprintf('Invalid cid "%s".', $cid)); } $this->cid = $cid; return $this; } public function getContentId(): string { return $this->cid ?: $this->cid = $this->generateContentId(); } public function hasContentId(): bool { return null !== $this->cid; } public function getMediaType(): string { return $this->mediaType; } public function getPreparedHeaders(): Headers { $headers = parent::getPreparedHeaders(); if (null !== $this->cid) { $headers->setHeaderBody('Id', 'Content-ID', $this->cid); } if (null !== $this->filename) { $headers->setHeaderParameter('Content-Disposition', 'filename', $this->filename); } return $headers; } public function asDebugString(): string { $str = parent::asDebugString(); if (null !== $this->filename) { $str .= ' filename: '.$this->filename; } return $str; } public function getFilename(): ?string { return $this->filename; } public function getContentType(): string { return implode('/', [$this->getMediaType(), $this->getMediaSubtype()]); } private function generateContentId(): string { return bin2hex(random_bytes(16)).'@symfony'; } public function __sleep(): array { // converts the body to a string parent::__sleep(); $this->_parent = []; foreach (['body', 'charset', 'subtype', 'disposition', 'name', 'encoding'] as $name) { $r = new \ReflectionProperty(TextPart::class, $name); $this->_parent[$name] = $r->getValue($this); } $this->_headers = $this->getHeaders(); return ['_headers', '_parent', 'filename', 'mediaType']; } /** * @return void */ public function __wakeup() { $r = new \ReflectionProperty(AbstractPart::class, 'headers'); $r->setValue($this, $this->_headers); unset($this->_headers); if (!\is_array($this->_parent)) { throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); } foreach (['body', 'charset', 'subtype', 'disposition', 'name', 'encoding'] as $name) { if (null !== $this->_parent[$name] && !\is_string($this->_parent[$name]) && !$this->_parent[$name] instanceof File) { throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); } $r = new \ReflectionProperty(TextPart::class, $name); $r->setValue($this, $this->_parent[$name]); } unset($this->_parent); } } PK 6K�Z;��c� � Part/Multipart/DigestPart.phpnu �[��� <?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Mime\Part\Multipart; use Symfony\Component\Mime\Part\AbstractMultipartPart; use Symfony\Component\Mime\Part\MessagePart; /** * @author Fabien Potencier <fabien@symfony.com> */ final class DigestPart extends AbstractMultipartPart { public function __construct(MessagePart ...$parts) { parent::__construct(...$parts); } public function getMediaSubtype(): string { return 'digest'; } } PK 6K�Z��S�' ' "