Surprisingly painless upgrade to Twig 3.x.
This commit is contained in:
parent
96e266b1fc
commit
f9181fc6f9
4 changed files with 188 additions and 206 deletions
|
@ -1,10 +1,9 @@
|
||||||
{
|
{
|
||||||
"require": {
|
"require": {
|
||||||
"twig/twig": "^2.0",
|
"twig/twig": "^3.0",
|
||||||
"swiftmailer/swiftmailer": "~6.0",
|
"swiftmailer/swiftmailer": "~6.0",
|
||||||
"erusev/parsedown": "~1.6",
|
"erusev/parsedown": "~1.6",
|
||||||
"geoip2/geoip2": "~2.0",
|
"geoip2/geoip2": "~2.0",
|
||||||
"twig/extensions": "^1.5",
|
|
||||||
"jublonet/codebird-php": "^3.1",
|
"jublonet/codebird-php": "^3.1",
|
||||||
"chillerlan/php-qrcode": "^3.0",
|
"chillerlan/php-qrcode": "^3.0",
|
||||||
"whichbrowser/parser": "^2.0"
|
"whichbrowser/parser": "^2.0"
|
||||||
|
@ -21,6 +20,9 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"preferred-install": "dist"
|
"preferred-install": "dist",
|
||||||
|
"allow-plugins": {
|
||||||
|
"composer/installers": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
299
composer.lock
generated
299
composer.lock
generated
|
@ -4,28 +4,29 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "ce45fc99f5187b5f6e6e63b3bbd89ce9",
|
"content-hash": "74b2bbca53906a66f78c659eb5d47a89",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "chillerlan/php-qrcode",
|
"name": "chillerlan/php-qrcode",
|
||||||
"version": "3.4.0",
|
"version": "3.4.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/chillerlan/php-qrcode.git",
|
"url": "https://github.com/chillerlan/php-qrcode.git",
|
||||||
"reference": "d8bf297e6843a53aeaa8f3285ce04fc349d133d6"
|
"reference": "468603b687a5fe75c1ff33857a45f1726c7b95a9"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/chillerlan/php-qrcode/zipball/d8bf297e6843a53aeaa8f3285ce04fc349d133d6",
|
"url": "https://api.github.com/repos/chillerlan/php-qrcode/zipball/468603b687a5fe75c1ff33857a45f1726c7b95a9",
|
||||||
"reference": "d8bf297e6843a53aeaa8f3285ce04fc349d133d6",
|
"reference": "468603b687a5fe75c1ff33857a45f1726c7b95a9",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"chillerlan/php-settings-container": "^1.2",
|
"chillerlan/php-settings-container": "^1.2.2",
|
||||||
"ext-mbstring": "*",
|
"ext-mbstring": "*",
|
||||||
"php": "^7.2"
|
"php": "^7.2 || ^8.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
"phan/phan": "^3.2.2",
|
||||||
"phpunit/phpunit": "^8.5",
|
"phpunit/phpunit": "^8.5",
|
||||||
"setasign/fpdf": "^1.8.2"
|
"setasign/fpdf": "^1.8.2"
|
||||||
},
|
},
|
||||||
|
@ -69,7 +70,7 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/chillerlan/php-qrcode/issues",
|
"issues": "https://github.com/chillerlan/php-qrcode/issues",
|
||||||
"source": "https://github.com/chillerlan/php-qrcode/tree/3.4.0"
|
"source": "https://github.com/chillerlan/php-qrcode/tree/3.4.1"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -81,28 +82,28 @@
|
||||||
"type": "ko_fi"
|
"type": "ko_fi"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2020-11-18T20:51:41+00:00"
|
"time": "2021-09-03T17:54:45+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "chillerlan/php-settings-container",
|
"name": "chillerlan/php-settings-container",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/chillerlan/php-settings-container.git",
|
"url": "https://github.com/chillerlan/php-settings-container.git",
|
||||||
"reference": "b9b0431dffd74102ee92348a63b4c33fc8ba639b"
|
"reference": "d1b5284d6eb3a767459738bb0b20073f0cb3eeaf"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/chillerlan/php-settings-container/zipball/b9b0431dffd74102ee92348a63b4c33fc8ba639b",
|
"url": "https://api.github.com/repos/chillerlan/php-settings-container/zipball/d1b5284d6eb3a767459738bb0b20073f0cb3eeaf",
|
||||||
"reference": "b9b0431dffd74102ee92348a63b4c33fc8ba639b",
|
"reference": "d1b5284d6eb3a767459738bb0b20073f0cb3eeaf",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"php": "^7.2"
|
"php": "^7.2 || ^8.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^8.3"
|
"phpunit/phpunit": "^8.4"
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@ -133,20 +134,30 @@
|
||||||
"issues": "https://github.com/chillerlan/php-settings-container/issues",
|
"issues": "https://github.com/chillerlan/php-settings-container/issues",
|
||||||
"source": "https://github.com/chillerlan/php-settings-container"
|
"source": "https://github.com/chillerlan/php-settings-container"
|
||||||
},
|
},
|
||||||
"time": "2019-09-10T00:09:44+00:00"
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://www.paypal.com/donate?hosted_button_id=WLYUNAT9ZTJZ4",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://ko-fi.com/codemasher",
|
||||||
|
"type": "ko_fi"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2021-09-03T17:33:25+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "composer/ca-bundle",
|
"name": "composer/ca-bundle",
|
||||||
"version": "1.2.10",
|
"version": "1.3.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/composer/ca-bundle.git",
|
"url": "https://github.com/composer/ca-bundle.git",
|
||||||
"reference": "9fdb22c2e97a614657716178093cd1da90a64aa8"
|
"reference": "4c679186f2aca4ab6a0f1b0b9cf9252decb44d0b"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/9fdb22c2e97a614657716178093cd1da90a64aa8",
|
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/4c679186f2aca4ab6a0f1b0b9cf9252decb44d0b",
|
||||||
"reference": "9fdb22c2e97a614657716178093cd1da90a64aa8",
|
"reference": "4c679186f2aca4ab6a0f1b0b9cf9252decb44d0b",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -158,7 +169,7 @@
|
||||||
"phpstan/phpstan": "^0.12.55",
|
"phpstan/phpstan": "^0.12.55",
|
||||||
"psr/log": "^1.0",
|
"psr/log": "^1.0",
|
||||||
"symfony/phpunit-bridge": "^4.2 || ^5",
|
"symfony/phpunit-bridge": "^4.2 || ^5",
|
||||||
"symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0"
|
"symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0 || ^6.0"
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
|
@ -193,7 +204,7 @@
|
||||||
"support": {
|
"support": {
|
||||||
"irc": "irc://irc.freenode.org/composer",
|
"irc": "irc://irc.freenode.org/composer",
|
||||||
"issues": "https://github.com/composer/ca-bundle/issues",
|
"issues": "https://github.com/composer/ca-bundle/issues",
|
||||||
"source": "https://github.com/composer/ca-bundle/tree/1.2.10"
|
"source": "https://github.com/composer/ca-bundle/tree/1.3.1"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -209,20 +220,20 @@
|
||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2021-06-07T13:58:28+00:00"
|
"time": "2021-10-28T20:44:15+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "composer/installers",
|
"name": "composer/installers",
|
||||||
"version": "v1.11.0",
|
"version": "v1.12.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/composer/installers.git",
|
"url": "https://github.com/composer/installers.git",
|
||||||
"reference": "ae03311f45dfe194412081526be2e003960df74b"
|
"reference": "d20a64ed3c94748397ff5973488761b22f6d3f19"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/composer/installers/zipball/ae03311f45dfe194412081526be2e003960df74b",
|
"url": "https://api.github.com/repos/composer/installers/zipball/d20a64ed3c94748397ff5973488761b22f6d3f19",
|
||||||
"reference": "ae03311f45dfe194412081526be2e003960df74b",
|
"reference": "d20a64ed3c94748397ff5973488761b22f6d3f19",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -321,6 +332,7 @@
|
||||||
"modx",
|
"modx",
|
||||||
"moodle",
|
"moodle",
|
||||||
"osclass",
|
"osclass",
|
||||||
|
"pantheon",
|
||||||
"phpbb",
|
"phpbb",
|
||||||
"piwik",
|
"piwik",
|
||||||
"ppi",
|
"ppi",
|
||||||
|
@ -343,7 +355,7 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/composer/installers/issues",
|
"issues": "https://github.com/composer/installers/issues",
|
||||||
"source": "https://github.com/composer/installers/tree/v1.11.0"
|
"source": "https://github.com/composer/installers/tree/v1.12.0"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -359,36 +371,32 @@
|
||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2021-04-28T06:42:17+00:00"
|
"time": "2021-09-13T08:19:44+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "doctrine/lexer",
|
"name": "doctrine/lexer",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/doctrine/lexer.git",
|
"url": "https://github.com/doctrine/lexer.git",
|
||||||
"reference": "e864bbf5904cb8f5bb334f99209b48018522f042"
|
"reference": "9c50f840f257bbb941e6f4a0e94ccf5db5c3f76c"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/doctrine/lexer/zipball/e864bbf5904cb8f5bb334f99209b48018522f042",
|
"url": "https://api.github.com/repos/doctrine/lexer/zipball/9c50f840f257bbb941e6f4a0e94ccf5db5c3f76c",
|
||||||
"reference": "e864bbf5904cb8f5bb334f99209b48018522f042",
|
"reference": "9c50f840f257bbb941e6f4a0e94ccf5db5c3f76c",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^7.2 || ^8.0"
|
"php": "^7.1 || ^8.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"doctrine/coding-standard": "^6.0",
|
"doctrine/coding-standard": "^9.0",
|
||||||
"phpstan/phpstan": "^0.11.8",
|
"phpstan/phpstan": "1.3",
|
||||||
"phpunit/phpunit": "^8.2"
|
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
|
||||||
|
"vimeo/psalm": "^4.11"
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
|
||||||
"branch-alias": {
|
|
||||||
"dev-master": "1.2.x-dev"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer"
|
"Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer"
|
||||||
|
@ -423,7 +431,7 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/doctrine/lexer/issues",
|
"issues": "https://github.com/doctrine/lexer/issues",
|
||||||
"source": "https://github.com/doctrine/lexer/tree/1.2.1"
|
"source": "https://github.com/doctrine/lexer/tree/1.2.2"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -439,20 +447,20 @@
|
||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2020-05-25T17:44:05+00:00"
|
"time": "2022-01-12T08:27:12+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "egulias/email-validator",
|
"name": "egulias/email-validator",
|
||||||
"version": "3.1.1",
|
"version": "3.1.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/egulias/EmailValidator.git",
|
"url": "https://github.com/egulias/EmailValidator.git",
|
||||||
"reference": "c81f18a3efb941d8c4d2e025f6183b5c6d697307"
|
"reference": "ee0db30118f661fb166bcffbf5d82032df484697"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/c81f18a3efb941d8c4d2e025f6183b5c6d697307",
|
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/ee0db30118f661fb166bcffbf5d82032df484697",
|
||||||
"reference": "c81f18a3efb941d8c4d2e025f6183b5c6d697307",
|
"reference": "ee0db30118f661fb166bcffbf5d82032df484697",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -499,7 +507,7 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/egulias/EmailValidator/issues",
|
"issues": "https://github.com/egulias/EmailValidator/issues",
|
||||||
"source": "https://github.com/egulias/EmailValidator/tree/3.1.1"
|
"source": "https://github.com/egulias/EmailValidator/tree/3.1.2"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -507,7 +515,7 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2021-04-01T18:37:14+00:00"
|
"time": "2021-10-11T09:18:27+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "erusev/parsedown",
|
"name": "erusev/parsedown",
|
||||||
|
@ -561,16 +569,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "geoip2/geoip2",
|
"name": "geoip2/geoip2",
|
||||||
"version": "v2.11.0",
|
"version": "v2.12.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/maxmind/GeoIP2-php.git",
|
"url": "https://github.com/maxmind/GeoIP2-php.git",
|
||||||
"reference": "d01be5894a5c1a3381c58c9b1795cd07f96c30f7"
|
"reference": "83adb44ac4b9553d36b579a14673ed124583082f"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/maxmind/GeoIP2-php/zipball/d01be5894a5c1a3381c58c9b1795cd07f96c30f7",
|
"url": "https://api.github.com/repos/maxmind/GeoIP2-php/zipball/83adb44ac4b9553d36b579a14673ed124583082f",
|
||||||
"reference": "d01be5894a5c1a3381c58c9b1795cd07f96c30f7",
|
"reference": "83adb44ac4b9553d36b579a14673ed124583082f",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -580,7 +588,8 @@
|
||||||
"php": ">=7.2"
|
"php": ">=7.2"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"friendsofphp/php-cs-fixer": "2.*",
|
"friendsofphp/php-cs-fixer": "3.*",
|
||||||
|
"phpstan/phpstan": "*",
|
||||||
"phpunit/phpunit": "^8.0 || ^9.0",
|
"phpunit/phpunit": "^8.0 || ^9.0",
|
||||||
"squizlabs/php_codesniffer": "3.*"
|
"squizlabs/php_codesniffer": "3.*"
|
||||||
},
|
},
|
||||||
|
@ -612,21 +621,21 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/maxmind/GeoIP2-php/issues",
|
"issues": "https://github.com/maxmind/GeoIP2-php/issues",
|
||||||
"source": "https://github.com/maxmind/GeoIP2-php/tree/v2.11.0"
|
"source": "https://github.com/maxmind/GeoIP2-php/tree/v2.12.2"
|
||||||
},
|
},
|
||||||
"time": "2020-10-01T18:48:34+00:00"
|
"time": "2021-11-30T18:15:25+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "jublonet/codebird-php",
|
"name": "jublonet/codebird-php",
|
||||||
"version": "3.1.0",
|
"version": "3.1.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/jublonet/codebird-php.git",
|
"url": "https://github.com/jublo/codebird-php.git",
|
||||||
"reference": "100a8e8f1928a5738b4476f0caf83f2c2ba6da5b"
|
"reference": "100a8e8f1928a5738b4476f0caf83f2c2ba6da5b"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/jublonet/codebird-php/zipball/100a8e8f1928a5738b4476f0caf83f2c2ba6da5b",
|
"url": "https://api.github.com/repos/jublo/codebird-php/zipball/100a8e8f1928a5738b4476f0caf83f2c2ba6da5b",
|
||||||
"reference": "100a8e8f1928a5738b4476f0caf83f2c2ba6da5b",
|
"reference": "100a8e8f1928a5738b4476f0caf83f2c2ba6da5b",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
|
@ -682,16 +691,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "maxmind-db/reader",
|
"name": "maxmind-db/reader",
|
||||||
"version": "v1.10.1",
|
"version": "v1.11.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git",
|
"url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git",
|
||||||
"reference": "569bd44d97d30a4ec12c7793a33004a76d4caf18"
|
"reference": "b1f3c0699525336d09cc5161a2861268d9f2ae5b"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/569bd44d97d30a4ec12c7793a33004a76d4caf18",
|
"url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/b1f3c0699525336d09cc5161a2861268d9f2ae5b",
|
||||||
"reference": "569bd44d97d30a4ec12c7793a33004a76d4caf18",
|
"reference": "b1f3c0699525336d09cc5161a2861268d9f2ae5b",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -701,7 +710,7 @@
|
||||||
"ext-maxminddb": "<1.10.1,>=2.0.0"
|
"ext-maxminddb": "<1.10.1,>=2.0.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"friendsofphp/php-cs-fixer": "*",
|
"friendsofphp/php-cs-fixer": "3.*",
|
||||||
"php-coveralls/php-coveralls": "^2.1",
|
"php-coveralls/php-coveralls": "^2.1",
|
||||||
"phpstan/phpstan": "*",
|
"phpstan/phpstan": "*",
|
||||||
"phpunit/phpcov": ">=6.0.0",
|
"phpunit/phpcov": ">=6.0.0",
|
||||||
|
@ -741,9 +750,9 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/maxmind/MaxMind-DB-Reader-php/issues",
|
"issues": "https://github.com/maxmind/MaxMind-DB-Reader-php/issues",
|
||||||
"source": "https://github.com/maxmind/MaxMind-DB-Reader-php/tree/v1.10.1"
|
"source": "https://github.com/maxmind/MaxMind-DB-Reader-php/tree/v1.11.0"
|
||||||
},
|
},
|
||||||
"time": "2021-04-14T17:49:35+00:00"
|
"time": "2021-10-18T15:23:10+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "maxmind/web-service-common",
|
"name": "maxmind/web-service-common",
|
||||||
|
@ -846,16 +855,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "swiftmailer/swiftmailer",
|
"name": "swiftmailer/swiftmailer",
|
||||||
"version": "v6.2.7",
|
"version": "v6.3.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/swiftmailer/swiftmailer.git",
|
"url": "https://github.com/swiftmailer/swiftmailer.git",
|
||||||
"reference": "15f7faf8508e04471f666633addacf54c0ab5933"
|
"reference": "8a5d5072dca8f48460fce2f4131fcc495eec654c"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/15f7faf8508e04471f666633addacf54c0ab5933",
|
"url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/8a5d5072dca8f48460fce2f4131fcc495eec654c",
|
||||||
"reference": "15f7faf8508e04471f666633addacf54c0ab5933",
|
"reference": "8a5d5072dca8f48460fce2f4131fcc495eec654c",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -867,7 +876,7 @@
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"mockery/mockery": "^1.0",
|
"mockery/mockery": "^1.0",
|
||||||
"symfony/phpunit-bridge": "^4.4|^5.0"
|
"symfony/phpunit-bridge": "^4.4|^5.4"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"ext-intl": "Needed to support internationalized email addresses"
|
"ext-intl": "Needed to support internationalized email addresses"
|
||||||
|
@ -905,7 +914,7 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/swiftmailer/swiftmailer/issues",
|
"issues": "https://github.com/swiftmailer/swiftmailer/issues",
|
||||||
"source": "https://github.com/swiftmailer/swiftmailer/tree/v6.2.7"
|
"source": "https://github.com/swiftmailer/swiftmailer/tree/v6.3.0"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -917,7 +926,8 @@
|
||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2021-03-09T12:30:35+00:00"
|
"abandoned": "symfony/mailer",
|
||||||
|
"time": "2021-10-18T15:26:12+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/polyfill-ctype",
|
"name": "symfony/polyfill-ctype",
|
||||||
|
@ -1003,21 +1013,24 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/polyfill-iconv",
|
"name": "symfony/polyfill-iconv",
|
||||||
"version": "v1.23.0",
|
"version": "v1.24.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/polyfill-iconv.git",
|
"url": "https://github.com/symfony/polyfill-iconv.git",
|
||||||
"reference": "63b5bb7db83e5673936d6e3b8b3e022ff6474933"
|
"reference": "f1aed619e28cb077fc83fac8c4c0383578356e40"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/63b5bb7db83e5673936d6e3b8b3e022ff6474933",
|
"url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/f1aed619e28cb077fc83fac8c4c0383578356e40",
|
||||||
"reference": "63b5bb7db83e5673936d6e3b8b3e022ff6474933",
|
"reference": "f1aed619e28cb077fc83fac8c4c0383578356e40",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.1"
|
"php": ">=7.1"
|
||||||
},
|
},
|
||||||
|
"provide": {
|
||||||
|
"ext-iconv": "*"
|
||||||
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"ext-iconv": "For best performance"
|
"ext-iconv": "For best performance"
|
||||||
},
|
},
|
||||||
|
@ -1032,12 +1045,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
|
||||||
"Symfony\\Polyfill\\Iconv\\": ""
|
|
||||||
},
|
|
||||||
"files": [
|
"files": [
|
||||||
"bootstrap.php"
|
"bootstrap.php"
|
||||||
]
|
],
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Polyfill\\Iconv\\": ""
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"license": [
|
"license": [
|
||||||
|
@ -1063,7 +1076,7 @@
|
||||||
"shim"
|
"shim"
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"source": "https://github.com/symfony/polyfill-iconv/tree/v1.23.0"
|
"source": "https://github.com/symfony/polyfill-iconv/tree/v1.24.0"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -1079,20 +1092,20 @@
|
||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2021-05-27T09:27:20+00:00"
|
"time": "2022-01-04T09:04:05+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/polyfill-intl-idn",
|
"name": "symfony/polyfill-intl-idn",
|
||||||
"version": "v1.23.0",
|
"version": "v1.24.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/polyfill-intl-idn.git",
|
"url": "https://github.com/symfony/polyfill-intl-idn.git",
|
||||||
"reference": "65bd267525e82759e7d8c4e8ceea44f398838e65"
|
"reference": "749045c69efb97c70d25d7463abba812e91f3a44"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/65bd267525e82759e7d8c4e8ceea44f398838e65",
|
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/749045c69efb97c70d25d7463abba812e91f3a44",
|
||||||
"reference": "65bd267525e82759e7d8c4e8ceea44f398838e65",
|
"reference": "749045c69efb97c70d25d7463abba812e91f3a44",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -1114,12 +1127,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
|
||||||
"Symfony\\Polyfill\\Intl\\Idn\\": ""
|
|
||||||
},
|
|
||||||
"files": [
|
"files": [
|
||||||
"bootstrap.php"
|
"bootstrap.php"
|
||||||
]
|
],
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Polyfill\\Intl\\Idn\\": ""
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"license": [
|
"license": [
|
||||||
|
@ -1150,7 +1163,7 @@
|
||||||
"shim"
|
"shim"
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.23.0"
|
"source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.24.0"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -1166,11 +1179,11 @@
|
||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2021-05-27T09:27:20+00:00"
|
"time": "2021-09-14T14:02:44+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/polyfill-intl-normalizer",
|
"name": "symfony/polyfill-intl-normalizer",
|
||||||
"version": "v1.23.0",
|
"version": "v1.24.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
|
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
|
||||||
|
@ -1199,12 +1212,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
|
||||||
"Symfony\\Polyfill\\Intl\\Normalizer\\": ""
|
|
||||||
},
|
|
||||||
"files": [
|
"files": [
|
||||||
"bootstrap.php"
|
"bootstrap.php"
|
||||||
],
|
],
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Polyfill\\Intl\\Normalizer\\": ""
|
||||||
|
},
|
||||||
"classmap": [
|
"classmap": [
|
||||||
"Resources/stubs"
|
"Resources/stubs"
|
||||||
]
|
]
|
||||||
|
@ -1234,7 +1247,7 @@
|
||||||
"shim"
|
"shim"
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0"
|
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.24.0"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -1286,12 +1299,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
|
||||||
"Symfony\\Polyfill\\Mbstring\\": ""
|
|
||||||
},
|
|
||||||
"files": [
|
"files": [
|
||||||
"bootstrap.php"
|
"bootstrap.php"
|
||||||
]
|
],
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Polyfill\\Mbstring\\": ""
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"license": [
|
"license": [
|
||||||
|
@ -1411,85 +1424,24 @@
|
||||||
],
|
],
|
||||||
"time": "2021-05-27T09:17:38+00:00"
|
"time": "2021-05-27T09:17:38+00:00"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "twig/extensions",
|
|
||||||
"version": "v1.5.4",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/twigphp/Twig-extensions.git",
|
|
||||||
"reference": "57873c8b0c1be51caa47df2cdb824490beb16202"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/twigphp/Twig-extensions/zipball/57873c8b0c1be51caa47df2cdb824490beb16202",
|
|
||||||
"reference": "57873c8b0c1be51caa47df2cdb824490beb16202",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"twig/twig": "^1.27|^2.0"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"symfony/phpunit-bridge": "^3.4",
|
|
||||||
"symfony/translation": "^2.7|^3.4"
|
|
||||||
},
|
|
||||||
"suggest": {
|
|
||||||
"symfony/translation": "Allow the time_diff output to be translated"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"extra": {
|
|
||||||
"branch-alias": {
|
|
||||||
"dev-master": "1.5-dev"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-0": {
|
|
||||||
"Twig_Extensions_": "lib/"
|
|
||||||
},
|
|
||||||
"psr-4": {
|
|
||||||
"Twig\\Extensions\\": "src/"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Fabien Potencier",
|
|
||||||
"email": "fabien@symfony.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Common additional features for Twig that do not directly belong in core",
|
|
||||||
"keywords": [
|
|
||||||
"i18n",
|
|
||||||
"text"
|
|
||||||
],
|
|
||||||
"support": {
|
|
||||||
"issues": "https://github.com/twigphp/Twig-extensions/issues",
|
|
||||||
"source": "https://github.com/twigphp/Twig-extensions/tree/master"
|
|
||||||
},
|
|
||||||
"abandoned": true,
|
|
||||||
"time": "2018-12-05T18:34:18+00:00"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "twig/twig",
|
"name": "twig/twig",
|
||||||
"version": "v2.14.11",
|
"version": "v3.3.8",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/twigphp/Twig.git",
|
"url": "https://github.com/twigphp/Twig.git",
|
||||||
"reference": "66baa66f29ee30e487e05f1679903e36eb01d727"
|
"reference": "972d8604a92b7054828b539f2febb0211dd5945c"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/66baa66f29ee30e487e05f1679903e36eb01d727",
|
"url": "https://api.github.com/repos/twigphp/Twig/zipball/972d8604a92b7054828b539f2febb0211dd5945c",
|
||||||
"reference": "66baa66f29ee30e487e05f1679903e36eb01d727",
|
"reference": "972d8604a92b7054828b539f2febb0211dd5945c",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.1.3",
|
"php": ">=7.2.5",
|
||||||
"symfony/polyfill-ctype": "^1.8",
|
"symfony/polyfill-ctype": "^1.8",
|
||||||
"symfony/polyfill-mbstring": "^1.3",
|
"symfony/polyfill-mbstring": "^1.3"
|
||||||
"symfony/polyfill-php72": "^1.8"
|
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"psr/container": "^1.0",
|
"psr/container": "^1.0",
|
||||||
|
@ -1498,13 +1450,10 @@
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "2.14-dev"
|
"dev-master": "3.3-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-0": {
|
|
||||||
"Twig_": "lib/"
|
|
||||||
},
|
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Twig\\": "src/"
|
"Twig\\": "src/"
|
||||||
}
|
}
|
||||||
|
@ -1537,7 +1486,7 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/twigphp/Twig/issues",
|
"issues": "https://github.com/twigphp/Twig/issues",
|
||||||
"source": "https://github.com/twigphp/Twig/tree/v2.14.11"
|
"source": "https://github.com/twigphp/Twig/tree/v3.3.8"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -1549,7 +1498,7 @@
|
||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2022-02-04T06:57:25+00:00"
|
"time": "2022-02-04T06:59:48+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "whichbrowser/parser",
|
"name": "whichbrowser/parser",
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
namespace Misuzu;
|
namespace Misuzu;
|
||||||
|
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use Twig\Environment as Twig_Environment;
|
use Twig\Environment as TwigEnvironment;
|
||||||
use Twig_Extensions_Extension_Date;
|
use Twig_Extensions_Extension_Date;
|
||||||
use Twig\Loader\FilesystemLoader as Twig_Loader_Filesystem;
|
use Twig\Loader\FilesystemLoader as TwigLoaderFilesystem;
|
||||||
|
|
||||||
final class Template {
|
final class Template {
|
||||||
private const FILE_EXT = '.twig';
|
private const FILE_EXT = '.twig';
|
||||||
|
@ -14,14 +14,14 @@ final class Template {
|
||||||
private static $vars = [];
|
private static $vars = [];
|
||||||
|
|
||||||
public static function init(?string $cache = null, bool $debug = false): void {
|
public static function init(?string $cache = null, bool $debug = false): void {
|
||||||
self::$loader = new Twig_Loader_Filesystem;
|
self::$loader = new TwigLoaderFilesystem;
|
||||||
self::$env = new Twig_Environment(self::$loader, [
|
self::$env = new TwigEnvironment(self::$loader, [
|
||||||
'cache' => $cache ?? false,
|
'cache' => $cache ?? false,
|
||||||
'strict_variables' => true,
|
'strict_variables' => true,
|
||||||
'auto_reload' => $debug,
|
'auto_reload' => $debug,
|
||||||
'debug' => $debug,
|
'debug' => $debug,
|
||||||
]);
|
]);
|
||||||
self::$env->addExtension(new Twig_Extensions_Extension_Date);
|
//self::$env->addExtension(new Twig_Extensions_Extension_Date);
|
||||||
self::$env->addExtension(new TwigMisuzu);
|
self::$env->addExtension(new TwigMisuzu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,38 +1,69 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Misuzu;
|
namespace Misuzu;
|
||||||
|
|
||||||
use Twig_Extension;
|
use Twig\Extension\AbstractExtension;
|
||||||
use Twig_Filter;
|
use Twig\TwigFilter;
|
||||||
use Twig_Function;
|
use Twig\TwigFunction;
|
||||||
|
use Twig\Environment as TwigEnvironment;
|
||||||
use Misuzu\Parsers\Parser;
|
use Misuzu\Parsers\Parser;
|
||||||
|
|
||||||
final class TwigMisuzu extends Twig_Extension {
|
final class TwigMisuzu extends AbstractExtension {
|
||||||
public function getFilters() {
|
public function getFilters() {
|
||||||
return [
|
return [
|
||||||
new Twig_Filter('html_colour', 'html_colour'),
|
new TwigFilter('html_colour', 'html_colour'),
|
||||||
new Twig_Filter('country_name', 'get_country_name'),
|
new TwigFilter('country_name', 'get_country_name'),
|
||||||
new Twig_Filter('byte_symbol', 'byte_symbol'),
|
new TwigFilter('byte_symbol', 'byte_symbol'),
|
||||||
new Twig_Filter('parse_text', fn(string $text, int $parser): string => Parser::instance($parser)->parseText($text)),
|
new TwigFilter('parse_text', fn(string $text, int $parser): string => Parser::instance($parser)->parseText($text)),
|
||||||
new Twig_Filter('perms_check', 'perms_check'),
|
new TwigFilter('perms_check', 'perms_check'),
|
||||||
new Twig_Filter('clamp', 'clamp'),
|
new TwigFilter('clamp', 'clamp'),
|
||||||
|
new TwigFilter('time_diff', [$this, 'timeDiff'], ['needs_environment' => true]),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFunctions() {
|
public function getFunctions() {
|
||||||
return [
|
return [
|
||||||
new Twig_Function('url_construct', 'url_construct'),
|
new TwigFunction('url_construct', 'url_construct'),
|
||||||
new Twig_Function('url', 'url'),
|
new TwigFunction('url', 'url'),
|
||||||
new Twig_Function('url_list', 'url_list'),
|
new TwigFunction('url_list', 'url_list'),
|
||||||
new Twig_Function('html_avatar', 'html_avatar'),
|
new TwigFunction('html_avatar', 'html_avatar'),
|
||||||
new Twig_Function('forum_may_have_children', 'forum_may_have_children'),
|
new TwigFunction('forum_may_have_children', 'forum_may_have_children'),
|
||||||
new Twig_Function('forum_may_have_topics', 'forum_may_have_topics'),
|
new TwigFunction('forum_may_have_topics', 'forum_may_have_topics'),
|
||||||
new Twig_Function('forum_has_priority_voting', 'forum_has_priority_voting'),
|
new TwigFunction('forum_has_priority_voting', 'forum_has_priority_voting'),
|
||||||
new Twig_Function('csrf_token', fn() => CSRF::token()),
|
new TwigFunction('csrf_token', fn() => CSRF::token()),
|
||||||
new Twig_Function('git_commit_hash', fn(bool $long = false) => GitInfo::hash($long)),
|
new TwigFunction('git_commit_hash', fn(bool $long = false) => GitInfo::hash($long)),
|
||||||
new Twig_Function('git_tag', fn() => GitInfo::tag()),
|
new TwigFunction('git_tag', fn() => GitInfo::tag()),
|
||||||
new Twig_Function('git_branch', fn() => GitInfo::branch()),
|
new TwigFunction('git_branch', fn() => GitInfo::branch()),
|
||||||
new Twig_Function('startup_time', fn(float $time = MSZ_STARTUP) => microtime(true) - $time),
|
new TwigFunction('startup_time', fn(float $time = MSZ_STARTUP) => microtime(true) - $time),
|
||||||
new Twig_Function('sql_query_count', fn() => DB::queries()),
|
new TwigFunction('sql_query_count', fn() => DB::queries()),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static $units = [
|
||||||
|
'y' => 'year',
|
||||||
|
'm' => 'month',
|
||||||
|
'd' => 'day',
|
||||||
|
'h' => 'hour',
|
||||||
|
'i' => 'minute',
|
||||||
|
's' => 'second',
|
||||||
|
];
|
||||||
|
|
||||||
|
// yoinked from https://github.com/twigphp/Twig-extensions/blob/0c7a08e6de42a3c8f6a68af9628f4c8e4e00de93/src/DateExtension.php
|
||||||
|
public function timeDiff(TwigEnvironment $env, $date, $now = null) {
|
||||||
|
$date = \twig_date_converter($env, $date);
|
||||||
|
$now = \twig_date_converter($env, $now);
|
||||||
|
|
||||||
|
$diff = $date->diff($now);
|
||||||
|
|
||||||
|
foreach(self::$units as $attr => $unit) {
|
||||||
|
$count = $diff->{$attr};
|
||||||
|
|
||||||
|
if($count !== 0) {
|
||||||
|
if($count !== 1)
|
||||||
|
$unit .= 's';
|
||||||
|
return $diff->invert ? "in {$count} {$unit}" : "{$count} {$unit} ago";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'infinite undefineds';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue