Plugin Directory

Changeset 3213041


Ignore:
Timestamp:
12/25/2024 04:27:08 PM (15 months ago)
Author:
premila
Message:

Fixed reviewer issues.

Location:
gutensee
Files:
92 added
8 edited

Legend:

Unmodified
Added
Removed
  • gutensee/trunk/gutensee.php

    r3198319 r3213041  
    44* Plugin URI:
    55* Description:          Gutensee Plugin
    6 * Version:              1.0.3
     6* Version:              1.0.4
    77* Requires at least:    5.3
    88* Requires PHP:         5.4
     
    1515* Domain Path:          /lang
    1616*/
    17 
    1817if( !defined( 'ABSPATH' ) ) {exit(); }
    19 define('GUTENSEE__VERSION', '1.0.3');
     18define('GUTENSEE_VERSION', '1.0.4');
    2019define('GUTENSEE_PLUGIN_PATH',trailingslashit(plugin_dir_path(__FILE__)));
    2120define('GUTENSEE_PLUGIN_URL',trailingslashit(plugins_url('/',__FILE__)));
     
    110109}
    111110add_action( 'wp_head', 'gutensee_add_template' );
     111
     112function gutensee_save_gravatar_to_media_library($gravatar_url) {
     113    // Validate Gravatar URL
     114    if (empty($gravatar_url) || !filter_var($gravatar_url, FILTER_VALIDATE_URL)) {
     115        return new WP_Error('invalid_url', 'The provided Gravatar URL is not valid.');
     116    }
     117
     118    // Parse URL to get the filename
     119    $parsed_url = wp_parse_url($gravatar_url);
     120    $query_params = [];
     121    if (!empty($parsed_url['query'])) {
     122        parse_str($parsed_url['query'], $query_params);
     123    }
     124    $filename = sanitize_file_name(md5($gravatar_url) . '.jpg'); // Unique filename based on the URL
     125
     126    // Get the upload directory
     127    $upload_dir = wp_upload_dir();
     128    $file_path = trailingslashit($upload_dir['path']) . $filename;
     129
     130    // Check if the file already exists
     131    if (file_exists($file_path)) {
     132        $attachment_id = attachment_url_to_postid($upload_dir['url'] . '/' . $filename);
     133        if ($attachment_id) {
     134            return $attachment_id; // Return existing attachment ID
     135        }
     136    }
     137
     138    // Fetch the image data
     139    $response = wp_remote_get($gravatar_url);
     140    if (is_wp_error($response)) {
     141        return new WP_Error('fetch_error', 'Failed to fetch the Gravatar image.');
     142    }
     143
     144    $image_data = wp_remote_retrieve_body($response);
     145    if (empty($image_data)) {
     146        return new WP_Error('empty_image_data', 'The image data is empty.');
     147    }
     148
     149    // Load WP_Filesystem
     150    if (empty($GLOBALS['wp_filesystem'])) {
     151        require_once ABSPATH . 'wp-admin/includes/file.php';
     152        WP_Filesystem();
     153    }
     154
     155    global $wp_filesystem;
     156
     157    // Write image data to the file
     158    if (!$wp_filesystem->put_contents($file_path, $image_data, FS_CHMOD_FILE)) {
     159        return new WP_Error('file_write_error', 'Failed to write the image file.');
     160    }
     161
     162    // Check file type and prepare attachment data
     163    $filetype = wp_check_filetype($filename, null);
     164    $attachment_data = array(
     165        'post_mime_type' => $filetype['type'],
     166        'post_title'     => sanitize_file_name($filename),
     167        'post_content'   => '',
     168        'post_status'    => 'inherit',
     169    );
     170
     171    // Insert attachment into the Media Library
     172    $attachment_id = wp_insert_attachment($attachment_data, $file_path);
     173    if (is_wp_error($attachment_id)) {
     174        return $attachment_id; // Return error if failed
     175    }
     176
     177    // Generate attachment metadata
     178    require_once ABSPATH . 'wp-admin/includes/image.php';
     179    $attachment_metadata = wp_generate_attachment_metadata($attachment_id, $file_path);
     180    wp_update_attachment_metadata($attachment_id, $attachment_metadata);
     181
     182    return $attachment_id; // Return attachment ID
     183}
     184
  • gutensee/trunk/inc/blocks/breadcrumbs.php

    r3175185 r3213041  
    5353    $homeicon=($attributes['enableicon']==true)? '<i class="fa-solid fa-house"></i>' : '';
    5454    $home=($attributes['enablehomebreadcumb']==true)? 'Home' : '';
    55     $output .= '<a class="breadcrumbs-icon" href="' . home_url() . '">'.$homeicon.'</a>';
     55    $output .= '<a class="breadcrumbs-icon" href="' . home_url() . '">'.wp_kses_post($homeicon).'</a>';
    5656    $output .= '<a href="' . home_url() . '">'.$home.'</a>';
    5757
     
    122122    $output .= '</div>';
    123123    $output .= '</div></div>';
    124     $output .=$attributes['addjs'];
     124    $output .=esc_html($attributes['addjs']);
    125125    return $output;
    126126}
  • gutensee/trunk/inc/blocks/contact-us.php

    r3175185 r3213041  
    1919                    <div class="custom-contact-name">
    2020                        <div class="contact-form-field">
    21                             <?php if($attributes['enablelabel']==true){?><label for="name"><?php echo esc_html($attributes['namelabel'],'gutensee'); ?></label><?php } ?>
    22                             <input type="text" id="name" name="name" <?php if($attributes['enableplaceholder']==true){?>placeholder="<?php echo esc_attr($attributes['nameholder'],'gutensee'); ?>"<?php } ?> class="contact-form-input-field name" required><br>
     21                            <?php if($attributes['enablelabel']==true){?><label for="name"><?php echo esc_html($attributes['namelabel']); ?></label><?php } ?>
     22                            <input type="text" id="name" name="name" <?php if($attributes['enableplaceholder']==true){?>placeholder="<?php echo esc_attr($attributes['nameholder']); ?>"<?php } ?> class="contact-form-input-field name" required><br>
    2323                        </div>
    2424                    </div>
     
    2828                    <div class="custom-contact-email">
    2929                        <div class="contact-form-field">
    30                             <?php if($attributes['enablelabel']==true){?><label for="email"><?php echo esc_html($attributes['emaillabel'],'gutensee'); ?></label><?php } ?>
    31                             <input type="email" id="email" name="email" <?php if($attributes['enableplaceholder']==true){?>placeholder="<?php echo esc_attr($attributes['nameholder'],'gutensee'); ?>"<?php } ?> class="contact-form-input-field email " required><br>
     30                            <?php if($attributes['enablelabel']==true){?><label for="email"><?php echo esc_html($attributes['emaillabel']); ?></label><?php } ?>
     31                            <input type="email" id="email" name="email" <?php if($attributes['enableplaceholder']==true){?>placeholder="<?php echo esc_attr($attributes['nameholder']); ?>"<?php } ?> class="contact-form-input-field email " required><br>
    3232                        </div>
    3333                    </div>
     
    3737                    <div class="custom-contact-subject">
    3838                        <div class="contact-form-field">
    39                           <?php if($attributes['enablelabel']==true){?><label for="subject"><?php echo esc_html($attributes['subjectlabel'],'gutensee'); ?></label><?php } ?>
    40                           <input type="text" id="subject" name="subject" <?php if($attributes['enableplaceholder']==true){?>placeholder="<?php echo esc_attr($attributes['subjectholder'],'gutensee'); ?>"<?php } ?> class="contact-form-input-field subject" required><br>
     39                          <?php if($attributes['enablelabel']==true){?><label for="subject"><?php echo esc_html($attributes['subjectlabel']); ?></label><?php } ?>
     40                          <input type="text" id="subject" name="subject" <?php if($attributes['enableplaceholder']==true){?>placeholder="<?php echo esc_attr($attributes['subjectholder']); ?>"<?php } ?> class="contact-form-input-field subject" required><br>
    4141                        </div>
    4242                    </div>
     
    4747                        <div class="contact-form-field">
    4848                          <?php if($attributes['enablelabel']==true){?><label for="subject"><?php echo esc_html($attributes['mobilelabel'],'gutensee'); ?></label><?php } ?>
    49                           <input type="text" id="mobile" name="mobile" <?php if($attributes['enableplaceholder']==true){?>placeholder="<?php echo esc_attr($attributes['mobileholder'],'gutensee'); ?>"<?php } ?> class="contact-form-input-field mobile" required><br>
     49                          <input type="text" id="mobile" name="mobile" <?php if($attributes['enableplaceholder']==true){?>placeholder="<?php echo esc_attr($attributes['mobileholder']); ?>"<?php } ?> class="contact-form-input-field mobile" required><br>
    5050                        </div>
    5151                    </div>
     
    5555                    <div class="custom-contact-message">
    5656                        <div class="contact-form-field">
    57                           <?php if($attributes['enablelabel']==true){?><label for="message"><?php echo esc_html($attributes['mesglabel'],'gutensee'); ?></label><?php } ?>
    58                           <textarea rows="4" id="message" name="message" <?php if($attributes['enableplaceholder']==true){?>placeholder="<?php echo esc_attr($attributes['mesgholder'],'gutensee'); ?>"<?php } ?> class="contact-form-input-field message" required></textarea><br>
     57                          <?php if($attributes['enablelabel']==true){?><label for="message"><?php echo esc_html($attributes['mesglabel']); ?></label><?php } ?>
     58                          <textarea rows="4" id="message" name="message" <?php if($attributes['enableplaceholder']==true){?>placeholder="<?php echo esc_attr($attributes['mesgholder']); ?>"<?php } ?> class="contact-form-input-field message" required></textarea><br>
    5959                        </div>
    6060                    </div>
    6161                <?php } ?>
    6262                <div class="custom-contact-button">
    63                     <button type="submit" class="contact-form-button"><?php echo esc_html($attributes['btnlabel'],'gutensee'); ?></button>
     63                    <button type="submit" class="contact-form-button"><?php echo esc_html($attributes['btnlabel']); ?></button>
    6464                </div>
    6565           </div>
     
    133133
    134134    // Email details
    135     $to = get_option('admin_email');
     135    $to = esc_html(get_option('admin_email'));
    136136    $headers = array('Content-Type: text/html; charset=UTF-8');
    137     $mail_subject = "New Contact Message from $name";
     137    $mail_subject = "New Contact Message from ".esc_html($name)."";
    138138
    139139    // Create the message body with correct labels
    140     $mail_body = "<strong>Name:</strong> $name <br/>";
    141     $mail_body .= "<strong>Email:</strong> $email <br/>";
    142     $mail_body .= "<strong>Subject:</strong> $subject <br/>";
    143     $mail_body .= "<strong>Mobile:</strong> $mobile <br/>";
    144     $mail_body .= "<strong>Message:</strong> $message <br/>";
     140    $mail_body = "<strong>Name:</strong>".esc_html($name)."<br/>";
     141    $mail_body .= "<strong>Email:</strong>".esc_html($email)."<br/>";
     142    $mail_body .= "<strong>Subject:</strong>".esc_html($subject)."<br/>";
     143    $mail_body .= "<strong>Mobile:</strong>".esc_html($mobile)."<br/>";
     144    $mail_body .= "<strong>Message:</strong>".esc_html($message)."<br/>";
    145145
    146146    // Send the mail
  • gutensee/trunk/inc/blocks/latest-post.php

    r3192394 r3213041  
    8080    }
    8181
    82 
    83     $bordertop=(!empty($attributes['border']['top'])) ? $attributes['border']['top']['width'].' '. $attributes['border']['top']['style'].' '. $attributes['border']['top']['color'] : null;
    84     $borderright=(!empty($attributes['border']['right'])) ? $attributes['border']['right']['width'].' '. $attributes['border']['right']['style'].' '. $attributes['border']['right']['color'] : null;
    85     $borderbottom=(!empty($attributes['border']['bottom'])) ? $attributes['border']['bottom']['width'].' '. $attributes['border']['bottom']['style'].' '. $attributes['border']['bottom']['color'] : null;
    86     $borderleft=(!empty($attributes['border']['left'] )) ? $attributes['border']['left']['width'].' '. $attributes['border']['left']['style'].' '. $attributes['border']['left']['color'] : null;
    87 
    88     $navbordertop=(!empty($attributes['navborder']['top'])) ? $attributes['navborder']['top']['width'].' '. $attributes['navborder']['top']['style'].' '. $attributes['navborder']['top']['color'] : null;
    89     $navborderright=(!empty($attributes['navborder']['right'])) ? $attributes['navborder']['right']['width'].' '. $attributes['navborder']['right']['style'].' '. $attributes['navborder']['right']['color'] : null;
    90     $navborderbottom=(!empty($attributes['navborder']['bottom'])) ? $attributes['navborder']['bottom']['width'].' '. $attributes['navborder']['bottom']['style'].' '. $attributes['navborder']['bottom']['color'] : null;
    91     $navborderleft=(!empty($attributes['navborder']['left'] )) ? $attributes['navborder']['left']['width'].' '. $attributes['navborder']['left']['style'].' '. $attributes['navborder']['left']['color'] : null;
    92 
    93     $dotsbordertop=(!empty($attributes['dotsborder']['top'])) ? $attributes['dotsborder']['top']['width'].' '. $attributes['dotsborder']['top']['style'].' '. $attributes['dotsborder']['top']['color'] : null;
    94     $dotsborderright=(!empty($attributes['dotsborder']['right'])) ? $attributes['dotsborder']['right']['width'].' '. $attributes['dotsborder']['right']['style'].' '. $attributes['dotsborder']['right']['color'] : null;
    95     $dotsborderbottom=(!empty($attributes['dotsborder']['bottom'])) ? $attributes['dotsborder']['bottom']['width'].' '. $attributes['dotsborder']['bottom']['style'].' '. $attributes['dotsborder']['bottom']['color'] : null;
    96     $dotsborderleft=(!empty($attributes['dotsborder']['left'] )) ? $attributes['dotsborder']['left']['width'].' '. $attributes['dotsborder']['left']['style'].' '. $attributes['dotsborder']['left']['color'] : null;
    97 
    98     $featuredbordertop=(!empty($attributes['featuredborder']['top'])) ? $attributes['featuredborder']['top']['width'].' '. $attributes['featuredborder']['top']['style'].' '. $attributes['featuredborder']['top']['color'] : null;
    99     $featuredborderright=(!empty($attributes['featuredborder']['right'])) ? $attributes['featuredborder']['right']['width'].' '. $attributes['featuredborder']['right']['style'].' '. $attributes['featuredborder']['right']['color'] : null;
    100     $featuredborderbottom=(!empty($attributes['featuredborder']['bottom'])) ? $attributes['featuredborder']['bottom']['width'].' '. $attributes['featuredborder']['bottom']['style'].' '. $attributes['featuredborder']['bottom']['color'] : null;
    101     $featuredborderleft=(!empty($attributes['featuredborder']['left'] )) ? $attributes['featuredborder']['left']['width'].' '. $attributes['featuredborder']['left']['style'].' '. $attributes['featuredborder']['left']['color'] : null;
    102 
    103     $metabordertop=(!empty($attributes['metaborder']['top'])) ? $attributes['metaborder']['top']['width'].' '. $attributes['metaborder']['top']['style'].' '. $attributes['metaborder']['top']['color'] : null;
    104     $metaborderright=(!empty($attributes['metaborder']['right'])) ? $attributes['metaborder']['right']['width'].' '. $attributes['metaborder']['right']['style'].' '. $attributes['metaborder']['right']['color'] : null;
    105     $metaborderbottom=(!empty($attributes['metaborder']['bottom'])) ? $attributes['metaborder']['bottom']['width'].' '. $attributes['metaborder']['bottom']['style'].' '. $attributes['metaborder']['bottom']['color'] : null;
    106     $metaborderleft=(!empty($attributes['metaborder']['left'] )) ? $attributes['metaborder']['left']['width'].' '. $attributes['metaborder']['left']['style'].' '. $attributes['metaborder']['left']['color'] : null;
    107 
    108     $headingbordertop=(!empty($attributes['headingborder']['top'])) ? $attributes['headingborder']['top']['width'].' '. $attributes['headingborder']['top']['style'].' '. $attributes['headingborder']['top']['color'] : null;
    109     $headingborderright=(!empty($attributes['headingborder']['right'])) ? $attributes['headingborder']['right']['width'].' '. $attributes['headingborder']['right']['style'].' '. $attributes['headingborder']['right']['color'] : null;
    110     $headingborderbottom=(!empty($attributes['headingborder']['bottom'])) ? $attributes['headingborder']['bottom']['width'].' '. $attributes['headingborder']['bottom']['style'].' '. $attributes['headingborder']['bottom']['color'] : null;
    111     $headingborderleft=(!empty($attributes['headingborder']['left'] )) ? $attributes['headingborder']['left']['width'].' '. $attributes['headingborder']['left']['style'].' '. $attributes['headingborder']['left']['color'] : null;   
    112 
    113     $contentbordertop=(!empty($attributes['contentborder']['top'] )) ? $attributes['contentborder']['top']['width'].' '. $attributes['contentborder']['top']['style'].' '. $attributes['contentborder']['top']['color'] : null;
    114     $contentborderright=(!empty($attributes['contentborder']['right'] )) ? $attributes['contentborder']['right']['width'].' '. $attributes['contentborder']['right']['style'].' '. $attributes['contentborder']['right']['color'] : null;
    115     $contentborderbottom=(!empty($attributes['contentborder']['bottom'] )) ? $attributes['contentborder']['bottom']['width'].' '. $attributes['contentborder']['bottom']['style'].' '. $attributes['contentborder']['bottom']['color'] : null;
    116     $contentborderleft=(!empty($attributes['contentborder']['left'] )) ? $attributes['contentborder']['left']['width'].' '. $attributes['contentborder']['left']['style'].' '. $attributes['contentborder']['left']['color'] : null;
    117 
    118     $buttonbordertop=(!empty($attributes['buttonborder']['top'])) ? $attributes['buttonborder']['top']['width'].' '. $attributes['buttonborder']['top']['style'].' '. $attributes['buttonborder']['top']['color'] : null;
    119     $buttonborderright=(!empty($attributes['buttonborder']['right'])) ? $attributes['buttonborder']['right']['width'].' '. $attributes['buttonborder']['right']['style'].' '. $attributes['buttonborder']['right']['color'] : null;
    120     $buttonborderbottom=(!empty($attributes['buttonborder']['bottom'])) ? $attributes['buttonborder']['bottom']['width'].' '. $attributes['buttonborder']['bottom']['style'].' '. $attributes['buttonborder']['bottom']['color'] : null;
    121     $buttonborderleft=(!empty($attributes['buttonborder']['left'] )) ? $attributes['buttonborder']['left']['width'].' '. $attributes['buttonborder']['left']['style'].' '. $attributes['buttonborder']['left']['color'] : null;
    122 
    123     $borderwidth=(!empty($attributes['border']['width']))? $attributes['border']['width'] :null;
    124     $borderstyle=(!empty($attributes['border']['style']))? $attributes['border']['style'] :null;
    125     $bordercolor=(!empty($attributes['border']['color']))? $attributes['border']['color'] :null;
    126 
    127     $navborderwidth=(!empty($attributes['navborder']['width']))? $attributes['navborder']['width'] :null;
    128     $navborderstyle=(!empty($attributes['navborder']['style']))? $attributes['navborder']['style'] :null;
    129     $navbordercolor=(!empty($attributes['navborder']['color']))? $attributes['navborder']['color'] :null;
    130 
    131     $dotsborderwidth=(!empty($attributes['dotsborder']['width']))? $attributes['dotsborder']['width'] :null;
    132     $dotsborderstyle=(!empty($attributes['dotsborder']['style']))? $attributes['dotsborder']['style'] :null;
    133     $dotsbordercolor=(!empty($attributes['dotsborder']['color']))? $attributes['dotsborder']['color'] :null;
    134 
    135     $featuredborderwidth=(!empty($attributes['featuredborder']['width']))? $attributes['featuredborder']['width'] :null;
    136     $featuredborderstyle=(!empty($attributes['featuredborder']['style']))? $attributes['featuredborder']['style'] :null;
    137     $featuredbordercolor=(!empty($attributes['featuredborder']['color']))? $attributes['featuredborder']['color'] :null;
    138 
    139     $metaborderwidth=(!empty($attributes['metaborder']['width']))? $attributes['metaborder']['width'] :null;
    140     $metaborderstyle=(!empty($attributes['metaborder']['style']))? $attributes['metaborder']['style'] :null;
    141     $metabordercolor=(!empty($attributes['metaborder']['color']))? $attributes['metaborder']['color'] :null;
    142 
    143     $headingborderwidth=(!empty($attributes['headingborder']['width']))? $attributes['headingborder']['width'] :null;
    144     $headingborderstyle=(!empty($attributes['headingborder']['style']))? $attributes['headingborder']['style'] :null;
    145     $headingbordercolor=(!empty($attributes['headingborder']['color']))? $attributes['headingborder']['color'] :null;
    146 
    147     $contentborderwidth=(!empty($attributes['contentborder']['width']))? $attributes['contentborder']['width'] :null;
    148     $contentborderstyle=(!empty($attributes['contentborder']['style']))? $attributes['contentborder']['style'] :null;
    149     $contentbordercolor=(!empty($attributes['contentborder']['color']))? $attributes['contentborder']['color'] :null;
    150 
    151     $buttonborderwidth=(!empty($attributes['buttonborder']['width']))? $attributes['buttonborder']['width'] :null;
    152     $buttonborderstyle=(!empty($attributes['buttonborder']['style']))? $attributes['buttonborder']['style'] :null;
    153     $buttonbordercolor=(!empty($attributes['buttonborder']['color']))? $attributes['buttonborder']['color'] :null;
    154 
    155     $ColumnClass='';
    156     $Rowclass='';
    157     switch($attributes['poststyle']){
    158         case 'grid-layout':
    159             $ColumnClass='block-col-'.$attributes['columnNumber'];
    160             $Rowclass='block-row';
    161             break;
    162         case 'list-layout':
    163             $ColumnClass='block-col-12';
    164             $Rowclass='block-row';
    165             break;
    166         case 'masonry-layout':
    167             $ColumnClass='masonry-column';
    168             $Rowclass='masonry-row masonry-layout-'.$attributes['columnNumber'];
    169             break;
    170         case 'cover-layout':
    171             $ColumnClass='block-col-'.$attributes['columnNumber'];
    172             $Rowclass='block-row';
    173             break;
    174         default:
    175             $ColumnClass='block-col-'.$attributes['columnNumber'];
    176             $Rowclass='block-row';
    177             break;
    178     }
    179 
    18082    $list_items_markup .= $attributes['addcss'];
    18183    $list_items_markup .= $attributes['addjs'];
    18284
    183     $list_items_markup .='<div id="'.$attributes['advid'].'"><div id="'.$uniqueid.'" class="post-query-loop '.$Rowclass.' single-item '.$uniqueid.' '.$attributes['addclass'].' '.$displayclass.' '. $animationclass.' '.$attributes['addclass'].'">';
     85    $list_items_markup .='<div id="'.esc_attr($attributes['advid']).'"><div id="'.esc_attr($uniqueid).'" class="post-query-loop '.esc_attr($Rowclass).' single-item '.esc_attr($uniqueid).' '.esc_attr($attributes['addclass']).' '.esc_attr($displayclass).' '. esc_attr($animationclass).' '.esc_attr($attributes['addclass']).'">';
    18486
    18587    foreach ( $recent_posts as $post ) {
     
    19193        }
    19294
    193         $post_content_class='';
    194 
    195         if ( $attributes['displayFeaturedImage'] &&  has_post_thumbnail( $post ) ){
    196             $post_content_class="post";
    197         }else{
    198             $post_content_class="post gutensee-remove-img";
    199         }
    20095        $columnno=$attributes['columnNumber'];
    201         $list_items_markup .= '<div class="'.$ColumnClass.'" id="'.$attributes["addid"].'">';
     96        $list_items_markup .= '<div class="'.esc_attr($ColumnClass).'" id="'.esc_attr($attributes["addid"]).'">';
    20297
    20398        if($attributes['poststyle']=='grid-layout'){
     
    243138                            $opacity= ($attributes['bgImageOverlay']) ? $attributes['bgOverlayOpacity'] : '';
    244139                            $list_items_markup .= '<div class="featured-image post-thumbnail">
    245                                                         <div class="overlay" style="background-color:'.$backgroundColor.';opacity:'.$opacity.'"></div>
    246                                                         '.$image_markup.'
     140                                                        <div class="overlay" style="background-color:'.esc_attr($backgroundColor).';opacity:'.esc_attr($opacity).'"></div>
     141                                                        '.wp_kses_post($image_markup).'
    247142                                                    </div>';
    248143                    }
     
    265160                                if ( ! empty( $author_display_name ) ) {
    266161                                    if($attributes['authortype']==='image'){
    267                                         $list_items_markup .= sprintf(
    268                                             '<span class="author"><img width="1060" height="766" src="'.$author_display_url.'" class="img-fluid" alt="user-1"><a href="'.esc_url( $author_display_link).'">%1$s</a></span>',
    269                                             $byline
    270                                         );
     162                                        $attachment_id = gutensee_save_gravatar_to_media_library($author_display_url);
     163                                        if (is_wp_error($attachment_id)) {
     164                                            echo esc_html('Error: ' . $attachment_id->get_error_message(),'gutensee');
     165                                        }
     166                                        else {
     167                                            // Use wp_get_attachment_image to display the image
     168                                            $list_items_markup .= sprintf(
     169                                                '<span class="author">'.wp_get_attachment_image($attachment_id, 'thumbnail', false, array('class' => 'img-fluid', 'alt'   => esc_attr($title),'width' => '1060', 'height'=> '766',)).'<a href="'.esc_url( $author_display_link).'">%1$s</a></span>',
     170                                                esc_html($byline)
     171                                            );
     172                                        }                                       
    271173                                    }else{
    272174                                        $list_items_markup .= sprintf(
    273175                                            '<span class="author"><i class="fa-regular fa-user"></i>&nbsp;&nbsp;<a href="'.esc_url( $author_display_link).'">%1$s</a></span>',
    274                                             $byline
     176                                            esc_html($byline)
    275177                                        );
    276178                                    }
     
    302204                                $list_items_markup .= sprintf(
    303205                                    '<span class="comments-link"><i class="far fa-comment"></i>&nbsp;&nbsp;<a href="%2$s/#comments">Comments(%1$s)</a></span>',
    304                                     $commentcounts,
     206                                    esc_html($commentcounts),
    305207                                    esc_url( $post_link )
    306208                                );           
     
    324226                        if (  $attributes['disablebtn'] !=false &&  $attributes['displayPostContentRadio'] === 'excerpt'  ) {
    325227                            $target=($attributes['opennewtab']) ?'_blank':'_self';
    326                             $btn_markup .='<a  href="'.esc_url( $post_link ).'" class="more-link" target="'.$target.'">'.$attributes['buttonlabel'].'<i class="fas fa-arrow-right"></i></a>';
     228                            $btn_markup .='<a  href="'.esc_url( $post_link ).'" class="more-link" target="'.$target.'">'.$attributes['buttonlabel'].'&nbsp;<i class="fas fa-arrow-right"></i></a>';
    327229                        }
    328230
     
    346248                            && isset( $attributes['displayPostContentRadio'] ) && 'full_post' === $attributes['displayPostContentRadio'] ) {
    347249
    348                             $post_content = html_entity_decode( $post->post_content, ENT_QUOTES, get_option( 'blog_charset' ) );
     250                            $post_content = html_entity_decode( $post->post_content, ENT_QUOTES, esc_html(get_option( 'blog_charset' )) );
    349251
    350252                            if ( post_password_required( $post ) ) {
     
    404306                    $opacity= ($attributes['bgImageOverlay']) ? $attributes['bgOverlayOpacity'] : '';
    405307                    $list_items_markup .= '<div class="featured-image post-thumbnail">
    406                                                 <div class="overlay" style="background-color:'.$backgroundColor.';opacity:'.$opacity.'"></div>
    407                                                 '.$image_markup.'
     308                                                <div class="overlay" style="background-color:'.esc_attr($backgroundColor).';opacity:'.esc_attr($opacity).'"></div>
     309                                                '.wp_kses_post($image_markup).'
    408310                                            </div>';
    409311                }
     
    428330                                        if ( ! empty( $author_display_name ) ) {
    429331                                            if($attributes['authortype']==='image'){
    430                                                 $list_items_markup .= sprintf(
    431                                                     '<span class="author"><img width="1060" height="766" src="'.$author_display_url.'" class="img-fluid" alt="user-1"><a href="'.esc_url( $author_display_link).'">%1$s</a></span>',
    432                                                     $byline
    433                                                 );
     332                                                $attachment_id = gutensee_save_gravatar_to_media_library($author_display_url);
     333                                                if (is_wp_error($attachment_id)) {
     334                                                    echo esc_html('Error: ' . $attachment_id->get_error_message(),'gutensee');
     335                                                }
     336                                                else {
     337                                                    // Use wp_get_attachment_image to display the image
     338                                                    $list_items_markup .= sprintf(
     339                                                        '<span class="author">'.wp_get_attachment_image($attachment_id, 'thumbnail', false, array('class' => 'img-fluid', 'alt'   => esc_attr($title),'width' => '1060', 'height'=> '766',)).'<a href="'.esc_url( $author_display_link).'">%1$s</a></span>',
     340                                                        esc_html($byline)
     341                                                    );
     342                                                } 
    434343                                            }else{
    435344                                                $list_items_markup .= sprintf(
    436345                                                    '<span class="author"><i class="fa-regular fa-user"></i>&nbsp;&nbsp;<a href="'.esc_url( $author_display_link).'">%1$s</a></span>',
    437                                                     $byline
     346                                                    esc_html($byline)
    438347                                                );
    439348                                            }
     
    465374                                        $list_items_markup .= sprintf(
    466375                                            '<span class="comments-link"><i class="far fa-comment"></i>&nbsp;&nbsp;<a href="%2$s/#comments">Comments(%1$s)</a></span>',
    467                                             $commentcounts,
     376                                            esc_html($commentcounts),
    468377                                            esc_url( $post_link )
    469378                                        );           
     
    478387                                        '<header class="post-entry-header"><h3 class="post-entry-title"><a class="wp-block-latest-posts__post-title" href="%1$s">%2$s</a></h3></header>',
    479388                                        esc_url( $post_link ),
    480                                         $title
     389                                        esc_html($title)
    481390                                    );
    482391                                }
     
    487396                                if (  $attributes['disablebtn'] !=false &&  $attributes['displayPostContentRadio'] === 'excerpt'  ) {
    488397                                    $target=($attributes['opennewtab']) ?'_blank':'_self';
    489                                     $btn_markup .='<a  href="'.esc_url( $post_link ).'" class="more-link" target="'.$target.'">'.$attributes['buttonlabel'].'<i class="fas fa-arrow-right"></i></a>';
     398                                    $btn_markup .='<a  href="'.esc_url( $post_link ).'" class="more-link" target="'.esc_attr($target).'">'.esc_html($attributes['buttonlabel']).'&nbsp;<i class="fas fa-arrow-right"></i></a>';
    490399                                }
    491400
     
    501410                                    $list_items_markup .= sprintf(
    502411                                        '<div class="post-entry-content wp-block-latest-posts__post-excerpt"><p class="spbb-entry-content">%1$s</p>%2$s</div>',
    503                                         $trimmed_excerpt,
    504                                         $btn_markup
     412                                        esc_html($trimmed_excerpt),
     413                                        wp_kses_post($btn_markup)
    505414                                    );
    506415                                }
     
    509418                                    && isset( $attributes['displayPostContentRadio'] ) && 'full_post' === $attributes['displayPostContentRadio'] ) {
    510419
    511                                     $post_content = html_entity_decode( $post->post_content, ENT_QUOTES, get_option( 'blog_charset' ) );
     420                                    $post_content = html_entity_decode( $post->post_content, ENT_QUOTES, esc_html(get_option( 'blog_charset' )) );
    512421
    513422                                    if ( post_password_required( $post ) ) {
     
    572481                            $opacity= ($attributes['bgImageOverlay']) ? $attributes['bgOverlayOpacity'] : '';
    573482                            $list_items_markup .= '<div class="featured-image post-thumbnail">
    574                                                         <div class="overlay" style="background-color:'.$backgroundColor.';opacity:'.$opacity.'"></div>
    575                                                         '.$image_markup.'
     483                                                        <div class="overlay" style="background-color:'.esc_attr($backgroundColor).';opacity:'.esc_attr($opacity).'"></div>
     484                                                        '.wp_kses_post($image_markup).'
    576485                                                    </div>';
    577486                    }
     
    594503                                if ( ! empty( $author_display_name ) ) {
    595504                                    if($attributes['authortype']==='image'){
    596                                         $list_items_markup .= sprintf(
    597                                             '<span class="author"><img width="1060" height="766" src="'.$author_display_url.'" class="img-fluid" alt="user-1"><a href="'.esc_url( $author_display_link).'">%1$s</a></span>',
    598                                             $byline
    599                                         );
     505                                        $attachment_id = gutensee_save_gravatar_to_media_library($author_display_url);
     506                                        if (is_wp_error($attachment_id)) {
     507                                            echo esc_html('Error: ' . $attachment_id->get_error_message(),'gutensee');
     508                                        }
     509                                        else {
     510                                            // Use wp_get_attachment_image to display the image
     511                                            $list_items_markup .= sprintf(
     512                                                '<span class="author">'.wp_get_attachment_image($attachment_id, 'thumbnail', false, array('class' => 'img-fluid', 'alt'   => esc_attr($title),'width' => '1060', 'height'=> '766',)).'<a href="'.esc_url( $author_display_link).'">%1$s</a></span>',
     513                                                esc_html($byline)
     514                                            );
     515                                        } 
    600516                                    }else{
    601517                                        $list_items_markup .= sprintf(
    602518                                            '<span class="author"><i class="fa-regular fa-user"></i>&nbsp;&nbsp;<a href="'.esc_url( $author_display_link).'">%1$s</a></span>',
    603                                             $byline
     519                                            esc_html($byline)
    604520                                        );
    605521                                    }
     
    631547                                $list_items_markup .= sprintf(
    632548                                    '<span class="comments-link"><i class="far fa-comment"></i>&nbsp;&nbsp;<a href="%2$s/#comments">Comments(%1$s)</a></span>',
    633                                     $commentcounts,
     549                                    esc_html($commentcounts),
    634550                                    esc_url( $post_link )
    635551                                );           
     
    644560                                '<header class="post-entry-header"><h3 class="post-entry-title"><a class="wp-block-latest-posts__post-title" href="%1$s">%2$s</a></h3></header>',
    645561                                esc_url( $post_link ),
    646                                 $title
     562                                esc_html($title)
    647563                            );
    648564                        }                       
     
    653569                        if (  $attributes['disablebtn'] !=false &&  $attributes['displayPostContentRadio'] === 'excerpt'  ) {
    654570                            $target=($attributes['opennewtab']) ?'_blank':'_self';
    655                             $btn_markup .='<a  href="'.esc_url( $post_link ).'" class="more-link" target="'.$target.'">'.$attributes['buttonlabel'].'<i class="fas fa-arrow-right"></i></a>';
     571                            $btn_markup .='<a  href="'.esc_url( $post_link ).'" class="more-link" target="'.esc_attr($target).'">'.esc_html($attributes['buttonlabel']).'&nbsp;<i class="fas fa-arrow-right"></i></a>';
    656572                        }
    657573
     
    667583                            $list_items_markup .= sprintf(
    668584                                '<div class="post-entry-content wp-block-latest-posts__post-excerpt"><p class="spbb-entry-content">%1$s</p>%2$s</div>',
    669                                 $trimmed_excerpt,
    670                                 $btn_markup
     585                                esc_html($trimmed_excerpt),
     586                                wp_kses_post($btn_markup)
    671587                            );
    672588                        }
     
    675591                            && isset( $attributes['displayPostContentRadio'] ) && 'full_post' === $attributes['displayPostContentRadio'] ) {
    676592
    677                             $post_content = html_entity_decode( $post->post_content, ENT_QUOTES, get_option( 'blog_charset' ) );
     593                            $post_content = html_entity_decode( $post->post_content, ENT_QUOTES, esc_html(get_option( 'blog_charset' )) );
    678594
    679595                            if ( post_password_required( $post ) ) {
     
    733649                    $opacity= ($attributes['bgImageOverlay']) ? $attributes['bgOverlayOpacity'] : '';
    734650                    $list_items_markup .= '<div class="featured-image post-thumbnail">
    735                                                 <div class="overlay" style="background-color:'.$backgroundColor.';opacity:'.$opacity.'"></div>
    736                                                 '.$image_markup.'
     651                                                <div class="overlay" style="background-color:'.esc_attr($backgroundColor).';opacity:'.esc_attr($opacity).'"></div>
     652                                                '.wp_kses_post($image_markup).'
    737653                                            </div>';
    738654                }
     
    757673                                        if ( ! empty( $author_display_name ) ) {
    758674                                            if($attributes['authortype']==='image'){
    759                                                 $list_items_markup .= sprintf(
    760                                                     '<span class="author"><img width="1060" height="766" src="'.$author_display_url.'" class="img-fluid" alt="user-1"><a href="'.esc_url( $author_display_link).'">%1$s</a></span>',
    761                                                     $byline
    762                                                 );
     675                                                $attachment_id = gutensee_save_gravatar_to_media_library($author_display_url);
     676                                                if (is_wp_error($attachment_id)) {
     677                                                    echo esc_html('Error: ' . $attachment_id->get_error_message(),'gutensee');
     678                                                }
     679                                                else {
     680                                                    // Use wp_get_attachment_image to display the image
     681                                                    $list_items_markup .= sprintf(
     682                                                        '<span class="author">'.wp_get_attachment_image($attachment_id, 'thumbnail', false, array('class' => 'img-fluid', 'alt'   => esc_attr($title),'width' => '1060', 'height'=> '766',)).'<a href="'.esc_url( $author_display_link).'">%1$s</a></span>',
     683                                                        esc_html($byline)
     684                                                    );
     685                                                } 
    763686                                            }else{
    764687                                                $list_items_markup .= sprintf(
    765688                                                    '<span class="author"><i class="fa-regular fa-user"></i>&nbsp;&nbsp;<a href="'.esc_url( $author_display_link).'">%1$s</a></span>',
    766                                                     $byline
     689                                                    esc_html($byline)
    767690                                                );
    768691                                            }
     
    794717                                        $list_items_markup .= sprintf(
    795718                                            '<span class="comments-link"><i class="far fa-comment"></i>&nbsp;&nbsp;<a href="%2$s/#comments">Comments(%1$s)</a></span>',
    796                                             $commentcounts,
     719                                            esc_html($commentcounts),
    797720                                            esc_url( $post_link )
    798721                                        );           
     
    807730                                        '<header class="post-entry-header"><h3 class="post-entry-title"><a class="wp-block-latest-posts__post-title" href="%1$s">%2$s</a></h3></header>',
    808731                                        esc_url( $post_link ),
    809                                         $title
     732                                        esc_html($title)
    810733                                    );
    811734                                }
     
    816739                                if (  $attributes['disablebtn'] !=false &&  $attributes['displayPostContentRadio'] === 'excerpt'  ) {
    817740                                    $target=($attributes['opennewtab']) ?'_blank':'_self';
    818                                     $btn_markup .='<a  href="'.esc_url( $post_link ).'" class="more-link" target="'.$target.'">'.$attributes['buttonlabel'].'<i class="fas fa-arrow-right"></i></a>';
     741                                    $btn_markup .='<a  href="'.esc_url( $post_link ).'" class="more-link" target="'.esc_attr($target).'">'.esc_html($attributes['buttonlabel']).'&nbsp;<i class="fas fa-arrow-right"></i></a>';
    819742                                }
    820743
     
    830753                                    $list_items_markup .= sprintf(
    831754                                        '<div class="post-entry-content wp-block-latest-posts__post-excerpt"><p class="spbb-entry-content">%1$s</p>%2$s</div>',
    832                                         $trimmed_excerpt,
    833                                         $btn_markup
     755                                        esc_html($trimmed_excerpt),
     756                                        wp_kses_post($btn_markup)
    834757                                    );
    835758                                }
     
    838761                                    && isset( $attributes['displayPostContentRadio'] ) && 'full_post' === $attributes['displayPostContentRadio'] ) {
    839762
    840                                     $post_content = html_entity_decode( $post->post_content, ENT_QUOTES, get_option( 'blog_charset' ) );
     763                                    $post_content = html_entity_decode( $post->post_content, ENT_QUOTES, esc_html(get_option( 'blog_charset' )) );
    841764
    842765                                    if ( post_password_required( $post ) ) {
     
    887810    }
    888811
    889     $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $class ) );
     812    $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => esc_attr($class) ) );
    890813
    891814    $list_items_markup .='</div></div>';
  • gutensee/trunk/inc/blocks/navbar.php

    r3192394 r3213041  
    10681068        $bool = true;
    10691069        //print_r($menu_items);die();
    1070          $frontpage_id = get_option( 'page_on_front' );
    1071         $page_for_posts = get_option( 'page_for_posts' );
     1070         $frontpage_id = esc_html(get_option( 'page_on_front' ));
     1071        $page_for_posts = esc_html(get_option( 'page_for_posts' ));
    10721072        // echo 'dev-'.$page_for_posts;
    10731073        foreach( $menu_items as $menu_item ) {
     
    10831083                        $bool = true;$str2='';
    10841084                        $active=(($submenu->object_id==get_the_id() && !is_front_page()) || ($submenu->title==is_category($submenu->object_id)) || ($submenu->object_id==$frontpage_id && is_front_page()) || ($submenu->object_id==$page_for_posts && is_home())  ) ? 'active' :'';
    1085                         $str2 .= '<a class="' . $submenu->object_id . ' nav-link" href="' . $submenu->url . '" >' . $submenu->title;
    1086                         $parents = $submenu->ID;
     1085                        $str2 .= '<a class="' . esc_attr($submenu->object_id) . ' nav-link" href="' . esc_url($submenu->url) . '" >' . esc_html($submenu->title);
     1086                        $parents = esc_html($submenu->ID);
    10871087                        $str='';
    10881088                        $activert='';
     
    10971097                                     $active10=(($submenus1->object_id==get_the_id()) || ($submenus1->title==is_category($submenus1->object_id)) || ($submenus1->object_id==$frontpage_id && is_front_page()) || ($submenus1->object_id==$page_for_posts && is_home()) ) ? 'active' :'';
    10981098                                    if( $submenus1->menu_item_parent == $parents1 ) {
    1099                                         $str3 .= '<li class="3 menu-item menu-item-type-post_type menu-item-object-page '.$active10.' '. $submenus1->object_id .' '.get_the_id().'"><a class="nav-link" href="' . $submenus1->url . '" >' . $submenus1->title . '</a></li>';
     1099                                        $str3 .= '<li class="3 menu-item menu-item-type-post_type menu-item-object-page '.esc_attr($active10).' '. esc_attr($submenus1->object_id ).' '.get_the_id().'"><a class="nav-link" href="' .esc_url($submenus1->url) . '" >' . esc_html($submenus1->title) . '</a></li>';
    11001100                                     $activert10.=($active10==='active' ) ? 'active' :'';
    11011101                                 }
    11021102                                }
    1103                                 $def=($str3!='')?'<ul class="dropdown-menu 3">'.$str3.'</ul>':'';
     1103                                $def=($str3!='')?'<ul class="dropdown-menu 3">'.esc_html($str3).'</ul>':'';
    11041104                                $activert.=($active1==='active' || $activert10==='active') ? 'active' :'';
    11051105                               
    11061106                                if($def!=''){
    1107                                     $str .= '<li class="3 menu-item dropdown menu-item-type-post_type menu-item-object-page '.$activert10.' '.$active1.' '. $submenus->object_id .' '.get_the_id().'"><a class="nav-link" href="' . $submenus->url . '" >' . $submenus->title . '<i class="fas fa-caret-down"></i></a>'.$def.'</li>';
     1107                                    $str .= '<li class="3 menu-item dropdown menu-item-type-post_type menu-item-object-page '.esc_attr($activert10).' '.esc_attr($active1).' '. esc_attr($submenus->object_id) .' '.get_the_id().'"><a class="nav-link" href="' . esc_url($submenus->url) . '" >' . esc_html($submenus->title) . '<i class="fas fa-caret-down"></i></a>'.esc_html($def).'</li>';
    11081108                                }else{
    1109                                     $str .= '<li class="3 menu-item menu-item-type-post_type menu-item-object-page '.$activert10.' '.$active1.' '. $submenus->object_id .' '.get_the_id().'"><a class="nav-link" href="' . $submenus->url . '" >' . $submenus->title . '</a></li>';
     1109                                    $str .= '<li class="3 menu-item menu-item-type-post_type menu-item-object-page '.esc_attr($activert10).' '.esc_attr($active1).' '. esc_attr($submenus->object_id).' '.get_the_id().'"><a class="nav-link" href="' . esc_url($submenus->url) . '" >' . esc_html($submenus->title) . '</a></li>';
    11101110                                }
    11111111
     
    11131113                        }
    11141114                        if($str!=null){
    1115                         $menu_array[] ='<li class="2 menu-item  menu-item-has-children dropdown '.$active.' '.$activert.'">';
     1115                        $menu_array[] ='<li class="2 menu-item  menu-item-has-children dropdown '.esc_attr($active).' '.esc_attr($activert).'">';
    11161116                        $menu_array[] .= $str2;                   
    11171117                        $menu_array[] .= '<i class="fas fa-caret-down"></i></a>';
     
    11351135                    $active2=(($menu_item->object_id==get_the_id()  && !is_front_page()) || ($menu_item->title==is_category($menu_item->object_id)) || ($menu_item->object_id==$frontpage_id && is_front_page()) || ($menu_item->object_id==$page_for_posts && is_home()) ) ? 'active' :'';
    11361136                    $menu_list .= '<li class="1 menu-item  menu-item-has-children dropdown '.$active2.' '.$dractive.' '.$drpreactive.'">';
    1137                     $menu_list .= '<a class="nav-link" href="'.$menu_item->url.'">'.$menu_item->title.'<i class="fas fa-caret-down"></i></a>';
     1137                    $menu_list .= '<a class="nav-link" href="'.esc_url($menu_item->url).'">'.esc_html($menu_item->title).'<i class="fas fa-caret-down"></i></a>';
    11381138                     
    11391139                    $menu_list .= '<ul class="dropdown-menu">' ."\n";
     
    11451145                    $active2=(($menu_item->object_id==get_the_id()  && !is_front_page()) || ($menu_item->title==is_category($menu_item->object_id)) || ($menu_item->object_id==$frontpage_id && is_front_page()) || ($menu_item->object_id==$page_for_posts && is_home())) ? 'active' :'';
    11461146                    $menu_list .= '<li class=" 5 menu-item menu-item-type-post_type menu-item-object-page '.$active2.' '.$dractive.'">';
    1147                     $menu_list .= '<a class="nav-link" href="'.$menu_item->url.'">' . $menu_item->title . '</a>';
     1147                    $menu_list .= '<a class="nav-link" href="'.esc_url($menu_item->url).'">' . esc_html($menu_item->title) . '</a>';
    11481148                }
    11491149                 
     
    11591159            $menu_list .='<li class="menu-item header-button">
    11601160                            <a  class="theme-btn btn-style-one nav-link"  style="outline: none;">
    1161                               <span class="txt">'.$attributes['btntext'].'</span>
     1161                              <span class="txt">'.esc_html($attributes['btntext']).'</span>
    11621162                            </a>
    11631163                          </li>';
     
    11811181        }
    11821182    } else {
    1183         $menu_list = '<!-- no menu defined in location "'.$theme_location.'" -->';
     1183        $menu_list = '<!-- no menu defined in location "'.esc_html($theme_location).'" -->';
    11841184    }
    11851185 
     
    11981198    $displayclass=$displaydesktop.' '.$displaytablet.' '.$displaymobile;
    11991199
    1200     $bordertop=(!empty($attributes['border']['top'])) ? $attributes['border']['top']['width'].' '. $attributes['border']['top']['style'].' '. $attributes['border']['top']['color'] : null;
    1201     $borderright=(!empty($attributes['border']['right'])) ? $attributes['border']['right']['width'].' '. $attributes['border']['right']['style'].' '. $attributes['border']['right']['color'] : null;
    1202     $borderbottom=(!empty($attributes['border']['bottom'])) ? $attributes['border']['bottom']['width'].' '. $attributes['border']['bottom']['style'].' '. $attributes['border']['bottom']['color'] : null;
    1203     $borderleft=(!empty($attributes['border']['left'] )) ? $attributes['border']['left']['width'].' '. $attributes['border']['left']['style'].' '. $attributes['border']['left']['color'] : null;
    1204 
    1205     $menubordertop=(!empty($attributes['menuborder']['top'])) ? $attributes['menuborder']['top']['width'].' '. $attributes['menuborder']['top']['style'].' '. $attributes['menuborder']['top']['color'] : null;
    1206     $menuborderright=(!empty($attributes['menuborder']['right'])) ? $attributes['menuborder']['right']['width'].' '. $attributes['menuborder']['right']['style'].' '. $attributes['menuborder']['right']['color'] : null;
    1207     $menuborderbottom=(!empty($attributes['menuborder']['bottom'])) ? $attributes['menuborder']['bottom']['width'].' '. $attributes['menuborder']['bottom']['style'].' '. $attributes['menuborder']['bottom']['color'] : null;
    1208     $menuborderleft=(!empty($attributes['menuborder']['left'] )) ? $attributes['menuborder']['left']['width'].' '. $attributes['menuborder']['left']['style'].' '. $attributes['menuborder']['left']['color'] : null;
    1209 
    1210     $ddbordertop=(!empty($attributes['ddborder']['top'])) ? $attributes['ddborder']['top']['width'].' '. $attributes['ddborder']['top']['style'].' '. $attributes['ddborder']['top']['color'] : null;
    1211     $ddborderright=(!empty($attributes['ddborder']['right'])) ? $attributes['ddborder']['right']['width'].' '. $attributes['ddborder']['right']['style'].' '. $attributes['ddborder']['right']['color'] : null;
    1212     $ddborderbottom=(!empty($attributes['ddborder']['bottom'])) ? $attributes['ddborder']['bottom']['width'].' '. $attributes['ddborder']['bottom']['style'].' '. $attributes['ddborder']['bottom']['color'] : null;
    1213     $ddborderleft=(!empty($attributes['ddborder']['left'] )) ? $attributes['ddborder']['left']['width'].' '. $attributes['ddborder']['left']['style'].' '. $attributes['ddborder']['left']['color'] : null;
    1214 
    1215     $submenubordertop=(!empty($attributes['submenuborder']['top'])) ? $attributes['submenuborder']['top']['width'].' '. $attributes['submenuborder']['top']['style'].' '. $attributes['submenuborder']['top']['color'] : null;
    1216     $submenuborderright=(!empty($attributes['submenuborder']['right'])) ? $attributes['submenuborder']['right']['width'].' '. $attributes['submenuborder']['right']['style'].' '. $attributes['submenuborder']['right']['color'] : null;
    1217     $submenuborderbottom=(!empty($attributes['submenuborder']['bottom'])) ? $attributes['submenuborder']['bottom']['width'].' '. $attributes['submenuborder']['bottom']['style'].' '. $attributes['submenuborder']['bottom']['color'] : null;
    1218     $submenuborderleft=(!empty($attributes['submenuborder']['left'] )) ? $attributes['submenuborder']['left']['width'].' '. $attributes['submenuborder']['left']['style'].' '. $attributes['submenuborder']['left']['color'] : null;
    1219 
    1220     $togglebordertop=(!empty($attributes['toggleborder']['top'])) ? $attributes['toggleborder']['top']['width'].' '. $attributes['toggleborder']['top']['style'].' '. $attributes['toggleborder']['top']['color'] : null;
    1221     $toggleborderright=(!empty($attributes['toggleborder']['right'])) ? $attributes['toggleborder']['right']['width'].' '. $attributes['toggleborder']['right']['style'].' '. $attributes['toggleborder']['right']['color'] : null;
    1222     $toggleborderbottom=(!empty($attributes['toggleborder']['bottom'])) ? $attributes['toggleborder']['bottom']['width'].' '. $attributes['toggleborder']['bottom']['style'].' '. $attributes['toggleborder']['bottom']['color'] : null;
    1223     $toggleborderleft=(!empty($attributes['toggleborder']['left'] )) ? $attributes['toggleborder']['left']['width'].' '. $attributes['toggleborder']['left']['style'].' '. $attributes['toggleborder']['left']['color'] : null;
    1224 
    1225     $btnbordertop=(!empty($attributes['btnborder']['top'])) ? $attributes['btnborder']['top']['width'].' '. $attributes['btnborder']['top']['style'].' '. $attributes['btnborder']['top']['color'] : null;
    1226     $btnborderright=(!empty($attributes['btnborder']['right'])) ? $attributes['btnborder']['right']['width'].' '. $attributes['btnborder']['right']['style'].' '. $attributes['btnborder']['right']['color'] : null;
    1227     $btnborderbottom=(!empty($attributes['btnborder']['bottom'])) ? $attributes['btnborder']['btnbottom']['width'].' '. $attributes['btnborder']['bottom']['style'].' '. $attributes['btnborder']['bottom']['color'] : null;
    1228     $btnborderleft=(!empty($attributes['btnborder']['left'] )) ? $attributes['border']['left']['width'].' '. $attributes['border']['left']['style'].' '. $attributes['btnborder']['left']['color'] : null;
    1229 
    1230     $sbtnbordertop=(!empty($attributes['sbtnborder']['top'])) ? $attributes['sbtnborder']['top']['width'].' '. $attributes['sbtnborder']['top']['style'].' '. $attributes['sbtnborder']['top']['color'] : null;
    1231     $sbtnborderright=(!empty($attributes['sbtnborder']['right'])) ? $attributes['sbtnborder']['right']['width'].' '. $attributes['sbtnborder']['right']['style'].' '. $attributes['sbtnborder']['right']['color'] : null;
    1232     $sbtnborderbottom=(!empty($attributes['sbtnborder']['bottom'])) ? $attributes['sbtnborder']['bottom']['width'].' '. $attributes['sbtnborder']['bottom']['style'].' '. $attributes['sbtnborder']['bottom']['color'] : null;
    1233     $sbtnborderleft=(!empty($attributes['sbtnborder']['left'] )) ? $attributes['sbtnborder']['left']['width'].' '. $attributes['sbtnborder']['left']['style'].' '. $attributes['sbtnborder']['left']['color'] : null;
    1234 
    1235     $sformbordertop=(!empty($attributes['sformborder']['top'])) ? $attributes['sformborder']['top']['width'].' '. $attributes['sformborder']['top']['style'].' '. $attributes['sformborder']['top']['color'] : null;
    1236     $sformborderright=(!empty($attributes['sformborder']['right'])) ? $attributes['sformborder']['right']['width'].' '. $attributes['sformborder']['right']['style'].' '. $attributes['sformborder']['right']['color'] : null;
    1237     $sformborderbottom=(!empty($attributes['sformborder']['bottom'])) ? $attributes['sformborder']['bottom']['width'].' '. $attributes['sformborder']['bottom']['style'].' '. $attributes['sformborder']['bottom']['color'] : null;
    1238     $sformborderleft=(!empty($attributes['sformborder']['left'] )) ? $attributes['sformborder']['left']['width'].' '. $attributes['sformborder']['left']['style'].' '. $attributes['sformborder']['left']['color'] : null;
    1239 
    1240 
    1241     $iconbordertop=(!empty($attributes['iconborder']['top'])) ? $attributes['iconborder']['top']['width'].' '. $attributes['border']['top']['style'].' '. $attributes['iconborder']['top']['color'] : null;
    1242     $iconborderright=(!empty($attributes['iconborder']['right'])) ? $attributes['iconborder']['right']['width'].' '. $attributes['iconborder']['right']['style'].' '. $attributes['iconborder']['right']['color'] : null;
    1243     $iconborderbottom=(!empty($attributes['iconborder']['bottom'])) ? $attributes['iconborder']['bottom']['width'].' '. $attributes['iconborder']['bottom']['style'].' '. $attributes['iconborder']['iconbottom']['color'] : null;
    1244     $iconborderleft=(!empty($attributes['iconborder']['left'] )) ? $attributes['iconborder']['left']['width'].' '. $attributes['iconborder']['left']['style'].' '. $attributes['iconborder']['left']['color'] : null;
    1245 
    1246     $borderwidth=(!empty($attributes['border']['width']))? $attributes['border']['width'] :null;
    1247     $borderstyle=(!empty($attributes['border']['style']))? $attributes['border']['style'] :null;
    1248     $bordercolor=(!empty($attributes['border']['color']))? $attributes['border']['color'] :null;
    1249 
    1250     $menuboxshadow=($attributes['boxshadow'] === true) ? ''.$attributes['vshadow'].'px '.$attributes['hshadow'].'px '.$attributes['blurshadow'].'px '.$attributes['shadowColor'].'' : '';
    1251     $smenuboxshadow=($attributes['sboxshadow'] === true) ? ''.$attributes['svshadow'].'px '.$attributes['shshadow'].'px '.$attributes['sblurshadow'].'px '.$attributes['sshadowColor'].'' : '';
    1252     $sbmenuboxshadow=($attributes['sbboxshadow'] === true) ? ''.$attributes['sbvshadow'].'px '.$attributes['sbhshadow'].'px '.$attributes['sbblurshadow'].'px '.$attributes['sbshadowColor'].'' : '';
    1253 
    1254     $list_items_markup .= $attributes['addcss'];
     1200    $list_items_markup .= wp_kses_post($attributes['addcss']);
    12551201
    12561202    $alignmentClass = ($attributes['textAlignment'] != null) ? 'has-text-align-'.$attributes['textAlignment'].'' : '';
     
    12621208        $list_items_markup .= '<!-- Brand and toggle get grouped for better mobile display -->';
    12631209        $list_items_markup .= '<div class="gutensee-header">';
    1264         $list_items_markup .= '<button id="'.$uniqueid01.'" class="gutensee-toggle '.$uniqueid.' '.$attributes['toggleposition'].' '.$attributes['togglepositiontab'].' '.$attributes['togglepositionmob'].' '.$attributes['advclass'].'" data-toggle="collapse" type="button" aria-controls="menu" aria-expanded="false">';
     1210        $list_items_markup .= '<button id="'.esc_attr($uniqueid01).'" class="gutensee-toggle '.esc_attr($uniqueid).' '.esc_attr($attributes['toggleposition']).' '.esc_attr($attributes['togglepositiontab']).' '.esc_attr($attributes['togglepositionmob']).' '.esc_attr($attributes['advclass']).'" data-toggle="collapse" type="button" aria-controls="menu" aria-expanded="false">';
    12651211        $list_items_markup .= '<i class="fas fa-bars"></i>';
    12661212        $list_items_markup .= '</button></div>';
    12671213        $list_items_markup .= '<!-- Collect the nav links, forms, and other content for toggling -->';
    1268         $list_items_markup .= '<div class="collapse gutensee-collapse '.$uniqueid.'" id="custom-collapse">';
    1269         $list_items_markup .= '<div class="gutensee-blocks-menu navigation '.$alignmentClass.' '.$displayclass.' '.$attributes['addclass'].'" id="'.$uniqueid.'">';
     1214        $list_items_markup .= '<div class="collapse gutensee-collapse '.esc_attr($uniqueid).'" id="custom-collapse">';
     1215        $list_items_markup .= '<div class="gutensee-blocks-menu navigation '.esc_attr($alignmentClass).' '.esc_attr($displayclass).' '.esc_attr($attributes['addclass']).'" id="'.esc_attr($uniqueid).'">';
    12701216        $list_items_markup .= $menu_list;
    12711217        $list_items_markup .= '</div>';
     
    12741220        $list_items_markup .= '</nav></div>';
    12751221    }
    1276     $list_items_markup .=$attributes['addjs'];
     1222    $list_items_markup .=wp_kses_post($attributes['addjs']);
    12771223    return $list_items_markup;     
    12781224}
  • gutensee/trunk/inc/blocks/post-query.php

    r3192394 r3213041  
    6363
    6464    $animationclass='wow animated '.$attributes['durations'].' '.$attributes['animation'];
    65 
    66 
    67     $bordertop=(!empty($attributes['border']['top'])) ? $attributes['border']['top']['width'].' '. $attributes['border']['top']['style'].' '. $attributes['border']['top']['color'] : null;
    68     $borderright=(!empty($attributes['border']['right'])) ? $attributes['border']['right']['width'].' '. $attributes['border']['right']['style'].' '. $attributes['border']['right']['color'] : null;
    69     $borderbottom=(!empty($attributes['border']['bottom'])) ? $attributes['border']['bottom']['width'].' '. $attributes['border']['bottom']['style'].' '. $attributes['border']['bottom']['color'] : null;
    70     $borderleft=(!empty($attributes['border']['left'] )) ? $attributes['border']['left']['width'].' '. $attributes['border']['left']['style'].' '. $attributes['border']['left']['color'] : null;
    71 
    72     $navbordertop=(!empty($attributes['navborder']['top'])) ? $attributes['navborder']['top']['width'].' '. $attributes['navborder']['top']['style'].' '. $attributes['navborder']['top']['color'] : null;
    73     $navborderright=(!empty($attributes['navborder']['right'])) ? $attributes['navborder']['right']['width'].' '. $attributes['navborder']['right']['style'].' '. $attributes['navborder']['right']['color'] : null;
    74     $navborderbottom=(!empty($attributes['navborder']['bottom'])) ? $attributes['navborder']['bottom']['width'].' '. $attributes['navborder']['bottom']['style'].' '. $attributes['navborder']['bottom']['color'] : null;
    75     $navborderleft=(!empty($attributes['navborder']['left'] )) ? $attributes['navborder']['left']['width'].' '. $attributes['navborder']['left']['style'].' '. $attributes['navborder']['left']['color'] : null;
    76 
    77     $dotsbordertop=(!empty($attributes['dotsborder']['top'])) ? $attributes['dotsborder']['top']['width'].' '. $attributes['dotsborder']['top']['style'].' '. $attributes['dotsborder']['top']['color'] : null;
    78     $dotsborderright=(!empty($attributes['dotsborder']['right'])) ? $attributes['dotsborder']['right']['width'].' '. $attributes['dotsborder']['right']['style'].' '. $attributes['dotsborder']['right']['color'] : null;
    79     $dotsborderbottom=(!empty($attributes['dotsborder']['bottom'])) ? $attributes['dotsborder']['bottom']['width'].' '. $attributes['dotsborder']['bottom']['style'].' '. $attributes['dotsborder']['bottom']['color'] : null;
    80     $dotsborderleft=(!empty($attributes['dotsborder']['left'] )) ? $attributes['dotsborder']['left']['width'].' '. $attributes['dotsborder']['left']['style'].' '. $attributes['dotsborder']['left']['color'] : null;
    81 
    82     $featuredbordertop=(!empty($attributes['featuredborder']['top'])) ? $attributes['featuredborder']['top']['width'].' '. $attributes['featuredborder']['top']['style'].' '. $attributes['featuredborder']['top']['color'] : null;
    83     $featuredborderright=(!empty($attributes['featuredborder']['right'])) ? $attributes['featuredborder']['right']['width'].' '. $attributes['featuredborder']['right']['style'].' '. $attributes['featuredborder']['right']['color'] : null;
    84     $featuredborderbottom=(!empty($attributes['featuredborder']['bottom'])) ? $attributes['featuredborder']['bottom']['width'].' '. $attributes['featuredborder']['bottom']['style'].' '. $attributes['featuredborder']['bottom']['color'] : null;
    85     $featuredborderleft=(!empty($attributes['featuredborder']['left'] )) ? $attributes['featuredborder']['left']['width'].' '. $attributes['featuredborder']['left']['style'].' '. $attributes['featuredborder']['left']['color'] : null;
    86 
    87     $metabordertop=(!empty($attributes['metaborder']['top'])) ? $attributes['metaborder']['top']['width'].' '. $attributes['metaborder']['top']['style'].' '. $attributes['metaborder']['top']['color'] : null;
    88     $metaborderright=(!empty($attributes['metaborder']['right'])) ? $attributes['metaborder']['right']['width'].' '. $attributes['metaborder']['right']['style'].' '. $attributes['metaborder']['right']['color'] : null;
    89     $metaborderbottom=(!empty($attributes['metaborder']['bottom'])) ? $attributes['metaborder']['bottom']['width'].' '. $attributes['metaborder']['bottom']['style'].' '. $attributes['metaborder']['bottom']['color'] : null;
    90     $metaborderleft=(!empty($attributes['metaborder']['left'] )) ? $attributes['metaborder']['left']['width'].' '. $attributes['metaborder']['left']['style'].' '. $attributes['metaborder']['left']['color'] : null;
    91 
    92     $headingbordertop=(!empty($attributes['headingborder']['top'])) ? $attributes['headingborder']['top']['width'].' '. $attributes['headingborder']['top']['style'].' '. $attributes['headingborder']['top']['color'] : null;
    93     $headingborderright=(!empty($attributes['headingborder']['right'])) ? $attributes['headingborder']['right']['width'].' '. $attributes['headingborder']['right']['style'].' '. $attributes['headingborder']['right']['color'] : null;
    94     $headingborderbottom=(!empty($attributes['headingborder']['bottom'])) ? $attributes['headingborder']['bottom']['width'].' '. $attributes['headingborder']['bottom']['style'].' '. $attributes['headingborder']['bottom']['color'] : null;
    95     $headingborderleft=(!empty($attributes['headingborder']['left'] )) ? $attributes['headingborder']['left']['width'].' '. $attributes['headingborder']['left']['style'].' '. $attributes['headingborder']['left']['color'] : null;   
    96 
    97     $contentbordertop=(!empty($attributes['contentborder']['top'] )) ? $attributes['contentborder']['top']['width'].' '. $attributes['contentborder']['top']['style'].' '. $attributes['contentborder']['top']['color'] : null;
    98     $contentborderright=(!empty($attributes['contentborder']['right'] )) ? $attributes['contentborder']['right']['width'].' '. $attributes['contentborder']['right']['style'].' '. $attributes['contentborder']['right']['color'] : null;
    99     $contentborderbottom=(!empty($attributes['contentborder']['bottom'] )) ? $attributes['contentborder']['bottom']['width'].' '. $attributes['contentborder']['bottom']['style'].' '. $attributes['contentborder']['bottom']['color'] : null;
    100     $contentborderleft=(!empty($attributes['contentborder']['left'] )) ? $attributes['contentborder']['left']['width'].' '. $attributes['contentborder']['left']['style'].' '. $attributes['contentborder']['left']['color'] : null;
    101 
    102     $buttonbordertop=(!empty($attributes['buttonborder']['top'])) ? $attributes['buttonborder']['top']['width'].' '. $attributes['buttonborder']['top']['style'].' '. $attributes['buttonborder']['top']['color'] : null;
    103     $buttonborderright=(!empty($attributes['buttonborder']['right'])) ? $attributes['buttonborder']['right']['width'].' '. $attributes['buttonborder']['right']['style'].' '. $attributes['buttonborder']['right']['color'] : null;
    104     $buttonborderbottom=(!empty($attributes['buttonborder']['bottom'])) ? $attributes['buttonborder']['bottom']['width'].' '. $attributes['buttonborder']['bottom']['style'].' '. $attributes['buttonborder']['bottom']['color'] : null;
    105     $buttonborderleft=(!empty($attributes['buttonborder']['left'] )) ? $attributes['buttonborder']['left']['width'].' '. $attributes['buttonborder']['left']['style'].' '. $attributes['buttonborder']['left']['color'] : null;
    106 
    107     $borderwidth=(!empty($attributes['border']['width']))? $attributes['border']['width'] :null;
    108     $borderstyle=(!empty($attributes['border']['style']))? $attributes['border']['style'] :null;
    109     $bordercolor=(!empty($attributes['border']['color']))? $attributes['border']['color'] :null;
    110 
    111     $navborderwidth=(!empty($attributes['navborder']['width']))? $attributes['navborder']['width'] :null;
    112     $navborderstyle=(!empty($attributes['navborder']['style']))? $attributes['navborder']['style'] :null;
    113     $navbordercolor=(!empty($attributes['navborder']['color']))? $attributes['navborder']['color'] :null;
    114 
    115     $dotsborderwidth=(!empty($attributes['dotsborder']['width']))? $attributes['dotsborder']['width'] :null;
    116     $dotsborderstyle=(!empty($attributes['dotsborder']['style']))? $attributes['dotsborder']['style'] :null;
    117     $dotsbordercolor=(!empty($attributes['dotsborder']['color']))? $attributes['dotsborder']['color'] :null;
    118 
    119     $featuredborderwidth=(!empty($attributes['featuredborder']['width']))? $attributes['featuredborder']['width'] :null;
    120     $featuredborderstyle=(!empty($attributes['featuredborder']['style']))? $attributes['featuredborder']['style'] :null;
    121     $featuredbordercolor=(!empty($attributes['featuredborder']['color']))? $attributes['featuredborder']['color'] :null;
    122 
    123     $metaborderwidth=(!empty($attributes['metaborder']['width']))? $attributes['metaborder']['width'] :null;
    124     $metaborderstyle=(!empty($attributes['metaborder']['style']))? $attributes['metaborder']['style'] :null;
    125     $metabordercolor=(!empty($attributes['metaborder']['color']))? $attributes['metaborder']['color'] :null;
    126 
    127     $headingborderwidth=(!empty($attributes['headingborder']['width']))? $attributes['headingborder']['width'] :null;
    128     $headingborderstyle=(!empty($attributes['headingborder']['style']))? $attributes['headingborder']['style'] :null;
    129     $headingbordercolor=(!empty($attributes['headingborder']['color']))? $attributes['headingborder']['color'] :null;
    130 
    131     $contentborderwidth=(!empty($attributes['contentborder']['width']))? $attributes['contentborder']['width'] :null;
    132     $contentborderstyle=(!empty($attributes['contentborder']['style']))? $attributes['contentborder']['style'] :null;
    133     $contentbordercolor=(!empty($attributes['contentborder']['color']))? $attributes['contentborder']['color'] :null;
    134 
    135     $buttonborderwidth=(!empty($attributes['buttonborder']['width']))? $attributes['buttonborder']['width'] :null;
    136     $buttonborderstyle=(!empty($attributes['buttonborder']['style']))? $attributes['buttonborder']['style'] :null;
    137     $buttonbordercolor=(!empty($attributes['buttonborder']['color']))? $attributes['buttonborder']['color'] :null;
    13865
    13966    $ColumnClass='';
     
    16289    }
    16390
    164     $list_items_markup .= $attributes['addcss'];
    165 
    166     $list_items_markup .='<div id="'.$attributes['advid'].'"><div id="'.$uniqueid.'" class="post-query-loop '.$Rowclass.' single-item '.$uniqueid.' '.$attributes['addclass'].' '.$displayclass.' '. $animationclass.' '.$attributes['advclass'].'">';
     91    $list_items_markup .= wp_kses_post($attributes['addcss']);
     92
     93    $list_items_markup .='<div id="'.esc_attr($attributes['advid']).'"><div id="'.esc_attr($uniqueid).'" class="post-query-loop '.esc_attr($Rowclass).' single-item '.esc_attr($uniqueid).' '.esc_attr($attributes['addclass']).' '.esc_attr($displayclass).' '. esc_attr($animationclass).' '.esc_attr($attributes['advclass']).'">';
    16794
    16895    foreach ( $recent_posts as $post ) {
     
    174101        }
    175102
    176         $post_content_class='';
    177 
    178         if ( $attributes['displayFeaturedImage'] &&  has_post_thumbnail( $post ) ){
    179             $post_content_class="post";
    180         }else{
    181             $post_content_class="post gutensee-remove-img";
    182         }
    183103        $columnno=$attributes['columnNumber'];
    184104        $list_items_markup .= '<div class="'.$ColumnClass.'" id="'.$attributes["addid"].'">';
     
    225145                            $opacity= ($attributes['bgImageOverlay']) ? $attributes['bgOverlayOpacity'] : '';
    226146                            $list_items_markup .= '<div class="featured-image post-thumbnail">
    227                                                         <div class="overlay" style="background-color:'.$backgroundColor.';opacity:'.$opacity.'"></div>
    228                                                         '.$image_markup.'
     147                                                        <div class="overlay" style="background-color:'.esc_attr($backgroundColor).';opacity:'.esc_attr($opacity).'"></div>
     148                                                        '.wp_kses_post($image_markup).'
    229149                                                    </div>';
    230150                    }
     
    247167                                if ( ! empty( $author_display_name ) ) {
    248168                                    if($attributes['authortype']==='image'){
    249                                         $list_items_markup .= sprintf(
    250                                             '<span class="author"><img width="1060" height="766" src="'.$author_display_url.'" class="img-fluid" alt="user-1"><a href="'.esc_url( $author_display_link).'">%1$s</a></span>',
    251                                             $byline
    252                                         );
     169                                        $attachment_id = gutensee_save_gravatar_to_media_library($author_display_url);
     170                                        if (is_wp_error($attachment_id)) {
     171                                            echo esc_html('Error: ' . $attachment_id->get_error_message(),'gutensee');
     172                                        }
     173                                        else {
     174                                            // Use wp_get_attachment_image to display the image
     175                                            $list_items_markup .= sprintf(
     176                                                '<span class="author">'.wp_get_attachment_image($attachment_id, 'thumbnail', false, array('class' => 'img-fluid', 'alt'   => esc_attr($title),'width' => '1060', 'height'=> '766',)).'<a href="'.esc_url( $author_display_link).'">%1$s</a></span>',
     177                                                esc_html($byline)
     178                                            );
     179                                        } 
    253180                                    }else{
    254181                                        $list_items_markup .= sprintf(
    255182                                            '<span class="author"><i class="fa-regular fa-user"></i>&nbsp;&nbsp;<a href="'.esc_url( $author_display_link).'">%1$s</a></span>',
    256                                             $byline
     183                                            esc_html($byline)
    257184                                        );
    258185                                    }
     
    284211                                $list_items_markup .= sprintf(
    285212                                    '<span class="comments-link"><i class="far fa-comment"></i>&nbsp;&nbsp;<a href="%2$s/#comments">Comments(%1$s)</a></span>',
    286                                     $commentcounts,
     213                                    esc_html($commentcounts),
    287214                                    esc_url( $post_link )
    288215                                );           
     
    297224                                '<header class="post-entry-header"><h3 class="post-entry-title"><a class="wp-block-latest-posts__post-title" href="%1$s">%2$s</a></h3></header>',
    298225                                esc_url( $post_link ),
    299                                 $title
     226                                esc_html($title)
    300227                            );
    301228                        }                       
     
    320247                                $list_items_markup .= sprintf(
    321248                                    '<div class="post-entry-content wp-block-latest-posts__post-excerpt"><p class="spbb-entry-content 1">%1$s</p>%2$s</div>',
    322                                     $trimmed_excerpt,
    323                                     $btn_markup
     249                                    esc_html($trimmed_excerpt),
     250                                    wp_kses_post($btn_markup)
    324251                                );
    325252                            }
     
    327254                           else{
    328255
    329                                 $post_content = html_entity_decode( $post->post_content, ENT_QUOTES, get_option( 'blog_charset' ) );
     256                                $post_content = html_entity_decode( $post->post_content, ENT_QUOTES, esc_html(get_option( 'blog_charset' )) );
    330257
    331258                                if ( post_password_required( $post ) ) {
     
    386313                $opacity= ($attributes['bgImageOverlay']) ? $attributes['bgOverlayOpacity'] : '';
    387314                $list_items_markup .= '<div class="featured-image post-thumbnail">
    388                                             <div class="overlay" style="background-color:'.$backgroundColor.';opacity:'.$opacity.'"></div>
    389                                             '.$image_markup.'
     315                                            <div class="overlay" style="background-color:'.esc_attr($backgroundColor).';opacity:'.esc_attr($opacity).'"></div>
     316                                            '.wp_kses_post($image_markup).'
    390317                                        </div>';
    391318            }   
     
    410337                                if ( ! empty( $author_display_name ) ) {
    411338                                    if($attributes['authortype']==='image'){
    412                                         $list_items_markup .= sprintf(
    413                                             '<span class="author"><img width="1060" height="766" src="'.$author_display_url.'" class="img-fluid" alt="user-1"><a href="'.esc_url( $author_display_link).'">%1$s</a></span>',
    414                                             $byline
    415                                         );
     339                                        $attachment_id = gutensee_save_gravatar_to_media_library($author_display_url);
     340                                        if (is_wp_error($attachment_id)) {
     341                                            echo esc_html('Error: ' . $attachment_id->get_error_message(),'gutensee');
     342                                        }
     343                                        else {
     344                                            // Use wp_get_attachment_image to display the image
     345                                            $list_items_markup .= sprintf(
     346                                                '<span class="author">'.wp_get_attachment_image($attachment_id, 'thumbnail', false, array('class' => 'img-fluid', 'alt'   => esc_attr($title),'width' => '1060', 'height'=> '766',)).'<a href="'.esc_url( $author_display_link).'">%1$s</a></span>',
     347                                                esc_html($byline)
     348                                            );
     349                                        } 
    416350                                    }else{
    417351                                        $list_items_markup .= sprintf(
    418352                                            '<span class="author"><i class="fa-regular fa-user"></i>&nbsp;&nbsp;<a href="'.esc_url( $author_display_link).'">%1$s</a></span>',
    419                                             $byline
     353                                            esc_html($byline)
    420354                                        );
    421355                                    }
     
    447381                                $list_items_markup .= sprintf(
    448382                                    '<span class="comments-link"><i class="far fa-comment"></i>&nbsp;&nbsp;<a href="%2$s/#comments">Comments(%1$s)</a></span>',
    449                                     $commentcounts,
     383                                    esc_html($commentcounts),
    450384                                    esc_url( $post_link )
    451385                                );           
     
    483417                                $list_items_markup .= sprintf(
    484418                                    '<div class="post-entry-content wp-block-latest-posts__post-excerpt"><p class="spbb-entry-content 1">%1$s</p>%2$s</div>',
    485                                     $trimmed_excerpt,
    486                                     $btn_markup
     419                                    esc_html($trimmed_excerpt),
     420                                    wp_kses_post($btn_markup)
    487421                                );
    488422                            }
     
    490424                            else{
    491425
    492                                 $post_content = html_entity_decode( $post->post_content, ENT_QUOTES, get_option( 'blog_charset' ) );
     426                                $post_content = html_entity_decode( $post->post_content, ENT_QUOTES, esc_html(get_option( 'blog_charset' )) );
    493427                                if ( post_password_required( $post ) ) {
    494428                                    $post_content = esc_html__( 'This content is password protected.' ,'gutensee');
     
    551485                            $opacity= ($attributes['bgImageOverlay']) ? $attributes['bgOverlayOpacity'] : '';
    552486                            $list_items_markup .= '<div class="featured-image post-thumbnail">
    553                                                         <div class="overlay" style="background-color:'.$backgroundColor.';opacity:'.$opacity.'"></div>
    554                                                         '.$image_markup.'
     487                                                        <div class="overlay" style="background-color:'.esc_attr($backgroundColor).';opacity:'.esc_attr($opacity).'"></div>
     488                                                        '.wp_kses_post($image_markup).'
    555489                                                    </div>';
    556490                    }
     
    572506                                if ( ! empty( $author_display_name ) ) {
    573507                                    if($attributes['authortype']==='image'){
    574                                         $list_items_markup .= sprintf(
    575                                             '<span class="author"><img width="1060" height="766" src="'.$author_display_url.'" class="img-fluid" alt="user-1"><a href="'.esc_url( $author_display_link).'">%1$s</a></span>',
    576                                             $byline
    577                                         );
     508                                        $attachment_id = gutensee_save_gravatar_to_media_library($author_display_url);
     509                                        if (is_wp_error($attachment_id)) {
     510                                            echo esc_html('Error: ' . $attachment_id->get_error_message(),'gutensee');
     511                                        }
     512                                        else {
     513                                            // Use wp_get_attachment_image to display the image
     514                                            $list_items_markup .= sprintf(
     515                                                '<span class="author">'.wp_get_attachment_image($attachment_id, 'thumbnail', false, array('class' => 'img-fluid', 'alt'   => esc_attr($title),'width' => '1060', 'height'=> '766',)).'<a href="'.esc_url( $author_display_link).'">%1$s</a></span>',
     516                                                esc_html($byline)
     517                                            );
     518                                        } 
    578519                                    }else{
    579520                                        $list_items_markup .= sprintf(
    580521                                            '<span class="author"><i class="fa-regular fa-user"></i>&nbsp;&nbsp;<a href="'.esc_url( $author_display_link).'">%1$s</a></span>',
    581                                             $byline
     522                                            esc_html($byline)
    582523                                        );
    583524                                    }
     
    622563                                '<header class="post-entry-header"><h3 class="post-entry-title"><a class="wp-block-latest-posts__post-title" href="%1$s">%2$s</a></h3></header>',
    623564                                esc_url( $post_link ),
    624                                 $title
     565                                esc_html($title)
    625566                            );
    626567                        }                       
     
    645586                                $list_items_markup .= sprintf(
    646587                                    '<div class="post-entry-content wp-block-latest-posts__post-excerpt"><p class="spbb-entry-content 1">%1$s</p>%2$s</div>',
    647                                     $trimmed_excerpt,
    648                                     $btn_markup
     588                                    esc_html($trimmed_excerpt),
     589                                    wp_kses_post($btn_markup)
    649590                                );
    650591                            }
     
    652593                            else{
    653594
    654                                 $post_content = html_entity_decode( $post->post_content, ENT_QUOTES, get_option( 'blog_charset' ) );
     595                                $post_content = html_entity_decode( $post->post_content, ENT_QUOTES, esc_html(get_option( 'blog_charset' )) );
    655596
    656597                                if ( post_password_required( $post ) ) {
     
    711652                $opacity= ($attributes['bgImageOverlay']) ? $attributes['bgOverlayOpacity'] : '';
    712653                $list_items_markup .= '<div class="featured-image post-thumbnail">
    713                                             <div class="overlay" style="background-color:'.$backgroundColor.';opacity:'.$opacity.'"></div>
    714                                             '.$image_markup.'
     654                                            <div class="overlay" style="background-color:'.esc_attr($backgroundColor).';opacity:'.esc_attr($opacity).'"></div>
     655                                            '.wp_kses_post($image_markup).'
    715656                                        </div>';
    716657            }   
     
    735676                                if ( ! empty( $author_display_name ) ) {
    736677                                    if($attributes['authortype']==='image'){
    737                                         $list_items_markup .= sprintf(
    738                                             '<span class="author"><img width="1060" height="766" src="'.$author_display_url.'" class="img-fluid" alt="user-1"><a href="'.esc_url( $author_display_link).'">%1$s</a></span>',
    739                                             $byline
    740                                         );
     678                                        $attachment_id = gutensee_save_gravatar_to_media_library($author_display_url);
     679                                        if (is_wp_error($attachment_id)) {
     680                                            echo esc_html('Error: ' . $attachment_id->get_error_message(),'gutensee');
     681                                        }
     682                                        else {
     683                                            // Use wp_get_attachment_image to display the image
     684                                            $list_items_markup .= sprintf(
     685                                                '<span class="author">'.wp_get_attachment_image($attachment_id, 'thumbnail', false, array('class' => 'img-fluid', 'alt'   => esc_attr($title),'width' => '1060', 'height'=> '766',)).'<a href="'.esc_url( $author_display_link).'">%1$s</a></span>',
     686                                                esc_html($byline)
     687                                            );
     688                                        } 
    741689                                    }else{
    742690                                        $list_items_markup .= sprintf(
    743691                                            '<span class="author"><i class="fa-regular fa-user"></i>&nbsp;&nbsp;<a href="'.esc_url( $author_display_link).'">%1$s</a></span>',
    744                                             $byline
     692                                            esc_html($byline)
    745693                                        );
    746694                                    }
     
    785733                                '<header class="post-entry-header"><h3 class="post-entry-title"><a class="wp-block-latest-posts__post-title" href="%1$s">%2$s</a></h3></header>',
    786734                                esc_url( $post_link ),
    787                                 $title
     735                                esc_html($title)
    788736                            );
    789737                        }                       
     
    808756                                $list_items_markup .= sprintf(
    809757                                    '<div class="post-entry-content wp-block-latest-posts__post-excerpt"><p class="spbb-entry-content 1">%1$s</p>%2$s</div>',
    810                                     $trimmed_excerpt,
    811                                     $btn_markup
     758                                    esc_html($trimmed_excerpt),
     759                                    wp_kses_post($btn_markup)
    812760                                );
    813761                            }
     
    815763                            else{
    816764
    817                                 $post_content = html_entity_decode( $post->post_content, ENT_QUOTES, get_option( 'blog_charset' ) );
     765                                $post_content = html_entity_decode( $post->post_content, ENT_QUOTES, esc_html(get_option( 'blog_charset' )) );
    818766
    819767                                if ( post_password_required( $post ) ) {
     
    849797        }
    850798        $list_items_markup .= '</div>';
    851     }
    852 
    853     $navright='';
    854     $navleft='';
    855     if($attributes['navicon'] === 'angle'){
    856       $navleft='fas fa-chevron-left';
    857       $navright='fas fa-chevron-right';
    858     }
    859     else if($attributes['navicon'] === 'doubleangle'){
    860       $navleft='fa-solid fa-angles-left';
    861       $navright='fa-solid fa-angles-right';
    862     }
    863     else if($attributes['navicon'] === 'arrow'){
    864       $navleft='fa fa-arrow-left';
    865       $navright='fa fa-arrow-right';
    866     }
    867     else if($attributes['navicon'] === 'longarrow'){
    868       $navleft='fa fa-arrow-left-long';
    869       $navright='fa fa-arrow-right-long';
    870     }
    871 
    872     $navl="<button class='slide-nav nav-left ".$navleft."'></button>";
    873     $navr="<button class='slide-nav nav-right ".$navright."' ></button>";
    874     $infinite=($attributes['infiniteloop']===true)?'true':'false';
    875     $nav=($attributes['displaynav']===true)?'true':'false';
    876     $dot=($attributes['displaydots']===true)?'true':'false';
    877     $autoplay=($attributes['autoplay']===true)?'true':'false';
    878        
     799    }       
    879800
    880801    remove_filter( 'excerpt_length', 'block_core_latest_posts_get_excerpt_length__premium_only', 20 );
     
    902823    $list_items_markup .='</div></div>';
    903824
    904     $list_items_markup .=$attributes['addjs'];
     825    $list_items_markup .=wp_kses_post($attributes['addjs']);
    905826   
    906827    return $list_items_markup;
  • gutensee/trunk/inc/blocks/topbar.php

    r3175185 r3213041  
    1111    $alignmentClass = ($attributes['textAlignment'] != null) ? 'has-text-align-'.$attributes['textAlignment'] : '';
    1212
    13     $bordertop=(!empty($attributes['border']['top'])) ? $attributes['border']['top']['width'].' '. $attributes['border']['top']['style'].' '. $attributes['border']['top']['color'] : null;
    14     $borderright=(!empty($attributes['border']['right'])) ? $attributes['border']['right']['width'].' '. $attributes['border']['right']['style'].' '. $attributes['border']['right']['color'] : null;
    15     $borderbottom=(!empty($attributes['border']['bottom'])) ? $attributes['border']['bottom']['width'].' '. $attributes['border']['bottom']['style'].' '. $attributes['border']['bottom']['color'] : null;
    16     $borderleft=(!empty($attributes['border']['left'] )) ? $attributes['border']['left']['width'].' '. $attributes['border']['left']['style'].' '. $attributes['border']['left']['color'] : null;
    17 
    18     $iconbordertop=(!empty($attributes['iconborder']['top'])) ? $attributes['iconborder']['top']['width'].' '. $attributes['iconborder']['top']['style'].' '. $attributes['iconborder']['top']['color'] : null;
    19     $iconborderright=(!empty($attributes['iconborder']['right'])) ? $attributes['iconborder']['right']['width'].' '. $attributes['iconborder']['right']['style'].' '. $attributes['iconborder']['right']['color'] : null;
    20     $iconborderbottom=(!empty($attributes['iconborder']['bottom'])) ? $attributes['iconborder']['bottom']['width'].' '. $attributes['iconborder']['bottom']['style'].' '. $attributes['iconborder']['bottom']['color'] : null;
    21     $iconborderleft=(!empty($attributes['iconborder']['left'] )) ? $attributes['iconborder']['left']['width'].' '. $attributes['iconborder']['left']['style'].' '. $attributes['iconborder']['left']['color'] : null;
    22 
    23     $textbordertop=(!empty($attributes['textborder']['top'])) ? $attributes['textborder']['top']['width'].' '. $attributes['textborder']['top']['style'].' '. $attributes['textborder']['top']['color'] : null;
    24     $textborderright=(!empty($attributes['textborder']['right'])) ? $attributes['textborder']['right']['width'].' '. $attributes['textborder']['right']['style'].' '. $attributes['textborder']['right']['color'] : null;
    25     $textborderbottom=(!empty($attributes['textborder']['bottom'])) ? $attributes['textborder']['bottom']['width'].' '. $attributes['textborder']['bottom']['style'].' '. $attributes['textborder']['bottom']['color'] : null;
    26     $textborderleft=(!empty($attributes['textborder']['left'] )) ? $attributes['textborder']['left']['width'].' '. $attributes['textborder']['left']['style'].' '. $attributes['textborder']['left']['color'] : null;
    27    
    28 
    2913    $dateFormat = isset($attributes['dateFormat']) ? $attributes['dateFormat'] : 'MM/DD/YYYY';
    3014    $timeFormat = isset($attributes['timeFormat']) ? $attributes['timeFormat'] : 'HH:mm:ss';
     
    3822    $query = new WP_Query($args);
    3923
    40     $list_items_markup .=$attributes['addcss'];
     24    $list_items_markup .=wp_kses_post($attributes['addcss']);
    4125
    4226    // Format the date based on selected format
     
    8064    switch ($attributes['topbartypes']) {
    8165        case 'date':
    82             $content='<div><span class="date"><i class="'.$attributes['topbaricon'].'"></i>'.$displayDateValue.'</span></div>';
     66            $content='<div><span class="date"><i class="'.esc_attr($attributes['topbaricon']).'"></i>'.esc_html($displayDateValue).'</span></div>';
    8367            break;
    8468        case 'time':
    85             $content='<div><i class="'.$attributes['topbaricon'].'"></i><span class="display-time" data-time-format="'.$timeFormat.'">'.$displayTimeValue.'</span></div>';
     69            $content='<div><i class="'.esc_attr($attributes['topbaricon']).'"></i><span class="display-time" data-time-format="'.$timeFormat.'">'.esc_html($displayTimeValue).'</span></div>';
    8670            break;
    8771        case 'post':
    88             $content .='<div class="slick-slider '.$attributes['uniqueid'].'">';
     72            $content .='<div class="slick-slider '.esc_attr($attributes['uniqueid']).'">';
    8973            if ($query->have_posts()) {
    9074                while ($query->have_posts()) {
    9175                    $query->the_post();
    92                     $content .='<div class="slide '.$alignmentClass.'"><span class="slide-heading"><a href="'.get_the_permalink().'"><i class="'.$attributes['topbaricon'].'"}></i>'.get_the_title().'</a></span></div>';
     76                    $content .='<div class="slide '.esc_attr($alignmentClass).'"><span class="slide-heading"><a href="'.esc_url(get_the_permalink()).'"><i class="'.esc_attr($attributes['topbaricon']).'"}></i>'.esc_url(get_the_title()).'</a></span></div>';
    9377                }
    9478            }
     
    9781            break;
    9882        case 'custom':
    99             $content='<div><span><a href="'.$attributes['textlink'].'" target="'.$topbartarget.'"><i class="'.$attributes['topbaricon'].'"></i>'.$attributes['text'].'</a></span></div>';
     83            $content='<div><span><a href="'.esc_url($attributes['textlink']).'" target="'.esc_attr($topbartarget).'"><i class="'.esc_attr($attributes['topbaricon']).'"></i>'.esc_html($attributes['text']).'</a></span></div>';
    10084            break;
    10185        default:
     
    10488    }
    10589
    106     $list_items_markup .= '<div id="'.$attributes['advid'].'"><div class="gutensee-topbar '.$displayclass.' '.$animationclass.' '.$alignmentClass.' '.$attributes['advclass'].'" id="'.$attributes['uniqueid'].'">'.$content.'</div></div>';
     90    $list_items_markup .= '<div id="'.esc_attr($attributes['advid']).'"><div class="gutensee-topbar '.esc_attr($displayclass).' '.esc_attr($animationclass).' '.esc_attr($alignmentClass).' '.esc_attr($attributes['advclass']).'" id="'.esc_attr($attributes['uniqueid']).'">'.wp_kses_post($content).'</div></div>';
    10791
    108     $list_items_markup .=$attributes['addjs'];
     92    $list_items_markup .=wp_kses_post($attributes['addjs']);
    10993
    11094    return $list_items_markup;
  • gutensee/trunk/readme.txt

    r3198319 r3213041  
    55Requires at least: 5.3
    66Tested up to: 6.7.1
    7 Stable tag: 1.0.3
     7Stable tag: 1.0.4
    88Requires PHP: 5.4
    99License: GPLv2 or later
     
    4848== Changelog ==
    4949
     50@Version 1.0.4
     51* Fixed reviewer issues.
     52
    5053@Version 1.0.3
    5154* Fixed reviewer issues.
Note: See TracChangeset for help on using the changeset viewer.