diff --git a/.gitignore b/.gitignore index da9562f3..252fcdec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,3 @@ -# netbeans project files -nbproject - # apigen docs dir /docs @@ -13,9 +10,6 @@ composer.phar # composer lock files composer.lock -# mac DS_Store files -.DS_Store - # cache folders cache/data/ cache/page/ @@ -25,4 +19,8 @@ cache/twig/ /apps # Tests -/src/Tests \ No newline at end of file +/src/Tests + +# twig test and doc folders +plugins/twig/vendor/twig/twig/doc/ +plugins/twig/vendor/twig/twig/test/ diff --git a/README.md b/README.md index 7dd9699a..4aa72b63 100644 --- a/README.md +++ b/README.md @@ -42,4 +42,4 @@ Weitere Informationen findest du unter [www.getherbie.org](http://www.getherbie. [packagist]: https://packagist.org [symfony]: http://symfony.com/doc/current/components/ [phpunit]: http://phpunit.de -[imagine]: https://github.com/avalanche123/Imagine \ No newline at end of file +[imagine]: https://github.com/avalanche123/Imagine diff --git a/log/.gitignore b/log/.gitignore index 86d0cb27..5e7d2734 100644 --- a/log/.gitignore +++ b/log/.gitignore @@ -1,4 +1,4 @@ # Ignore everything in this directory * # Except this file -!.gitignore \ No newline at end of file +!.gitignore diff --git a/plugins/markdown/composer.json b/plugins/markdown/composer.json index bdacc0cd..89894905 100644 --- a/plugins/markdown/composer.json +++ b/plugins/markdown/composer.json @@ -5,4 +5,4 @@ "keywords": ["herbie", "plugin", "markdown"], "type": "herbie-plugin", "license": "BSD-3-Clause" -} \ No newline at end of file +} diff --git a/plugins/markdown/markdown.php b/plugins/markdown/markdown.php index a09c5480..0f535bf8 100644 --- a/plugins/markdown/markdown.php +++ b/plugins/markdown/markdown.php @@ -12,7 +12,7 @@ public static function install() // add twig function / filter if ((bool)$config->get('plugins.config.markdown.twig', false)) { - Hook::attach('twigInitialized', function($twig) { + Hook::attach('twigInitialized', function(\Twig_Environment $twig) { $options = ['is_safe' => ['html']]; $twig->addFunction( new \Twig_SimpleFunction('markdown', ['MarkdownPlugin', 'parseMarkdown'], $options) @@ -25,9 +25,6 @@ public static function install() // add shortcode if ((bool)$config->get('plugins.config.markdown.shortcode', true)) { - #Hook::attach('shortcodeInitialized', function($shortcode) { - # $shortcode->add('markdown', ['MarkdownPlugin', 'markdownShortcode']); - #}); Hook::attach('shortcodeInitialized', ['MarkdownPlugin', 'addShortcode']); } @@ -40,7 +37,7 @@ public static function install() }); } - public static function addShortcode($shortcode) + public static function addShortcode(\herbie\sysplugin\shortcode\classes\Shortcode $shortcode) { $shortcode->add('markdown', ['MarkdownPlugin', 'markdownShortcode']); } diff --git a/plugins/shortcode/shortcode.php b/plugins/shortcode/shortcode.php index 010fed9a..94389c57 100644 --- a/plugins/shortcode/shortcode.php +++ b/plugins/shortcode/shortcode.php @@ -164,12 +164,12 @@ protected function addListingTag() $collection = $collection->sort($field, $direction); } - if (true == (int)$options['shuffle']) { + if (1 == (int)$options['shuffle']) { $collection = $collection->shuffle(); } // filter pages with empty title - $collection = $collection->filter(function ($page) { + $collection = $collection->filter(function (\Herbie\Page $page) { return !empty($page->title); }); @@ -360,11 +360,6 @@ protected function addFileTag() $attributes = $this->extractValuesFromArray(['title', 'text', 'alt', 'class'], $options); $attributes['alt'] = isset($attributes['alt']) ? $attributes['alt'] : ''; - // Interne Ressource - if (strpos($options['path'], 'http') !== 0) { - #$options['path'] = $this->config->get('web.url') . '/' . $options['src']; - } - $info = ''; if (!empty($options['info'])) { $info = $this->getFileInfo($options['path']); @@ -387,13 +382,13 @@ protected function getFileInfo($path) return ''; } $replace = [ - '{size}' => $this->human_filesize(filesize($path)), + '{size}' => $this->humanFilesize(filesize($path)), '{extension}' => strtoupper(pathinfo($path, PATHINFO_EXTENSION)) ]; return strtr(' ({extension}, {size})', $replace); } - protected function human_filesize($bytes, $decimals = 0) + protected function humanFilesize($bytes, $decimals = 0) { $sz = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB']; $factor = floor((strlen($bytes) - 1) / 3); diff --git a/plugins/textile/composer.json b/plugins/textile/composer.json index 2e19afd6..5be35f86 100644 --- a/plugins/textile/composer.json +++ b/plugins/textile/composer.json @@ -5,4 +5,4 @@ "keywords": ["herbie", "plugin", "textile"], "type": "herbie-plugin", "license": "BSD-3-Clause" -} \ No newline at end of file +} diff --git a/plugins/textile/textile.php b/plugins/textile/textile.php index 3c937573..5d5967e1 100644 --- a/plugins/textile/textile.php +++ b/plugins/textile/textile.php @@ -20,7 +20,7 @@ public function install() Hook::attach('renderContent', [$this, 'renderContent']); } - public function addTwigFunctionAndFilter($twig) + public function addTwigFunctionAndFilter(\Twig_Environment $twig) { $options = ['is_safe' => ['html']]; $twig->addFunction( @@ -31,17 +31,17 @@ public function addTwigFunctionAndFilter($twig) ); } - public function addSortcode($shortcode) + public function addSortcode(herbie\sysplugin\shortcode\classes\Shortcode $shortcode) { $shortcode->add('textile', [$this, 'textileShortcode']); } - public function renderContent($segment, array $attributes) + public function renderContent( $segment, array $attributes) { if(!in_array($attributes['format'], ['textile'])) { return $segment; } - return $this->parseTextile($segment->string); + return $this->parseTextile($segment); } public function parseTextile($value) diff --git a/plugins/twig/classes/HerbieExtension.php b/plugins/twig/classes/HerbieExtension.php index dba1a555..9543936c 100644 --- a/plugins/twig/classes/HerbieExtension.php +++ b/plugins/twig/classes/HerbieExtension.php @@ -446,7 +446,7 @@ public function functionMenu(array $options = []) $htmlTree = new Menu\Page\Renderer\HtmlTree($filterIterator); $htmlTree->setMaxDepth($maxDepth); $htmlTree->setClass($class); - $htmlTree->itemCallback = function ($node) { + $htmlTree->itemCallback = function (\Herbie\Node $node) { $menuItem = $node->getMenuItem(); $href = $this->urlGenerator->generate($menuItem->route); return sprintf('%s', $href, $menuItem->getMenuTitle()); @@ -482,7 +482,6 @@ public function functionPagetitle(array $options = []) $titles[] = $item->title; } - #$page = Application::getPage(); if ($this->testIsPost($this->page)) { $titles[] = $this->page->title; } @@ -549,10 +548,6 @@ public function functionPager($limit = '', $template = '{prev}{next}', $linkClas } $replacements['{prev}'] = $this->createLink($prev->route, $label, $attribs); } - /*if(isset($cur)) { - $label = empty($curPageLabel) ? $cur->getMenuTitle() : $curPageLabel; - $replacements['{cur}'] = $this->createLink($cur->route, $label, $attribs); - }*/ if (isset($next)) { $label = empty($nextPageLabel) ? $next->getMenuTitle() : $nextPageLabel; $label = sprintf('%s', $label); @@ -597,7 +592,7 @@ public function functionSitemap(array $options = []) $htmlTree = new Menu\Page\Renderer\HtmlTree($filterIterator); $htmlTree->setMaxDepth($maxDepth); $htmlTree->setClass($class); - $htmlTree->itemCallback = function ($node) { + $htmlTree->itemCallback = function (\Herbie\Node $node) { $menuItem = $node->getMenuItem(); $href = $this->urlGenerator->generate($menuItem->route); return sprintf('%s', $href, $menuItem->getMenuTitle()); diff --git a/plugins/twig/classes/Twig.php b/plugins/twig/classes/Twig.php index fbdb4e9c..de4eb71b 100644 --- a/plugins/twig/classes/Twig.php +++ b/plugins/twig/classes/Twig.php @@ -64,18 +64,24 @@ public function init() $this->addTwigPlugins(); foreach(Hook::trigger(Hook::CONFIG, 'addTwigFunction') as $function) { - @list($name, $callable, $options) = $function; - $this->environment->addFunction(new \Twig_SimpleFunction($name, $callable, (array)$options)); + try { + list($name, $callable, $options) = $function; + $this->environment->addFunction(new \Twig_SimpleFunction($name, $callable, (array)$options)); + } catch (\Exception $e) {;/*do nothing else yet*/} } foreach(Hook::trigger(Hook::CONFIG, 'addTwigFilter') as $filter) { - @list($name, $callable, $options) = $filter; - $this->environment->addFilter(new \Twig_SimpleFilter($name, $callable, (array)$options)); + try { + list($name, $callable, $options) = $filter; + $this->environment->addFilter(new \Twig_SimpleFilter($name, $callable, (array)$options)); + } catch (\Exception $e) {;/*do nothing else yet*/} } foreach(Hook::trigger(Hook::CONFIG, 'addTwigTest') as $test) { - @list($name, $callable, $options) = $test; - $this->environment->addTest(new \Twig_SimpleTest($name, $callable, (array)$options)); + try { + list($name, $callable, $options) = $test; + $this->environment->addTest(new \Twig_SimpleTest($name, $callable, (array)$options)); + } catch (\Exception $e) {;/*do nothing else yet*/} } $this->initialized = true; @@ -179,7 +185,6 @@ public function renderString($string) */ private function getContext() { - // @todo Inject request object or refactor code return [ 'route' => Application::getService('Request')->getRoute(), 'baseUrl' => Application::getService('Request')->getBasePath(), diff --git a/plugins/twig/classes/widgets/blog/archives.html b/plugins/twig/classes/widgets/blog/archives.html index 9fcb82ef..434d697e 100644 --- a/plugins/twig/classes/widgets/blog/archives.html +++ b/plugins/twig/classes/widgets/blog/archives.html @@ -1,6 +1,5 @@ {% set title = title ? title : 'Archives' %} {% set showCount = showCount ? showCount : false %} -{# @todo: option dropdown (Display as dropdown) #} {% if site.posts.months|length > 0 %}
diff --git a/plugins/twig/classes/widgets/blog/categories.html b/plugins/twig/classes/widgets/blog/categories.html index c2e8f0f8..6c7bc2ea 100644 --- a/plugins/twig/classes/widgets/blog/categories.html +++ b/plugins/twig/classes/widgets/blog/categories.html @@ -1,7 +1,5 @@ {% set title = title ? title : 'Categories' %} {% set showCount = showCount ? showCount : false %} -{# @todo: option dropdown (Display as dropdown) #} -{# @todo: option hierarchical (Show hierarchy) #} {% if site.posts.categories|length > 0 %}
diff --git a/plugins/twig/classes/widgets/blog/tags.html b/plugins/twig/classes/widgets/blog/tags.html index e575e2ff..14ce4587 100644 --- a/plugins/twig/classes/widgets/blog/tags.html +++ b/plugins/twig/classes/widgets/blog/tags.html @@ -1,7 +1,5 @@ {% set title = title ? title : 'Tags' %} {% set showCount = showCount ? showCount : false %} -{# @todo: option dropdown (Display as dropdown) #} -{# @todo: option hierarchical (Show hierarchy) #} {% if site.posts.tags|length > 0 %}
diff --git a/plugins/twig/classes/widgets/listing.twig b/plugins/twig/classes/widgets/listing.twig index 2bf07060..9a579cd0 100644 --- a/plugins/twig/classes/widgets/listing.twig +++ b/plugins/twig/classes/widgets/listing.twig @@ -22,4 +22,4 @@ Nächste Seite {% endif %} -
\ No newline at end of file +
diff --git a/plugins/twig/composer.json b/plugins/twig/composer.json index f248dbe3..7a04e2ac 100644 --- a/plugins/twig/composer.json +++ b/plugins/twig/composer.json @@ -4,5 +4,8 @@ "description": "Herbie Twig Plugin.", "keywords": ["herbie", "plugin", "twig"], "type": "herbie-plugin", - "license": "BSD-3-Clause" -} \ No newline at end of file + "license": "BSD-3-Clause", + "require": { + "twig/twig": "v1.24.0" + } +} diff --git a/plugins/twig/twig.php b/plugins/twig/twig.php index c0569c2c..eeb974b7 100644 --- a/plugins/twig/twig.php +++ b/plugins/twig/twig.php @@ -23,7 +23,7 @@ public function initTwig() // Add custom namespace path to Imagine lib $vendorDir = $config->get('site.path') . '/../vendor'; $autoload = require($vendorDir . '/autoload.php'); - $autoload->add('Twig_', __DIR__ . '/vendor/twig/lib'); + $autoload->add('Twig_', __DIR__ . '/vendor/twig/twig/lib'); $this->twig = new Twig($config); $this->twig->init(); @@ -39,7 +39,7 @@ public function twigifyContent($content, array $attributes) return $this->twig->renderString($content); } - public function twigifyLayout($page) + public function twigifyLayout(\Herbie\Page $page) { $this->twig->getEnvironment()->getExtension('herbie')->setPage($page); return $this->twig->render($page->layout); diff --git a/plugins/twig/vendor/autoload.php b/plugins/twig/vendor/autoload.php new file mode 100644 index 00000000..606718a5 --- /dev/null +++ b/plugins/twig/vendor/autoload.php @@ -0,0 +1,7 @@ +> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`; fi + - if [ ${TRAVIS_PHP_VERSION:0:3} == "5.2" ]; then sed -i.bak "s|vendor/autoload.php|test/bootstrap.php|" phpunit.xml.dist; fi + +matrix: + fast_finish: true + exclude: + - php: hhvm + env: TWIG_EXT=yes + allow_failures: + - php: 7.0 + env: TWIG_EXT=yes diff --git a/plugins/twig/vendor/twig/twig/CHANGELOG b/plugins/twig/vendor/twig/twig/CHANGELOG new file mode 100644 index 00000000..85de10dd --- /dev/null +++ b/plugins/twig/vendor/twig/twig/CHANGELOG @@ -0,0 +1,828 @@ +* 1.24.0 (2016-01-25) + + * adding support for the ?? operator + * fixed the defined test when used on a constant, a map, or a sequence + * undeprecated _self (should only be used to get the template name, not the template instance) + * fixed parsing on PHP7 + +* 1.23.3 (2016-01-11) + + * fixed typo + +* 1.23.2 (2015-01-11) + + * added versions in deprecated messages + * made file cache tolerant for trailing (back)slashes on directory configuration + * deprecated unused Twig_Node_Expression_ExtensionReference class + +* 1.23.1 (2015-11-05) + + * fixed some exception messages which triggered PHP warnings + * fixed BC on Twig_Test_NodeTestCase + +* 1.23.0 (2015-10-29) + + * deprecated the possibility to override an extension by registering another one with the same name + * deprecated Twig_ExtensionInterface::getGlobals() (added Twig_Extension_GlobalsInterface for BC) + * deprecated Twig_ExtensionInterface::initRuntime() (added Twig_Extension_InitRuntimeInterface for BC) + * deprecated Twig_Environment::computeAlternatives() + +* 1.22.3 (2015-10-13) + + * fixed regression when using null as a cache strategy + * improved performance when checking template freshness + * fixed warnings when loaded templates do not exist + * fixed template class name generation to prevent possible collisions + * fixed logic for custom escapers to call them even on integers and null values + * changed template cache names to take into account the Twig C extension + +* 1.22.2 (2015-09-22) + + * fixed a race condition in template loading + +* 1.22.1 (2015-09-15) + + * fixed regression in template_from_string + +* 1.22.0 (2015-09-13) + + * made Twig_Test_IntegrationTestCase more flexible + * added an option to force PHP bytecode invalidation when writing a compiled template into the cache + * fixed the profiler duration for the root node + * changed template cache names to take into account enabled extensions + * deprecated Twig_Environment::clearCacheFiles(), Twig_Environment::getCacheFilename(), + Twig_Environment::writeCacheFile(), and Twig_Environment::getTemplateClassPrefix() + * added a way to override the filesystem template cache system + * added a way to get the original template source from Twig_Template + +* 1.21.2 (2015-09-09) + + * fixed variable names for the deprecation triggering code + * fixed escaping strategy detection based on filename + * added Traversable support for replace, merge, and sort + * deprecated support for character by character replacement for the "replace" filter + +* 1.21.1 (2015-08-26) + + * fixed regression when using the deprecated Twig_Test_* classes + +* 1.21.0 (2015-08-24) + + * added deprecation notices for deprecated features + * added a deprecation "framework" for filters/functions/tests and test fixtures + +* 1.20.0 (2015-08-12) + + * forbid access to the Twig environment from templates and internal parts of Twig_Template + * fixed limited RCEs when in sandbox mode + * deprecated Twig_Template::getEnvironment() + * deprecated the _self variable for usage outside of the from and import tags + * added Twig_BaseNodeVisitor to ease the compatibility of node visitors + between 1.x and 2.x + +* 1.19.0 (2015-07-31) + + * fixed wrong error message when including an undefined template in a child template + * added support for variadic filters, functions, and tests + * added support for extra positional arguments in macros + * added ignore_missing flag to the source function + * fixed batch filter with zero items + * deprecated Twig_Environment::clearTemplateCache() + * fixed sandbox disabling when using the include function + +* 1.18.2 (2015-06-06) + + * fixed template/line guessing in exceptions for nested templates + * optimized the number of inodes and the size of realpath cache when using the cache + +* 1.18.1 (2015-04-19) + + * fixed memory leaks in the C extension + * deprecated Twig_Loader_String + * fixed the slice filter when used with a SimpleXMLElement object + * fixed filesystem loader when trying to load non-files (like directories) + +* 1.18.0 (2015-01-25) + + * fixed some error messages where the line was wrong (unknown variables or argument names) + * added a new way to customize the main Module node (via empty nodes) + * added Twig_Environment::createTemplate() to create a template from a string + * added a profiler + * fixed filesystem loader cache when different file paths are used for the same template + +* 1.17.0 (2015-01-14) + + * added a 'filename' autoescaping strategy, which dynamically chooses the + autoescaping strategy for a template based on template file extension. + +* 1.16.3 (2014-12-25) + + * fixed regression for dynamic parent templates + * fixed cache management with statcache + * fixed a regression in the slice filter + +* 1.16.2 (2014-10-17) + + * fixed timezone on dates as strings + * fixed 2-words test names when a custom node class is not used + * fixed macros when using an argument named like a PHP super global (like GET or POST) + * fixed date_modify when working with DateTimeImmutable + * optimized for loops + * fixed multi-byte characters handling in the split filter + * fixed a regression in the in operator + * fixed a regression in the slice filter + +* 1.16.1 (2014-10-10) + + * improved error reporting in a sandboxed template + * fixed missing error file/line information under certain circumstances + * fixed wrong error line number in some error messages + * fixed the in operator to use strict comparisons + * sped up the slice filter + * fixed for mb function overload mb_substr acting different + * fixed the attribute() function when passing a variable for the arguments + +* 1.16.0 (2014-07-05) + + * changed url_encode to always encode according to RFC 3986 + * fixed inheritance in a 'use'-hierarchy + * removed the __toString policy check when the sandbox is disabled + * fixed recursively calling blocks in templates with inheritance + +* 1.15.1 (2014-02-13) + + * fixed the conversion of the special '0000-00-00 00:00' date + * added an error message when trying to import an undefined block from a trait + * fixed a C extension crash when accessing defined but uninitialized property. + +* 1.15.0 (2013-12-06) + + * made ignoreStrictCheck in Template::getAttribute() works with __call() methods throwing BadMethodCallException + * added min and max functions + * added the round filter + * fixed a bug that prevented the optimizers to be enabled/disabled selectively + * fixed first and last filters for UTF-8 strings + * added a source function to include the content of a template without rendering it + * fixed the C extension sandbox behavior when get or set is prepend to method name + +* 1.14.2 (2013-10-30) + + * fixed error filename/line when an error occurs in an included file + * allowed operators that contain whitespaces to have more than one whitespace + * allowed tests to be made of 1 or 2 words (like "same as" or "divisible by") + +* 1.14.1 (2013-10-15) + + * made it possible to use named operators as variables + * fixed the possibility to have a variable named 'matches' + * added support for PHP 5.5 DateTimeInterface + +* 1.14.0 (2013-10-03) + + * fixed usage of the html_attr escaping strategy to avoid double-escaping with the html strategy + * added new operators: ends with, starts with, and matches + * fixed some compatibility issues with HHVM + * added a way to add custom escaping strategies + * fixed the C extension compilation on Windows + * fixed the batch filter when using a fill argument with an exact match of elements to batch + * fixed the filesystem loader cache when a template name exists in several namespaces + * fixed template_from_string when the template includes or extends other ones + * fixed a crash of the C extension on an edge case + +* 1.13.2 (2013-08-03) + + * fixed the error line number for an error occurs in and embedded template + * fixed crashes of the C extension on some edge cases + +* 1.13.1 (2013-06-06) + + * added the possibility to ignore the filesystem constructor argument in Twig_Loader_Filesystem + * fixed Twig_Loader_Chain::exists() for a loader which implements Twig_ExistsLoaderInterface + * adjusted backtrace call to reduce memory usage when an error occurs + * added support for object instances as the second argument of the constant test + * fixed the include function when used in an assignment + +* 1.13.0 (2013-05-10) + + * fixed getting a numeric-like item on a variable ('09' for instance) + * fixed getting a boolean or float key on an array, so it is consistent with PHP's array access: + `{{ array[false] }}` behaves the same as `echo $array[false];` (equals `$array[0]`) + * made the escape filter 20% faster for happy path (escaping string for html with UTF-8) + * changed ☃ to § in tests + * enforced usage of named arguments after positional ones + +* 1.12.3 (2013-04-08) + + * fixed a security issue in the filesystem loader where it was possible to include a template one + level above the configured path + * fixed fatal error that should be an exception when adding a filter/function/test too late + * added a batch filter + * added support for encoding an array as query string in the url_encode filter + +* 1.12.2 (2013-02-09) + + * fixed the timezone used by the date filter and function when the given date contains a timezone (like 2010-01-28T15:00:00+02:00) + * fixed globals when getGlobals is called early on + * added the first and last filter + +* 1.12.1 (2013-01-15) + + * added support for object instances as the second argument of the constant function + * relaxed globals management to avoid a BC break + * added support for {{ some_string[:2] }} + +* 1.12.0 (2013-01-08) + + * added verbatim as an alias for the raw tag to avoid confusion with the raw filter + * fixed registration of tests and functions as anonymous functions + * fixed globals management + +* 1.12.0-RC1 (2012-12-29) + + * added an include function (does the same as the include tag but in a more flexible way) + * added the ability to use any PHP callable to define filters, functions, and tests + * added a syntax error when using a loop variable that is not defined + * added the ability to set default values for macro arguments + * added support for named arguments for filters, tests, and functions + * moved filters/functions/tests syntax errors to the parser + * added support for extended ternary operator syntaxes + +* 1.11.1 (2012-11-11) + + * fixed debug info line numbering (was off by 2) + * fixed escaping when calling a macro inside another one (regression introduced in 1.9.1) + * optimized variable access on PHP 5.4 + * fixed a crash of the C extension when an exception was thrown from a macro called without being imported (using _self.XXX) + +* 1.11.0 (2012-11-07) + + * fixed macro compilation when a variable name is a PHP reserved keyword + * changed the date filter behavior to always apply the default timezone, except if false is passed as the timezone + * fixed bitwise operator precedences + * added the template_from_string function + * fixed default timezone usage for the date function + * optimized the way Twig exceptions are managed (to make them faster) + * added Twig_ExistsLoaderInterface (implementing this interface in your loader make the chain loader much faster) + +* 1.10.3 (2012-10-19) + + * fixed wrong template location in some error messages + * reverted a BC break introduced in 1.10.2 + * added a split filter + +* 1.10.2 (2012-10-15) + + * fixed macro calls on PHP 5.4 + +* 1.10.1 (2012-10-15) + + * made a speed optimization to macro calls when imported via the "import" tag + * fixed C extension compilation on Windows + * fixed a segfault in the C extension when using DateTime objects + +* 1.10.0 (2012-09-28) + + * extracted functional tests framework to make it reusable for third-party extensions + * added namespaced templates support in Twig_Loader_Filesystem + * added Twig_Loader_Filesystem::prependPath() + * fixed an error when a token parser pass a closure as a test to the subparse() method + +* 1.9.2 (2012-08-25) + + * fixed the in operator for objects that contain circular references + * fixed the C extension when accessing a public property of an object implementing the \ArrayAccess interface + +* 1.9.1 (2012-07-22) + + * optimized macro calls when auto-escaping is on + * fixed wrong parent class for Twig_Function_Node + * made Twig_Loader_Chain more explicit about problems + +* 1.9.0 (2012-07-13) + + * made the parsing independent of the template loaders + * fixed exception trace when an error occurs when rendering a child template + * added escaping strategies for CSS, URL, and HTML attributes + * fixed nested embed tag calls + * added the date_modify filter + +* 1.8.3 (2012-06-17) + + * fixed paths in the filesystem loader when passing a path that ends with a slash or a backslash + * fixed escaping when a project defines a function named html or js + * fixed chmod mode to apply the umask correctly + +* 1.8.2 (2012-05-30) + + * added the abs filter + * fixed a regression when using a number in template attributes + * fixed compiler when mbstring.func_overload is set to 2 + * fixed DateTimeZone support in date filter + +* 1.8.1 (2012-05-17) + + * fixed a regression when dealing with SimpleXMLElement instances in templates + * fixed "is_safe" value for the "dump" function when "html_errors" is not defined in php.ini + * switched to use mbstring whenever possible instead of iconv (you might need to update your encoding as mbstring and iconv encoding names sometimes differ) + +* 1.8.0 (2012-05-08) + + * enforced interface when adding tests, filters, functions, and node visitors from extensions + * fixed a side-effect of the date filter where the timezone might be changed + * simplified usage of the autoescape tag; the only (optional) argument is now the escaping strategy or false (with a BC layer) + * added a way to dynamically change the auto-escaping strategy according to the template "filename" + * changed the autoescape option to also accept a supported escaping strategy (for BC, true is equivalent to html) + * added an embed tag + +* 1.7.0 (2012-04-24) + + * fixed a PHP warning when using CIFS + * fixed template line number in some exceptions + * added an iterable test + * added an error when defining two blocks with the same name in a template + * added the preserves_safety option for filters + * fixed a PHP notice when trying to access a key on a non-object/array variable + * enhanced error reporting when the template file is an instance of SplFileInfo + * added Twig_Environment::mergeGlobals() + * added compilation checks to avoid misuses of the sandbox tag + * fixed filesystem loader freshness logic for high traffic websites + * fixed random function when charset is null + +* 1.6.5 (2012-04-11) + + * fixed a regression when a template only extends another one without defining any blocks + +* 1.6.4 (2012-04-02) + + * fixed PHP notice in Twig_Error::guessTemplateLine() introduced in 1.6.3 + * fixed performance when compiling large files + * optimized parent template creation when the template does not use dynamic inheritance + +* 1.6.3 (2012-03-22) + + * fixed usage of Z_ADDREF_P for PHP 5.2 in the C extension + * fixed compilation of numeric values used in templates when using a locale where the decimal separator is not a dot + * made the strategy used to guess the real template file name and line number in exception messages much faster and more accurate + +* 1.6.2 (2012-03-18) + + * fixed sandbox mode when used with inheritance + * added preserveKeys support for the slice filter + * fixed the date filter when a DateTime instance is passed with a specific timezone + * added a trim filter + +* 1.6.1 (2012-02-29) + + * fixed Twig C extension + * removed the creation of Twig_Markup instances when not needed + * added a way to set the default global timezone for dates + * fixed the slice filter on strings when the length is not specified + * fixed the creation of the cache directory in case of a race condition + +* 1.6.0 (2012-02-04) + + * fixed raw blocks when used with the whitespace trim option + * made a speed optimization to macro calls when imported via the "from" tag + * fixed globals, parsers, visitors, filters, tests, and functions management in Twig_Environment when a new one or new extension is added + * fixed the attribute function when passing arguments + * added slice notation support for the [] operator (syntactic sugar for the slice operator) + * added a slice filter + * added string support for the reverse filter + * fixed the empty test and the length filter for Twig_Markup instances + * added a date function to ease date comparison + * fixed unary operators precedence + * added recursive parsing support in the parser + * added string and integer handling for the random function + +* 1.5.1 (2012-01-05) + + * fixed a regression when parsing strings + +* 1.5.0 (2012-01-04) + + * added Traversable objects support for the join filter + +* 1.5.0-RC2 (2011-12-30) + + * added a way to set the default global date interval format + * fixed the date filter for DateInterval instances (setTimezone() does not exist for them) + * refactored Twig_Template::display() to ease its extension + * added a number_format filter + +* 1.5.0-RC1 (2011-12-26) + + * removed the need to quote hash keys + * allowed hash keys to be any expression + * added a do tag + * added a flush tag + * added support for dynamically named filters and functions + * added a dump function to help debugging templates + * added a nl2br filter + * added a random function + * added a way to change the default format for the date filter + * fixed the lexer when an operator ending with a letter ends a line + * added string interpolation support + * enhanced exceptions for unknown filters, functions, tests, and tags + +* 1.4.0 (2011-12-07) + + * fixed lexer when using big numbers (> PHP_INT_MAX) + * added missing preserveKeys argument to the reverse filter + * fixed macros containing filter tag calls + +* 1.4.0-RC2 (2011-11-27) + + * removed usage of Reflection in Twig_Template::getAttribute() + * added a C extension that can optionally replace Twig_Template::getAttribute() + * added negative timestamp support to the date filter + +* 1.4.0-RC1 (2011-11-20) + + * optimized variable access when using PHP 5.4 + * changed the precedence of the .. operator to be more consistent with languages that implements such a feature like Ruby + * added an Exception to Twig_Loader_Array::isFresh() method when the template does not exist to be consistent with other loaders + * added Twig_Function_Node to allow more complex functions to have their own Node class + * added Twig_Filter_Node to allow more complex filters to have their own Node class + * added Twig_Test_Node to allow more complex tests to have their own Node class + * added a better error message when a template is empty but contain a BOM + * fixed "in" operator for empty strings + * fixed the "defined" test and the "default" filter (now works with more than one call (foo.bar.foo) and for both values of the strict_variables option) + * changed the way extensions are loaded (addFilter/addFunction/addGlobal/addTest/addNodeVisitor/addTokenParser/addExtension can now be called in any order) + * added Twig_Environment::display() + * made the escape filter smarter when the encoding is not supported by PHP + * added a convert_encoding filter + * moved all node manipulations outside the compile() Node method + * made several speed optimizations + +* 1.3.0 (2011-10-08) + +no changes + +* 1.3.0-RC1 (2011-10-04) + + * added an optimization for the parent() function + * added cache reloading when auto_reload is true and an extension has been modified + * added the possibility to force the escaping of a string already marked as safe (instance of Twig_Markup) + * allowed empty templates to be used as traits + * added traits support for the "parent" function + +* 1.2.0 (2011-09-13) + +no changes + +* 1.2.0-RC1 (2011-09-10) + + * enhanced the exception when a tag remains unclosed + * added support for empty Countable objects for the "empty" test + * fixed algorithm that determines if a template using inheritance is valid (no output between block definitions) + * added better support for encoding problems when escaping a string (available as of PHP 5.4) + * added a way to ignore a missing template when using the "include" tag ({% include "foo" ignore missing %}) + * added support for an array of templates to the "include" and "extends" tags ({% include ['foo', 'bar'] %}) + * added support for bitwise operators in expressions + * added the "attribute" function to allow getting dynamic attributes on variables + * added Twig_Loader_Chain + * added Twig_Loader_Array::setTemplate() + * added an optimization for the set tag when used to capture a large chunk of static text + * changed name regex to match PHP one "[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*" (works for blocks, tags, functions, filters, and macros) + * removed the possibility to use the "extends" tag from a block + * added "if" modifier support to "for" loops + +* 1.1.2 (2011-07-30) + + * fixed json_encode filter on PHP 5.2 + * fixed regression introduced in 1.1.1 ({{ block(foo|lower) }}) + * fixed inheritance when using conditional parents + * fixed compilation of templates when the body of a child template is not empty + * fixed output when a macro throws an exception + * fixed a parsing problem when a large chunk of text is enclosed in a comment tag + * added PHPDoc for all Token parsers and Core extension functions + +* 1.1.1 (2011-07-17) + + * added a performance optimization in the Optimizer (also helps to lower the number of nested level calls) + * made some performance improvement for some edge cases + +* 1.1.0 (2011-06-28) + + * fixed json_encode filter + +* 1.1.0-RC3 (2011-06-24) + + * fixed method case-sensitivity when using the sandbox mode + * added timezone support for the date filter + * fixed possible security problems with NUL bytes + +* 1.1.0-RC2 (2011-06-16) + + * added an exception when the template passed to "use" is not a string + * made 'a.b is defined' not throw an exception if a is not defined (in strict mode) + * added {% line \d+ %} directive + +* 1.1.0-RC1 (2011-05-28) + +Flush your cache after upgrading. + + * fixed date filter when using a timestamp + * fixed the defined test for some cases + * fixed a parsing problem when a large chunk of text is enclosed in a raw tag + * added support for horizontal reuse of template blocks (see docs for more information) + * added whitespace control modifier to all tags (see docs for more information) + * added null as an alias for none (the null test is also an alias for the none test now) + * made TRUE, FALSE, NONE equivalent to their lowercase counterparts + * wrapped all compilation and runtime exceptions with Twig_Error_Runtime and added logic to guess the template name and line + * moved display() method to Twig_Template (generated templates should now use doDisplay() instead) + +* 1.0.0 (2011-03-27) + + * fixed output when using mbstring + * fixed duplicate call of methods when using the sandbox + * made the charset configurable for the escape filter + +* 1.0.0-RC2 (2011-02-21) + + * changed the way {% set %} works when capturing (the content is now marked as safe) + * added support for macro name in the endmacro tag + * make Twig_Error compatible with PHP 5.3.0 > + * fixed an infinite loop on some Windows configurations + * fixed the "length" filter for numbers + * fixed Template::getAttribute() as properties in PHP are case sensitive + * removed coupling between Twig_Node and Twig_Template + * fixed the ternary operator precedence rule + +* 1.0.0-RC1 (2011-01-09) + +Backward incompatibilities: + + * the "items" filter, which has been deprecated for quite a long time now, has been removed + * the "range" filter has been converted to a function: 0|range(10) -> range(0, 10) + * the "constant" filter has been converted to a function: {{ some_date|date('DATE_W3C'|constant) }} -> {{ some_date|date(constant('DATE_W3C')) }} + * the "cycle" filter has been converted to a function: {{ ['odd', 'even']|cycle(i) }} -> {{ cycle(['odd', 'even'], i) }} + * the "for" tag does not support "joined by" anymore + * the "autoescape" first argument is now "true"/"false" (instead of "on"/"off") + * the "parent" tag has been replaced by a "parent" function ({{ parent() }} instead of {% parent %}) + * the "display" tag has been replaced by a "block" function ({{ block('title') }} instead of {% display title %}) + * removed the grammar and simple token parser (moved to the Twig Extensions repository) + +Changes: + + * added "needs_context" option for filters and functions (the context is then passed as a first argument) + * added global variables support + * made macros return their value instead of echoing directly (fixes calling a macro in sandbox mode) + * added the "from" tag to import macros as functions + * added support for functions (a function is just syntactic sugar for a getAttribute() call) + * made macros callable when sandbox mode is enabled + * added an exception when a macro uses a reserved name + * the "default" filter now uses the "empty" test instead of just checking for null + * added the "empty" test + +* 0.9.10 (2010-12-16) + +Backward incompatibilities: + + * The Escaper extension is enabled by default, which means that all displayed + variables are now automatically escaped. You can revert to the previous + behavior by removing the extension via $env->removeExtension('escaper') + or just set the 'autoescape' option to 'false'. + * removed the "without loop" attribute for the "for" tag (not needed anymore + as the Optimizer take care of that for most cases) + * arrays and hashes have now a different syntax + * arrays keep the same syntax with square brackets: [1, 2] + * hashes now use curly braces (["a": "b"] should now be written as {"a": "b"}) + * support for "arrays with keys" and "hashes without keys" is not supported anymore ([1, "foo": "bar"] or {"foo": "bar", 1}) + * the i18n extension is now part of the Twig Extensions repository + +Changes: + + * added the merge filter + * removed 'is_escaper' option for filters (a left over from the previous version) -- you must use 'is_safe' now instead + * fixed usage of operators as method names (like is, in, and not) + * changed the order of execution for node visitors + * fixed default() filter behavior when used with strict_variables set to on + * fixed filesystem loader compatibility with PHAR files + * enhanced error messages when an unexpected token is parsed in an expression + * fixed filename not being added to syntax error messages + * added the autoescape option to enable/disable autoescaping + * removed the newline after a comment (mimics PHP behavior) + * added a syntax error exception when parent block is used on a template that does not extend another one + * made the Escaper extension enabled by default + * fixed sandbox extension when used with auto output escaping + * fixed escaper when wrapping a Twig_Node_Print (the original class must be preserved) + * added an Optimizer extension (enabled by default; optimizes "for" loops and "raw" filters) + * added priority to node visitors + +* 0.9.9 (2010-11-28) + +Backward incompatibilities: + * the self special variable has been renamed to _self + * the odd and even filters are now tests: + {{ foo|odd }} must now be written {{ foo is odd }} + * the "safe" filter has been renamed to "raw" + * in Node classes, + sub-nodes are now accessed via getNode() (instead of property access) + attributes via getAttribute() (instead of array access) + * the urlencode filter had been renamed to url_encode + * the include tag now merges the passed variables with the current context by default + (the old behavior is still possible by adding the "only" keyword) + * moved Exceptions to Twig_Error_* (Twig_SyntaxError/Twig_RuntimeError are now Twig_Error_Syntax/Twig_Error_Runtime) + * removed support for {{ 1 < i < 3 }} (use {{ i > 1 and i < 3 }} instead) + * the "in" filter has been removed ({{ a|in(b) }} should now be written {{ a in b }}) + +Changes: + * added file and line to Twig_Error_Runtime exceptions thrown from Twig_Template + * changed trans tag to accept any variable for the plural count + * fixed sandbox mode (__toString() method check was not enforced if called implicitly from complex statements) + * added the ** (power) operator + * changed the algorithm used for parsing expressions + * added the spaceless tag + * removed trim_blocks option + * added support for is*() methods for attributes (foo.bar now looks for foo->getBar() or foo->isBar()) + * changed all exceptions to extend Twig_Error + * fixed unary expressions ({{ not(1 or 0) }}) + * fixed child templates (with an extend tag) that uses one or more imports + * added support for {{ 1 not in [2, 3] }} (more readable than the current {{ not (1 in [2, 3]) }}) + * escaping has been rewritten + * the implementation of template inheritance has been rewritten + (blocks can now be called individually and still work with inheritance) + * fixed error handling for if tag when a syntax error occurs within a subparse process + * added a way to implement custom logic for resolving token parsers given a tag name + * fixed js escaper to be stricter (now uses a whilelist-based js escaper) + * added the following filers: "constant", "trans", "replace", "json_encode" + * added a "constant" test + * fixed objects with __toString() not being autoescaped + * fixed subscript expressions when calling __call() (methods now keep the case) + * added "test" feature (accessible via the "is" operator) + * removed the debug tag (should be done in an extension) + * fixed trans tag when no vars are used in plural form + * fixed race condition when writing template cache + * added the special _charset variable to reference the current charset + * added the special _context variable to reference the current context + * renamed self to _self (to avoid conflict) + * fixed Twig_Template::getAttribute() for protected properties + +* 0.9.8 (2010-06-28) + +Backward incompatibilities: + * the trans tag plural count is now attached to the plural tag: + old: `{% trans count %}...{% plural %}...{% endtrans %}` + new: `{% trans %}...{% plural count %}...{% endtrans %}` + + * added a way to translate strings coming from a variable ({% trans var %}) + * fixed trans tag when used with the Escaper extension + * fixed default cache umask + * removed Twig_Template instances from the debug tag output + * fixed objects with __isset() defined + * fixed set tag when used with a capture + * fixed type hinting for Twig_Environment::addFilter() method + +* 0.9.7 (2010-06-12) + +Backward incompatibilities: + * changed 'as' to '=' for the set tag ({% set title as "Title" %} must now be {% set title = "Title" %}) + * removed the sandboxed attribute of the include tag (use the new sandbox tag instead) + * refactored the Node system (if you have custom nodes, you will have to update them to use the new API) + + * added self as a special variable that refers to the current template (useful for importing macros from the current template) + * added Twig_Template instance support to the include tag + * added support for dynamic and conditional inheritance ({% extends some_var %} and {% extends standalone ? "minimum" : "base" %}) + * added a grammar sub-framework to ease the creation of custom tags + * fixed the for tag for large arrays (some loop variables are now only available for arrays and objects that implement the Countable interface) + * removed the Twig_Resource::resolveMissingFilter() method + * fixed the filter tag which did not apply filtering to included files + * added a bunch of unit tests + * added a bunch of phpdoc + * added a sandbox tag in the sandbox extension + * changed the date filter to support any date format supported by DateTime + * added strict_variable setting to throw an exception when an invalid variable is used in a template (disabled by default) + * added the lexer, parser, and compiler as arguments to the Twig_Environment constructor + * changed the cache option to only accepts an explicit path to a cache directory or false + * added a way to add token parsers, filters, and visitors without creating an extension + * added three interfaces: Twig_NodeInterface, Twig_TokenParserInterface, and Twig_FilterInterface + * changed the generated code to match the new coding standards + * fixed sandbox mode (__toString() method check was not enforced if called implicitly from a simple statement like {{ article }}) + * added an exception when a child template has a non-empty body (as it is always ignored when rendering) + +* 0.9.6 (2010-05-12) + + * fixed variables defined outside a loop and for which the value changes in a for loop + * fixed the test suite for PHP 5.2 and older versions of PHPUnit + * added support for __call() in expression resolution + * fixed node visiting for macros (macros are now visited by visitors as any other node) + * fixed nested block definitions with a parent call (rarely useful but nonetheless supported now) + * added the cycle filter + * fixed the Lexer when mbstring.func_overload is used with an mbstring.internal_encoding different from ASCII + * added a long-syntax for the set tag ({% set foo %}...{% endset %}) + * unit tests are now powered by PHPUnit + * added support for gettext via the `i18n` extension + * fixed twig_capitalize_string_filter() and fixed twig_length_filter() when used with UTF-8 values + * added a more useful exception if an if tag is not closed properly + * added support for escaping strategy in the autoescape tag + * fixed lexer when a template has a big chunk of text between/in a block + +* 0.9.5 (2010-01-20) + +As for any new release, don't forget to remove all cached templates after +upgrading. + +If you have defined custom filters, you MUST upgrade them for this release. To +upgrade, replace "array" with "new Twig_Filter_Function", and replace the +environment constant by the "needs_environment" option: + + // before + 'even' => array('twig_is_even_filter', false), + 'escape' => array('twig_escape_filter', true), + + // after + 'even' => new Twig_Filter_Function('twig_is_even_filter'), + 'escape' => new Twig_Filter_Function('twig_escape_filter', array('needs_environment' => true)), + +If you have created NodeTransformer classes, you will need to upgrade them to +the new interface (please note that the interface is not yet considered +stable). + + * fixed list nodes that did not extend the Twig_NodeListInterface + * added the "without loop" option to the for tag (it disables the generation of the loop variable) + * refactored node transformers to node visitors + * fixed automatic-escaping for blocks + * added a way to specify variables to pass to an included template + * changed the automatic-escaping rules to be more sensible and more configurable in custom filters (the documentation lists all the rules) + * improved the filter system to allow object methods to be used as filters + * changed the Array and String loaders to actually make use of the cache mechanism + * included the default filter function definitions in the extension class files directly (Core, Escaper) + * added the // operator (like the floor() PHP function) + * added the .. operator (as a syntactic sugar for the range filter when the step is 1) + * added the in operator (as a syntactic sugar for the in filter) + * added the following filters in the Core extension: in, range + * added support for arrays (same behavior as in PHP, a mix between lists and dictionaries, arrays and hashes) + * enhanced some error messages to provide better feedback in case of parsing errors + +* 0.9.4 (2009-12-02) + +If you have custom loaders, you MUST upgrade them for this release: The +Twig_Loader base class has been removed, and the Twig_LoaderInterface has also +been changed (see the source code for more information or the documentation). + + * added support for DateTime instances for the date filter + * fixed loop.last when the array only has one item + * made it possible to insert newlines in tag and variable blocks + * fixed a bug when a literal '\n' were present in a template text + * fixed bug when the filename of a template contains */ + * refactored loaders + +* 0.9.3 (2009-11-11) + +This release is NOT backward compatible with the previous releases. + + The loaders do not take the cache and autoReload arguments anymore. Instead, + the Twig_Environment class has two new options: cache and auto_reload. + Upgrading your code means changing this kind of code: + + $loader = new Twig_Loader_Filesystem('/path/to/templates', '/path/to/compilation_cache', true); + $twig = new Twig_Environment($loader); + + to something like this: + + $loader = new Twig_Loader_Filesystem('/path/to/templates'); + $twig = new Twig_Environment($loader, array( + 'cache' => '/path/to/compilation_cache', + 'auto_reload' => true, + )); + + * deprecated the "items" filter as it is not needed anymore + * made cache and auto_reload options of Twig_Environment instead of arguments of Twig_Loader + * optimized template loading speed + * removed output when an error occurs in a template and render() is used + * made major speed improvements for loops (up to 300% on even the smallest loops) + * added properties as part of the sandbox mode + * added public properties support (obj.item can now be the item property on the obj object) + * extended set tag to support expression as value ({% set foo as 'foo' ~ 'bar' %} ) + * fixed bug when \ was used in HTML + +* 0.9.2 (2009-10-29) + + * made some speed optimizations + * changed the cache extension to .php + * added a js escaping strategy + * added support for short block tag + * changed the filter tag to allow chained filters + * made lexer more flexible as you can now change the default delimiters + * added set tag + * changed default directory permission when cache dir does not exist (more secure) + * added macro support + * changed filters first optional argument to be a Twig_Environment instance instead of a Twig_Template instance + * made Twig_Autoloader::autoload() a static method + * avoid writing template file if an error occurs + * added $ escaping when outputting raw strings + * enhanced some error messages to ease debugging + * fixed empty cache files when the template contains an error + +* 0.9.1 (2009-10-14) + + * fixed a bug in PHP 5.2.6 + * fixed numbers with one than one decimal + * added support for method calls with arguments ({{ foo.bar('a', 43) }}) + * made small speed optimizations + * made minor tweaks to allow better extensibility and flexibility + +* 0.9.0 (2009-10-12) + + * Initial release diff --git a/plugins/twig/vendor/twig/twig/LICENSE b/plugins/twig/vendor/twig/twig/LICENSE new file mode 100644 index 00000000..cc74f810 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/LICENSE @@ -0,0 +1,31 @@ +Copyright (c) 2009-2016 by the Twig Team. + +Some rights reserved. + +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. diff --git a/plugins/twig/vendor/twig/twig/README.rst b/plugins/twig/vendor/twig/twig/README.rst new file mode 100644 index 00000000..81737b0b --- /dev/null +++ b/plugins/twig/vendor/twig/twig/README.rst @@ -0,0 +1,15 @@ +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. + +More Information +---------------- + +Read the `documentation`_ for more information. + +.. _documentation: http://twig.sensiolabs.org/documentation diff --git a/plugins/twig/vendor/twig/twig/composer.json b/plugins/twig/vendor/twig/twig/composer.json new file mode 100644 index 00000000..507d8aec --- /dev/null +++ b/plugins/twig/vendor/twig/twig/composer.json @@ -0,0 +1,46 @@ +{ + "name": "twig/twig", + "type": "library", + "description": "Twig, the flexible, fast, and secure template language for PHP", + "keywords": ["templating"], + "homepage": "http://twig.sensiolabs.org", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Twig Team", + "homepage": "http://twig.sensiolabs.org/contributors", + "role": "Contributors" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + } + ], + "support": { + "forum": "https://groups.google.com/forum/#!forum/twig-users" + }, + "require": { + "php": ">=5.2.7" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7", + "symfony/debug": "~2.7" + }, + "autoload": { + "psr-0" : { + "Twig_" : "lib/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.24-dev" + } + } +} diff --git a/plugins/twig/vendor/twig/twig/ext/twig/.gitignore b/plugins/twig/vendor/twig/twig/ext/twig/.gitignore new file mode 100644 index 00000000..56ea76cc --- /dev/null +++ b/plugins/twig/vendor/twig/twig/ext/twig/.gitignore @@ -0,0 +1,30 @@ +*.sw* +.deps +Makefile +Makefile.fragments +Makefile.global +Makefile.objects +acinclude.m4 +aclocal.m4 +build/ +config.cache +config.guess +config.h +config.h.in +config.log +config.nice +config.status +config.sub +configure +configure.in +install-sh +libtool +ltmain.sh +missing +mkinstalldirs +run-tests.php +twig.loT +.libs/ +modules/ +twig.la +twig.lo diff --git a/plugins/twig/vendor/twig/twig/ext/twig/config.m4 b/plugins/twig/vendor/twig/twig/ext/twig/config.m4 new file mode 100644 index 00000000..83486be4 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/ext/twig/config.m4 @@ -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 diff --git a/plugins/twig/vendor/twig/twig/ext/twig/config.w32 b/plugins/twig/vendor/twig/twig/ext/twig/config.w32 new file mode 100644 index 00000000..cb287b99 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/ext/twig/config.w32 @@ -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'); +} diff --git a/plugins/twig/vendor/twig/twig/ext/twig/php_twig.h b/plugins/twig/vendor/twig/twig/ext/twig/php_twig.h new file mode 100644 index 00000000..2973e9d9 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/ext/twig/php_twig.h @@ -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 | + +----------------------------------------------------------------------+ + */ + +#ifndef PHP_TWIG_H +#define PHP_TWIG_H + +#define PHP_TWIG_VERSION "1.24.0" + +#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 diff --git a/plugins/twig/vendor/twig/twig/ext/twig/twig.c b/plugins/twig/vendor/twig/twig/ext/twig/twig.c new file mode 100644 index 00000000..92d1addc --- /dev/null +++ b/plugins/twig/vendor/twig/twig/ext/twig/twig.c @@ -0,0 +1,1127 @@ +/* + +----------------------------------------------------------------------+ + | 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 | + +----------------------------------------------------------------------+ + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "php.h" +#include "php_twig.h" +#include "ext/standard/php_var.h" +#include "ext/standard/php_string.h" +#include "ext/standard/php_smart_str.h" +#include "ext/spl/spl_exceptions.h" + +#include "Zend/zend_object_handlers.h" +#include "Zend/zend_interfaces.h" +#include "Zend/zend_exceptions.h" + +#ifndef Z_ADDREF_P +#define Z_ADDREF_P(pz) (pz)->refcount++ +#endif + +#define FREE_DTOR(z) \ + zval_dtor(z); \ + efree(z); + +#if PHP_VERSION_ID >= 50300 + #define APPLY_TSRMLS_DC TSRMLS_DC + #define APPLY_TSRMLS_CC TSRMLS_CC + #define APPLY_TSRMLS_FETCH() +#else + #define APPLY_TSRMLS_DC + #define APPLY_TSRMLS_CC + #define APPLY_TSRMLS_FETCH() TSRMLS_FETCH() +#endif + +ZEND_BEGIN_ARG_INFO_EX(twig_template_get_attribute_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 6) + ZEND_ARG_INFO(0, template) + ZEND_ARG_INFO(0, object) + ZEND_ARG_INFO(0, item) + ZEND_ARG_INFO(0, arguments) + ZEND_ARG_INFO(0, type) + ZEND_ARG_INFO(0, isDefinedTest) +ZEND_END_ARG_INFO() + +#ifndef PHP_FE_END +#define PHP_FE_END { NULL, NULL, NULL} +#endif + +static const zend_function_entry twig_functions[] = { + PHP_FE(twig_template_get_attributes, twig_template_get_attribute_args) + PHP_FE_END +}; + +PHP_RSHUTDOWN_FUNCTION(twig) +{ +#if ZEND_DEBUG + CG(unclean_shutdown) = 0; /* get rid of PHPUnit's exit() and report memleaks */ +#endif + return SUCCESS; +} + +zend_module_entry twig_module_entry = { + STANDARD_MODULE_HEADER, + "twig", + twig_functions, + NULL, + NULL, + NULL, + PHP_RSHUTDOWN(twig), + NULL, + PHP_TWIG_VERSION, + STANDARD_MODULE_PROPERTIES +}; + + +#ifdef COMPILE_DL_TWIG +ZEND_GET_MODULE(twig) +#endif + +static int TWIG_ARRAY_KEY_EXISTS(zval *array, zval *key) +{ + if (Z_TYPE_P(array) != IS_ARRAY) { + return 0; + } + + switch (Z_TYPE_P(key)) { + case IS_NULL: + return zend_hash_exists(Z_ARRVAL_P(array), "", 1); + + case IS_BOOL: + case IS_DOUBLE: + convert_to_long(key); + case IS_LONG: + return zend_hash_index_exists(Z_ARRVAL_P(array), Z_LVAL_P(key)); + + default: + convert_to_string(key); + return zend_symtable_exists(Z_ARRVAL_P(array), Z_STRVAL_P(key), Z_STRLEN_P(key) + 1); + } +} + +static int TWIG_INSTANCE_OF(zval *object, zend_class_entry *interface TSRMLS_DC) +{ + if (Z_TYPE_P(object) != IS_OBJECT) { + return 0; + } + return instanceof_function(Z_OBJCE_P(object), interface TSRMLS_CC); +} + +static int TWIG_INSTANCE_OF_USERLAND(zval *object, char *interface TSRMLS_DC) +{ + zend_class_entry **pce; + if (Z_TYPE_P(object) != IS_OBJECT) { + return 0; + } + if (zend_lookup_class(interface, strlen(interface), &pce TSRMLS_CC) == FAILURE) { + return 0; + } + return instanceof_function(Z_OBJCE_P(object), *pce TSRMLS_CC); +} + +static zval *TWIG_GET_ARRAYOBJECT_ELEMENT(zval *object, zval *offset TSRMLS_DC) +{ + zend_class_entry *ce = Z_OBJCE_P(object); + zval *retval; + + if (Z_TYPE_P(object) == IS_OBJECT) { + SEPARATE_ARG_IF_REF(offset); + zend_call_method_with_1_params(&object, ce, NULL, "offsetget", &retval, offset); + + zval_ptr_dtor(&offset); + + if (!retval) { + if (!EG(exception)) { + zend_error(E_ERROR, "Undefined offset for object of type %s used as array", ce->name); + } + return NULL; + } + + return retval; + } + return NULL; +} + +static int TWIG_ISSET_ARRAYOBJECT_ELEMENT(zval *object, zval *offset TSRMLS_DC) +{ + zend_class_entry *ce = Z_OBJCE_P(object); + zval *retval; + + if (Z_TYPE_P(object) == IS_OBJECT) { + SEPARATE_ARG_IF_REF(offset); + zend_call_method_with_1_params(&object, ce, NULL, "offsetexists", &retval, offset); + + zval_ptr_dtor(&offset); + + if (!retval) { + if (!EG(exception)) { + zend_error(E_ERROR, "Undefined offset for object of type %s used as array", ce->name); + } + return 0; + } + + return (retval && Z_TYPE_P(retval) == IS_BOOL && Z_LVAL_P(retval)); + } + return 0; +} + +static char *TWIG_STRTOLOWER(const char *str, int str_len) +{ + char *item_dup; + + item_dup = estrndup(str, str_len); + php_strtolower(item_dup, str_len); + return item_dup; +} + +static zval *TWIG_CALL_USER_FUNC_ARRAY(zval *object, char *function, zval *arguments TSRMLS_DC) +{ + zend_fcall_info fci; + zval ***args = NULL; + int arg_count = 0; + HashTable *table; + HashPosition pos; + int i = 0; + zval *retval_ptr; + zval *zfunction; + + if (arguments) { + table = HASH_OF(arguments); + args = safe_emalloc(sizeof(zval **), table->nNumOfElements, 0); + + zend_hash_internal_pointer_reset_ex(table, &pos); + + while (zend_hash_get_current_data_ex(table, (void **)&args[i], &pos) == SUCCESS) { + i++; + zend_hash_move_forward_ex(table, &pos); + } + arg_count = table->nNumOfElements; + } + + MAKE_STD_ZVAL(zfunction); + ZVAL_STRING(zfunction, function, 1); + fci.size = sizeof(fci); + fci.function_table = EG(function_table); + fci.function_name = zfunction; + fci.symbol_table = NULL; +#if PHP_VERSION_ID >= 50300 + fci.object_ptr = object; +#else + fci.object_pp = &object; +#endif + fci.retval_ptr_ptr = &retval_ptr; + fci.param_count = arg_count; + fci.params = args; + fci.no_separation = 0; + + if (zend_call_function(&fci, NULL TSRMLS_CC) == FAILURE) { + ALLOC_INIT_ZVAL(retval_ptr); + ZVAL_BOOL(retval_ptr, 0); + } + + if (args) { + efree(fci.params); + } + FREE_DTOR(zfunction); + return retval_ptr; +} + +static int TWIG_CALL_BOOLEAN(zval *object, char *functionName TSRMLS_DC) +{ + zval *ret; + int res; + + ret = TWIG_CALL_USER_FUNC_ARRAY(object, functionName, NULL TSRMLS_CC); + res = Z_LVAL_P(ret); + zval_ptr_dtor(&ret); + return res; +} + +static zval *TWIG_GET_STATIC_PROPERTY(zval *class, char *prop_name TSRMLS_DC) +{ + zval **tmp_zval; + zend_class_entry *ce; + + if (class == NULL || Z_TYPE_P(class) != IS_OBJECT) { + return NULL; + } + + ce = zend_get_class_entry(class TSRMLS_CC); +#if PHP_VERSION_ID >= 50400 + tmp_zval = zend_std_get_static_property(ce, prop_name, strlen(prop_name), 0, NULL TSRMLS_CC); +#else + tmp_zval = zend_std_get_static_property(ce, prop_name, strlen(prop_name), 0 TSRMLS_CC); +#endif + return *tmp_zval; +} + +static zval *TWIG_GET_ARRAY_ELEMENT_ZVAL(zval *class, zval *prop_name TSRMLS_DC) +{ + zval **tmp_zval; + + if (class == NULL || Z_TYPE_P(class) != IS_ARRAY) { + if (class != NULL && Z_TYPE_P(class) == IS_OBJECT && TWIG_INSTANCE_OF(class, zend_ce_arrayaccess TSRMLS_CC)) { + // array access object + return TWIG_GET_ARRAYOBJECT_ELEMENT(class, prop_name TSRMLS_CC); + } + return NULL; + } + + switch(Z_TYPE_P(prop_name)) { + case IS_NULL: + zend_hash_find(HASH_OF(class), "", 1, (void**) &tmp_zval); + return *tmp_zval; + + case IS_BOOL: + case IS_DOUBLE: + convert_to_long(prop_name); + case IS_LONG: + zend_hash_index_find(HASH_OF(class), Z_LVAL_P(prop_name), (void **) &tmp_zval); + return *tmp_zval; + + case IS_STRING: + zend_symtable_find(HASH_OF(class), Z_STRVAL_P(prop_name), Z_STRLEN_P(prop_name) + 1, (void**) &tmp_zval); + return *tmp_zval; + } + + return NULL; +} + +static zval *TWIG_GET_ARRAY_ELEMENT(zval *class, char *prop_name, int prop_name_length TSRMLS_DC) +{ + zval **tmp_zval; + + if (class == NULL/* || Z_TYPE_P(class) != IS_ARRAY*/) { + return NULL; + } + + if (class != NULL && Z_TYPE_P(class) == IS_OBJECT && TWIG_INSTANCE_OF(class, zend_ce_arrayaccess TSRMLS_CC)) { + // array access object + zval *tmp_name_zval; + zval *tmp_ret_zval; + + ALLOC_INIT_ZVAL(tmp_name_zval); + ZVAL_STRING(tmp_name_zval, prop_name, 1); + tmp_ret_zval = TWIG_GET_ARRAYOBJECT_ELEMENT(class, tmp_name_zval TSRMLS_CC); + FREE_DTOR(tmp_name_zval); + return tmp_ret_zval; + } + + if (zend_symtable_find(HASH_OF(class), prop_name, prop_name_length+1, (void**)&tmp_zval) == SUCCESS) { + return *tmp_zval; + } + return NULL; +} + +static zval *TWIG_PROPERTY(zval *object, zval *propname TSRMLS_DC) +{ + zval *tmp = NULL; + + if (Z_OBJ_HT_P(object)->read_property) { +#if PHP_VERSION_ID >= 50400 + tmp = Z_OBJ_HT_P(object)->read_property(object, propname, BP_VAR_IS, NULL TSRMLS_CC); +#else + tmp = Z_OBJ_HT_P(object)->read_property(object, propname, BP_VAR_IS TSRMLS_CC); +#endif + if (tmp == EG(uninitialized_zval_ptr)) { + ZVAL_NULL(tmp); + } + } + return tmp; +} + +static int TWIG_HAS_PROPERTY(zval *object, zval *propname TSRMLS_DC) +{ + if (Z_OBJ_HT_P(object)->has_property) { +#if PHP_VERSION_ID >= 50400 + return Z_OBJ_HT_P(object)->has_property(object, propname, 0, NULL TSRMLS_CC); +#else + return Z_OBJ_HT_P(object)->has_property(object, propname, 0 TSRMLS_CC); +#endif + } + return 0; +} + +static int TWIG_HAS_DYNAMIC_PROPERTY(zval *object, char *prop, int prop_len TSRMLS_DC) +{ + if (Z_OBJ_HT_P(object)->get_properties) { + return zend_hash_quick_exists( + Z_OBJ_HT_P(object)->get_properties(object TSRMLS_CC), // the properties hash + prop, // property name + prop_len + 1, // property length + zend_get_hash_value(prop, prop_len + 1) // hash value + ); + } + return 0; +} + +static zval *TWIG_PROPERTY_CHAR(zval *object, char *propname TSRMLS_DC) +{ + zval *tmp_name_zval, *tmp; + + ALLOC_INIT_ZVAL(tmp_name_zval); + ZVAL_STRING(tmp_name_zval, propname, 1); + tmp = TWIG_PROPERTY(object, tmp_name_zval TSRMLS_CC); + FREE_DTOR(tmp_name_zval); + return tmp; +} + +static zval *TWIG_CALL_S(zval *object, char *method, char *arg0 TSRMLS_DC) +{ + zend_fcall_info fci; + zval **args[1]; + zval *argument; + zval *zfunction; + zval *retval_ptr; + + MAKE_STD_ZVAL(argument); + ZVAL_STRING(argument, arg0, 1); + args[0] = &argument; + + MAKE_STD_ZVAL(zfunction); + ZVAL_STRING(zfunction, method, 1); + fci.size = sizeof(fci); + fci.function_table = EG(function_table); + fci.function_name = zfunction; + fci.symbol_table = NULL; +#if PHP_VERSION_ID >= 50300 + fci.object_ptr = object; +#else + fci.object_pp = &object; +#endif + fci.retval_ptr_ptr = &retval_ptr; + fci.param_count = 1; + fci.params = args; + fci.no_separation = 0; + + if (zend_call_function(&fci, NULL TSRMLS_CC) == FAILURE) { + FREE_DTOR(zfunction); + zval_ptr_dtor(&argument); + return 0; + } + FREE_DTOR(zfunction); + zval_ptr_dtor(&argument); + return retval_ptr; +} + +static int TWIG_CALL_SB(zval *object, char *method, char *arg0 TSRMLS_DC) +{ + zval *retval_ptr; + int success; + + retval_ptr = TWIG_CALL_S(object, method, arg0 TSRMLS_CC); + success = (retval_ptr && (Z_TYPE_P(retval_ptr) == IS_BOOL) && Z_LVAL_P(retval_ptr)); + + if (retval_ptr) { + zval_ptr_dtor(&retval_ptr); + } + + return success; +} + +static int TWIG_CALL_ZZ(zval *object, char *method, zval *arg1, zval *arg2 TSRMLS_DC) +{ + zend_fcall_info fci; + zval **args[2]; + zval *zfunction; + zval *retval_ptr; + int success; + + args[0] = &arg1; + args[1] = &arg2; + + MAKE_STD_ZVAL(zfunction); + ZVAL_STRING(zfunction, method, 1); + fci.size = sizeof(fci); + fci.function_table = EG(function_table); + fci.function_name = zfunction; + fci.symbol_table = NULL; +#if PHP_VERSION_ID >= 50300 + fci.object_ptr = object; +#else + fci.object_pp = &object; +#endif + fci.retval_ptr_ptr = &retval_ptr; + fci.param_count = 2; + fci.params = args; + fci.no_separation = 0; + + if (zend_call_function(&fci, NULL TSRMLS_CC) == FAILURE) { + FREE_DTOR(zfunction); + return 0; + } + + FREE_DTOR(zfunction); + + success = (retval_ptr && (Z_TYPE_P(retval_ptr) == IS_BOOL) && Z_LVAL_P(retval_ptr)); + if (retval_ptr) { + zval_ptr_dtor(&retval_ptr); + } + + return success; +} + +#ifndef Z_SET_REFCOUNT_P +# define Z_SET_REFCOUNT_P(pz, rc) pz->refcount = rc +# define Z_UNSET_ISREF_P(pz) pz->is_ref = 0 +#endif + +static void TWIG_NEW(zval *object, char *class, zval *arg0, zval *arg1 TSRMLS_DC) +{ + zend_class_entry **pce; + + if (zend_lookup_class(class, strlen(class), &pce TSRMLS_CC) == FAILURE) { + return; + } + + Z_TYPE_P(object) = IS_OBJECT; + object_init_ex(object, *pce); + Z_SET_REFCOUNT_P(object, 1); + Z_UNSET_ISREF_P(object); + + TWIG_CALL_ZZ(object, "__construct", arg0, arg1 TSRMLS_CC); +} + +static int twig_add_array_key_to_string(void *pDest APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) +{ + smart_str *buf; + char *joiner; + APPLY_TSRMLS_FETCH(); + + buf = va_arg(args, smart_str*); + joiner = va_arg(args, char*); + + if (buf->len != 0) { + smart_str_appends(buf, joiner); + } + + if (hash_key->nKeyLength == 0) { + smart_str_append_long(buf, (long) hash_key->h); + } else { + char *key, *tmp_str; + int key_len, tmp_len; + key = php_addcslashes(hash_key->arKey, hash_key->nKeyLength - 1, &key_len, 0, "'\\", 2 TSRMLS_CC); + tmp_str = php_str_to_str_ex(key, key_len, "\0", 1, "' . \"\\0\" . '", 12, &tmp_len, 0, NULL); + + smart_str_appendl(buf, tmp_str, tmp_len); + efree(key); + efree(tmp_str); + } + + return 0; +} + +static char *TWIG_IMPLODE_ARRAY_KEYS(char *joiner, zval *array TSRMLS_DC) +{ + smart_str collector = { 0, 0, 0 }; + + smart_str_appendl(&collector, "", 0); + zend_hash_apply_with_arguments(HASH_OF(array) APPLY_TSRMLS_CC, twig_add_array_key_to_string, 2, &collector, joiner); + smart_str_0(&collector); + + return collector.c; +} + +static void TWIG_RUNTIME_ERROR(zval *template TSRMLS_DC, char *message, ...) +{ + char *buffer; + va_list args; + zend_class_entry **pce; + zval *ex; + zval *constructor; + zval *zmessage; + zval *lineno; + zval *filename_func; + zval *filename; + zval *constructor_args[3]; + zval *constructor_retval; + + if (zend_lookup_class("Twig_Error_Runtime", strlen("Twig_Error_Runtime"), &pce TSRMLS_CC) == FAILURE) { + return; + } + + va_start(args, message); + vspprintf(&buffer, 0, message, args); + va_end(args); + + MAKE_STD_ZVAL(ex); + object_init_ex(ex, *pce); + + // Call Twig_Error constructor + MAKE_STD_ZVAL(constructor); + MAKE_STD_ZVAL(zmessage); + MAKE_STD_ZVAL(lineno); + MAKE_STD_ZVAL(filename); + MAKE_STD_ZVAL(filename_func); + MAKE_STD_ZVAL(constructor_retval); + + ZVAL_STRINGL(constructor, "__construct", sizeof("__construct")-1, 1); + ZVAL_STRING(zmessage, buffer, 1); + ZVAL_LONG(lineno, -1); + + // Get template filename + ZVAL_STRINGL(filename_func, "getTemplateName", sizeof("getTemplateName")-1, 1); + call_user_function(EG(function_table), &template, filename_func, filename, 0, 0 TSRMLS_CC); + + constructor_args[0] = zmessage; + constructor_args[1] = lineno; + constructor_args[2] = filename; + call_user_function(EG(function_table), &ex, constructor, constructor_retval, 3, constructor_args TSRMLS_CC); + + zval_ptr_dtor(&constructor_retval); + zval_ptr_dtor(&zmessage); + zval_ptr_dtor(&lineno); + zval_ptr_dtor(&filename); + FREE_DTOR(constructor); + FREE_DTOR(filename_func); + efree(buffer); + + zend_throw_exception_object(ex TSRMLS_CC); +} + +static char *TWIG_GET_CLASS_NAME(zval *object TSRMLS_DC) +{ + char *class_name; + zend_uint class_name_len; + + if (Z_TYPE_P(object) != IS_OBJECT) { + return ""; + } +#if PHP_API_VERSION >= 20100412 + zend_get_object_classname(object, (const char **) &class_name, &class_name_len TSRMLS_CC); +#else + zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC); +#endif + return class_name; +} + +static int twig_add_method_to_class(void *pDest APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) +{ + zend_class_entry *ce; + zval *retval; + char *item; + size_t item_len; + zend_function *mptr = (zend_function *) pDest; + APPLY_TSRMLS_FETCH(); + + if (!(mptr->common.fn_flags & ZEND_ACC_PUBLIC)) { + return 0; + } + + ce = *va_arg(args, zend_class_entry**); + retval = va_arg(args, zval*); + + item_len = strlen(mptr->common.function_name); + item = estrndup(mptr->common.function_name, item_len); + php_strtolower(item, item_len); + + if (strcmp("getenvironment", item) == 0) { + zend_class_entry **twig_template_ce; + if (zend_lookup_class("Twig_Template", strlen("Twig_Template"), &twig_template_ce TSRMLS_CC) == FAILURE) { + return 0; + } + if (instanceof_function(ce, *twig_template_ce TSRMLS_CC)) { + return 0; + } + } + + add_assoc_stringl_ex(retval, item, item_len+1, item, item_len, 0); + + return 0; +} + +static int twig_add_property_to_class(void *pDest APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) +{ + zend_class_entry *ce; + zval *retval; + char *class_name, *prop_name; + zend_property_info *pptr = (zend_property_info *) pDest; + APPLY_TSRMLS_FETCH(); + + if (!(pptr->flags & ZEND_ACC_PUBLIC) || (pptr->flags & ZEND_ACC_STATIC)) { + return 0; + } + + ce = *va_arg(args, zend_class_entry**); + retval = va_arg(args, zval*); + +#if PHP_API_VERSION >= 20100412 + zend_unmangle_property_name(pptr->name, pptr->name_length, (const char **) &class_name, (const char **) &prop_name); +#else + zend_unmangle_property_name(pptr->name, pptr->name_length, &class_name, &prop_name); +#endif + + add_assoc_string(retval, prop_name, prop_name, 1); + + return 0; +} + +static void twig_add_class_to_cache(zval *cache, zval *object, char *class_name TSRMLS_DC) +{ + zval *class_info, *class_methods, *class_properties; + zend_class_entry *class_ce; + + class_ce = zend_get_class_entry(object TSRMLS_CC); + + ALLOC_INIT_ZVAL(class_info); + ALLOC_INIT_ZVAL(class_methods); + ALLOC_INIT_ZVAL(class_properties); + array_init(class_info); + array_init(class_methods); + array_init(class_properties); + // add all methods to self::cache[$class]['methods'] + zend_hash_apply_with_arguments(&class_ce->function_table APPLY_TSRMLS_CC, twig_add_method_to_class, 2, &class_ce, class_methods); + zend_hash_apply_with_arguments(&class_ce->properties_info APPLY_TSRMLS_CC, twig_add_property_to_class, 2, &class_ce, class_properties); + + add_assoc_zval(class_info, "methods", class_methods); + add_assoc_zval(class_info, "properties", class_properties); + add_assoc_zval(cache, class_name, class_info); +} + +/* {{{ proto mixed twig_template_get_attributes(TwigTemplate template, mixed object, mixed item, array arguments, string type, boolean isDefinedTest, boolean ignoreStrictCheck) + A C implementation of TwigTemplate::getAttribute() */ +PHP_FUNCTION(twig_template_get_attributes) +{ + zval *template; + zval *object; + char *item; + int item_len; + zval *zitem, ztmpitem; + zval *arguments = NULL; + zval *ret = NULL; + char *type = NULL; + int type_len = 0; + zend_bool isDefinedTest = 0; + zend_bool ignoreStrictCheck = 0; + int free_ret = 0; + zval *tmp_self_cache; + char *class_name = NULL; + zval *tmp_class; + char *type_name; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ozz|asbb", &template, &object, &zitem, &arguments, &type, &type_len, &isDefinedTest, &ignoreStrictCheck) == FAILURE) { + return; + } + + // convert the item to a string + ztmpitem = *zitem; + zval_copy_ctor(&ztmpitem); + convert_to_string(&ztmpitem); + item_len = Z_STRLEN(ztmpitem); + item = estrndup(Z_STRVAL(ztmpitem), item_len); + zval_dtor(&ztmpitem); + + if (!type) { + type = "any"; + } + +/* + // array + if (Twig_Template::METHOD_CALL !== $type) { + $arrayItem = is_bool($item) || is_float($item) ? (int) $item : $item; + + if ((is_array($object) && array_key_exists($arrayItem, $object)) + || ($object instanceof ArrayAccess && isset($object[$arrayItem])) + ) { + if ($isDefinedTest) { + return true; + } + + return $object[$arrayItem]; + } +*/ + + + if (strcmp("method", type) != 0) { + if ((TWIG_ARRAY_KEY_EXISTS(object, zitem)) + || (TWIG_INSTANCE_OF(object, zend_ce_arrayaccess TSRMLS_CC) && TWIG_ISSET_ARRAYOBJECT_ELEMENT(object, zitem TSRMLS_CC)) + ) { + + if (isDefinedTest) { + efree(item); + RETURN_TRUE; + } + + ret = TWIG_GET_ARRAY_ELEMENT_ZVAL(object, zitem TSRMLS_CC); + + if (!ret) { + ret = &EG(uninitialized_zval); + } + RETVAL_ZVAL(ret, 1, 0); + if (free_ret) { + zval_ptr_dtor(&ret); + } + efree(item); + return; + } +/* + if (Twig_Template::ARRAY_CALL === $type) { + if ($isDefinedTest) { + return false; + } + if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { + return null; + } +*/ + if (strcmp("array", type) == 0 || Z_TYPE_P(object) != IS_OBJECT) { + if (isDefinedTest) { + efree(item); + RETURN_FALSE; + } + if (ignoreStrictCheck || !TWIG_CALL_BOOLEAN(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "isStrictVariables" TSRMLS_CC)) { + efree(item); + return; + } +/* + if ($object instanceof ArrayAccess) { + $message = sprintf('Key "%s" in object with ArrayAccess of class "%s" does not exist', $arrayItem, get_class($object)); + } elseif (is_object($object)) { + $message = sprintf('Impossible to access a key "%s" on an object of class "%s" that does not implement ArrayAccess interface', $item, get_class($object)); + } elseif (is_array($object)) { + if (empty($object)) { + $message = sprintf('Key "%s" does not exist as the array is empty', $arrayItem); + } else { + $message = sprintf('Key "%s" for array with keys "%s" does not exist', $arrayItem, implode(', ', array_keys($object))); + } + } elseif (Twig_Template::ARRAY_CALL === $type) { + if (null === $object) { + $message = sprintf('Impossible to access a key ("%s") on a null variable', $item); + } else { + $message = sprintf('Impossible to access a key ("%s") on a %s variable ("%s")', $item, gettype($object), $object); + } + } elseif (null === $object) { + $message = sprintf('Impossible to access an attribute ("%s") on a null variable', $item); + } else { + $message = sprintf('Impossible to access an attribute ("%s") on a %s variable ("%s")', $item, gettype($object), $object); + } + throw new Twig_Error_Runtime($message, -1, $this->getTemplateName()); + } + } +*/ + if (TWIG_INSTANCE_OF(object, zend_ce_arrayaccess TSRMLS_CC)) { + TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Key \"%s\" in object with ArrayAccess of class \"%s\" does not exist", item, TWIG_GET_CLASS_NAME(object TSRMLS_CC)); + } else if (Z_TYPE_P(object) == IS_OBJECT) { + TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Impossible to access a key \"%s\" on an object of class \"%s\" that does not implement ArrayAccess interface", item, TWIG_GET_CLASS_NAME(object TSRMLS_CC)); + } else if (Z_TYPE_P(object) == IS_ARRAY) { + if (0 == zend_hash_num_elements(Z_ARRVAL_P(object))) { + TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Key \"%s\" does not exist as the array is empty", item); + } else { + char *array_keys = TWIG_IMPLODE_ARRAY_KEYS(", ", object TSRMLS_CC); + TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Key \"%s\" for array with keys \"%s\" does not exist", item, array_keys); + efree(array_keys); + } + } else { + char *type_name = zend_zval_type_name(object); + Z_ADDREF_P(object); + if (Z_TYPE_P(object) == IS_NULL) { + convert_to_string(object); + TWIG_RUNTIME_ERROR(template TSRMLS_CC, + (strcmp("array", type) == 0) + ? "Impossible to access a key (\"%s\") on a %s variable" + : "Impossible to access an attribute (\"%s\") on a %s variable", + item, type_name); + } else { + convert_to_string(object); + TWIG_RUNTIME_ERROR(template TSRMLS_CC, + (strcmp("array", type) == 0) + ? "Impossible to access a key (\"%s\") on a %s variable (\"%s\")" + : "Impossible to access an attribute (\"%s\") on a %s variable (\"%s\")", + item, type_name, Z_STRVAL_P(object)); + } + zval_ptr_dtor(&object); + } + efree(item); + return; + } + } + +/* + if (!is_object($object)) { + if ($isDefinedTest) { + return false; + } +*/ + + if (Z_TYPE_P(object) != IS_OBJECT) { + if (isDefinedTest) { + efree(item); + RETURN_FALSE; + } +/* + if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { + return null; + } + + if (null === $object) { + $message = sprintf('Impossible to invoke a method ("%s") on a null variable', $item); + } else { + $message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s")', $item, gettype($object), $object); + } + + throw new Twig_Error_Runtime($message, -1, $this->getTemplateName()); + } +*/ + if (ignoreStrictCheck || !TWIG_CALL_BOOLEAN(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "isStrictVariables" TSRMLS_CC)) { + efree(item); + return; + } + + type_name = zend_zval_type_name(object); + Z_ADDREF_P(object); + if (Z_TYPE_P(object) == IS_NULL) { + convert_to_string_ex(&object); + + TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Impossible to invoke a method (\"%s\") on a %s variable", item, type_name); + } else { + convert_to_string_ex(&object); + + TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Impossible to invoke a method (\"%s\") on a %s variable (\"%s\")", item, type_name, Z_STRVAL_P(object)); + } + + zval_ptr_dtor(&object); + efree(item); + return; + } +/* + $class = get_class($object); +*/ + + class_name = TWIG_GET_CLASS_NAME(object TSRMLS_CC); + tmp_self_cache = TWIG_GET_STATIC_PROPERTY(template, "cache" TSRMLS_CC); + tmp_class = TWIG_GET_ARRAY_ELEMENT(tmp_self_cache, class_name, strlen(class_name) TSRMLS_CC); + + if (!tmp_class) { + twig_add_class_to_cache(tmp_self_cache, object, class_name TSRMLS_CC); + tmp_class = TWIG_GET_ARRAY_ELEMENT(tmp_self_cache, class_name, strlen(class_name) TSRMLS_CC); + } + efree(class_name); + +/* + // object property + if (Twig_Template::METHOD_CALL !== $type && !$object instanceof Twig_Template) { + if (isset($object->$item) || array_key_exists((string) $item, $object)) { + if ($isDefinedTest) { + return true; + } + + if ($this->env->hasExtension('sandbox')) { + $this->env->getExtension('sandbox')->checkPropertyAllowed($object, $item); + } + + return $object->$item; + } + } +*/ + if (strcmp("method", type) != 0 && !TWIG_INSTANCE_OF_USERLAND(object, "Twig_Template" TSRMLS_CC)) { + zval *tmp_properties, *tmp_item; + + tmp_properties = TWIG_GET_ARRAY_ELEMENT(tmp_class, "properties", strlen("properties") TSRMLS_CC); + tmp_item = TWIG_GET_ARRAY_ELEMENT(tmp_properties, item, item_len TSRMLS_CC); + + if (tmp_item || TWIG_HAS_PROPERTY(object, zitem TSRMLS_CC) || TWIG_HAS_DYNAMIC_PROPERTY(object, item, item_len TSRMLS_CC)) { + if (isDefinedTest) { + efree(item); + RETURN_TRUE; + } + if (TWIG_CALL_SB(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "hasExtension", "sandbox" TSRMLS_CC)) { + TWIG_CALL_ZZ(TWIG_CALL_S(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "getExtension", "sandbox" TSRMLS_CC), "checkPropertyAllowed", object, zitem TSRMLS_CC); + } + if (EG(exception)) { + efree(item); + return; + } + + ret = TWIG_PROPERTY(object, zitem TSRMLS_CC); + efree(item); + RETURN_ZVAL(ret, 1, 0); + } + } +/* + // object method + if (!isset(self::$cache[$class]['methods'])) { + if ($object instanceof self) { + $ref = new ReflectionClass($class); + $methods = array(); + + foreach ($ref->getMethods(ReflectionMethod::IS_PUBLIC) as $refMethod) { + $methodName = strtolower($refMethod->name); + + // Accessing the environment from templates is forbidden to prevent untrusted changes to the environment + if ('getenvironment' !== $methodName) { + $methods[$methodName] = true; + } + } + + self::$cache[$class]['methods'] = $methods; + } else { + self::$cache[$class]['methods'] = array_change_key_case(array_flip(get_class_methods($object))); + } + } + + $call = false; + $lcItem = strtolower($item); + if (isset(self::$cache[$class]['methods'][$lcItem])) { + $method = (string) $item; + } elseif (isset(self::$cache[$class]['methods']['get'.$lcItem])) { + $method = 'get'.$item; + } elseif (isset(self::$cache[$class]['methods']['is'.$lcItem])) { + $method = 'is'.$item; + } elseif (isset(self::$cache[$class]['methods']['__call'])) { + $method = (string) $item; + $call = true; +*/ + { + int call = 0; + char *lcItem = TWIG_STRTOLOWER(item, item_len); + int lcItem_length; + char *method = NULL; + char *tmp_method_name_get; + char *tmp_method_name_is; + zval *zmethod; + zval *tmp_methods; + + lcItem_length = strlen(lcItem); + tmp_method_name_get = emalloc(4 + lcItem_length); + tmp_method_name_is = emalloc(3 + lcItem_length); + + sprintf(tmp_method_name_get, "get%s", lcItem); + sprintf(tmp_method_name_is, "is%s", lcItem); + + tmp_methods = TWIG_GET_ARRAY_ELEMENT(tmp_class, "methods", strlen("methods") TSRMLS_CC); + + if (TWIG_GET_ARRAY_ELEMENT(tmp_methods, lcItem, lcItem_length TSRMLS_CC)) { + method = item; + } else if (TWIG_GET_ARRAY_ELEMENT(tmp_methods, tmp_method_name_get, lcItem_length + 3 TSRMLS_CC)) { + method = tmp_method_name_get; + } else if (TWIG_GET_ARRAY_ELEMENT(tmp_methods, tmp_method_name_is, lcItem_length + 2 TSRMLS_CC)) { + method = tmp_method_name_is; + } else if (TWIG_GET_ARRAY_ELEMENT(tmp_methods, "__call", 6 TSRMLS_CC)) { + method = item; + call = 1; +/* + } else { + if ($isDefinedTest) { + return false; + } + + if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { + return null; + } + + throw new Twig_Error_Runtime(sprintf('Method "%s" for object "%s" does not exist', $item, get_class($object)), -1, $this->getTemplateName()); + } + + if ($isDefinedTest) { + return true; + } +*/ + } else { + efree(tmp_method_name_get); + efree(tmp_method_name_is); + efree(lcItem); + + if (isDefinedTest) { + efree(item); + RETURN_FALSE; + } + if (ignoreStrictCheck || !TWIG_CALL_BOOLEAN(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "isStrictVariables" TSRMLS_CC)) { + efree(item); + return; + } + TWIG_RUNTIME_ERROR(template TSRMLS_CC, "Method \"%s\" for object \"%s\" does not exist", item, TWIG_GET_CLASS_NAME(object TSRMLS_CC)); + efree(item); + return; + } + + if (isDefinedTest) { + efree(tmp_method_name_get); + efree(tmp_method_name_is); + efree(lcItem);efree(item); + RETURN_TRUE; + } +/* + if ($this->env->hasExtension('sandbox')) { + $this->env->getExtension('sandbox')->checkMethodAllowed($object, $method); + } +*/ + MAKE_STD_ZVAL(zmethod); + ZVAL_STRING(zmethod, method, 1); + if (TWIG_CALL_SB(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "hasExtension", "sandbox" TSRMLS_CC)) { + TWIG_CALL_ZZ(TWIG_CALL_S(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "getExtension", "sandbox" TSRMLS_CC), "checkMethodAllowed", object, zmethod TSRMLS_CC); + } + zval_ptr_dtor(&zmethod); + if (EG(exception)) { + efree(tmp_method_name_get); + efree(tmp_method_name_is); + efree(lcItem);efree(item); + return; + } +/* + // Some objects throw exceptions when they have __call, and the method we try + // to call is not supported. If ignoreStrictCheck is true, we should return null. + try { + $ret = call_user_func_array(array($object, $method), $arguments); + } catch (BadMethodCallException $e) { + if ($call && ($ignoreStrictCheck || !$this->env->isStrictVariables())) { + return null; + } + throw $e; + } +*/ + ret = TWIG_CALL_USER_FUNC_ARRAY(object, method, arguments TSRMLS_CC); + if (EG(exception) && TWIG_INSTANCE_OF(EG(exception), spl_ce_BadMethodCallException TSRMLS_CC)) { + if (ignoreStrictCheck || !TWIG_CALL_BOOLEAN(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "isStrictVariables" TSRMLS_CC)) { + efree(tmp_method_name_get); + efree(tmp_method_name_is); + efree(lcItem);efree(item); + zend_clear_exception(TSRMLS_C); + return; + } + } + free_ret = 1; + efree(tmp_method_name_get); + efree(tmp_method_name_is); + efree(lcItem); + } +/* + // useful when calling a template method from a template + // this is not supported but unfortunately heavily used in the Symfony profiler + if ($object instanceof Twig_TemplateInterface) { + return $ret === '' ? '' : new Twig_Markup($ret, $this->env->getCharset()); + } + + return $ret; +*/ + efree(item); + // ret can be null, if e.g. the called method throws an exception + if (ret) { + if (TWIG_INSTANCE_OF_USERLAND(object, "Twig_TemplateInterface" TSRMLS_CC)) { + if (Z_STRLEN_P(ret) != 0) { + zval *charset = TWIG_CALL_USER_FUNC_ARRAY(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "getCharset", NULL TSRMLS_CC); + TWIG_NEW(return_value, "Twig_Markup", ret, charset TSRMLS_CC); + zval_ptr_dtor(&charset); + if (ret) { + zval_ptr_dtor(&ret); + } + return; + } + } + + RETVAL_ZVAL(ret, 1, 0); + if (free_ret) { + zval_ptr_dtor(&ret); + } + } +} diff --git a/plugins/twig/vendor/twig/lib/Twig/Autoloader.php b/plugins/twig/vendor/twig/twig/lib/Twig/Autoloader.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Autoloader.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Autoloader.php diff --git a/plugins/twig/vendor/twig/lib/Twig/BaseNodeVisitor.php b/plugins/twig/vendor/twig/twig/lib/Twig/BaseNodeVisitor.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/BaseNodeVisitor.php rename to plugins/twig/vendor/twig/twig/lib/Twig/BaseNodeVisitor.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Cache/Filesystem.php b/plugins/twig/vendor/twig/twig/lib/Twig/Cache/Filesystem.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Cache/Filesystem.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Cache/Filesystem.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Cache/Null.php b/plugins/twig/vendor/twig/twig/lib/Twig/Cache/Null.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Cache/Null.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Cache/Null.php diff --git a/plugins/twig/vendor/twig/lib/Twig/CacheInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/CacheInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/CacheInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/CacheInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Compiler.php b/plugins/twig/vendor/twig/twig/lib/Twig/Compiler.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Compiler.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Compiler.php diff --git a/plugins/twig/vendor/twig/lib/Twig/CompilerInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/CompilerInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/CompilerInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/CompilerInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Environment.php b/plugins/twig/vendor/twig/twig/lib/Twig/Environment.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Environment.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Environment.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Error.php b/plugins/twig/vendor/twig/twig/lib/Twig/Error.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Error.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Error.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Error/Loader.php b/plugins/twig/vendor/twig/twig/lib/Twig/Error/Loader.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Error/Loader.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Error/Loader.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Error/Runtime.php b/plugins/twig/vendor/twig/twig/lib/Twig/Error/Runtime.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Error/Runtime.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Error/Runtime.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Error/Syntax.php b/plugins/twig/vendor/twig/twig/lib/Twig/Error/Syntax.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Error/Syntax.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Error/Syntax.php diff --git a/plugins/twig/vendor/twig/lib/Twig/ExistsLoaderInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/ExistsLoaderInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/ExistsLoaderInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/ExistsLoaderInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/ExpressionParser.php b/plugins/twig/vendor/twig/twig/lib/Twig/ExpressionParser.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/ExpressionParser.php rename to plugins/twig/vendor/twig/twig/lib/Twig/ExpressionParser.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Extension.php b/plugins/twig/vendor/twig/twig/lib/Twig/Extension.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Extension.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Extension.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Extension/Core.php b/plugins/twig/vendor/twig/twig/lib/Twig/Extension/Core.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Extension/Core.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Extension/Core.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Extension/Debug.php b/plugins/twig/vendor/twig/twig/lib/Twig/Extension/Debug.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Extension/Debug.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Extension/Debug.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Extension/Escaper.php b/plugins/twig/vendor/twig/twig/lib/Twig/Extension/Escaper.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Extension/Escaper.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Extension/Escaper.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Extension/GlobalsInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/Extension/GlobalsInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Extension/GlobalsInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Extension/GlobalsInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Extension/InitRuntimeInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/Extension/InitRuntimeInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Extension/InitRuntimeInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Extension/InitRuntimeInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Extension/Optimizer.php b/plugins/twig/vendor/twig/twig/lib/Twig/Extension/Optimizer.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Extension/Optimizer.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Extension/Optimizer.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Extension/Profiler.php b/plugins/twig/vendor/twig/twig/lib/Twig/Extension/Profiler.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Extension/Profiler.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Extension/Profiler.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Extension/Sandbox.php b/plugins/twig/vendor/twig/twig/lib/Twig/Extension/Sandbox.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Extension/Sandbox.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Extension/Sandbox.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Extension/Staging.php b/plugins/twig/vendor/twig/twig/lib/Twig/Extension/Staging.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Extension/Staging.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Extension/Staging.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Extension/StringLoader.php b/plugins/twig/vendor/twig/twig/lib/Twig/Extension/StringLoader.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Extension/StringLoader.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Extension/StringLoader.php diff --git a/plugins/twig/vendor/twig/lib/Twig/ExtensionInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/ExtensionInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/ExtensionInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/ExtensionInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/FileExtensionEscapingStrategy.php b/plugins/twig/vendor/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/FileExtensionEscapingStrategy.php rename to plugins/twig/vendor/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Filter.php b/plugins/twig/vendor/twig/twig/lib/Twig/Filter.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Filter.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Filter.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Filter/Function.php b/plugins/twig/vendor/twig/twig/lib/Twig/Filter/Function.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Filter/Function.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Filter/Function.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Filter/Method.php b/plugins/twig/vendor/twig/twig/lib/Twig/Filter/Method.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Filter/Method.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Filter/Method.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Filter/Node.php b/plugins/twig/vendor/twig/twig/lib/Twig/Filter/Node.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Filter/Node.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Filter/Node.php diff --git a/plugins/twig/vendor/twig/lib/Twig/FilterCallableInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/FilterCallableInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/FilterCallableInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/FilterCallableInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/FilterInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/FilterInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/FilterInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/FilterInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Function.php b/plugins/twig/vendor/twig/twig/lib/Twig/Function.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Function.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Function.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Function/Function.php b/plugins/twig/vendor/twig/twig/lib/Twig/Function/Function.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Function/Function.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Function/Function.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Function/Method.php b/plugins/twig/vendor/twig/twig/lib/Twig/Function/Method.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Function/Method.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Function/Method.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Function/Node.php b/plugins/twig/vendor/twig/twig/lib/Twig/Function/Node.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Function/Node.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Function/Node.php diff --git a/plugins/twig/vendor/twig/lib/Twig/FunctionCallableInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/FunctionCallableInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/FunctionCallableInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/FunctionCallableInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/FunctionInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/FunctionInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/FunctionInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/FunctionInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Lexer.php b/plugins/twig/vendor/twig/twig/lib/Twig/Lexer.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Lexer.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Lexer.php diff --git a/plugins/twig/vendor/twig/lib/Twig/LexerInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/LexerInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/LexerInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/LexerInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Loader/Array.php b/plugins/twig/vendor/twig/twig/lib/Twig/Loader/Array.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Loader/Array.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Loader/Array.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Loader/Chain.php b/plugins/twig/vendor/twig/twig/lib/Twig/Loader/Chain.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Loader/Chain.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Loader/Chain.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Loader/Filesystem.php b/plugins/twig/vendor/twig/twig/lib/Twig/Loader/Filesystem.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Loader/Filesystem.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Loader/Filesystem.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Loader/String.php b/plugins/twig/vendor/twig/twig/lib/Twig/Loader/String.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Loader/String.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Loader/String.php diff --git a/plugins/twig/vendor/twig/lib/Twig/LoaderInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/LoaderInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/LoaderInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/LoaderInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Markup.php b/plugins/twig/vendor/twig/twig/lib/Twig/Markup.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Markup.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Markup.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/AutoEscape.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/AutoEscape.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/AutoEscape.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/AutoEscape.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Block.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Block.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Block.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Block.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/BlockReference.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/BlockReference.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/BlockReference.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/BlockReference.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Body.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Body.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Body.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Body.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/CheckSecurity.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/CheckSecurity.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/CheckSecurity.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/CheckSecurity.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Do.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Do.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Do.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Do.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Embed.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Embed.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Embed.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Embed.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Array.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Array.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Array.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Array.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/AssignName.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/AssignName.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/AssignName.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/AssignName.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Add.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Add.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Add.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Add.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/And.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/And.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/And.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/And.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Concat.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Concat.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Concat.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Concat.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Div.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Div.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Div.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Div.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/EndsWith.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/EndsWith.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/EndsWith.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/EndsWith.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Equal.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Equal.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Equal.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Equal.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Greater.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Greater.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Greater.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Greater.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/In.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/In.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/In.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/In.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Less.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Less.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Less.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Less.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/LessEqual.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/LessEqual.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/LessEqual.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/LessEqual.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Matches.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Matches.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Matches.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Matches.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Mod.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mod.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Mod.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mod.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Mul.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mul.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Mul.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mul.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/NotEqual.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotEqual.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/NotEqual.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotEqual.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/NotIn.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/NotIn.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Or.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Or.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Or.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Or.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Power.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Power.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Power.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Power.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Range.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Range.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Range.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Range.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/StartsWith.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/StartsWith.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/StartsWith.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/StartsWith.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Sub.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Sub.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Binary/Sub.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Sub.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/BlockReference.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/BlockReference.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Call.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Call.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Call.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Call.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Conditional.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Conditional.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Conditional.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Conditional.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Constant.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Constant.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Constant.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Constant.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/ExtensionReference.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/ExtensionReference.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/ExtensionReference.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/ExtensionReference.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Filter.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Filter.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Filter.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Filter.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Filter/Default.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Filter/Default.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Filter/Default.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Filter/Default.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Function.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Function.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Function.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Function.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/GetAttr.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/GetAttr.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/GetAttr.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/GetAttr.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/MethodCall.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/MethodCall.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/MethodCall.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/MethodCall.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Name.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Name.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Name.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Name.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/NullCoalesce.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/NullCoalesce.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/NullCoalesce.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/NullCoalesce.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Parent.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Parent.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Parent.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Parent.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/TempName.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/TempName.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/TempName.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/TempName.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Constant.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Constant.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Constant.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Constant.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Defined.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Defined.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Divisibleby.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Divisibleby.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Divisibleby.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Divisibleby.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Even.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Even.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Even.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Even.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Null.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Null.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Null.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Null.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Odd.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Odd.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Odd.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Odd.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Sameas.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Sameas.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Test/Sameas.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Test/Sameas.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Unary.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Unary.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Unary.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Unary.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Unary/Neg.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Neg.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Unary/Neg.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Neg.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Unary/Not.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Not.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Unary/Not.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Not.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Expression/Unary/Pos.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Pos.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Expression/Unary/Pos.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Pos.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Flush.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Flush.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Flush.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Flush.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/For.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/For.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/For.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/For.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/ForLoop.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/ForLoop.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/ForLoop.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/ForLoop.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/If.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/If.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/If.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/If.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Import.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Import.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Import.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Import.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Include.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Include.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Include.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Include.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Macro.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Macro.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Macro.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Macro.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Module.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Module.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Module.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Module.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Print.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Print.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Print.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Print.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Sandbox.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Sandbox.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Sandbox.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Sandbox.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/SandboxedPrint.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/SandboxedPrint.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Set.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Set.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Set.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Set.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/SetTemp.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/SetTemp.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/SetTemp.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/SetTemp.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Spaceless.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Spaceless.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Spaceless.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Spaceless.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Node/Text.php b/plugins/twig/vendor/twig/twig/lib/Twig/Node/Text.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Node/Text.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Node/Text.php diff --git a/plugins/twig/vendor/twig/lib/Twig/NodeInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/NodeInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/NodeInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/NodeInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/NodeOutputInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/NodeOutputInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/NodeOutputInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/NodeOutputInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/NodeTraverser.php b/plugins/twig/vendor/twig/twig/lib/Twig/NodeTraverser.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/NodeTraverser.php rename to plugins/twig/vendor/twig/twig/lib/Twig/NodeTraverser.php diff --git a/plugins/twig/vendor/twig/lib/Twig/NodeVisitor/Escaper.php b/plugins/twig/vendor/twig/twig/lib/Twig/NodeVisitor/Escaper.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/NodeVisitor/Escaper.php rename to plugins/twig/vendor/twig/twig/lib/Twig/NodeVisitor/Escaper.php diff --git a/plugins/twig/vendor/twig/lib/Twig/NodeVisitor/Optimizer.php b/plugins/twig/vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/NodeVisitor/Optimizer.php rename to plugins/twig/vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php diff --git a/plugins/twig/vendor/twig/lib/Twig/NodeVisitor/SafeAnalysis.php b/plugins/twig/vendor/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/NodeVisitor/SafeAnalysis.php rename to plugins/twig/vendor/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php diff --git a/plugins/twig/vendor/twig/lib/Twig/NodeVisitor/Sandbox.php b/plugins/twig/vendor/twig/twig/lib/Twig/NodeVisitor/Sandbox.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/NodeVisitor/Sandbox.php rename to plugins/twig/vendor/twig/twig/lib/Twig/NodeVisitor/Sandbox.php diff --git a/plugins/twig/vendor/twig/lib/Twig/NodeVisitorInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/NodeVisitorInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/NodeVisitorInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/NodeVisitorInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Parser.php b/plugins/twig/vendor/twig/twig/lib/Twig/Parser.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Parser.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Parser.php diff --git a/plugins/twig/vendor/twig/lib/Twig/ParserInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/ParserInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/ParserInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/ParserInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Profiler/Dumper/Blackfire.php b/plugins/twig/vendor/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Profiler/Dumper/Blackfire.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Profiler/Dumper/Html.php b/plugins/twig/vendor/twig/twig/lib/Twig/Profiler/Dumper/Html.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Profiler/Dumper/Html.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Profiler/Dumper/Html.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Profiler/Dumper/Text.php b/plugins/twig/vendor/twig/twig/lib/Twig/Profiler/Dumper/Text.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Profiler/Dumper/Text.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Profiler/Dumper/Text.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Profiler/Node/EnterProfile.php b/plugins/twig/vendor/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Profiler/Node/EnterProfile.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Profiler/Node/EnterProfile.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Profiler/Node/LeaveProfile.php b/plugins/twig/vendor/twig/twig/lib/Twig/Profiler/Node/LeaveProfile.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Profiler/Node/LeaveProfile.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Profiler/Node/LeaveProfile.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php b/plugins/twig/vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Profiler/Profile.php b/plugins/twig/vendor/twig/twig/lib/Twig/Profiler/Profile.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Profiler/Profile.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Profiler/Profile.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Sandbox/SecurityError.php b/plugins/twig/vendor/twig/twig/lib/Twig/Sandbox/SecurityError.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Sandbox/SecurityError.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Sandbox/SecurityError.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php b/plugins/twig/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFilterError.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php b/plugins/twig/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedFunctionError.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php b/plugins/twig/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Sandbox/SecurityNotAllowedTagError.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Sandbox/SecurityPolicy.php b/plugins/twig/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicy.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Sandbox/SecurityPolicy.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicy.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/SimpleFilter.php b/plugins/twig/vendor/twig/twig/lib/Twig/SimpleFilter.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/SimpleFilter.php rename to plugins/twig/vendor/twig/twig/lib/Twig/SimpleFilter.php diff --git a/plugins/twig/vendor/twig/lib/Twig/SimpleFunction.php b/plugins/twig/vendor/twig/twig/lib/Twig/SimpleFunction.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/SimpleFunction.php rename to plugins/twig/vendor/twig/twig/lib/Twig/SimpleFunction.php diff --git a/plugins/twig/vendor/twig/lib/Twig/SimpleTest.php b/plugins/twig/vendor/twig/twig/lib/Twig/SimpleTest.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/SimpleTest.php rename to plugins/twig/vendor/twig/twig/lib/Twig/SimpleTest.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Template.php b/plugins/twig/vendor/twig/twig/lib/Twig/Template.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Template.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Template.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TemplateInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/TemplateInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TemplateInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TemplateInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Test.php b/plugins/twig/vendor/twig/twig/lib/Twig/Test.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Test.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Test.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Test/Function.php b/plugins/twig/vendor/twig/twig/lib/Twig/Test/Function.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Test/Function.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Test/Function.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Test/IntegrationTestCase.php b/plugins/twig/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Test/IntegrationTestCase.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Test/Method.php b/plugins/twig/vendor/twig/twig/lib/Twig/Test/Method.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Test/Method.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Test/Method.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Test/Node.php b/plugins/twig/vendor/twig/twig/lib/Twig/Test/Node.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Test/Node.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Test/Node.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Test/NodeTestCase.php b/plugins/twig/vendor/twig/twig/lib/Twig/Test/NodeTestCase.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Test/NodeTestCase.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Test/NodeTestCase.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TestCallableInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/TestCallableInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TestCallableInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TestCallableInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TestInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/TestInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TestInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TestInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Token.php b/plugins/twig/vendor/twig/twig/lib/Twig/Token.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Token.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Token.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/AutoEscape.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/AutoEscape.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/AutoEscape.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/AutoEscape.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Block.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Block.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Block.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Block.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Do.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Do.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Do.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Do.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Embed.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Embed.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Embed.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Embed.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Extends.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Extends.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Extends.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Extends.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Filter.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Filter.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Filter.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Filter.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Flush.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Flush.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Flush.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Flush.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/For.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/For.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/For.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/For.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/From.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/From.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/From.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/From.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/If.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/If.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/If.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/If.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Import.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Import.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Import.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Import.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Include.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Include.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Include.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Include.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Macro.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Macro.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Macro.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Macro.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Sandbox.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Sandbox.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Sandbox.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Sandbox.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Set.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Set.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Set.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Set.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Spaceless.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Spaceless.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Spaceless.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Spaceless.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParser/Use.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Use.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParser/Use.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParser/Use.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParserBroker.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParserBroker.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParserBroker.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParserBroker.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParserBrokerInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParserBrokerInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParserBrokerInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParserBrokerInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenParserInterface.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenParserInterface.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenParserInterface.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenParserInterface.php diff --git a/plugins/twig/vendor/twig/lib/Twig/TokenStream.php b/plugins/twig/vendor/twig/twig/lib/Twig/TokenStream.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/TokenStream.php rename to plugins/twig/vendor/twig/twig/lib/Twig/TokenStream.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Util/DeprecationCollector.php b/plugins/twig/vendor/twig/twig/lib/Twig/Util/DeprecationCollector.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Util/DeprecationCollector.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Util/DeprecationCollector.php diff --git a/plugins/twig/vendor/twig/lib/Twig/Util/TemplateDirIterator.php b/plugins/twig/vendor/twig/twig/lib/Twig/Util/TemplateDirIterator.php similarity index 100% rename from plugins/twig/vendor/twig/lib/Twig/Util/TemplateDirIterator.php rename to plugins/twig/vendor/twig/twig/lib/Twig/Util/TemplateDirIterator.php diff --git a/plugins/twig/vendor/twig/twig/phpunit.xml.dist b/plugins/twig/vendor/twig/twig/phpunit.xml.dist new file mode 100644 index 00000000..6f6d1d25 --- /dev/null +++ b/plugins/twig/vendor/twig/twig/phpunit.xml.dist @@ -0,0 +1,25 @@ + + + + + + ./test/Twig/ + + + + + + ./lib/Twig/ + + + diff --git a/system/Application.php b/system/Application.php index 1161beff..76f72c5b 100644 --- a/system/Application.php +++ b/system/Application.php @@ -156,7 +156,7 @@ private function init() $route = $DI['Request']->getRoute(); - $page = false; ##$DI['Cache\PageCache']->get($route); + $page = false; if (false === $page) { @@ -168,10 +168,6 @@ private function init() $page->load($path); Hook::trigger(Hook::ACTION, 'pageLoaded', $page); - - if (empty($menuItem->nocache)) { - ##$DI['Cache\PageCache']->set($path, $page); - } } } catch (\Exception $e) { diff --git a/system/Cache/AbstractCache.php b/system/Cache/AbstractCache.php new file mode 100644 index 00000000..c43876eb --- /dev/null +++ b/system/Cache/AbstractCache.php @@ -0,0 +1,93 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Herbie\Cache; + +abstract class AbstractCache implements CacheInterface +{ + + /** + * @var boolean + */ + protected $enable; + + /** + * @var string + */ + protected $dir; + + /** + * @var int + */ + protected $expire; + + /** + * @param array $options + */ + public function __construct(array $options = []) + { + $this->enable = null; + $this->dir = null; + $this->expire = 60 * 60 * 24; + $this->setOptions($options); + } + + /** + * @param array $options + */ + public function setOptions(array $options) + { + foreach ($options as $key => $value) { + $this->$key = $value; + } + } + + /** + * @param string $id + * @return mixed|boolean + */ + public function get($id) + { + $filename = $this->makeFilename($id); + if (file_exists($filename) && (time() - $this->expire < filemtime($filename))) { + $serialized = file_get_contents($filename); + return unserialize($serialized); + } + return false; + } + + /** + * @param string $id + * @param mixed $value + * @return boolean + * @throws \Exception + */ + public function set($id, $value) + { + $filename = $this->makeFilename($id); + $written = file_put_contents($filename, serialize($value)); + if ($written === false) { + throw new \Exception('Could not write to data cache file', 500); + } + return true; + } + + /** + * @param string $id + * @return string + */ + protected function makeFilename($id) + { + $id = md5($id); + return sprintf('%s/%s.%s', $this->dir, $id, 'cache'); + } + +} diff --git a/system/Cache/DataCache.php b/system/Cache/DataCache.php index 3e51e174..b81e3e9a 100644 --- a/system/Cache/DataCache.php +++ b/system/Cache/DataCache.php @@ -11,83 +11,7 @@ namespace Herbie\Cache; -class DataCache implements CacheInterface +class DataCache extends AbstractCache implements CacheInterface { - /** - * @var boolean - */ - protected $enable; - - /** - * @var string - */ - protected $dir; - - /** - * @var int - */ - protected $expire; - - /** - * @param array $options - */ - public function __construct(array $options = []) - { - $this->enable = null; - $this->dir = null; - $this->expire = 60 * 60 * 24; - $this->setOptions($options); - } - - /** - * @param array $options - */ - public function setOptions(array $options) - { - foreach ($options as $key => $value) { - $this->$key = $value; - } - } - - /** - * @param string $id - * @return mixed|boolean - */ - public function get($id) - { - $filename = $this->makeFilename($id); - if (file_exists($filename) && (time() - $this->expire < filemtime($filename))) { - $serialized = file_get_contents($filename); - return unserialize($serialized); - } - return false; - } - - /** - * @param string $id - * @param mixed $value - * @return boolean - * @throws \Exception - */ - public function set($id, $value) - { - $filename = $this->makeFilename($id); - $written = file_put_contents($filename, serialize($value)); - if ($written === false) { - throw new \Exception('Could not write to data cache file', 500); - } - return true; - } - - /** - * @param string $id - * @return string - */ - protected function makeFilename($id) - { - $id = md5($id); - return sprintf('%s/%s.%s', $this->dir, $id, 'cache'); - } - } diff --git a/system/Cache/FilesystemCache.php b/system/Cache/FilesystemCache.php index 8f427882..0de34063 100644 --- a/system/Cache/FilesystemCache.php +++ b/system/Cache/FilesystemCache.php @@ -11,83 +11,7 @@ namespace Herbie\Cache; -class FilesystemCache implements CacheInterface +class FilesystemCache extends AbstractCache implements CacheInterface { - /** - * @var boolean - */ - protected $enable; - - /** - * @var string - */ - protected $dir; - - /** - * @var int - */ - protected $expire; - - /** - * @param array $options - */ - public function __construct(array $options = []) - { - $this->enable = null; - $this->dir = null; - $this->expire = 60 * 60 * 24; - $this->setOptions($options); - } - - /** - * @param array $options - */ - public function setOptions(array $options) - { - foreach ($options as $key => $value) { - $this->$key = $value; - } - } - - /** - * @param string $id - * @return mixed|boolean - */ - public function get($id) - { - $filename = $this->makeFilename($id); - if (file_exists($filename) && (time() - $this->expire < filemtime($filename))) { - $serialized = file_get_contents($filename); - return unserialize($serialized); - } - return false; - } - - /** - * @param string $id - * @param mixed $value - * @return boolean - * @throws \Exception - */ - public function set($id, $value) - { - $filename = $this->makeFilename($id); - $written = file_put_contents($filename, serialize($value)); - if ($written === false) { - throw new \Exception('Could not write to data cache file', 500); - } - return true; - } - - /** - * @param string $id - * @return string - */ - protected function makeFilename($id) - { - $id = md5($id); - return sprintf('%s/%s.%s', $this->dir, $id, 'cache'); - } - } diff --git a/system/Config.php b/system/Config.php index 6e386a8a..dae09e8b 100644 --- a/system/Config.php +++ b/system/Config.php @@ -57,15 +57,12 @@ public function __construct($sitePath, $webPath, $webUrl) private function loadConfig($useCache = true) { if ($useCache) { - #$cacheFile = $this->sitePath . '/cache/config.json'; $cacheFile = $this->sitePath . '/cache/config.php'; if (is_file($cacheFile)) { - #$this->items = json_decode(file_get_contents($cacheFile), true); $this->items = require($cacheFile); } else { $this->loadMainFile(); $this->loadPluginFiles(); - #file_put_contents($cacheFile, json_encode($this->items)); file_put_contents($cacheFile, 'items, true).';'); } } else { diff --git a/system/Finder/Finder.php b/system/Finder/Finder.php index b1c2f2e1..35eca1ef 100644 --- a/system/Finder/Finder.php +++ b/system/Finder/Finder.php @@ -118,7 +118,7 @@ public function getIterator() } if ($this->minDepth > -1 || $this->maxDepth < PHP_INT_MAX) { - #$iterator = new DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth); + $iterator = new DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth); } return $iterator; diff --git a/system/Finder/SplFileInfo.php b/system/Finder/SplFileInfo.php index b887e635..cf05f775 100644 --- a/system/Finder/SplFileInfo.php +++ b/system/Finder/SplFileInfo.php @@ -11,70 +11,7 @@ namespace Herbie\Finder; -class SplFileInfo extends \SplFileInfo +class SplFileInfo extends \Herbie\SplFileInfo { - private $relativePath; - private $relativePathname; - - /** - * Constructor - * - * @param string $file - * @param string $relativePath - * @param string $relativePathname - */ - public function __construct($file, $relativePath, $relativePathname) - { - parent::__construct($file); - $this->relativePath = $relativePath; - $this->relativePathname = $relativePathname; - } - - /** - * Returns the relative path - * - * @return string - */ - public function getRelativePath() - { - return $this->relativePath; - } - - /** - * Returns the relative path name - * - * @return string - */ - public function getRelativePathname() - { - return $this->relativePathname; - } - - /** - * @return bool - */ - public function isDot() - { - return in_array($this->getBasename(), ['.', '..']); - } - - /** - * Returns the contents of the file - * - * @return string - * - * @throws \RuntimeException - */ - public function getContents() - { - $level = error_reporting(0); - $content = file_get_contents($this->getPathname()); - error_reporting($level); - if (false === $content) { - $error = error_get_last(); - throw new \RuntimeException($error['message']); - } - - return $content; - } + } diff --git a/system/Helper/PageHelper.php b/system/Helper/PageHelper.php index 7880e7b1..a1453f3d 100644 --- a/system/Helper/PageHelper.php +++ b/system/Helper/PageHelper.php @@ -46,19 +46,16 @@ public static function updateSegments($filepath, array $segments) if (array_key_exists(0, $segments)) { $newContent .= PHP_EOL; $newContent .= $segments[0]; - #$newContent .= PHP_EOL; unset($segments[0]); } if (array_key_exists('', $segments)) { $newContent .= PHP_EOL; $newContent .= $segments['']; - #$newContent .= PHP_EOL; unset($segments['']); } foreach ($segments as $key => $value) { $newContent .= PHP_EOL . '--- ' . $key . ' ---' . PHP_EOL; $newContent .= $value; - #$newContent .= PHP_EOL; } return file_put_contents($filepath, $newContent); diff --git a/system/Helper/PathHelper.php b/system/Helper/PathHelper.php new file mode 100644 index 00000000..9e5c40fa --- /dev/null +++ b/system/Helper/PathHelper.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Herbie\Helper; + +class PathHelper +{ + /** + * @param string $path + * @return string + */ + public static function extractDateFromPath($path) + { + $filename = basename($path); + if(preg_match('/^([0-9]{4}-[0-9]{2}-[0-9]{2}).*$/', $filename, $matches)) { + return $matches[1]; + } + return null; + } +} diff --git a/system/Http/Request.php b/system/Http/Request.php old mode 100755 new mode 100644 diff --git a/system/Http/Response.php b/system/Http/Response.php old mode 100755 new mode 100644 diff --git a/system/Iterator/SplFileInfo.php b/system/Iterator/SplFileInfo.php index 32feec4f..6dc12a78 100644 --- a/system/Iterator/SplFileInfo.php +++ b/system/Iterator/SplFileInfo.php @@ -11,70 +11,7 @@ namespace Herbie\Iterator; -class SplFileInfo extends \SplFileInfo +class SplFileInfo extends \Herbie\SplFileInfo { - private $relativePath; - private $relativePathname; - /** - * Constructor - * - * @param string $file The file name - * @param string $relativePath The relative path - * @param string $relativePathname The relative path name - */ - public function __construct($file, $relativePath, $relativePathname) - { - parent::__construct($file); - $this->relativePath = $relativePath; - $this->relativePathname = $relativePathname; - } - - /** - * Returns the relative path - * - * @return string the relative path - */ - public function getRelativePath() - { - return $this->relativePath; - } - - /** - * Returns the relative path name - * - * @return string the relative path name - */ - public function getRelativePathname() - { - return $this->relativePathname; - } - - /** - * @return bool - */ - public function isDot() - { - return in_array($this->getBasename(), ['.', '..']); - } - - /** - * Returns the contents of the file - * - * @return string the contents of the file - * - * @throws \RuntimeException - */ - public function getContents() - { - $level = error_reporting(0); - $content = file_get_contents($this->getPathname()); - error_reporting($level); - if (false === $content) { - $error = error_get_last(); - throw new \RuntimeException($error['message']); - } - - return $content; - } } diff --git a/system/Loader/PageLoader.php b/system/Loader/PageLoader.php index 76d4c0a1..de55c422 100644 --- a/system/Loader/PageLoader.php +++ b/system/Loader/PageLoader.php @@ -45,7 +45,7 @@ public function load($alias, $addDefFields = true) $data = (array) Yaml::parse($yaml); if ($addDefFields) { $data['format'] = isset($data['format']) ? $data['format'] : pathinfo($alias, PATHINFO_EXTENSION); - $data['date'] = isset($data['date']) ? $data['date'] : $this->extractDateFromPath($alias); + $data['date'] = isset($data['date']) ? $data['date'] : \Herbie\Helper\PathHelper::extractDateFromPath($alias); $data['path'] = isset($data['path']) ? $data['path'] : $alias; } return [ @@ -119,7 +119,8 @@ protected function parseContent($content) } $segments[] = array_shift($splitted); - for ($i=0; $iitems, $key)); } if (is_string($key) && is_scalar($value)) { - return new static(array_filter($this->items, function($val) use ($key, $value) { + return new static(array_filter($this->items, function(\stdClass $val) use ($key, $value) { if ($val->{$key} == $value) { return true; } @@ -149,7 +149,7 @@ public function sort($mixed = null, $direction = 'asc') } $field = is_string($mixed) ? $mixed : 'title'; - uasort($items, function($a, $b) use ($field, $direction) { + uasort($items, function(\stdClass $a, \stdClass $b) use ($field, $direction) { if ($a->{$field} == $b->{$field}) { return 0; } diff --git a/system/Menu/Page/FileFilterCallback.php b/system/Menu/Page/FileFilterCallback.php index 0a5ddc87..7d819627 100644 --- a/system/Menu/Page/FileFilterCallback.php +++ b/system/Menu/Page/FileFilterCallback.php @@ -34,7 +34,7 @@ public function __construct($extensions) * @param \RecursiveDirectoryIterator $iterator * @return boolean */ - public function call(\SplFileInfo $file, $path, \RecursiveDirectoryIterator $iterator) + public function call(\SplFileInfo $file) { $firstChar = substr($file->getFileName(), 0, 1); if (in_array($firstChar, ['.', '_'])) { diff --git a/system/Menu/Page/Iterator/FilterCallback.php b/system/Menu/Page/Iterator/FilterCallback.php index 867bb311..dcdecb1c 100644 --- a/system/Menu/Page/Iterator/FilterCallback.php +++ b/system/Menu/Page/Iterator/FilterCallback.php @@ -24,7 +24,7 @@ public function __construct(array $routeLine) $this->routeLine = $routeLine; } - public function call($current, $key, $iterator) + public function call(\Herbie\Menu\Page\Node $current) { $menuItem = $current->getMenuItem(); diff --git a/system/Menu/Page/Iterator/SortableIterator.php b/system/Menu/Page/Iterator/SortableIterator.php index 56e03891..03079a03 100644 --- a/system/Menu/Page/Iterator/SortableIterator.php +++ b/system/Menu/Page/Iterator/SortableIterator.php @@ -39,11 +39,11 @@ public function __construct(\Traversable $iterator, $sort) $this->iterator = $iterator; if (self::SORT_BY_NAME === $sort) { - $this->sort = function ($a, $b) { + $this->sort = function (\Herbie\Iterator\SplFileInfo $a, \Herbie\Iterator\SplFileInfo $b) { return strcmp($a->getRealpath(), $b->getRealpath()); }; } elseif (self::SORT_BY_TYPE === $sort) { - $this->sort = function ($a, $b) { + $this->sort = function (\Herbie\Iterator\SplFileInfo $a, \Herbie\Iterator\SplFileInfo $b) { if ($a->isDir() && $b->isFile()) { return -1; } elseif ($a->isFile() && $b->isDir()) { @@ -52,15 +52,15 @@ public function __construct(\Traversable $iterator, $sort) return strcmp($a->getRealpath(), $b->getRealpath()); }; } elseif (self::SORT_BY_ACCESSED_TIME === $sort) { - $this->sort = function ($a, $b) { + $this->sort = function (\Herbie\Iterator\SplFileInfo $a, \Herbie\Iterator\SplFileInfo $b) { return ($a->getATime() - $b->getATime()); }; } elseif (self::SORT_BY_CHANGED_TIME === $sort) { - $this->sort = function ($a, $b) { + $this->sort = function (\Herbie\Iterator\SplFileInfo $a, \Herbie\Iterator\SplFileInfo $b) { return ($a->getCTime() - $b->getCTime()); }; } elseif (self::SORT_BY_MODIFIED_TIME === $sort) { - $this->sort = function ($a, $b) { + $this->sort = function (\Herbie\Iterator\SplFileInfo $a, \Herbie\Iterator\SplFileInfo $b) { return ($a->getMTime() - $b->getMTime()); }; } elseif (is_callable($sort)) { diff --git a/system/Menu/Post/Builder.php b/system/Menu/Post/Builder.php index 4902bb22..fe4c1ae6 100644 --- a/system/Menu/Post/Builder.php +++ b/system/Menu/Post/Builder.php @@ -78,7 +78,7 @@ public function build($path = null) $data['modified'] = date('c', filemtime($realpath.'/'.$filename)); } if (empty($data['date'])) { - $data['date'] = $this->extractDateFromPath($filename); + $data['date'] = \Herbie\Helper\PathHelper::extractDateFromPath($filename); } $data['path'] = '@post/'.$filename; $data['blogRoute'] = $this->blogRoute; @@ -88,19 +88,6 @@ public function build($path = null) } $this->cache->set(__CLASS__, $collection); } - #echo"
";print_r($collection);echo"
"; return $collection; } - - /** - * @param string $path - * @return string - * @todo Duplicate code in Herbie\Loader\PageLoader - */ - protected function extractDateFromPath($path) - { - $filename = basename($path); - preg_match('/^([0-9]{4}-[0-9]{2}-[0-9]{2}).*$/', $filename, $matches); - return $matches[1]; - } } diff --git a/system/SplFileInfo.php b/system/SplFileInfo.php new file mode 100644 index 00000000..34f5576a --- /dev/null +++ b/system/SplFileInfo.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Herbie; + +class SplFileInfo extends \SplFileInfo +{ + private $relativePath; + private $relativePathname; + + /** + * Constructor + * + * @param string $file The file name + * @param string $relativePath The relative path + * @param string $relativePathname The relative path name + */ + public function __construct($file, $relativePath, $relativePathname) + { + parent::__construct($file); + $this->relativePath = $relativePath; + $this->relativePathname = $relativePathname; + } + + /** + * Returns the relative path + * + * @return string the relative path + */ + public function getRelativePath() + { + return $this->relativePath; + } + + /** + * Returns the relative path name + * + * @return string the relative path name + */ + public function getRelativePathname() + { + return $this->relativePathname; + } + + /** + * @return bool + */ + public function isDot() + { + return in_array($this->getBasename(), ['.', '..']); + } + + /** + * Returns the contents of the file + * + * @return string the contents of the file + * + * @throws \RuntimeException + */ + public function getContents() + { + $level = error_reporting(0); + $content = file_get_contents($this->getPathname()); + error_reporting($level); + if (false === $content) { + $error = error_get_last(); + throw new \RuntimeException($error['message']); + } + + return $content; + } +}