init web ems all

This commit is contained in:
agtuser
2024-09-27 17:13:36 +08:00
parent 81c97acbe9
commit 5cc56f8078
4263 changed files with 798779 additions and 0 deletions

34
phpMyAdmin/vendor/twig/extensions/.travis.yml vendored Executable file
View File

@@ -0,0 +1,34 @@
language: php
sudo: false
cache:
directories:
- vendor
- $HOME/.composer/cache/files
env:
- DEPS=no
before_install:
- phpenv config-rm xdebug.ini
before_script:
- if [ "$DEPS" == "low" ]; then composer --prefer-lowest --prefer-stable update; fi;
- if [ "$DEPS" == "no" ]; then composer install; fi;
script: |
./vendor/bin/simple-phpunit
matrix:
include:
- php: 5.3
dist: precise
- php: 5.4
- php: 5.5
- php: 5.6
env: DEPS=low
- php: 7.0
- php: 7.1
- php: 7.2
fast_finish: true

19
phpMyAdmin/vendor/twig/extensions/LICENSE vendored Executable file
View File

@@ -0,0 +1,19 @@
Copyright (c) 2010-2017 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

14
phpMyAdmin/vendor/twig/extensions/README.rst vendored Executable file
View File

@@ -0,0 +1,14 @@
Twig Extensions Repository
==========================
This repository hosts Twig Extensions that do not belong to the core but can
be nonetheless interesting to share with other developers.
Fork this repository, add your extension, and request a pull.
More Information
----------------
Read the `documentation`_ for more information.
.. _documentation: http://twig-extensions.readthedocs.io/

View File

@@ -0,0 +1,32 @@
{
"name": "twig/extensions",
"description": "Common additional features for Twig that do not directly belong in core",
"keywords": ["i18n","text"],
"type": "library",
"license": "MIT",
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"require": {
"twig/twig": "^1.27|^2.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^3.4",
"symfony/translation": "^2.7|^3.4"
},
"suggest": {
"symfony/translation": "Allow the time_diff output to be translated"
},
"autoload": {
"psr-0": { "Twig_Extensions_": "lib/" },
"psr-4": { "Twig\\Extensions\\": "src/" }
},
"extra": {
"branch-alias": {
"dev-master": "1.5-dev"
}
}
}

View File

@@ -0,0 +1,48 @@
<?php
/*
* This file is part of Twig.
*
* (c) 2009 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@trigger_error('The "Twig_Extensions_Autoloader" class is deprecated since version 1.5. Use Composer instead.', E_USER_DEPRECATED);
/**
* Autoloads Twig Extensions classes.
*
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*
* @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;
}
}
}

View File

@@ -0,0 +1,56 @@
<?php
/**
* This file is part of Twig.
*
* (c) 2009 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* @author Ricard Clau <ricard.clau@gmail.com>
*/
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);

View File

@@ -0,0 +1,107 @@
<?php
/**
* This file is part of Twig.
*
* (c) 2014 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Translation\IdentityTranslator;
/**
* @author Robin van der Vleuten <robinvdvleuten@gmail.com>
*/
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);

View File

@@ -0,0 +1,41 @@
<?php
/*
* This file is part of Twig.
*
* (c) 2010 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class Twig_Extensions_Extension_I18n extends Twig_Extension
{
/**
* {@inheritdoc}
*/
public function getTokenParsers()
{
return array(new Twig_Extensions_TokenParser_Trans());
}
/**
* {@inheritdoc}
*/
public function getFilters()
{
return array(
new Twig_SimpleFilter('trans', 'gettext'),
);
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'i18n';
}
}
class_alias('Twig_Extensions_Extension_I18n', 'Twig\Extensions\I18nExtension', false);

View File

