move WallabagBundle into Wallabag:CoreBundle

This commit is contained in:
Nicolas Lœuillet
2015-01-23 16:28:37 +01:00
parent b84a80559a
commit ad4d1caa9e
40 changed files with 67 additions and 62 deletions

View File

@ -0,0 +1,184 @@
<?php
namespace Wallabag\CoreBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Wallabag\CoreBundle\Repository;
use Wallabag\CoreBundle\Entity\Entries;
use Wallabag\Wallabag\Tools;
use Wallabag\Wallabag\Url;
class EntryController extends Controller
{
/**
* @param Request $request
* @Route("/new", name="new_entry")
* @return \Symfony\Component\HttpFoundation\Response
*/
public function addEntryAction(Request $request)
{
$entry = new Entries();
$entry->setUserId(1);
$form = $this->createFormBuilder($entry)
->add('url', 'url')
->add('save', 'submit')
->getForm();
$form->handleRequest($request);
if ($form->isValid()) {
$content = Tools::getPageContent(new Url($entry->getUrl()));
var_dump($content);die;
$em = $this->getDoctrine()->getEntityManager();
$em->persist($entry);
$em->flush();
$this->get('session')->getFlashBag()->add(
'notice',
'Entry saved'
);
return $this->redirect($this->generateUrl('homepage'));
}
return $this->render('WallabagCoreBundle:Entry:new.html.twig', array(
'form' => $form->createView(),
));
}
/**
* Shows unread entries for current user
*
* @Route("/unread", name="unread")
* @return \Symfony\Component\HttpFoundation\Response
*/
public function showUnreadAction()
{
$repository = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entries');
$entries = $repository->findUnreadByUser(1, 0);
return $this->render(
'WallabagCoreBundle:Entry:entries.html.twig',
array('entries' => $entries)
);
}
/**
* Shows read entries for current user
*
* @Route("/archive", name="archive")
* @return \Symfony\Component\HttpFoundation\Response
*/
public function showArchiveAction()
{
$repository = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entries');
$entries = $repository->findArchiveByUser(1, 0);
return $this->render(
'WallabagCoreBundle:Entry:entries.html.twig',
array('entries' => $entries)
);
}
/**
* Shows starred entries for current user
*
* @Route("/starred", name="starred")
* @return \Symfony\Component\HttpFoundation\Response
*/
public function showStarredAction()
{
$repository = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entries');
$entries = $repository->findStarredByUser(1, 0);
return $this->render(
'WallabagCoreBundle:Entry:entries.html.twig',
array('entries' => $entries)
);
}
/**
* Shows entry content
*
* @param Entries $entry
* @Route("/view/{id}", requirements={"id" = "\d+"}, name="view")
* @return \Symfony\Component\HttpFoundation\Response
*/
public function viewAction(Entries $entry)
{
return $this->render(
'WallabagCoreBundle:Entry:entry.html.twig',
array('entry' => $entry)
);
}
/**
* Changes read status for an entry
*
* @param Request $request
* @param Entries $entry
* @Route("/archive/{id}", requirements={"id" = "\d+"}, name="archive_entry")
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*/
public function toggleArchiveAction(Request $request, Entries $entry)
{
$entry->toggleArchive();
$this->getDoctrine()->getManager()->flush();
$this->get('session')->getFlashBag()->add(
'notice',
'Entry archived'
);
return $this->redirect($request->headers->get('referer'));
}
/**
* Changes favorite status for an entry
*
* @param Request $request
* @param Entries $entry
* @Route("/star/{id}", requirements={"id" = "\d+"}, name="star_entry")
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*/
public function toggleStarAction(Request $request, Entries $entry)
{
$entry->toggleStar();
$this->getDoctrine()->getManager()->flush();
$this->get('session')->getFlashBag()->add(
'notice',
'Entry starred'
);
return $this->redirect($request->headers->get('referer'));
}
/**
* Deletes entry
*
* @param Request $request
* @param Entries $entry
* @Route("/delete/{id}", requirements={"id" = "\d+"}, name="delete_entry")
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*/
public function deleteEntryAction(Request $request, Entries $entry)
{
$em = $this->getDoctrine()->getEntityManager();
$em->remove($entry);
$em->flush();
$this->get('session')->getFlashBag()->add(
'notice',
'Entry deleted'
);
return $this->redirect($request->headers->get('referer'));
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace Wallabag\CoreBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class StaticController extends Controller
{
/**
* @Route("/about", name="about")
*/
public function aboutAction()
{
return $this->render(
'WallabagCoreBundle:Static:about.html.twig',
array()
);
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace Wallabag\CoreBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\Config\FileLocator;
class WallabagCoreExtension 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_core';
}
}

View File

@ -0,0 +1,95 @@
<?php
namespace Wallabag\CoreBundle\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,230 @@
<?php
namespace Wallabag\CoreBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Entries
*
* @ORM\Entity(repositoryClass="Wallabag\CoreBundle\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
*
* @Assert\NotBlank()
* @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;
}
public function toggleArchive()
{
$this->isRead = $this->getIsRead() ^ 1;
return $this;
}
/**
* 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;
}
public function toggleStar()
{
$this->isFav = $this->getIsFav() ^ 1;
return $this;
}
/**
* 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 Wallabag\CoreBundle\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 Wallabag\CoreBundle\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 Wallabag\CoreBundle\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 Wallabag\CoreBundle\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,79 @@
<?php
namespace Wallabag\CoreBundle\Repository;
use Doctrine\ORM\Query;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Tools\Pagination\Paginator;
class EntriesRepository extends EntityRepository
{
/**
* Retrieves unread entries for a user
*
* @param $userId
* @param $firstResult
* @param int $maxResults
* @return Paginator
*/
public function findUnreadByUser($userId, $firstResult, $maxResults = 12)
{
$qb = $this->createQueryBuilder('e')
->select('e')
->setFirstResult($firstResult)
->setMaxResults($maxResults)
->where('e.isRead = 0')
->andWhere('e.userId =:userId')->setParameter('userId', $userId)
->getQuery();
$paginator = new Paginator($qb);
return $paginator;
}
/**
* Retrieves read entries for a user
*
* @param $userId
* @param $firstResult
* @param int $maxResults
* @return Paginator
*/
public function findArchiveByUser($userId, $firstResult, $maxResults = 12)
{
$qb = $this->createQueryBuilder('e')
->select('e')
->setFirstResult($firstResult)
->setMaxResults($maxResults)
->where('e.isRead = 1')
->andWhere('e.userId =:userId')->setParameter('userId', $userId)
->getQuery();
$paginator = new Paginator($qb);
return $paginator;
}
/**
* Retrieves starred entries for a user
*
* @param $userId
* @param $firstResult
* @param int $maxResults
* @return Paginator
*/
public function findStarredByUser($userId, $firstResult, $maxResults = 12)
{
$qb = $this->createQueryBuilder('e')
->select('e')
->setFirstResult($firstResult)
->setMaxResults($maxResults)
->where('e.isFav = 1')
->andWhere('e.userId =:userId')->setParameter('userId', $userId)
->getQuery();
$paginator = new Paginator($qb);
return $paginator;
}
}

View File

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

View File

@ -0,0 +1,17 @@
<?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_core.twig.wallabag" class="Wallabag\CoreBundle\Twig\Extension\WallabagExtension">
<tag name="twig.extension" />
</service>
</services>
</container>

View File

@ -0,0 +1,47 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title "Unread" %}
{% block menu %}
{% include "WallabagCoreBundle::_menu.html.twig" %}
{% endblock %}
{% block content %}
{% block pager %}
{% if entries is not empty %}
<div class="results">
<div class="nb-results">{{ entries.count }} {% trans %}entries{% endtrans %}</div>
<div class="pagination">
{% for p in range(1, entries.count) %}
<li>
<a href="{{ path(app.request.attributes.get('_route'), {'page': p}) }}">{{ p }}</a>
</li>
{% endfor %}
</div>
</div>
{% endif %}
{% endblock %}
{% if entries is empty %}
<div class="messages warning"><p>{% trans %}No articles found.{% endtrans %}</p></div>
{% else %}
{% for entry in entries %}
<div id="entry-{{ entry.id|e }}" class="entrie">
<h2><a href="{{ path('view', { 'id': entry.id }) }}">{{ 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="{{ path('archive_entry', { 'id': entry.id }) }}"><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="{{ path('star_entry', { 'id': entry.id }) }}"><span>{% trans %}toggle favorite{% endtrans %}</span></a></li>
<li><a title="{% trans %}delete{% endtrans %}" class="tool delete icon-trash icon" href="{{ path('delete_entry', { 'id': entry.id }) }}"><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 %}
{% endif %}
{% endblock %}

View File

@ -0,0 +1,104 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{{ entry.title|raw }} ({{ entry.url | e | domainName }}){% endblock %}
{% block menu %}
{% include "WallabagCoreBundle::_menu.html.twig" %}
{% endblock %}
{% block content %}
<div id="article_toolbar">
<ul class="links">
<li class="topPosF"><a href="#top" title="{% trans %}Back to top{% endtrans %}" class="tool top icon icon-arrow-up-thick"><span>{% trans %}Back to top{% endtrans %}</span></a></li>
<li><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link icon icon-link"><span>{{ entry.url | e | domainName }}</span></a></li>
<li><a title="{% trans %}Mark as read{% endtrans %}" class="tool icon icon-check {% if entry.isRead == 0 %}archive-off{% else %}archive{% endif %}" href="{{ path('archive_entry', { 'id': entry.id }) }}"><span>{% trans %}Toggle mark as read{% endtrans %}</span></a></li>
<li><a title="{% trans %}Favorite{% endtrans %}" class="tool icon icon-star {% if entry.isFav == 0 %}fav-off{% else %}fav{% endif %}" href="{{ path('star_entry', { 'id': entry.id }) }}"><span>{% trans %}Toggle favorite{% endtrans %}</span></a></li>
<li><a title="{% trans %}Delete{% endtrans %}" class="tool delete icon icon-trash" href="{{ path('delete_entry', { 'id': entry.id }) }}"><span>{% trans %}Delete{% endtrans %}</span></a></li>
{% if share_twitter %}<li><a href="https://twitter.com/home?status={{entry.title|url_encode}}%20{{ entry.url|url_encode }}%20via%20@wallabagapp" target="_blank" class="tool twitter icon icon-twitter" title="{% trans %}Tweet{% endtrans %}"><span>{% trans %}Tweet{% endtrans %}</span></a></li>{% endif %}
{% if share_mail %}<li><a href="mailto:?subject={{ entry.title|url_encode }}&amp;body={{ entry.url|url_encode }}%20via%20@wallabagapp" class="tool email icon icon-mail" title="{% trans %}Email{% endtrans %}"><span>{% trans %}Email{% endtrans %}</span></a></li>{% endif %}
{% if share_shaarli %}<li><a href="{{ shaarli_url }}/index.php?post={{ entry.url|url_encode }}&amp;title={{ entry.title|url_encode }}" target="_blank" class="tool shaarli" title="{% trans %}shaarli{% endtrans %}"><span>{% trans %}shaarli{% endtrans %}</span></a></li>{% endif %}
{% if share_diaspora %}<li><a href="{{ diaspora_url }}/bookmarklet?url={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}&notes=&v=1&noui=1&jump=doclose" target="_blank" class="tool diaspora icon-image icon-image--diaspora" title="{% trans %}diaspora{% endtrans %}"><span>{% trans %}diaspora{% endtrans %}</span></a></li>{% endif %}
{# {% if flattr %}{% if flattr.status == flattrable %}<li><a href="http://flattr.com/submit/auto?url={{ entry.url }}" class="tool flattr icon icon-flattr" target="_blank" title="{% trans %}flattr{% endtrans %}"><span>{% trans %}flattr{% endtrans %}</span></a></li>{% elseif flattr.status == flattred %}<li><a href="{{ flattr.flattrItemURL }}" class="tool flattr icon icon-flattr" target="_blank" title="{% trans %}flattr{% endtrans %}><span>{% trans %}flattr{% endtrans %}</span> ({{ flattr.numFlattrs }})</a></li>{% endif %}{% endif %} #}
{% if carrot %}<li><a href="https://secure.carrot.org/GiveAndGetBack.do?url={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}" class="tool carrot icon-image icon-image--carrot" target="_blank" title="{% trans %}carrot{% endtrans %}"><span>Carrot</span></a></li>{% endif %}
{% if show_printlink %}<li><a title="{% trans %}Print{% endtrans %}" class="tool icon icon-print" href="javascript: window.print();"><span>{% trans %}Print{% endtrans %}</span></a></li>{% endif %}
{% if export_epub %}<li><a href="?epub&amp;method=id&amp;value={{ entry.id|e }}" title="Generate ePub file">EPUB</a></li>{% endif %}
{% if export_mobi %}<li><a href="?mobi&amp;method=id&amp;value={{ entry.id|e }}" title="Generate Mobi file">MOBI</a></li>{% endif %}
{% if export_pdf %}<li><a href="?pdf&amp;method=id&amp;value={{ entry.id|e }}" title="Generate PDF file">PDF</a></li>{% endif %}
<li><a href="mailto:hello@wallabag.org?subject=Wrong%20display%20in%20wallabag&amp;body={{ entry.url|url_encode }}" title="{% trans %}Does this article appear wrong?{% endtrans %}" class="tool bad-display icon icon-delete"><span>{% trans %}Does this article appear wrong?{% endtrans %}</span></a></li>
</ul>
</div>
<div id="article">
<header class="mbm">
<h1>{{ entry.title|raw }}</h1>
</header>
<aside class="tags">
tags: {# {% for tag in tags %}<a href="./?view=tag&amp;id={{ tag.id }}">{{ tag.value }}</a> {% endfor %}<a href="./?view=edit-tags&amp;id={{ entry.id|e }}" title="{% trans %}Edit tags{% endtrans %}">✎</a> #}
</aside>
<article>
{{ entry.content | raw }}
</article>
</div>
<script src="{{ asset('themes/_global/js/restoreScroll.js')}}"></script>
<script type="text/javascript">
$(document).ready(function() {
// toggle read property of current article
/* $('#markAsRead').click(function(){
$("body").css("cursor", "wait");
$.ajax( { url: '{{ path('archive_entry', { 'id': entry.id }) }}' }).done(
function( data ) {
if ( data == '1' ) {
if ( $('#markAsRead').hasClass("archive-off") ) {
$('#markAsRead').removeClass("archive-off");
$('#markAsRead').addClass("archive");
}
else {
$('#markAsRead').removeClass("archive");
$('#markAsRead').addClass("archive-off");
}
}
else {
alert('Error! Pls check if you are logged in.');
}
});
$("body").css("cursor", "auto");
});*/
// toggle favorite property of current article
/* $('#setFav').click(function(){
$("body").css("cursor", "wait");
$.ajax( { url: '{{ path('star_entry', { 'id': entry.id }) }}' }).done(
function( data ) {
if ( data == '1' ) {
if ( $('#setFav').hasClass("fav-off") ) {
$('#setFav').removeClass("fav-off");
$('#setFav').addClass("fav");
}
else {
$('#setFav').removeClass("fav");
$('#setFav').addClass("fav-off");
}
}
else {
alert('Error! Pls check if you are logged in.');
}
});
$("body").css("cursor", "auto");
});*/
$(window).scroll(function(e){
var scrollTop = $(window).scrollTop();
var docHeight = $(document).height();
var scrollPercent = (scrollTop) / (docHeight);
var scrollPercentRounded = Math.round(scrollPercent*100)/100;
savePercent({{ entry.id|e }}, scrollPercentRounded);
});
retrievePercent({{ entry.id|e }});
$(window).resize(function(){
retrievePercent({{ entry.id|e }});
});
});
</script>
{% endblock %}

View File

@ -0,0 +1,11 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{% trans %}Save new entry{% endtrans %}{% endblock %}
{% block menu %}
{% include "WallabagCoreBundle::_menu.html.twig" %}
{% endblock %}
{% block content %}
{{ form(form) }}
{% endblock %}

View File

@ -0,0 +1,51 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{% trans %}About{% endtrans %}{% endblock %}
{% block menu %}
{% include "WallabagCoreBundle::_menu.html.twig" %}
{% endblock %}
{% block content %}
<h2>{% trans %}About wallabag{% endtrans %}</h2>
<dl>
<dt>{% trans %}Project website{% endtrans %}</dt>
<dd><a href="https://www.wallabag.org">https://www.wallabag.org</a></dd>
<dt>{% trans %}Main developer{% endtrans %}</dt>
<dd><a href="mailto:nicolas@loeuillet.org">Nicolas Lœuillet</a> — <a href="http://cdetc.fr">{% trans %}website{% endtrans %}</a></dd>
<dt>{% trans %}Contributors ♥:{% endtrans %}</dt>
<dd><a href="https://github.com/wallabag/wallabag/graphs/contributors">{% trans %}on Github{% endtrans %}</a></dd>
<dt>{% trans %}Bug reports{% endtrans %}</dt>
<dd><a href="https://support.wallabag.org">{% trans %}On our support website{% endtrans %}</a> {% trans %}or{% endtrans %} <a href="https://github.com/wallabag/wallabag/issues">{% trans %}on Github{% endtrans %}</a></dd>
<dt>{% trans %}License{% endtrans %}</dt>
<dd><a href="http://en.wikipedia.org/wiki/MIT_License">MIT</a></dd>
<dt>{% trans %}Version{% endtrans %}</dt>
<dd>{{ version }}</dd>
</dl>
<p>{% trans %}wallabag is a read-it-later application: you can save a web page by keeping only content. Elements like ads or menus are deleted.{% endtrans %}</p>
<h2>{% trans %}Getting help{% endtrans %}</h2>
<dl>
<dt>{% trans %}Documentation{% endtrans %}</dt>
<dd><a href="https://doc.wallabag.org/">Online documentation</a></dd>
<dt>{% trans %}Support{% endtrans %}</dt>
<dd><a href="http://support.wallabag.org/">http://support.wallabag.org/</a></dd>
</dl>
<h2>{% trans %}Helping wallabag{% endtrans %}</h2>
<p>{% trans %}wallabag is free and opensource. You can help us:{% endtrans %}</p>
<dl>
<dt><a href="{{ paypal_url }}">{% trans %}via Paypal{% endtrans %}</a></dt>
<dt><a href="{{ flattr_url }}">{% trans %}via Flattr{% endtrans %}</a></dt>
</dl>
{% 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,15 @@
<button id="menu" class="icon icon-menu desktopHide"><span>Menu</span></button>
<ul id="links" class="links">
<li><a href="{{ path('unread') }}">{% trans %}unread{% endtrans %}</a></li>
<li><a href="{{ path('starred') }}">{% trans %}favorites{% endtrans %}</a></li>
<li><a href="{{ path('archive') }}"}>{% trans %}archive{% endtrans %}</a></li>
<li><a href="?view=tags">{% trans %}tags{% endtrans %}</a></li>
<li><a href="{{ path('new_entry') }}">{% trans %}save a link{% endtrans %}</a></li>
<li style="position: relative;"><a href="javascript: void(null);" id="search">{% trans %}search{% endtrans %}</a>
{% include "WallabagCoreBundle::_search_form.html.twig" %}
</li>
<li><a href="?view=config">{% trans %}config{% endtrans %}</a></li>
<li><a href={{ path('about') }}>{% trans %}about{% endtrans %}</a></li>
<li><a class="icon icon-power" href="?logout" title="{% trans %}logout{% endtrans %}">{% trans %}logout{% endtrans %}</a></li>
</ul>

View File

@ -0,0 +1,10 @@
<div id="bagit-form" class="messages info popup-form">
<form method="get" action="index.php" target="_blank" id="bagit-form-form">
<h2>{% trans %}Save a link{% endtrans %}</h2>
<a href="javascript: void(null);" id="bagit-form-close" class="close-button--popup close-button">&times;</a>
<input type="hidden" name="autoclose" value="1" />
<input required placeholder="example.com/article" class="addurl" id="plainurl" name="plainurl" type="url" />
<span id="add-link-result"></span>
<input type="submit" value="{% trans %}save link!"{% endtrans %} />
</form>
</div>

View File

@ -0,0 +1,9 @@
<div id="search-form" class="messages info popup-form">
<form method="get" action="index.php">
<h2>{% trans %}Search{% endtrans %}</h2>
<a href="javascript: void(null);" id="search-form-close" class="close-button--popup close-button">&times;</a>
<input type="hidden" name="view" value="search"></input>
<input required placeholder="{% trans %}Enter your search here{% endtrans %}" type="text" name="search" id="searchfield"><br>
<input id="submit-search" type="submit" value="{% trans %}Search{% endtrans %}"></input>
</form>
</div>

View File

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

View File

@ -0,0 +1,33 @@
<!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 "WallabagCoreBundle::_head.html.twig" %}
{% include "WallabagCoreBundle::_bookmarklet.html.twig" %}
</head>
<body>
{% include "WallabagCoreBundle::_top.html.twig" %}
<div id="main">
{% block menu %}{% endblock %}
{% block precontent %}{% endblock %}
{% for flashMessage in app.session.flashbag.get('notice') %}
<div class="flash-notice">
{{ flashMessage }}
</div>
{% endfor %}
<div id="content" class="w600p center">
{% block content %}{% endblock %}
</div>
</div>
{% include "WallabagCoreBundle::_footer.html.twig" %}
</body>
</html>

View File

@ -0,0 +1,18 @@
<?php
namespace Wallabag\CoreBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class EntryControllerTest extends WebTestCase
{
public function testIndex()
{
$client = static::createClient();
$crawler = $client->request('GET', '/app/index');
$this->assertEquals(200, $client->getResponse()->getStatusCode());
$this->assertTrue($crawler->filter('html:contains("Homepage")')->count() > 0);
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace Wallabag\CoreBundle\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';
}
}

View File

@ -0,0 +1,9 @@
<?php
namespace Wallabag\CoreBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class WallabagCoreBundle extends Bundle
{
}