mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 14:03:27 +00:00
Merge cooliris branch
This commit is contained in:
@@ -44,15 +44,21 @@ class RSSFeeds implements ControllerProviderInterface
|
||||
|
||||
$registry = \registry::get_instance();
|
||||
|
||||
if ($format == 'rss')
|
||||
if ($format == Feed_Adapter::FORMAT_RSS)
|
||||
{
|
||||
$content = new \Feed_XML_RSS();
|
||||
}
|
||||
if ($format == 'atom')
|
||||
|
||||
if ($format == Feed_Adapter::FORMAT_ATOM)
|
||||
{
|
||||
$content = new \Feed_XML_Atom();
|
||||
}
|
||||
|
||||
|
||||
if($format == Feed_Adapter::FORMAT_COOLIRIS)
|
||||
{
|
||||
$content = new Feed_XML_Cooliris();
|
||||
}
|
||||
|
||||
if ($user instanceof \User_Adapter)
|
||||
$link = $feed->get_user_link($registry, $user, $format, $page);
|
||||
else
|
||||
@@ -80,7 +86,7 @@ class RSSFeeds implements ControllerProviderInterface
|
||||
}
|
||||
foreach ($entries->get_entries() as $entry)
|
||||
$content->set_item($entry);
|
||||
|
||||
|
||||
$render = $content->render();
|
||||
$response = new Response($render, 200, array('Content-Type' => $content->get_mimetype()));
|
||||
$response->setCharset('UTF-8');
|
||||
@@ -164,7 +170,18 @@ class RSSFeeds implements ControllerProviderInterface
|
||||
return $display_feed($feed, $format, $page);
|
||||
})->assert('format', '(rss|atom)');
|
||||
|
||||
$controllers->get('/cooliris/', function() use ($app, $appbox, $display_feed) {
|
||||
$feeds = Feed_Collection::load_public_feeds($appbox);
|
||||
$feed = $feeds->get_aggregate();
|
||||
|
||||
$request = $app['request'];
|
||||
$page = (int) $request->get('page');
|
||||
$page = $page < 1 ? 1 : $page;
|
||||
|
||||
return $display_feed($feed, Feed_Adapter::FORMAT_COOLIRIS , $page);
|
||||
});
|
||||
|
||||
return $controllers;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,10 @@ abstract class Feed_Abstract
|
||||
*
|
||||
*/
|
||||
const FORMAT_ATOM = 'atom';
|
||||
/**
|
||||
*
|
||||
*/
|
||||
const FORMAT_COOLIRIS = 'cooliris';
|
||||
|
||||
/**
|
||||
*
|
||||
|
@@ -57,6 +57,8 @@ class Feed_Adapter extends Feed_Abstract implements Feed_Interface, cache_cachea
|
||||
const CACHE_ENTRY_NUMBER = 'entrynumber';
|
||||
|
||||
const CACHE_USER_TOKEN = 'usr_token';
|
||||
|
||||
const MAX_ENTRIES = 20;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -561,7 +563,7 @@ class Feed_Adapter extends Feed_Abstract implements Feed_Interface, cache_cachea
|
||||
public function get_entries($offset_start, $how_many)
|
||||
{
|
||||
$offset_start = (int) $offset_start;
|
||||
$how_many = $how_many > 20 ? 20 : (int) $how_many;
|
||||
$how_many = $how_many > self::MAX_ENTRIES ? self::MAX_ENTRIES : (int) $how_many;
|
||||
|
||||
$sql = 'SELECT id
|
||||
FROM feed_entries
|
||||
|
@@ -158,6 +158,16 @@ class Feed_Aggregate extends Feed_Abstract implements Feed_Interface
|
||||
, 'application/atom+xml'
|
||||
);
|
||||
break;
|
||||
case self::FORMAT_COOLIRIS:
|
||||
return new Feed_Link(
|
||||
sprintf('%sfeeds/cooliris/%s'
|
||||
, $registry->get('GV_ServerName')
|
||||
, ($page ? '?page=' . $page : '')
|
||||
)
|
||||
, sprintf('%s - %s', $this->get_title(), 'RSS')
|
||||
, 'application/rss+xml'
|
||||
);
|
||||
break;
|
||||
default:
|
||||
case self::FORMAT_RSS:
|
||||
return new Feed_Link(
|
||||
|
459
lib/classes/Feed/XML/Cooliris.class.php
Normal file
459
lib/classes/Feed/XML/Cooliris.class.php
Normal file
@@ -0,0 +1,459 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package Feeds
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class Feed_XML_Cooliris extends Feed_XML_Abstract implements Feed_XML_Interface
|
||||
{
|
||||
/**
|
||||
* RSS version
|
||||
*/
|
||||
const VERSION = '2.0';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Array
|
||||
*/
|
||||
protected $required_fields = array('title', 'subtitle', 'link');
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $language;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $copyright;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $managingEditor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $webMaster;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var DateTime
|
||||
*/
|
||||
protected $lastBuildDate;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $categories;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $docs = 'http://blogs.law.harvard.edu/tech/rss';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $ttl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Feed_XML_RSS_Image
|
||||
*/
|
||||
protected $image;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $skipHours = array();
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $skipDays = array();
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $mimetype = 'application/rss+xml';
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $language
|
||||
* @return Feed_XML_RSS
|
||||
*/
|
||||
public function set_language($language)
|
||||
{
|
||||
$this->language = $language;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $language
|
||||
* @return Feed_XML_RSS
|
||||
*/
|
||||
public function set_copyright($copyright)
|
||||
{
|
||||
$this->copyright = $copyright;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $managingEditor
|
||||
* @return Feed_XML_RSS
|
||||
*/
|
||||
public function set_managingEditor($managingEditor)
|
||||
{
|
||||
$this->managingEditor = $managingEditor;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $webMaster
|
||||
* @return Feed_XML_RSS
|
||||
*/
|
||||
public function set_webMaster($webMaster)
|
||||
{
|
||||
$this->webMaster = $webMaster;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param DateTime $lastBuildDate
|
||||
* @return Feed_XML_RSS
|
||||
*/
|
||||
public function set_lastBuildDate(DateTime $lastBuildDate)
|
||||
{
|
||||
$this->lastBuildDate = $lastBuildDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $category
|
||||
* @return Feed_XML_RSS
|
||||
*/
|
||||
public function set_category($category)
|
||||
{
|
||||
$this->categories[] = $category;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $docs
|
||||
* @return Feed_XML_RSS
|
||||
*/
|
||||
public function set_docs($docs)
|
||||
{
|
||||
$this->docs = $docs;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param int $ttl
|
||||
* @return Feed_XML_RSS
|
||||
*/
|
||||
public function set_ttl($ttl)
|
||||
{
|
||||
$this->ttl = $ttl;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param Feed_XML_RSS_Image $image
|
||||
* @return Feed_XML_RSS
|
||||
*/
|
||||
public function set_image(Feed_XML_RSS_Image $image)
|
||||
{
|
||||
$this->image = $image;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $skipHours
|
||||
* @return Feed_XML_RSS
|
||||
*/
|
||||
public function set_skipHour($hour)
|
||||
{
|
||||
$this->skipHours[] = (int) $hour;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $skipDays
|
||||
* @return Feed_XML_RSS
|
||||
*/
|
||||
public function set_skipDays($day)
|
||||
{
|
||||
$this->skipDays[] = $day;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$doc = new DOMDocument('1.0', 'UTF-8');
|
||||
$doc->formatOutput = true;
|
||||
$doc->standalone = true;
|
||||
|
||||
|
||||
$root = $this->addTag($doc, $doc, 'rss');
|
||||
|
||||
$root->setAttribute('version', self::VERSION);
|
||||
$root->setAttribute('xmlns:media', 'http://search.yahoo.com/mrss/');
|
||||
$root->setAttribute('xmlns:atom', 'http://www.w3.org/2005/Atom');
|
||||
$root->setAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/');
|
||||
|
||||
$channel = $this->addTag($doc, $root, 'channel');
|
||||
|
||||
$this->addTag($doc, $channel, 'title', $this->title);
|
||||
$this->addTag($doc, $channel, 'dc:title', $this->title);
|
||||
$this->addTag($doc, $channel, 'description', $this->subtitle);
|
||||
if ($this->link instanceof Feed_Link)
|
||||
$this->addTag($doc, $channel, 'link', $this->link->get_href());
|
||||
|
||||
if ($this->language)
|
||||
$this->addTag($doc, $channel, 'language', $this->language);
|
||||
if ($this->copyright)
|
||||
$this->addTag($doc, $channel, 'copyright', $this->copyright);
|
||||
if ($this->managingEditor)
|
||||
$this->addTag($doc, $channel, 'managingEditor', $this->managingEditor);
|
||||
if ($this->webMaster)
|
||||
$this->addTag($doc, $channel, 'webMaster', $this->webMaster);
|
||||
if ($this->updated_on instanceof DateTime)
|
||||
{
|
||||
$updated_on = $this->updated_on->format(DATE_RFC2822);
|
||||
$this->addTag($doc, $channel, 'pubDate', $updated_on);
|
||||
}
|
||||
if ($this->lastBuildDate instanceof DateTime)
|
||||
{
|
||||
$last_build = $this->lastBuildDate->format(DATE_RFC2822);
|
||||
$this->addTag($doc, $channel, 'lastBuildDate', $last_build);
|
||||
}
|
||||
if (count($this->categories) > 0)
|
||||
{
|
||||
foreach ($this->categories as $category)
|
||||
{
|
||||
$this->addTag($doc, $channel, 'category', $category);
|
||||
}
|
||||
}
|
||||
if ($this->generator)
|
||||
$this->addTag($doc, $channel, 'generator', $this->generator);
|
||||
if ($this->docs)
|
||||
$this->addTag($doc, $channel, 'docs', $this->docs);
|
||||
if ($this->ttl)
|
||||
$this->addTag($doc, $channel, 'ttl', $this->ttl);
|
||||
if ($this->image instanceof Feed_XML_RSS_Image)
|
||||
{
|
||||
$image = $this->addTag($doc, $channel, 'image');
|
||||
$this->addTag($doc, $image, 'url', $this->image->get_url());
|
||||
$this->addTag($doc, $image, 'title', $this->image->get_title());
|
||||
$this->addTag($doc, $image, 'link', $this->image->get_link());
|
||||
if ($this->image->get_width())
|
||||
$this->addTag($doc, $image, 'width', $this->image->get_width());
|
||||
if ($this->image->get_height())
|
||||
$this->addTag($doc, $image, 'height', $this->image->get_height());
|
||||
if ($this->image->get_description())
|
||||
$this->addTag($doc, $image, 'description', $this->image->get_description());
|
||||
}
|
||||
if (count($this->skipHours))
|
||||
{
|
||||
$skipHours = $this->addTag($doc, $channel, 'skipHours');
|
||||
foreach ($this->skipHours as $hour)
|
||||
{
|
||||
$this->addTag($doc, $skipHours, 'hour', $hour);
|
||||
}
|
||||
}
|
||||
if (count($this->skipDays) > 0)
|
||||
{
|
||||
$skipDays = $this->addTag($doc, $channel, 'skipDays');
|
||||
foreach ($this->skipDays as $day)
|
||||
{
|
||||
$this->addTag($doc, $skipDays, 'day', $day);
|
||||
}
|
||||
}
|
||||
if ($this->link instanceof Feed_Link)
|
||||
{
|
||||
$self_link = $this->addTag($doc, $channel, 'atom:link');
|
||||
$self_link->setAttribute('rel', 'self');
|
||||
$self_link->setAttribute('href', $this->link->get_href());
|
||||
}
|
||||
|
||||
$this->add_navigation($doc, $channel, true);
|
||||
|
||||
foreach ($this->items as $item)
|
||||
{
|
||||
$this->add_item($doc, $channel, $item);
|
||||
}
|
||||
|
||||
return $doc->saveXML();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param DOMDocument $document
|
||||
* @param DOMNode $node
|
||||
* @param Feed_Entry_Adapter $entry
|
||||
* @return DOMElement
|
||||
*/
|
||||
protected function add_item(DOMDocument $document, DOMNode $node, Feed_Entry_Adapter $entry)
|
||||
{
|
||||
foreach ($entry->get_content() as $content)
|
||||
{
|
||||
$this->addContent($document, $node, $entry, $content);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param DOMDocument $document
|
||||
* @param DOMNode $item
|
||||
* @param Feed_Entry_Item $content
|
||||
* @return Feed_XML_Interface
|
||||
*/
|
||||
protected function addContent(DOMDocument $document, DOMNode $node, Feed_Entry_Adapter $entry, Feed_Entry_Item $content)
|
||||
{
|
||||
|
||||
$preview_sd = $content->get_record()->get_subdef('preview');
|
||||
$preview_permalink = $preview_sd->get_permalink();
|
||||
$thumbnail_sd = $content->get_record()->get_thumbnail();
|
||||
$thumbnail_permalink = $thumbnail_sd->get_permalink();
|
||||
|
||||
$medium = strtolower($content->get_record()->get_type());
|
||||
|
||||
if (!in_array($medium, array('image', 'audio', 'video')))
|
||||
return $this;
|
||||
|
||||
if (!$preview_permalink || !$thumbnail_permalink)
|
||||
return $this;
|
||||
|
||||
//add item node to channel node
|
||||
$item = $this->addTag($document, $node, 'item');
|
||||
|
||||
$title_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Title);
|
||||
if ($title_field)
|
||||
{
|
||||
$str_title = $title_field->get_value(true, ' ');
|
||||
}
|
||||
else
|
||||
{
|
||||
$str_title = $content->get_record()->get_title();
|
||||
}
|
||||
|
||||
//attach tile node to item node
|
||||
$title = $this->addTag($document, $item, 'title', $str_title);
|
||||
|
||||
$desc_field = $content->get_record()->get_caption()->get_dc_field(databox_Field_DCESAbstract::Description);
|
||||
if ($desc_field)
|
||||
{
|
||||
$str_desc = $desc_field->get_value(true, ' ');
|
||||
}
|
||||
else
|
||||
{
|
||||
$str_desc = '';
|
||||
}
|
||||
|
||||
//attach desc node to item node
|
||||
$desc = $this->addTag($document, $item, 'description', $str_desc);
|
||||
|
||||
$duration = $content->get_record()->get_duration();
|
||||
|
||||
if ($preview_permalink)
|
||||
{
|
||||
$preview = $this->addTag($document, $item, 'media:content');
|
||||
|
||||
$preview->setAttribute('url', $preview_permalink->get_url());
|
||||
$preview->setAttribute('fileSize', $preview_sd->get_size());
|
||||
$preview->setAttribute('type', $preview_sd->get_mime());
|
||||
$preview->setAttribute('medium', $medium);
|
||||
$preview->setAttribute('expression', 'full');
|
||||
$preview->setAttribute('isDefault', 'true');
|
||||
|
||||
if ($preview_sd->get_width())
|
||||
$preview->setAttribute('width', $preview_sd->get_width());
|
||||
if ($preview_sd->get_height())
|
||||
$preview->setAttribute('height', $preview_sd->get_height());
|
||||
if ($duration)
|
||||
$preview->setAttribute('duration', $duration);
|
||||
}
|
||||
|
||||
if ($thumbnail_permalink)
|
||||
{
|
||||
$thumbnail = $this->addTag($document, $item, 'media:thumbnail');
|
||||
|
||||
$thumbnail->setAttribute('url', $thumbnail_permalink->get_url());
|
||||
|
||||
if ($thumbnail_sd->get_width())
|
||||
$thumbnail->setAttribute('width', $thumbnail_sd->get_width());
|
||||
if ($thumbnail_sd->get_height())
|
||||
$thumbnail->setAttribute('height', $thumbnail_sd->get_height());
|
||||
|
||||
|
||||
$thumbnail = $this->addTag($document, $item, 'media:content');
|
||||
|
||||
$thumbnail->setAttribute('url', $thumbnail_permalink->get_url());
|
||||
$thumbnail->setAttribute('fileSize', $thumbnail_sd->get_size());
|
||||
$thumbnail->setAttribute('type', $thumbnail_sd->get_mime());
|
||||
$thumbnail->setAttribute('medium', $medium);
|
||||
$thumbnail->setAttribute('isDefault', 'false');
|
||||
|
||||
if ($thumbnail_sd->get_width())
|
||||
$thumbnail->setAttribute('width', $thumbnail_sd->get_width());
|
||||
if ($thumbnail_sd->get_height())
|
||||
$thumbnail->setAttribute('height', $thumbnail_sd->get_height());
|
||||
if ($duration)
|
||||
$thumbnail->setAttribute('duration', $duration);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
@@ -41,7 +41,7 @@ abstract class W3CFeedValidator
|
||||
{
|
||||
const VALIDATOR_ENDPOINT = "http://validator.w3.org/feed/check.cgi";
|
||||
const OUTPOUT = "soap12";
|
||||
const TIME_BETWEEN_REQUEST = 1;
|
||||
const TIME_BETWEEN_REQUEST = 2;
|
||||
|
||||
public abstract function validate();
|
||||
}
|
||||
@@ -83,7 +83,7 @@ class W3CFeedUrlValidator extends W3CFeedValidator
|
||||
{
|
||||
$url_validator = sprintf("%s?url=%s&output=%s", self::VALIDATOR_ENDPOINT, $this->url, self::OUTPOUT);
|
||||
sleep(self::TIME_BETWEEN_REQUEST);
|
||||
$response = file_get_contents($url_validator);
|
||||
$response = @file_get_contents($url_validator);
|
||||
if (!$response)
|
||||
{
|
||||
throw new W3CFeedValidatorException("Unable to request W3C API");
|
||||
@@ -146,7 +146,7 @@ class W3CFeedRawValidator extends W3CFeedValidator
|
||||
),
|
||||
));
|
||||
sleep(self::TIME_BETWEEN_REQUEST);
|
||||
$response = file_get_contents(self::VALIDATOR_ENDPOINT, false, $context);
|
||||
$response = @file_get_contents(self::VALIDATOR_ENDPOINT, false, $context);
|
||||
if (!$response)
|
||||
{
|
||||
throw new W3CFeedValidatorException("Unable to request W3C API");
|
||||
|
@@ -15,6 +15,13 @@ class Module_RssFeedTest extends PhraseanetWebTestCaseAbstract
|
||||
* @var Feed_Adapter
|
||||
*/
|
||||
public static $feed;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Feed_Adapter_Entry
|
||||
*/
|
||||
public static $entry;
|
||||
public static $publisher;
|
||||
public static $need_records = 1;
|
||||
protected $client;
|
||||
|
||||
@@ -22,22 +29,30 @@ class Module_RssFeedTest extends PhraseanetWebTestCaseAbstract
|
||||
{
|
||||
parent::setUp();
|
||||
$this->client = $this->createClient();
|
||||
self::$feed = Feed_Adapter::create(appbox::get_instance(), self::$user, 'title', 'subtitle');
|
||||
self::$publisher = Feed_Publisher_Adapter::getPublisher(appbox::get_instance(), self::$feed, self::$user);
|
||||
self::$entry = Feed_Entry_Adapter::create(appbox::get_instance(), self::$feed, self::$publisher, 'title_entry', 'subtitle', 'hello', "test@mail.com");
|
||||
Feed_Entry_Item::create(appbox::get_instance(), self::$entry, self::$record_1);
|
||||
self::$feed->set_public(true);
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
self::$publisher->delete();
|
||||
self::$entry->delete();
|
||||
self::$feed->delete();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
self::$feed = Feed_Adapter::create(appbox::get_instance(), self::$user, 'title', 'subtitle');
|
||||
$publisher = Feed_Publisher_Adapter::getPublisher(appbox::get_instance(), self::$feed, self::$user);
|
||||
$entry = Feed_Entry_Adapter::create(appbox::get_instance(), self::$feed, $publisher, 'title_entry', 'subtitle', 'hello', "test@mail.com");
|
||||
Feed_Entry_Item::create(appbox::get_instance(), $entry, self::$record_1);
|
||||
self::$feed->set_public(true);
|
||||
}
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
|
||||
parent::tearDownAfterClass();
|
||||
self::$feed->delete();
|
||||
}
|
||||
|
||||
public function createApplication()
|
||||
@@ -45,6 +60,33 @@ class Module_RssFeedTest extends PhraseanetWebTestCaseAbstract
|
||||
return require dirname(__FILE__) . '/../../Alchemy/Phrasea/Application/Root.php';
|
||||
}
|
||||
|
||||
public function testGetFeedFormat()
|
||||
{
|
||||
$feeds = Feed_Collection::load_public_feeds(appbox::get_instance());
|
||||
$feed = array_shift($feeds->get_feeds());
|
||||
|
||||
$crawler = $this->client->request("GET", "/feeds/feed/" . $feed->get_id() . "/rss/");
|
||||
$this->assertEquals("application/rss+xml", $this->client->getResponse()->headers->get("content-type"));
|
||||
$xml = $this->client->getResponse()->getContent();
|
||||
$this->verifyXML($xml);
|
||||
$this->verifyRSS($feed, $xml);
|
||||
|
||||
$crawler = $this->client->request("GET", "/feeds/feed/" . $feed->get_id() . "/atom/");
|
||||
$this->assertEquals("application/atom+xml", $this->client->getResponse()->headers->get("content-type"));
|
||||
$xml = $this->client->getResponse()->getContent();
|
||||
$this->verifyXML($xml);
|
||||
$this->verifyATOM($feed, $xml);
|
||||
}
|
||||
|
||||
public function testCooliris()
|
||||
{
|
||||
$crawler = $this->client->request("GET", "/feeds/cooliris/");
|
||||
$this->assertTrue($this->client->getResponse()->isOk());
|
||||
$this->assertEquals("application/rss+xml", $this->client->getResponse()->headers->get("content-type"));
|
||||
$xml = $this->client->getResponse()->getContent();
|
||||
$this->verifyXML($xml);
|
||||
}
|
||||
|
||||
public function testAggregatedRss()
|
||||
{
|
||||
$feeds = Feed_Collection::load_public_feeds(appbox::get_instance());
|
||||
@@ -56,7 +98,6 @@ class Module_RssFeedTest extends PhraseanetWebTestCaseAbstract
|
||||
$crawler = $this->client->request("GET", "/feeds/aggregated/rss/");
|
||||
$this->assertTrue($this->client->getResponse()->isOk());
|
||||
$this->assertEquals("application/rss+xml", $this->client->getResponse()->headers->get("content-type"));
|
||||
// $this->assertEquals($feeds->get_aggregate()->get_count_total_entries(), $crawler->filterXPath("//channel/item")->count());
|
||||
$xml = $this->client->getResponse()->getContent();
|
||||
$this->verifyXML($xml);
|
||||
}
|
||||
@@ -86,35 +127,21 @@ class Module_RssFeedTest extends PhraseanetWebTestCaseAbstract
|
||||
$this->assertEquals(404, $this->client->getResponse()->getStatusCode());
|
||||
}
|
||||
|
||||
public function testGetFeedFormat()
|
||||
{
|
||||
$feeds = Feed_Collection::load_public_feeds(appbox::get_instance());
|
||||
$feed = array_shift($feeds->get_feeds());
|
||||
$crawler = $this->client->request("GET", "/feeds/feed/" . $feed->get_id() . "/rss/");
|
||||
$this->assertEquals("application/rss+xml", $this->client->getResponse()->headers->get("content-type"));
|
||||
$xml = $this->client->getResponse()->getContent();
|
||||
$this->verifyRSS($feed, $xml);
|
||||
$crawler = $this->client->request("GET", "/feeds/feed/" . $feed->get_id() . "/atom/");
|
||||
$this->assertEquals("application/atom+xml", $this->client->getResponse()->headers->get("content-type"));
|
||||
$xml = $this->client->getResponse()->getContent();
|
||||
$this->verifyATOM($feed, $xml);
|
||||
}
|
||||
|
||||
public function testGetFeedId()
|
||||
{
|
||||
$feeds = Feed_Collection::load_public_feeds(appbox::get_instance());
|
||||
$all_feeds = $feeds->get_feeds();
|
||||
foreach ($all_feeds as $feed)
|
||||
{
|
||||
$crawler = $this->client->request("GET", "/feeds/feed/" . $feed->get_id() . "/rss/");
|
||||
$this->assertTrue($this->client->getResponse()->isOk());
|
||||
$xml = $this->client->getResponse()->getContent();
|
||||
$this->verifyRSS($feed, $xml);
|
||||
$crawler = $this->client->request("GET", "/feeds/feed/" . $feed->get_id() . "/atom/");
|
||||
$this->assertTrue($this->client->getResponse()->isOk());
|
||||
$xml = $this->client->getResponse()->getContent();
|
||||
$this->verifyATOM($feed, $xml);
|
||||
}
|
||||
$feed = array_shift($all_feeds);
|
||||
|
||||
$crawler = $this->client->request("GET", "/feeds/feed/" . $feed->get_id() . "/rss/");
|
||||
$this->assertTrue($this->client->getResponse()->isOk());
|
||||
$xml = $this->client->getResponse()->getContent();
|
||||
$this->verifyRSS($feed, $xml);
|
||||
|
||||
$crawler = $this->client->request("GET", "/feeds/feed/" . $feed->get_id() . "/atom/");
|
||||
$this->assertTrue($this->client->getResponse()->isOk());
|
||||
$xml = $this->client->getResponse()->getContent();
|
||||
$this->verifyATOM($feed, $xml);
|
||||
}
|
||||
|
||||
public function testPrivateFeedAccess()
|
||||
@@ -129,7 +156,6 @@ class Module_RssFeedTest extends PhraseanetWebTestCaseAbstract
|
||||
|
||||
public function verifyXML($xml)
|
||||
{
|
||||
$this->markTestSkipped("En attente");
|
||||
try
|
||||
{
|
||||
$validator = new W3CFeedRawValidator($xml);
|
||||
@@ -139,7 +165,7 @@ class Module_RssFeedTest extends PhraseanetWebTestCaseAbstract
|
||||
}
|
||||
catch (W3CFeedValidatorException $e)
|
||||
{
|
||||
$this->fail($e->getMessage());
|
||||
print "\nCould not use W3C FEED VALIDATOR API : " . $e->getMessage() . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -443,7 +469,8 @@ class Module_RssFeedTest extends PhraseanetWebTestCaseAbstract
|
||||
{
|
||||
if ($p4field = $entry_item->get_record()->get_caption()->get_dc_field($field["dc_field"]))
|
||||
{
|
||||
$this->assertEquals($p4field->get_value(true, $field["separator"]), $node->nodeValue);
|
||||
$this->assertEquals($p4field->get_value(true, $field["separator"]), $node->nodeValue
|
||||
, sprintf('Asserting good value for DC %s', $field["dc_field"]));
|
||||
if (sizeof($field["media_field"]["attributes"]) > 0)
|
||||
{
|
||||
foreach ($node->attributes as $attribute)
|
||||
@@ -583,15 +610,26 @@ class Module_RssFeedTest extends PhraseanetWebTestCaseAbstract
|
||||
}
|
||||
|
||||
$content = $entry->get_content();
|
||||
$available_medium = array('image', 'audio', 'video');
|
||||
array_walk($content, $this->removeBadItems($content, $available_medium));
|
||||
$media_group = $xpath->query("//media:group");
|
||||
$this->assertEquals(sizeof($content), $media_group->length);
|
||||
|
||||
foreach ($media_group as $media)
|
||||
|
||||
$available_medium = array('image', 'audio', 'video');
|
||||
|
||||
array_walk($content, $this->removeBadItems($content, $available_medium));
|
||||
|
||||
|
||||
$media_group = $xpath->query("/Atom:feed/Atom:entry[0]/media:group");
|
||||
|
||||
if ($media_group->length > 0)
|
||||
{
|
||||
$entry_item = array_shift($content);
|
||||
$this->verifyMediaItem($entry_item, $media);
|
||||
foreach ($media_group as $media)
|
||||
{
|
||||
|
||||
$entry_item = array_shift($content);
|
||||
if ($entry_item instanceof Feed_Entry_Item)
|
||||
{
|
||||
$this->verifyMediaItem($entry_item, $media);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
2
lib/vendor/symfony
vendored
2
lib/vendor/symfony
vendored
Submodule lib/vendor/symfony updated: 4316595dbb...6924e63587
@@ -55,10 +55,10 @@
|
||||
<param name="allowFullScreen" value="true" />
|
||||
<param name="allowScriptAccess" value="always" />
|
||||
<param name="flashvars"
|
||||
value="feed=/feeds/aggregated/rss/&glowColor=#0077BC&style=dark&backgroundColor=#000000&showChrome=false&showEMbed=false&showSearch=false" />
|
||||
value="feed=/feeds/cooliris/&glowColor=#0077BC&style=dark&backgroundColor=#000000&showChrome=false&showEMbed=false&showSearch=false" />
|
||||
<embed wmode="transparent" type="application/x-shockwave-flash"
|
||||
src="http://apps.cooliris.com/embed/cooliris.swf"
|
||||
flashvars="feed=/feeds/aggregated/rss/&glowColor=#0077BC&style=dark&backgroundColor=#000000&showChrome=false&showEMbed=false&showSearch=false"
|
||||
flashvars="feed=/feeds/cooliris/&glowColor=#0077BC&style=dark&backgroundColor=#000000&showChrome=false&showEMbed=false&showSearch=false"
|
||||
width="930"
|
||||
height="360"
|
||||
allowFullScreen="true"
|
||||
|
@@ -51,8 +51,8 @@
|
||||
<param name="movie" value="/include/player_scroll.swf" />
|
||||
<param name="quality" value="high" />
|
||||
<param name="wmode" value="transparent" />
|
||||
<param name="flashvars" value="space=20&speed=2&media=content&zoom=0.4&rss=/feeds/aggregated/rss/" />
|
||||
<embed flashvars="space=20&speed=2&media=content&zoom=0.4&rss=/feeds/aggregated/rss/" src="/include/player_scroll.swf"
|
||||
<param name="flashvars" value="space=20&speed=2&media=content&zoom=0.4&rss=/feeds/cooliris/" />
|
||||
<embed flashvars="space=20&speed=2&media=content&zoom=0.4&rss=/feeds/cooliris/" src="/include/player_scroll.swf"
|
||||
quality="high" bgcolor="#000000" width="930" height="260" name="slideshow_as2" align="top"
|
||||
allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
|
||||
</object>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<param name="quality" value="high" />
|
||||
<param name="wmode" value="transparent" />
|
||||
<param name="flashvars" value="xmls=/feeds/aggregated/rss/?zh=470&zw=525" />
|
||||
<embed flashvars="xmls=/feeds/aggregated/rss/?zh=470&zw=525" src="/include/player_homelink.swf"
|
||||
<embed flashvars="xmls=/feeds/cooliris/?zh=470&zw=525" src="/include/player_homelink.swf"
|
||||
quality="high" bgcolor="#000000" width="525" height="470" name="slideshow_as2" align="top"
|
||||
allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
|
||||
</object>
|
||||
|
Reference in New Issue
Block a user