@@ -0,0 +1,146 @@
<?php
/*
* This file is part of Twig.
*
* (c) 2010 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class Twig_Extensions_Extension_Intl extends Twig_Extension
{
public function __construct()
{
if (!class_exists('IntlDateFormatter')) {
throw new RuntimeException('The native PHP intl extension (http://php.net/manual/en/book.intl.php) is needed to use intl-based filters.');
}
}
/**
* {@inheritdoc}
*/
public function getFilters()
{
return array(
new Twig_SimpleFilter('localizeddate', 'twig_localized_date_filter', array('needs_environment' => 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);

View File

@@ -0,0 +1,99 @@
<?php
/**
* This file is part of Twig.
*
* (c) 2009 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* @author Henrik Bjornskov <hb@peytz.dk>
*/
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);

View File

@@ -0,0 +1,43 @@
<?php
/*
* This file is part of Twig.
*
* (c) 2010 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* @deprecated since version 1.5
*/
abstract class Twig_Extensions_Grammar implements Twig_Extensions_GrammarInterface
{
protected $name;
protected $parser;
/**
* @param string $name
*/
public function __construct($name)
{
$this->name = $name;
}
/**
* @param Twig_Parser $parser
*/
public function setParser(Twig_Parser $parser)
{
$this->parser = $parser;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
}

View File

@@ -0,0 +1,26 @@
<?php
/*
* This file is part of Twig.
*
* (c) 2010 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* @deprecated since version 1.5
*/
class Twig_Extensions_Grammar_Arguments extends Twig_Extensions_Grammar
{
public function __toString()
{
return sprintf('<%s:arguments>', $this->name);
}
public function parse(Twig_Token $token)
{
return $this->parser->getExpressionParser()->parseArguments();
}
}

View File

@@ -0,0 +1,26 @@
<?php
/*
* This file is part of Twig.
*
* (c) 2010 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* @deprecated since version 1.5
*/
class Twig_Extensions_Grammar_Array extends Twig_Extensions_Grammar
{
public function __toString()
{
return sprintf('<%s:array>', $this->name);
}
public function parse(Twig_Token $token)
{
return $this->parser->getExpressionParser()->parseArrayExpression();
}
}

View File

@@ -0,0 +1,43 @@
<?php
/*
* This file is part of Twig.
*
* (c) 2010 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* @deprecated since version 1.5
*/
class Twig_Extensions_Grammar_Body extends Twig_Extensions_Grammar
{
protected $end;
public function __construct($name, $end = null)
{
parent::__construct($name);
$this->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);
}
}

View File

@@ -0,0 +1,28 @@
<?php
/*
* This file is part of Twig.
*
* (c) 2010 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* @deprecated since version 1.5
*/
class Twig_Extensions_Grammar_Boolean extends Twig_Extensions_Grammar
{
public function __toString()
{
return sprintf('<%s:boolean>', $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());
}
}

View File

@@ -0,0 +1,41 @@
<?php
/*
* This file is part of Twig.
*
* (c) 2010 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* @deprecated since version 1.5
*/
class Twig_Extensions_Grammar_Constant extends Twig_Extensions_Grammar
{
protected $type;
public function __construct($name, $type = null)
{
$this->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;
}
}

View File

@@ -0,0 +1,26 @@
<?php
/*
* This file is part of Twig.
*
* (c) 2010 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* @deprecated since version 1.5
*/
class Twig_Extensions_Grammar_Expression extends Twig_Extensions_Grammar
{
public function __toString()
{
return sprintf('<%s>', $this->name);
}
public function parse(Twig_Token $token)
{
return $this->parser->getExpressionParser()->parseExpression();
}
}

View File

@@ -0,0 +1,26 @@
<?php
/*
* This file is part of Twig.
*
* (c) 2010 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* @deprecated since version 1.5
*/
class Twig_Extensions_Grammar_Hash extends Twig_Extensions_Grammar
{
public function __toString()
{
return sprintf('<%s:hash>', $this->name);
}
public function parse(Twig_Token $token)
{
return $this->parser->getExpressionParser()->parseHashExpression();
}
}

View File

@@ -0,0 +1,28 @@
<?php
/*
* This file is part of Twig.
*
* (c) 2010 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* @deprecated since version 1.5
*/
class Twig_Extensions_Grammar_Number extends Twig_Extensions_Grammar
{
public function __toString()
{
return sprintf('<%s:number>', $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());
}
}

View File

@@ -0,0 +1,73 @@
<?php
/*
* This file is part of Twig.
*
* (c) 2010 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* @deprecated since version 1.5
*/
class Twig_Extensions_Grammar_Optional extends Twig_Extensions_Grammar
{
protected $grammar;
public function __construct()
{
$this->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;
}
}

View File

@@ -0,0 +1,28 @@
<?php
/*
* This file is part of Twig.
*
* (c) 2010 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* @deprecated since version 1.5
*/
class Twig_Extensions_Grammar_Switch extends Twig_Extensions_Grammar
{
public function __toString()
{
return sprintf('<%s:switch>', $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());
}
}

View File

@@ -0,0 +1,60 @@
<?php
/*
* This file is part of Twig.
*
* (c) 2010 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* @deprecated since version 1.5
*/
class Twig_Extensions_Grammar_Tag extends Twig_Extensions_Grammar
{
protected $grammar;
public function __construct()
{
$this->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;
}
}

View File

@@ -0,0 +1,22 @@
<?php
/*
* This file is part of Twig.
*
* (c) 2010 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* @deprecated since version 1.5
*/
interface Twig_Extensions_GrammarInterface
{
public function setParser(Twig_Parser $parser);
public function parse(Twig_Token $token);
public function getName();
}

View File

@@ -0,0 +1,166 @@
<?php
/*
* This file is part of Twig.
*
* (c) 2010 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Represents a trans node.
*
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
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);

View File

@@ -0,0 +1,138 @@
<?php
/*
* This file is part of Twig.
*
* (c) 2010 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@trigger_error('The grammar feature is deprecated since version 1.5 and will be removed in 2.0.', E_USER_DEPRECATED);
/**
* @deprecated since version 1.5
*/
abstract class Twig_Extensions_SimpleTokenParser extends Twig_TokenParser
{
/**
* Parses a token and returns a node.
*
* @param Twig_Token $token A Twig_Token instance
*
* @return Twig_Node A Twig_Node instance
*/
public function parse(Twig_Token $token)
{
$grammar = $this->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;
}
}

View File

@@ -0,0 +1,88 @@
<?php
/*
* This file is part of Twig.
*
* (c) 2010 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class Twig_Extensions_TokenParser_Trans extends Twig_TokenParser
{
/**
* {@inheritdoc}
*/
public function parse(Twig_Token $token)
{
$lineno = $token->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);

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="vendor/autoload.php"
>
<testsuites>
<testsuite name="Twig Extensions Test Suite">
<directory>./test/Twig/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./lib/Twig/</directory>
</whitelist>
</filter>
</phpunit>

View File

@@ -0,0 +1,11 @@
<?php
namespace Twig\Extensions;
class_exists('Twig_Extensions_Extension_Array');
if (\false) {
class ArrayExtension extends \Twig_Extensions_Extension_Array
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
namespace Twig\Extensions;
class_exists('Twig_Extensions_Extension_Date');
if (\false) {
class DateExtension extends \Twig_Extensions_Extension_Date
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
namespace Twig\Extensions;
class_exists('Twig_Extensions_Extension_I18n');
if (\false) {
class I18nExtension extends \Twig_Extensions_Extension_I18n
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
namespace Twig\Extensions;
class_exists('Twig_Extensions_Extension_Intl');
if (\false) {
class IntlExtension extends \Twig_Extensions_Extension_Intl
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
namespace Twig\Extensions\Node;
class_exists('Twig_Extensions_Node_Trans');
if (\false) {
class TransNode extends \Twig_Extensions_Node_Trans
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
namespace Twig\Extensions;
class_exists('Twig_Extensions_Extension_Text');
if (\false) {
class TextExtension extends \Twig_Extensions_Extension_Text
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
namespace Twig\Extensions\TokenParser;
class_exists('Twig_Extensions_TokenParser_Trans');
if (\false) {
class TransTokenParser extends \Twig_Extensions_TokenParser_Trans
{
}
}

18
phpMyAdmin/vendor/twig/twig/.editorconfig vendored Executable file
View File

@@ -0,0 +1,18 @@
; top-most EditorConfig file
root = true
; Unix-style newlines
[*]
end_of_line = LF
[*.php]
indent_style = space
indent_size = 4
[*.test]
indent_style = space
indent_size = 4
[*.rst]
indent_style = space
indent_size = 4

20
phpMyAdmin/vendor/twig/twig/.php_cs.dist vendored Executable file
View File

@@ -0,0 +1,20 @@
<?php
return PhpCsFixer\Config::create()
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'@PHPUnit75Migration:risky' => true,
'php_unit_dedicate_assert' => ['target' => '5.6'],
'array_syntax' => ['syntax' => 'short'],
'php_unit_fqcn_annotation' => true,
'no_unreachable_default_argument_value' => false,
'braces' => ['allow_single_line_closure' => true],
'heredoc_to_nowdoc' => false,
'ordered_imports' => true,
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'all'],
])
->setRiskyAllowed(true)
->setFinder(PhpCsFixer\Finder::create()->in(__DIR__))
;

46
phpMyAdmin/vendor/twig/twig/.travis.yml vendored Executable file
View File

@@ -0,0 +1,46 @@
language: php
dist: trusty
sudo: false
cache:
directories:
- vendor
- $HOME/.composer/cache/files
env:
global:
- TWIG_EXT=no
- SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1
before_install:
- phpenv config-rm xdebug.ini || return 0
install:
- travis_retry composer install
before_script:
- if [ "$TWIG_EXT" == "yes" ]; then sh -c "cd ext/twig && phpize && ./configure --enable-twig && make && make install"; fi
- if [ "$TWIG_EXT" == "yes" ]; then echo "extension=twig.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`; fi
script: ./vendor/bin/simple-phpunit
jobs:
fast_finish: true
include:
- php: 5.5
- php: 5.5
env: TWIG_EXT=yes
- php: 5.6
- php: 5.6
env: TWIG_EXT=yes
- php: 7.0
- php: 7.1
- php: 7.2
- php: 7.3
- php: 7.4snapshot
- stage: integration tests
php: 7.3
script: ./drupal_test.sh

1138
phpMyAdmin/vendor/twig/twig/CHANGELOG vendored Executable file

File diff suppressed because it is too large Load Diff

29
phpMyAdmin/vendor/twig/twig/LICENSE vendored Executable file
View File

@@ -0,0 +1,29 @@
Copyright (c) 2009-2020 by the Twig Team.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* The names of the contributors may not be used to endorse or
promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

24
phpMyAdmin/vendor/twig/twig/README.rst vendored Executable file
View File

@@ -0,0 +1,24 @@
Twig, the flexible, fast, and secure template language for PHP
==============================================================
Twig is a template language for PHP, released under the new BSD license (code
and documentation).
Twig uses a syntax similar to the Django and Jinja template languages which
inspired the Twig runtime environment.
Sponsors
--------
.. raw:: html
<a href="https://blackfire.io/docs/introduction?utm_source=twig&utm_medium=github_readme&utm_campaign=logo">
<img src="https://static.blackfire.io/assets/intemporals/logo/png/blackfire-io_secondary_horizontal_transparent.png?1" width="255px" alt="Blackfire.io">
</a>
More Information
----------------
Read the `documentation`_ for more information.
.. _documentation: https://twig.symfony.com/documentation

51
phpMyAdmin/vendor/twig/twig/composer.json vendored Executable file
View File

@@ -0,0 +1,51 @@
{
"name": "twig/twig",
"type": "library",
"description": "Twig, the flexible, fast, and secure template language for PHP",
"keywords": ["templating"],
"homepage": "https://twig.symfony.com",
"license": "BSD-3-Clause",
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com",
"homepage": "http://fabien.potencier.org",
"role": "Lead Developer"
},
{
"name": "Twig Team",
"role": "Contributors"
},
{
"name": "Armin Ronacher",
"email": "armin.ronacher@active-4.com",
"role": "Project Founder"
}
],
"require": {
"php": ">=5.5.0",
"symfony/polyfill-ctype": "^1.8"
},
"require-dev": {
"symfony/phpunit-bridge": "^4.4|^5.0",
"psr/container": "^1.0"
},
"autoload": {
"psr-0" : {
"Twig_" : "lib/"
},
"psr-4" : {
"Twig\\" : "src/"
}
},
"autoload-dev": {
"psr-4" : {
"Twig\\Tests\\" : "tests"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.42-dev"
}
}
}

50
phpMyAdmin/vendor/twig/twig/drupal_test.sh vendored Executable file
View File

@@ -0,0 +1,50 @@
#!/bin/bash
set -x
set -e
REPO=`pwd`
cd /tmp
rm -rf drupal-twig-test
composer create-project --no-interaction drupal-composer/drupal-project:8.x-dev drupal-twig-test
cd drupal-twig-test
(cd vendor/twig && rm -rf twig && ln -sf $REPO twig)
echo '$config["system.logging"]["error_level"] = "verbose";' >> web/sites/default/settings.php
php ./web/core/scripts/drupal install --no-interaction demo_umami > output
perl -p -i -e 's/^([A-Za-z]+)\: (.+)$/export DRUPAL_\1=\2/' output
source output
wget https://get.symfony.com/cli/installer -O - | bash
export PATH="$HOME/.symfony/bin:$PATH"
symfony server:start -d --no-tls
curl -OLsS https://get.blackfire.io/blackfire-player.phar
chmod +x blackfire-player.phar
cat > drupal-tests.bkf <<EOF
name "Drupal tests"
scenario
name "homepage"
set name "admin"
set pass "pass"
visit url('/')
expect status_code() == 200
click link('Articles')
expect status_code() == 200
click link('Dairy-free and delicious milk chocolate')
expect body() matches "/Dairy\-free milk chocolate is made in largely the same way as regular chocolate/"
expect status_code() == 200
click link('Log in')
expect status_code() == 200
submit button("Log in")
param name name
param pass pass
expect status_code() == 303
follow
expect status_code() == 200
click link('Structure')
expect status_code() == 200
EOF
./blackfire-player.phar run drupal-tests.bkf --endpoint=`symfony var:export SYMFONY_DEFAULT_ROUTE_URL` --variable name=$DRUPAL_Username --variable pass=$DRUPAL_Password
symfony server:stop

View File

@@ -0,0 +1,8 @@
dnl config.m4 for extension twig
PHP_ARG_ENABLE(twig, whether to enable twig support,
[ --enable-twig Enable twig support])
if test "$PHP_TWIG" != "no"; then
PHP_NEW_EXTENSION(twig, twig.c, $ext_shared)
fi

View File

@@ -0,0 +1,8 @@
// vim:ft=javascript
ARG_ENABLE("twig", "Twig support", "no");
if (PHP_TWIG != "no") {
AC_DEFINE('HAVE_TWIG', 1);
EXTENSION('twig', 'twig.c');
}

View File

@@ -0,0 +1,35 @@
/*
+----------------------------------------------------------------------+
| Twig Extension |
+----------------------------------------------------------------------+
| Copyright (c) 2011 Derick Rethans |
+----------------------------------------------------------------------+
| Redistribution and use in source and binary forms, with or without |
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met (BSD-3-Clause). |
+----------------------------------------------------------------------+
| Author: Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
*/
#ifndef PHP_TWIG_H
#define PHP_TWIG_H
#define PHP_TWIG_VERSION "1.42.5-DEV"
#include "php.h"
extern zend_module_entry twig_module_entry;
#define phpext_twig_ptr &twig_module_entry
#ifndef PHP_WIN32
zend_module_entry *get_module(void);
#endif
#ifdef ZTS
#include "TSRM.h"
#endif
PHP_FUNCTION(twig_template_get_attributes);
PHP_RSHUTDOWN_FUNCTION(twig);
#endif

1217
phpMyAdmin/vendor/twig/twig/ext/twig/twig.c vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,52 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@trigger_error('The Twig_Autoloader class is deprecated since version 1.21 and will be removed in 2.0. Use Composer instead.', E_USER_DEPRECATED);
/**
* Autoloads Twig classes.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since 1.21 and will be removed in 2.0. Use Composer instead. 2.0.
*/
class Twig_Autoloader
{
/**
* Registers Twig_Autoloader as an SPL autoloader.
*
* @param bool $prepend whether to prepend the autoloader or not
*/
public static function register($prepend = false)
{
@trigger_error('Using Twig_Autoloader is deprecated since version 1.21. Use Composer instead.', E_USER_DEPRECATED);
spl_autoload_register([__CLASS__, 'autoload'], true, $prepend);
}
/**
* Handles autoloading of classes.
*
* @param string $class a class name
*/
public static function autoload($class)
{
if (0 !== strpos($class, 'Twig')) {
return;
}
if (is_file($file = __DIR__.'/../'.str_replace(['_', "\0"], ['/', ''], $class).'.php')) {
require $file;
} elseif (is_file($file = __DIR__.'/../../src/'.str_replace(['Twig\\', '\\', "\0"], ['', '/', ''], $class).'.php')) {
require $file;
}
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\NodeVisitor\AbstractNodeVisitor;
class_exists('Twig\NodeVisitor\AbstractNodeVisitor');
if (\false) {
class Twig_BaseNodeVisitor extends AbstractNodeVisitor
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Cache\FilesystemCache;
class_exists('Twig\Cache\FilesystemCache');
if (\false) {
class Twig_Cache_Filesystem extends FilesystemCache
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Cache\NullCache;
class_exists('Twig\Cache\NullCache');
if (\false) {
class Twig_Cache_Null extends NullCache
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Cache\CacheInterface;
class_exists('Twig\Cache\CacheInterface');
if (\false) {
class Twig_CacheInterface extends CacheInterface
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Compiler;
class_exists('Twig\Compiler');
if (\false) {
class Twig_Compiler extends Compiler
{
}
}

View File

@@ -0,0 +1,34 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Interface implemented by compiler classes.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since 1.12 (to be removed in 3.0)
*/
interface Twig_CompilerInterface
{
/**
* Compiles a node.
*
* @return $this
*/
public function compile(Twig_NodeInterface $node);
/**
* Gets the current PHP code after compilation.
*
* @return string The PHP code
*/
public function getSource();
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\RuntimeLoader\ContainerRuntimeLoader;
class_exists('Twig\RuntimeLoader\ContainerRuntimeLoader');
if (\false) {
class Twig_ContainerRuntimeLoader extends ContainerRuntimeLoader
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Environment;
class_exists('Twig\Environment');
if (\false) {
class Twig_Environment extends Environment
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Error\Error;
class_exists('Twig\Error\Error');
if (\false) {
class Twig_Error extends Error
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Error\LoaderError;
class_exists('Twig\Error\LoaderError');
if (\false) {
class Twig_Error_Loader extends LoaderError
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Error\RuntimeError;
class_exists('Twig\Error\RuntimeError');
if (\false) {
class Twig_Error_Runtime extends RuntimeError
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Error\SyntaxError;
class_exists('Twig\Error\SyntaxError');
if (\false) {
class Twig_Error_Syntax extends SyntaxError
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Loader\ExistsLoaderInterface;
class_exists('Twig\Loader\ExistsLoaderInterface');
if (\false) {
class Twig_ExistsLoaderInterface extends ExistsLoaderInterface
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\ExpressionParser;
class_exists('Twig\ExpressionParser');
if (\false) {
class Twig_ExpressionParser extends ExpressionParser
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Extension\AbstractExtension;
class_exists('Twig\Extension\AbstractExtension');
if (\false) {
class Twig_Extension extends AbstractExtension
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Extension\CoreExtension;
class_exists('Twig\Extension\CoreExtension');
if (\false) {
class Twig_Extension_Core extends CoreExtension
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Extension\DebugExtension;
class_exists('Twig\Extension\DebugExtension');
if (\false) {
class Twig_Extension_Debug extends DebugExtension
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Extension\EscaperExtension;
class_exists('Twig\Extension\EscaperExtension');
if (\false) {
class Twig_Extension_Escaper extends EscaperExtension
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Extension\GlobalsInterface;
class_exists('Twig\Extension\GlobalsInterface');
if (\false) {
class Twig_Extension_GlobalsInterface extends GlobalsInterface
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Extension\InitRuntimeInterface;
class_exists('Twig\Extension\InitRuntimeInterface');
if (\false) {
class Twig_Extension_InitRuntimeInterface extends InitRuntimeInterface
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Extension\OptimizerExtension;
class_exists('Twig\Extension\OptimizerExtension');
if (\false) {
class Twig_Extension_Optimizer extends OptimizerExtension
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Extension\ProfilerExtension;
class_exists('Twig\Extension\ProfilerExtension');
if (\false) {
class Twig_Extension_Profiler extends ProfilerExtension
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Extension\SandboxExtension;
class_exists('Twig\Extension\SandboxExtension');
if (\false) {
class Twig_Extension_Sandbox extends SandboxExtension
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Extension\StagingExtension;
class_exists('Twig\Extension\StagingExtension');
if (\false) {
class Twig_Extension_Staging extends StagingExtension
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Extension\StringLoaderExtension;
class_exists('Twig\Extension\StringLoaderExtension');
if (\false) {
class Twig_Extension_StringLoader extends StringLoaderExtension
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Extension\ExtensionInterface;
class_exists('Twig\Extension\ExtensionInterface');
if (\false) {
class Twig_ExtensionInterface extends ExtensionInterface
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\RuntimeLoader\FactoryRuntimeLoader;
class_exists('Twig\RuntimeLoader\FactoryRuntimeLoader');
if (\false) {
class Twig_FactoryRuntimeLoader extends FactoryRuntimeLoader
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\FileExtensionEscapingStrategy;
class_exists('Twig\FileExtensionEscapingStrategy');
if (\false) {
class Twig_FileExtensionEscapingStrategy extends FileExtensionEscapingStrategy
{
}
}

View File

@@ -0,0 +1,86 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Twig\Node\Node;
@trigger_error('The Twig_Filter class is deprecated since version 1.12 and will be removed in 2.0. Use \Twig\TwigFilter instead.', E_USER_DEPRECATED);
/**
* Represents a template filter.
*
* Use \Twig\TwigFilter instead.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since 1.12 (to be removed in 2.0)
*/
abstract class Twig_Filter implements Twig_FilterInterface, Twig_FilterCallableInterface
{
protected $options;
protected $arguments = [];
public function __construct(array $options = [])
{
$this->options = array_merge([
'needs_environment' => false,
'needs_context' => false,
'pre_escape' => null,
'preserves_safety' => null,
'callable' => null,
], $options);
}
public function setArguments($arguments)
{
$this->arguments = $arguments;
}
public function getArguments()
{
return $this->arguments;
}
public function needsEnvironment()
{
return $this->options['needs_environment'];
}
public function needsContext()
{
return $this->options['needs_context'];
}
public function getSafe(Node $filterArgs)
{
if (isset($this->options['is_safe'])) {
return $this->options['is_safe'];
}
if (isset($this->options['is_safe_callback'])) {
return \call_user_func($this->options['is_safe_callback'], $filterArgs);
}
}
public function getPreservesSafety()
{
return $this->options['preserves_safety'];
}
public function getPreEscape()
{
return $this->options['pre_escape'];
}
public function getCallable()
{
return $this->options['callable'];
}
}

View File

@@ -0,0 +1,40 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@trigger_error('The Twig_Filter_Function class is deprecated since version 1.12 and will be removed in 2.0. Use \Twig\TwigFilter instead.', E_USER_DEPRECATED);
/**
* Represents a function template filter.
*
* Use \Twig\TwigFilter instead.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since 1.12 (to be removed in 2.0)
*/
class Twig_Filter_Function extends Twig_Filter
{
protected $function;
public function __construct($function, array $options = [])
{
$options['callable'] = $function;
parent::__construct($options);
$this->function = $function;
}
public function compile()
{
return $this->function;
}
}

View File

@@ -0,0 +1,44 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Twig\Extension\ExtensionInterface;
@trigger_error('The Twig_Filter_Method class is deprecated since version 1.12 and will be removed in 2.0. Use \Twig\TwigFilter instead.', E_USER_DEPRECATED);
/**
* Represents a method template filter.
*
* Use \Twig\TwigFilter instead.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since 1.12 (to be removed in 2.0)
*/
class Twig_Filter_Method extends Twig_Filter
{
protected $extension;
protected $method;
public function __construct(ExtensionInterface $extension, $method, array $options = [])
{
$options['callable'] = [$extension, $method];
parent::__construct($options);
$this->extension = $extension;
$this->method = $method;
}
public function compile()
{
return sprintf('$this->env->getExtension(\'%s\')->%s', \get_class($this->extension), $this->method);
}
}

View File

@@ -0,0 +1,42 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@trigger_error('The Twig_Filter_Node class is deprecated since version 1.12 and will be removed in 2.0. Use \Twig\TwigFilter instead.', E_USER_DEPRECATED);
/**
* Represents a template filter as a node.
*
* Use \Twig\TwigFilter instead.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since 1.12 (to be removed in 2.0)
*/
class Twig_Filter_Node extends Twig_Filter
{
protected $class;
public function __construct($class, array $options = [])
{
parent::__construct($options);
$this->class = $class;
}
public function getClass()
{
return $this->class;
}
public function compile()
{
}
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Represents a callable template filter.
*
* Use \Twig\TwigFilter instead.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since 1.12 (to be removed in 2.0)
*/
interface Twig_FilterCallableInterface
{
public function getCallable();
}

View File

@@ -0,0 +1,45 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Twig\Node\Node;
/**
* Represents a template filter.
*
* Use \Twig\TwigFilter instead.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since 1.12 (to be removed in 2.0)
*/
interface Twig_FilterInterface
{
/**
* Compiles a filter.
*
* @return string The PHP code for the filter
*/
public function compile();
public function needsEnvironment();
public function needsContext();
public function getSafe(Node $filterArgs);
public function getPreservesSafety();
public function getPreEscape();
public function setArguments($arguments);
public function getArguments();
}

View File

@@ -0,0 +1,76 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Twig\Node\Node;
@trigger_error('The Twig_Function class is deprecated since version 1.12 and will be removed in 2.0. Use \Twig\TwigFunction instead.', E_USER_DEPRECATED);
/**
* Represents a template function.
*
* Use \Twig\TwigFunction instead.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since 1.12 (to be removed in 2.0)
*/
abstract class Twig_Function implements Twig_FunctionInterface, Twig_FunctionCallableInterface
{
protected $options;
protected $arguments = [];
public function __construct(array $options = [])
{
$this->options = array_merge([
'needs_environment' => false,
'needs_context' => false,
'callable' => null,
], $options);
}
public function setArguments($arguments)
{
$this->arguments = $arguments;
}
public function getArguments()
{
return $this->arguments;
}
public function needsEnvironment()
{
return $this->options['needs_environment'];
}
public function needsContext()
{
return $this->options['needs_context'];
}
public function getSafe(Node $functionArgs)
{
if (isset($this->options['is_safe'])) {
return $this->options['is_safe'];
}
if (isset($this->options['is_safe_callback'])) {
return \call_user_func($this->options['is_safe_callback'], $functionArgs);
}
return [];
}
public function getCallable()
{
return $this->options['callable'];
}
}

View File

@@ -0,0 +1,41 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
* (c) Arnaud Le Blanc
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@trigger_error('The Twig_Function_Function class is deprecated since version 1.12 and will be removed in 2.0. Use \Twig\TwigFunction instead.', E_USER_DEPRECATED);
/**
* Represents a function template function.
*
* Use \Twig\TwigFunction instead.
*
* @author Arnaud Le Blanc <arnaud.lb@gmail.com>
*
* @deprecated since 1.12 (to be removed in 2.0)
*/
class Twig_Function_Function extends Twig_Function
{
protected $function;
public function __construct($function, array $options = [])
{
$options['callable'] = $function;
parent::__construct($options);
$this->function = $function;
}
public function compile()
{
return $this->function;
}
}

View File

@@ -0,0 +1,45 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
* (c) Arnaud Le Blanc
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Twig\Extension\ExtensionInterface;
@trigger_error('The Twig_Function_Method class is deprecated since version 1.12 and will be removed in 2.0. Use \Twig\TwigFunction instead.', E_USER_DEPRECATED);
/**
* Represents a method template function.
*
* Use \Twig\TwigFunction instead.
*
* @author Arnaud Le Blanc <arnaud.lb@gmail.com>
*
* @deprecated since 1.12 (to be removed in 2.0)
*/
class Twig_Function_Method extends Twig_Function
{
protected $extension;
protected $method;
public function __construct(ExtensionInterface $extension, $method, array $options = [])
{
$options['callable'] = [$extension, $method];
parent::__construct($options);
$this->extension = $extension;
$this->method = $method;
}
public function compile()
{
return sprintf('$this->env->getExtension(\'%s\')->%s', \get_class($this->extension), $this->method);
}
}

View File

@@ -0,0 +1,42 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@trigger_error('The Twig_Function_Node class is deprecated since version 1.12 and will be removed in 2.0. Use \Twig\TwigFunction instead.', E_USER_DEPRECATED);
/**
* Represents a template function as a node.
*
* Use \Twig\TwigFunction instead.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since 1.12 (to be removed in 2.0)
*/
class Twig_Function_Node extends Twig_Function
{
protected $class;
public function __construct($class, array $options = [])
{
parent::__construct($options);
$this->class = $class;
}
public function getClass()
{
return $this->class;
}
public function compile()
{
}
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Represents a callable template function.
*
* Use \Twig\TwigFunction instead.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since 1.12 (to be removed in 2.0)
*/
interface Twig_FunctionCallableInterface
{
public function getCallable();
}

View File

@@ -0,0 +1,42 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
* (c) Arnaud Le Blanc
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Twig\Node\Node;
/**
* Represents a template function.
*
* Use \Twig\TwigFunction instead.
*
* @author Arnaud Le Blanc <arnaud.lb@gmail.com>
*
* @deprecated since 1.12 (to be removed in 2.0)
*/
interface Twig_FunctionInterface
{
/**
* Compiles a function.
*
* @return string The PHP code for the function
*/
public function compile();
public function needsEnvironment();
public function needsContext();
public function getSafe(Node $filterArgs);
public function setArguments($arguments);
public function getArguments();
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Lexer;
class_exists('Twig\Lexer');
if (\false) {
class Twig_Lexer extends Lexer
{
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Twig\Error\SyntaxError;
use Twig\Source;
use Twig\TokenStream;
/**
* Interface implemented by lexer classes.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since 1.12 (to be removed in 3.0)
*/
interface Twig_LexerInterface
{
/**
* Tokenizes a source code.
*
* @param string|Source $code The source code
* @param string $name A unique identifier for the source code
*
* @return TokenStream
*
* @throws SyntaxError When the code is syntactically wrong
*/
public function tokenize($code, $name = null);
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Loader\ArrayLoader;
class_exists('Twig\Loader\ArrayLoader');
if (\false) {
class Twig_Loader_Array extends ArrayLoader
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Loader\ChainLoader;
class_exists('Twig\Loader\ChainLoader');
if (\false) {
class Twig_Loader_Chain extends ChainLoader
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Loader\FilesystemLoader;
class_exists('Twig\Loader\FilesystemLoader');
if (\false) {
class Twig_Loader_Filesystem extends FilesystemLoader
{
}
}

View File

@@ -0,0 +1,63 @@
<?php
/*
* This file is part of Twig.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Twig\Loader\ExistsLoaderInterface;
use Twig\Loader\LoaderInterface;
use Twig\Loader\SourceContextLoaderInterface;
use Twig\Source;
@trigger_error('The Twig_Loader_String class is deprecated since version 1.18.1 and will be removed in 2.0. Use "Twig\Loader\ArrayLoader" instead or "Twig\Environment::createTemplate()".', E_USER_DEPRECATED);
/**
* Loads a template from a string.
*
* This loader should NEVER be used. It only exists for Twig internal purposes.
*
* When using this loader with a cache mechanism, you should know that a new cache
* key is generated each time a template content "changes" (the cache key being the
* source code of the template). If you don't want to see your cache grows out of
* control, you need to take care of clearing the old cache file by yourself.
*
* @deprecated since 1.18.1 (to be removed in 2.0)
*
* @internal
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class Twig_Loader_String implements LoaderInterface, ExistsLoaderInterface, SourceContextLoaderInterface
{
public function getSource($name)
{
@trigger_error(sprintf('Calling "getSource" on "%s" is deprecated since 1.27. Use getSourceContext() instead.', \get_class($this)), E_USER_DEPRECATED);
return $name;
}
public function getSourceContext($name)
{
return new Source($name, $name);
}
public function exists($name)
{
return true;
}
public function getCacheKey($name)
{
return $name;
}
public function isFresh($name, $time)
{
return true;
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Loader\LoaderInterface;
class_exists('Twig\Loader\LoaderInterface');
if (\false) {
class Twig_LoaderInterface extends LoaderInterface
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Markup;
class_exists('Twig\Markup');
if (\false) {
class Twig_Markup extends Markup
{
}
}

11
phpMyAdmin/vendor/twig/twig/lib/Twig/Node.php vendored Executable file
View File

@@ -0,0 +1,11 @@
<?php
use Twig\Node\Node;
class_exists('Twig\Node\Node');
if (\false) {
class Twig_Node extends Node
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Node\AutoEscapeNode;
class_exists('Twig\Node\AutoEscapeNode');
if (\false) {
class Twig_Node_AutoEscape extends AutoEscapeNode
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Node\BlockNode;
class_exists('Twig\Node\BlockNode');
if (\false) {
class Twig_Node_Block extends BlockNode
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Node\BlockReferenceNode;
class_exists('Twig\Node\BlockReferenceNode');
if (\false) {
class Twig_Node_BlockReference extends BlockReferenceNode
{
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Twig\Node\BodyNode;
class_exists('Twig\Node\BodyNode');
if (\false) {
class Twig_Node_Body extends BodyNode
{
}
}

Some files were not shown because too many files have changed in this diff Show More