SimplePie::set_autodiscovery_level PHP Method

set_autodiscovery_level() public method

Set how much feed autodiscovery to do
See also: SIMPLEPIE_LOCATOR_NONE
See also: SIMPLEPIE_LOCATOR_AUTODISCOVERY
See also: SIMPLEPIE_LOCATOR_LOCAL_EXTENSION
See also: SIMPLEPIE_LOCATOR_LOCAL_BODY
See also: SIMPLEPIE_LOCATOR_REMOTE_EXTENSION
See also: SIMPLEPIE_LOCATOR_REMOTE_BODY
See also: SIMPLEPIE_LOCATOR_ALL
public set_autodiscovery_level ( integer $level = SIMPLEPIE_LOCATOR_ALL )
$level integer Feed Autodiscovery Level (level can be a combination of the above constants, see bitwise OR operator)
    public function set_autodiscovery_level($level = SIMPLEPIE_LOCATOR_ALL)
    {
        $this->autodiscovery = (int) $level;
    }

Usage Example

Example #1
0
 function add($render)
 {
     $url = $_REQUEST['url'];
     require_once 'lib/simplepie/simplepie.inc';
     $pie = new SimplePie();
     $pie->enable_cache(false);
     $pie->set_autodiscovery_level(SIMPLEPIE_LOCATOR_ALL);
     $pie->set_feed_url($url);
     $pie->init();
     $feed_url = $pie->feed_url;
     $feed_title = $pie->get_title();
     // Save feed to insert into session variables for later insertion into db
     // only do this if we found items at the given url. This way we won't
     // insert broken urls in doadd(). Also prevents inserting a new feed
     // that never gets subscribed to in the following page.
     if (count($pie->get_items()) > 0) {
         $_SESSION['new_feed_url'] = $feed_url;
         $_SESSION['new_feed_name'] = $feed_title;
     } else {
         $_SESSION['new_feed_url'] = NULL;
         $_SESSION['new_feed_name'] = NULL;
     }
     $render->assign('url', $url);
     $render->assign('feed_url', $feed_url);
     $render->assign('items', array_slice($pie->get_items(), 0, 5));
     $render->assign('feed', $pie);
     $render->assign('title', 'Adding Feed');
     $render->display('feed_search.tpl');
 }
All Usage Examples Of SimplePie::set_autodiscovery_level