migrating legacy to symfony

This commit is contained in:
Nicolas Lœuillet 2015-01-22 17:18:56 +01:00
parent 2b9fe72b39
commit 9d50517cea
31 changed files with 1825 additions and 20 deletions

View file

@ -58,7 +58,7 @@ doctrine:
# e.g. database_path: "%kernel.root_dir%/data/data.db3"
# 2. Uncomment database_path in parameters.yml.dist
# 3. Uncomment next line:
# path: "%database_path%"
path: "%database_path%"
orm:
auto_generate_proxy_classes: "%kernel.debug%"

View file

@ -7,7 +7,7 @@ parameters:
database_user: root
database_password: ~
# You should uncomment this if you want use pdo_sqlite
# database_path: "%kernel.root_dir%/data.db3"
database_path: "%kernel.root_dir%/data/db/poche.sqlite"
mailer_transport: smtp
mailer_host: 127.0.0.1

View file

@ -11,6 +11,7 @@
namespace Wallabag\Wallabag;
use \PDO;
use WallabagBundle\Entity;
class Database {

View file

@ -1,17 +0,0 @@
<?php
namespace WallabagBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class DefaultController extends Controller
{
/**
* @Route("/app/index", name="homepage")
*/
public function indexAction()
{
return $this->render('default/index.html.twig');
}
}

View file

@ -0,0 +1,25 @@
<?php
namespace WallabagBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use WallabagBundle\Repository;
class EntryController extends Controller
{
/**
* @Route("/unread", name="unread")
*/
public function unreadAction()
{
$repository = $this->getDoctrine()->getRepository('WallabagBundle:Entries');
$entries = $repository->findUnreadByUser(1);
return $this->render(
'WallabagBundle:Entry:entries.html.twig',
array('entries' => $entries)
);
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace WallabagBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\Config\FileLocator;
class WallabagExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.xml');
}
public function getAlias()
{
return 'wallabag';
}
}

View file

@ -0,0 +1,95 @@
<?php
namespace WallabagBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Config
*
* @ORM\Table(name="config")
* @ORM\Entity
*/
class Config
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", nullable=true)
*/
private $name;
/**
* @var string
*
* @ORM\Column(name="value", type="blob", nullable=true)
*/
private $value;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
* @return Config
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set value
*
* @param string $value
* @return Config
*/
public function setValue($value)
{
$this->value = $value;
return $this;
}
/**
* Get value
*
* @return string
*/
public function getValue()
{
return $this->value;
}
}

View file

@ -0,0 +1,95 @@
<?php
namespace WallabagBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Config
*
* @ORM\Table(name="config")
* @ORM\Entity
*/
class Config
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", nullable=true)
*/
private $name;
/**
* @var string
*
* @ORM\Column(name="value", type="blob", nullable=true)
*/
private $value;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
* @return Config
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set value
*
* @param string $value
* @return Config
*/
public function setValue($value)
{
$this->value = $value;
return $this;
}
/**
* Get value
*
* @return string
*/
public function getValue()
{
return $this->value;
}
}

View file

@ -0,0 +1,215 @@
<?php
namespace WallabagBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Entries
*
* @ORM\Entity(repositoryClass="WallabagBundle\Repository\EntriesRepository")
* @ORM\Table(name="entries")
*/
class Entries
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=true)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="title", type="text", nullable=true)
*/
private $title;
/**
* @var string
*
* @ORM\Column(name="url", type="text", nullable=true)
*/
private $url;
/**
* @var string
*
* @ORM\Column(name="is_read", type="decimal", precision=10, scale=0, nullable=true)
*/
private $isRead = '0';
/**
* @var string
*
* @ORM\Column(name="is_fav", type="decimal", precision=10, scale=0, nullable=true)
*/
private $isFav = '0';
/**
* @var string
*
* @ORM\Column(name="content", type="text", nullable=true)
*/
private $content;
/**
* @var string
*
* @ORM\Column(name="user_id", type="decimal", precision=10, scale=0, nullable=true)
*/
private $userId;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set title
*
* @param string $title
* @return Entries
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set url
*
* @param string $url
* @return Entries
*/
public function setUrl($url)
{
$this->url = $url;
return $this;
}
/**
* Get url
*
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set isRead
*
* @param string $isRead
* @return Entries
*/
public function setIsRead($isRead)
{
$this->isRead = $isRead;
return $this;
}
/**
* Get isRead
*
* @return string
*/
public function getIsRead()
{
return $this->isRead;
}
/**
* Set isFav
*
* @param string $isFav
* @return Entries
*/
public function setIsFav($isFav)
{
$this->isFav = $isFav;
return $this;
}
/**
* Get isFav
*
* @return string
*/
public function getIsFav()
{
return $this->isFav;
}
/**
* Set content
*
* @param string $content
* @return Entries
*/
public function setContent($content)
{
$this->content = $content;
return $this;
}
/**
* Get content
*
* @return string
*/
public function getContent()
{
return $this->content;
}
/**
* Set userId
*
* @param string $userId
* @return Entries
*/
public function setUserId($userId)
{
$this->userId = $userId;
return $this;
}
/**
* Get userId
*
* @return string
*/
public function getUserId()
{
return $this->userId;
}
}

View file

@ -0,0 +1,215 @@
<?php
namespace WallabagBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Entries
*
* @ORM\Entity(repositoryClass="WallabagBundle\Repository\EntriesRepository")
* @ORM\Table(name="entries")
*/
class Entries
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=true)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="title", type="text", nullable=true)
*/
private $title;
/**
* @var string
*
* @ORM\Column(name="url", type="text", nullable=true)
*/
private $url;
/**
* @var string
*
* @ORM\Column(name="is_read", type="decimal", precision=10, scale=0, nullable=true)
*/
private $isRead = '0';
/**
* @var string
*
* @ORM\Column(name="is_fav", type="decimal", precision=10, scale=0, nullable=true)
*/
private $isFav = '0';
/**
* @var string
*
* @ORM\Column(name="content", type="text", nullable=true)
*/
private $content;
/**
* @var string
*
* @ORM\Column(name="user_id", type="decimal", precision=10, scale=0, nullable=true)
*/
private $userId;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set title
*
* @param string $title
* @return Entries
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set url
*
* @param string $url
* @return Entries
*/
public function setUrl($url)
{
$this->url = $url;
return $this;
}
/**
* Get url
*
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set isRead
*
* @param string $isRead
* @return Entries
*/
public function setIsRead($isRead)
{
$this->isRead = $isRead;
return $this;
}
/**
* Get isRead
*
* @return string
*/
public function getIsRead()
{
return $this->isRead;
}
/**
* Set isFav
*
* @param string $isFav
* @return Entries
*/
public function setIsFav($isFav)
{
$this->isFav = $isFav;
return $this;
}
/**
* Get isFav
*
* @return string
*/
public function getIsFav()
{
return $this->isFav;
}
/**
* Set content
*
* @param string $content
* @return Entries
*/
public function setContent($content)
{
$this->content = $content;
return $this;
}
/**
* Get content
*
* @return string
*/
public function getContent()
{
return $this->content;
}
/**
* Set userId
*
* @param string $userId
* @return Entries
*/
public function setUserId($userId)
{
$this->userId = $userId;
return $this;
}
/**
* Get userId
*
* @return string
*/
public function getUserId()
{
return $this->userId;
}
}

View file

@ -0,0 +1,74 @@
<?php
namespace WallabagBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Entry
*
* @ORM\Table(name="Entry")
* @ORM\Entity
*/
class Entry
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="title", type="string", length=255, nullable=false)
*/
private $title;
/**
* @var string
*
* @ORM\Column(name="url", type="text", nullable=false)
*/
private $url;
/**
* @var string
*
* @ORM\Column(name="content", type="text", nullable=false)
*/
private $content;
/**
* @var boolean
*
* @ORM\Column(name="is_read", type="boolean", nullable=false)
*/
private $isRead;
/**
* @var boolean
*
* @ORM\Column(name="is_fav", type="boolean", nullable=false)
*/
private $isFav;
/**
* @var \DateTime
*
* @ORM\Column(name="created_at", type="datetime", nullable=false)
*/
private $createdAt;
/**
* @var \DateTime
*
* @ORM\Column(name="edited_at", type="datetime", nullable=false)
*/
private $editedAt;
}

View file

@ -0,0 +1,65 @@
<?php
namespace WallabagBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Tags
*
* @ORM\Table(name="tags")
* @ORM\Entity
*/
class Tags
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="value", type="text", nullable=true)
*/
private $value;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set value
*
* @param string $value
* @return Tags
*/
public function setValue($value)
{
$this->value = $value;
return $this;
}
/**
* Get value
*
* @return string
*/
public function getValue()
{
return $this->value;
}
}

View file

@ -0,0 +1,65 @@
<?php
namespace WallabagBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Tags
*
* @ORM\Table(name="tags")
* @ORM\Entity
*/
class Tags
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="value", type="text", nullable=true)
*/
private $value;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set value
*
* @param string $value
* @return Tags
*/
public function setValue($value)
{
$this->value = $value;
return $this;
}
/**
* Get value
*
* @return string
*/
public function getValue()
{
return $this->value;
}
}

View file

@ -0,0 +1,95 @@
<?php
namespace WallabagBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* TagsEntries
*
* @ORM\Table(name="tags_entries")
* @ORM\Entity
*/
class TagsEntries
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var integer
*
* @ORM\Column(name="entry_id", type="integer", nullable=true)
*/
private $entryId;
/**
* @var integer
*
* @ORM\Column(name="tag_id", type="integer", nullable=true)
*/
private $tagId;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set entryId
*
* @param integer $entryId
* @return TagsEntries
*/
public function setEntryId($entryId)
{
$this->entryId = $entryId;
return $this;
}
/**
* Get entryId
*
* @return integer
*/
public function getEntryId()
{
return $this->entryId;
}
/**
* Set tagId
*
* @param integer $tagId
* @return TagsEntries
*/
public function setTagId($tagId)
{
$this->tagId = $tagId;
return $this;
}
/**
* Get tagId
*
* @return integer
*/
public function getTagId()
{
return $this->tagId;
}
}

View file

@ -0,0 +1,95 @@
<?php
namespace WallabagBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* TagsEntries
*
* @ORM\Table(name="tags_entries")
* @ORM\Entity
*/
class TagsEntries
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var integer
*
* @ORM\Column(name="entry_id", type="integer", nullable=true)
*/
private $entryId;
/**
* @var integer
*
* @ORM\Column(name="tag_id", type="integer", nullable=true)
*/
private $tagId;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set entryId
*
* @param integer $entryId
* @return TagsEntries
*/
public function setEntryId($entryId)
{
$this->entryId = $entryId;
return $this;
}
/**
* Get entryId
*
* @return integer
*/
public function getEntryId()
{
return $this->entryId;
}
/**
* Set tagId
*
* @param integer $tagId
* @return TagsEntries
*/
public function setTagId($tagId)
{
$this->tagId = $tagId;
return $this;
}
/**
* Get tagId
*
* @return integer
*/
public function getTagId()
{
return $this->tagId;
}
}

View file

@ -0,0 +1,155 @@
<?php
namespace WallabagBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Users
*
* @ORM\Table(name="users")
* @ORM\Entity
*/
class Users
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=true)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="username", type="text", nullable=true)
*/
private $username;
/**
* @var string
*
* @ORM\Column(name="password", type="text", nullable=true)
*/
private $password;
/**
* @var string
*
* @ORM\Column(name="name", type="text", nullable=true)
*/
private $name;
/**
* @var string
*
* @ORM\Column(name="email", type="text", nullable=true)
*/
private $email;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set username
*
* @param string $username
* @return Users
*/
public function setUsername($username)
{
$this->username = $username;
return $this;
}
/**
* Get username
*
* @return string
*/
public function getUsername()
{
return $this->username;
}
/**
* Set password
*
* @param string $password
* @return Users
*/
public function setPassword($password)
{
$this->password = $password;
return $this;
}
/**
* Get password
*
* @return string
*/
public function getPassword()
{
return $this->password;
}
/**
* Set name
*
* @param string $name
* @return Users
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set email
*
* @param string $email
* @return Users
*/
public function setEmail($email)
{
$this->email = $email;
return $this;
}
/**
* Get email
*
* @return string
*/
public function getEmail()
{
return $this->email;
}
}

View file

@ -0,0 +1,155 @@
<?php
namespace WallabagBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Users
*
* @ORM\Table(name="users")
* @ORM\Entity
*/
class Users
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=true)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="username", type="text", nullable=true)
*/
private $username;
/**
* @var string
*
* @ORM\Column(name="password", type="text", nullable=true)
*/
private $password;
/**
* @var string
*
* @ORM\Column(name="name", type="text", nullable=true)
*/
private $name;
/**
* @var string
*
* @ORM\Column(name="email", type="text", nullable=true)
*/
private $email;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set username
*
* @param string $username
* @return Users
*/
public function setUsername($username)
{
$this->username = $username;
return $this;
}
/**
* Get username
*
* @return string
*/
public function getUsername()
{
return $this->username;
}
/**
* Set password
*
* @param string $password
* @return Users
*/
public function setPassword($password)
{
$this->password = $password;
return $this;
}
/**
* Get password
*
* @return string
*/
public function getPassword()
{
return $this->password;
}
/**
* Set name
*
* @param string $name
* @return Users
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set email
*
* @param string $email
* @return Users
*/
public function setEmail($email)
{
$this->email = $email;
return $this;
}
/**
* Get email
*
* @return string
*/
public function getEmail()
{
return $this->email;
}
}

View file

@ -0,0 +1,125 @@
<?php
namespace WallabagBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* UsersConfig
*
* @ORM\Table(name="users_config")
* @ORM\Entity
*/
class UsersConfig
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=true)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="user_id", type="decimal", precision=10, scale=0, nullable=true)
*/
private $userId;
/**
* @var string
*
* @ORM\Column(name="name", type="text", nullable=true)
*/
private $name;
/**
* @var string
*
* @ORM\Column(name="value", type="text", nullable=true)
*/
private $value;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set userId
*
* @param string $userId
* @return UsersConfig
*/
public function setUserId($userId)
{
$this->userId = $userId;
return $this;
}
/**
* Get userId
*
* @return string
*/
public function getUserId()
{
return $this->userId;
}
/**
* Set name
*
* @param string $name
* @return UsersConfig
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set value
*
* @param string $value
* @return UsersConfig
*/
public function setValue($value)
{
$this->value = $value;
return $this;
}
/**
* Get value
*
* @return string
*/
public function getValue()
{
return $this->value;
}
}

View file

@ -0,0 +1,125 @@
<?php
namespace WallabagBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* UsersConfig
*
* @ORM\Table(name="users_config")
* @ORM\Entity
*/
class UsersConfig
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", nullable=true)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="user_id", type="decimal", precision=10, scale=0, nullable=true)
*/
private $userId;
/**
* @var string
*
* @ORM\Column(name="name", type="text", nullable=true)
*/
private $name;
/**
* @var string
*
* @ORM\Column(name="value", type="text", nullable=true)
*/
private $value;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set userId
*
* @param string $userId
* @return UsersConfig
*/
public function setUserId($userId)
{
$this->userId = $userId;
return $this;
}
/**
* Get userId
*
* @return string
*/
public function getUserId()
{
return $this->userId;
}
/**
* Set name
*
* @param string $name
* @return UsersConfig
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set value
*
* @param string $value
* @return UsersConfig
*/
public function setValue($value)
{
$this->value = $value;
return $this;
}
/**
* Get value
*
* @return string
*/
public function getValue()
{
return $this->value;
}
}

View file

@ -0,0 +1,35 @@
<?php
namespace WallabagBundle\Repository;
use Doctrine\ORM\Query;
use Doctrine\ORM\EntityRepository;
/**
* EntriesRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class EntriesRepository extends EntityRepository
{
/* public function findUnreadByUser($userId)
{
return $this->createQueryBuilder('e')
->where('e.is_read = 0')
->andWhere('e.user_id = :userId')
->setParameter('userId', $userId)
->getQuery();
}*/
public function findUnreadByUser($userId)
{
$qb = $this->createQueryBuilder('e')
->select('e')
->where('e.isRead = 0')
->andWhere('e.userId =:userId')->setParameter('userId', $userId)
->getQuery()
->getResult(Query::HYDRATE_ARRAY);
return $qb;
}
}

View file

@ -0,0 +1,3 @@
_wllbg:
resource: "@WallabagBundle/Controller/EntryController.php"
type: annotation

View file

@ -0,0 +1,12 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="wallabag.twig.extension.wallabag_extension" class="WallabagBundle\Twig\Extension\WallabagExtension">
<tag name="twig.extension" />
</service>
</services>
</container>

View file

@ -0,0 +1,26 @@
{% extends "WallabagBundle::layout.html.twig" %}
{% block title "Unread" %}
{% block content_header '' %}
{% block content %}
{% for entry in entries %}
<div id="entry-{{ entry.id|e }}" class="entrie">
<h2><a href="index.php?view=view&amp;id={{ entry.id|e }}">{{ entry.title|raw }}</a></h2>
{% if entry.content| readingTime > 0 %}
<div class="estimatedTime"><span class="tool reading-time">{% trans %}estimated reading time :{% endtrans %} {{ entry.content| readingTime }} min</span></div>
{% else %}
<div class="estimatedTime"><span class="tool reading-time">{% trans %}estimated reading time :{% endtrans %} <small class="inferieur">&lt;</small> 1 min</span></div>
{% endif %}
<ul class="tools links">
<li><a title="{% trans %}Toggle mark as read{% endtrans %}" class="tool icon-check icon {% if entry.isRead == 0 %}archive-off{% else %}archive{% endif %}" href="./?action=toggle_archive&amp;id={{ entry.id|e }}"><span>{% trans %}Toggle mark as read{% endtrans %}</span></a></li>
<li><a title="{% trans %}toggle favorite{% endtrans %}" class="tool icon-star icon {% if entry.isFav == 0 %}fav-off{% else %}fav{% endif %}" href="./?action=toggle_fav&amp;id={{ entry.id|e }}"><span>{% trans %}toggle favorite{% endtrans %}</span></a></li>
<li><a title="{% trans %}delete{% endtrans %}" class="tool delete icon-trash icon" href="./?action=delete&amp;id={{ entry.id|e }}"><span>{% trans %}delete{% endtrans %}</span></a></li>
<li><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link icon-link icon"><span>{{ entry.url | e | domainName }}</span></a></li>
</ul>
<p>{{ entry.content|striptags|slice(0, 300) }}...</p>
</div>
{% endfor %}
{% endblock %}

View file

@ -0,0 +1,3 @@
<script type="text/javascript">
top["bookmarklet-url@wallabag.org"]=""+"<!DOCTYPE html>"+"<html>"+"<head>"+"<title>bag it!</title>"+'<link rel="icon" href="tpl/img/favicon.ico" />'+"</head>"+"<body>"+"<script>"+"window.onload=function(){"+"window.setTimeout(function(){"+"history.back();"+"},250);"+"};"+"</scr"+"ipt>"+"</body>"+"</html>"
</script>

View file

@ -0,0 +1,3 @@
<footer class="w600p center mt3 mb3 smaller txtright">
<p>{% trans %}powered by{% endtrans %} <a href="http://wallabag.org">wallabag</a></p>
</footer>

View file

@ -0,0 +1,40 @@
<link rel="apple-touch-icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-152.png') }}" sizes="152x152">
<link rel="icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-152.png') }}" sizes="152x152">
<link rel="apple-touch-icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-144.png') }}" sizes="144x144">
<link rel="icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-144.png') }}" sizes="144x144">
<link rel="apple-touch-icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-120.png') }}" sizes="120x120">
<link rel="icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-120.png') }}" sizes="120x120">
<link rel="apple-touch-icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-114.png') }}" sizes="114x114">
<link rel="icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-114.png') }}" sizes="114x114">
<link rel="apple-touch-icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-76.png') }}" sizes="76x76">
<link rel="icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-76.png') }}" sizes="76x76">
<link rel="apple-touch-icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-72.png') }}" sizes="72x72">
<link rel="icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-72.png') }}" sizes="72x72">
<link rel="apple-touch-icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-57.png') }}" sizes="57x57">
<link rel="icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-57.png') }}" sizes="57x57">
<link rel="apple-touch-icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon.png') }}">
<link rel="icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon.png') }}">
<link rel="shortcut icon" type="image/x-icon" href="{{ asset('themes/_global/img/appicon/favicon.ico') }}">
<link rel="stylesheet" href="{{ asset('themes/baggy/css/ratatouille.css') }}" media="all">
<link rel="stylesheet" href="{{ asset('themes/baggy/css/font.css') }}" media="all">
<link rel="stylesheet" href="{{ asset('themes/baggy/css/main.css') }}" media="all">
<link rel="stylesheet" href="{{ asset('themes/baggy/css/messages.css') }}" media="all">
<link rel="stylesheet" href="{{ asset('themes/baggy/css/print.css') }}" media="print">
<script src="{{ asset('themes/_global/js/jquery-2.0.3.min.js') }}"></script>
<script src="{{ asset('themes/_global/js/autoClose.js') }}"></script>
<script src="{{ asset('themes/baggy/js/jquery.cookie.js') }}"></script>
<script src="{{ asset('themes/baggy/js/init.js') }}"></script>
<script src="{{ asset('themes/_global/js/saveLink.js') }}"></script>
<script src="{{ asset('themes/_global/js/popupForm.js') }}"></script>
<script src="{{ asset('themes/baggy/js/closeMessage.js') }}"></script>

View file

@ -0,0 +1,6 @@
<header class="w600p center mbm">
<h1>
{% block logo %}<img width="100" height="100" src="{{ asset('themes/baggy/img/logo-other_themes.png') }}" alt="wallabag logo" />{% endblock %}
</h1>
</header>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<!--[if lte IE 6]><html class="no-js ie6 ie67 ie678" lang="en"><![endif]-->
<!--[if lte IE 7]><html class="no-js ie7 ie67 ie678" lang="en"><![endif]-->
<!--[if IE 8]><html class="no-js ie8 ie678" lang="en"><![endif]-->
<!--[if gt IE 8]><html class="no-js" lang="en"><![endif]-->
<html lang="en">
<head>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<!--[if IE]>
<meta http-equiv="X-UA-Compatible" content="IE=10">
<![endif]-->
<title>{% block title %}{% endblock %} - wallabag</title>
{% include "WallabagBundle::_head.html.twig" %}
{% include "WallabagBundle::_bookmarklet.html.twig" %}
</head>
<body>
{% include "WallabagBundle::_top.html.twig" %}
<div id="main">
{% block menu %}{% endblock %}
{% block precontent %}{% endblock %}
{% block messages %}
{% include "WallabagBundle::_messages.html.twig" %}
{% endblock %}
<div id="content" class="w600p center">
{% block content %}{% endblock %}
</div>
</div>
{% include "WallabagBundle::_footer.html.twig" %}
</body>
</html>

View file

@ -4,7 +4,7 @@ namespace WallabagBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class DefaultControllerTest extends WebTestCase
class EntryControllerTest extends WebTestCase
{
public function testIndex()
{

View file

@ -0,0 +1,41 @@
<?php
namespace WallabagBundle\Twig\Extension;
class WallabagExtension extends \Twig_Extension
{
public function getFilters()
{
return array(
new \Twig_SimpleFilter('readingTime', array($this, 'getReadingTime')),
new \Twig_SimpleFilter('domainName', array($this, 'getDomainName')),
);
}
/**
* Returns the domain name for a URL
*
* @param $url
* @return string
*/
public static function getDomainName($url)
{
return parse_url($url, PHP_URL_HOST);
}
/**
* For a given text, we calculate reading time for an article
*
* @param $text
* @return float
*/
public static function getReadingTime($text)
{
return floor(str_word_count(strip_tags($text)) / 200);
}
public function getName()
{
return 'wallabag_extension';
}
}