mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 04:23:19 +00:00
Rebased, fixed codestyle
This commit is contained in:
@@ -22,7 +22,6 @@ use Silex\ControllerProviderInterface;
|
|||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
namespace Alchemy\Phrasea\Controller\Prod;
|
namespace Alchemy\Phrasea\Controller\Prod;
|
||||||
|
|
||||||
use Alchemy\Phrasea\Feed\Aggregate;
|
|
||||||
use Alchemy\Phrasea\Application;
|
use Alchemy\Phrasea\Application;
|
||||||
use Alchemy\Phrasea\Exception\SessionNotFound;
|
use Alchemy\Phrasea\Exception\SessionNotFound;
|
||||||
use Silex\Application as SilexApplication;
|
use Silex\Application as SilexApplication;
|
||||||
|
@@ -13,7 +13,6 @@ namespace Alchemy\Phrasea\Controller\Root;
|
|||||||
|
|
||||||
use Entities\Feed;
|
use Entities\Feed;
|
||||||
use Alchemy\Phrasea\Feed\Aggregate;
|
use Alchemy\Phrasea\Feed\Aggregate;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
use Silex\Application;
|
use Silex\Application;
|
||||||
use Silex\ControllerProviderInterface;
|
use Silex\ControllerProviderInterface;
|
||||||
|
|
||||||
@@ -111,7 +110,6 @@ class RSSFeeds implements ControllerProviderInterface
|
|||||||
$page = (int) $request->query->get('page');
|
$page = (int) $request->query->get('page');
|
||||||
$page = $page < 1 ? 1 : $page;
|
$page = $page < 1 ? 1 : $page;
|
||||||
|
|
||||||
|
|
||||||
return $app['feed.formatter-strategy']('cooliris')->createResponse($feed, $page, null, 'Phraseanet', $app);
|
return $app['feed.formatter-strategy']('cooliris')->createResponse($feed, $page, null, 'Phraseanet', $app);
|
||||||
})
|
})
|
||||||
->bind('feed_public_cooliris');
|
->bind('feed_public_cooliris');
|
||||||
|
@@ -34,6 +34,7 @@ class FeedServiceProvider implements ServiceProviderInterface
|
|||||||
$collection = new LinkGeneratorCollection();
|
$collection = new LinkGeneratorCollection();
|
||||||
$collection->pushGenerator($app['feed.user-link-generator']);
|
$collection->pushGenerator($app['feed.user-link-generator']);
|
||||||
$collection->pushGenerator($app['feed.aggregate-link-generator']);
|
$collection->pushGenerator($app['feed.aggregate-link-generator']);
|
||||||
|
|
||||||
return $collection;
|
return $collection;
|
||||||
});
|
});
|
||||||
$app['feed.rss-formatter'] = $app->share(function($app) {
|
$app['feed.rss-formatter'] = $app->share(function($app) {
|
||||||
|
@@ -83,6 +83,7 @@ class Aggregate implements FeedInterface
|
|||||||
if (count($this->feeds) == 0) {
|
if (count($this->feeds) == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->em->getRepository('Entities\FeedEntry')->findByFeeds($this->feeds, $offset_start, $how_many);
|
return $this->em->getRepository('Entities\FeedEntry')->findByFeeds($this->feeds, $offset_start, $how_many);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,6 +132,7 @@ class Aggregate implements FeedInterface
|
|||||||
if (count($this->feeds) > 0) {
|
if (count($this->feeds) > 0) {
|
||||||
return count($this->em->getRepository('Entities\FeedEntry')->findByFeeds($this->feeds));
|
return count($this->em->getRepository('Entities\FeedEntry')->findByFeeds($this->feeds));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
namespace Alchemy\Phrasea\Feed;
|
namespace Alchemy\Phrasea\Feed;
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FeedToken
|
* FeedToken
|
||||||
*/
|
*/
|
||||||
@@ -24,7 +22,6 @@ class AggregateToken
|
|||||||
*/
|
*/
|
||||||
private $feed;
|
private $feed;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get id
|
* Get id
|
||||||
*
|
*
|
||||||
@@ -85,7 +82,6 @@ class AggregateToken
|
|||||||
*/
|
*/
|
||||||
private $value;
|
private $value;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set value
|
* Set value
|
||||||
*
|
*
|
||||||
|
@@ -32,6 +32,7 @@ class AtomFormatter extends FeedFormatterAbstract implements FeedFormatterInterf
|
|||||||
$content = $this->format($feed, $page, $user, $generator);
|
$content = $this->format($feed, $page, $user, $generator);
|
||||||
$response = new Response($content, 200, array('Content-Type' => 'application/atom+xml'));
|
$response = new Response($content, 200, array('Content-Type' => 'application/atom+xml'));
|
||||||
$response->setCharset('UTF-8');
|
$response->setCharset('UTF-8');
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,8 +77,7 @@ class AtomFormatter extends FeedFormatterAbstract implements FeedFormatterInterf
|
|||||||
|
|
||||||
if (null !== $user) {
|
if (null !== $user) {
|
||||||
$feedlink = $this->linkGenerator->generate($feed, $user, static::FORMAT, $page);
|
$feedlink = $this->linkGenerator->generate($feed, $user, static::FORMAT, $page);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$feedlink = $this->linkGenerator->generatePublic($feed, static::FORMAT, $page);
|
$feedlink = $this->linkGenerator->generatePublic($feed, static::FORMAT, $page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,4 +156,3 @@ class AtomFormatter extends FeedFormatterAbstract implements FeedFormatterInterf
|
|||||||
return $entry_node;
|
return $entry_node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -33,6 +33,7 @@ class CoolirisFormatter extends FeedFormatterAbstract implements FeedFormatterIn
|
|||||||
$content = $this->format($feed, $page, $user, $generator, $app);
|
$content = $this->format($feed, $page, $user, $generator, $app);
|
||||||
$response = new Response($content, 200, array('Content-Type' => 'application/rss+xml'));
|
$response = new Response($content, 200, array('Content-Type' => 'application/rss+xml'));
|
||||||
$response->setCharset('UTF-8');
|
$response->setCharset('UTF-8');
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,8 +62,7 @@ class CoolirisFormatter extends FeedFormatterAbstract implements FeedFormatterIn
|
|||||||
|
|
||||||
if (null !== $user) {
|
if (null !== $user) {
|
||||||
$link = $this->linkGenerator->generate($feed, $user, static::FORMAT, $page);
|
$link = $this->linkGenerator->generate($feed, $user, static::FORMAT, $page);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$link = $this->linkGenerator->generatePublic($feed, static::FORMAT, $page);
|
$link = $this->linkGenerator->generatePublic($feed, static::FORMAT, $page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,4 +265,3 @@ class CoolirisFormatter extends FeedFormatterAbstract implements FeedFormatterIn
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -34,6 +34,7 @@ class RssFormatter extends FeedFormatterAbstract implements FeedFormatterInterfa
|
|||||||
$content = $this->format($feed, $page, $user, $generator);
|
$content = $this->format($feed, $page, $user, $generator);
|
||||||
$response = new Response($content, 200, array('Content-Type' => 'application/rss+xml'));
|
$response = new Response($content, 200, array('Content-Type' => 'application/rss+xml'));
|
||||||
$response->setCharset('UTF-8');
|
$response->setCharset('UTF-8');
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,8 +65,7 @@ class RssFormatter extends FeedFormatterAbstract implements FeedFormatterInterfa
|
|||||||
|
|
||||||
if (null !== $user) {
|
if (null !== $user) {
|
||||||
$link = $this->linkGenerator->generate($feed, $user, static::FORMAT, $page);
|
$link = $this->linkGenerator->generate($feed, $user, static::FORMAT, $page);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$link = $this->linkGenerator->generatePublic($feed, static::FORMAT, $page);
|
$link = $this->linkGenerator->generatePublic($feed, static::FORMAT, $page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,4 +203,3 @@ class RssFormatter extends FeedFormatterAbstract implements FeedFormatterInterfa
|
|||||||
return $item;
|
return $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -38,6 +38,7 @@ class AggregateLinkGenerator implements LinkGeneratorInterface
|
|||||||
if (null !== $page) {
|
if (null !== $page) {
|
||||||
$params['page'] = $page;
|
$params['page'] = $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new FeedLink(
|
return new FeedLink(
|
||||||
$this->generator->generate('feed_user_aggregated', $params, UrlGenerator::ABSOLUTE_URL),
|
$this->generator->generate('feed_user_aggregated', $params, UrlGenerator::ABSOLUTE_URL),
|
||||||
sprintf('%s - %s', $aggregate->getTitle(), 'Atom'),
|
sprintf('%s - %s', $aggregate->getTitle(), 'Atom'),
|
||||||
@@ -50,6 +51,7 @@ class AggregateLinkGenerator implements LinkGeneratorInterface
|
|||||||
if (null !== $page) {
|
if (null !== $page) {
|
||||||
$params['page'] = $page;
|
$params['page'] = $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new FeedLink(
|
return new FeedLink(
|
||||||
$this->generator->generate('feed_user_aggregated', $params, UrlGenerator::ABSOLUTE_URL),
|
$this->generator->generate('feed_user_aggregated', $params, UrlGenerator::ABSOLUTE_URL),
|
||||||
sprintf('%s - %s', $aggregate->getTitle(), 'RSS'),
|
sprintf('%s - %s', $aggregate->getTitle(), 'RSS'),
|
||||||
@@ -78,6 +80,7 @@ class AggregateLinkGenerator implements LinkGeneratorInterface
|
|||||||
if (null !== $page) {
|
if (null !== $page) {
|
||||||
$params['page'] = $page;
|
$params['page'] = $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new FeedLink(
|
return new FeedLink(
|
||||||
$this->generator->generate('feed_public_aggregated', $params, UrlGenerator::ABSOLUTE_URL),
|
$this->generator->generate('feed_public_aggregated', $params, UrlGenerator::ABSOLUTE_URL),
|
||||||
sprintf('%s - %s', $aggregate->getTitle(), 'Atom'),
|
sprintf('%s - %s', $aggregate->getTitle(), 'Atom'),
|
||||||
@@ -89,6 +92,7 @@ class AggregateLinkGenerator implements LinkGeneratorInterface
|
|||||||
if (null !== $page) {
|
if (null !== $page) {
|
||||||
$params['page'] = $page;
|
$params['page'] = $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new FeedLink(
|
return new FeedLink(
|
||||||
$this->generator->generate('feed_public_aggregated', $params, UrlGenerator::ABSOLUTE_URL),
|
$this->generator->generate('feed_public_aggregated', $params, UrlGenerator::ABSOLUTE_URL),
|
||||||
sprintf('%s - %s', $aggregate->getTitle(), 'RSS'),
|
sprintf('%s - %s', $aggregate->getTitle(), 'RSS'),
|
||||||
|
@@ -62,6 +62,7 @@ class FeedLinkGenerator implements LinkGeneratorInterface
|
|||||||
if (null !== $page) {
|
if (null !== $page) {
|
||||||
$params['page'] = $page;
|
$params['page'] = $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new FeedLink(
|
return new FeedLink(
|
||||||
$this->generator->generate('feed_user', $params, UrlGenerator::ABSOLUTE_URL),
|
$this->generator->generate('feed_user', $params, UrlGenerator::ABSOLUTE_URL),
|
||||||
sprintf('%s - %s', $feed->getTitle(), 'RSS'),
|
sprintf('%s - %s', $feed->getTitle(), 'RSS'),
|
||||||
|
@@ -17,7 +17,7 @@ namespace Alchemy\Phrasea\Feed\RSS;
|
|||||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||||
* @link www.phraseanet.com
|
* @link www.phraseanet.com
|
||||||
*/
|
*/
|
||||||
class FeedRSSImage implements FeedRSSImageInterface
|
class Image implements FeedRSSImageInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@@ -17,7 +17,7 @@ namespace Alchemy\Phrasea\Feed\RSS;
|
|||||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||||
* @link www.phraseanet.com
|
* @link www.phraseanet.com
|
||||||
*/
|
*/
|
||||||
interface FeedXMLRSSImageInterface
|
interface ImageInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
public function __construct($url, $title, $link);
|
public function __construct($url, $title, $link);
|
||||||
|
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
namespace Entities;
|
namespace Entities;
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AggregateToken
|
* AggregateToken
|
||||||
*/
|
*/
|
||||||
@@ -24,7 +22,6 @@ class AggregateToken
|
|||||||
*/
|
*/
|
||||||
private $value;
|
private $value;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get id
|
* Get id
|
||||||
*
|
*
|
||||||
|
@@ -4,7 +4,6 @@ namespace Entities;
|
|||||||
|
|
||||||
use Alchemy\Phrasea\Application;
|
use Alchemy\Phrasea\Application;
|
||||||
use Alchemy\Phrasea\Feed\FeedInterface;
|
use Alchemy\Phrasea\Feed\FeedInterface;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Feed
|
* Feed
|
||||||
@@ -243,6 +242,7 @@ class Feed implements FeedInterface
|
|||||||
if (null === $how_many) {
|
if (null === $how_many) {
|
||||||
return $this->entries;
|
return $this->entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->entries->slice($offset_start, $how_many);
|
return $this->entries->slice($offset_start, $how_many);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,6 +276,7 @@ class Feed implements FeedInterface
|
|||||||
{
|
{
|
||||||
if ($collection === null) {
|
if ($collection === null) {
|
||||||
$this->base_id = null;
|
$this->base_id = null;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->base_id = $collection->get_base_id();
|
$this->base_id = $collection->get_base_id();
|
||||||
|
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
namespace Entities;
|
namespace Entities;
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FeedEntry
|
* FeedEntry
|
||||||
*/
|
*/
|
||||||
|
@@ -122,7 +122,6 @@ class FeedItem
|
|||||||
*/
|
*/
|
||||||
private $ord;
|
private $ord;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set ord
|
* Set ord
|
||||||
*
|
*
|
||||||
|
@@ -3,7 +3,6 @@
|
|||||||
namespace Entities;
|
namespace Entities;
|
||||||
|
|
||||||
use Alchemy\Phrasea\Application;
|
use Alchemy\Phrasea\Application;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FeedPublisher
|
* FeedPublisher
|
||||||
@@ -35,7 +34,6 @@ class FeedPublisher
|
|||||||
*/
|
*/
|
||||||
private $feed;
|
private $feed;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get id
|
* Get id
|
||||||
*
|
*
|
||||||
@@ -115,7 +113,6 @@ class FeedPublisher
|
|||||||
return $this->feed;
|
return $this->feed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get user
|
* Get user
|
||||||
*
|
*
|
||||||
|
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
namespace Entities;
|
namespace Entities;
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
|
|
||||||
class FeedToken
|
class FeedToken
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -21,7 +19,6 @@ class FeedToken
|
|||||||
*/
|
*/
|
||||||
private $feed;
|
private $feed;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get id
|
* Get id
|
||||||
*
|
*
|
||||||
@@ -82,7 +79,6 @@ class FeedToken
|
|||||||
*/
|
*/
|
||||||
private $value;
|
private $value;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set value
|
* Set value
|
||||||
*
|
*
|
||||||
|
@@ -3,7 +3,6 @@
|
|||||||
namespace Repositories;
|
namespace Repositories;
|
||||||
|
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Entities\Feed;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AggregateTokenRepository
|
* AggregateTokenRepository
|
||||||
|
@@ -43,8 +43,7 @@ class LoadOneFeed extends AbstractFixture implements FixtureInterface
|
|||||||
$feed->addPublisher($publisher);
|
$feed->addPublisher($publisher);
|
||||||
if (isset($this->title) && $this->title !== null) {
|
if (isset($this->title) && $this->title !== null) {
|
||||||
$feed->setTitle($this->title);
|
$feed->setTitle($this->title);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$feed->setTitle("test");
|
$feed->setTitle("test");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user