├── update.php ├── vendor └── symfony │ ├── deprecation-contracts │ ├── .gitignore │ ├── CHANGELOG.md │ ├── composer.json │ ├── function.php │ ├── LICENSE │ └── README.md │ └── serializer │ ├── Exception │ ├── BadMethodCallException.php │ ├── MappingException.php │ ├── MissingConstructorArgumentsException.php │ ├── NotEncodableValueException.php │ ├── ExceptionInterface.php │ ├── NotNormalizableValueException.php │ ├── CircularReferenceException.php │ ├── LogicException.php │ ├── UnsupportedException.php │ ├── RuntimeException.php │ ├── InvalidArgumentException.php │ ├── UnexpectedValueException.php │ └── ExtraAttributesException.php │ ├── SerializerAwareInterface.php │ ├── Normalizer │ ├── NormalizerAwareInterface.php │ ├── DenormalizerAwareInterface.php │ ├── NormalizerAwareTrait.php │ ├── DenormalizerAwareTrait.php │ ├── CacheableSupportsMethodInterface.php │ ├── ContextAwareNormalizerInterface.php │ ├── ContextAwareDenormalizerInterface.php │ ├── ObjectToPopulateTrait.php │ ├── NormalizableInterface.php │ ├── DenormalizableInterface.php │ ├── NormalizerInterface.php │ ├── UnwrappingDenormalizer.php │ ├── JsonSerializableNormalizer.php │ ├── CustomNormalizer.php │ ├── DateTimeZoneNormalizer.php │ ├── ProblemNormalizer.php │ ├── DenormalizerInterface.php │ ├── FormErrorNormalizer.php │ ├── UidNormalizer.php │ ├── ArrayDenormalizer.php │ ├── MimeMessageNormalizer.php │ ├── DateIntervalNormalizer.php │ ├── ConstraintViolationListNormalizer.php │ ├── DateTimeNormalizer.php │ └── GetSetMethodNormalizer.php │ ├── README.md │ ├── Annotation │ ├── Ignore.php │ ├── MaxDepth.php │ ├── SerializedName.php │ ├── Groups.php │ ├── DiscriminatorMap.php │ └── Context.php │ ├── SerializerAwareTrait.php │ ├── Extractor │ ├── ObjectPropertyListExtractorInterface.php │ └── ObjectPropertyListExtractor.php │ ├── Mapping │ ├── Loader │ │ ├── LoaderInterface.php │ │ ├── FileLoader.php │ │ ├── LoaderChain.php │ │ └── schema │ │ │ └── dic │ │ │ └── serializer-mapping │ │ │ └── serializer-mapping-1.0.xsd │ ├── ClassDiscriminatorResolverInterface.php │ ├── Factory │ │ ├── ClassResolverTrait.php │ │ ├── ClassMetadataFactoryInterface.php │ │ ├── CacheClassMetadataFactory.php │ │ ├── ClassMetadataFactory.php │ │ ├── ClassMetadataFactoryCompiler.php │ │ └── CompiledClassMetadataFactory.php │ ├── ClassDiscriminatorMapping.php │ ├── ClassMetadataInterface.php │ ├── ClassDiscriminatorFromClassMetadata.php │ ├── AttributeMetadataInterface.php │ └── ClassMetadata.php │ ├── Encoder │ ├── NormalizationAwareInterface.php │ ├── ContextAwareDecoderInterface.php │ ├── ContextAwareEncoderInterface.php │ ├── EncoderInterface.php │ ├── DecoderInterface.php │ ├── JsonEncoder.php │ ├── JsonEncode.php │ ├── ChainDecoder.php │ ├── ChainEncoder.php │ ├── YamlEncoder.php │ └── JsonDecode.php │ ├── NameConverter │ ├── NameConverterInterface.php │ ├── AdvancedNameConverterInterface.php │ └── CamelCaseToSnakeCaseNameConverter.php │ ├── SerializerInterface.php │ ├── LICENSE │ ├── CacheWarmer │ └── CompiledClassMetadataCacheWarmer.php │ ├── DependencyInjection │ └── SerializerPass.php │ └── composer.json ├── composer.json ├── pages ├── index.php ├── sprog.copy.structure_content_generate.php ├── sprog.copy.structure_metadata_generate.php └── artefact.export.php ├── assets ├── css │ └── sprog.css └── js │ └── timer.jquery.min.js ├── lib └── Sprog │ ├── Filter │ ├── Raw.php │ ├── Lower.php │ ├── Upper.php │ ├── Markdown.php │ ├── Title.php │ ├── Format.php │ ├── Limit.php │ └── Words.php │ ├── Filter.php │ ├── Copy.php │ ├── Abbreviation.php │ ├── Export │ └── CsvExport.php │ ├── Copy │ └── StructureMetadata.php │ ├── Extension.php │ └── Sync.php ├── LICENSE ├── install.php ├── CHANGELOG.md ├── functions └── sprog.php ├── package.yml └── README.md /update.php: -------------------------------------------------------------------------------- 1 | includeFile(__DIR__.'/install.php'); 4 | -------------------------------------------------------------------------------- /vendor/symfony/deprecation-contracts/.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | composer.lock 3 | phpunit.xml 4 | -------------------------------------------------------------------------------- /vendor/symfony/deprecation-contracts/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | CHANGELOG 2 | ========= 3 | 4 | The changelog is maintained for all Symfony contracts at the following URL: 5 | https://github.com/symfony/contracts/blob/main/CHANGELOG.md 6 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "symfony/serializer": "^5.3" 4 | }, 5 | "replace": { 6 | "symfony/polyfill-ctype": "*", 7 | "symfony/polyfill-php80": "*" 8 | }, 9 | "scripts": { 10 | "post-install-cmd": [ 11 | "rm -rf vendor/composer && rm -f vendor/autoload.php" 12 | ], 13 | "post-update-cmd": [ 14 | "rm -rf vendor/composer && rm -f vendor/autoload.php" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Exception/BadMethodCallException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Exception; 13 | 14 | class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface 15 | { 16 | } 17 | -------------------------------------------------------------------------------- /pages/index.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | //$subpage = rex_be_controller::getCurrentPagePart(2); 13 | 14 | echo rex_view::title(rex_i18n::msg('sprog_title')); 15 | 16 | //include rex_be_controller::getCurrentPageObject()->getSubPath(); 17 | rex_be_controller::includeCurrentPageSubPath(); 18 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Exception/MappingException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Exception; 13 | 14 | /** 15 | * MappingException. 16 | * 17 | * @author Kévin Dunglas 18 | */ 19 | class MappingException extends RuntimeException 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Exception/MissingConstructorArgumentsException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Exception; 13 | 14 | /** 15 | * @author Maxime VEBER 16 | */ 17 | class MissingConstructorArgumentsException extends RuntimeException 18 | { 19 | } 20 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Exception/NotEncodableValueException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Exception; 13 | 14 | /** 15 | * @author Christian Flothmann 16 | */ 17 | class NotEncodableValueException extends UnexpectedValueException 18 | { 19 | } 20 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Exception/ExceptionInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Exception; 13 | 14 | /** 15 | * Base exception interface. 16 | * 17 | * @author Johannes M. Schmitt 18 | */ 19 | interface ExceptionInterface extends \Throwable 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Exception/NotNormalizableValueException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Exception; 13 | 14 | /** 15 | * @author Christian Flothmann 16 | */ 17 | class NotNormalizableValueException extends UnexpectedValueException 18 | { 19 | } 20 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Exception/CircularReferenceException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Exception; 13 | 14 | /** 15 | * CircularReferenceException. 16 | * 17 | * @author Kévin Dunglas 18 | */ 19 | class CircularReferenceException extends RuntimeException 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Exception/LogicException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Exception; 13 | 14 | /** 15 | * LogicException. 16 | * 17 | * @author Lukas Kahwe Smith 18 | */ 19 | class LogicException extends \LogicException implements ExceptionInterface 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Exception/UnsupportedException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Exception; 13 | 14 | /** 15 | * UnsupportedException. 16 | * 17 | * @author Johannes M. Schmitt 18 | */ 19 | class UnsupportedException extends InvalidArgumentException 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Exception/RuntimeException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Exception; 13 | 14 | /** 15 | * RuntimeException. 16 | * 17 | * @author Johannes M. Schmitt 18 | */ 19 | class RuntimeException extends \RuntimeException implements ExceptionInterface 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Exception/InvalidArgumentException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Exception; 13 | 14 | /** 15 | * InvalidArgumentException. 16 | * 17 | * @author Johannes M. Schmitt 18 | */ 19 | class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Exception/UnexpectedValueException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Exception; 13 | 14 | /** 15 | * UnexpectedValueException. 16 | * 17 | * @author Lukas Kahwe Smith 18 | */ 19 | class UnexpectedValueException extends \UnexpectedValueException implements ExceptionInterface 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/SerializerAwareInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer; 13 | 14 | /** 15 | * @author Jordi Boggiano 16 | */ 17 | interface SerializerAwareInterface 18 | { 19 | /** 20 | * Sets the owning Serializer object. 21 | */ 22 | public function setSerializer(SerializerInterface $serializer); 23 | } 24 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/NormalizerAwareInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | /** 15 | * @author Joel Wurtz 16 | */ 17 | interface NormalizerAwareInterface 18 | { 19 | /** 20 | * Sets the owning Normalizer object. 21 | */ 22 | public function setNormalizer(NormalizerInterface $normalizer); 23 | } 24 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/README.md: -------------------------------------------------------------------------------- 1 | Serializer Component 2 | ==================== 3 | 4 | The Serializer component handles serializing and deserializing data structures, 5 | including object graphs, into array structures or other formats like XML and 6 | JSON. 7 | 8 | Resources 9 | --------- 10 | 11 | * [Documentation](https://symfony.com/doc/current/components/serializer.html) 12 | * [Contributing](https://symfony.com/doc/current/contributing/index.html) 13 | * [Report issues](https://github.com/symfony/symfony/issues) and 14 | [send Pull Requests](https://github.com/symfony/symfony/pulls) 15 | in the [main Symfony repository](https://github.com/symfony/symfony) 16 | -------------------------------------------------------------------------------- /pages/sprog.copy.structure_content_generate.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use Sprog\Copy\StructureContent; 13 | 14 | // generate page cache 15 | $articles = \rex_get('articles', 'string'); 16 | $params = \rex_get('params', 'array'); 17 | 18 | if (!empty($articles)) { 19 | StructureContent::fire(StructureContent::resolveItems($articles), $params); 20 | } 21 | 22 | // clear output 23 | StructureContent::clearOutput(); 24 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Annotation/Ignore.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Annotation; 13 | 14 | /** 15 | * Annotation class for @Ignore(). 16 | * 17 | * @Annotation 18 | * @Target({"PROPERTY", "METHOD"}) 19 | * 20 | * @author Kévin Dunglas 21 | */ 22 | #[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)] 23 | final class Ignore 24 | { 25 | } 26 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/DenormalizerAwareInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | /** 15 | * @author Joel Wurtz 16 | */ 17 | interface DenormalizerAwareInterface 18 | { 19 | /** 20 | * Sets the owning Denormalizer object. 21 | */ 22 | public function setDenormalizer(DenormalizerInterface $denormalizer); 23 | } 24 | -------------------------------------------------------------------------------- /assets/css/sprog.css: -------------------------------------------------------------------------------- 1 | .panel-sprog-copy .panel-body { 2 | height: 250px; 3 | overflow: hidden; 4 | overflow-y: auto; 5 | -webkit-overflow-scrolling: touch; 6 | } 7 | 8 | .table-striped > tbody > tr.sprog-mark-edit, 9 | .sprog-mark-edit, 10 | .sprog-mark-highlight { 11 | background-color: #e0f5ee; 12 | } 13 | 14 | .sprog-search-input { 15 | height: 24px; 16 | padding-top: 3px; 17 | padding-bottom: 3px; 18 | font-size: 12px; 19 | line-height: 1; 20 | } 21 | 22 | .sprog-text-finished { 23 | color: #3bb594; 24 | } 25 | .sprog-text-error { 26 | color: #d9534f; 27 | } 28 | .sprog-progressbar [role="progressbar"] { 29 | width: 0; 30 | } 31 | -------------------------------------------------------------------------------- /pages/sprog.copy.structure_metadata_generate.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use Sprog\Copy\StructureMetadata; 13 | 14 | // generate page cache 15 | $articles = \rex_get('articles', 'string'); 16 | $params = \rex_get('params', 'array'); 17 | 18 | if (!empty($articles)) { 19 | StructureMetadata::fire(StructureMetadata::resolveItems($articles), $params); 20 | } 21 | 22 | // clear output 23 | StructureMetadata::clearOutput(); 24 | -------------------------------------------------------------------------------- /lib/Sprog/Filter/Raw.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Sprog\Filter; 13 | 14 | use Sprog\Filter; 15 | 16 | class Raw extends Filter 17 | { 18 | /** 19 | * {@inheritdoc} 20 | */ 21 | public function name() 22 | { 23 | return 'raw'; 24 | } 25 | 26 | /** 27 | * {@inheritdoc} 28 | */ 29 | public function fire($value, $arguments) 30 | { 31 | return $value; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/Sprog/Filter/Lower.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Sprog\Filter; 13 | 14 | use Sprog\Filter; 15 | 16 | class Lower extends Filter 17 | { 18 | /** 19 | * {@inheritdoc} 20 | */ 21 | public function name() 22 | { 23 | return 'lower'; 24 | } 25 | 26 | /** 27 | * {@inheritdoc} 28 | */ 29 | public function fire($value, $arguments) 30 | { 31 | return mb_strtolower($value, 'UTF-8'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/Sprog/Filter/Upper.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Sprog\Filter; 13 | 14 | use Sprog\Filter; 15 | 16 | class Upper extends Filter 17 | { 18 | /** 19 | * {@inheritdoc} 20 | */ 21 | public function name() 22 | { 23 | return 'upper'; 24 | } 25 | 26 | /** 27 | * {@inheritdoc} 28 | */ 29 | public function fire($value, $arguments) 30 | { 31 | return mb_strtoupper($value, 'UTF-8'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/SerializerAwareTrait.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer; 13 | 14 | /** 15 | * @author Joel Wurtz 16 | */ 17 | trait SerializerAwareTrait 18 | { 19 | /** 20 | * @var SerializerInterface 21 | */ 22 | protected $serializer; 23 | 24 | public function setSerializer(SerializerInterface $serializer) 25 | { 26 | $this->serializer = $serializer; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/Sprog/Filter/Markdown.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Sprog\Filter; 13 | 14 | use Sprog\Filter; 15 | 16 | class Markdown extends Filter 17 | { 18 | /** 19 | * {@inheritdoc} 20 | */ 21 | public function name() 22 | { 23 | return 'markdown'; 24 | } 25 | 26 | /** 27 | * {@inheritdoc} 28 | */ 29 | public function fire($value, $arguments) 30 | { 31 | return \rex_markdown::factory()->parse($value); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/Sprog/Filter/Title.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Sprog\Filter; 13 | 14 | use Sprog\Filter; 15 | 16 | class Title extends Filter 17 | { 18 | /** 19 | * {@inheritdoc} 20 | */ 21 | public function name() 22 | { 23 | return 'title'; 24 | } 25 | 26 | /** 27 | * {@inheritdoc} 28 | */ 29 | public function fire($value, $arguments) 30 | { 31 | return mb_convert_case($value, MB_CASE_TITLE, 'UTF-8'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/NormalizerAwareTrait.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | /** 15 | * @author Joel Wurtz 16 | */ 17 | trait NormalizerAwareTrait 18 | { 19 | /** 20 | * @var NormalizerInterface 21 | */ 22 | protected $normalizer; 23 | 24 | public function setNormalizer(NormalizerInterface $normalizer) 25 | { 26 | $this->normalizer = $normalizer; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/Sprog/Filter.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Sprog; 13 | 14 | abstract class Filter 15 | { 16 | /** 17 | * Returns the name of the filter. 18 | * 19 | * @return string 20 | */ 21 | abstract public function name(); 22 | 23 | /** 24 | * Execute the filter. 25 | * 26 | * @param string $value 27 | * @param string $arguments 28 | * 29 | * @return string 30 | */ 31 | abstract public function fire($value, $arguments); 32 | } 33 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Extractor/ObjectPropertyListExtractorInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Extractor; 13 | 14 | /** 15 | * @author David Maicher 16 | */ 17 | interface ObjectPropertyListExtractorInterface 18 | { 19 | /** 20 | * Gets the list of properties available for the given object. 21 | * 22 | * @return string[]|null 23 | */ 24 | public function getProperties(object $object, array $context = []): ?array; 25 | } 26 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/DenormalizerAwareTrait.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | /** 15 | * @author Joel Wurtz 16 | */ 17 | trait DenormalizerAwareTrait 18 | { 19 | /** 20 | * @var DenormalizerInterface 21 | */ 22 | protected $denormalizer; 23 | 24 | public function setDenormalizer(DenormalizerInterface $denormalizer) 25 | { 26 | $this->denormalizer = $denormalizer; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Mapping/Loader/LoaderInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Mapping\Loader; 13 | 14 | use Symfony\Component\Serializer\Mapping\ClassMetadataInterface; 15 | 16 | /** 17 | * Loads {@link ClassMetadataInterface}. 18 | * 19 | * @author Kévin Dunglas 20 | */ 21 | interface LoaderInterface 22 | { 23 | /** 24 | * @return bool 25 | */ 26 | public function loadClassMetadata(ClassMetadataInterface $classMetadata); 27 | } 28 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Encoder/NormalizationAwareInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Encoder; 13 | 14 | /** 15 | * Defines the interface of encoders that will normalize data themselves. 16 | * 17 | * Implementing this interface essentially just tells the Serializer that the 18 | * data should not be pre-normalized before being passed to this Encoder. 19 | * 20 | * @author Jordi Boggiano 21 | */ 22 | interface NormalizationAwareInterface 23 | { 24 | } 25 | -------------------------------------------------------------------------------- /lib/Sprog/Filter/Format.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Sprog\Filter; 13 | 14 | use Sprog\Filter; 15 | 16 | class Format extends Filter 17 | { 18 | /** 19 | * {@inheritdoc} 20 | */ 21 | public function name() 22 | { 23 | return 'format'; 24 | } 25 | 26 | /** 27 | * {@inheritdoc} 28 | */ 29 | public function fire($value, $arguments) 30 | { 31 | if ($arguments == '') { 32 | return $value; 33 | } 34 | 35 | return vsprintf($value, explode(',', $arguments)); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Encoder/ContextAwareDecoderInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Encoder; 13 | 14 | /** 15 | * Adds the support of an extra $context parameter for the supportsDecoding method. 16 | * 17 | * @author Kévin Dunglas 18 | */ 19 | interface ContextAwareDecoderInterface extends DecoderInterface 20 | { 21 | /** 22 | * {@inheritdoc} 23 | * 24 | * @param array $context options that decoders have access to 25 | */ 26 | public function supportsDecoding(string $format, array $context = []); 27 | } 28 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Encoder/ContextAwareEncoderInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Encoder; 13 | 14 | /** 15 | * Adds the support of an extra $context parameter for the supportsEncoding method. 16 | * 17 | * @author Kévin Dunglas 18 | */ 19 | interface ContextAwareEncoderInterface extends EncoderInterface 20 | { 21 | /** 22 | * {@inheritdoc} 23 | * 24 | * @param array $context options that encoders have access to 25 | */ 26 | public function supportsEncoding(string $format, array $context = []); 27 | } 28 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/CacheableSupportsMethodInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | /** 15 | * Marker interface for normalizers and denormalizers that use 16 | * only the type and the format in their supports*() methods. 17 | * 18 | * By implementing this interface, the return value of the 19 | * supports*() methods will be cached by type and format. 20 | * 21 | * @author Kévin Dunglas 22 | */ 23 | interface CacheableSupportsMethodInterface 24 | { 25 | public function hasCacheableSupportsMethod(): bool; 26 | } 27 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/ContextAwareNormalizerInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | /** 15 | * Adds the support of an extra $context parameter for the supportsNormalization method. 16 | * 17 | * @author Kévin Dunglas 18 | */ 19 | interface ContextAwareNormalizerInterface extends NormalizerInterface 20 | { 21 | /** 22 | * {@inheritdoc} 23 | * 24 | * @param array $context options that normalizers have access to 25 | */ 26 | public function supportsNormalization($data, string $format = null, array $context = []); 27 | } 28 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/ContextAwareDenormalizerInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | /** 15 | * Adds the support of an extra $context parameter for the supportsDenormalization method. 16 | * 17 | * @author Kévin Dunglas 18 | */ 19 | interface ContextAwareDenormalizerInterface extends DenormalizerInterface 20 | { 21 | /** 22 | * {@inheritdoc} 23 | * 24 | * @param array $context options that denormalizers have access to 25 | */ 26 | public function supportsDenormalization($data, string $type, string $format = null, array $context = []); 27 | } 28 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/NameConverter/NameConverterInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\NameConverter; 13 | 14 | /** 15 | * Defines the interface for property name converters. 16 | * 17 | * @author Kévin Dunglas 18 | */ 19 | interface NameConverterInterface 20 | { 21 | /** 22 | * Converts a property name to its normalized value. 23 | * 24 | * @return string 25 | */ 26 | public function normalize(string $propertyName); 27 | 28 | /** 29 | * Converts a property name to its denormalized value. 30 | * 31 | * @return string 32 | */ 33 | public function denormalize(string $propertyName); 34 | } 35 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Mapping/ClassDiscriminatorResolverInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Mapping; 13 | 14 | /** 15 | * Knows how to get the class discriminator mapping for classes and objects. 16 | * 17 | * @author Samuel Roze 18 | */ 19 | interface ClassDiscriminatorResolverInterface 20 | { 21 | public function getMappingForClass(string $class): ?ClassDiscriminatorMapping; 22 | 23 | /** 24 | * @param object|string $object 25 | */ 26 | public function getMappingForMappedObject($object): ?ClassDiscriminatorMapping; 27 | 28 | /** 29 | * @param object|string $object 30 | */ 31 | public function getTypeForMappedObject($object): ?string; 32 | } 33 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/NameConverter/AdvancedNameConverterInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\NameConverter; 13 | 14 | /** 15 | * Gives access to the class, the format and the context in the property name converters. 16 | * 17 | * @author Kévin Dunglas 18 | */ 19 | interface AdvancedNameConverterInterface extends NameConverterInterface 20 | { 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function normalize(string $propertyName, string $class = null, string $format = null, array $context = []); 25 | 26 | /** 27 | * {@inheritdoc} 28 | */ 29 | public function denormalize(string $propertyName, string $class = null, string $format = null, array $context = []); 30 | } 31 | -------------------------------------------------------------------------------- /vendor/symfony/deprecation-contracts/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "symfony/deprecation-contracts", 3 | "type": "library", 4 | "description": "A generic function and convention to trigger deprecation notices", 5 | "homepage": "https://symfony.com", 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "Nicolas Grekas", 10 | "email": "p@tchwork.com" 11 | }, 12 | { 13 | "name": "Symfony Community", 14 | "homepage": "https://symfony.com/contributors" 15 | } 16 | ], 17 | "require": { 18 | "php": ">=7.1" 19 | }, 20 | "autoload": { 21 | "files": [ 22 | "function.php" 23 | ] 24 | }, 25 | "minimum-stability": "dev", 26 | "extra": { 27 | "branch-alias": { 28 | "dev-main": "2.5-dev" 29 | }, 30 | "thanks": { 31 | "name": "symfony/contracts", 32 | "url": "https://github.com/symfony/contracts" 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/Sprog/Filter/Limit.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Sprog\Filter; 13 | 14 | use Sprog\Filter; 15 | 16 | class Limit extends Filter 17 | { 18 | /** 19 | * {@inheritdoc} 20 | */ 21 | public function name() 22 | { 23 | return 'limit'; 24 | } 25 | 26 | /** 27 | * {@inheritdoc} 28 | */ 29 | public function fire($value, $arguments) 30 | { 31 | if ($arguments == '') { 32 | return $value; 33 | } 34 | 35 | $parts = explode(',', $arguments); 36 | $limit = (int) $parts[0]; 37 | $end = isset($parts[1]) ? $parts[1] : ''; 38 | 39 | if (mb_strwidth($value, 'UTF-8') <= $limit) { 40 | return $value; 41 | } 42 | return rtrim(mb_strimwidth($value, 0, $limit, '', 'UTF-8')).$end; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/SerializerInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer; 13 | 14 | /** 15 | * @author Jordi Boggiano 16 | */ 17 | interface SerializerInterface 18 | { 19 | /** 20 | * Serializes data in the appropriate format. 21 | * 22 | * @param mixed $data Any data 23 | * @param string $format Format name 24 | * @param array $context Options normalizers/encoders have access to 25 | * 26 | * @return string 27 | */ 28 | public function serialize($data, string $format, array $context = []); 29 | 30 | /** 31 | * Deserializes data into the given type. 32 | * 33 | * @param mixed $data 34 | * 35 | * @return mixed 36 | */ 37 | public function deserialize($data, string $type, string $format, array $context = []); 38 | } 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Thomas Blum 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/symfony/deprecation-contracts/function.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | if (!function_exists('trigger_deprecation')) { 13 | /** 14 | * Triggers a silenced deprecation notice. 15 | * 16 | * @param string $package The name of the Composer package that is triggering the deprecation 17 | * @param string $version The version of the package that introduced the deprecation 18 | * @param string $message The message of the deprecation 19 | * @param mixed ...$args Values to insert in the message using printf() formatting 20 | * 21 | * @author Nicolas Grekas 22 | */ 23 | function trigger_deprecation(string $package, string $version, string $message, ...$args): void 24 | { 25 | @trigger_error(($package || $version ? "Since $package $version: " : '').($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/Sprog/Filter/Words.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Sprog\Filter; 13 | 14 | use Sprog\Filter; 15 | 16 | class Words extends Filter 17 | { 18 | /** 19 | * {@inheritdoc} 20 | */ 21 | public function name() 22 | { 23 | return 'words'; 24 | } 25 | 26 | /** 27 | * {@inheritdoc} 28 | */ 29 | public function fire($value, $arguments) 30 | { 31 | if ($arguments == '') { 32 | return $value; 33 | } 34 | 35 | $parts = explode(',', $arguments); 36 | $words = (int) $parts[0]; 37 | $end = isset($parts[1]) ? $parts[1] : ''; 38 | 39 | preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $value, $matches); 40 | if (!isset($matches[0]) || mb_strlen($value) === mb_strlen($matches[0])) { 41 | return $value; 42 | } 43 | return rtrim($matches[0]).$end; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2004-2021 Fabien Potencier 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/symfony/deprecation-contracts/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020-2021 Fabien Potencier 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Exception/ExtraAttributesException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Exception; 13 | 14 | /** 15 | * ExtraAttributesException. 16 | * 17 | * @author Julien DIDIER 18 | */ 19 | class ExtraAttributesException extends RuntimeException 20 | { 21 | private $extraAttributes; 22 | 23 | public function __construct(array $extraAttributes, \Throwable $previous = null) 24 | { 25 | $msg = sprintf('Extra attributes are not allowed ("%s" %s unknown).', implode('", "', $extraAttributes), \count($extraAttributes) > 1 ? 'are' : 'is'); 26 | 27 | $this->extraAttributes = $extraAttributes; 28 | 29 | parent::__construct($msg, 0, $previous); 30 | } 31 | 32 | /** 33 | * Get the extra attributes that are not allowed. 34 | * 35 | * @return array 36 | */ 37 | public function getExtraAttributes() 38 | { 39 | return $this->extraAttributes; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Encoder/EncoderInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Encoder; 13 | 14 | use Symfony\Component\Serializer\Exception\UnexpectedValueException; 15 | 16 | /** 17 | * @author Jordi Boggiano 18 | */ 19 | interface EncoderInterface 20 | { 21 | /** 22 | * Encodes data into the given format. 23 | * 24 | * @param mixed $data Data to encode 25 | * @param string $format Format name 26 | * @param array $context Options that normalizers/encoders have access to 27 | * 28 | * @return string 29 | * 30 | * @throws UnexpectedValueException 31 | */ 32 | public function encode($data, string $format, array $context = []); 33 | 34 | /** 35 | * Checks whether the serializer can encode to given format. 36 | * 37 | * @param string $format Format name 38 | * 39 | * @return bool 40 | */ 41 | public function supportsEncoding(string $format); 42 | } 43 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Mapping/Loader/FileLoader.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Mapping\Loader; 13 | 14 | use Symfony\Component\Serializer\Exception\MappingException; 15 | 16 | /** 17 | * Base class for all file based loaders. 18 | * 19 | * @author Kévin Dunglas 20 | */ 21 | abstract class FileLoader implements LoaderInterface 22 | { 23 | protected $file; 24 | 25 | /** 26 | * @param string $file The mapping file to load 27 | * 28 | * @throws MappingException if the mapping file does not exist or is not readable 29 | */ 30 | public function __construct(string $file) 31 | { 32 | if (!is_file($file)) { 33 | throw new MappingException(sprintf('The mapping file "%s" does not exist.', $file)); 34 | } 35 | 36 | if (!is_readable($file)) { 37 | throw new MappingException(sprintf('The mapping file "%s" is not readable.', $file)); 38 | } 39 | 40 | $this->file = $file; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/Sprog/Copy.php: -------------------------------------------------------------------------------- 1 | setSubject(false); 27 | }); 28 | } 29 | 30 | /** 31 | * Resolve items in query string 32 | * query string pattern: v1.v2,v1.v2,…. 33 | * 34 | * @param string $items 35 | * 36 | * @return array 37 | */ 38 | public static function resolveItems($items) 39 | { 40 | $itemsArray = explode(',', $items); 41 | $filteredItemsArray = []; 42 | 43 | if (count($itemsArray) > 0) { 44 | foreach ($itemsArray as $item) { 45 | $filteredItemsArray[] = explode('.', $item); 46 | } 47 | } 48 | 49 | return $filteredItemsArray; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /install.php: -------------------------------------------------------------------------------- 1 | ensureColumn(new rex_sql_column('pid', 'int(11) unsigned', false, null, 'AUTO_INCREMENT')) 5 | ->setPrimaryKey('pid') 6 | ->ensureColumn(new rex_sql_column('id', 'int(11)')) 7 | ->ensureColumn(new rex_sql_column('clang_id', 'int(11)')) 8 | ->ensureColumn(new rex_sql_column('wildcard', 'varchar(255)')) 9 | ->ensureColumn(new rex_sql_column('replace', 'text')) 10 | ->ensureGlobalColumns() 11 | ->ensureColumn(new rex_sql_column('revision', 'int(11)')) 12 | ->ensure(); 13 | 14 | $table = rex_sql_table::get(rex::getTable('sprog_abbreviation')); 15 | $table 16 | ->ensureColumn(new rex_sql_column('id', 'int(11) unsigned', false, null, 'AUTO_INCREMENT')) 17 | ->setPrimaryKey('id') 18 | ->ensureColumn(new rex_sql_column('clang_id', 'int(11)')) 19 | ->ensureColumn(new rex_sql_column('abbreviation', 'varchar(255)')) 20 | ->ensureColumn(new rex_sql_column('text', 'text')) 21 | ->ensureColumn(new rex_sql_column('status', 'tinyint(1)')) 22 | ->ensureGlobalColumns() 23 | ->ensureColumn(new rex_sql_column('revision', 'int(11)')) 24 | ->ensureIndex(new rex_sql_index('find_abbreviations', ['clang_id', 'abbreviation'], rex_sql_index::UNIQUE)) 25 | ->ensure(); 26 | -------------------------------------------------------------------------------- /vendor/symfony/deprecation-contracts/README.md: -------------------------------------------------------------------------------- 1 | Symfony Deprecation Contracts 2 | ============================= 3 | 4 | A generic function and convention to trigger deprecation notices. 5 | 6 | This package provides a single global function named `trigger_deprecation()` that triggers silenced deprecation notices. 7 | 8 | By using a custom PHP error handler such as the one provided by the Symfony ErrorHandler component, 9 | the triggered deprecations can be caught and logged for later discovery, both on dev and prod environments. 10 | 11 | The function requires at least 3 arguments: 12 | - the name of the Composer package that is triggering the deprecation 13 | - the version of the package that introduced the deprecation 14 | - the message of the deprecation 15 | - more arguments can be provided: they will be inserted in the message using `printf()` formatting 16 | 17 | Example: 18 | ```php 19 | trigger_deprecation('symfony/blockchain', '8.9', 'Using "%s" is deprecated, use "%s" instead.', 'bitcoin', 'fabcoin'); 20 | ``` 21 | 22 | This will generate the following message: 23 | `Since symfony/blockchain 8.9: Using "bitcoin" is deprecated, use "fabcoin" instead.` 24 | 25 | While not necessarily recommended, the deprecation notices can be completely ignored by declaring an empty 26 | `function trigger_deprecation() {}` in your application. 27 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/ObjectToPopulateTrait.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | trait ObjectToPopulateTrait 15 | { 16 | /** 17 | * Extract the `object_to_populate` field from the context if it exists 18 | * and is an instance of the provided $class. 19 | * 20 | * @param string $class The class the object should be 21 | * @param string|null $key They in which to look for the object to populate. 22 | * Keeps backwards compatibility with `AbstractNormalizer`. 23 | * 24 | * @return object|null an object if things check out, null otherwise 25 | */ 26 | protected function extractObjectToPopulate(string $class, array $context, string $key = null): ?object 27 | { 28 | $key = $key ?? AbstractNormalizer::OBJECT_TO_POPULATE; 29 | 30 | if (isset($context[$key]) && \is_object($context[$key]) && $context[$key] instanceof $class) { 31 | return $context[$key]; 32 | } 33 | 34 | return null; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Extractor/ObjectPropertyListExtractor.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Extractor; 13 | 14 | use Symfony\Component\PropertyInfo\PropertyListExtractorInterface; 15 | 16 | /** 17 | * @author David Maicher 18 | */ 19 | final class ObjectPropertyListExtractor implements ObjectPropertyListExtractorInterface 20 | { 21 | private $propertyListExtractor; 22 | private $objectClassResolver; 23 | 24 | public function __construct(PropertyListExtractorInterface $propertyListExtractor, callable $objectClassResolver = null) 25 | { 26 | $this->propertyListExtractor = $propertyListExtractor; 27 | $this->objectClassResolver = $objectClassResolver; 28 | } 29 | 30 | /** 31 | * {@inheritdoc} 32 | */ 33 | public function getProperties(object $object, array $context = []): ?array 34 | { 35 | $class = $this->objectClassResolver ? ($this->objectClassResolver)($object) : \get_class($object); 36 | 37 | return $this->propertyListExtractor->getProperties($class, $context); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/Sprog/Abbreviation.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Sprog; 13 | 14 | class Abbreviation 15 | { 16 | public static function parse($content, $clangId = null) 17 | { 18 | if (!\rex_clang::exists($clangId)) { 19 | $clangId = \rex_clang::getCurrentId(); 20 | } 21 | 22 | preg_match_all('|]*>(.*)|msU', $content, $body); 23 | 24 | if (!isset($body[1][0])) { 25 | return $content; 26 | } 27 | $bodyReplace = $body[1][0]; 28 | 29 | $sql = \rex_sql::factory(); 30 | $sql->setQuery('SELECT `abbreviation`, `text` FROM '.\rex::getTable('sprog_abbreviation').' WHERE `clang_id` = :clangId AND `status` = 1', ['clangId' => $clangId]); 31 | $items = $sql->getArray(); 32 | 33 | foreach ($items as $item) { 34 | $bodyReplace = preg_replace_callback('|(?!<[^<>]*?)(?]*?>)|msU', function ($matches) use ($item) { 35 | return sprintf('%s', rex_escape($item['text']), $matches[0]); 36 | }, $bodyReplace); 37 | } 38 | 39 | return str_replace($body[1][0], $bodyReplace, $content); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Mapping/Factory/ClassResolverTrait.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Mapping\Factory; 13 | 14 | use Symfony\Component\Serializer\Exception\InvalidArgumentException; 15 | 16 | /** 17 | * Resolves a class name. 18 | * 19 | * @internal 20 | * 21 | * @author Kévin Dunglas 22 | */ 23 | trait ClassResolverTrait 24 | { 25 | /** 26 | * Gets a class name for a given class or instance. 27 | * 28 | * @param object|string $value 29 | * 30 | * @throws InvalidArgumentException If the class does not exist 31 | */ 32 | private function getClass($value): string 33 | { 34 | if (\is_string($value)) { 35 | if (!class_exists($value) && !interface_exists($value, false)) { 36 | throw new InvalidArgumentException(sprintf('The class or interface "%s" does not exist.', $value)); 37 | } 38 | 39 | return ltrim($value, '\\'); 40 | } 41 | 42 | if (!\is_object($value)) { 43 | throw new InvalidArgumentException(sprintf('Cannot create metadata for non-objects. Got: "%s".', get_debug_type($value))); 44 | } 45 | 46 | return \get_class($value); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Encoder/DecoderInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Encoder; 13 | 14 | use Symfony\Component\Serializer\Exception\UnexpectedValueException; 15 | 16 | /** 17 | * @author Jordi Boggiano 18 | */ 19 | interface DecoderInterface 20 | { 21 | /** 22 | * Decodes a string into PHP data. 23 | * 24 | * @param string $data Data to decode 25 | * @param string $format Format name 26 | * @param array $context Options that decoders have access to 27 | * 28 | * The format parameter specifies which format the data is in; valid values 29 | * depend on the specific implementation. Authors implementing this interface 30 | * are encouraged to document which formats they support in a non-inherited 31 | * phpdoc comment. 32 | * 33 | * @return mixed 34 | * 35 | * @throws UnexpectedValueException 36 | */ 37 | public function decode(string $data, string $format, array $context = []); 38 | 39 | /** 40 | * Checks whether the deserializer can decode from given format. 41 | * 42 | * @param string $format Format name 43 | * 44 | * @return bool 45 | */ 46 | public function supportsDecoding(string $format); 47 | } 48 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/NormalizableInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | /** 15 | * Defines the most basic interface a class must implement to be normalizable. 16 | * 17 | * If a normalizer is registered for the class and it doesn't implement 18 | * the Normalizable interfaces, the normalizer will be used instead. 19 | * 20 | * @author Jordi Boggiano 21 | */ 22 | interface NormalizableInterface 23 | { 24 | /** 25 | * Normalizes the object into an array of scalars|arrays. 26 | * 27 | * It is important to understand that the normalize() call should normalize 28 | * recursively all child objects of the implementor. 29 | * 30 | * @param NormalizerInterface $normalizer The normalizer is given so that you 31 | * can use it to normalize objects contained within this object 32 | * @param string|null $format The format is optionally given to be able to normalize differently 33 | * based on different output formats 34 | * @param array $context Options for normalizing this object 35 | * 36 | * @return array|string|int|float|bool 37 | */ 38 | public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []); 39 | } 40 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/DenormalizableInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | /** 15 | * Defines the most basic interface a class must implement to be denormalizable. 16 | * 17 | * If a denormalizer is registered for the class and it doesn't implement 18 | * the Denormalizable interfaces, the normalizer will be used instead 19 | * 20 | * @author Jordi Boggiano 21 | */ 22 | interface DenormalizableInterface 23 | { 24 | /** 25 | * Denormalizes the object back from an array of scalars|arrays. 26 | * 27 | * It is important to understand that the denormalize() call should denormalize 28 | * recursively all child objects of the implementor. 29 | * 30 | * @param DenormalizerInterface $denormalizer The denormalizer is given so that you 31 | * can use it to denormalize objects contained within this object 32 | * @param array|string|int|float|bool $data The data from which to re-create the object 33 | * @param string|null $format The format is optionally given to be able to denormalize 34 | * differently based on different input formats 35 | * @param array $context Options for denormalizing 36 | */ 37 | public function denormalize(DenormalizerInterface $denormalizer, $data, string $format = null, array $context = []); 38 | } 39 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Encoder/JsonEncoder.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Encoder; 13 | 14 | /** 15 | * Encodes JSON data. 16 | * 17 | * @author Jordi Boggiano 18 | */ 19 | class JsonEncoder implements EncoderInterface, DecoderInterface 20 | { 21 | public const FORMAT = 'json'; 22 | 23 | protected $encodingImpl; 24 | protected $decodingImpl; 25 | 26 | public function __construct(JsonEncode $encodingImpl = null, JsonDecode $decodingImpl = null) 27 | { 28 | $this->encodingImpl = $encodingImpl ?? new JsonEncode(); 29 | $this->decodingImpl = $decodingImpl ?? new JsonDecode([JsonDecode::ASSOCIATIVE => true]); 30 | } 31 | 32 | /** 33 | * {@inheritdoc} 34 | */ 35 | public function encode($data, string $format, array $context = []) 36 | { 37 | return $this->encodingImpl->encode($data, self::FORMAT, $context); 38 | } 39 | 40 | /** 41 | * {@inheritdoc} 42 | */ 43 | public function decode(string $data, string $format, array $context = []) 44 | { 45 | return $this->decodingImpl->decode($data, self::FORMAT, $context); 46 | } 47 | 48 | /** 49 | * {@inheritdoc} 50 | */ 51 | public function supportsEncoding(string $format) 52 | { 53 | return self::FORMAT === $format; 54 | } 55 | 56 | /** 57 | * {@inheritdoc} 58 | */ 59 | public function supportsDecoding(string $format) 60 | { 61 | return self::FORMAT === $format; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Annotation/MaxDepth.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Annotation; 13 | 14 | use Symfony\Component\Serializer\Exception\InvalidArgumentException; 15 | 16 | /** 17 | * Annotation class for @MaxDepth(). 18 | * 19 | * @Annotation 20 | * @NamedArgumentConstructor 21 | * @Target({"PROPERTY", "METHOD"}) 22 | * 23 | * @author Kévin Dunglas 24 | */ 25 | #[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)] 26 | class MaxDepth 27 | { 28 | /** 29 | * @var int 30 | */ 31 | private $maxDepth; 32 | 33 | /** 34 | * @param int $maxDepth 35 | */ 36 | public function __construct($maxDepth) 37 | { 38 | if (\is_array($maxDepth)) { 39 | trigger_deprecation('symfony/serializer', '5.3', 'Passing an array as first argument to "%s" is deprecated. Use named arguments instead.', __METHOD__); 40 | 41 | if (!isset($maxDepth['value'])) { 42 | throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" should be set.', static::class)); 43 | } 44 | $maxDepth = $maxDepth['value']; 45 | } 46 | 47 | if (!\is_int($maxDepth) || $maxDepth <= 0) { 48 | throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a positive integer.', static::class)); 49 | } 50 | 51 | $this->maxDepth = $maxDepth; 52 | } 53 | 54 | public function getMaxDepth() 55 | { 56 | return $this->maxDepth; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | Sprog - Changelog 3 | ================================================================================ 4 | 5 | ## Version 1.3.0 - 19.11.2021 6 | 7 | ### Neu 8 | 9 | - [#30](https://github.com/tbaddade/redaxo_sprog/commit/9c3c64573dcc789b578f8a3ff5efe9e803e008e3) Import / Export (@lexplatt) 10 | - [#38](https://github.com/tbaddade/redaxo_sprog/commit/972277fd02459621966564114b3817e0e92fe97c) Bei eingeblendeter Unternavigation kann im Formular zwischen den Sprachen gewechselt werden 11 | - [#66](https://github.com/tbaddade/redaxo_sprog/pull/66) Kopieren in dieselbe Sprache verhindern (@TobiasKrais) 12 | - [#67](https://github.com/tbaddade/redaxo_sprog/pull/67) Hilfeseite (@marcohanke) 13 | - [#73](https://github.com/tbaddade/redaxo_sprog/pull/73) Funktionen wegen statischer Code-Analyse in eigene Datei verschoben (@dergel) 14 | - Sucheingabe bleibt erhalten 15 | - Layoutanpassungen 16 | 17 | ### Bugfix 18 | 19 | - [#71](https://github.com/tbaddade/redaxo_sprog/commit/3fcba57eed87740cf850b100f6d2be458cc69e18) Sucheingabe wurde nicht an Paginierung übergeben 20 | 21 | 22 | ## Version 1.2.0 – 26.02.2019 23 | 24 | ### Neu 25 | 26 | - [#52](https://github.com/tbaddade/redaxo_sprog/pull/52) Spanische Übersetzung (@nandes2062) 27 | - [#58](https://github.com/tbaddade/redaxo_sprog/pull/58) "Kategorienamen synchronsieren" verständlicher formuliert (@Pixeldaniel) 28 | 29 | ### Bugfix 30 | 31 | - [#50](https://github.com/tbaddade/redaxo_sprog/commit/0d74d9a7efd976844f6ec15d462baccc7e2c2401) Synchronisieren gelöschter Metainfos (@IngoWinter) 32 | - [#56](https://github.com/tbaddade/redaxo_sprog/commit/1e92221f0177b97863b1472fddb1a49bdd4d114f) Countable Warning (@IngoWinter) 33 | 34 | 35 | ## Version 1.1.0 - 30.01.2017 36 | 37 | ### Security 38 | - CSRF Protection eingebaut 39 | 40 | ### Information 41 | - REDAXO 5.5 ist Vorraussetzung 42 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Mapping/ClassDiscriminatorMapping.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Mapping; 13 | 14 | /** 15 | * @author Samuel Roze 16 | */ 17 | class ClassDiscriminatorMapping 18 | { 19 | private $typeProperty; 20 | private $typesMapping; 21 | 22 | public function __construct(string $typeProperty, array $typesMapping = []) 23 | { 24 | $this->typeProperty = $typeProperty; 25 | $this->typesMapping = $typesMapping; 26 | 27 | uasort($this->typesMapping, static function (string $a, string $b): int { 28 | if (is_a($a, $b, true)) { 29 | return -1; 30 | } 31 | 32 | if (is_a($b, $a, true)) { 33 | return 1; 34 | } 35 | 36 | return 0; 37 | }); 38 | } 39 | 40 | public function getTypeProperty(): string 41 | { 42 | return $this->typeProperty; 43 | } 44 | 45 | public function getClassForType(string $type): ?string 46 | { 47 | return $this->typesMapping[$type] ?? null; 48 | } 49 | 50 | /** 51 | * @param object|string $object 52 | */ 53 | public function getMappedObjectType($object): ?string 54 | { 55 | foreach ($this->typesMapping as $type => $typeClass) { 56 | if (is_a($object, $typeClass)) { 57 | return $type; 58 | } 59 | } 60 | 61 | return null; 62 | } 63 | 64 | public function getTypesMapping(): array 65 | { 66 | return $this->typesMapping; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Mapping/Factory/ClassMetadataFactoryInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Mapping\Factory; 13 | 14 | use Symfony\Component\Serializer\Exception\InvalidArgumentException; 15 | use Symfony\Component\Serializer\Mapping\ClassMetadataInterface; 16 | 17 | /** 18 | * Returns a {@see ClassMetadataInterface}. 19 | * 20 | * @author Kévin Dunglas 21 | */ 22 | interface ClassMetadataFactoryInterface 23 | { 24 | /** 25 | * If the method was called with the same class name (or an object of that 26 | * class) before, the same metadata instance is returned. 27 | * 28 | * If the factory was configured with a cache, this method will first look 29 | * for an existing metadata instance in the cache. If an existing instance 30 | * is found, it will be returned without further ado. 31 | * 32 | * Otherwise, a new metadata instance is created. If the factory was 33 | * configured with a loader, the metadata is passed to the 34 | * {@link \Symfony\Component\Serializer\Mapping\Loader\LoaderInterface::loadClassMetadata()} method for further 35 | * configuration. At last, the new object is returned. 36 | * 37 | * @param string|object $value 38 | * 39 | * @return ClassMetadataInterface 40 | * 41 | * @throws InvalidArgumentException 42 | */ 43 | public function getMetadataFor($value); 44 | 45 | /** 46 | * Checks if class has metadata. 47 | * 48 | * @param mixed $value 49 | * 50 | * @return bool 51 | */ 52 | public function hasMetadataFor($value); 53 | } 54 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Mapping/ClassMetadataInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Mapping; 13 | 14 | /** 15 | * Stores metadata needed for serializing and deserializing objects of specific class. 16 | * 17 | * Primarily, the metadata stores the set of attributes to serialize or deserialize. 18 | * 19 | * There may only exist one metadata for each attribute according to its name. 20 | * 21 | * @internal 22 | * 23 | * @author Kévin Dunglas 24 | */ 25 | interface ClassMetadataInterface 26 | { 27 | /** 28 | * Returns the name of the backing PHP class. 29 | * 30 | * @return string The name of the backing class 31 | */ 32 | public function getName(): string; 33 | 34 | /** 35 | * Adds an {@link AttributeMetadataInterface}. 36 | */ 37 | public function addAttributeMetadata(AttributeMetadataInterface $attributeMetadata); 38 | 39 | /** 40 | * Gets the list of {@link AttributeMetadataInterface}. 41 | * 42 | * @return AttributeMetadataInterface[] 43 | */ 44 | public function getAttributesMetadata(): array; 45 | 46 | /** 47 | * Merges a {@link ClassMetadataInterface} in the current one. 48 | */ 49 | public function merge(self $classMetadata); 50 | 51 | /** 52 | * Returns a {@link \ReflectionClass} instance for this class. 53 | */ 54 | public function getReflectionClass(): \ReflectionClass; 55 | 56 | public function getClassDiscriminatorMapping(): ?ClassDiscriminatorMapping; 57 | 58 | public function setClassDiscriminatorMapping(ClassDiscriminatorMapping $mapping = null); 59 | } 60 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Annotation/SerializedName.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Annotation; 13 | 14 | use Symfony\Component\Serializer\Exception\InvalidArgumentException; 15 | 16 | /** 17 | * Annotation class for @SerializedName(). 18 | * 19 | * @Annotation 20 | * @NamedArgumentConstructor 21 | * @Target({"PROPERTY", "METHOD"}) 22 | * 23 | * @author Fabien Bourigault 24 | */ 25 | #[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)] 26 | final class SerializedName 27 | { 28 | /** 29 | * @var string 30 | */ 31 | private $serializedName; 32 | 33 | /** 34 | * @param string $serializedName 35 | */ 36 | public function __construct($serializedName) 37 | { 38 | if (\is_array($serializedName)) { 39 | trigger_deprecation('symfony/serializer', '5.3', 'Passing an array as first argument to "%s" is deprecated. Use named arguments instead.', __METHOD__); 40 | 41 | if (!isset($serializedName['value'])) { 42 | throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" should be set.', static::class)); 43 | } 44 | $serializedName = $serializedName['value']; 45 | } 46 | 47 | if (!\is_string($serializedName) || empty($serializedName)) { 48 | throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a non-empty string.', static::class)); 49 | } 50 | 51 | $this->serializedName = $serializedName; 52 | } 53 | 54 | public function getSerializedName(): string 55 | { 56 | return $this->serializedName; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Encoder/JsonEncode.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Encoder; 13 | 14 | use Symfony\Component\Serializer\Exception\NotEncodableValueException; 15 | 16 | /** 17 | * Encodes JSON data. 18 | * 19 | * @author Sander Coolen 20 | */ 21 | class JsonEncode implements EncoderInterface 22 | { 23 | public const OPTIONS = 'json_encode_options'; 24 | 25 | private $defaultContext = [ 26 | self::OPTIONS => 0, 27 | ]; 28 | 29 | public function __construct(array $defaultContext = []) 30 | { 31 | $this->defaultContext = array_merge($this->defaultContext, $defaultContext); 32 | } 33 | 34 | /** 35 | * Encodes PHP data to a JSON string. 36 | * 37 | * {@inheritdoc} 38 | */ 39 | public function encode($data, string $format, array $context = []) 40 | { 41 | $options = $context[self::OPTIONS] ?? $this->defaultContext[self::OPTIONS]; 42 | 43 | try { 44 | $encodedJson = json_encode($data, $options); 45 | } catch (\JsonException $e) { 46 | throw new NotEncodableValueException($e->getMessage(), 0, $e); 47 | } 48 | 49 | if (\PHP_VERSION_ID >= 70300 && (\JSON_THROW_ON_ERROR & $options)) { 50 | return $encodedJson; 51 | } 52 | 53 | if (\JSON_ERROR_NONE !== json_last_error() && (false === $encodedJson || !($options & \JSON_PARTIAL_OUTPUT_ON_ERROR))) { 54 | throw new NotEncodableValueException(json_last_error_msg()); 55 | } 56 | 57 | return $encodedJson; 58 | } 59 | 60 | /** 61 | * {@inheritdoc} 62 | */ 63 | public function supportsEncoding(string $format) 64 | { 65 | return JsonEncoder::FORMAT === $format; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\NameConverter; 13 | 14 | /** 15 | * CamelCase to Underscore name converter. 16 | * 17 | * @author Kévin Dunglas 18 | */ 19 | class CamelCaseToSnakeCaseNameConverter implements NameConverterInterface 20 | { 21 | private $attributes; 22 | private $lowerCamelCase; 23 | 24 | /** 25 | * @param array|null $attributes The list of attributes to rename or null for all attributes 26 | * @param bool $lowerCamelCase Use lowerCamelCase style 27 | */ 28 | public function __construct(array $attributes = null, bool $lowerCamelCase = true) 29 | { 30 | $this->attributes = $attributes; 31 | $this->lowerCamelCase = $lowerCamelCase; 32 | } 33 | 34 | /** 35 | * {@inheritdoc} 36 | */ 37 | public function normalize(string $propertyName) 38 | { 39 | if (null === $this->attributes || \in_array($propertyName, $this->attributes)) { 40 | return strtolower(preg_replace('/[A-Z]/', '_\\0', lcfirst($propertyName))); 41 | } 42 | 43 | return $propertyName; 44 | } 45 | 46 | /** 47 | * {@inheritdoc} 48 | */ 49 | public function denormalize(string $propertyName) 50 | { 51 | $camelCasedName = preg_replace_callback('/(^|_|\.)+(.)/', function ($match) { 52 | return ('.' === $match[1] ? '_' : '').strtoupper($match[2]); 53 | }, $propertyName); 54 | 55 | if ($this->lowerCamelCase) { 56 | $camelCasedName = lcfirst($camelCasedName); 57 | } 58 | 59 | if (null === $this->attributes || \in_array($camelCasedName, $this->attributes)) { 60 | return $camelCasedName; 61 | } 62 | 63 | return $propertyName; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Mapping/Factory/CacheClassMetadataFactory.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Mapping\Factory; 13 | 14 | use Psr\Cache\CacheItemPoolInterface; 15 | 16 | /** 17 | * Caches metadata using a PSR-6 implementation. 18 | * 19 | * @author Kévin Dunglas 20 | */ 21 | class CacheClassMetadataFactory implements ClassMetadataFactoryInterface 22 | { 23 | use ClassResolverTrait; 24 | 25 | /** 26 | * @var ClassMetadataFactoryInterface 27 | */ 28 | private $decorated; 29 | 30 | /** 31 | * @var CacheItemPoolInterface 32 | */ 33 | private $cacheItemPool; 34 | 35 | private $loadedClasses = []; 36 | 37 | public function __construct(ClassMetadataFactoryInterface $decorated, CacheItemPoolInterface $cacheItemPool) 38 | { 39 | $this->decorated = $decorated; 40 | $this->cacheItemPool = $cacheItemPool; 41 | } 42 | 43 | /** 44 | * {@inheritdoc} 45 | */ 46 | public function getMetadataFor($value) 47 | { 48 | $class = $this->getClass($value); 49 | 50 | if (isset($this->loadedClasses[$class])) { 51 | return $this->loadedClasses[$class]; 52 | } 53 | 54 | $key = rawurlencode(strtr($class, '\\', '_')); 55 | 56 | $item = $this->cacheItemPool->getItem($key); 57 | if ($item->isHit()) { 58 | return $this->loadedClasses[$class] = $item->get(); 59 | } 60 | 61 | $metadata = $this->decorated->getMetadataFor($value); 62 | $this->cacheItemPool->save($item->set($metadata)); 63 | 64 | return $this->loadedClasses[$class] = $metadata; 65 | } 66 | 67 | /** 68 | * {@inheritdoc} 69 | */ 70 | public function hasMetadataFor($value) 71 | { 72 | return $this->decorated->hasMetadataFor($value); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/CacheWarmer/CompiledClassMetadataCacheWarmer.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\CacheWarmer; 13 | 14 | use Symfony\Component\Filesystem\Filesystem; 15 | use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface; 16 | use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryCompiler; 17 | use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface; 18 | 19 | /** 20 | * @author Fabien Bourigault 21 | */ 22 | final class CompiledClassMetadataCacheWarmer implements CacheWarmerInterface 23 | { 24 | private $classesToCompile; 25 | 26 | private $classMetadataFactory; 27 | 28 | private $classMetadataFactoryCompiler; 29 | 30 | private $filesystem; 31 | 32 | public function __construct(array $classesToCompile, ClassMetadataFactoryInterface $classMetadataFactory, ClassMetadataFactoryCompiler $classMetadataFactoryCompiler, Filesystem $filesystem) 33 | { 34 | $this->classesToCompile = $classesToCompile; 35 | $this->classMetadataFactory = $classMetadataFactory; 36 | $this->classMetadataFactoryCompiler = $classMetadataFactoryCompiler; 37 | $this->filesystem = $filesystem; 38 | } 39 | 40 | /** 41 | * {@inheritdoc} 42 | */ 43 | public function warmUp($cacheDir) 44 | { 45 | $metadatas = []; 46 | 47 | foreach ($this->classesToCompile as $classToCompile) { 48 | $metadatas[] = $this->classMetadataFactory->getMetadataFor($classToCompile); 49 | } 50 | 51 | $code = $this->classMetadataFactoryCompiler->compile($metadatas); 52 | 53 | $this->filesystem->dumpFile("{$cacheDir}/serializer.class.metadata.php", $code); 54 | 55 | return []; 56 | } 57 | 58 | /** 59 | * {@inheritdoc} 60 | */ 61 | public function isOptional() 62 | { 63 | return true; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/NormalizerInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | use Symfony\Component\Serializer\Exception\CircularReferenceException; 15 | use Symfony\Component\Serializer\Exception\ExceptionInterface; 16 | use Symfony\Component\Serializer\Exception\InvalidArgumentException; 17 | use Symfony\Component\Serializer\Exception\LogicException; 18 | 19 | /** 20 | * @author Jordi Boggiano 21 | */ 22 | interface NormalizerInterface 23 | { 24 | /** 25 | * Normalizes an object into a set of arrays/scalars. 26 | * 27 | * @param mixed $object Object to normalize 28 | * @param string $format Format the normalization result will be encoded as 29 | * @param array $context Context options for the normalizer 30 | * 31 | * @return array|string|int|float|bool|\ArrayObject|null \ArrayObject is used to make sure an empty object is encoded as an object not an array 32 | * 33 | * @throws InvalidArgumentException Occurs when the object given is not a supported type for the normalizer 34 | * @throws CircularReferenceException Occurs when the normalizer detects a circular reference when no circular 35 | * reference handler can fix it 36 | * @throws LogicException Occurs when the normalizer is not called in an expected context 37 | * @throws ExceptionInterface Occurs for all the other cases of errors 38 | */ 39 | public function normalize($object, string $format = null, array $context = []); 40 | 41 | /** 42 | * Checks whether the given class is supported for normalization by this normalizer. 43 | * 44 | * @param mixed $data Data to normalize 45 | * @param string $format The format being (de-)serialized from or into 46 | * 47 | * @return bool 48 | */ 49 | public function supportsNormalization($data, string $format = null); 50 | } 51 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Annotation/Groups.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Annotation; 13 | 14 | use Symfony\Component\Serializer\Exception\InvalidArgumentException; 15 | 16 | /** 17 | * Annotation class for @Groups(). 18 | * 19 | * @Annotation 20 | * @NamedArgumentConstructor 21 | * @Target({"PROPERTY", "METHOD"}) 22 | * 23 | * @author Kévin Dunglas 24 | */ 25 | #[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)] 26 | class Groups 27 | { 28 | /** 29 | * @var string[] 30 | */ 31 | private $groups; 32 | 33 | /** 34 | * @param string|string[] $groups 35 | */ 36 | public function __construct($groups) 37 | { 38 | if (\is_string($groups)) { 39 | $groups = (array) $groups; 40 | } elseif (!\is_array($groups)) { 41 | throw new \TypeError(sprintf('"%s": Parameter $groups is expected to be a string or an array of strings, got "%s".', __METHOD__, get_debug_type($groups))); 42 | } elseif (isset($groups['value'])) { 43 | trigger_deprecation('symfony/serializer', '5.3', 'Passing an array of properties as first argument to "%s" is deprecated. Use named arguments instead.', __METHOD__); 44 | 45 | $groups = (array) $groups['value']; 46 | } 47 | if (empty($groups)) { 48 | throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" cannot be empty.', static::class)); 49 | } 50 | 51 | foreach ($groups as $group) { 52 | if (!\is_string($group) || '' === $group) { 53 | throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a string or an array of non-empty strings.', static::class)); 54 | } 55 | } 56 | 57 | $this->groups = $groups; 58 | } 59 | 60 | /** 61 | * @return string[] 62 | */ 63 | public function getGroups() 64 | { 65 | return $this->groups; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Mapping/Factory/ClassMetadataFactory.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Mapping\Factory; 13 | 14 | use Symfony\Component\Serializer\Mapping\ClassMetadata; 15 | use Symfony\Component\Serializer\Mapping\Loader\LoaderInterface; 16 | 17 | /** 18 | * Returns a {@link ClassMetadata}. 19 | * 20 | * @author Kévin Dunglas 21 | */ 22 | class ClassMetadataFactory implements ClassMetadataFactoryInterface 23 | { 24 | use ClassResolverTrait; 25 | 26 | private $loader; 27 | 28 | /** 29 | * @var array 30 | */ 31 | private $loadedClasses; 32 | 33 | public function __construct(LoaderInterface $loader) 34 | { 35 | $this->loader = $loader; 36 | } 37 | 38 | /** 39 | * {@inheritdoc} 40 | */ 41 | public function getMetadataFor($value) 42 | { 43 | $class = $this->getClass($value); 44 | 45 | if (isset($this->loadedClasses[$class])) { 46 | return $this->loadedClasses[$class]; 47 | } 48 | 49 | $classMetadata = new ClassMetadata($class); 50 | $this->loader->loadClassMetadata($classMetadata); 51 | 52 | $reflectionClass = $classMetadata->getReflectionClass(); 53 | 54 | // Include metadata from the parent class 55 | if ($parent = $reflectionClass->getParentClass()) { 56 | $classMetadata->merge($this->getMetadataFor($parent->name)); 57 | } 58 | 59 | // Include metadata from all implemented interfaces 60 | foreach ($reflectionClass->getInterfaces() as $interface) { 61 | $classMetadata->merge($this->getMetadataFor($interface->name)); 62 | } 63 | 64 | return $this->loadedClasses[$class] = $classMetadata; 65 | } 66 | 67 | /** 68 | * {@inheritdoc} 69 | */ 70 | public function hasMetadataFor($value) 71 | { 72 | return \is_object($value) || (\is_string($value) && (class_exists($value) || interface_exists($value, false))); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Mapping/Loader/LoaderChain.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Mapping\Loader; 13 | 14 | use Symfony\Component\Serializer\Exception\MappingException; 15 | use Symfony\Component\Serializer\Mapping\ClassMetadataInterface; 16 | 17 | /** 18 | * Calls multiple {@link LoaderInterface} instances in a chain. 19 | * 20 | * This class accepts multiple instances of LoaderInterface to be passed to the 21 | * constructor. When {@link loadClassMetadata()} is called, the same method is called 22 | * in all of these loaders, regardless of whether any of them was 23 | * successful or not. 24 | * 25 | * @author Bernhard Schussek 26 | * @author Kévin Dunglas 27 | */ 28 | class LoaderChain implements LoaderInterface 29 | { 30 | private $loaders; 31 | 32 | /** 33 | * Accepts a list of LoaderInterface instances. 34 | * 35 | * @param LoaderInterface[] $loaders An array of LoaderInterface instances 36 | * 37 | * @throws MappingException If any of the loaders does not implement LoaderInterface 38 | */ 39 | public function __construct(array $loaders) 40 | { 41 | foreach ($loaders as $loader) { 42 | if (!$loader instanceof LoaderInterface) { 43 | throw new MappingException(sprintf('Class "%s" is expected to implement LoaderInterface.', get_debug_type($loader))); 44 | } 45 | } 46 | 47 | $this->loaders = $loaders; 48 | } 49 | 50 | /** 51 | * {@inheritdoc} 52 | */ 53 | public function loadClassMetadata(ClassMetadataInterface $metadata) 54 | { 55 | $success = false; 56 | 57 | foreach ($this->loaders as $loader) { 58 | $success = $loader->loadClassMetadata($metadata) || $success; 59 | } 60 | 61 | return $success; 62 | } 63 | 64 | /** 65 | * @return LoaderInterface[] 66 | */ 67 | public function getLoaders() 68 | { 69 | return $this->loaders; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Mapping/Factory/ClassMetadataFactoryCompiler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Mapping\Factory; 13 | 14 | use Symfony\Component\Serializer\Mapping\ClassMetadataInterface; 15 | use Symfony\Component\VarExporter\VarExporter; 16 | 17 | /** 18 | * @author Fabien Bourigault 19 | */ 20 | final class ClassMetadataFactoryCompiler 21 | { 22 | /** 23 | * @param ClassMetadataInterface[] $classMetadatas 24 | */ 25 | public function compile(array $classMetadatas): string 26 | { 27 | return <<generateDeclaredClassMetadata($classMetadatas)} 33 | ]; 34 | EOF; 35 | } 36 | 37 | /** 38 | * @param ClassMetadataInterface[] $classMetadatas 39 | */ 40 | private function generateDeclaredClassMetadata(array $classMetadatas): string 41 | { 42 | $compiled = ''; 43 | 44 | foreach ($classMetadatas as $classMetadata) { 45 | $attributesMetadata = []; 46 | foreach ($classMetadata->getAttributesMetadata() as $attributeMetadata) { 47 | $attributesMetadata[$attributeMetadata->getName()] = [ 48 | $attributeMetadata->getGroups(), 49 | $attributeMetadata->getMaxDepth(), 50 | $attributeMetadata->getSerializedName(), 51 | ]; 52 | } 53 | 54 | $classDiscriminatorMapping = $classMetadata->getClassDiscriminatorMapping() ? [ 55 | $classMetadata->getClassDiscriminatorMapping()->getTypeProperty(), 56 | $classMetadata->getClassDiscriminatorMapping()->getTypesMapping(), 57 | ] : null; 58 | 59 | $compiled .= sprintf("\n'%s' => %s,", $classMetadata->getName(), VarExporter::export([ 60 | $attributesMetadata, 61 | $classDiscriminatorMapping, 62 | ])); 63 | } 64 | 65 | return $compiled; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/UnwrappingDenormalizer.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | use Symfony\Component\PropertyAccess\PropertyAccess; 15 | use Symfony\Component\PropertyAccess\PropertyAccessorInterface; 16 | use Symfony\Component\Serializer\SerializerAwareInterface; 17 | use Symfony\Component\Serializer\SerializerAwareTrait; 18 | 19 | /** 20 | * @author Eduard Bulava 21 | */ 22 | final class UnwrappingDenormalizer implements DenormalizerInterface, SerializerAwareInterface, CacheableSupportsMethodInterface 23 | { 24 | use SerializerAwareTrait; 25 | 26 | public const UNWRAP_PATH = 'unwrap_path'; 27 | 28 | private $propertyAccessor; 29 | 30 | public function __construct(PropertyAccessorInterface $propertyAccessor = null) 31 | { 32 | $this->propertyAccessor = $propertyAccessor ?? PropertyAccess::createPropertyAccessor(); 33 | } 34 | 35 | /** 36 | * {@inheritdoc} 37 | */ 38 | public function denormalize($data, $class, string $format = null, array $context = []) 39 | { 40 | $propertyPath = $context[self::UNWRAP_PATH]; 41 | $context['unwrapped'] = true; 42 | 43 | if ($propertyPath) { 44 | if (!$this->propertyAccessor->isReadable($data, $propertyPath)) { 45 | return null; 46 | } 47 | 48 | $data = $this->propertyAccessor->getValue($data, $propertyPath); 49 | } 50 | 51 | return $this->serializer->denormalize($data, $class, $format, $context); 52 | } 53 | 54 | /** 55 | * {@inheritdoc} 56 | */ 57 | public function supportsDenormalization($data, $type, string $format = null, array $context = []) 58 | { 59 | return \array_key_exists(self::UNWRAP_PATH, $context) && !isset($context['unwrapped']); 60 | } 61 | 62 | /** 63 | * {@inheritdoc} 64 | */ 65 | public function hasCacheableSupportsMethod(): bool 66 | { 67 | return $this->serializer instanceof CacheableSupportsMethodInterface && $this->serializer->hasCacheableSupportsMethod(); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Annotation/DiscriminatorMap.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Annotation; 13 | 14 | use Symfony\Component\Serializer\Exception\InvalidArgumentException; 15 | 16 | /** 17 | * Annotation class for @DiscriminatorMap(). 18 | * 19 | * @Annotation 20 | * @NamedArgumentConstructor 21 | * @Target({"CLASS"}) 22 | * 23 | * @author Samuel Roze 24 | */ 25 | #[\Attribute(\Attribute::TARGET_CLASS)] 26 | class DiscriminatorMap 27 | { 28 | /** 29 | * @var string 30 | */ 31 | private $typeProperty; 32 | 33 | /** 34 | * @var array 35 | */ 36 | private $mapping; 37 | 38 | /** 39 | * @param string $typeProperty 40 | * 41 | * @throws InvalidArgumentException 42 | */ 43 | public function __construct($typeProperty, array $mapping = null) 44 | { 45 | if (\is_array($typeProperty)) { 46 | trigger_deprecation('symfony/serializer', '5.3', 'Passing an array as first argument to "%s" is deprecated. Use named arguments instead.', __METHOD__); 47 | 48 | $mapping = $typeProperty['mapping'] ?? null; 49 | $typeProperty = $typeProperty['typeProperty'] ?? null; 50 | } elseif (!\is_string($typeProperty)) { 51 | throw new \TypeError(sprintf('"%s": Argument $typeProperty was expected to be a string or array, got "%s".', __METHOD__, get_debug_type($typeProperty))); 52 | } 53 | 54 | if (empty($typeProperty)) { 55 | throw new InvalidArgumentException(sprintf('Parameter "typeProperty" of annotation "%s" cannot be empty.', static::class)); 56 | } 57 | 58 | if (empty($mapping)) { 59 | throw new InvalidArgumentException(sprintf('Parameter "mapping" of annotation "%s" cannot be empty.', static::class)); 60 | } 61 | 62 | $this->typeProperty = $typeProperty; 63 | $this->mapping = $mapping; 64 | } 65 | 66 | public function getTypeProperty(): string 67 | { 68 | return $this->typeProperty; 69 | } 70 | 71 | public function getMapping(): array 72 | { 73 | return $this->mapping; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/JsonSerializableNormalizer.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | use Symfony\Component\Serializer\Exception\InvalidArgumentException; 15 | use Symfony\Component\Serializer\Exception\LogicException; 16 | 17 | /** 18 | * A normalizer that uses an objects own JsonSerializable implementation. 19 | * 20 | * @author Fred Cox 21 | */ 22 | class JsonSerializableNormalizer extends AbstractNormalizer 23 | { 24 | /** 25 | * {@inheritdoc} 26 | */ 27 | public function normalize($object, string $format = null, array $context = []) 28 | { 29 | if ($this->isCircularReference($object, $context)) { 30 | return $this->handleCircularReference($object); 31 | } 32 | 33 | if (!$object instanceof \JsonSerializable) { 34 | throw new InvalidArgumentException(sprintf('The object must implement "%s".', \JsonSerializable::class)); 35 | } 36 | 37 | if (!$this->serializer instanceof NormalizerInterface) { 38 | throw new LogicException('Cannot normalize object because injected serializer is not a normalizer.'); 39 | } 40 | 41 | return $this->serializer->normalize($object->jsonSerialize(), $format, $context); 42 | } 43 | 44 | /** 45 | * {@inheritdoc} 46 | */ 47 | public function supportsNormalization($data, string $format = null) 48 | { 49 | return $data instanceof \JsonSerializable; 50 | } 51 | 52 | /** 53 | * {@inheritdoc} 54 | */ 55 | public function supportsDenormalization($data, string $type, string $format = null) 56 | { 57 | return false; 58 | } 59 | 60 | /** 61 | * {@inheritdoc} 62 | */ 63 | public function denormalize($data, string $type, string $format = null, array $context = []) 64 | { 65 | throw new LogicException(sprintf('Cannot denormalize with "%s".', \JsonSerializable::class)); 66 | } 67 | 68 | /** 69 | * {@inheritdoc} 70 | */ 71 | public function hasCacheableSupportsMethod(): bool 72 | { 73 | return __CLASS__ === static::class; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Encoder/ChainDecoder.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Encoder; 13 | 14 | use Symfony\Component\Serializer\Exception\RuntimeException; 15 | 16 | /** 17 | * Decoder delegating the decoding to a chain of decoders. 18 | * 19 | * @author Jordi Boggiano 20 | * @author Johannes M. Schmitt 21 | * @author Lukas Kahwe Smith 22 | * 23 | * @final 24 | */ 25 | class ChainDecoder implements ContextAwareDecoderInterface 26 | { 27 | protected $decoders = []; 28 | protected $decoderByFormat = []; 29 | 30 | public function __construct(array $decoders = []) 31 | { 32 | $this->decoders = $decoders; 33 | } 34 | 35 | /** 36 | * {@inheritdoc} 37 | */ 38 | final public function decode(string $data, string $format, array $context = []) 39 | { 40 | return $this->getDecoder($format, $context)->decode($data, $format, $context); 41 | } 42 | 43 | /** 44 | * {@inheritdoc} 45 | */ 46 | public function supportsDecoding(string $format, array $context = []): bool 47 | { 48 | try { 49 | $this->getDecoder($format, $context); 50 | } catch (RuntimeException $e) { 51 | return false; 52 | } 53 | 54 | return true; 55 | } 56 | 57 | /** 58 | * Gets the decoder supporting the format. 59 | * 60 | * @throws RuntimeException if no decoder is found 61 | */ 62 | private function getDecoder(string $format, array $context): DecoderInterface 63 | { 64 | if (isset($this->decoderByFormat[$format]) 65 | && isset($this->decoders[$this->decoderByFormat[$format]]) 66 | ) { 67 | return $this->decoders[$this->decoderByFormat[$format]]; 68 | } 69 | 70 | foreach ($this->decoders as $i => $decoder) { 71 | if ($decoder->supportsDecoding($format, $context)) { 72 | $this->decoderByFormat[$format] = $i; 73 | 74 | return $decoder; 75 | } 76 | } 77 | 78 | throw new RuntimeException(sprintf('No decoder found for format "%s".', $format)); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /functions/sprog.php: -------------------------------------------------------------------------------- 1 | 'DE Überschrift', 10 | * 'headline_2' => 'EN Heading', 11 | * 'text_1' => 'DE Zwei flinke Boxer jagen die quirlige Eva und ihren Mops durch Sylt.', 12 | * 'text_2' => 'EN The quick, brown fox jumps over a lazy dog.', 13 | * ]; 14 | * $fields = ['headline', 'text']; 15 | * 16 | * E.g. The current clang_id is 1 for german 17 | * $array = sprogarray($array, $fields); 18 | * Array 19 | * ( 20 | * 'headline_1' => 'DE Überschrift', 21 | * 'headline_2' => 'EN Heading', 22 | * 'text_1' => 'DE Zwei flinke Boxer jagen die quirlige Eva und ihren Mops durch Sylt.', 23 | * 'text_2' => 'EN The quick, brown fox jumps over a lazy dog.', 24 | * 'headline' => 'DE Überschrift', 25 | * 'text' => 'DE Zwei flinke Boxer jagen die quirlige Eva und ihren Mops durch Sylt.', 26 | * ) 27 | */ 28 | function sprogarray(array $array, array $fields, $fallback_clang_id = 0, $separator = '_') 29 | { 30 | foreach ($fields as $field) { 31 | $array[$field] = sprogvalue($array, $field, $fallback_clang_id, $separator); 32 | } 33 | return $array; 34 | } 35 | 36 | 37 | /** 38 | * Replaced given wildcard. 39 | */ 40 | function sprogcard($wildcard, $clang_id = null) 41 | { 42 | return Wildcard::get($wildcard, $clang_id); 43 | } 44 | 45 | 46 | /** 47 | * Replaced some wildcards in given text. 48 | */ 49 | function sprogdown($text, $clang_id = null) 50 | { 51 | return Wildcard::parse($text, $clang_id); 52 | } 53 | 54 | 55 | /** 56 | * Returns a field with the suffix of the current clang id. 57 | */ 58 | function sprogfield($field, $separator = '_') 59 | { 60 | return $field.$separator.rex_clang::getCurrentId(); 61 | } 62 | 63 | 64 | /** 65 | * Returns the value by given an array and field. 66 | * The field will be modified with the suffix of the current clang id. 67 | */ 68 | function sprogvalue(array $array, $field, $fallback_clang_id = 0, $separator = '_') 69 | { 70 | $modifiedField = sprogfield($field, $separator); 71 | if (isset($array[$modifiedField])) { 72 | return $array[$modifiedField]; 73 | } 74 | 75 | $modifiedField = $field.$separator.$fallback_clang_id; 76 | if (isset($array[$modifiedField])) { 77 | return $array[$modifiedField]; 78 | } 79 | 80 | if (isset($array[$field])) { 81 | return $array[$field]; 82 | } 83 | 84 | return false; 85 | } 86 | -------------------------------------------------------------------------------- /lib/Sprog/Export/CsvExport.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Sprog\Export; 13 | 14 | use Symfony\Component\Serializer\Encoder\CsvEncoder; 15 | 16 | class CsvExport 17 | { 18 | protected array $headers; 19 | protected array $items; 20 | private array $context; 21 | private CsvEncoder $encoder; 22 | 23 | public function __construct() 24 | { 25 | $this->encoder = new CsvEncoder(); 26 | $this->context = [ 27 | CsvEncoder::DELIMITER_KEY => ';', 28 | CsvEncoder::OUTPUT_UTF8_BOM_KEY => true, 29 | CsvEncoder::NO_HEADERS_KEY => true, 30 | ]; 31 | } 32 | 33 | public function addHeaders(array $values) 34 | { 35 | $this->context[CsvEncoder::HEADERS_KEY] = $values; 36 | $this->context[CsvEncoder::NO_HEADERS_KEY] = false; 37 | } 38 | 39 | public function addItem(array $values) 40 | { 41 | $this->items[] = $values; 42 | } 43 | 44 | public function setDelimiter(string $value) 45 | { 46 | $this->context[CsvEncoder::DELIMITER_KEY] = $value; 47 | } 48 | 49 | public function setUtf8Bom(bool $value = true) 50 | { 51 | $this->context[CsvEncoder::OUTPUT_UTF8_BOM_KEY] = $value; 52 | } 53 | 54 | public function sendFile(string $fileName): void 55 | { 56 | if ('.csv' !== substr($fileName, -4)) { 57 | $fileName .= '.csv'; 58 | } 59 | 60 | header('Content-Disposition: attachment; filename="' . $fileName . '"; charset=utf-8'); 61 | \rex_response::sendContent($this->getStream(), 'text/csv'); 62 | exit(); 63 | } 64 | 65 | public function getStream() 66 | { 67 | if (false === $this->context[CsvEncoder::NO_HEADERS_KEY] && isset($this->context[CsvEncoder::HEADERS_KEY])) { 68 | $headers = $this->context[CsvEncoder::HEADERS_KEY]; 69 | 70 | foreach ($this->items as $index => $item) { 71 | $data = []; 72 | foreach ($item as $header => $value) { 73 | $data[$headers[$header]] = $value; 74 | } 75 | $this->items[$index] = $data; 76 | } 77 | } 78 | 79 | return $this->encoder->encode($this->items, 'csv', $this->context); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /package.yml: -------------------------------------------------------------------------------- 1 | package: sprog 2 | version: '1.5.1' 3 | author: Thomas Blum 4 | supportpage: www.redaxo.org/de/forum/ 5 | 6 | requires: 7 | redaxo: '^5.11' 8 | 9 | filter: 10 | - Sprog\Filter\Format 11 | - Sprog\Filter\Limit 12 | - Sprog\Filter\Lower 13 | - Sprog\Filter\Markdown 14 | - Sprog\Filter\Raw 15 | - Sprog\Filter\Title 16 | - Sprog\Filter\Upper 17 | - Sprog\Filter\Words 18 | 19 | page: 20 | title: 'translate:sprog' 21 | perm: sprog[] 22 | pjax: true 23 | icon: rex-icon rex-icon-language 24 | subpages: 25 | wildcard: 26 | title: 'translate:wildcard' 27 | abbreviation: 28 | title: 'translate:abbreviations' 29 | perm: sprog[abbreviation] 30 | copy: 31 | title: 'translate:copy_content' 32 | perm: admin[] 33 | subpages: 34 | structure_content: 35 | title: 'translate:copy_structure_content' 36 | structure_metadata: 37 | title: 'translate:copy_structure_metadata' 38 | artefact: 39 | title: 'translate:artefact' 40 | perm: admin[] 41 | pjax: false 42 | subpages: 43 | import: 44 | title: 'translate:import' 45 | export: 46 | title: 'translate:export' 47 | # cleanup: 48 | # title: 'translate:cleanup' 49 | settings: 50 | title: 'translate:settings' 51 | perm: admin[] 52 | help: 53 | title: 'translate:help' 54 | subPath: README.md 55 | perm: admin[] 56 | itemClass: pull-right 57 | 58 | 59 | pages: 60 | sprog.copy.structure_content_popup: 61 | title: 'translate:copy_structure_content_popup' 62 | main: true 63 | popup: true 64 | hidden: true 65 | sprog.copy.structure_content_generate: 66 | title: 'translate:copy_structure_content_generate' 67 | main: true 68 | hasLayout: false 69 | hidden: true 70 | sprog.copy.structure_metadata_popup: 71 | title: 'translate:copy_structure_metadata_popup' 72 | main: true 73 | popup: true 74 | hidden: true 75 | sprog.copy.structure_metadata_generate: 76 | title: 'translate:copy_structure_metadata_generate' 77 | main: true 78 | hasLayout: false 79 | hidden: true 80 | 81 | default_config: 82 | wildcard_open_tag: '{{ ' 83 | wildcard_close_tag: ' }}' 84 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/CustomNormalizer.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | use Symfony\Component\Serializer\SerializerAwareInterface; 15 | use Symfony\Component\Serializer\SerializerAwareTrait; 16 | 17 | /** 18 | * @author Jordi Boggiano 19 | */ 20 | class CustomNormalizer implements NormalizerInterface, DenormalizerInterface, SerializerAwareInterface, CacheableSupportsMethodInterface 21 | { 22 | use ObjectToPopulateTrait; 23 | use SerializerAwareTrait; 24 | 25 | /** 26 | * {@inheritdoc} 27 | */ 28 | public function normalize($object, string $format = null, array $context = []) 29 | { 30 | return $object->normalize($this->serializer, $format, $context); 31 | } 32 | 33 | /** 34 | * {@inheritdoc} 35 | */ 36 | public function denormalize($data, string $type, string $format = null, array $context = []) 37 | { 38 | $object = $this->extractObjectToPopulate($type, $context) ?? new $type(); 39 | $object->denormalize($this->serializer, $data, $format, $context); 40 | 41 | return $object; 42 | } 43 | 44 | /** 45 | * Checks if the given class implements the NormalizableInterface. 46 | * 47 | * @param mixed $data Data to normalize 48 | * @param string $format The format being (de-)serialized from or into 49 | * 50 | * @return bool 51 | */ 52 | public function supportsNormalization($data, string $format = null) 53 | { 54 | return $data instanceof NormalizableInterface; 55 | } 56 | 57 | /** 58 | * Checks if the given class implements the DenormalizableInterface. 59 | * 60 | * @param mixed $data Data to denormalize from 61 | * @param string $type The class to which the data should be denormalized 62 | * @param string $format The format being deserialized from 63 | * 64 | * @return bool 65 | */ 66 | public function supportsDenormalization($data, string $type, string $format = null) 67 | { 68 | return is_subclass_of($type, DenormalizableInterface::class); 69 | } 70 | 71 | /** 72 | * {@inheritdoc} 73 | */ 74 | public function hasCacheableSupportsMethod(): bool 75 | { 76 | return __CLASS__ === static::class; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/DateTimeZoneNormalizer.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | use Symfony\Component\Serializer\Exception\InvalidArgumentException; 15 | use Symfony\Component\Serializer\Exception\NotNormalizableValueException; 16 | 17 | /** 18 | * Normalizes a {@see \DateTimeZone} object to a timezone string. 19 | * 20 | * @author Jérôme Desjardins 21 | */ 22 | class DateTimeZoneNormalizer implements NormalizerInterface, DenormalizerInterface, CacheableSupportsMethodInterface 23 | { 24 | /** 25 | * {@inheritdoc} 26 | * 27 | * @throws InvalidArgumentException 28 | * 29 | * @return string 30 | */ 31 | public function normalize($object, string $format = null, array $context = []) 32 | { 33 | if (!$object instanceof \DateTimeZone) { 34 | throw new InvalidArgumentException('The object must be an instance of "\DateTimeZone".'); 35 | } 36 | 37 | return $object->getName(); 38 | } 39 | 40 | /** 41 | * {@inheritdoc} 42 | */ 43 | public function supportsNormalization($data, string $format = null) 44 | { 45 | return $data instanceof \DateTimeZone; 46 | } 47 | 48 | /** 49 | * {@inheritdoc} 50 | * 51 | * @throws NotNormalizableValueException 52 | * 53 | * @return \DateTimeZone 54 | */ 55 | public function denormalize($data, string $type, string $format = null, array $context = []) 56 | { 57 | if ('' === $data || null === $data) { 58 | throw new NotNormalizableValueException('The data is either an empty string or null, you should pass a string that can be parsed as a DateTimeZone.'); 59 | } 60 | 61 | try { 62 | return new \DateTimeZone($data); 63 | } catch (\Exception $e) { 64 | throw new NotNormalizableValueException($e->getMessage(), $e->getCode(), $e); 65 | } 66 | } 67 | 68 | /** 69 | * {@inheritdoc} 70 | */ 71 | public function supportsDenormalization($data, string $type, string $format = null) 72 | { 73 | return \DateTimeZone::class === $type; 74 | } 75 | 76 | /** 77 | * {@inheritdoc} 78 | */ 79 | public function hasCacheableSupportsMethod(): bool 80 | { 81 | return __CLASS__ === static::class; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/ProblemNormalizer.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | use Symfony\Component\ErrorHandler\Exception\FlattenException; 15 | use Symfony\Component\Serializer\Exception\InvalidArgumentException; 16 | 17 | /** 18 | * Normalizes errors according to the API Problem spec (RFC 7807). 19 | * 20 | * @see https://tools.ietf.org/html/rfc7807 21 | * 22 | * @author Kévin Dunglas 23 | * @author Yonel Ceruto 24 | */ 25 | class ProblemNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface 26 | { 27 | private $debug; 28 | private $defaultContext = [ 29 | 'type' => 'https://tools.ietf.org/html/rfc2616#section-10', 30 | 'title' => 'An error occurred', 31 | ]; 32 | 33 | public function __construct(bool $debug = false, array $defaultContext = []) 34 | { 35 | $this->debug = $debug; 36 | $this->defaultContext = $defaultContext + $this->defaultContext; 37 | } 38 | 39 | /** 40 | * {@inheritdoc} 41 | * 42 | * @return array 43 | */ 44 | public function normalize($object, string $format = null, array $context = []) 45 | { 46 | if (!$object instanceof FlattenException) { 47 | throw new InvalidArgumentException(sprintf('The object must implement "%s".', FlattenException::class)); 48 | } 49 | 50 | $context += $this->defaultContext; 51 | $debug = $this->debug && ($context['debug'] ?? true); 52 | 53 | $data = [ 54 | 'type' => $context['type'], 55 | 'title' => $context['title'], 56 | 'status' => $context['status'] ?? $object->getStatusCode(), 57 | 'detail' => $debug ? $object->getMessage() : $object->getStatusText(), 58 | ]; 59 | if ($debug) { 60 | $data['class'] = $object->getClass(); 61 | $data['trace'] = $object->getTrace(); 62 | } 63 | 64 | return $data; 65 | } 66 | 67 | /** 68 | * {@inheritdoc} 69 | */ 70 | public function supportsNormalization($data, string $format = null): bool 71 | { 72 | return $data instanceof FlattenException; 73 | } 74 | 75 | /** 76 | * {@inheritdoc} 77 | */ 78 | public function hasCacheableSupportsMethod(): bool 79 | { 80 | return true; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/DenormalizerInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | use Symfony\Component\Serializer\Exception\BadMethodCallException; 15 | use Symfony\Component\Serializer\Exception\ExceptionInterface; 16 | use Symfony\Component\Serializer\Exception\ExtraAttributesException; 17 | use Symfony\Component\Serializer\Exception\InvalidArgumentException; 18 | use Symfony\Component\Serializer\Exception\LogicException; 19 | use Symfony\Component\Serializer\Exception\RuntimeException; 20 | use Symfony\Component\Serializer\Exception\UnexpectedValueException; 21 | 22 | /** 23 | * @author Jordi Boggiano 24 | */ 25 | interface DenormalizerInterface 26 | { 27 | /** 28 | * Denormalizes data back into an object of the given class. 29 | * 30 | * @param mixed $data Data to restore 31 | * @param string $type The expected class to instantiate 32 | * @param string $format Format the given data was extracted from 33 | * @param array $context Options available to the denormalizer 34 | * 35 | * @return mixed 36 | * 37 | * @throws BadMethodCallException Occurs when the normalizer is not called in an expected context 38 | * @throws InvalidArgumentException Occurs when the arguments are not coherent or not supported 39 | * @throws UnexpectedValueException Occurs when the item cannot be hydrated with the given data 40 | * @throws ExtraAttributesException Occurs when the item doesn't have attribute to receive given data 41 | * @throws LogicException Occurs when the normalizer is not supposed to denormalize 42 | * @throws RuntimeException Occurs if the class cannot be instantiated 43 | * @throws ExceptionInterface Occurs for all the other cases of errors 44 | */ 45 | public function denormalize($data, string $type, string $format = null, array $context = []); 46 | 47 | /** 48 | * Checks whether the given class is supported for denormalization by this normalizer. 49 | * 50 | * @param mixed $data Data to denormalize from 51 | * @param string $type The class to which the data should be denormalized 52 | * @param string $format The format being deserialized from 53 | * 54 | * @return bool 55 | */ 56 | public function supportsDenormalization($data, string $type, string $format = null); 57 | } 58 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/DependencyInjection/SerializerPass.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\DependencyInjection; 13 | 14 | use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; 15 | use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait; 16 | use Symfony\Component\DependencyInjection\ContainerBuilder; 17 | use Symfony\Component\DependencyInjection\Exception\RuntimeException; 18 | 19 | /** 20 | * Adds all services with the tags "serializer.encoder" and "serializer.normalizer" as 21 | * encoders and normalizers to the "serializer" service. 22 | * 23 | * @author Javier Lopez 24 | * @author Robin Chalas 25 | */ 26 | class SerializerPass implements CompilerPassInterface 27 | { 28 | use PriorityTaggedServiceTrait; 29 | 30 | private $serializerService; 31 | private $normalizerTag; 32 | private $encoderTag; 33 | 34 | public function __construct(string $serializerService = 'serializer', string $normalizerTag = 'serializer.normalizer', string $encoderTag = 'serializer.encoder') 35 | { 36 | if (0 < \func_num_args()) { 37 | trigger_deprecation('symfony/serializer', '5.3', 'Configuring "%s" is deprecated.', __CLASS__); 38 | } 39 | 40 | $this->serializerService = $serializerService; 41 | $this->normalizerTag = $normalizerTag; 42 | $this->encoderTag = $encoderTag; 43 | } 44 | 45 | public function process(ContainerBuilder $container) 46 | { 47 | if (!$container->hasDefinition($this->serializerService)) { 48 | return; 49 | } 50 | 51 | if (!$normalizers = $this->findAndSortTaggedServices($this->normalizerTag, $container)) { 52 | throw new RuntimeException(sprintf('You must tag at least one service as "%s" to use the "%s" service.', $this->normalizerTag, $this->serializerService)); 53 | } 54 | 55 | $serializerDefinition = $container->getDefinition($this->serializerService); 56 | $serializerDefinition->replaceArgument(0, $normalizers); 57 | 58 | if (!$encoders = $this->findAndSortTaggedServices($this->encoderTag, $container)) { 59 | throw new RuntimeException(sprintf('You must tag at least one service as "%s" to use the "%s" service.', $this->encoderTag, $this->serializerService)); 60 | } 61 | 62 | $serializerDefinition->replaceArgument(1, $encoders); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/FormErrorNormalizer.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | use Symfony\Component\Form\FormInterface; 15 | 16 | /** 17 | * Normalizes invalid Form instances. 18 | */ 19 | final class FormErrorNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface 20 | { 21 | public const TITLE = 'title'; 22 | public const TYPE = 'type'; 23 | public const CODE = 'status_code'; 24 | 25 | /** 26 | * {@inheritdoc} 27 | */ 28 | public function normalize($object, $format = null, array $context = []): array 29 | { 30 | $data = [ 31 | 'title' => $context[self::TITLE] ?? 'Validation Failed', 32 | 'type' => $context[self::TYPE] ?? 'https://symfony.com/errors/form', 33 | 'code' => $context[self::CODE] ?? null, 34 | 'errors' => $this->convertFormErrorsToArray($object), 35 | ]; 36 | 37 | if (0 !== \count($object->all())) { 38 | $data['children'] = $this->convertFormChildrenToArray($object); 39 | } 40 | 41 | return $data; 42 | } 43 | 44 | /** 45 | * {@inheritdoc} 46 | */ 47 | public function supportsNormalization($data, $format = null): bool 48 | { 49 | return $data instanceof FormInterface && $data->isSubmitted() && !$data->isValid(); 50 | } 51 | 52 | private function convertFormErrorsToArray(FormInterface $data): array 53 | { 54 | $errors = []; 55 | 56 | foreach ($data->getErrors() as $error) { 57 | $errors[] = [ 58 | 'message' => $error->getMessage(), 59 | 'cause' => $error->getCause(), 60 | ]; 61 | } 62 | 63 | return $errors; 64 | } 65 | 66 | private function convertFormChildrenToArray(FormInterface $data): array 67 | { 68 | $children = []; 69 | 70 | foreach ($data->all() as $child) { 71 | $childData = [ 72 | 'errors' => $this->convertFormErrorsToArray($child), 73 | ]; 74 | 75 | if (!empty($child->all())) { 76 | $childData['children'] = $this->convertFormChildrenToArray($child); 77 | } 78 | 79 | $children[$child->getName()] = $childData; 80 | } 81 | 82 | return $children; 83 | } 84 | 85 | /** 86 | * {@inheritdoc} 87 | */ 88 | public function hasCacheableSupportsMethod(): bool 89 | { 90 | return __CLASS__ === static::class; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "symfony/serializer", 3 | "type": "library", 4 | "description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.", 5 | "keywords": [], 6 | "homepage": "https://symfony.com", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "Fabien Potencier", 11 | "email": "fabien@symfony.com" 12 | }, 13 | { 14 | "name": "Symfony Community", 15 | "homepage": "https://symfony.com/contributors" 16 | } 17 | ], 18 | "require": { 19 | "php": ">=7.2.5", 20 | "symfony/deprecation-contracts": "^2.1", 21 | "symfony/polyfill-ctype": "~1.8", 22 | "symfony/polyfill-php80": "^1.16" 23 | }, 24 | "require-dev": { 25 | "doctrine/annotations": "^1.12", 26 | "phpdocumentor/reflection-docblock": "^3.2|^4.0|^5.0", 27 | "symfony/cache": "^4.4|^5.0", 28 | "symfony/config": "^4.4|^5.0", 29 | "symfony/dependency-injection": "^4.4|^5.0", 30 | "symfony/error-handler": "^4.4|^5.0", 31 | "symfony/filesystem": "^4.4|^5.0", 32 | "symfony/form": "^4.4|^5.0", 33 | "symfony/http-foundation": "^4.4|^5.0", 34 | "symfony/http-kernel": "^4.4|^5.0", 35 | "symfony/mime": "^4.4|^5.0", 36 | "symfony/property-access": "^4.4.9|^5.0.9", 37 | "symfony/property-info": "^5.3", 38 | "symfony/uid": "^5.1", 39 | "symfony/validator": "^4.4|^5.0", 40 | "symfony/var-dumper": "^4.4|^5.0", 41 | "symfony/var-exporter": "^4.4|^5.0", 42 | "symfony/yaml": "^4.4|^5.0" 43 | }, 44 | "conflict": { 45 | "doctrine/annotations": "<1.12", 46 | "phpdocumentor/reflection-docblock": "<3.2.2", 47 | "phpdocumentor/type-resolver": "<1.4.0", 48 | "symfony/dependency-injection": "<4.4", 49 | "symfony/property-access": "<4.4", 50 | "symfony/property-info": "<5.3", 51 | "symfony/yaml": "<4.4" 52 | }, 53 | "suggest": { 54 | "psr/cache-implementation": "For using the metadata cache.", 55 | "symfony/property-info": "To deserialize relations.", 56 | "symfony/yaml": "For using the default YAML mapping loader.", 57 | "symfony/config": "For using the XML mapping loader.", 58 | "symfony/property-access": "For using the ObjectNormalizer.", 59 | "symfony/mime": "For using a MIME type guesser within the DataUriNormalizer.", 60 | "symfony/var-exporter": "For using the metadata compiler." 61 | }, 62 | "autoload": { 63 | "psr-4": { "Symfony\\Component\\Serializer\\": "" }, 64 | "exclude-from-classmap": [ 65 | "/Tests/" 66 | ] 67 | }, 68 | "minimum-stability": "dev" 69 | } 70 | -------------------------------------------------------------------------------- /lib/Sprog/Copy/StructureMetadata.php: -------------------------------------------------------------------------------- 1 | self::getChunkedArray(), 18 | ]; 19 | } 20 | 21 | /** 22 | * Get all pages being online. 23 | * 24 | * @return array 25 | */ 26 | public static function getArticleIds() 27 | { 28 | $articles = []; 29 | if (\rex_addon::get('structure')->isAvailable()) { 30 | $sql = \rex_sql::factory(); 31 | $items = $sql->getArray('SELECT `id` FROM '.\rex::getTable('article').' GROUP BY `id`'); 32 | 33 | foreach ($items as $item) { 34 | $articles[] = $item['id']; 35 | } 36 | } 37 | return $articles; 38 | } 39 | 40 | /** 41 | * Get all pages and languages as chunked array including 'count' and 'items'. 42 | * 43 | * @return array 44 | */ 45 | public static function getChunkedArray() 46 | { 47 | $articles = self::getArticleIds(); 48 | 49 | $items = []; 50 | if (count($articles) > 0 && \rex_clang::count() > 0) { 51 | foreach ($articles as $article) { 52 | $items[] = [$article, \rex_clang::getStartId()]; 53 | } 54 | } 55 | 56 | $chunkedItems = self::chunk($items, \rex_addon::get('sprog')->getConfig('chunkSizeArticles')); 57 | return ['count' => count($items), 'params' => rex_request('params', 'array', 0), 'items' => $chunkedItems]; 58 | } 59 | 60 | /** 61 | * @param array $items 62 | * @param array $params 63 | * 64 | * @return array 65 | */ 66 | public static function fire(array $items, array $params) 67 | { 68 | if (\rex_addon::get('structure')->isAvailable() && $params['clangFrom'] != $params['clangTo']) { 69 | foreach ($items as $item) { 70 | $syncParams = [ 71 | 'id' => $item[0], 72 | 'clang' => $params['clangFrom'], 73 | ]; 74 | $syncFields = explode(',', $params['fields']); 75 | Sync::articleMetainfo($syncParams, $syncFields, $params['clangTo']); 76 | 77 | // generate content 78 | $article = new \rex_article_content($item[0], $params['clangTo']); 79 | $content = $article->getArticle(); 80 | 81 | // generate meta 82 | \rex_article_cache::generateMeta($item[0], $params['clangTo']); 83 | 84 | // generate lists 85 | \rex_article_cache::generateLists($item[0]); 86 | } 87 | } 88 | return $items; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Encoder/ChainEncoder.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Encoder; 13 | 14 | use Symfony\Component\Serializer\Exception\RuntimeException; 15 | 16 | /** 17 | * Encoder delegating the decoding to a chain of encoders. 18 | * 19 | * @author Jordi Boggiano 20 | * @author Johannes M. Schmitt 21 | * @author Lukas Kahwe Smith 22 | * 23 | * @final 24 | */ 25 | class ChainEncoder implements ContextAwareEncoderInterface 26 | { 27 | protected $encoders = []; 28 | protected $encoderByFormat = []; 29 | 30 | public function __construct(array $encoders = []) 31 | { 32 | $this->encoders = $encoders; 33 | } 34 | 35 | /** 36 | * {@inheritdoc} 37 | */ 38 | final public function encode($data, string $format, array $context = []) 39 | { 40 | return $this->getEncoder($format, $context)->encode($data, $format, $context); 41 | } 42 | 43 | /** 44 | * {@inheritdoc} 45 | */ 46 | public function supportsEncoding(string $format, array $context = []): bool 47 | { 48 | try { 49 | $this->getEncoder($format, $context); 50 | } catch (RuntimeException $e) { 51 | return false; 52 | } 53 | 54 | return true; 55 | } 56 | 57 | /** 58 | * Checks whether the normalization is needed for the given format. 59 | */ 60 | public function needsNormalization(string $format, array $context = []): bool 61 | { 62 | $encoder = $this->getEncoder($format, $context); 63 | 64 | if (!$encoder instanceof NormalizationAwareInterface) { 65 | return true; 66 | } 67 | 68 | if ($encoder instanceof self) { 69 | return $encoder->needsNormalization($format, $context); 70 | } 71 | 72 | return false; 73 | } 74 | 75 | /** 76 | * Gets the encoder supporting the format. 77 | * 78 | * @throws RuntimeException if no encoder is found 79 | */ 80 | private function getEncoder(string $format, array $context): EncoderInterface 81 | { 82 | if (isset($this->encoderByFormat[$format]) 83 | && isset($this->encoders[$this->encoderByFormat[$format]]) 84 | ) { 85 | return $this->encoders[$this->encoderByFormat[$format]]; 86 | } 87 | 88 | foreach ($this->encoders as $i => $encoder) { 89 | if ($encoder->supportsEncoding($format, $context)) { 90 | $this->encoderByFormat[$format] = $i; 91 | 92 | return $encoder; 93 | } 94 | } 95 | 96 | throw new RuntimeException(sprintf('No encoder found for format "%s".', $format)); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Encoder/YamlEncoder.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Encoder; 13 | 14 | use Symfony\Component\Serializer\Exception\RuntimeException; 15 | use Symfony\Component\Yaml\Dumper; 16 | use Symfony\Component\Yaml\Parser; 17 | use Symfony\Component\Yaml\Yaml; 18 | 19 | /** 20 | * Encodes YAML data. 21 | * 22 | * @author Kévin Dunglas 23 | */ 24 | class YamlEncoder implements EncoderInterface, DecoderInterface 25 | { 26 | public const FORMAT = 'yaml'; 27 | private const ALTERNATIVE_FORMAT = 'yml'; 28 | 29 | public const PRESERVE_EMPTY_OBJECTS = 'preserve_empty_objects'; 30 | 31 | public const YAML_INLINE = 'yaml_inline'; 32 | public const YAML_INDENT = 'yaml_indent'; 33 | public const YAML_FLAGS = 'yaml_flags'; 34 | 35 | private $dumper; 36 | private $parser; 37 | private $defaultContext = [ 38 | self::YAML_INLINE => 0, 39 | self::YAML_INDENT => 0, 40 | self::YAML_FLAGS => 0, 41 | ]; 42 | 43 | public function __construct(Dumper $dumper = null, Parser $parser = null, array $defaultContext = []) 44 | { 45 | if (!class_exists(Dumper::class)) { 46 | throw new RuntimeException('The YamlEncoder class requires the "Yaml" component. Install "symfony/yaml" to use it.'); 47 | } 48 | 49 | $this->dumper = $dumper ?? new Dumper(); 50 | $this->parser = $parser ?? new Parser(); 51 | $this->defaultContext = array_merge($this->defaultContext, $defaultContext); 52 | } 53 | 54 | /** 55 | * {@inheritdoc} 56 | */ 57 | public function encode($data, string $format, array $context = []) 58 | { 59 | $context = array_merge($this->defaultContext, $context); 60 | 61 | if (isset($context[self::PRESERVE_EMPTY_OBJECTS])) { 62 | $context[self::YAML_FLAGS] |= Yaml::DUMP_OBJECT_AS_MAP; 63 | } 64 | 65 | return $this->dumper->dump($data, $context[self::YAML_INLINE], $context[self::YAML_INDENT], $context[self::YAML_FLAGS]); 66 | } 67 | 68 | /** 69 | * {@inheritdoc} 70 | */ 71 | public function supportsEncoding(string $format) 72 | { 73 | return self::FORMAT === $format || self::ALTERNATIVE_FORMAT === $format; 74 | } 75 | 76 | /** 77 | * {@inheritdoc} 78 | */ 79 | public function decode(string $data, string $format, array $context = []) 80 | { 81 | $context = array_merge($this->defaultContext, $context); 82 | 83 | return $this->parser->parse($data, $context[self::YAML_FLAGS]); 84 | } 85 | 86 | /** 87 | * {@inheritdoc} 88 | */ 89 | public function supportsDecoding(string $format) 90 | { 91 | return self::FORMAT === $format || self::ALTERNATIVE_FORMAT === $format; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /pages/artefact.export.php: -------------------------------------------------------------------------------- 1 | 7 | * @author (c) Thomas Blum 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | use Sprog\Export\CsvExport; 14 | 15 | $addon = rex_addon::get('sprog'); 16 | 17 | $csrfToken = \rex_csrf_token::factory('sprog-settings'); 18 | 19 | $func = rex_request('func', 'string'); 20 | 21 | if ($func == 'export' && !$csrfToken->isValid()) { 22 | echo \rex_view::error(\rex_i18n::msg('csrf_token_invalid')); 23 | } elseif ($func == 'export') { 24 | rex_response::cleanOutputBuffers(); 25 | $sql = rex_sql::factory(); 26 | $items = $sql->getArray('SELECT `id`, `clang_id`, `wildcard`, `replace` FROM '.rex::getTable('sprog_wildcard').' ORDER BY `wildcard`, `clang_id`'); 27 | 28 | $rows = []; 29 | $data = []; 30 | $clang_ids = []; 31 | foreach ($items as $index => $item) { 32 | $data[$item['wildcard']][$item['clang_id']] = str_replace("\r", '', $item['replace']); 33 | $clang_ids[$item['clang_id']] = ''; 34 | } 35 | 36 | ksort($data); 37 | 38 | $header = ['wildcard']; 39 | foreach ($clang_ids as $clang_id => $value) { 40 | $header[] = ($clang = rex_clang::get($clang_id)) ? $clang->getCode() : $clang_id; 41 | } 42 | 43 | $csv = new CsvExport(); 44 | $csv->addHeaders($header); 45 | 46 | foreach ($data as $wildcard => $clangs) { 47 | $record = [$wildcard]; 48 | foreach ($clang_ids as $clang_id => $empty) { 49 | if (isset($clangs[$clang_id])) { 50 | $record[] = $clangs[$clang_id]; // replace value 51 | } else { 52 | $record[] = ''; // empty replace value for missing clang_id record 53 | } 54 | } 55 | $csv->addItem($record); 56 | } 57 | 58 | $csv->sendFile('sprog-' . date('Ymd-His') . '.csv'); 59 | } 60 | 61 | $formElements = []; 62 | $n = []; 63 | $n['field'] = ''; 64 | $formElements[] = $n; 65 | 66 | $fragment = new \rex_fragment(); 67 | $fragment->setVar('elements', $formElements, false); 68 | $buttons = $fragment->parse('core/form/submit.php'); 69 | 70 | $panelBody = ' 71 |
72 | 73 | '.$csrfToken->getHiddenField().' 74 |

