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

Fixed allow html tags in field description #451

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion classes/input-meta.class.php
Original file line number Diff line number Diff line change
@@ -155,7 +155,7 @@ function field_label( $tooltip = true, $desc = true, $asterisk = true ) {

$asterisk_symbol = ( ! empty( $this->required() ) && $this->title() != '' ) ? '<span class="show_required"> *</span>' : '';

$show_desc = ( ! empty( $this->desc() ) ) ? '<span class="show_description ppom-input-desc">' . wp_strip_all_tags( html_entity_decode( $this->desc() ) ) . '</span>' : '';
$show_desc = ( ! empty( $this->desc() ) ) ? '<span class="show_description ppom-input-desc">' . $this->desc() . '</span>' : '';

if ( $desc ) {
$show_desc = apply_filters( 'ppom_field_description', $show_desc, self::$input_meta );
3 changes: 3 additions & 0 deletions inc/validation.php
Original file line number Diff line number Diff line change
@@ -37,6 +37,8 @@ function ppom_esc_html( $content ) {
'onclick' => array(),
'onchange' => array(),
'onkeyup' => array(),
'data-*' => array(),
'style' => array(),
);
$allowedposttags['form'] = $allowed_atts;
$allowedposttags['label'] = $allowed_atts;
@@ -72,6 +74,7 @@ function ppom_esc_html( $content ) {
$allowedposttags['a'] = $allowed_atts;
$allowedposttags['b'] = $allowed_atts;
$allowedposttags['i'] = $allowed_atts;
$allowedposttags['br'] = $allowed_atts;
$allowed_tags = wp_kses_allowed_html( 'post' );

return wp_kses( stripslashes_deep( $content ), $allowed_tags );
2 changes: 1 addition & 1 deletion templates/frontend/inputs/cropper.php
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ class="<?php echo esc_attr( $fm->field_inner_wrapper_classes() ); ?>">
<!-- if title of field exist -->
<?php if ( $field_label ) : ?>
<label class="<?php echo esc_attr( $fm->label_classes() ); ?>"
for="<?php echo esc_attr( $fm->data_name() ); ?>"><?php echo wp_kses( $field_label, array( 'span' => array( 'class' => true, 'data-*' => true, 'title' => true ) ) ); ?></label>
for="<?php echo esc_attr( $fm->data_name() ); ?>"><?php echo ppom_esc_html( $field_label ); ?></label>
<?php endif ?>


10 changes: 5 additions & 5 deletions templates/frontend/inputs/divider.php
Original file line number Diff line number Diff line change
@@ -103,7 +103,7 @@
if ( $divider_styles == 'style1' ) {
if ( $fm->field_label() ) {
?>
<h2 class="ppom-divider-with-txt ppom-divider-line ppom-divider-line-clr ppom-divider-txt"><?php echo wp_kses( $fm->field_label(), array( 'span' => array( 'class' => true, 'data-*' => true, 'title' => true ) ) ); ?></h2>
<h2 class="ppom-divider-with-txt ppom-divider-line ppom-divider-line-clr ppom-divider-txt"><?php echo ppom_esc_html( $fm->field_label() ); ?></h2>
<?php } else { ?>
<hr class="ppom-divider-<?php echo esc_attr( $style1_border ); ?>">
<?php
@@ -113,27 +113,27 @@

<!--Style 2-->
<?php if ( $divider_styles == 'style2' ) { ?>
<h2 class="ppom-divider-with-txt ppom-divider-gradient ppom-divider-txt"><?php echo wp_kses( $fm->field_label(), array( 'span' => array( 'class' => true, 'data-*' => true, 'title' => true ) ) ); ?></h2>
<h2 class="ppom-divider-with-txt ppom-divider-gradient ppom-divider-txt"><?php echo ppom_esc_html( $fm->field_label() ); ?></h2>
<?php } ?>

<!--Style 3-->
<?php if ( $divider_styles == 'style3' ) { ?>
<h2 class="ppom-divider-with-txt ppom-divider-donotcross ppom-divider-txt"><?php echo wp_kses( $fm->field_label(), array( 'span' => array( 'class' => true, 'data-*' => true, 'title' => true ) ) ); ?></h2>
<h2 class="ppom-divider-with-txt ppom-divider-donotcross ppom-divider-txt"><?php echo ppom_esc_html( $fm->field_label() ); ?></h2>
<?php } ?>

<!--Style 4-->
<?php if ( $divider_styles == 'style4' ) { ?>
<div class="ppom-divider-easy-shadow">
<span></span>
<span class="ppom-divider-txt"><?php echo wp_kses( $fm->field_label(), array( 'span' => array( 'class' => true, 'data-*' => true, 'title' => true ) ) ); ?></span>
<span class="ppom-divider-txt"><?php echo ppom_esc_html( $fm->field_label() ); ?></span>
<span></span>
</div>
<?php } ?>

<!--Style 5-->
<?php if ( $divider_styles == 'style5' ) { ?>

<h1 class="ppom-divider-fancy-heading ppom-divider-txt"><?php echo wp_kses( $fm->field_label(), array( 'span' => array( 'class' => true, 'data-*' => true, 'title' => true ) ) ); ?></h1>
<h1 class="ppom-divider-fancy-heading ppom-divider-txt"><?php echo ppom_esc_html( $fm->field_label() ); ?></h1>
<div class="ppom-divider-fancy-line">
<span></span>
</div>
2 changes: 1 addition & 1 deletion templates/frontend/inputs/file.php
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ class="<?php echo esc_attr( $fm->field_inner_wrapper_classes() ); ?>">
class="<?php echo esc_attr( $fm->label_classes() ); ?>"
for="<?php echo esc_attr( $fm->data_name() ); ?>"
>
<?php echo wp_kses( $field_label, array( 'span' => array( 'class' => true, 'data-*' => true, 'title' => true ) ) ); ?>
<?php echo ppom_esc_html( $field_label ); ?>
</label>
<?php endif ?>

2 changes: 1 addition & 1 deletion templates/frontend/inputs/quantities.php
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@
class="<?php echo esc_attr( $fm->label_classes() ); ?>"
for="<?php echo esc_attr( $fm->data_name() ); ?>"
>
<?php echo wp_kses( $fm->field_label(), array( 'span' => array( 'class' => true, 'data-*' => true, 'title' => true ) ) ); ?>
<?php echo ppom_esc_html( $fm->field_label() ); ?>
</label>
<?php endif ?>

2 changes: 1 addition & 1 deletion templates/frontend/inputs/text.php
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@
class="<?php echo esc_attr( $fm->label_classes() ); ?>"
for="<?php echo esc_attr( $fm->data_name() ); ?>"
>
<?php echo wp_kses( $fm->field_label(), array( 'span' => array( 'class' => true, 'data-*' => true, 'title' => true ) ) ); ?>
<?php echo ppom_esc_html( $fm->field_label() ); ?>
</label>
<?php endif ?>