# super-rss-reader/4.2/includes/utilities.php

Super RSS Reader – Add attractive RSS Feed Widget, version 4.2. 36 lines.

- Page: https://pluginprobe.com/plugins/super-rss-reader/4.2/code/includes/utilities.php
- Raw: https://pluginprobe.com/plugins/super-rss-reader/4.2/raw/includes/utilities.php
- Modified: 2021-04-27T20:31:12+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/super-rss-reader/4.2/code/includes/utilities.php#L10-L20`.

```php
<?php
/**
* Common utilities for the plugin
*
*/

if( ! defined( 'ABSPATH' ) ) exit;

class SRR_Utilities{

    public static function init(){

        add_filter( 'the_excerpt_rss', array( __CLASS__, 'insert_featured_image_rss_feed' ) );
        add_filter( 'the_content_feed', array( __CLASS__, 'insert_featured_image_rss_feed' ) );

    }

    public static function insert_featured_image_rss_feed( $content ){

        global $post;

        preg_match_all( '~<img.*?src=["\']+(.*?)["\']+~', $content, $image_urls );

        if( empty( $image_urls[1] ) && has_post_thumbnail( $post->ID ) ) {
            $content = '<p>' . get_the_post_thumbnail( $post->ID ) . '</p>' . $content;
        }

        return $content;

    }

}

SRR_Utilities::init();

?>
```
