Skip to content

Commit

Permalink
Merge pull request #2101 from ahmedkaludi/1.30
Browse files Browse the repository at this point in the history
1.30
  • Loading branch information
shridhamdeveloper authored Apr 16, 2024
2 parents a8c7576 + 7a56152 commit d1010e7
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 33 deletions.
96 changes: 67 additions & 29 deletions modules/gutenberg/includes/class-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -547,20 +547,23 @@ public static function render_faq_data( $attributes ) {


case 'right':
echo '<img class="alignright" style="float:right;" '. html_entity_decode(esc_attr($item['image_align'])).'>';
echo '<img class="alignright" style="float:right;" '. esc_attr($item['image_align']).'>';
break;
case 'left':
echo '<img class="alignleft" style="float:left;" '. html_entity_decode(esc_attr($item['image_align'])).'>';
echo '<img class="alignleft" style="float:left;" '. esc_attr($item['image_align']).'>';
break;

default:
echo '<img class="alignleft" style="float:left;" '. html_entity_decode(esc_attr($item['image_align'])).'>';
echo '<img class="alignleft" style="float:left;" '. esc_attr($item['image_align']).'>';
break;
}
}

foreach($attributes['items'] as $item){

$block_title = isset($item['title'])?$item['title']:'';
$block_description = isset($item['description'])?$item['description']:'';

if($item['title'] || $item['description']){

if(!empty($item['questionID'])){
Expand All @@ -573,44 +576,57 @@ public static function render_faq_data( $attributes ) {
switch ($attributes['headingTag']) {

case 'h1':
echo '<h1>'. html_entity_decode(esc_attr($item['title'])).'</h1>';
echo sprintf('<h1>%s</h1>', esc_html($block_title));
break;
case 'h2':
echo '<h2>'. html_entity_decode(esc_attr($item['title'])).'</h2>';
echo sprintf('<h2>%s</h2>', esc_html($block_title));
break;
case 'h3':
echo '<h3>'. html_entity_decode(esc_attr($item['title'])).'</h3>';
echo sprintf('<h3>%s</h3>', esc_html($block_title));
break;
case 'h4':
echo '<h4>'. html_entity_decode(esc_attr($item['title'])).'</h4>';
echo sprintf('<h4>%s</h4>', esc_html($block_title));
break;
case 'h5':
echo '<h5>'. html_entity_decode(esc_attr($item['title'])).'</h5>';
echo sprintf('<h5>%s</h5>', esc_html($block_title));
break;
case 'h6':
echo '<h6>'. html_entity_decode(esc_attr($item['title'])).'</h6>';
echo sprintf('<h6>%s</h6>', esc_html($block_title));
break;
case 'div':
echo '<div>'. html_entity_decode(esc_attr($item['title'])).'</div>';
echo sprintf('<div>%s</div>', esc_html($block_title));
break;
case 'p':
echo '<p>'. html_entity_decode(esc_attr($item['title'])).'</p>';
echo sprintf('<p>%s</p>', esc_html($block_title));
break;
case 'strong':
echo '<strong>'. html_entity_decode(esc_attr($item['title'])).'</strong>';
echo sprintf('<strong>%s</strong>', esc_html($block_title));
break;


default:
echo '<h5>'. html_entity_decode(esc_attr($item['title'])).'</h5>';
echo sprintf('<h5>%s</h5>', esc_html($block_title));
break;
}

}else{
echo '<h5 class="saswp-faq-question-title">'. html_entity_decode(esc_attr($item['title'])).'</h5>';
echo sprintf('<h5 class="saswp-faq-question-title">%s</h5>', esc_html($block_title));
}

echo '<p class="saswp-faq-answer-text">'.html_entity_decode(esc_textarea($item['description'])).'</p>';
if(isset($item['description'])){
$allowed_tags = array('img' => array(
'class' => array(),
'id' => array(),
'style' => array(),
'src' => array(),
'key' => array(),
'alt' => array(),
'height' => array(),
'width' => array()
)
);
echo sprintf('<p class="saswp-faq-answer-text">%s</p>', wp_kses($item['description'], $allowed_tags));
}

}

Expand Down Expand Up @@ -692,7 +708,7 @@ public static function render_how_to_data( $attributes ) {
echo '</p>';
}
if(isset($attributes['description'])){
echo '<p>'.html_entity_decode(esc_attr($attributes['description'])).'</p>';
echo sprintf('<p>%s</p>', esc_html($attributes['description']));
}

if(isset($attributes['items'])){
Expand All @@ -704,42 +720,64 @@ public static function render_how_to_data( $attributes ) {



if(($attributes['listStyleType']=='none')){
echo'<ol '.$className.' style="list-style-type:none;">';
}elseif(($attributes['listStyleType']=='disc')){
echo'<ol '.$className.' style="list-style-type:disc;">';
}else{
if(isset($attributes['listStyleType'])){
if(($attributes['listStyleType']=='none')){
echo'<ol '.$className.' style="list-style-type:none;">';
}elseif(($attributes['listStyleType']=='disc')){
echo'<ol '.$className.' style="list-style-type:disc;">';
}else{
echo '<ol>';
}
}else{
echo '<ol>';
}
}

if(isset($item['image_align'])){

switch ($item['image_align']) {


case 'right':
echo '<img class="alignright"'. html_entity_decode(esc_attr($item['image_align'])).'>';
echo '<img class="alignright"'. esc_attr($item['image_align']).'>';
break;
case 'left':
echo '<img class="alignleft" '. html_entity_decode(esc_attr($item['image_align'])).'>';
echo '<img class="alignleft" '. esc_attr($item['image_align']).'>';
break;

default:
echo '<img class="alignleft" '. html_entity_decode(esc_attr($item['image_align'])).'>';
echo '<img class="alignleft" '. esc_attr($item['image_align']).'>';
break;
}
}

foreach($attributes['items'] as $item){

$block_title = isset($item['title'])?$item['title']:'';
$block_description = isset($item['description'])?$item['description']:'';

if($item['title'] || $item['description']){
echo '<li>';
if(isset($attributes['headingTag']) && !empty($attributes['headingTag']) && $attributes['headingTag'] == 'h1' || $attributes['headingTag'] == 'h2' || $attributes['headingTag'] == 'h3' || $attributes['headingTag'] == 'h4' || $attributes['headingTag'] == 'h5' || $attributes['headingTag'] == 'h6'){
echo '<'.html_entity_decode(esc_attr($attributes['headingTag'])).'>'. html_entity_decode(esc_attr($item['title'])).'</'.html_entity_decode(esc_attr($attributes['headingTag'])).'>';
if(isset($attributes['headingTag']) && !empty($attributes['headingTag'])){
$heading_array = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6');
if(in_array($attributes['headingTag'], $heading_array)){
echo sprintf('<%s> %s </%s>', esc_html($attributes['headingTag']), esc_html($block_title), esc_html($attributes['headingTag']));
}
}else{
echo '<h1 class="saswp-how-to-step-name">'. html_entity_decode(esc_attr($item['title'])).'</h1>';
echo sprintf('<h1 class="saswp-how-to-step-name">%s</h1>', esc_html($block_title));
}
echo '<p class="saswp-how-to-step-text">'.html_entity_decode(esc_textarea($item['description'])).'</p>';
$allowed_tags = array('img' => array(
'class' => array(),
'id' => array(),
'style' => array(),
'src' => array(),
'key' => array(),
'alt' => array(),
'height' => array(),
'width' => array()
)
);

echo sprintf('<p class="saswp-how-to-step-text">%s</p>', wp_kses($item['description'], $allowed_tags));
echo '</li>';
}

Expand Down
2 changes: 1 addition & 1 deletion output/gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ function saswp_gutenberg_faq_schema(){
$supply_data['@type'] = 'Question';
$supply_data['name'] = htmlspecialchars(wp_strip_all_tags($val['title']), ENT_QUOTES, 'UTF-8');
$supply_data['acceptedAnswer']['@type'] = 'Answer';
$supply_data['acceptedAnswer']['text'] = htmlspecialchars(wp_strip_all_tags(do_shortcode($val['description'])), ENT_QUOTES, 'UTF-8');
$supply_data['acceptedAnswer']['text'] = isset($val['description'])?htmlspecialchars(wp_strip_all_tags(do_shortcode($val['description'])), ENT_QUOTES, 'UTF-8'):'';

if(isset($val['imageId']) && $val['imageId'] !=''){

Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: Schema, Structured Data, Rich Snippets, SEO, AMP
Requires at least: 3.0
Tested up to: 6.5
Requires PHP: 5.6.20
Stable tag: 1.29
Stable tag: 1.30
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -121,6 +121,10 @@ You can contact us from [here](http://structured-data-for-wp.com/contact-us/)

== Changelog ==

= 1.30 (16 April 2024) =

* Fixed: Security vulnerability issues raised by Wordfence

= 1.29 (29 March 2024) =

* Fixed: PHP warning is showing on the user's end #2080
Expand Down
4 changes: 2 additions & 2 deletions structured-data-for-wp.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
Plugin Name: Schema & Structured Data for WP & AMP
Description: Schema & Structured Data adds Google Rich Snippets markup according to Schema.org guidelines to structure your site for SEO. (AMP Compatible)
Version: 1.29
Version: 1.30
Text Domain: schema-and-structured-data-for-wp
Domain Path: /languages
Author: Magazine3
Expand All @@ -13,7 +13,7 @@
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) exit;

define('SASWP_VERSION', '1.29');
define('SASWP_VERSION', '1.30');
define('SASWP_DIR_NAME_FILE', __FILE__ );
define('SASWP_DIR_NAME', dirname( __FILE__ ));
define('SASWP_DIR_URI', plugin_dir_url(__FILE__));
Expand Down

0 comments on commit d1010e7

Please sign in to comment.