-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Internal: Add custom escaper for template renderer [ED-18015] #30189
Merged
Merged
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3b83587
Internal: Add custom escaper for template renderer [ED-18015]
Nevoss 006b41e
wip
Nevoss 6436ef7
Merge branch 'main' into ED-18015
elementorbot d1dae73
Merge branch 'main' into ED-18015
elementorbot 1884a5b
Merge branch 'main' into ED-18015
elementorbot b95ff54
Merge branch 'main' into ED-18015
elementorbot dc6f0b5
Merge branch 'main' into ED-18015
elementorbot 8df3cc2
Merge branch 'main' into ED-18015
elementorbot 2444aeb
Merge branch 'main' into ED-18015
elementorbot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
modules/atomic-widgets/elements/atomic-heading/atomic-heading.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{# TODO: Need to add base classes #} | ||
<{{ settings.tag | e('html_tag') }} | ||
class="{{ settings.classes | join(' ') }}" | ||
> | ||
{% if settings.link.href %} | ||
<a href="{{ settings.link.href | e('full_url') }}" target="{{ settings.link.target }}"> | ||
{{ settings.title }} | ||
</a> | ||
{% else %} | ||
{{ settings.title }} | ||
{% endif %} | ||
</{{ settings.tag | e('html_tag') }}> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 6 additions & 3 deletions
9
modules/atomic-widgets/elements/atomic-image/atomic-image.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
{# TODO: Need to escape the image src #} | ||
<img | ||
class="{{ settings.classes }}" | ||
class="{{ settings.classes | join(' ') }}" | ||
{% for attr, value in settings.image %} | ||
{{ attr | e('html_attr') }}="{{ value }}" | ||
{% if attr == 'src' %} | ||
src="{{ value | e('full_url') }}" | ||
{% else %} | ||
{{ attr | e('html_attr') }}="{{ value }}" | ||
{% endif %} | ||
{% endfor %} | ||
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
modules/atomic-widgets/props-resolver/transformers/array-transformer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Elementor\Modules\AtomicWidgets\PropsResolver\Transformers; | ||
|
||
use Elementor\Modules\AtomicWidgets\PropsResolver\Transformer_Base; | ||
|
||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; // Exit if accessed directly. | ||
} | ||
|
||
class Array_Transformer extends Transformer_Base { | ||
public function transform( $value, $key ) { | ||
if ( ! is_array( $value ) ) { | ||
return null; | ||
} | ||
|
||
return array_filter( $value ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ate-renderer/__snapshots__/Test_Template_Renderer__test_render__multiple_templates__1.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<div> | ||
<div class=""> | ||
<h1>This is my title</h1> | ||
<p>This comes from part</p> | ||
</div> | ||
|
2 changes: 1 addition & 1 deletion
2
tests/phpunit/elementor/modules/atomic-widgets/template-renderer/mocks/basic.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/phpunit/elementor/modules/atomic-widgets/template-renderer/mocks/with-part.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<div> | ||
<div class="{{ settings.classes | join (' ') }}"> | ||
<h1>{{ settings.title }}</h1> | ||
{% include 'elementor/parts/part' %} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
shouldn't it come sanitized from the props resolver?
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 have some validations, but as for today we validate it and also when printing sanitize it, just like
full_url
, this is the same. not sure about it, what do you think? I think if we are going to remove it, we also need to removefull_url