From 5bf66662a9bdd62c5bccab15e607cd95cfb8fcab Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Mon, 27 Jul 2020 10:05:23 +0200 Subject: Removed wordpress and phpmyadmin, my server doesn't handle it well and it brings shame on my familly --- .../extensions/lib/Twig/Extensions/Autoloader.php | 48 ------ .../lib/Twig/Extensions/Extension/Array.php | 56 ------- .../lib/Twig/Extensions/Extension/Date.php | 107 ------------- .../lib/Twig/Extensions/Extension/I18n.php | 41 ----- .../lib/Twig/Extensions/Extension/Intl.php | 146 ------------------ .../lib/Twig/Extensions/Extension/Text.php | 99 ------------ .../extensions/lib/Twig/Extensions/Grammar.php | 43 ------ .../lib/Twig/Extensions/Grammar/Arguments.php | 26 ---- .../lib/Twig/Extensions/Grammar/Array.php | 26 ---- .../lib/Twig/Extensions/Grammar/Body.php | 43 ------ .../lib/Twig/Extensions/Grammar/Boolean.php | 28 ---- .../lib/Twig/Extensions/Grammar/Constant.php | 41 ----- .../lib/Twig/Extensions/Grammar/Expression.php | 26 ---- .../lib/Twig/Extensions/Grammar/Hash.php | 26 ---- .../lib/Twig/Extensions/Grammar/Number.php | 28 ---- .../lib/Twig/Extensions/Grammar/Optional.php | 73 --------- .../lib/Twig/Extensions/Grammar/Switch.php | 28 ---- .../extensions/lib/Twig/Extensions/Grammar/Tag.php | 60 -------- .../lib/Twig/Extensions/GrammarInterface.php | 22 --- .../extensions/lib/Twig/Extensions/Node/Trans.php | 166 --------------------- .../lib/Twig/Extensions/SimpleTokenParser.php | 138 ----------------- .../lib/Twig/Extensions/TokenParser/Trans.php | 88 ----------- 22 files changed, 1359 deletions(-) delete mode 100644 srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Autoloader.php delete mode 100644 srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Extension/Array.php delete mode 100644 srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Extension/Date.php delete mode 100644 srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Extension/I18n.php delete mode 100644 srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Extension/Intl.php delete mode 100644 srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Extension/Text.php delete mode 100644 srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar.php delete mode 100644 srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Arguments.php delete mode 100644 srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Array.php delete mode 100644 srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Body.php delete mode 100644 srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Boolean.php delete mode 100644 srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Constant.php delete mode 100644 srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Expression.php delete mode 100644 srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Hash.php delete mode 100644 srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Number.php delete mode 100644 srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Optional.php delete mode 100644 srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Switch.php delete mode 100644 srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Tag.php delete mode 100644 srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/GrammarInterface.php delete mode 100644 srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Node/Trans.php delete mode 100644 srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/SimpleTokenParser.php delete mode 100644 srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/TokenParser/Trans.php (limited to 'srcs/phpmyadmin/vendor/twig/extensions/lib/Twig') diff --git a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Autoloader.php b/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Autoloader.php deleted file mode 100644 index 9ad5a46..0000000 --- a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Autoloader.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * @deprecated since version 1.5, use Composer instead. - */ -class Twig_Extensions_Autoloader -{ - /** - * Registers Twig_Extensions_Autoloader as an SPL autoloader. - */ - public static function register() - { - spl_autoload_register(array(new self(), 'autoload')); - } - - /** - * Handles autoloading of classes. - * - * @param string $class a class name - * - * @return bool Returns true if the class has been loaded - */ - public static function autoload($class) - { - if (0 !== strpos($class, 'Twig_Extensions')) { - return; - } - - if (file_exists($file = __DIR__.'/../../'.str_replace('_', '/', $class).'.php')) { - require $file; - } - } -} diff --git a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Extension/Array.php b/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Extension/Array.php deleted file mode 100644 index a5eaf6d..0000000 --- a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Extension/Array.php +++ /dev/null @@ -1,56 +0,0 @@ - - */ -class Twig_Extensions_Extension_Array extends Twig_Extension -{ - /** - * {@inheritdoc} - */ - public function getFilters() - { - $filters = array( - new Twig_SimpleFilter('shuffle', 'twig_shuffle_filter'), - ); - - return $filters; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'array'; - } -} - -/** - * Shuffles an array. - * - * @param array|Traversable $array An array - * - * @return array - */ -function twig_shuffle_filter($array) -{ - if ($array instanceof Traversable) { - $array = iterator_to_array($array, false); - } - - shuffle($array); - - return $array; -} - -class_alias('Twig_Extensions_Extension_Array', 'Twig\Extensions\ArrayExtension', false); diff --git a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Extension/Date.php b/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Extension/Date.php deleted file mode 100644 index 1cdd455..0000000 --- a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Extension/Date.php +++ /dev/null @@ -1,107 +0,0 @@ - - */ -class Twig_Extensions_Extension_Date extends Twig_Extension -{ - public static $units = array( - 'y' => 'year', - 'm' => 'month', - 'd' => 'day', - 'h' => 'hour', - 'i' => 'minute', - 's' => 'second', - ); - - /** - * @var TranslatorInterface - */ - private $translator; - - public function __construct(TranslatorInterface $translator = null) - { - // Ignore the IdentityTranslator, otherwise the parameters won't be replaced properly - if ($translator instanceof IdentityTranslator) { - $translator = null; - } - - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ - public function getFilters() - { - return array( - new Twig_SimpleFilter('time_diff', array($this, 'diff'), array('needs_environment' => true)), - ); - } - - /** - * Filter for converting dates to a time ago string like Facebook and Twitter has. - * - * @param Twig_Environment $env a Twig_Environment instance - * @param string|DateTime $date a string or DateTime object to convert - * @param string|DateTime $now A string or DateTime object to compare with. If none given, the current time will be used. - * - * @return string the converted time - */ - public function diff(Twig_Environment $env, $date, $now = null) - { - // Convert both dates to DateTime instances. - $date = twig_date_converter($env, $date); - $now = twig_date_converter($env, $now); - - // Get the difference between the two DateTime objects. - $diff = $date->diff($now); - - // Check for each interval if it appears in the $diff object. - foreach (self::$units as $attribute => $unit) { - $count = $diff->$attribute; - - if (0 !== $count) { - return $this->getPluralizedInterval($count, $diff->invert, $unit); - } - } - - return ''; - } - - protected function getPluralizedInterval($count, $invert, $unit) - { - if ($this->translator) { - $id = sprintf('diff.%s.%s', $invert ? 'in' : 'ago', $unit); - - return $this->translator->transChoice($id, $count, array('%count%' => $count), 'date'); - } - - if (1 !== $count) { - $unit .= 's'; - } - - return $invert ? "in $count $unit" : "$count $unit ago"; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'date'; - } -} - -class_alias('Twig_Extensions_Extension_Date', 'Twig\Extensions\DateExtension', false); diff --git a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Extension/I18n.php b/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Extension/I18n.php deleted file mode 100644 index 41cb9ce..0000000 --- a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Extension/I18n.php +++ /dev/null @@ -1,41 +0,0 @@ - true)), - new Twig_SimpleFilter('localizednumber', 'twig_localized_number_filter'), - new Twig_SimpleFilter('localizedcurrency', 'twig_localized_currency_filter'), - ); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'intl'; - } -} - -function twig_localized_date_filter(Twig_Environment $env, $date, $dateFormat = 'medium', $timeFormat = 'medium', $locale = null, $timezone = null, $format = null, $calendar = 'gregorian') -{ - $date = twig_date_converter($env, $date, $timezone); - - $formatValues = array( - 'none' => IntlDateFormatter::NONE, - 'short' => IntlDateFormatter::SHORT, - 'medium' => IntlDateFormatter::MEDIUM, - 'long' => IntlDateFormatter::LONG, - 'full' => IntlDateFormatter::FULL, - ); - - if (PHP_VERSION_ID < 50500 || !class_exists('IntlTimeZone')) { - $formatter = IntlDateFormatter::create( - $locale, - $formatValues[$dateFormat], - $formatValues[$timeFormat], - $date->getTimezone()->getName(), - 'gregorian' === $calendar ? IntlDateFormatter::GREGORIAN : IntlDateFormatter::TRADITIONAL, - $format - ); - - return $formatter->format($date->getTimestamp()); - } - - $formatter = IntlDateFormatter::create( - $locale, - $formatValues[$dateFormat], - $formatValues[$timeFormat], - IntlTimeZone::createTimeZone($date->getTimezone()->getName()), - 'gregorian' === $calendar ? IntlDateFormatter::GREGORIAN : IntlDateFormatter::TRADITIONAL, - $format - ); - - return $formatter->format($date->getTimestamp()); -} - -function twig_localized_number_filter($number, $style = 'decimal', $type = 'default', $locale = null) -{ - static $typeValues = array( - 'default' => NumberFormatter::TYPE_DEFAULT, - 'int32' => NumberFormatter::TYPE_INT32, - 'int64' => NumberFormatter::TYPE_INT64, - 'double' => NumberFormatter::TYPE_DOUBLE, - 'currency' => NumberFormatter::TYPE_CURRENCY, - ); - - $formatter = twig_get_number_formatter($locale, $style); - - if (!isset($typeValues[$type])) { - throw new Twig_Error_Syntax(sprintf('The type "%s" does not exist. Known types are: "%s"', $type, implode('", "', array_keys($typeValues)))); - } - - return $formatter->format($number, $typeValues[$type]); -} - -function twig_localized_currency_filter($number, $currency = null, $locale = null) -{ - $formatter = twig_get_number_formatter($locale, 'currency'); - - return $formatter->formatCurrency($number, $currency); -} - -/** - * Gets a number formatter instance according to given locale and formatter. - * - * @param string $locale Locale in which the number would be formatted - * @param int $style Style of the formatting - * - * @return NumberFormatter A NumberFormatter instance - */ -function twig_get_number_formatter($locale, $style) -{ - static $formatter, $currentStyle; - - $locale = null !== $locale ? $locale : Locale::getDefault(); - - if ($formatter && $formatter->getLocale() === $locale && $currentStyle === $style) { - // Return same instance of NumberFormatter if parameters are the same - // to those in previous call - return $formatter; - } - - static $styleValues = array( - 'decimal' => NumberFormatter::DECIMAL, - 'currency' => NumberFormatter::CURRENCY, - 'percent' => NumberFormatter::PERCENT, - 'scientific' => NumberFormatter::SCIENTIFIC, - 'spellout' => NumberFormatter::SPELLOUT, - 'ordinal' => NumberFormatter::ORDINAL, - 'duration' => NumberFormatter::DURATION, - ); - - if (!isset($styleValues[$style])) { - throw new Twig_Error_Syntax(sprintf('The style "%s" does not exist. Known styles are: "%s"', $style, implode('", "', array_keys($styleValues)))); - } - - $currentStyle = $style; - - $formatter = NumberFormatter::create($locale, $styleValues[$style]); - - return $formatter; -} - -class_alias('Twig_Extensions_Extension_Intl', 'Twig\Extensions\IntlExtension', false); diff --git a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Extension/Text.php b/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Extension/Text.php deleted file mode 100644 index 52d3591..0000000 --- a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Extension/Text.php +++ /dev/null @@ -1,99 +0,0 @@ - - */ -class Twig_Extensions_Extension_Text extends Twig_Extension -{ - /** - * {@inheritdoc} - */ - public function getFilters() - { - return array( - new Twig_SimpleFilter('truncate', 'twig_truncate_filter', array('needs_environment' => true)), - new Twig_SimpleFilter('wordwrap', 'twig_wordwrap_filter', array('needs_environment' => true)), - ); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'Text'; - } -} - -if (function_exists('mb_get_info')) { - function twig_truncate_filter(Twig_Environment $env, $value, $length = 30, $preserve = false, $separator = '...') - { - if (mb_strlen($value, $env->getCharset()) > $length) { - if ($preserve) { - // If breakpoint is on the last word, return the value without separator. - if (false === ($breakpoint = mb_strpos($value, ' ', $length, $env->getCharset()))) { - return $value; - } - - $length = $breakpoint; - } - - return rtrim(mb_substr($value, 0, $length, $env->getCharset())).$separator; - } - - return $value; - } - - function twig_wordwrap_filter(Twig_Environment $env, $value, $length = 80, $separator = "\n", $preserve = false) - { - $sentences = array(); - - $previous = mb_regex_encoding(); - mb_regex_encoding($env->getCharset()); - - $pieces = mb_split($separator, $value); - mb_regex_encoding($previous); - - foreach ($pieces as $piece) { - while (!$preserve && mb_strlen($piece, $env->getCharset()) > $length) { - $sentences[] = mb_substr($piece, 0, $length, $env->getCharset()); - $piece = mb_substr($piece, $length, 2048, $env->getCharset()); - } - - $sentences[] = $piece; - } - - return implode($separator, $sentences); - } -} else { - function twig_truncate_filter(Twig_Environment $env, $value, $length = 30, $preserve = false, $separator = '...') - { - if (strlen($value) > $length) { - if ($preserve) { - if (false !== ($breakpoint = strpos($value, ' ', $length))) { - $length = $breakpoint; - } - } - - return rtrim(substr($value, 0, $length)).$separator; - } - - return $value; - } - - function twig_wordwrap_filter(Twig_Environment $env, $value, $length = 80, $separator = "\n", $preserve = false) - { - return wordwrap($value, $length, $separator, !$preserve); - } -} - -class_alias('Twig_Extensions_Extension_Text', 'Twig\Extensions\TextExtension', false); diff --git a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar.php b/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar.php deleted file mode 100644 index b6cc0a7..0000000 --- a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar.php +++ /dev/null @@ -1,43 +0,0 @@ -name = $name; - } - - /** - * @param Twig_Parser $parser - */ - public function setParser(Twig_Parser $parser) - { - $this->parser = $parser; - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } -} diff --git a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Arguments.php b/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Arguments.php deleted file mode 100644 index abb9e0e..0000000 --- a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Arguments.php +++ /dev/null @@ -1,26 +0,0 @@ -', $this->name); - } - - public function parse(Twig_Token $token) - { - return $this->parser->getExpressionParser()->parseArguments(); - } -} diff --git a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Array.php b/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Array.php deleted file mode 100644 index 94d7b8c..0000000 --- a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Array.php +++ /dev/null @@ -1,26 +0,0 @@ -', $this->name); - } - - public function parse(Twig_Token $token) - { - return $this->parser->getExpressionParser()->parseArrayExpression(); - } -} diff --git a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Body.php b/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Body.php deleted file mode 100644 index b2ac43e..0000000 --- a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Body.php +++ /dev/null @@ -1,43 +0,0 @@ -end = null === $end ? 'end'.$name : $end; - } - - public function __toString() - { - return sprintf('<%s:body>', $this->name); - } - - public function parse(Twig_Token $token) - { - $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - return $this->parser->subparse(array($this, 'decideBlockEnd'), true); - } - - public function decideBlockEnd(Twig_Token $token) - { - return $token->test($this->end); - } -} diff --git a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Boolean.php b/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Boolean.php deleted file mode 100644 index 578567e..0000000 --- a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Boolean.php +++ /dev/null @@ -1,28 +0,0 @@ -', $this->name); - } - - public function parse(Twig_Token $token) - { - $this->parser->getStream()->expect(Twig_Token::NAME_TYPE, array('true', 'false')); - - return new Twig_Node_Expression_Constant('true' === $token->getValue() ? true : false, $token->getLine()); - } -} diff --git a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Constant.php b/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Constant.php deleted file mode 100644 index 8d82b82..0000000 --- a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Constant.php +++ /dev/null @@ -1,41 +0,0 @@ -name = $name; - $this->type = null === $type ? Twig_Token::NAME_TYPE : $type; - } - - public function __toString() - { - return $this->name; - } - - public function parse(Twig_Token $token) - { - $this->parser->getStream()->expect($this->type, $this->name); - - return $this->name; - } - - public function getType() - { - return $this->type; - } -} diff --git a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Expression.php b/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Expression.php deleted file mode 100644 index b73156e..0000000 --- a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Expression.php +++ /dev/null @@ -1,26 +0,0 @@ -', $this->name); - } - - public function parse(Twig_Token $token) - { - return $this->parser->getExpressionParser()->parseExpression(); - } -} diff --git a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Hash.php b/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Hash.php deleted file mode 100644 index 5ea3e69..0000000 --- a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Hash.php +++ /dev/null @@ -1,26 +0,0 @@ -', $this->name); - } - - public function parse(Twig_Token $token) - { - return $this->parser->getExpressionParser()->parseHashExpression(); - } -} diff --git a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Number.php b/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Number.php deleted file mode 100644 index 68bbb62..0000000 --- a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Number.php +++ /dev/null @@ -1,28 +0,0 @@ -', $this->name); - } - - public function parse(Twig_Token $token) - { - $this->parser->getStream()->expect(Twig_Token::NUMBER_TYPE); - - return new Twig_Node_Expression_Constant($token->getValue(), $token->getLine()); - } -} diff --git a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Optional.php b/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Optional.php deleted file mode 100644 index 0cde9bc..0000000 --- a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Optional.php +++ /dev/null @@ -1,73 +0,0 @@ -grammar = array(); - foreach (func_get_args() as $grammar) { - $this->addGrammar($grammar); - } - } - - public function __toString() - { - $repr = array(); - foreach ($this->grammar as $grammar) { - $repr[] = (string) $grammar; - } - - return sprintf('[%s]', implode(' ', $repr)); - } - - public function addGrammar(Twig_Extensions_GrammarInterface $grammar) - { - $this->grammar[] = $grammar; - } - - public function parse(Twig_Token $token) - { - // test if we have the optional element before consuming it - if ($this->grammar[0] instanceof Twig_Extensions_Grammar_Constant) { - if (!$this->parser->getStream()->test($this->grammar[0]->getType(), $this->grammar[0]->getName())) { - return array(); - } - } elseif ($this->grammar[0] instanceof Twig_Extensions_Grammar_Name) { - if (!$this->parser->getStream()->test(Twig_Token::NAME_TYPE)) { - return array(); - } - } elseif ($this->parser->getStream()->test(Twig_Token::BLOCK_END_TYPE)) { - // if this is not a Constant or a Name, it must be the last element of the tag - - return array(); - } - - $elements = array(); - foreach ($this->grammar as $grammar) { - $grammar->setParser($this->parser); - - $element = $grammar->parse($token); - if (is_array($element)) { - $elements = array_merge($elements, $element); - } else { - $elements[$grammar->getName()] = $element; - } - } - - return $elements; - } -} diff --git a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Switch.php b/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Switch.php deleted file mode 100644 index 407cc20..0000000 --- a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Switch.php +++ /dev/null @@ -1,28 +0,0 @@ -', $this->name); - } - - public function parse(Twig_Token $token) - { - $this->parser->getStream()->expect(Twig_Token::NAME_TYPE, $this->name); - - return new Twig_Node_Expression_Constant(true, $token->getLine()); - } -} diff --git a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Tag.php b/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Tag.php deleted file mode 100644 index 2506efa..0000000 --- a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/Grammar/Tag.php +++ /dev/null @@ -1,60 +0,0 @@ -grammar = array(); - foreach (func_get_args() as $grammar) { - $this->addGrammar($grammar); - } - } - - public function __toString() - { - $repr = array(); - foreach ($this->grammar as $grammar) { - $repr[] = (string) $grammar; - } - - return implode(' ', $repr); - } - - public function addGrammar(Twig_Extensions_GrammarInterface $grammar) - { - $this->grammar[] = $grammar; - } - - public function parse(Twig_Token $token) - { - $elements = array(); - foreach ($this->grammar as $grammar) { - $grammar->setParser($this->parser); - - $element = $grammar->parse($token); - if (is_array($element)) { - $elements = array_merge($elements, $element); - } else { - $elements[$grammar->getName()] = $element; - } - } - - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - return $elements; - } -} diff --git a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/GrammarInterface.php b/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/GrammarInterface.php deleted file mode 100644 index b4854da..0000000 --- a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/GrammarInterface.php +++ /dev/null @@ -1,22 +0,0 @@ - - */ -class Twig_Extensions_Node_Trans extends Twig_Node -{ - public function __construct(Twig_Node $body, Twig_Node $plural = null, Twig_Node_Expression $count = null, Twig_Node $notes = null, $lineno, $tag = null) - { - $nodes = array('body' => $body); - if (null !== $count) { - $nodes['count'] = $count; - } - if (null !== $plural) { - $nodes['plural'] = $plural; - } - if (null !== $notes) { - $nodes['notes'] = $notes; - } - - parent::__construct($nodes, array(), $lineno, $tag); - } - - /** - * {@inheritdoc} - */ - public function compile(Twig_Compiler $compiler) - { - $compiler->addDebugInfo($this); - - list($msg, $vars) = $this->compileString($this->getNode('body')); - - if ($this->hasNode('plural')) { - list($msg1, $vars1) = $this->compileString($this->getNode('plural')); - - $vars = array_merge($vars, $vars1); - } - - $function = $this->getTransFunction($this->hasNode('plural')); - - if ($this->hasNode('notes')) { - $message = trim($this->getNode('notes')->getAttribute('data')); - - // line breaks are not allowed cause we want a single line comment - $message = str_replace(array("\n", "\r"), ' ', $message); - $compiler->write("// notes: {$message}\n"); - } - - if ($vars) { - $compiler - ->write('echo strtr('.$function.'(') - ->subcompile($msg) - ; - - if ($this->hasNode('plural')) { - $compiler - ->raw(', ') - ->subcompile($msg1) - ->raw(', abs(') - ->subcompile($this->hasNode('count') ? $this->getNode('count') : null) - ->raw(')') - ; - } - - $compiler->raw('), array('); - - foreach ($vars as $var) { - if ('count' === $var->getAttribute('name')) { - $compiler - ->string('%count%') - ->raw(' => abs(') - ->subcompile($this->hasNode('count') ? $this->getNode('count') : null) - ->raw('), ') - ; - } else { - $compiler - ->string('%'.$var->getAttribute('name').'%') - ->raw(' => ') - ->subcompile($var) - ->raw(', ') - ; - } - } - - $compiler->raw("));\n"); - } else { - $compiler - ->write('echo '.$function.'(') - ->subcompile($msg) - ; - - if ($this->hasNode('plural')) { - $compiler - ->raw(', ') - ->subcompile($msg1) - ->raw(', abs(') - ->subcompile($this->hasNode('count') ? $this->getNode('count') : null) - ->raw(')') - ; - } - - $compiler->raw(");\n"); - } - } - - /** - * @param Twig_Node $body A Twig_Node instance - * - * @return array - */ - protected function compileString(Twig_Node $body) - { - if ($body instanceof Twig_Node_Expression_Name || $body instanceof Twig_Node_Expression_Constant || $body instanceof Twig_Node_Expression_TempName) { - return array($body, array()); - } - - $vars = array(); - if (count($body)) { - $msg = ''; - - foreach ($body as $node) { - if (get_class($node) === 'Twig_Node' && $node->getNode(0) instanceof Twig_Node_SetTemp) { - $node = $node->getNode(1); - } - - if ($node instanceof Twig_Node_Print) { - $n = $node->getNode('expr'); - while ($n instanceof Twig_Node_Expression_Filter) { - $n = $n->getNode('node'); - } - $msg .= sprintf('%%%s%%', $n->getAttribute('name')); - $vars[] = new Twig_Node_Expression_Name($n->getAttribute('name'), $n->getTemplateLine()); - } else { - $msg .= $node->getAttribute('data'); - } - } - } else { - $msg = $body->getAttribute('data'); - } - - return array(new Twig_Node(array(new Twig_Node_Expression_Constant(trim($msg), $body->getTemplateLine()))), $vars); - } - - /** - * @param bool $plural Return plural or singular function to use - * - * @return string - */ - protected function getTransFunction($plural) - { - return $plural ? 'ngettext' : 'gettext'; - } -} - -class_alias('Twig_Extensions_Node_Trans', 'Twig\Extensions\Node\TransNode', false); diff --git a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/SimpleTokenParser.php b/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/SimpleTokenParser.php deleted file mode 100644 index 76fa9d3..0000000 --- a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/SimpleTokenParser.php +++ /dev/null @@ -1,138 +0,0 @@ -getGrammar(); - if (!is_object($grammar)) { - $grammar = self::parseGrammar($grammar); - } - - $grammar->setParser($this->parser); - $values = $grammar->parse($token); - - return $this->getNode($values, $token->getLine()); - } - - /** - * Gets the grammar as an object or as a string. - * - * @return string|Twig_Extensions_Grammar A Twig_Extensions_Grammar instance or a string - */ - abstract protected function getGrammar(); - - /** - * Gets the nodes based on the parsed values. - * - * @param array $values An array of values - * @param int $line The parser line - */ - abstract protected function getNode(array $values, $line); - - protected function getAttribute($node, $attribute, $arguments = array(), $type = Twig_Node_Expression_GetAttr::TYPE_ANY, $line = -1) - { - return new Twig_Node_Expression_GetAttr( - $node instanceof Twig_Node ? $node : new Twig_Node_Expression_Name($node, $line), - $attribute instanceof Twig_Node ? $attribute : new Twig_Node_Expression_Constant($attribute, $line), - $arguments instanceof Twig_Node ? $arguments : new Twig_Node($arguments), - $type, - $line - ); - } - - protected function call($node, $attribute, $arguments = array(), $line = -1) - { - return $this->getAttribute($node, $attribute, $arguments, Twig_Node_Expression_GetAttr::TYPE_METHOD, $line); - } - - protected function markAsSafe(Twig_Node $node, $line = -1) - { - return new Twig_Node_Expression_Filter( - $node, - new Twig_Node_Expression_Constant('raw', $line), - new Twig_Node(), - $line - ); - } - - protected function output(Twig_Node $node, $line = -1) - { - return new Twig_Node_Print($node, $line); - } - - protected function getNodeValues(array $values) - { - $nodes = array(); - foreach ($values as $value) { - if ($value instanceof Twig_Node) { - $nodes[] = $value; - } - } - - return $nodes; - } - - public static function parseGrammar($str, $main = true) - { - static $cursor; - - if (true === $main) { - $cursor = 0; - $grammar = new Twig_Extensions_Grammar_Tag(); - } else { - $grammar = new Twig_Extensions_Grammar_Optional(); - } - - while ($cursor < strlen($str)) { - if (preg_match('/\s+/A', $str, $match, null, $cursor)) { - $cursor += strlen($match[0]); - } elseif (preg_match('/<(\w+)(?:\:(\w+))?>/A', $str, $match, null, $cursor)) { - $class = sprintf('Twig_Extensions_Grammar_%s', ucfirst(isset($match[2]) ? $match[2] : 'Expression')); - if (!class_exists($class)) { - throw new Twig_Error_Runtime(sprintf('Unable to understand "%s" in grammar (%s class does not exist)', $match[0], $class)); - } - $grammar->addGrammar(new $class($match[1])); - $cursor += strlen($match[0]); - } elseif (preg_match('/\w+/A', $str, $match, null, $cursor)) { - $grammar->addGrammar(new Twig_Extensions_Grammar_Constant($match[0])); - $cursor += strlen($match[0]); - } elseif (preg_match('/,/A', $str, $match, null, $cursor)) { - $grammar->addGrammar(new Twig_Extensions_Grammar_Constant($match[0], Twig_Token::PUNCTUATION_TYPE)); - $cursor += strlen($match[0]); - } elseif (preg_match('/\[/A', $str, $match, null, $cursor)) { - $cursor += strlen($match[0]); - $grammar->addGrammar(self::parseGrammar($str, false)); - } elseif (true !== $main && preg_match('/\]/A', $str, $match, null, $cursor)) { - $cursor += strlen($match[0]); - - return $grammar; - } else { - throw new Twig_Error_Runtime(sprintf('Unable to parse grammar "%s" near "...%s..."', $str, substr($str, $cursor, 10))); - } - } - - return $grammar; - } -} diff --git a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/TokenParser/Trans.php b/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/TokenParser/Trans.php deleted file mode 100644 index 4d4f600..0000000 --- a/srcs/phpmyadmin/vendor/twig/extensions/lib/Twig/Extensions/TokenParser/Trans.php +++ /dev/null @@ -1,88 +0,0 @@ -getLine(); - $stream = $this->parser->getStream(); - $count = null; - $plural = null; - $notes = null; - - if (!$stream->test(Twig_Token::BLOCK_END_TYPE)) { - $body = $this->parser->getExpressionParser()->parseExpression(); - } else { - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideForFork')); - $next = $stream->next()->getValue(); - - if ('plural' === $next) { - $count = $this->parser->getExpressionParser()->parseExpression(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $plural = $this->parser->subparse(array($this, 'decideForFork')); - - if ('notes' === $stream->next()->getValue()) { - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $notes = $this->parser->subparse(array($this, 'decideForEnd'), true); - } - } elseif ('notes' === $next) { - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $notes = $this->parser->subparse(array($this, 'decideForEnd'), true); - } - } - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - $this->checkTransString($body, $lineno); - - return new Twig_Extensions_Node_Trans($body, $plural, $count, $notes, $lineno, $this->getTag()); - } - - public function decideForFork(Twig_Token $token) - { - return $token->test(array('plural', 'notes', 'endtrans')); - } - - public function decideForEnd(Twig_Token $token) - { - return $token->test('endtrans'); - } - - /** - * {@inheritdoc} - */ - public function getTag() - { - return 'trans'; - } - - protected function checkTransString(Twig_Node $body, $lineno) - { - foreach ($body as $i => $node) { - if ( - $node instanceof Twig_Node_Text - || - ($node instanceof Twig_Node_Print && $node->getNode('expr') instanceof Twig_Node_Expression_Name) - ) { - continue; - } - - throw new Twig_Error_Syntax(sprintf('The text to be translated with "trans" can only contain references to simple variables'), $lineno); - } - } -} - -class_alias('Twig_Extensions_TokenParser_Trans', 'Twig\Extensions\TokenParser\TransTokenParser', false); -- cgit