Advertisement
Guest User

Untitled

a guest
Mar 19th, 2013
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.03 KB | None | 0 0
  1. <?php
  2. class Ff_Ibm extends Plugin {
  3.  
  4.         private $link;
  5.         private $host;
  6.  
  7.         function about() {
  8.                 return array(1.0,
  9.                         "Strips html code from the IBM feed",
  10.                         "fleg",
  11.                         false);
  12.         }
  13.  
  14.         function init($host) {
  15.                 $this->link = $host->get_link();
  16.                 $this->host = $host;
  17.                 $host->add_hook($host::HOOK_FEED_FETCHED, $this);
  18.         }
  19.  
  20.         function hook_feed_fetched($feed_data) {
  21.                 #_debug("---[ ff_ibm  ]---");
  22.                if( preg_match('/IBM developer\s*works/i', $feed_data) ){
  23.                         _debug('ff_ibm: IBM Feed found, correcting raw feed.');
  24.                         $feed_data = preg_replace('/<\/feed>[\n\r\s]*<[^<>]*doctype html[^<>]+>.*html.*<\/html>/ims', '</feed>', $feed_data);
  25.                 }
  26.                 //_debug($feed_data);
  27.                 #_debug("---[ ff_ibm  ]---");
  28.                return $feed_data;
  29.         }
  30.  
  31. }
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement