Use apply tag instead of filter and fix for loop

https://twig.symfony.com/doc/1.x/tags/apply.html
https://twig.symfony.com/doc/2.x/deprecated.html#tags
"The filter tag is deprecated in Twig 2.9. Use the apply tag instead (the Twig\TokenParser\FilterTokenParser classes is also deprecated)."
and "Adding an if condition on a for tag is deprecated in Twig 2.10. Use a filter filter or an "if" condition inside the "for" body instead (if your condition depends on a variable updated inside the loop)"
Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2019-12-16 21:02:43 +01:00
parent 6f034732c3
commit b475cfdd6c
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889
4 changed files with 9 additions and 7 deletions

View File

@ -15,11 +15,11 @@
<div class="group"> <div class="group">
<h2>{% trans 'phpMyAdmin Demo Server' %}</h2> <h2>{% trans 'phpMyAdmin Demo Server' %}</h2>
<p class="cfg_dbg_demo"> <p class="cfg_dbg_demo">
{% filter format('<a href="url.php?url=https://demo.phpmyadmin.net/" target="_blank" rel="noopener noreferrer">demo.phpmyadmin.net</a>')|raw %} {% apply format('<a href="url.php?url=https://demo.phpmyadmin.net/" target="_blank" rel="noopener noreferrer">demo.phpmyadmin.net</a>')|raw %}
{% trans %} {% trans %}
You are using the demo server. You can do anything here, but please do not change root, debian-sys-maint and pma users. More information is available at %s. You are using the demo server. You can do anything here, but please do not change root, debian-sys-maint and pma users. More information is available at %s.
{% endtrans %} {% endtrans %}
{% endfilter %} {% endapply %}
</p> </p>
</div> </div>
{% endif %} {% endif %}

View File

@ -13,8 +13,10 @@ AJAX.scriptHandler
{% endfor %} {% endfor %}
; ;
$(function() { $(function() {
{% for file in files if file.has_onload %} {% for file in files %}
{% if file.has_onload %}
AJAX.fireOnload('{{ file.filename|escape_js_string }}'); AJAX.fireOnload('{{ file.filename|escape_js_string }}');
{% endif %}
{% endfor %} {% endfor %}
}); });
{% endif %} {% endif %}

View File

@ -12,11 +12,11 @@
{% elseif master_configure is null and clear_screen is null %} {% elseif master_configure is null and clear_screen is null %}
<fieldset> <fieldset>
<legend>{% trans 'Master replication' %}</legend> <legend>{% trans 'Master replication' %}</legend>
{% filter format('<a href="server_replication.php" data-post="' ~ get_common(url_params|merge({'mr_configure': true}), '') ~ '">', '</a>')|raw %} {% apply format('<a href="server_replication.php" data-post="' ~ get_common(url_params|merge({'mr_configure': true}), '') ~ '">', '</a>')|raw %}
{% trans %} {% trans %}
This server is not configured as master in a replication process. Would you like to %sconfigure%s it? This server is not configured as master in a replication process. Would you like to %sconfigure%s it?
{% endtrans %} {% endtrans %}
{% endfilter %} {% endapply %}
</fieldset> </fieldset>
{% endif %} {% endif %}

View File

@ -99,11 +99,11 @@
</ul> </ul>
</div> </div>
{% elseif not has_slave_configure %} {% elseif not has_slave_configure %}
{% filter format('<a href="server_replication.php" data-post="' ~ get_common(url_params|merge({ {% apply format('<a href="server_replication.php" data-post="' ~ get_common(url_params|merge({
'sl_configure': true, 'sl_configure': true,
'repl_clear_scr': true 'repl_clear_scr': true
})) ~ '">', '</a>')|raw %} })) ~ '">', '</a>')|raw %}
{% trans 'This server is not configured as slave in a replication process. Would you like to %sconfigure%s it?' %} {% trans 'This server is not configured as slave in a replication process. Would you like to %sconfigure%s it?' %}
{% endfilter %} {% endapply %}
{% endif %} {% endif %}
</fieldset> </fieldset>