-
-
Notifications
You must be signed in to change notification settings - Fork 408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Working on #2972 Template Conversion to Twig Format (warnings.php) #2975
Conversation
Part 1 - User warning log
Nice! |
@@ -0,0 +1,31 @@ | |||
{% set row = alt_trow() %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@justinsoltesz was talking about completely removing alternating row classes. I've left them in the templates I've done too, but we might end up removing them (and the function) completely...
<tr> | ||
<td class="thead" colspan="5"> | ||
{% if warning_level > 0 %} | ||
<div class="float_right">{{ trans('current_warning_level', warning_level, user.warningpoints, mybb.settings.maxwarningpoints)|raw }}</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it's worth marking the trans
function as HTML safe... There are quite a few translations that have HTML in them unfortunately.
warnings.php
Outdated
ORDER BY w.expired ASC, w.dateline DESC | ||
LIMIT {$start}, {$perpage} | ||
"); | ||
while($warning = $db->fetch_array($query)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you've fixed codestyle elsewhere in this code, here's another one 😄
} | ||
|
||
$warning['username'] = htmlspecialchars_uni($warning['username']); | ||
$warning['issuedby'] = build_profile_link($warning['username'], $warning['issuedby']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably add this as a Twig function which is HTML safe. It's used fairly often afterall.
We should maybe add a CoreExtension
(or MybbExtension
or some other name) with some utilities like this, my_date
, and probably afew others.
warnings.php
Outdated
$warning_type = $warning['title']; | ||
} | ||
|
||
$warning['warning_type'] = htmlspecialchars_uni($warning_type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be escaped in the template too, so you can remove the htmlspecialchars_uni
here or else it will be double escaped and look weird.
Part 2 - Warning details
Part 3 - Warning a user
Done. All templates in warnings.php have been converted |
We should consider adding some Twig functions for the following:
|
@PaulBender Mind starting an issue for any Twig functions you find that would be useful? We can build a list in a single issue and cross them off as we implement them. |
…2975) * Working on #2972 Template Conversion to Twig Format (warnings.php) Part 1 - User warning log * Coding standards * Working on #2972 Template Conversion to Twig Format (warnings.php) Part 2 - Warning details * Working on #2972 Template Conversion to Twig Format (warnings.php) Part 3 - Warning a user
mybb#2975) * Working on mybb#2972 Template Conversion to Twig Format (warnings.php) Part 1 - User warning log * Coding standards * Working on mybb#2972 Template Conversion to Twig Format (warnings.php) Part 2 - Warning details * Working on mybb#2972 Template Conversion to Twig Format (warnings.php) Part 3 - Warning a user
mybb#2975) * Working on mybb#2972 Template Conversion to Twig Format (warnings.php) Part 1 - User warning log * Coding standards * Working on mybb#2972 Template Conversion to Twig Format (warnings.php) Part 2 - Warning details * Working on mybb#2972 Template Conversion to Twig Format (warnings.php) Part 3 - Warning a user
…2975) * Working on #2972 Template Conversion to Twig Format (warnings.php) Part 1 - User warning log * Coding standards * Working on #2972 Template Conversion to Twig Format (warnings.php) Part 2 - Warning details * Working on #2972 Template Conversion to Twig Format (warnings.php) Part 3 - Warning a user
…2975) * Working on #2972 Template Conversion to Twig Format (warnings.php) Part 1 - User warning log * Coding standards * Working on #2972 Template Conversion to Twig Format (warnings.php) Part 2 - Warning details * Working on #2972 Template Conversion to Twig Format (warnings.php) Part 3 - Warning a user
Working on #2972
This PR is for the warning system (warnings.php).