'.rex_i18n::msg('sprog_export_heading').'

75 |

'.rex_i18n::msg('sprog_export_description').'

76 |
'; 77 | 78 | $fragment = new \rex_fragment(); 79 | $fragment->setVar('class', 'edit', false); 80 | $fragment->setVar('title', rex_i18n::msg('sprog_export_title'), false); 81 | $fragment->setVar('body', $panelBody, false); 82 | $fragment->setVar('buttons', $buttons, false); 83 | $section = $fragment->parse('core/page/section.php'); 84 | 85 | echo ' 86 |
87 | '.$section.' 88 |
89 | '; 90 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Mapping/ClassDiscriminatorFromClassMetadata.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Mapping; 13 | 14 | use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface; 15 | 16 | /** 17 | * @author Samuel Roze 18 | */ 19 | class ClassDiscriminatorFromClassMetadata implements ClassDiscriminatorResolverInterface 20 | { 21 | /** 22 | * @var ClassMetadataFactoryInterface 23 | */ 24 | private $classMetadataFactory; 25 | private $mappingForMappedObjectCache = []; 26 | 27 | public function __construct(ClassMetadataFactoryInterface $classMetadataFactory) 28 | { 29 | $this->classMetadataFactory = $classMetadataFactory; 30 | } 31 | 32 | /** 33 | * {@inheritdoc} 34 | */ 35 | public function getMappingForClass(string $class): ?ClassDiscriminatorMapping 36 | { 37 | if ($this->classMetadataFactory->hasMetadataFor($class)) { 38 | return $this->classMetadataFactory->getMetadataFor($class)->getClassDiscriminatorMapping(); 39 | } 40 | 41 | return null; 42 | } 43 | 44 | /** 45 | * {@inheritdoc} 46 | */ 47 | public function getMappingForMappedObject($object): ?ClassDiscriminatorMapping 48 | { 49 | if ($this->classMetadataFactory->hasMetadataFor($object)) { 50 | $metadata = $this->classMetadataFactory->getMetadataFor($object); 51 | 52 | if (null !== $metadata->getClassDiscriminatorMapping()) { 53 | return $metadata->getClassDiscriminatorMapping(); 54 | } 55 | } 56 | 57 | $cacheKey = \is_object($object) ? \get_class($object) : $object; 58 | if (!\array_key_exists($cacheKey, $this->mappingForMappedObjectCache)) { 59 | $this->mappingForMappedObjectCache[$cacheKey] = $this->resolveMappingForMappedObject($object); 60 | } 61 | 62 | return $this->mappingForMappedObjectCache[$cacheKey]; 63 | } 64 | 65 | /** 66 | * {@inheritdoc} 67 | */ 68 | public function getTypeForMappedObject($object): ?string 69 | { 70 | if (null === $mapping = $this->getMappingForMappedObject($object)) { 71 | return null; 72 | } 73 | 74 | return $mapping->getMappedObjectType($object); 75 | } 76 | 77 | private function resolveMappingForMappedObject($object) 78 | { 79 | $reflectionClass = new \ReflectionClass($object); 80 | if ($parentClass = $reflectionClass->getParentClass()) { 81 | return $this->getMappingForMappedObject($parentClass->getName()); 82 | } 83 | 84 | foreach ($reflectionClass->getInterfaceNames() as $interfaceName) { 85 | if (null !== ($interfaceMapping = $this->getMappingForMappedObject($interfaceName))) { 86 | return $interfaceMapping; 87 | } 88 | } 89 | 90 | return null; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Mapping/Factory/CompiledClassMetadataFactory.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Mapping\Factory; 13 | 14 | use Symfony\Component\Serializer\Mapping\AttributeMetadata; 15 | use Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping; 16 | use Symfony\Component\Serializer\Mapping\ClassMetadata; 17 | 18 | /** 19 | * @author Fabien Bourigault 20 | */ 21 | final class CompiledClassMetadataFactory implements ClassMetadataFactoryInterface 22 | { 23 | private $compiledClassMetadata = []; 24 | 25 | private $loadedClasses = []; 26 | 27 | private $classMetadataFactory; 28 | 29 | public function __construct(string $compiledClassMetadataFile, ClassMetadataFactoryInterface $classMetadataFactory) 30 | { 31 | if (!file_exists($compiledClassMetadataFile)) { 32 | throw new \RuntimeException("File \"{$compiledClassMetadataFile}\" could not be found."); 33 | } 34 | 35 | $compiledClassMetadata = require $compiledClassMetadataFile; 36 | if (!\is_array($compiledClassMetadata)) { 37 | throw new \RuntimeException(sprintf('Compiled metadata must be of the type array, %s given.', \gettype($compiledClassMetadata))); 38 | } 39 | 40 | $this->compiledClassMetadata = $compiledClassMetadata; 41 | $this->classMetadataFactory = $classMetadataFactory; 42 | } 43 | 44 | /** 45 | * {@inheritdoc} 46 | */ 47 | public function getMetadataFor($value) 48 | { 49 | $className = \is_object($value) ? \get_class($value) : $value; 50 | 51 | if (!isset($this->compiledClassMetadata[$className])) { 52 | return $this->classMetadataFactory->getMetadataFor($value); 53 | } 54 | 55 | if (!isset($this->loadedClasses[$className])) { 56 | $classMetadata = new ClassMetadata($className); 57 | foreach ($this->compiledClassMetadata[$className][0] as $name => $compiledAttributesMetadata) { 58 | $classMetadata->attributesMetadata[$name] = $attributeMetadata = new AttributeMetadata($name); 59 | [$attributeMetadata->groups, $attributeMetadata->maxDepth, $attributeMetadata->serializedName] = $compiledAttributesMetadata; 60 | } 61 | $classMetadata->classDiscriminatorMapping = $this->compiledClassMetadata[$className][1] 62 | ? new ClassDiscriminatorMapping(...$this->compiledClassMetadata[$className][1]) 63 | : null 64 | ; 65 | 66 | $this->loadedClasses[$className] = $classMetadata; 67 | } 68 | 69 | return $this->loadedClasses[$className]; 70 | } 71 | 72 | /** 73 | * {@inheritdoc} 74 | */ 75 | public function hasMetadataFor($value) 76 | { 77 | $className = \is_object($value) ? \get_class($value) : $value; 78 | 79 | return isset($this->compiledClassMetadata[$className]) || $this->classMetadataFactory->hasMetadataFor($value); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Mapping/AttributeMetadataInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Mapping; 13 | 14 | /** 15 | * Stores metadata needed for serializing and deserializing attributes. 16 | * 17 | * Primarily, the metadata stores serialization groups. 18 | * 19 | * @internal 20 | * 21 | * @author Kévin Dunglas 22 | */ 23 | interface AttributeMetadataInterface 24 | { 25 | /** 26 | * Gets the attribute name. 27 | */ 28 | public function getName(): string; 29 | 30 | /** 31 | * Adds this attribute to the given group. 32 | */ 33 | public function addGroup(string $group); 34 | 35 | /** 36 | * Gets groups of this attribute. 37 | * 38 | * @return string[] 39 | */ 40 | public function getGroups(): array; 41 | 42 | /** 43 | * Sets the serialization max depth for this attribute. 44 | */ 45 | public function setMaxDepth(?int $maxDepth); 46 | 47 | /** 48 | * Gets the serialization max depth for this attribute. 49 | * 50 | * @return int|null 51 | */ 52 | public function getMaxDepth(); 53 | 54 | /** 55 | * Sets the serialization name for this attribute. 56 | */ 57 | public function setSerializedName(string $serializedName = null); 58 | 59 | /** 60 | * Gets the serialization name for this attribute. 61 | */ 62 | public function getSerializedName(): ?string; 63 | 64 | /** 65 | * Sets if this attribute must be ignored or not. 66 | */ 67 | public function setIgnore(bool $ignore); 68 | 69 | /** 70 | * Gets if this attribute is ignored or not. 71 | */ 72 | public function isIgnored(): bool; 73 | 74 | /** 75 | * Merges an {@see AttributeMetadataInterface} with in the current one. 76 | */ 77 | public function merge(self $attributeMetadata); 78 | 79 | /** 80 | * Gets all the normalization contexts per group ("*" being the base context applied to all groups). 81 | */ 82 | public function getNormalizationContexts(): array; 83 | 84 | /** 85 | * Gets the computed normalization contexts for given groups. 86 | */ 87 | public function getNormalizationContextForGroups(array $groups): array; 88 | 89 | /** 90 | * Sets the normalization context for given groups. 91 | */ 92 | public function setNormalizationContextForGroups(array $context, array $groups = []): void; 93 | 94 | /** 95 | * Gets all the denormalization contexts per group ("*" being the base context applied to all groups). 96 | */ 97 | public function getDenormalizationContexts(): array; 98 | 99 | /** 100 | * Gets the computed denormalization contexts for given groups. 101 | */ 102 | public function getDenormalizationContextForGroups(array $groups): array; 103 | 104 | /** 105 | * Sets the denormalization context for given groups. 106 | */ 107 | public function setDenormalizationContextForGroups(array $context, array $groups = []): void; 108 | } 109 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/UidNormalizer.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | use Symfony\Component\Serializer\Exception\LogicException; 15 | use Symfony\Component\Serializer\Exception\NotNormalizableValueException; 16 | use Symfony\Component\Uid\AbstractUid; 17 | use Symfony\Component\Uid\Ulid; 18 | use Symfony\Component\Uid\Uuid; 19 | 20 | final class UidNormalizer implements NormalizerInterface, DenormalizerInterface, CacheableSupportsMethodInterface 21 | { 22 | public const NORMALIZATION_FORMAT_KEY = 'uid_normalization_format'; 23 | 24 | public const NORMALIZATION_FORMAT_CANONICAL = 'canonical'; 25 | public const NORMALIZATION_FORMAT_BASE58 = 'base58'; 26 | public const NORMALIZATION_FORMAT_BASE32 = 'base32'; 27 | public const NORMALIZATION_FORMAT_RFC4122 = 'rfc4122'; 28 | 29 | private $defaultContext = [ 30 | self::NORMALIZATION_FORMAT_KEY => self::NORMALIZATION_FORMAT_CANONICAL, 31 | ]; 32 | 33 | public function __construct(array $defaultContext = []) 34 | { 35 | $this->defaultContext = array_merge($this->defaultContext, $defaultContext); 36 | } 37 | 38 | /** 39 | * {@inheritdoc} 40 | * 41 | * @param AbstractUid $object 42 | */ 43 | public function normalize($object, string $format = null, array $context = []) 44 | { 45 | switch ($context[self::NORMALIZATION_FORMAT_KEY] ?? $this->defaultContext[self::NORMALIZATION_FORMAT_KEY]) { 46 | case self::NORMALIZATION_FORMAT_CANONICAL: 47 | return (string) $object; 48 | case self::NORMALIZATION_FORMAT_BASE58: 49 | return $object->toBase58(); 50 | case self::NORMALIZATION_FORMAT_BASE32: 51 | return $object->toBase32(); 52 | case self::NORMALIZATION_FORMAT_RFC4122: 53 | return $object->toRfc4122(); 54 | } 55 | 56 | throw new LogicException(sprintf('The "%s" format is not valid.', $context[self::NORMALIZATION_FORMAT_KEY] ?? $this->defaultContext[self::NORMALIZATION_FORMAT_KEY])); 57 | } 58 | 59 | /** 60 | * {@inheritdoc} 61 | */ 62 | public function supportsNormalization($data, string $format = null) 63 | { 64 | return $data instanceof AbstractUid; 65 | } 66 | 67 | /** 68 | * {@inheritdoc} 69 | */ 70 | public function denormalize($data, string $type, string $format = null, array $context = []) 71 | { 72 | try { 73 | return Ulid::class === $type ? Ulid::fromString($data) : Uuid::fromString($data); 74 | } catch (\InvalidArgumentException $exception) { 75 | throw new NotNormalizableValueException(sprintf('The data is not a valid "%s" string representation.', $type)); 76 | } 77 | } 78 | 79 | /** 80 | * {@inheritdoc} 81 | */ 82 | public function supportsDenormalization($data, string $type, string $format = null) 83 | { 84 | return is_a($type, AbstractUid::class, true); 85 | } 86 | 87 | /** 88 | * {@inheritdoc} 89 | */ 90 | public function hasCacheableSupportsMethod(): bool 91 | { 92 | return __CLASS__ === static::class; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Encoder/JsonDecode.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Encoder; 13 | 14 | use Symfony\Component\Serializer\Exception\NotEncodableValueException; 15 | 16 | /** 17 | * Decodes JSON data. 18 | * 19 | * @author Sander Coolen 20 | */ 21 | class JsonDecode implements DecoderInterface 22 | { 23 | protected $serializer; 24 | 25 | /** 26 | * True to return the result as an associative array, false for a nested stdClass hierarchy. 27 | */ 28 | public const ASSOCIATIVE = 'json_decode_associative'; 29 | 30 | public const OPTIONS = 'json_decode_options'; 31 | 32 | /** 33 | * Specifies the recursion depth. 34 | */ 35 | public const RECURSION_DEPTH = 'json_decode_recursion_depth'; 36 | 37 | private $defaultContext = [ 38 | self::ASSOCIATIVE => false, 39 | self::OPTIONS => 0, 40 | self::RECURSION_DEPTH => 512, 41 | ]; 42 | 43 | public function __construct(array $defaultContext = []) 44 | { 45 | $this->defaultContext = array_merge($this->defaultContext, $defaultContext); 46 | } 47 | 48 | /** 49 | * Decodes data. 50 | * 51 | * @param string $data The encoded JSON string to decode 52 | * @param string $format Must be set to JsonEncoder::FORMAT 53 | * @param array $context An optional set of options for the JSON decoder; see below 54 | * 55 | * The $context array is a simple key=>value array, with the following supported keys: 56 | * 57 | * json_decode_associative: boolean 58 | * If true, returns the object as an associative array. 59 | * If false, returns the object as nested stdClass 60 | * If not specified, this method will use the default set in JsonDecode::__construct 61 | * 62 | * json_decode_recursion_depth: integer 63 | * Specifies the maximum recursion depth 64 | * If not specified, this method will use the default set in JsonDecode::__construct 65 | * 66 | * json_decode_options: integer 67 | * Specifies additional options as per documentation for json_decode 68 | * 69 | * @return mixed 70 | * 71 | * @throws NotEncodableValueException 72 | * 73 | * @see https://php.net/json_decode 74 | */ 75 | public function decode(string $data, string $format, array $context = []) 76 | { 77 | $associative = $context[self::ASSOCIATIVE] ?? $this->defaultContext[self::ASSOCIATIVE]; 78 | $recursionDepth = $context[self::RECURSION_DEPTH] ?? $this->defaultContext[self::RECURSION_DEPTH]; 79 | $options = $context[self::OPTIONS] ?? $this->defaultContext[self::OPTIONS]; 80 | 81 | try { 82 | $decodedData = json_decode($data, $associative, $recursionDepth, $options); 83 | } catch (\JsonException $e) { 84 | throw new NotEncodableValueException($e->getMessage(), 0, $e); 85 | } 86 | 87 | if (\PHP_VERSION_ID >= 70300 && (\JSON_THROW_ON_ERROR & $options)) { 88 | return $decodedData; 89 | } 90 | 91 | if (\JSON_ERROR_NONE !== json_last_error()) { 92 | throw new NotEncodableValueException(json_last_error_msg()); 93 | } 94 | 95 | return $decodedData; 96 | } 97 | 98 | /** 99 | * {@inheritdoc} 100 | */ 101 | public function supportsDecoding(string $format) 102 | { 103 | return JsonEncoder::FORMAT === $format; 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/ArrayDenormalizer.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | use Symfony\Component\Serializer\Exception\BadMethodCallException; 15 | use Symfony\Component\Serializer\Exception\InvalidArgumentException; 16 | use Symfony\Component\Serializer\Exception\NotNormalizableValueException; 17 | use Symfony\Component\Serializer\Serializer; 18 | use Symfony\Component\Serializer\SerializerAwareInterface; 19 | use Symfony\Component\Serializer\SerializerInterface; 20 | 21 | /** 22 | * Denormalizes arrays of objects. 23 | * 24 | * @author Alexander M. Turek 25 | * 26 | * @final 27 | */ 28 | class ArrayDenormalizer implements ContextAwareDenormalizerInterface, DenormalizerAwareInterface, SerializerAwareInterface, CacheableSupportsMethodInterface 29 | { 30 | use DenormalizerAwareTrait; 31 | 32 | /** 33 | * {@inheritdoc} 34 | * 35 | * @throws NotNormalizableValueException 36 | */ 37 | public function denormalize($data, string $type, string $format = null, array $context = []): array 38 | { 39 | if (null === $this->denormalizer) { 40 | throw new BadMethodCallException('Please set a denormalizer before calling denormalize()!'); 41 | } 42 | if (!\is_array($data)) { 43 | throw new InvalidArgumentException('Data expected to be an array, '.get_debug_type($data).' given.'); 44 | } 45 | if (!str_ends_with($type, '[]')) { 46 | throw new InvalidArgumentException('Unsupported class: '.$type); 47 | } 48 | 49 | $type = substr($type, 0, -2); 50 | 51 | $builtinType = isset($context['key_type']) ? $context['key_type']->getBuiltinType() : null; 52 | foreach ($data as $key => $value) { 53 | if (null !== $builtinType && !('is_'.$builtinType)($key)) { 54 | throw new NotNormalizableValueException(sprintf('The type of the key "%s" must be "%s" ("%s" given).', $key, $builtinType, get_debug_type($key))); 55 | } 56 | 57 | $data[$key] = $this->denormalizer->denormalize($value, $type, $format, $context); 58 | } 59 | 60 | return $data; 61 | } 62 | 63 | /** 64 | * {@inheritdoc} 65 | */ 66 | public function supportsDenormalization($data, string $type, string $format = null, array $context = []): bool 67 | { 68 | if (null === $this->denormalizer) { 69 | throw new BadMethodCallException(sprintf('The nested denormalizer needs to be set to allow "%s()" to be used.', __METHOD__)); 70 | } 71 | 72 | return str_ends_with($type, '[]') 73 | && $this->denormalizer->supportsDenormalization($data, substr($type, 0, -2), $format, $context); 74 | } 75 | 76 | /** 77 | * {@inheritdoc} 78 | * 79 | * @deprecated call setDenormalizer() instead 80 | */ 81 | public function setSerializer(SerializerInterface $serializer) 82 | { 83 | if (!$serializer instanceof DenormalizerInterface) { 84 | throw new InvalidArgumentException('Expected a serializer that also implements DenormalizerInterface.'); 85 | } 86 | 87 | if (Serializer::class !== debug_backtrace()[1]['class'] ?? null) { 88 | trigger_deprecation('symfony/serializer', '5.3', 'Calling "%s" is deprecated. Please call setDenormalizer() instead.'); 89 | } 90 | 91 | $this->setDenormalizer($serializer); 92 | } 93 | 94 | /** 95 | * {@inheritdoc} 96 | */ 97 | public function hasCacheableSupportsMethod(): bool 98 | { 99 | return $this->denormalizer instanceof CacheableSupportsMethodInterface && $this->denormalizer->hasCacheableSupportsMethod(); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Mapping/ClassMetadata.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Mapping; 13 | 14 | /** 15 | * {@inheritdoc} 16 | * 17 | * @author Kévin Dunglas 18 | */ 19 | class ClassMetadata implements ClassMetadataInterface 20 | { 21 | /** 22 | * @internal This property is public in order to reduce the size of the 23 | * class' serialized representation. Do not access it. Use 24 | * {@link getName()} instead. 25 | */ 26 | public $name; 27 | 28 | /** 29 | * @var AttributeMetadataInterface[] 30 | * 31 | * @internal This property is public in order to reduce the size of the 32 | * class' serialized representation. Do not access it. Use 33 | * {@link getAttributesMetadata()} instead. 34 | */ 35 | public $attributesMetadata = []; 36 | 37 | /** 38 | * @var \ReflectionClass 39 | */ 40 | private $reflClass; 41 | 42 | /** 43 | * @var ClassDiscriminatorMapping|null 44 | * 45 | * @internal This property is public in order to reduce the size of the 46 | * class' serialized representation. Do not access it. Use 47 | * {@link getClassDiscriminatorMapping()} instead. 48 | */ 49 | public $classDiscriminatorMapping; 50 | 51 | /** 52 | * Constructs a metadata for the given class. 53 | */ 54 | public function __construct(string $class, ClassDiscriminatorMapping $classDiscriminatorMapping = null) 55 | { 56 | $this->name = $class; 57 | $this->classDiscriminatorMapping = $classDiscriminatorMapping; 58 | } 59 | 60 | /** 61 | * {@inheritdoc} 62 | */ 63 | public function getName(): string 64 | { 65 | return $this->name; 66 | } 67 | 68 | /** 69 | * {@inheritdoc} 70 | */ 71 | public function addAttributeMetadata(AttributeMetadataInterface $attributeMetadata) 72 | { 73 | $this->attributesMetadata[$attributeMetadata->getName()] = $attributeMetadata; 74 | } 75 | 76 | /** 77 | * {@inheritdoc} 78 | */ 79 | public function getAttributesMetadata(): array 80 | { 81 | return $this->attributesMetadata; 82 | } 83 | 84 | /** 85 | * {@inheritdoc} 86 | */ 87 | public function merge(ClassMetadataInterface $classMetadata) 88 | { 89 | foreach ($classMetadata->getAttributesMetadata() as $attributeMetadata) { 90 | if (isset($this->attributesMetadata[$attributeMetadata->getName()])) { 91 | $this->attributesMetadata[$attributeMetadata->getName()]->merge($attributeMetadata); 92 | } else { 93 | $this->addAttributeMetadata($attributeMetadata); 94 | } 95 | } 96 | } 97 | 98 | /** 99 | * {@inheritdoc} 100 | */ 101 | public function getReflectionClass(): \ReflectionClass 102 | { 103 | if (!$this->reflClass) { 104 | $this->reflClass = new \ReflectionClass($this->getName()); 105 | } 106 | 107 | return $this->reflClass; 108 | } 109 | 110 | /** 111 | * {@inheritdoc} 112 | */ 113 | public function getClassDiscriminatorMapping(): ?ClassDiscriminatorMapping 114 | { 115 | return $this->classDiscriminatorMapping; 116 | } 117 | 118 | /** 119 | * {@inheritdoc} 120 | */ 121 | public function setClassDiscriminatorMapping(ClassDiscriminatorMapping $mapping = null) 122 | { 123 | $this->classDiscriminatorMapping = $mapping; 124 | } 125 | 126 | /** 127 | * Returns the names of the properties that should be serialized. 128 | * 129 | * @return string[] 130 | */ 131 | public function __sleep() 132 | { 133 | return [ 134 | 'name', 135 | 'attributesMetadata', 136 | 'classDiscriminatorMapping', 137 | ]; 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Annotation/Context.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Annotation; 13 | 14 | use Symfony\Component\Serializer\Exception\InvalidArgumentException; 15 | 16 | /** 17 | * Annotation class for @Context(). 18 | * 19 | * @Annotation 20 | * @NamedArgumentConstructor 21 | * @Target({"PROPERTY", "METHOD"}) 22 | * 23 | * @author Maxime Steinhausser 24 | */ 25 | #[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] 26 | final class Context 27 | { 28 | private $context; 29 | private $normalizationContext; 30 | private $denormalizationContext; 31 | private $groups; 32 | 33 | /** 34 | * @param string|string[] $groups 35 | * 36 | * @throws InvalidArgumentException 37 | */ 38 | public function __construct(array $options = [], array $context = [], array $normalizationContext = [], array $denormalizationContext = [], $groups = []) 39 | { 40 | if (!$context) { 41 | if (!array_intersect((array_keys($options)), ['normalizationContext', 'groups', 'context', 'value', 'denormalizationContext'])) { 42 | // gracefully supports context as first, unnamed attribute argument if it cannot be confused with Doctrine-style options 43 | $context = $options; 44 | } else { 45 | trigger_deprecation('symfony/serializer', '5.3', 'Passing an array of properties as first argument to "%s" is deprecated. Use named arguments instead.', __METHOD__); 46 | 47 | // If at least one of the options match, it's likely to be Doctrine-style options. Search for the context inside: 48 | $context = $options['value'] ?? $options['context'] ?? []; 49 | } 50 | } 51 | if (!\is_string($groups) && !\is_array($groups)) { 52 | throw new \TypeError(sprintf('"%s": Expected parameter $groups to be a string or an array of strings, got "%s".', __METHOD__, get_debug_type($groups))); 53 | } 54 | 55 | $normalizationContext = $options['normalizationContext'] ?? $normalizationContext; 56 | $denormalizationContext = $options['denormalizationContext'] ?? $denormalizationContext; 57 | 58 | foreach (compact(['context', 'normalizationContext', 'denormalizationContext']) as $key => $value) { 59 | if (!\is_array($value)) { 60 | throw new InvalidArgumentException(sprintf('Option "%s" of annotation "%s" must be an array.', $key, static::class)); 61 | } 62 | } 63 | 64 | if (!$context && !$normalizationContext && !$denormalizationContext) { 65 | throw new InvalidArgumentException(sprintf('At least one of the "context", "normalizationContext", or "denormalizationContext" options of annotation "%s" must be provided as a non-empty array.', static::class)); 66 | } 67 | 68 | $groups = (array) ($options['groups'] ?? $groups); 69 | 70 | foreach ($groups as $group) { 71 | if (!\is_string($group)) { 72 | throw new InvalidArgumentException(sprintf('Parameter "groups" of annotation "%s" must be a string or an array of strings. Got "%s".', static::class, get_debug_type($group))); 73 | } 74 | } 75 | 76 | $this->context = $context; 77 | $this->normalizationContext = $normalizationContext; 78 | $this->denormalizationContext = $denormalizationContext; 79 | $this->groups = $groups; 80 | } 81 | 82 | public function getContext(): array 83 | { 84 | return $this->context; 85 | } 86 | 87 | public function getNormalizationContext(): array 88 | { 89 | return $this->normalizationContext; 90 | } 91 | 92 | public function getDenormalizationContext(): array 93 | { 94 | return $this->denormalizationContext; 95 | } 96 | 97 | public function getGroups(): array 98 | { 99 | return $this->groups; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /lib/Sprog/Extension.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Sprog; 13 | 14 | use Sprog\Abbreviation; 15 | 16 | class Extension 17 | { 18 | public static function replaceAbbreviations(\rex_extension_point $ep): void 19 | { 20 | $ep->setSubject(Abbreviation::parse($ep->getSubject(), null)); 21 | } 22 | 23 | public static function replaceWildcards(\rex_extension_point $ep): void 24 | { 25 | $ep->setSubject(Wildcard::parse($ep->getSubject(), null)); 26 | } 27 | 28 | public static function articleUpdated(\rex_extension_point $ep) 29 | { 30 | $addon = \rex_addon::get('sprog'); 31 | 32 | if ($addon->getConfig('sync_structure_article_name_to_category_name')) { 33 | Sync::articleNameToCategoryName($ep->getParams()); 34 | } 35 | 36 | if ($addon->getConfig('sync_structure_status')) { 37 | Sync::articleStatus($ep->getParams()); 38 | } 39 | 40 | if ($addon->getConfig('sync_structure_template')) { 41 | Sync::articleTemplate($ep->getParams()); 42 | } 43 | } 44 | 45 | public static function articleMetadataUpdated(\rex_extension_point $ep) 46 | { 47 | $addon = \rex_addon::get('sprog'); 48 | $fields = $addon->getConfig('sync_metainfo_art', []); 49 | if (count($fields)) { 50 | Sync::articleMetainfo($ep->getParams(), $fields); 51 | } 52 | } 53 | 54 | public static function categoryUpdated(\rex_extension_point $ep) 55 | { 56 | $addon = \rex_addon::get('sprog'); 57 | 58 | if ($addon->getConfig('sync_structure_category_name_to_article_name')) { 59 | Sync::categoryNameToArticleName($ep->getParams()); 60 | } 61 | 62 | $fields = $addon->getConfig('sync_metainfo_cat', []); 63 | if (count($fields)) { 64 | Sync::categoryMetainfo($ep->getParams(), $fields); 65 | } 66 | 67 | if ($addon->getConfig('sync_structure_status')) { 68 | Sync::articleStatus($ep->getParams()); 69 | } 70 | } 71 | 72 | /* 73 | * Medienpool ist noch nicht mehrsprachig 74 | public static function mediaUpdated(\rex_extension_point $ep) 75 | { 76 | $addon = \rex_addon::get('sprog'); 77 | 78 | if (count($addon->getConfig('sync_metainfo_med'))) { 79 | Sync::mediaMetainfo($ep->getParams(), $addon->getConfig('sync_metainfo_med')); 80 | } 81 | } 82 | */ 83 | 84 | public static function clangAdded(\rex_extension_point $ep) 85 | { 86 | $firstLang = \rex_sql::factory(); 87 | $firstLang->setQuery('SELECT * FROM '.\rex::getTable('sprog_wildcard').' WHERE clang_id=?', [\rex_clang::getStartId()]); 88 | $fields = $firstLang->getFieldnames(); 89 | 90 | $newLang = \rex_sql::factory(); 91 | $newLang->setDebug(false); 92 | foreach ($firstLang as $firstLangEntry) { 93 | $newLang->setTable(\rex::getTable('sprog_wildcard')); 94 | 95 | foreach ($fields as $key => $value) { 96 | if ($value == 'pid') { 97 | echo ''; 98 | } elseif ($value == 'clang_id') { 99 | $newLang->setValue('clang_id', $ep->getParam('clang')->getId()); 100 | } else { 101 | $newLang->setValue($value, $firstLangEntry->getValue($value)); 102 | } 103 | } 104 | 105 | $newLang->insert(); 106 | } 107 | } 108 | 109 | public static function clangDeleted(\rex_extension_point $ep) 110 | { 111 | $deleteLang = \rex_sql::factory(); 112 | $deleteLang->setQuery('DELETE FROM '.\rex::getTable('sprog_wildcard').' WHERE clang_id=?', [$ep->getParam('clang')->getId()]); 113 | } 114 | 115 | public static function wildcardFormControlElement(\rex_extension_point $ep) 116 | { 117 | $subject = $ep->getSubject(); 118 | $subject['delete'] = ''; 119 | $ep->setSubject($subject); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /assets/js/timer.jquery.min.js: -------------------------------------------------------------------------------- 1 | /*! timer.jquery 0.4.9 2016-01-30*/!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],b):b(a.jQuery)}(this,function(a){function b(b){var c=b.element;a(c).data("intr",setInterval(d.bind(b),b.options.updateFrequency)),a(c).data("isTimerRunning",!0)}function c(b){clearInterval(a(b.element).data("intr")),a(b.element).data("isTimerRunning",!1)}function d(){a(this.element).data("totalSeconds",g()-a(this.element).data("startTime")),e(this),a(this.element).data("duration")&&a(this.element).data("totalSeconds")%a(this.element).data("duration")===0&&(this.options.repeat||(a(this.element).data("duration",null),this.options.duration=null),this.options.countdown&&(c(this),this.options.countdown=!1,a(this.element).data("state",r)),this.options.callback())}function e(b){var c=b.element,d=a(c).data("totalSeconds");b.options.countdown&&a(c).data("duration")>0&&(d=a(c).data("duration")-a(c).data("totalSeconds")),a(c)[q](i(d,b)),a(c).data("seconds",d)}function f(b){var c=b.element;a(c).on("focus",function(){l(b)}),a(c).on("blur",function(){var d,e=a(c)[q]();e.indexOf("sec")>0?a(c).data("totalSeconds",Number(e.replace(/\ssec/g,""))):e.indexOf("min")>0?(e=e.replace(/\smin/g,""),d=e.split(":"),a(c).data("totalSeconds",Number(60*d[0])+Number(d[1]))):e.match(/\d{1,2}:\d{2}:\d{2}/)&&(d=e.split(":"),a(c).data("totalSeconds",Number(3600*d[0])+Number(60*d[1])+Number(d[2]))),m(b)})}function g(){return Math.round((new Date).getTime()/1e3)}function h(a){var b,c=0,d=Math.floor(a/60);return a>=3600&&(c=Math.floor(a/3600)),a>=3600&&(d=Math.floor(a%3600/60)),10>d&&c>0&&(d="0"+d),b=a%60,10>b&&(d>0||c>0)&&(b="0"+b),{hours:c,minutes:d,seconds:b}}function i(a,b){var c="",d=h(a);if(b.options.format){var e=[{identifier:"%h",value:d.hours,pad:!1},{identifier:"%m",value:d.minutes,pad:!1},{identifier:"%s",value:d.seconds,pad:!1},{identifier:"%H",value:parseInt(d.hours),pad:!0},{identifier:"%M",value:parseInt(d.minutes),pad:!0},{identifier:"%S",value:parseInt(d.seconds),pad:!0}];c=b.options.format,e.forEach(function(a){c=c.replace(new RegExp(a.identifier.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),a.pad&&a.value<10?"0"+a.value:a.value)})}else c=d.hours?d.hours+":"+d.minutes+":"+d.seconds:d.minutes?d.minutes+":"+d.seconds+" min":d.seconds+" sec";return c}function j(a){if(!isNaN(Number(a)))return a;var b=a.match(/\d{1,2}h/),c=a.match(/\d{1,2}m/),d=a.match(/\d{1,2}s/),e=0;return a=a.toLowerCase(),b&&(e+=3600*Number(b[0].replace("h",""))),c&&(e+=60*Number(c[0].replace("m",""))),d&&(e+=Number(d[0].replace("s",""))),e}function k(c){var d=c.element;a(d).data("isTimerRunning")||(e(c),b(c),a(d).data("state",s),c.options.startTimer.bind(c).call())}function l(b){var d=b.element;a(d).data("isTimerRunning")&&(c(b),a(d).data("state",t),b.options.pauseTimer.bind(b).call())}function m(c){var d=c.element;a(d).data("isTimerRunning")||(a(d).data("startTime",g()-a(d).data("totalSeconds")),b(c),a(d).data("state",s),c.options.resumeTimer.bind(c).call())}function n(b){var c=b.element;a(c).data("startTime",0),a(c).data("totalSeconds",0),a(c).data("seconds",0),a(c).data("state",r),a(c).data("duration",b.options.duration),b.options.resetTimer.bind(b).call()}function o(b){var d=b.element;c(b),b.options.removeTimer.bind(b).call(),a(d).data("plugin_"+v,null),a(d).data("seconds",null),a(d).data("state",null),a(d)[q]("")}var p={seconds:0,editable:!1,restart:!1,duration:null,callback:function(){alert("Time up!")},startTimer:function(){},pauseTimer:function(){},resumeTimer:function(){},resetTimer:function(){},removeTimer:function(){},repeat:!1,countdown:!1,format:null,updateFrequency:1e3,state:"running"},q="html",r="stopped",s="running",t="paused",u=function(b,c){var d;this.options=p=a.extend(this.options,p,c),this.element=b,a(b).data("totalSeconds",p.seconds),a(b).data("startTime",g()-a(b).data("totalSeconds")),a(b).data("seconds",a(b).data("totalSeconds")),a(b).data("state",r),d=a(b).prop("tagName").toLowerCase(),("input"===d||"textarea"===d)&&(q="val"),this.options.duration&&(a(b).data("duration",j(this.options.duration)),this.options.duration=j(this.options.duration)),this.options.editable&&f(this)};u.prototype={start:function(){k(this)},pause:function(){l(this)},resume:function(){m(this)},reset:function(){n(this)},remove:function(){o(this)}};var v="timer";a.fn[v]=function(b){return b=b||"start",this.each(function(){a.data(this,"plugin_"+v)instanceof u||a.data(this,"plugin_"+v,new u(this,b));var c=a.data(this,"plugin_"+v);"string"==typeof b&&"function"==typeof c[b]&&c[b].call(c),"object"==typeof b&&(c.options.state===s?c.start.call(c):e(c))})}}); -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/MimeMessageNormalizer.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | use Symfony\Component\Mime\Address; 15 | use Symfony\Component\Mime\Header\HeaderInterface; 16 | use Symfony\Component\Mime\Header\Headers; 17 | use Symfony\Component\Mime\Header\UnstructuredHeader; 18 | use Symfony\Component\Mime\Message; 19 | use Symfony\Component\Mime\Part\AbstractPart; 20 | use Symfony\Component\Serializer\SerializerAwareInterface; 21 | use Symfony\Component\Serializer\SerializerInterface; 22 | 23 | /** 24 | * Normalize Mime message classes. 25 | * 26 | * It forces the use of a PropertyNormalizer instance for normalization 27 | * of all data objects composing a Message. 28 | * 29 | * Emails using resources for any parts are not serializable. 30 | */ 31 | final class MimeMessageNormalizer implements NormalizerInterface, DenormalizerInterface, SerializerAwareInterface, CacheableSupportsMethodInterface 32 | { 33 | private $serializer; 34 | private $normalizer; 35 | private $headerClassMap; 36 | private $headersProperty; 37 | 38 | public function __construct(PropertyNormalizer $normalizer) 39 | { 40 | $this->normalizer = $normalizer; 41 | $this->headerClassMap = (new \ReflectionClassConstant(Headers::class, 'HEADER_CLASS_MAP'))->getValue(); 42 | $this->headersProperty = new \ReflectionProperty(Headers::class, 'headers'); 43 | $this->headersProperty->setAccessible(true); 44 | } 45 | 46 | public function setSerializer(SerializerInterface $serializer) 47 | { 48 | $this->serializer = $serializer; 49 | $this->normalizer->setSerializer($serializer); 50 | } 51 | 52 | /** 53 | * {@inheritdoc} 54 | */ 55 | public function normalize($object, string $format = null, array $context = []) 56 | { 57 | if ($object instanceof Headers) { 58 | $ret = []; 59 | foreach ($this->headersProperty->getValue($object) as $name => $header) { 60 | $ret[$name] = $this->serializer->normalize($header, $format, $context); 61 | } 62 | 63 | return $ret; 64 | } 65 | 66 | if ($object instanceof AbstractPart) { 67 | $ret = $this->normalizer->normalize($object, $format, $context); 68 | $ret['class'] = \get_class($object); 69 | 70 | return $ret; 71 | } 72 | 73 | return $this->normalizer->normalize($object, $format, $context); 74 | } 75 | 76 | /** 77 | * {@inheritdoc} 78 | */ 79 | public function denormalize($data, string $type, string $format = null, array $context = []) 80 | { 81 | if (Headers::class === $type) { 82 | $ret = []; 83 | foreach ($data as $headers) { 84 | foreach ($headers as $header) { 85 | $ret[] = $this->serializer->denormalize($header, $this->headerClassMap[strtolower($header['name'])] ?? UnstructuredHeader::class, $format, $context); 86 | } 87 | } 88 | 89 | return new Headers(...$ret); 90 | } 91 | 92 | if (AbstractPart::class === $type) { 93 | $type = $data['class']; 94 | unset($data['class']); 95 | } 96 | 97 | return $this->normalizer->denormalize($data, $type, $format, $context); 98 | } 99 | 100 | /** 101 | * {@inheritdoc} 102 | */ 103 | public function supportsNormalization($data, string $format = null) 104 | { 105 | return $data instanceof Message || $data instanceof Headers || $data instanceof HeaderInterface || $data instanceof Address || $data instanceof AbstractPart; 106 | } 107 | 108 | /** 109 | * {@inheritdoc} 110 | */ 111 | public function supportsDenormalization($data, string $type, string $format = null) 112 | { 113 | return is_a($type, Message::class, true) || Headers::class === $type || AbstractPart::class === $type; 114 | } 115 | 116 | /** 117 | * {@inheritdoc} 118 | */ 119 | public function hasCacheableSupportsMethod(): bool 120 | { 121 | return __CLASS__ === static::class; 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Sprog 2 | ================================================================================ 3 | 4 | **AddOn für Sprachen** 5 | 6 | ## Platzhalter 7 | 8 | - einfaches Erstellen von Platzhaltern und deren Ersetzungen 9 | - Eine Sprache kann die Ersetzungen einer anderen Sprache verwenden (Sprachbasis) 10 | 11 | ### Anwendung 12 | 13 | Das **Anlegen** des Platzhalters erfolgt **ohne** das öffnende bzw. schließende **Tag**. 14 | 15 | **Beispiel** 16 | 17 | platzhalter 18 | 19 | Das **Notieren** des Platzhalters **im Code** (Klassen, Funktionen, Templates, Module, etc.), in **Artikelinhalten** oder **Tabellendaten** usw. erfolgt **mit** öffnenden und schließenden **Tag**. 20 | 21 | **Beispiel** 22 | 23 | {{ platzhalter }} 24 | 25 | 26 | ### Filter verwenden 27 | 28 | Filter werden direkt am Platzhalter im Code notiert und haben Einfluss auf deren Übersetzung. 29 | 30 | #### Mögliche Filter 31 | - - - - - - - - - - - - - - - - - - - - 32 | 33 | - format (sprintf) 34 | - limit 35 | - lower 36 | - markdown 37 | - raw (kein nl2br) 38 | - title 39 | - upper 40 | - words 41 | 42 | | Verwendung | Ersetzung | Ausgabe | 43 | | ---------- | --------- | ------- | 44 | | {{ sprog|format(5, Baum) }} | `%s Affen sitzen auf einem %s` | `5 Affen sitzen auf einem Baum` | 45 | | {{ sprog|limit(5,...) }} | `5 Affen sitzen auf einem Baum` | `5 Aff...` | 46 | | {{ sprog|lower }} | `5 Affen sitzen auf einem Baum` | `5 affen sitzen auf einem baum` | 47 | | {{ sprog|markdown }} | `**5 Affen sitzen auf einem Baum**` | `

5 Affen sitzen auf einem Baum

` | 48 | | {{ sprog|raw }} | `5 Affen sitzen auf einem Baum` | `5 Affen sitzen auf einem Baum` | 49 | | {{ sprog|title }} | `5 Affen sitzen auf einem Baum` | `5 Affen Sitzen Auf Einem Baum` | 50 | | {{ sprog|upper }} | `5 Affen sitzen auf einem Baum` | `5 AFFEN SITZEN AUF EINEM BAUM` | 51 | | {{ sprog|words(4) }} | `5 Affen sitzen auf einem Baum` | `5 Affen sitzen auf` | 52 | 53 | 54 | ### Helferfunktionen 55 | 56 | **Text ersetzen lassen** 57 | 58 | ```php 59 | echo sprogdown($text, $clang_id = null); 60 | ``` 61 | 62 | **Übersetzung eines einzelnen Platzhalters** 63 | 64 | ```php 65 | echo sprogcard($wildcard, $clang_id = null); 66 | ``` 67 | 68 | **Tabellenfeld mit dem Suffix der aktuellen Sprache** 69 | 70 | ```php 71 | echo sprogfield($field, $separator = '_'); 72 | 73 | // field 74 | // about_1, about_2 75 | echo sprogfield('about'); 76 | 77 | 78 | // oder in Yorm Dataset Class 79 | public function getAbout() 80 | { 81 | return trim($this->{sprogfield('about')}); 82 | } 83 | ``` 84 | 85 | ```php 86 | // normal 87 | foreach ($items as $item) { 88 | echo $item->getValue('name_' . rex_clang::getCurrentId()); 89 | } 90 | 91 | // sprogfield 92 | foreach ($items as $item) { 93 | echo $item->getValue(sprogfield('name')); 94 | } 95 | ``` 96 | 97 | ## Optionale Synchronisierung von 98 | 99 | - Artikelname mit Kategoriename innerhalb derselben Sprache 100 | - Kategoriename mit Artikelname innerhalb derselben Sprache 101 | - Status (Online/Offline) zwischen den Sprachen 102 | - Template zwischen den Sprachen 103 | 104 | 105 | ## Inhalte kopieren/synchronisieren 106 | 107 | - Inhalte können von einer Sprache zur anderen Sprache kopiert werden 108 | - Metadaten der Artikel/Kategorien können von einer Sprache zur anderen Sprache synchronisiert werden 109 | 110 | 111 | ## Bugtracker 112 | 113 | Du hast einen Fehler gefunden oder ein nettes Feature parat? [Lege ein Issue an](https://github.com/tbaddade/redaxo_sprog/issues). Bevor du ein neues Issue erstellts, suche bitte ob bereits eines mit deinem Anliegen existiert und lese die [Issue Guidelines (englisch)](https://github.com/necolas/issue-guidelines) von [Nicolas Gallagher](https://github.com/necolas/). 114 | 115 | 116 | ## Changelog 117 | 118 | siehe [CHANGELOG.md](https://github.com/tbaddade/redaxo_sprog/blob/master/CHANGELOG.md) 119 | 120 | ## Lizenz 121 | 122 | siehe [LICENSE](https://github.com/tbaddade/redaxo_sprog/blob/master/LICENSE) 123 | 124 | 125 | ## Autor 126 | 127 | **[Thomas Blum](https://github.com/tbaddade)** 128 | 129 | 130 | ## Übersetzungen 131 | 132 | - English [@ynamite](https://github.com/ynamite) 133 | - Español [@nandes2062](https://github.com/nandes2062) 134 | - Svensk [@interweave-media](https://github.com/interweave-media) 135 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/DateIntervalNormalizer.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | use Symfony\Component\Serializer\Exception\InvalidArgumentException; 15 | use Symfony\Component\Serializer\Exception\UnexpectedValueException; 16 | 17 | /** 18 | * Normalizes an instance of {@see \DateInterval} to an interval string. 19 | * Denormalizes an interval string to an instance of {@see \DateInterval}. 20 | * 21 | * @author Jérôme Parmentier 22 | */ 23 | class DateIntervalNormalizer implements NormalizerInterface, DenormalizerInterface, CacheableSupportsMethodInterface 24 | { 25 | public const FORMAT_KEY = 'dateinterval_format'; 26 | 27 | private $defaultContext = [ 28 | self::FORMAT_KEY => '%rP%yY%mM%dDT%hH%iM%sS', 29 | ]; 30 | 31 | public function __construct(array $defaultContext = []) 32 | { 33 | $this->defaultContext = array_merge($this->defaultContext, $defaultContext); 34 | } 35 | 36 | /** 37 | * {@inheritdoc} 38 | * 39 | * @throws InvalidArgumentException 40 | * 41 | * @return string 42 | */ 43 | public function normalize($object, string $format = null, array $context = []) 44 | { 45 | if (!$object instanceof \DateInterval) { 46 | throw new InvalidArgumentException('The object must be an instance of "\DateInterval".'); 47 | } 48 | 49 | return $object->format($context[self::FORMAT_KEY] ?? $this->defaultContext[self::FORMAT_KEY]); 50 | } 51 | 52 | /** 53 | * {@inheritdoc} 54 | */ 55 | public function supportsNormalization($data, string $format = null) 56 | { 57 | return $data instanceof \DateInterval; 58 | } 59 | 60 | /** 61 | * {@inheritdoc} 62 | */ 63 | public function hasCacheableSupportsMethod(): bool 64 | { 65 | return __CLASS__ === static::class; 66 | } 67 | 68 | /** 69 | * {@inheritdoc} 70 | * 71 | * @throws InvalidArgumentException 72 | * @throws UnexpectedValueException 73 | * 74 | * @return \DateInterval 75 | */ 76 | public function denormalize($data, string $type, string $format = null, array $context = []) 77 | { 78 | if (!\is_string($data)) { 79 | throw new InvalidArgumentException(sprintf('Data expected to be a string, "%s" given.', get_debug_type($data))); 80 | } 81 | 82 | if (!$this->isISO8601($data)) { 83 | throw new UnexpectedValueException('Expected a valid ISO 8601 interval string.'); 84 | } 85 | 86 | $dateIntervalFormat = $context[self::FORMAT_KEY] ?? $this->defaultContext[self::FORMAT_KEY]; 87 | 88 | $signPattern = ''; 89 | switch (substr($dateIntervalFormat, 0, 2)) { 90 | case '%R': 91 | $signPattern = '[-+]'; 92 | $dateIntervalFormat = substr($dateIntervalFormat, 2); 93 | break; 94 | case '%r': 95 | $signPattern = '-?'; 96 | $dateIntervalFormat = substr($dateIntervalFormat, 2); 97 | break; 98 | } 99 | $valuePattern = '/^'.$signPattern.preg_replace('/%([yYmMdDhHiIsSwW])(\w)/', '(?:(?P<$1>\d+)$2)?', preg_replace('/(T.*)$/', '($1)?', $dateIntervalFormat)).'$/'; 100 | if (!preg_match($valuePattern, $data)) { 101 | throw new UnexpectedValueException(sprintf('Value "%s" contains intervals not accepted by format "%s".', $data, $dateIntervalFormat)); 102 | } 103 | 104 | try { 105 | if ('-' === $data[0]) { 106 | $interval = new \DateInterval(substr($data, 1)); 107 | $interval->invert = 1; 108 | 109 | return $interval; 110 | } 111 | 112 | if ('+' === $data[0]) { 113 | return new \DateInterval(substr($data, 1)); 114 | } 115 | 116 | return new \DateInterval($data); 117 | } catch (\Exception $e) { 118 | throw new UnexpectedValueException($e->getMessage(), $e->getCode(), $e); 119 | } 120 | } 121 | 122 | /** 123 | * {@inheritdoc} 124 | */ 125 | public function supportsDenormalization($data, string $type, string $format = null) 126 | { 127 | return \DateInterval::class === $type; 128 | } 129 | 130 | private function isISO8601(string $string): bool 131 | { 132 | return preg_match('/^[\-+]?P(?=\w*(?:\d|%\w))(?:\d+Y|%[yY]Y)?(?:\d+M|%[mM]M)?(?:(?:\d+D|%[dD]D)|(?:\d+W|%[wW]W))?(?:T(?:\d+H|[hH]H)?(?:\d+M|[iI]M)?(?:\d+S|[sS]S)?)?$/', $string); 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Mapping/Loader/schema/dic/serializer-mapping/serializer-mapping-1.0.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/ConstraintViolationListNormalizer.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | use Symfony\Component\Serializer\NameConverter\NameConverterInterface; 15 | use Symfony\Component\Validator\ConstraintViolationListInterface; 16 | 17 | /** 18 | * A normalizer that normalizes a ConstraintViolationListInterface instance. 19 | * 20 | * This Normalizer implements RFC7807 {@link https://tools.ietf.org/html/rfc7807}. 21 | * 22 | * @author Grégoire Pineau 23 | * @author Kévin Dunglas 24 | */ 25 | class ConstraintViolationListNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface 26 | { 27 | public const INSTANCE = 'instance'; 28 | public const STATUS = 'status'; 29 | public const TITLE = 'title'; 30 | public const TYPE = 'type'; 31 | public const PAYLOAD_FIELDS = 'payload_fields'; 32 | 33 | private $defaultContext; 34 | private $nameConverter; 35 | 36 | public function __construct(array $defaultContext = [], NameConverterInterface $nameConverter = null) 37 | { 38 | $this->defaultContext = $defaultContext; 39 | $this->nameConverter = $nameConverter; 40 | } 41 | 42 | /** 43 | * {@inheritdoc} 44 | * 45 | * @return array 46 | */ 47 | public function normalize($object, string $format = null, array $context = []) 48 | { 49 | if (\array_key_exists(self::PAYLOAD_FIELDS, $context)) { 50 | $payloadFieldsToSerialize = $context[self::PAYLOAD_FIELDS]; 51 | } elseif (\array_key_exists(self::PAYLOAD_FIELDS, $this->defaultContext)) { 52 | $payloadFieldsToSerialize = $this->defaultContext[self::PAYLOAD_FIELDS]; 53 | } else { 54 | $payloadFieldsToSerialize = []; 55 | } 56 | 57 | if (\is_array($payloadFieldsToSerialize) && [] !== $payloadFieldsToSerialize) { 58 | $payloadFieldsToSerialize = array_flip($payloadFieldsToSerialize); 59 | } 60 | 61 | $violations = []; 62 | $messages = []; 63 | foreach ($object as $violation) { 64 | $propertyPath = $this->nameConverter ? $this->nameConverter->normalize($violation->getPropertyPath(), null, $format, $context) : $violation->getPropertyPath(); 65 | 66 | $violationEntry = [ 67 | 'propertyPath' => $propertyPath, 68 | 'title' => $violation->getMessage(), 69 | 'parameters' => $violation->getParameters(), 70 | ]; 71 | if (null !== $code = $violation->getCode()) { 72 | $violationEntry['type'] = sprintf('urn:uuid:%s', $code); 73 | } 74 | 75 | $constraint = $violation->getConstraint(); 76 | if ( 77 | [] !== $payloadFieldsToSerialize && 78 | $constraint && 79 | $constraint->payload && 80 | // If some or all payload fields are whitelisted, add them 81 | $payloadFields = null === $payloadFieldsToSerialize || true === $payloadFieldsToSerialize ? $constraint->payload : array_intersect_key($constraint->payload, $payloadFieldsToSerialize) 82 | ) { 83 | $violationEntry['payload'] = $payloadFields; 84 | } 85 | 86 | $violations[] = $violationEntry; 87 | 88 | $prefix = $propertyPath ? sprintf('%s: ', $propertyPath) : ''; 89 | $messages[] = $prefix.$violation->getMessage(); 90 | } 91 | 92 | $result = [ 93 | 'type' => $context[self::TYPE] ?? $this->defaultContext[self::TYPE] ?? 'https://symfony.com/errors/validation', 94 | 'title' => $context[self::TITLE] ?? $this->defaultContext[self::TITLE] ?? 'Validation Failed', 95 | ]; 96 | if (null !== $status = ($context[self::STATUS] ?? $this->defaultContext[self::STATUS] ?? null)) { 97 | $result['status'] = $status; 98 | } 99 | if ($messages) { 100 | $result['detail'] = implode("\n", $messages); 101 | } 102 | if (null !== $instance = ($context[self::INSTANCE] ?? $this->defaultContext[self::INSTANCE] ?? null)) { 103 | $result['instance'] = $instance; 104 | } 105 | 106 | return $result + ['violations' => $violations]; 107 | } 108 | 109 | /** 110 | * {@inheritdoc} 111 | */ 112 | public function supportsNormalization($data, string $format = null) 113 | { 114 | return $data instanceof ConstraintViolationListInterface; 115 | } 116 | 117 | /** 118 | * {@inheritdoc} 119 | */ 120 | public function hasCacheableSupportsMethod(): bool 121 | { 122 | return __CLASS__ === static::class; 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/DateTimeNormalizer.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | use Symfony\Component\Serializer\Exception\InvalidArgumentException; 15 | use Symfony\Component\Serializer\Exception\NotNormalizableValueException; 16 | 17 | /** 18 | * Normalizes an object implementing the {@see \DateTimeInterface} to a date string. 19 | * Denormalizes a date string to an instance of {@see \DateTime} or {@see \DateTimeImmutable}. 20 | * 21 | * @author Kévin Dunglas 22 | */ 23 | class DateTimeNormalizer implements NormalizerInterface, DenormalizerInterface, CacheableSupportsMethodInterface 24 | { 25 | public const FORMAT_KEY = 'datetime_format'; 26 | public const TIMEZONE_KEY = 'datetime_timezone'; 27 | 28 | private $defaultContext = [ 29 | self::FORMAT_KEY => \DateTime::RFC3339, 30 | self::TIMEZONE_KEY => null, 31 | ]; 32 | 33 | private const SUPPORTED_TYPES = [ 34 | \DateTimeInterface::class => true, 35 | \DateTimeImmutable::class => true, 36 | \DateTime::class => true, 37 | ]; 38 | 39 | public function __construct(array $defaultContext = []) 40 | { 41 | $this->defaultContext = array_merge($this->defaultContext, $defaultContext); 42 | } 43 | 44 | /** 45 | * {@inheritdoc} 46 | * 47 | * @throws InvalidArgumentException 48 | * 49 | * @return string 50 | */ 51 | public function normalize($object, string $format = null, array $context = []) 52 | { 53 | if (!$object instanceof \DateTimeInterface) { 54 | throw new InvalidArgumentException('The object must implement the "\DateTimeInterface".'); 55 | } 56 | 57 | $dateTimeFormat = $context[self::FORMAT_KEY] ?? $this->defaultContext[self::FORMAT_KEY]; 58 | $timezone = $this->getTimezone($context); 59 | 60 | if (null !== $timezone) { 61 | $object = clone $object; 62 | $object = $object->setTimezone($timezone); 63 | } 64 | 65 | return $object->format($dateTimeFormat); 66 | } 67 | 68 | /** 69 | * {@inheritdoc} 70 | */ 71 | public function supportsNormalization($data, string $format = null) 72 | { 73 | return $data instanceof \DateTimeInterface; 74 | } 75 | 76 | /** 77 | * {@inheritdoc} 78 | * 79 | * @throws NotNormalizableValueException 80 | * 81 | * @return \DateTimeInterface 82 | */ 83 | public function denormalize($data, string $type, string $format = null, array $context = []) 84 | { 85 | $dateTimeFormat = $context[self::FORMAT_KEY] ?? null; 86 | $timezone = $this->getTimezone($context); 87 | 88 | if (null === $data || (\is_string($data) && '' === trim($data))) { 89 | throw new NotNormalizableValueException('The data is either an empty string or null, you should pass a string that can be parsed with the passed format or a valid DateTime string.'); 90 | } 91 | 92 | if (null !== $dateTimeFormat) { 93 | $object = \DateTime::class === $type ? \DateTime::createFromFormat($dateTimeFormat, $data, $timezone) : \DateTimeImmutable::createFromFormat($dateTimeFormat, $data, $timezone); 94 | 95 | if (false !== $object) { 96 | return $object; 97 | } 98 | 99 | $dateTimeErrors = \DateTime::class === $type ? \DateTime::getLastErrors() : \DateTimeImmutable::getLastErrors(); 100 | 101 | throw new NotNormalizableValueException(sprintf('Parsing datetime string "%s" using format "%s" resulted in %d errors: ', $data, $dateTimeFormat, $dateTimeErrors['error_count'])."\n".implode("\n", $this->formatDateTimeErrors($dateTimeErrors['errors']))); 102 | } 103 | 104 | try { 105 | return \DateTime::class === $type ? new \DateTime($data, $timezone) : new \DateTimeImmutable($data, $timezone); 106 | } catch (\Exception $e) { 107 | throw new NotNormalizableValueException($e->getMessage(), $e->getCode(), $e); 108 | } 109 | } 110 | 111 | /** 112 | * {@inheritdoc} 113 | */ 114 | public function supportsDenormalization($data, string $type, string $format = null) 115 | { 116 | return isset(self::SUPPORTED_TYPES[$type]); 117 | } 118 | 119 | /** 120 | * {@inheritdoc} 121 | */ 122 | public function hasCacheableSupportsMethod(): bool 123 | { 124 | return __CLASS__ === static::class; 125 | } 126 | 127 | /** 128 | * Formats datetime errors. 129 | * 130 | * @return string[] 131 | */ 132 | private function formatDateTimeErrors(array $errors): array 133 | { 134 | $formattedErrors = []; 135 | 136 | foreach ($errors as $pos => $message) { 137 | $formattedErrors[] = sprintf('at position %d: %s', $pos, $message); 138 | } 139 | 140 | return $formattedErrors; 141 | } 142 | 143 | private function getTimezone(array $context): ?\DateTimeZone 144 | { 145 | $dateTimeZone = $context[self::TIMEZONE_KEY] ?? $this->defaultContext[self::TIMEZONE_KEY]; 146 | 147 | if (null === $dateTimeZone) { 148 | return null; 149 | } 150 | 151 | return $dateTimeZone instanceof \DateTimeZone ? $dateTimeZone : new \DateTimeZone($dateTimeZone); 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /lib/Sprog/Sync.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Sprog; 13 | 14 | class Sync 15 | { 16 | public static function articleNameToCategoryName($params) 17 | { 18 | try { 19 | $id = $params['id']; 20 | $clangId = $params['clang']; 21 | $parentId = isset($params['parent_id']) ? $params['parent_id'] : -1; 22 | $articleName = isset($params['name']) ? $params['name'] : ''; 23 | 24 | if ($articleName != '') { 25 | \rex_sql::factory() 26 | ->setTable(\rex::getTable('article')) 27 | ->setWhere('(id = :id OR (parent_id = :parent_id AND startarticle = 0)) AND clang_id = :clang', ['id' => $id, 'parent_id' => $parentId, 'clang' => $clangId]) 28 | ->setValue('catname', $articleName) 29 | ->addGlobalUpdateFields() 30 | ->update(); 31 | 32 | \rex_article_cache::delete($id, $clangId); 33 | } 34 | } catch (\rex_sql_exception $e) { 35 | throw new \rex_api_exception($e); 36 | } 37 | } 38 | 39 | public static function categoryNameToArticleName($params) 40 | { 41 | try { 42 | $id = $params['id']; 43 | $clangId = $params['clang']; 44 | $categoryName = isset($params['data']['catname']) ? $params['data']['catname'] : ''; 45 | 46 | if ($categoryName != '') { 47 | \rex_sql::factory() 48 | ->setTable(\rex::getTable('article')) 49 | ->setWhere('id = :id AND clang_id = :clang', ['id' => $id, 'clang' => $clangId]) 50 | ->setValue('name', $categoryName) 51 | ->addGlobalUpdateFields() 52 | ->update(); 53 | 54 | \rex_article_cache::delete($id, $clangId); 55 | } 56 | } catch (\rex_sql_exception $e) { 57 | throw new \rex_api_exception($e); 58 | } 59 | } 60 | 61 | public static function articleStatus($params) 62 | { 63 | try { 64 | $id = $params['id']; 65 | $clangId = $params['clang']; 66 | $status = $params['status']; 67 | 68 | // ----- Update Article Status 69 | \rex_sql::factory() 70 | ->setTable(\rex::getTable('article')) 71 | ->setWhere('id = :id AND clang_id != :clang', ['id' => $id, 'clang' => $clangId]) 72 | ->setValue('status', $status) 73 | ->addGlobalUpdateFields() 74 | ->update(); 75 | 76 | \rex_article_cache::delete($id); 77 | } catch (\rex_sql_exception $e) { 78 | throw new \rex_api_exception($e); 79 | } 80 | } 81 | 82 | public static function articleTemplate($params) 83 | { 84 | try { 85 | $id = $params['id']; 86 | $clangId = $params['clang']; 87 | $templateId = isset($params['template_id']) ? $params['template_id'] : 0; 88 | 89 | // ----- Update Template Id 90 | if ($templateId > 0) { 91 | \rex_sql::factory() 92 | ->setTable(\rex::getTable('article')) 93 | ->setWhere('id = :id AND clang_id != :clang', ['id' => $id, 'clang' => $clangId]) 94 | ->setValue('template_id', $templateId) 95 | ->addGlobalUpdateFields() 96 | ->update(); 97 | 98 | \rex_article_cache::delete($id); 99 | } 100 | } catch (\rex_sql_exception $e) { 101 | throw new \rex_api_exception($e); 102 | } 103 | } 104 | 105 | public static function articleMetainfo($params, $fields, $toClangId = 0) 106 | { 107 | // Check whether field exists in table 108 | $sql = \rex_sql::factory()->setQuery('SELECT * FROM '.\rex::getTable('article').' LIMIT 1'); 109 | $fieldNames = $sql->getFieldnames(); 110 | foreach ($fields as $index => $field) { 111 | if (!in_array($field, $fieldNames)) { 112 | unset($fields[$index]); 113 | } 114 | } 115 | 116 | if (count($fields) < 1) { 117 | return; 118 | } 119 | 120 | 121 | $id = $params['id']; 122 | $clangId = $params['clang']; 123 | $saveFields = \rex_sql::factory() 124 | ->setTable(\rex::getTable('article')) 125 | ->setWhere('id = :id AND clang_id = :clang', ['id' => $id, 'clang' => $clangId]) 126 | ->select(implode(',', $fields)) 127 | ->getArray(); 128 | 129 | if (count($saveFields) == 1) { 130 | $saveFields = $saveFields[0]; 131 | try { 132 | // ----- Update Category Metainfo 133 | \rex_sql::factory() 134 | ->setTable(\rex::getTable('article')) 135 | ->setWhere('id = :id AND clang_id '.($toClangId > 0 ? '=' : '!=').' :clang', ['id' => $id, 'clang' => ($toClangId > 0 ? $toClangId : $clangId)]) 136 | ->setValues($saveFields) 137 | ->addGlobalUpdateFields() 138 | ->update(); 139 | 140 | \rex_article_cache::delete($id); 141 | } catch (\rex_sql_exception $e) { 142 | throw new \rex_api_exception($e); 143 | } 144 | } 145 | } 146 | 147 | public static function categoryMetainfo($params, $fields) 148 | { 149 | self::articleMetainfo($params, $fields); 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /vendor/symfony/serializer/Normalizer/GetSetMethodNormalizer.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Serializer\Normalizer; 13 | 14 | /** 15 | * Converts between objects with getter and setter methods and arrays. 16 | * 17 | * The normalization process looks at all public methods and calls the ones 18 | * which have a name starting with get and take no parameters. The result is a 19 | * map from property names (method name stripped of the get prefix and converted 20 | * to lower case) to property values. Property values are normalized through the 21 | * serializer. 22 | * 23 | * The denormalization first looks at the constructor of the given class to see 24 | * if any of the parameters have the same name as one of the properties. The 25 | * constructor is then called with all parameters or an exception is thrown if 26 | * any required parameters were not present as properties. Then the denormalizer 27 | * walks through the given map of property names to property values to see if a 28 | * setter method exists for any of the properties. If a setter exists it is 29 | * called with the property value. No automatic denormalization of the value 30 | * takes place. 31 | * 32 | * @author Nils Adermann 33 | * @author Kévin Dunglas 34 | */ 35 | class GetSetMethodNormalizer extends AbstractObjectNormalizer 36 | { 37 | private static $setterAccessibleCache = []; 38 | 39 | /** 40 | * {@inheritdoc} 41 | */ 42 | public function supportsNormalization($data, string $format = null) 43 | { 44 | return parent::supportsNormalization($data, $format) && $this->supports(\get_class($data)); 45 | } 46 | 47 | /** 48 | * {@inheritdoc} 49 | */ 50 | public function supportsDenormalization($data, string $type, string $format = null) 51 | { 52 | return parent::supportsDenormalization($data, $type, $format) && $this->supports($type); 53 | } 54 | 55 | /** 56 | * {@inheritdoc} 57 | */ 58 | public function hasCacheableSupportsMethod(): bool 59 | { 60 | return __CLASS__ === static::class; 61 | } 62 | 63 | /** 64 | * Checks if the given class has any getter method. 65 | */ 66 | private function supports(string $class): bool 67 | { 68 | $class = new \ReflectionClass($class); 69 | $methods = $class->getMethods(\ReflectionMethod::IS_PUBLIC); 70 | foreach ($methods as $method) { 71 | if ($this->isGetMethod($method)) { 72 | return true; 73 | } 74 | } 75 | 76 | return false; 77 | } 78 | 79 | /** 80 | * Checks if a method's name matches /^(get|is|has).+$/ and can be called non-statically without parameters. 81 | */ 82 | private function isGetMethod(\ReflectionMethod $method): bool 83 | { 84 | $methodLength = \strlen($method->name); 85 | 86 | return 87 | !$method->isStatic() && 88 | ( 89 | ((str_starts_with($method->name, 'get') && 3 < $methodLength) || 90 | (str_starts_with($method->name, 'is') && 2 < $methodLength) || 91 | (str_starts_with($method->name, 'has') && 3 < $methodLength)) && 92 | 0 === $method->getNumberOfRequiredParameters() 93 | ) 94 | ; 95 | } 96 | 97 | /** 98 | * {@inheritdoc} 99 | */ 100 | protected function extractAttributes(object $object, string $format = null, array $context = []) 101 | { 102 | $reflectionObject = new \ReflectionObject($object); 103 | $reflectionMethods = $reflectionObject->getMethods(\ReflectionMethod::IS_PUBLIC); 104 | 105 | $attributes = []; 106 | foreach ($reflectionMethods as $method) { 107 | if (!$this->isGetMethod($method)) { 108 | continue; 109 | } 110 | 111 | $attributeName = lcfirst(substr($method->name, str_starts_with($method->name, 'is') ? 2 : 3)); 112 | 113 | if ($this->isAllowedAttribute($object, $attributeName, $format, $context)) { 114 | $attributes[] = $attributeName; 115 | } 116 | } 117 | 118 | return $attributes; 119 | } 120 | 121 | /** 122 | * {@inheritdoc} 123 | */ 124 | protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []) 125 | { 126 | $ucfirsted = ucfirst($attribute); 127 | 128 | $getter = 'get'.$ucfirsted; 129 | if (\is_callable([$object, $getter])) { 130 | return $object->$getter(); 131 | } 132 | 133 | $isser = 'is'.$ucfirsted; 134 | if (\is_callable([$object, $isser])) { 135 | return $object->$isser(); 136 | } 137 | 138 | $haser = 'has'.$ucfirsted; 139 | if (\is_callable([$object, $haser])) { 140 | return $object->$haser(); 141 | } 142 | 143 | return null; 144 | } 145 | 146 | /** 147 | * {@inheritdoc} 148 | */ 149 | protected function setAttributeValue(object $object, string $attribute, $value, string $format = null, array $context = []) 150 | { 151 | $setter = 'set'.ucfirst($attribute); 152 | $key = \get_class($object).':'.$setter; 153 | 154 | if (!isset(self::$setterAccessibleCache[$key])) { 155 | self::$setterAccessibleCache[$key] = \is_callable([$object, $setter]) && !(new \ReflectionMethod($object, $setter))->isStatic(); 156 | } 157 | 158 | if (self::$setterAccessibleCache[$key]) { 159 | $object->$setter($value); 160 | } 161 | } 162 | } 163 | --------------------------------------------------------------------------------