Skip to content
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

Make links in description body clickable #104

Merged
merged 5 commits into from
Feb 21, 2024
Merged

Make links in description body clickable #104

merged 5 commits into from
Feb 21, 2024

Conversation

trymebytes
Copy link
Collaborator

Fixes #76

@amieiro
Copy link
Collaborator

amieiro commented Feb 19, 2024

I am testing with 3 items:

  1. A link.
  2. An <a> item.
  3. An <img> item.

image

Only works the first item.

image

I don't know if it works correctly or not.

@trymebytes
Copy link
Collaborator Author

Nice catch, thank you!

Copy link
Member

@akirk akirk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sold on the output escaping, maybe we can improve it

<?php echo esc_html( $event_description ); ?>
<?php
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo make_clickable( wp_kses_post( $event_description ) );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not this which would not require the override?

Suggested change
echo make_clickable( wp_kses_post( $event_description ) );
echo wp_kses_post( make_clickable( $event_description ) );

$title = isset( $_POST['event_title'] ) ? sanitize_text_field( wp_unslash( $_POST['event_title'] ) ) : '';
$description = isset( $_POST['event_description'] ) ? sanitize_text_field( wp_unslash( $_POST['event_description'] ) ) : '';
$title = isset( $_POST['event_title'] ) ? sanitize_text_field( wp_unslash( $_POST['event_title'] ) ) : '';
//@codingStandardsIgnoreStart
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it an option to call make_clickable() already here? And why this style of disabling coding standards vs a phpcs:ignore style comment?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some tests, we could decide to call make_clickable() here or in the frontend it gives the same result. Do you suggest we rather call it here?

@trymebytes trymebytes requested a review from akirk February 20, 2024 10:30
templates/event.php Outdated Show resolved Hide resolved
Copy link
Member

@akirk akirk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok for me now!

@amieiro amieiro merged commit d4f4949 into trunk Feb 21, 2024
2 checks passed
@amieiro amieiro deleted the edit-improve branch February 21, 2024 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Edit Event Improvements
3 participants