本文整理匯總了PHP中Zend_Feed::importFile方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Feed::importFile方法的具體用法?PHP Zend_Feed::importFile怎麽用?PHP Zend_Feed::importFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Feed
的用法示例。
在下文中一共展示了Zend_Feed::importFile方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testUnset
public function testUnset()
{
$feed = Zend_Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeed.xml');
unset($feed['version']);
$this->assertFalse(isset($feed['version']), 'Version should be unset');
$this->assertEquals('', $feed['version'], 'Version should be equal to the empty string');
$nsfeed = Zend_Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeedNamespaced.xml');
unset($nsfeed['version']);
$this->assertFalse(isset($nsfeed['version']), 'Version should be unset');
$this->assertEquals('', $nsfeed['version'], 'Version should be equal to the empty string');
}
示例2: testContentEncodedNullIfEmpty
public function testContentEncodedNullIfEmpty()
{
$feed = Zend_Feed::importFile(dirname(__FILE__) . '/../_files/TestFeedEntryRssContentEncoded.xml');
$this->assertType('Zend_Feed_Rss', $feed);
$feed->next();
$item = $feed->current();
$this->assertType('Zend_Feed_Entry_Rss', $item);
$this->assertFalse(isset($item->content));
$this->assertNull($item->content());
// $this->assertNull($item->content); // always return DOMElement Object
}
示例3: __construct
/**
* @param string $filename
*/
public function __construct($id, $url, $filename)
{
$this->url = $url;
$this->id = $id;
$feed = Zend_Feed::importFile($filename);
if ($feed instanceof Zend_Feed_Rss) {
$this->processRss($feed);
} else {
if ($feed instanceof Zend_Feed_Atom) {
$this->processAtom($feed);
} else {
throw new Zend_Exception("Error reading feed " . $filename);
}
}
}
示例4: testCount
public function testCount()
{
$f = Zend_Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeed.xml');
$this->assertEquals($f->count(), 2, 'Feed count should be 2');
}
示例5: setUp
public function setUp()
{
$this->_feed = Zend_Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeed.xml');
$this->_nsfeed = Zend_Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeedNamespaced.xml');
}
示例6: testGetsLinkWithEmptyOrMissingRelAsAlternateRel
/**
* @issue ZF-5354
*/
public function testGetsLinkWithEmptyOrMissingRelAsAlternateRel()
{
$feed = Zend_Feed::importFile(dirname(__FILE__) . '/_files/AtomHOnline.xml');
$entry = $feed->current();
$this->assertEquals('http://www.h-online.com/security/Google-acquires-reCAPTCHA--/news/114266/from/rss', $entry->link('alternate'));
}