Upgrade twig to version 3 for php 8.1
authorChristian Weiske <cweiske@cweiske.de>
Sun, 13 Mar 2022 00:58:56 +0000 (01:58 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Sun, 13 Mar 2022 00:59:01 +0000 (01:59 +0100)
composer.json
composer.lock
data/templates/post-like.htm
data/templates/post-reply.htm
www/www-header.php

index a4340c15fa0c4caaf35ad7dfdfae8768b8c4dac6..f751efe154f4fb99dc6bedbc81d15d88ddd75843 100644 (file)
@@ -1,7 +1,7 @@
 {
     "require": {
         "pear/net_url2": "^2.2",
-        "twig/twig": "^2.5",
+        "twig/twig": "^3.0",
         "pear/services_libravatar": "^0.2.4",
         "pear2/services_linkback": "^0.3.0"
     }
index e0d4701483b4e64ed820fa718c941ff75c4b291d..228711b3441c4342eddee63105c351963c423f24 100644 (file)
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "8f0806c1db09f689e6499c38f58669bd",
+    "content-hash": "6f5e8d10b4a20c2586020514fcd648c6",
     "packages": [
         {
             "name": "pear/http2",
         },
         {
             "name": "twig/twig",
-            "version": "v2.5.0",
+            "version": "v3.3.8",
             "source": {
                 "type": "git",
                 "url": "https://github.com/twigphp/Twig.git",
-                "reference": "6a5f676b77a90823c2d4eaf76137b771adf31323"
+                "reference": "972d8604a92b7054828b539f2febb0211dd5945c"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/twigphp/Twig/zipball/6a5f676b77a90823c2d4eaf76137b771adf31323",
-                "reference": "6a5f676b77a90823c2d4eaf76137b771adf31323",
+                "url": "https://api.github.com/repos/twigphp/Twig/zipball/972d8604a92b7054828b539f2febb0211dd5945c",
+                "reference": "972d8604a92b7054828b539f2febb0211dd5945c",
                 "shasum": ""
             },
             "require": {
-                "php": "^7.0",
+                "php": ">=7.2.5",
                 "symfony/polyfill-ctype": "^1.8",
-                "symfony/polyfill-mbstring": "~1.0"
+                "symfony/polyfill-mbstring": "^1.3"
             },
             "require-dev": {
                 "psr/container": "^1.0",
-                "symfony/debug": "^2.7",
-                "symfony/phpunit-bridge": "^3.3"
+                "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0"
             },
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "2.5-dev"
+                    "dev-master": "3.3-dev"
                 }
             },
             "autoload": {
-                "psr-0": {
-                    "Twig_": "lib/"
-                },
                 "psr-4": {
                     "Twig\\": "src/"
                 }
                     "homepage": "http://fabien.potencier.org",
                     "role": "Lead Developer"
                 },
+                {
+                    "name": "Twig Team",
+                    "role": "Contributors"
+                },
                 {
                     "name": "Armin Ronacher",
                     "email": "armin.ronacher@active-4.com",
                     "role": "Project Founder"
-                },
-                {
-                    "name": "Twig Team",
-                    "homepage": "https://twig.symfony.com/contributors",
-                    "role": "Contributors"
                 }
             ],
             "description": "Twig, the flexible, fast, and secure template language for PHP",
             "keywords": [
                 "templating"
             ],
-            "time": "2018-07-13T07:18:09+00:00"
+            "support": {
+                "issues": "https://github.com/twigphp/Twig/issues",
+                "source": "https://github.com/twigphp/Twig/tree/v3.3.8"
+            },
+            "funding": [
+                {
+                    "url": "https://github.com/fabpot",
+                    "type": "github"
+                },
+                {
+                    "url": "https://tidelift.com/funding/github/packagist/twig/twig",
+                    "type": "tidelift"
+                }
+            ],
+            "time": "2022-02-04T06:59:48+00:00"
         }
     ],
     "packages-dev": [],
     "prefer-stable": false,
     "prefer-lowest": false,
     "platform": [],
-    "platform-dev": []
+    "platform-dev": [],
+    "plugin-api-version": "2.2.0"
 }
index 463e703e9bbfb66e78077a6aa2f4abb4a36bd1ce..61406be082bc9fc211468c605d110b5ae6663783 100644 (file)
@@ -6,11 +6,11 @@
  <body class="h-entry">
   <h1>Like #{{crow.comment_id}}</h1>
   <p>
-   {% spaceless %}
+   {% apply spaceless %}
    <a class="p-author h-card" href="{{author.url}}">
     <img class="u-photo" src="{{author.imageurl}}" alt="" width="32" height="32" />
     {{author.name}}</a>
-   {% endspaceless %}
+   {% endapply %}
    <a href="{{postUrl}}" class="u-url">likes</a>
    <a class="u-like-of"
       href="{{attribute(json, 'like-of').0}}">{{attribute(json, 'like-of').0}}</a>.
index 2c2e7cd48c29849ae11e98907fe114e82c7da049..1839e7cf494c971d45109cb5c81e8ca2a43afac7 100644 (file)
@@ -6,11 +6,11 @@
  <body class="h-entry">
   <h1>Comment #{{crow.comment_id}}</h1>
   <p>
-   {% spaceless %}
+   {% apply spaceless %}
    <a class="p-author h-card" href="{{author.url}}">
     <img class="u-photo" src="{{author.imageurl}}" alt="" width="32" height="32" />
     {{author.name}}</a>
-   {% endspaceless %}
+   {% endapply %}
    <a href="{{postUrl}}" class="u-url">wrote</a>
    the following reply to
    <a class="in-reply-to u-in-reply-to"
index dbca0979790f4b8f7f1b8c3ae90183e9ba0b03c9..37dd4b11e943eaf368b2209e2394790b480fc3d7 100644 (file)
@@ -4,8 +4,8 @@ require_once __DIR__ . '/../src/anoweco/autoload.php';
 
 header("Access-Control-Allow-Origin: *");
 
-$loader = new \Twig_Loader_Filesystem(__DIR__ . '/../data/templates/');
-$twig = new \Twig_Environment(
+$loader = new \Twig\Loader\FilesystemLoader(__DIR__ . '/../data/templates/');
+$twig = new \Twig\Environment(
     $loader,
     array(
         //'cache' => '/path/to/compilation_cache',
@@ -65,7 +65,7 @@ function error($description, $status = 'HTTP/1.0 400 Bad Request')
 
 function render($tplname, $vars = array(), $return = false)
 {
-    $template = $GLOBALS['twig']->loadTemplate($tplname . '.htm');
+    $template = $GLOBALS['twig']->load($tplname . '.htm');
 
     if ($return) {
         return $template->render($vars);
@@ -73,4 +73,4 @@ function render($tplname, $vars = array(), $return = false)
         echo $template->render($vars);
     }
 }
-?>
\ No newline at end of file
+?>