Файловый менеджер - Редактировать - /home/avadvi5/calendar.aeronextgen.com/src.zip
Ðазад
PK ���\ވ?0 0 ! Cache/ReadOnlyFilesystemCache.phpnu �[��� <?php /* * This file is part of Twig. * * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Twig\Cache; /** * Implements a cache on the filesystem that can only be read, not written to. * * @author Quentin Devos <quentin@devos.pm> */ class ReadOnlyFilesystemCache extends FilesystemCache { public function write(string $key, string $content): void { // Do nothing with the content, it's a read-only filesystem. } } PK ���\*�� � Cache/CacheInterface.phpnu �[��� <?php /* * This file is part of Twig. * * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Twig\Cache; /** * Interface implemented by cache classes. * * It is highly recommended to always store templates on the filesystem to * benefit from the PHP opcode cache. This interface is mostly useful if you * need to implement a custom strategy for storing templates on the filesystem. * * @author Andrew Tch <andrew@noop.lv> */ interface CacheInterface { /** * Generates a cache key for the given template class name. */ public function generateKey(string $name, string $className): string; /** * Writes the compiled template to cache. * * @param string $content The template representation as a PHP class */ public function write(string $key, string $content): void; /** * Loads a template from the cache. */ public function load(string $key): void; /** * Returns the modification timestamp of a key. */ public function getTimestamp(string $key): int; } PK ���\,�h h Cache/ChainCache.phpnu �[��� <?php /* * This file is part of Twig. * * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Twig\Cache; /** * Chains several caches together. * * Cached items are fetched from the first cache having them in its data store. * They are saved and deleted in all adapters at once. * * @author Quentin Devos <quentin@devos.pm> */ final class ChainCache implements CacheInterface, RemovableCacheInterface { /** * @param iterable<CacheInterface> $caches The ordered list of caches used to store and fetch cached items */ public function __construct( private iterable $caches, ) { } public function generateKey(string $name, string $className): string { return $className.'#'.$name; } public function write(string $key, string $content): void { $splitKey = $this->splitKey($key); foreach ($this->caches as $cache) { $cache->write($cache->generateKey(...$splitKey), $content); } } public function load(string $key): void { [$name, $className] = $this->splitKey($key); foreach ($this->caches as $cache) { $cache->load($cache->generateKey($name, $className)); if (class_exists($className, false)) { break; } } } public function getTimestamp(string $key): int { $splitKey = $this->splitKey($key); foreach ($this->caches as $cache) { if (0 < $timestamp = $cache->getTimestamp($cache->generateKey(...$splitKey))) { return $timestamp; } } return 0; } public function remove(string $name, string $cls): void { foreach ($this->caches as $cache) { if ($cache instanceof RemovableCacheInterface) { $cache->remove($name, $cls); } } } /** * @return string[] */ private function splitKey(string $key): array { return array_reverse(explode('#', $key, 2)); } } PK ���\��� Cache/NullCache.phpnu �[��� <?php /* * This file is part of Twig. * * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Twig\Cache; /** * Implements a no-cache strategy. * * @author Fabien Potencier <fabien@symfony.com> */ final class NullCache implements CacheInterface, RemovableCacheInterface { public function generateKey(string $name, string $className): string { return ''; } public function write(string $key, string $content): void { } public function load(string $key): void { } public function getTimestamp(string $key): int { return 0; } public function remove(string $name, string $cls): void { } } PK ���\�y�~ Cache/FilesystemCache.phpnu �[��� <?php /* * This file is part of Twig. * * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Twig\Cache; /** * Implements a cache on the filesystem. * * @author Andrew Tch <andrew@noop.lv> */ class FilesystemCache implements CacheInterface, RemovableCacheInterface { public const FORCE_BYTECODE_INVALIDATION = 1; private $directory; private $options; public function __construct(string $directory, int $options = 0) { $this->directory = rtrim($directory, '\/').'/'; $this->options = $options; } public function generateKey(string $name, string $className): string { $hash = hash(\PHP_VERSION_ID < 80100 ? 'sha256' : 'xxh128', $className); return $this->directory.$hash[0].$hash[1].'/'.$hash.'.php'; } public function load(string $key): void { if (is_file($key)) { @include_once $key; } } public function write(string $key, string $content): void { $dir = \dirname($key); if (!is_dir($dir)) { if (false === @mkdir($dir, 0777, true)) { clearstatcache(true, $dir); if (!is_dir($dir)) { throw new \RuntimeException(\sprintf('Unable to create the cache directory (%s).', $dir)); } } } elseif (!is_writable($dir)) { throw new \RuntimeException(\sprintf('Unable to write in the cache directory (%s).', $dir)); } $tmpFile = tempnam($dir, basename($key)); if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $key)) { @chmod($key, 0666 & ~umask()); if (self::FORCE_BYTECODE_INVALIDATION == ($this->options & self::FORCE_BYTECODE_INVALIDATION)) { // Compile cached file into bytecode cache if (\function_exists('opcache_invalidate') && filter_var(\ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN)) { @opcache_invalidate($key, true); } elseif (\function_exists('apc_compile_file')) { apc_compile_file($key); } } return; } throw new \RuntimeException(\sprintf('Failed to write cache file "%s".', $key)); } public function remove(string $name, string $cls): void { $key = $this->generateKey($name, $cls); if (!@unlink($key) && file_exists($key)) { throw new \RuntimeException(\sprintf('Failed to delete cache file "%s".', $key)); } } public function getTimestamp(string $key): int { if (!is_file($key)) { return 0; } return (int) @filemtime($key); } } PK ���\�A�} } ! Cache/RemovableCacheInterface.phpnu �[��� <?php /* * This file is part of Twig. * * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Twig\Cache; /** * @author Fabien Potencier <fabien@symfony.com> */ interface RemovableCacheInterface { public function remove(string $name, string $cls): void; } PK ���\l�R^4 4 Profiler/Profile.phpnu �[��� <?php /* * This file is part of Twig. * * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Twig\Profiler; /** * @author Fabien Potencier <fabien@symfony.com> */ final class Profile implements \IteratorAggregate, \Serializable { public const ROOT = 'ROOT'; public const BLOCK = 'block'; public const TEMPLATE = 'template'; public const MACRO = 'macro'; private $starts = []; private $ends = []; private $profiles = []; public function __construct( private string $template = 'main', private string $type = self::ROOT, private string $name = 'main', ) { $this->name = str_starts_with($name, '__internal_') ? 'INTERNAL' : $name; $this->enter(); } public function getTemplate(): string { return $this->template; } public function getType(): string { return $this->type; } public function getName(): string { return $this->name; } public function isRoot(): bool { return self::ROOT === $this->type; } public function isTemplate(): bool { return self::TEMPLATE === $this->type; } public function isBlock(): bool { return self::BLOCK === $this->type; } public function isMacro(): bool { return self::MACRO === $this->type; } /** * @return Profile[] */ public function getProfiles(): array { return $this->profiles; } public function addProfile(self $profile): void { $this->profiles[] = $profile; } /** * Returns the duration in microseconds. */ public function getDuration(): float { if ($this->isRoot() && $this->profiles) { // for the root node with children, duration is the sum of all child durations $duration = 0; foreach ($this->profiles as $profile) { $duration += $profile->getDuration(); } return $duration; } return isset($this->ends['wt']) && isset($this->starts['wt']) ? $this->ends['wt'] - $this->starts['wt'] : 0; } /** * Returns the start time in microseconds. */ public function getStartTime(): float { return $this->starts['wt'] ?? 0.0; } /** * Returns the end time in microseconds. */ public function getEndTime(): float { return $this->ends['wt'] ?? 0.0; } /** * Returns the memory usage in bytes. */ public function getMemoryUsage(): int { return isset($this->ends['mu']) && isset($this->starts['mu']) ? $this->ends['mu'] - $this->starts['mu'] : 0; } /** * Returns the peak memory usage in bytes. */ public function getPeakMemoryUsage(): int { return isset($this->ends['pmu']) && isset($this->starts['pmu']) ? $this->ends['pmu'] - $this->starts['pmu'] : 0; } /** * Starts the profiling. */ public function enter(): void { $this->starts = [ 'wt' => microtime(true), 'mu' => memory_get_usage(), 'pmu' => memory_get_peak_usage(), ]; } /** * Stops the profiling. */ public function leave(): void { $this->ends = [ 'wt' => microtime(true), 'mu' => memory_get_usage(), 'pmu' => memory_get_peak_usage(), ]; } public function reset(): void { $this->starts = $this->ends = $this->profiles = []; $this->enter(); } public function getIterator(): \Traversable { return new \ArrayIterator($this->profiles); } public function serialize(): string { return serialize($this->__serialize()); } public function unserialize($data): void { $this->__unserialize(unserialize($data)); } /** * @internal */ public function __serialize(): array { return [$this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles]; } /** * @internal */ public function __unserialize(array $data): void { [$this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles] = $data; } } PK ���\J��� � Profiler/Dumper/BaseDumper.phpnu �[��� <?php /* * This file is part of Twig. * * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Twig\Profiler\Dumper; use Twig\Profiler\Profile; /** * @author Fabien Potencier <fabien@symfony.com> */ abstract class BaseDumper { private $root; public function dump(Profile $profile): string { return $this->dumpProfile($profile); } abstract protected function formatTemplate(Profile $profile, $prefix): string; abstract protected function formatNonTemplate(Profile $profile, $prefix): string; abstract protected function formatTime(Profile $profile, $percent): string; private function dumpProfile(Profile $profile, $prefix = '', $sibling = false): string { if ($profile->isRoot()) { $this->root = $profile->getDuration(); $start = $profile->getName(); } else { if ($profile->isTemplate()) { $start = $this->formatTemplate($profile, $prefix); } else { $start = $this->formatNonTemplate($profile, $prefix); } $prefix .= $sibling ? '│ ' : ' '; } $percent = $this->root ? $profile->getDuration() / $this->root * 100 : 0; if ($profile->getDuration() * 1000 < 1) { $str = $start."\n"; } else { $str = \sprintf("%s %s\n", $start, $this->formatTime($profile, $percent)); } $nCount = \count($profile->getProfiles()); foreach ($profile as $i => $p) { $str .= $this->dumpProfile($p, $prefix, $i + 1 !== $nCount); } return $str; } } PK ���\��)*z z Profiler/Dumper/HtmlDumper.phpnu �[��� <?php /* * This file is part of Twig. * * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Twig\Profiler\Dumper; use Twig\Profiler\Profile; /** * @author Fabien Potencier <fabien@symfony.com> */ final class HtmlDumper extends BaseDumper { private static $colors = [ 'block' => '#dfd', 'macro' => '#ddf', 'template' => '#ffd', 'big' => '#d44', ]; public function dump(Profile $profile): string { return '<pre>'.parent::dump($profile).'</pre>'; } protected function formatTemplate(Profile $profile, $prefix): string { return \sprintf('%s└ <span style="background-color: %s">%s</span>', $prefix, self::$colors['template'], $profile->getTemplate()); } protected function formatNonTemplate(Profile $profile, $prefix): string { return \sprintf('%s└ %s::%s(<span style="background-color: %s">%s</span>)', $prefix, $profile->getTemplate(), $profile->getType(), self::$colors[$profile->getType()] ?? 'auto', $profile->getName()); } protected function formatTime(Profile $profile, $percent): string { return \sprintf('<span style="color: %s">%.2fms/%.0f%%</span>', $percent > 20 ? self::$colors['big'] : 'auto', $profile->getDuration() * 1000, $percent); } } PK ���\�ӣ0� � Profiler/Dumper/TextDumper.phpnu �[��� <?php /* * This file is part of Twig. * * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Twig\Profiler\Dumper; use Twig\Profiler\Profile; /** * @author Fabien Potencier <fabien@symfony.com> */ final class TextDumper extends BaseDumper { protected function formatTemplate(Profile $profile, $prefix): string { return \sprintf('%s└ %s', $prefix, $profile->getTemplate()); } protected function formatNonTemplate(Profile $profile, $prefix): string { return \sprintf('%s└ %s::%s(%s)', $prefix, $profile->getTemplate(), $profile->getType(), $profile->getName()); } protected function formatTime(Profile $profile, $percent): string { return \sprintf('%.2fms/%.0f%%', $profile->getDuration() * 1000, $percent); } } PK ���\�J�g� � # Profiler/Dumper/BlackfireDumper.phpnu �[��� <?php /* * This file is part of Twig. * * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Twig\Profiler\Dumper; use Twig\Profiler\Profile; /** * @author Fabien Potencier <fabien@symfony.com> */ final class BlackfireDumper { public function dump(Profile $profile): string { $data = []; $this->dumpProfile('main()', $profile, $data); $this->dumpChildren('main()', $profile, $data); $start = \sprintf('%f', microtime(true)); $str = <<<EOF file-format: BlackfireProbe cost-dimensions: wt mu pmu request-start: $start EOF; foreach ($data as $name => $values) { $str .= "$name//{$values['ct']} {$values['wt']} {$values['mu']} {$values['pmu']}\n"; } return $str; } private function dumpChildren(string $parent, Profile $profile, &$data): void { foreach ($profile as $p) { if ($p->isTemplate()) { $name = $p->getTemplate(); } else { $name = \sprintf('%s::%s(%s)', $p->getTemplate(), $p->getType(), $p->getName()); } $this->dumpProfile(\sprintf('%s==>%s', $parent, $name), $p, $data); $this->dumpChildren($name, $p, $data); } } private function dumpProfile(string $edge, Profile $profile, &$data): void { if (isset($data[$edge])) { ++$data[$edge]['ct']; $data[$edge]['wt'] += floor($profile->getDuration() * 1000000); $data[$edge]['mu'] += $profile->getMemoryUsage(); $data[$edge]['pmu'] += $profile->getPeakMemoryUsage(); } else { $data[$edge] = [ 'ct' => 1, 'wt' => floor($profile->getDuration() * 1000000), 'mu' => $profile->getMemoryUsage(), 'pmu' => $profile->getPeakMemoryUsage(), ]; } } } PK ���\�x=� "