Title: [Plugin: RSS in Page] great plugin, some changes expected
Last modified: August 19, 2016

---

# [Plugin: RSS in Page] great plugin, some changes expected

 *  [ascetix](https://wordpress.org/support/users/ascetix/)
 * (@ascetix)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-rss-in-page-great-plugin-some-changes-expected/)
 * Hello,
 * I’m a new user of “RSS in page”. Plugin is great, but I had to made some changes.
 * Some of them would be interesting for other users. Some of them are just ‘improvements’.
 * 1) for UTF-8 pages
 * You used **substr** for cropping titles/descriptions that were longer that should
   be. I’ve changed to **mb_substr**:
 * – for title:
 *     ```
       if(strlen($rsstitle) > $rsstitlelength)
        // <strong>original</strong>: { $rsstitle = substr($rsstitle, 0, $rsstitlelength).'... '; }
        { $rsstitle = mb_substr($rsstitle, 0, $rsstitlelength, 'UTF-8').'... '; }
       }
       ```
   
 * – for description:
 *     ```
       if ($rssdescriptionlength != 'all') {
       if(strlen($z) > $rssdescriptionlength)
       // <strong>original</strong>: { $z = substr($z, 0, $rssdescriptionlength).'... '; }
        { $z = mb_substr($z, 0, $rssdescriptionlength,  'UTF-8').'... '; }
       }
       ```
   
 * 2) change **frequency** for reading rss feeds
    In your plugin you set up 60 seconds
   for cache ‘freshness’. I’ve changed for my blog to 3600s, to protect rss sources:
 * `$feed->set_cache_duration('3600');`
 * 3) setting rel=”nofollow” for links
    For SEO improvement:
 *     ```
       // orig: $Y = '<a href="'.$rss_itemlink.'" target="'.$rsstarget.'" title="'.$rsslinketitle.'">'.$rsstitle.'</a>'; } else { $Y = $rsstitle; }
       $Y = '<a rel="nofollow" href="'.$rss_itemlink.'" target="'.$rsstarget.'" title="'.$rsslinketitle.'">'.$rsstitle.'</a>'; } else { $Y = $rsstitle; }
       ```
   
 * I think you could put an option for “nofollow” (like option rsstarget for “_blank”)
 * 4) removing some html tags/comments from descriptions
    There are numbers of reasons
   for doing it (cropping text sometimes breaks html tags; someone may not want 
   to have links/pictures in feeds etc).
 *     ```
       $feed->strip_htmltags(array('p', 'a', 'b', 'strong', 'i', 'em', 'u', 'div', 'table', 'td', 'tr', 'img', 'span', 'h1', 'h2', 'h3', 'h4', 'ul', 'ol', 'li'));
       $feed->strip_comments(true);
       ```
   
 * 5) I also did some other replacements for content of descriptions (below some
   examples, not a complete list):
 *     ```
       if ($rss_items[$i]->get_description() != '') $z = $rss_items[$i]->get_description();
           $z = str_ireplace  ('&oacute;', 'ó', $z);
           $z = str_ireplace  ('&middot;', '-', $z);
           $z = preg_replace  ('/<br\s+\/>/i', ' ', $z);
           $z = preg_replace  ('/<br\/>/i', ' ', $z);
           $z = preg_replace  ('/<br>/i', ' ', $z);
           $z = preg_replace  ('/[\r\n]/i', ' ', $z);
           $z = preg_replace  ('/https?[^\s]+/i', '[url] ', $z);
       ```
   
 * (putting br to strip_htmltags array was not a good idea; strip_htmltags just 
   cuts tags, I wanted to replace some of them to space – but, of course, one may
   prefer doing it the other way)
 * ——–
 * I think 1), 2) and 3) could be interesting to others, 4) – many may want this
   as an option for some feeds, 5) is just a ‘feature’ 🙂
 * [http://wordpress.org/extend/plugins/rss-in-page/](http://wordpress.org/extend/plugins/rss-in-page/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [ascetix](https://wordpress.org/support/users/ascetix/)
 * (@ascetix)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-rss-in-page-great-plugin-some-changes-expected/#post-1918607)
 * as an example of page with mentioned changes:
    [http://blog.koszykzdomenami.pl/domenowe-wiadomosci/](http://blog.koszykzdomenami.pl/domenowe-wiadomosci/)
 *  Thread Starter [ascetix](https://wordpress.org/support/users/ascetix/)
 * (@ascetix)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-rss-in-page-great-plugin-some-changes-expected/#post-1918924)
 * Hi,
 * I don’t know why, but for me strip_htmltags for “img” doesn’t work properly- 
   I see many <img> tags with some images in parsed feeds. To work it out I’ve added
   another preg_replace line.
 * I always added “iframe” to strip_htmltags. So, now, after some additional cleanings/
   customisations I use:
 *     ```
       $feed->strip_htmltags(array('p', 'a', 'b', 'strong', 'i', 'em', 'u', 'div', 'table', 'iframe', 'td', 'tr', 'img', 'span', 'h1', 'h2', 'h3', 'h4', 'ul', 'ol', 'li' ..... /* and other tags */ ));
       $feed->strip_comments(true);
   
       [...]
   
       if ($rss_items[$i]->get_description() != '') $z = $rss_items[$i]->get_description();
           $z = str_ireplace  ('&oacute;', 'ó', $z);
           $z = str_ireplace  ('&middot;', '-', $z);
           $z = preg_replace  ('/<br\s+\/>/i', ' ', $z);
           $z = preg_replace  ('/<br\/>/i', ' ', $z);
           $z = preg_replace  ('/<br>/i', ' ', $z);
           $z = preg_replace  ('/[ \t\f]+/i', ' ', $z);
           $z = preg_replace  ('/https?[^\s]+/i', '[url]', $z);
           $z = preg_replace  ('/<img[^>]*>/i', '[img]', $z);
           $z = preg_replace  ('/[\r\n]/i', '•', $z);
   
       if ($rssdescriptionlength != 'all') {
       if(strlen($z) > $rssdescriptionlength)
        { $z = mb_substr($z, 0, $rssdescriptionlength,  'UTF-8').'... '; }
       }
           $z = str_ireplace  ('[url]', '<i>[url]</i> ', $z);
           $z = str_ireplace  ('[img]', '<i>[img]</i> ', $z);
           $z = preg_replace  ('/•[ •]*/i', '&diams;', $z);
       ```
   
 * It results in importing more interesting texts from rss feed. It’s also safer.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Plugin: RSS in Page] great plugin, some changes expected’ is closed 
to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/rss-in-page.svg)
 * [RSS in Page](https://wordpress.org/plugins/rss-in-page/)
 * [Support Threads](https://wordpress.org/support/plugin/rss-in-page/)
 * [Active Topics](https://wordpress.org/support/plugin/rss-in-page/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/rss-in-page/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/rss-in-page/reviews/)

 * 2 replies
 * 1 participant
 * Last reply from: [ascetix](https://wordpress.org/support/users/ascetix/)
 * Last activity: [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-rss-in-page-great-plugin-some-changes-expected/#post-1918924)
 * Status: not resolved