troubleshooting Question

Problem building WordPress Plugin that uses lastRSS

Avatar of Howard Bash
Howard BashFlag for United States of America asked on
WordPressPHP
18 Comments1 Solution1305 ViewsLast Modified:
I have been going through a tutorial and built a plugin for WordPress that uses lastRSS.  When I activate it.  It displays some of the code on the top left corner of the dashboard.

I will attach the code that uses lastRSS for review.  I'm not clear how to go about debugging it.

<?
/*
Plugin Name: RSS Processor
Plugin URI: http://localhost
Description: Plugin to fetch parse and show RSS feeds.
Author: Author
Version: 1.0
Author URI: http://localhost
Feature: So far none to be seen.
*/
?>



<?

add_filter('the_content', 'rss_parse');

/*
RSS PARSE FUNCTION
Sample format for rss tag:
{rss uri=http://rss.groups.yahoo.com/phpexperts/rss count=5}

uri and how many feeds to show

param is content of post
returns none

*/


include './lastRSS.php';


function rss_parse($content)
{
  $rss=new lastRSS();
  
  $pattern="~{rss\s*uri=(.*)\s*limit=(.*)}~iU";

  $matches = "";

  preg_match_all($pattern, $content, $matches);

  $rsses = 0;
  while ($rsses<count($matches[0]))
  {
    $p_content="";

    $uri=$matches[1][$rsses];

    $count=$matches[2][$rsses];

    if (empty($count)) $count=10;

    $rss_content = $rss->Get($uri);
 
    $items = $rss_content['items'];

    $i = 0;
    while ($i < $count)
      {
        $p_content .= "<div id='rss_item'><strong><a href='{$items[$i]['link']}'>".$items[$i]['title']."</a></strong><br/>";
        $p_content .= "".$items[$i]['description']."</div><br/><br/>";

        $i++;

      }
    $content = str_replace($matches[0][$rsses], $p_content, $content);
    $rsses +=1;

  }
  return $content;
 
}

?>

Open in new window

ASKER CERTIFIED SOLUTION
jeremyjared74

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 18 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 18 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros