Skip to content

Commit

Permalink
Merge pull request #2714 from QuizandSurveyMaster/CU-86cx3uzkc-qsm-li…
Browse files Browse the repository at this point in the history
…nk-shortcode-text-issue

Cu 86cx3uzkc qsm link shortcode text issue
  • Loading branch information
zubairraeen authored Nov 25, 2024
2 parents 4d77601 + bc8a3bd commit 4443ab7
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
45 changes: 43 additions & 2 deletions php/shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,51 @@ function qsm_quiz_link_shortcode( $atts, $content = '' ) {

// Craft the target attribute if one is passed to shortcode
$target_html = '';
$allowed_tags = apply_filters( 'qsm_quiz_link_allowed_tags', array(
'span' => array(
'class' => true,
'id' => true,
'style' => true,
),
'a' => array(
'href' => true,
'target' => true,
'class' => true,
'id' => true,
'rel' => true,
),
'img' => array(
'src' => true,
'alt' => true,
'width' => true,
'height' => true,
'class' => true,
'id' => true,
),
'div' => array(
'class' => true,
'id' => true,
'style' => true,
),
'h1' => array( 'class' => true ),
'h2' => array( 'class' => true ),
'h3' => array( 'class' => true ),
'h4' => array( 'class' => true ),
'h5' => array( 'class' => true ),
'h6' => array( 'class' => true ),
'p' => array(),
'br' => array(),
'b' => array(),
'strong' => array(),
'i' => array(),
'em' => array(),
'u' => array(),
) );

if ( ! empty( $target ) ) {
return "<a href='" . esc_url( $permalink ) . "' target='" . esc_attr( $target ) . "' class='" . esc_attr( $class ) . "'>" . esc_html( $content ) . '</a>';
return "<a href='" . esc_url( $permalink ) . "' target='" . esc_attr( $target ) . "' class='" . esc_attr( $class ) . "'>" . wp_kses( $content, $allowed_tags ) . '</a>';
} else {
return "<a href='" . esc_url( $permalink ) . "' class='" . esc_attr( $class ) . "'>" . esc_html( $content ) . '</a>';
return "<a href='" . esc_url( $permalink ) . "' class='" . esc_attr( $class ) . "'>" . wp_kses( $content, $allowed_tags ) . '</a>';
}
}

Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Contributors: quizsurvey,expresstech
Tags: quiz, survey, test, exam, online assessment
Requires at least: 4.9
Tested up to: 6.6
Tested up to: 6.7
Requires PHP: 5.4
Stable tag: 9.3.0
License: GPLv2
Expand Down

0 comments on commit 4443ab7

Please sign in to comment.