aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2015-01-23 16:28:37 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2015-01-23 16:28:37 +0100
commitad4d1caa9e744af57ca58a4e57576533eb682d00 (patch)
tree37d6c284d2afc7fc62cdf80be419b536ab4ea603 /src/Wallabag/CoreBundle
parentb84a80559a1167b5500fbc5eb4965d3b08b371ef (diff)
downloadwallabag-ad4d1caa9e744af57ca58a4e57576533eb682d00.tar.gz
wallabag-ad4d1caa9e744af57ca58a4e57576533eb682d00.tar.zst
wallabag-ad4d1caa9e744af57ca58a4e57576533eb682d00.zip
move WallabagBundle into Wallabag:CoreBundle
Diffstat (limited to 'src/Wallabag/CoreBundle')
-rw-r--r--src/Wallabag/CoreBundle/Controller/EntryController.php184
-rw-r--r--src/Wallabag/CoreBundle/Controller/StaticController.php20
-rw-r--r--src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php22
-rw-r--r--src/Wallabag/CoreBundle/Entity/Config.php95
-rw-r--r--src/Wallabag/CoreBundle/Entity/Config.php~95
-rw-r--r--src/Wallabag/CoreBundle/Entity/Entries.php230
-rw-r--r--src/Wallabag/CoreBundle/Entity/Entries.php~215
-rw-r--r--src/Wallabag/CoreBundle/Entity/Entry.php~74
-rw-r--r--src/Wallabag/CoreBundle/Entity/Tags.php65
-rw-r--r--src/Wallabag/CoreBundle/Entity/Tags.php~65
-rw-r--r--src/Wallabag/CoreBundle/Entity/TagsEntries.php95
-rw-r--r--src/Wallabag/CoreBundle/Entity/TagsEntries.php~95
-rw-r--r--src/Wallabag/CoreBundle/Entity/Users.php155
-rw-r--r--src/Wallabag/CoreBundle/Entity/Users.php~155
-rw-r--r--src/Wallabag/CoreBundle/Entity/UsersConfig.php125
-rw-r--r--src/Wallabag/CoreBundle/Entity/UsersConfig.php~125
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntriesRepository.php79
-rw-r--r--src/Wallabag/CoreBundle/Resources/config/routing.yml3
-rw-r--r--src/Wallabag/CoreBundle/Resources/config/services.xml17
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig47
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/Entry/entry.html.twig104
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/Entry/new.html.twig11
-rwxr-xr-xsrc/Wallabag/CoreBundle/Resources/views/Static/about.html.twig51
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/_bookmarklet.html.twig3
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/_footer.html.twig3
-rwxr-xr-xsrc/Wallabag/CoreBundle/Resources/views/_head.html.twig40
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/_menu.html.twig15
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/_messages.html.twig0
-rwxr-xr-xsrc/Wallabag/CoreBundle/Resources/views/_save_form.html.twig10
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/_search_form.html.twig9
-rwxr-xr-xsrc/Wallabag/CoreBundle/Resources/views/_top.html.twig5
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/layout.html.twig33
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/DefaultControllerTest.php18
-rw-r--r--src/Wallabag/CoreBundle/Twig/Extension/WallabagExtension.php41
-rw-r--r--src/Wallabag/CoreBundle/WallabagCoreBundle.php9
35 files changed, 2313 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php
new file mode 100644
index 00000000..2ebb416c
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Controller/EntryController.php
@@ -0,0 +1,184 @@
1<?php
2
3namespace Wallabag\CoreBundle\Controller;
4
5use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7use Symfony\Component\HttpFoundation\Request;
8use Wallabag\CoreBundle\Repository;
9use Wallabag\CoreBundle\Entity\Entries;
10use Wallabag\Wallabag\Tools;
11use Wallabag\Wallabag\Url;
12
13class EntryController extends Controller
14{
15
16 /**
17 * @param Request $request
18 * @Route("/new", name="new_entry")
19 * @return \Symfony\Component\HttpFoundation\Response
20 */
21 public function addEntryAction(Request $request)
22 {
23 $entry = new Entries();
24 $entry->setUserId(1);
25
26 $form = $this->createFormBuilder($entry)
27 ->add('url', 'url')
28 ->add('save', 'submit')
29 ->getForm();
30
31 $form->handleRequest($request);
32
33 if ($form->isValid()) {
34
35 $content = Tools::getPageContent(new Url($entry->getUrl()));
36 var_dump($content);die;
37
38 $em = $this->getDoctrine()->getEntityManager();
39 $em->persist($entry);
40 $em->flush();
41
42 $this->get('session')->getFlashBag()->add(
43 'notice',
44 'Entry saved'
45 );
46
47 return $this->redirect($this->generateUrl('homepage'));
48 }
49
50 return $this->render('WallabagCoreBundle:Entry:new.html.twig', array(
51 'form' => $form->createView(),
52 ));
53 }
54
55 /**
56 * Shows unread entries for current user
57 *
58 * @Route("/unread", name="unread")
59 * @return \Symfony\Component\HttpFoundation\Response
60 */
61 public function showUnreadAction()
62 {
63 $repository = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entries');
64 $entries = $repository->findUnreadByUser(1, 0);
65
66 return $this->render(
67 'WallabagCoreBundle:Entry:entries.html.twig',
68 array('entries' => $entries)
69 );
70 }
71
72 /**
73 * Shows read entries for current user
74 *
75 * @Route("/archive", name="archive")
76 * @return \Symfony\Component\HttpFoundation\Response
77 */
78 public function showArchiveAction()
79 {
80 $repository = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entries');
81 $entries = $repository->findArchiveByUser(1, 0);
82
83 return $this->render(
84 'WallabagCoreBundle:Entry:entries.html.twig',
85 array('entries' => $entries)
86 );
87 }
88
89 /**
90 * Shows starred entries for current user
91 *
92 * @Route("/starred", name="starred")
93 * @return \Symfony\Component\HttpFoundation\Response
94 */
95 public function showStarredAction()
96 {
97 $repository = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entries');
98 $entries = $repository->findStarredByUser(1, 0);
99
100 return $this->render(
101 'WallabagCoreBundle:Entry:entries.html.twig',
102 array('entries' => $entries)
103 );
104 }
105
106 /**
107 * Shows entry content
108 *
109 * @param Entries $entry
110 * @Route("/view/{id}", requirements={"id" = "\d+"}, name="view")
111 * @return \Symfony\Component\HttpFoundation\Response
112 */
113 public function viewAction(Entries $entry)
114 {
115 return $this->render(
116 'WallabagCoreBundle:Entry:entry.html.twig',
117 array('entry' => $entry)
118 );
119 }
120
121 /**
122 * Changes read status for an entry
123 *
124 * @param Request $request
125 * @param Entries $entry
126 * @Route("/archive/{id}", requirements={"id" = "\d+"}, name="archive_entry")
127 * @return \Symfony\Component\HttpFoundation\RedirectResponse
128 */
129 public function toggleArchiveAction(Request $request, Entries $entry)
130 {
131 $entry->toggleArchive();
132 $this->getDoctrine()->getManager()->flush();
133
134 $this->get('session')->getFlashBag()->add(
135 'notice',
136 'Entry archived'
137 );
138
139 return $this->redirect($request->headers->get('referer'));
140 }
141
142 /**
143 * Changes favorite status for an entry
144 *
145 * @param Request $request
146 * @param Entries $entry
147 * @Route("/star/{id}", requirements={"id" = "\d+"}, name="star_entry")
148 * @return \Symfony\Component\HttpFoundation\RedirectResponse
149 */
150 public function toggleStarAction(Request $request, Entries $entry)
151 {
152 $entry->toggleStar();
153 $this->getDoctrine()->getManager()->flush();
154
155 $this->get('session')->getFlashBag()->add(
156 'notice',
157 'Entry starred'
158 );
159
160 return $this->redirect($request->headers->get('referer'));
161 }
162
163 /**
164 * Deletes entry
165 *
166 * @param Request $request
167 * @param Entries $entry
168 * @Route("/delete/{id}", requirements={"id" = "\d+"}, name="delete_entry")
169 * @return \Symfony\Component\HttpFoundation\RedirectResponse
170 */
171 public function deleteEntryAction(Request $request, Entries $entry)
172 {
173 $em = $this->getDoctrine()->getEntityManager();
174 $em->remove($entry);
175 $em->flush();
176
177 $this->get('session')->getFlashBag()->add(
178 'notice',
179 'Entry deleted'
180 );
181
182 return $this->redirect($request->headers->get('referer'));
183 }
184}
diff --git a/src/Wallabag/CoreBundle/Controller/StaticController.php b/src/Wallabag/CoreBundle/Controller/StaticController.php
new file mode 100644
index 00000000..0fd19d65
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Controller/StaticController.php
@@ -0,0 +1,20 @@
1<?php
2
3namespace Wallabag\CoreBundle\Controller;
4
5use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7
8class StaticController extends Controller
9{
10 /**
11 * @Route("/about", name="about")
12 */
13 public function aboutAction()
14 {
15 return $this->render(
16 'WallabagCoreBundle:Static:about.html.twig',
17 array()
18 );
19 }
20}
diff --git a/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php b/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php
new file mode 100644
index 00000000..7cc4165e
--- /dev/null
+++ b/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php
@@ -0,0 +1,22 @@
1<?php
2
3namespace Wallabag\CoreBundle\DependencyInjection;
4
5use Symfony\Component\DependencyInjection\ContainerBuilder;
6use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
7use Symfony\Component\HttpKernel\DependencyInjection\Extension;
8use Symfony\Component\Config\FileLocator;
9
10class WallabagCoreExtension extends Extension
11{
12 public function load(array $configs, ContainerBuilder $container)
13 {
14 $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
15 $loader->load('services.xml');
16 }
17
18 public function getAlias()
19 {
20 return 'wallabag_core';
21 }
22}
diff --git a/src/Wallabag/CoreBundle/Entity/Config.php b/src/Wallabag/CoreBundle/Entity/Config.php
new file mode 100644
index 00000000..d60b2df0
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Entity/Config.php
@@ -0,0 +1,95 @@
1<?php
2
3namespace Wallabag\CoreBundle\Entity;
4
5use Doctrine\ORM\Mapping as ORM;
6
7/**
8 * Config
9 *
10 * @ORM\Table(name="config")
11 * @ORM\Entity
12 */
13class Config
14{
15 /**
16 * @var integer
17 *
18 * @ORM\Column(name="id", type="integer", nullable=false)
19 * @ORM\Id
20 * @ORM\GeneratedValue(strategy="IDENTITY")
21 */
22 private $id;
23
24 /**
25 * @var string
26 *
27 * @ORM\Column(name="name", type="string", nullable=true)
28 */
29 private $name;
30
31 /**
32 * @var string
33 *
34 * @ORM\Column(name="value", type="blob", nullable=true)
35 */
36 private $value;
37
38
39
40 /**
41 * Get id
42 *
43 * @return integer
44 */
45 public function getId()
46 {
47 return $this->id;
48 }
49
50 /**
51 * Set name
52 *
53 * @param string $name
54 * @return Config
55 */
56 public function setName($name)
57 {
58 $this->name = $name;
59
60 return $this;
61 }
62
63 /**
64 * Get name
65 *
66 * @return string
67 */
68 public function getName()
69 {
70 return $this->name;
71 }
72
73 /**
74 * Set value
75 *
76 * @param string $value
77 * @return Config
78 */
79 public function setValue($value)
80 {
81 $this->value = $value;
82
83 return $this;
84 }
85
86 /**
87 * Get value
88 *
89 * @return string
90 */
91 public function getValue()
92 {
93 return $this->value;
94 }
95}
diff --git a/src/Wallabag/CoreBundle/Entity/Config.php~ b/src/Wallabag/CoreBundle/Entity/Config.php~
new file mode 100644
index 00000000..8b692cef
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Entity/Config.php~
@@ -0,0 +1,95 @@
1<?php
2
3namespace WallabagBundle\Entity;
4
5use Doctrine\ORM\Mapping as ORM;
6
7/**
8 * Config
9 *
10 * @ORM\Table(name="config")
11 * @ORM\Entity
12 */
13class Config
14{
15 /**
16 * @var integer
17 *
18 * @ORM\Column(name="id", type="integer", nullable=false)
19 * @ORM\Id
20 * @ORM\GeneratedValue(strategy="IDENTITY")
21 */
22 private $id;
23
24 /**
25 * @var string
26 *
27 * @ORM\Column(name="name", type="string", nullable=true)
28 */
29 private $name;
30
31 /**
32 * @var string
33 *
34 * @ORM\Column(name="value", type="blob", nullable=true)
35 */
36 private $value;
37
38
39
40 /**
41 * Get id
42 *
43 * @return integer
44 */
45 public function getId()
46 {
47 return $this->id;
48 }
49
50 /**
51 * Set name
52 *
53 * @param string $name
54 * @return Config
55 */
56 public function setName($name)
57 {
58 $this->name = $name;
59
60 return $this;
61 }
62
63 /**
64 * Get name
65 *
66 * @return string
67 */
68 public function getName()
69 {
70 return $this->name;
71 }
72
73 /**
74 * Set value
75 *
76 * @param string $value
77 * @return Config
78 */
79 public function setValue($value)
80 {
81 $this->value = $value;
82
83 return $this;
84 }
85
86 /**
87 * Get value
88 *
89 * @return string
90 */
91 public function getValue()
92 {
93 return $this->value;
94 }
95}
diff --git a/src/Wallabag/CoreBundle/Entity/Entries.php b/src/Wallabag/CoreBundle/Entity/Entries.php
new file mode 100644
index 00000000..712ff126
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Entity/Entries.php
@@ -0,0 +1,230 @@
1<?php
2
3namespace Wallabag\CoreBundle\Entity;
4
5use Doctrine\ORM\Mapping as ORM;
6use Symfony\Component\Validator\Constraints as Assert;
7
8/**
9 * Entries
10 *
11 * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\EntriesRepository")
12 * @ORM\Table(name="entries")
13 */
14class Entries
15{
16 /**
17 * @var integer
18 *
19 * @ORM\Column(name="id", type="integer", nullable=true)
20 * @ORM\Id
21 * @ORM\GeneratedValue(strategy="IDENTITY")
22 */
23 private $id;
24
25 /**
26 * @var string
27 *
28 * @ORM\Column(name="title", type="text", nullable=true)
29 */
30 private $title;
31
32 /**
33 * @var string
34 *
35 * @Assert\NotBlank()
36 * @ORM\Column(name="url", type="text", nullable=true)
37 */
38 private $url;
39
40 /**
41 * @var string
42 *
43 * @ORM\Column(name="is_read", type="decimal", precision=10, scale=0, nullable=true)
44 */
45 private $isRead = '0';
46
47 /**
48 * @var string
49 *
50 * @ORM\Column(name="is_fav", type="decimal", precision=10, scale=0, nullable=true)
51 */
52 private $isFav = '0';
53
54 /**
55 * @var string
56 *
57 * @ORM\Column(name="content", type="text", nullable=true)
58 */
59 private $content;
60
61 /**
62 * @var string
63 *
64 * @ORM\Column(name="user_id", type="decimal", precision=10, scale=0, nullable=true)
65 */
66 private $userId;
67
68
69
70 /**
71 * Get id
72 *
73 * @return integer
74 */
75 public function getId()
76 {
77 return $this->id;
78 }
79
80 /**
81 * Set title
82 *
83 * @param string $title
84 * @return Entries
85 */
86 public function setTitle($title)
87 {
88 $this->title = $title;
89
90 return $this;
91 }
92
93 /**
94 * Get title
95 *
96 * @return string
97 */
98 public function getTitle()
99 {
100 return $this->title;
101 }
102
103 /**
104 * Set url
105 *
106 * @param string $url
107 * @return Entries
108 */
109 public function setUrl($url)
110 {
111 $this->url = $url;
112
113 return $this;
114 }
115
116 /**
117 * Get url
118 *
119 * @return string
120 */
121 public function getUrl()
122 {
123 return $this->url;
124 }
125
126 /**
127 * Set isRead
128 *
129 * @param string $isRead
130 * @return Entries
131 */
132 public function setIsRead($isRead)
133 {
134 $this->isRead = $isRead;
135
136 return $this;
137 }
138
139 /**
140 * Get isRead
141 *
142 * @return string
143 */
144 public function getIsRead()
145 {
146 return $this->isRead;
147 }
148
149 public function toggleArchive()
150 {
151 $this->isRead = $this->getIsRead() ^ 1;
152 return $this;
153 }
154
155 /**
156 * Set isFav
157 *
158 * @param string $isFav
159 * @return Entries
160 */
161 public function setIsFav($isFav)
162 {
163 $this->isFav = $isFav;
164
165 return $this;
166 }
167
168 /**
169 * Get isFav
170 *
171 * @return string
172 */
173 public function getIsFav()
174 {
175 return $this->isFav;
176 }
177
178 public function toggleStar()
179 {
180 $this->isFav = $this->getIsFav() ^ 1;
181
182 return $this;
183 }
184
185 /**
186 * Set content
187 *
188 * @param string $content
189 * @return Entries
190 */
191 public function setContent($content)
192 {
193 $this->content = $content;
194
195 return $this;
196 }
197
198 /**
199 * Get content
200 *
201 * @return string
202 */
203 public function getContent()
204 {
205 return $this->content;
206 }
207
208 /**
209 * Set userId
210 *
211 * @param string $userId
212 * @return Entries
213 */
214 public function setUserId($userId)
215 {
216 $this->userId = $userId;
217
218 return $this;
219 }
220
221 /**
222 * Get userId
223 *
224 * @return string
225 */
226 public function getUserId()
227 {
228 return $this->userId;
229 }
230}
diff --git a/src/Wallabag/CoreBundle/Entity/Entries.php~ b/src/Wallabag/CoreBundle/Entity/Entries.php~
new file mode 100644
index 00000000..69c6be0d
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Entity/Entries.php~
@@ -0,0 +1,215 @@
1<?php
2
3namespace WallabagBundle\Entity;
4
5use Doctrine\ORM\Mapping as ORM;
6
7/**
8 * Entries
9 *
10 * @ORM\Entity(repositoryClass="WallabagBundle\Repository\EntriesRepository")
11 * @ORM\Table(name="entries")
12 */
13class Entries
14{
15 /**
16 * @var integer
17 *
18 * @ORM\Column(name="id", type="integer", nullable=true)
19 * @ORM\Id
20 * @ORM\GeneratedValue(strategy="IDENTITY")
21 */
22 private $id;
23
24 /**
25 * @var string
26 *
27 * @ORM\Column(name="title", type="text", nullable=true)
28 */
29 private $title;
30
31 /**
32 * @var string
33 *
34 * @ORM\Column(name="url", type="text", nullable=true)
35 */
36 private $url;
37
38 /**
39 * @var string
40 *
41 * @ORM\Column(name="is_read", type="decimal", precision=10, scale=0, nullable=true)
42 */
43 private $isRead = '0';
44
45 /**
46 * @var string
47 *
48 * @ORM\Column(name="is_fav", type="decimal", precision=10, scale=0, nullable=true)
49 */
50 private $isFav = '0';
51
52 /**
53 * @var string
54 *
55 * @ORM\Column(name="content", type="text", nullable=true)
56 */
57 private $content;
58
59 /**
60 * @var string
61 *
62 * @ORM\Column(name="user_id", type="decimal", precision=10, scale=0, nullable=true)
63 */
64 private $userId;
65
66
67
68 /**
69 * Get id
70 *
71 * @return integer
72 */
73 public function getId()
74 {
75 return $this->id;
76 }
77
78 /**
79 * Set title
80 *
81 * @param string $title
82 * @return Entries
83 */
84 public function setTitle($title)
85 {
86 $this->title = $title;
87
88 return $this;
89 }
90
91 /**
92 * Get title
93 *
94 * @return string
95 */
96 public function getTitle()
97 {
98 return $this->title;
99 }
100
101 /**
102 * Set url
103 *
104 * @param string $url
105 * @return Entries
106 */
107 public function setUrl($url)
108 {
109 $this->url = $url;
110
111 return $this;
112 }
113
114 /**
115 * Get url
116 *
117 * @return string
118 */
119 public function getUrl()
120 {
121 return $this->url;
122 }
123
124 /**
125 * Set isRead
126 *
127 * @param string $isRead
128 * @return Entries
129 */
130 public function setIsRead($isRead)
131 {
132 $this->isRead = $isRead;
133
134 return $this;
135 }
136
137 /**
138 * Get isRead
139 *
140 * @return string
141 */
142 public function getIsRead()
143 {
144 return $this->isRead;
145 }
146
147 /**
148 * Set isFav
149 *
150 * @param string $isFav
151 * @return Entries
152 */
153 public function setIsFav($isFav)
154 {
155 $this->isFav = $isFav;
156
157 return $this;
158 }
159
160 /**
161 * Get isFav
162 *
163 * @return string
164 */
165 public function getIsFav()
166 {
167 return $this->isFav;
168 }
169
170 /**
171 * Set content
172 *
173 * @param string $content
174 * @return Entries
175 */
176 public function setContent($content)
177 {
178 $this->content = $content;
179
180 return $this;
181 }
182
183 /**
184 * Get content
185 *
186 * @return string
187 */
188 public function getContent()
189 {
190 return $this->content;
191 }
192
193 /**
194 * Set userId
195 *
196 * @param string $userId
197 * @return Entries
198 */
199 public function setUserId($userId)
200 {
201 $this->userId = $userId;
202
203 return $this;
204 }
205
206 /**
207 * Get userId
208 *
209 * @return string
210 */
211 public function getUserId()
212 {
213 return $this->userId;
214 }
215}
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php~ b/src/Wallabag/CoreBundle/Entity/Entry.php~
new file mode 100644
index 00000000..ebcdf53a
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Entity/Entry.php~
@@ -0,0 +1,74 @@
1<?php
2
3namespace WallabagBundle\Entity;
4
5use Doctrine\ORM\Mapping as ORM;
6
7/**
8 * Entry
9 *
10 * @ORM\Table(name="Entry")
11 * @ORM\Entity
12 */
13class Entry
14{
15 /**
16 * @var integer
17 *
18 * @ORM\Column(name="id", type="integer", nullable=false)
19 * @ORM\Id
20 * @ORM\GeneratedValue(strategy="IDENTITY")
21 */
22 private $id;
23
24 /**
25 * @var string
26 *
27 * @ORM\Column(name="title", type="string", length=255, nullable=false)
28 */
29 private $title;
30
31 /**
32 * @var string
33 *
34 * @ORM\Column(name="url", type="text", nullable=false)
35 */
36 private $url;
37
38 /**
39 * @var string
40 *
41 * @ORM\Column(name="content", type="text", nullable=false)
42 */
43 private $content;
44
45 /**
46 * @var boolean
47 *
48 * @ORM\Column(name="is_read", type="boolean", nullable=false)
49 */
50 private $isRead;
51
52 /**
53 * @var boolean
54 *
55 * @ORM\Column(name="is_fav", type="boolean", nullable=false)
56 */
57 private $isFav;
58
59 /**
60 * @var \DateTime
61 *
62 * @ORM\Column(name="created_at", type="datetime", nullable=false)
63 */
64 private $createdAt;
65
66 /**
67 * @var \DateTime
68 *
69 * @ORM\Column(name="edited_at", type="datetime", nullable=false)
70 */
71 private $editedAt;
72
73
74}
diff --git a/src/Wallabag/CoreBundle/Entity/Tags.php b/src/Wallabag/CoreBundle/Entity/Tags.php
new file mode 100644
index 00000000..6fe16a53
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Entity/Tags.php
@@ -0,0 +1,65 @@
1<?php
2
3namespace Wallabag\CoreBundle\Entity;
4
5use Doctrine\ORM\Mapping as ORM;
6
7/**
8 * Tags
9 *
10 * @ORM\Table(name="tags")
11 * @ORM\Entity
12 */
13class Tags
14{
15 /**
16 * @var integer
17 *
18 * @ORM\Column(name="id", type="integer", nullable=false)
19 * @ORM\Id
20 * @ORM\GeneratedValue(strategy="IDENTITY")
21 */
22 private $id;
23
24 /**
25 * @var string
26 *
27 * @ORM\Column(name="value", type="text", nullable=true)
28 */
29 private $value;
30
31
32
33 /**
34 * Get id
35 *
36 * @return integer
37 */
38 public function getId()
39 {
40 return $this->id;
41 }
42
43 /**
44 * Set value
45 *
46 * @param string $value
47 * @return Tags
48 */
49 public function setValue($value)
50 {
51 $this->value = $value;
52
53 return $this;
54 }
55
56 /**
57 * Get value
58 *
59 * @return string
60 */
61 public function getValue()
62 {
63 return $this->value;
64 }
65}
diff --git a/src/Wallabag/CoreBundle/Entity/Tags.php~ b/src/Wallabag/CoreBundle/Entity/Tags.php~
new file mode 100644
index 00000000..c0c78ee5
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Entity/Tags.php~
@@ -0,0 +1,65 @@
1<?php
2
3namespace WallabagBundle\Entity;
4
5use Doctrine\ORM\Mapping as ORM;
6
7/**
8 * Tags
9 *
10 * @ORM\Table(name="tags")
11 * @ORM\Entity
12 */
13class Tags
14{
15 /**
16 * @var integer
17 *
18 * @ORM\Column(name="id", type="integer", nullable=false)
19 * @ORM\Id
20 * @ORM\GeneratedValue(strategy="IDENTITY")
21 */
22 private $id;
23
24 /**
25 * @var string
26 *
27 * @ORM\Column(name="value", type="text", nullable=true)
28 */
29 private $value;
30
31
32
33 /**
34 * Get id
35 *
36 * @return integer
37 */
38 public function getId()
39 {
40 return $this->id;
41 }
42
43 /**
44 * Set value
45 *
46 * @param string $value
47 * @return Tags
48 */
49 public function setValue($value)
50 {
51 $this->value = $value;
52
53 return $this;
54 }
55
56 /**
57 * Get value
58 *
59 * @return string
60 */
61 public function getValue()
62 {
63 return $this->value;
64 }
65}
diff --git a/src/Wallabag/CoreBundle/Entity/TagsEntries.php b/src/Wallabag/CoreBundle/Entity/TagsEntries.php
new file mode 100644
index 00000000..ad01cf57
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Entity/TagsEntries.php
@@ -0,0 +1,95 @@
1<?php
2
3namespace Wallabag\CoreBundle\Entity;
4
5use Doctrine\ORM\Mapping as ORM;
6
7/**
8 * TagsEntries
9 *
10 * @ORM\Table(name="tags_entries")
11 * @ORM\Entity
12 */
13class TagsEntries
14{
15 /**
16 * @var integer
17 *
18 * @ORM\Column(name="id", type="integer", nullable=false)
19 * @ORM\Id
20 * @ORM\GeneratedValue(strategy="IDENTITY")
21 */
22 private $id;
23
24 /**
25 * @var integer
26 *
27 * @ORM\Column(name="entry_id", type="integer", nullable=true)
28 */
29 private $entryId;
30
31 /**
32 * @var integer
33 *
34 * @ORM\Column(name="tag_id", type="integer", nullable=true)
35 */
36 private $tagId;
37
38
39
40 /**
41 * Get id
42 *
43 * @return integer
44 */
45 public function getId()
46 {
47 return $this->id;
48 }
49
50 /**
51 * Set entryId
52 *
53 * @param integer $entryId
54 * @return TagsEntries
55 */
56 public function setEntryId($entryId)
57 {
58 $this->entryId = $entryId;
59
60 return $this;
61 }
62
63 /**
64 * Get entryId
65 *
66 * @return integer
67 */
68 public function getEntryId()
69 {
70 return $this->entryId;
71 }
72
73 /**
74 * Set tagId
75 *
76 * @param integer $tagId
77 * @return TagsEntries
78 */
79 public function setTagId($tagId)
80 {
81 $this->tagId = $tagId;
82
83 return $this;
84 }
85
86 /**
87 * Get tagId
88 *
89 * @return integer
90 */
91 public function getTagId()
92 {
93 return $this->tagId;
94 }
95}
diff --git a/src/Wallabag/CoreBundle/Entity/TagsEntries.php~ b/src/Wallabag/CoreBundle/Entity/TagsEntries.php~
new file mode 100644
index 00000000..448c54fa
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Entity/TagsEntries.php~
@@ -0,0 +1,95 @@
1<?php
2
3namespace WallabagBundle\Entity;
4
5use Doctrine\ORM\Mapping as ORM;
6
7/**
8 * TagsEntries
9 *
10 * @ORM\Table(name="tags_entries")
11 * @ORM\Entity
12 */
13class TagsEntries
14{
15 /**
16 * @var integer
17 *
18 * @ORM\Column(name="id", type="integer", nullable=false)
19 * @ORM\Id
20 * @ORM\GeneratedValue(strategy="IDENTITY")
21 */
22 private $id;
23
24 /**
25 * @var integer
26 *
27 * @ORM\Column(name="entry_id", type="integer", nullable=true)
28 */
29 private $entryId;
30
31 /**
32 * @var integer
33 *
34 * @ORM\Column(name="tag_id", type="integer", nullable=true)
35 */
36 private $tagId;
37
38
39
40 /**
41 * Get id
42 *
43 * @return integer
44 */
45 public function getId()
46 {
47 return $this->id;
48 }
49
50 /**
51 * Set entryId
52 *
53 * @param integer $entryId
54 * @return TagsEntries
55 */
56 public function setEntryId($entryId)
57 {
58 $this->entryId = $entryId;
59
60 return $this;
61 }
62
63 /**
64 * Get entryId
65 *
66 * @return integer
67 */
68 public function getEntryId()
69 {
70 return $this->entryId;
71 }
72
73 /**
74 * Set tagId
75 *
76 * @param integer $tagId
77 * @return TagsEntries
78 */
79 public function setTagId($tagId)
80 {
81 $this->tagId = $tagId;
82
83 return $this;
84 }
85
86 /**
87 * Get tagId
88 *
89 * @return integer
90 */
91 public function getTagId()
92 {
93 return $this->tagId;
94 }
95}
diff --git a/src/Wallabag/CoreBundle/Entity/Users.php b/src/Wallabag/CoreBundle/Entity/Users.php
new file mode 100644
index 00000000..3db4a3fd
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Entity/Users.php
@@ -0,0 +1,155 @@
1<?php
2
3namespace Wallabag\CoreBundle\Entity;
4
5use Doctrine\ORM\Mapping as ORM;
6
7/**
8 * Users
9 *
10 * @ORM\Table(name="users")
11 * @ORM\Entity
12 */
13class Users
14{
15 /**
16 * @var integer
17 *
18 * @ORM\Column(name="id", type="integer", nullable=true)
19 * @ORM\Id
20 * @ORM\GeneratedValue(strategy="IDENTITY")
21 */
22 private $id;
23
24 /**
25 * @var string
26 *
27 * @ORM\Column(name="username", type="text", nullable=true)
28 */
29 private $username;
30
31 /**
32 * @var string
33 *
34 * @ORM\Column(name="password", type="text", nullable=true)
35 */
36 private $password;
37
38 /**
39 * @var string
40 *
41 * @ORM\Column(name="name", type="text", nullable=true)
42 */
43 private $name;
44
45 /**
46 * @var string
47 *
48 * @ORM\Column(name="email", type="text", nullable=true)
49 */
50 private $email;
51
52
53
54 /**
55 * Get id
56 *
57 * @return integer
58 */
59 public function getId()
60 {
61 return $this->id;
62 }
63
64 /**
65 * Set username
66 *
67 * @param string $username
68 * @return Users
69 */
70 public function setUsername($username)
71 {
72 $this->username = $username;
73
74 return $this;
75 }
76
77 /**
78 * Get username
79 *
80 * @return string
81 */
82 public function getUsername()
83 {
84 return $this->username;
85 }
86
87 /**
88 * Set password
89 *
90 * @param string $password
91 * @return Users
92 */
93 public function setPassword($password)
94 {
95 $this->password = $password;
96
97 return $this;
98 }
99
100 /**
101 * Get password
102 *
103 * @return string
104 */
105 public function getPassword()
106 {
107 return $this->password;
108 }
109
110 /**
111 * Set name
112 *
113 * @param string $name
114 * @return Users
115 */
116 public function setName($name)
117 {
118 $this->name = $name;
119
120 return $this;
121 }
122
123 /**
124 * Get name
125 *
126 * @return string
127 */
128 public function getName()
129 {
130 return $this->name;
131 }
132
133 /**
134 * Set email
135 *
136 * @param string $email
137 * @return Users
138 */
139 public function setEmail($email)
140 {
141 $this->email = $email;
142
143 return $this;
144 }
145
146 /**
147 * Get email
148 *
149 * @return string
150 */
151 public function getEmail()
152 {
153 return $this->email;
154 }
155}
diff --git a/src/Wallabag/CoreBundle/Entity/Users.php~ b/src/Wallabag/CoreBundle/Entity/Users.php~
new file mode 100644
index 00000000..a48f2240
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Entity/Users.php~
@@ -0,0 +1,155 @@
1<?php
2
3namespace WallabagBundle\Entity;
4
5use Doctrine\ORM\Mapping as ORM;
6
7/**
8 * Users
9 *
10 * @ORM\Table(name="users")
11 * @ORM\Entity
12 */
13class Users
14{
15 /**
16 * @var integer
17 *
18 * @ORM\Column(name="id", type="integer", nullable=true)
19 * @ORM\Id
20 * @ORM\GeneratedValue(strategy="IDENTITY")
21 */
22 private $id;
23
24 /**
25 * @var string
26 *
27 * @ORM\Column(name="username", type="text", nullable=true)
28 */
29 private $username;
30
31 /**
32 * @var string
33 *
34 * @ORM\Column(name="password", type="text", nullable=true)
35 */
36 private $password;
37
38 /**
39 * @var string
40 *
41 * @ORM\Column(name="name", type="text", nullable=true)
42 */
43 private $name;
44
45 /**
46 * @var string
47 *
48 * @ORM\Column(name="email", type="text", nullable=true)
49 */
50 private $email;
51
52
53
54 /**
55 * Get id
56 *
57 * @return integer
58 */
59 public function getId()
60 {
61 return $this->id;
62 }
63
64 /**
65 * Set username
66 *
67 * @param string $username
68 * @return Users
69 */
70 public function setUsername($username)
71 {
72 $this->username = $username;
73
74 return $this;
75 }
76
77 /**
78 * Get username
79 *
80 * @return string
81 */
82 public function getUsername()
83 {
84 return $this->username;
85 }
86
87 /**
88 * Set password
89 *
90 * @param string $password
91 * @return Users
92 */
93 public function setPassword($password)
94 {
95 $this->password = $password;
96
97 return $this;
98 }
99
100 /**
101 * Get password
102 *
103 * @return string
104 */
105 public function getPassword()
106 {
107 return $this->password;
108 }
109
110 /**
111 * Set name
112 *
113 * @param string $name
114 * @return Users
115 */
116 public function setName($name)
117 {
118 $this->name = $name;
119
120 return $this;
121 }
122
123 /**
124 * Get name
125 *
126 * @return string
127 */
128 public function getName()
129 {
130 return $this->name;
131 }
132
133 /**
134 * Set email
135 *
136 * @param string $email
137 * @return Users
138 */
139 public function setEmail($email)
140 {
141 $this->email = $email;
142
143 return $this;
144 }
145
146 /**
147 * Get email
148 *
149 * @return string
150 */
151 public function getEmail()
152 {
153 return $this->email;
154 }
155}
diff --git a/src/Wallabag/CoreBundle/Entity/UsersConfig.php b/src/Wallabag/CoreBundle/Entity/UsersConfig.php
new file mode 100644
index 00000000..26fb44ee
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Entity/UsersConfig.php
@@ -0,0 +1,125 @@
1<?php
2
3namespace Wallabag\CoreBundle\Entity;
4
5use Doctrine\ORM\Mapping as ORM;
6
7/**
8 * UsersConfig
9 *
10 * @ORM\Table(name="users_config")
11 * @ORM\Entity
12 */
13class UsersConfig
14{
15 /**
16 * @var integer
17 *
18 * @ORM\Column(name="id", type="integer", nullable=true)
19 * @ORM\Id
20 * @ORM\GeneratedValue(strategy="IDENTITY")
21 */
22 private $id;
23
24 /**
25 * @var string
26 *
27 * @ORM\Column(name="user_id", type="decimal", precision=10, scale=0, nullable=true)
28 */
29 private $userId;
30
31 /**
32 * @var string
33 *
34 * @ORM\Column(name="name", type="text", nullable=true)
35 */
36 private $name;
37
38 /**
39 * @var string
40 *
41 * @ORM\Column(name="value", type="text", nullable=true)
42 */
43 private $value;
44
45
46
47 /**
48 * Get id
49 *
50 * @return integer
51 */
52 public function getId()
53 {
54 return $this->id;
55 }
56
57 /**
58 * Set userId
59 *
60 * @param string $userId
61 * @return UsersConfig
62 */
63 public function setUserId($userId)
64 {
65 $this->userId = $userId;
66
67 return $this;
68 }
69
70 /**
71 * Get userId
72 *
73 * @return string
74 */
75 public function getUserId()
76 {
77 return $this->userId;
78 }
79
80 /**
81 * Set name
82 *
83 * @param string $name
84 * @return UsersConfig
85 */
86 public function setName($name)
87 {
88 $this->name = $name;
89
90 return $this;
91 }
92
93 /**
94 * Get name
95 *
96 * @return string
97 */
98 public function getName()
99 {
100 return $this->name;
101 }
102
103 /**
104 * Set value
105 *
106 * @param string $value
107 * @return UsersConfig
108 */
109 public function setValue($value)
110 {
111 $this->value = $value;
112
113 return $this;
114 }
115
116 /**
117 * Get value
118 *
119 * @return string
120 */
121 public function getValue()
122 {
123 return $this->value;
124 }
125}
diff --git a/src/Wallabag/CoreBundle/Entity/UsersConfig.php~ b/src/Wallabag/CoreBundle/Entity/UsersConfig.php~
new file mode 100644
index 00000000..8af283cc
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Entity/UsersConfig.php~
@@ -0,0 +1,125 @@
1<?php
2
3namespace WallabagBundle\Entity;
4
5use Doctrine\ORM\Mapping as ORM;
6
7/**
8 * UsersConfig
9 *
10 * @ORM\Table(name="users_config")
11 * @ORM\Entity
12 */
13class UsersConfig
14{
15 /**
16 * @var integer
17 *
18 * @ORM\Column(name="id", type="integer", nullable=true)
19 * @ORM\Id
20 * @ORM\GeneratedValue(strategy="IDENTITY")
21 */
22 private $id;
23
24 /**
25 * @var string
26 *
27 * @ORM\Column(name="user_id", type="decimal", precision=10, scale=0, nullable=true)
28 */
29 private $userId;
30
31 /**
32 * @var string
33 *
34 * @ORM\Column(name="name", type="text", nullable=true)
35 */
36 private $name;
37
38 /**
39 * @var string
40 *
41 * @ORM\Column(name="value", type="text", nullable=true)
42 */
43 private $value;
44
45
46
47 /**
48 * Get id
49 *
50 * @return integer
51 */
52 public function getId()
53 {
54 return $this->id;
55 }
56
57 /**
58 * Set userId
59 *
60 * @param string $userId
61 * @return UsersConfig
62 */
63 public function setUserId($userId)
64 {
65 $this->userId = $userId;
66
67 return $this;
68 }
69
70 /**
71 * Get userId
72 *
73 * @return string
74 */
75 public function getUserId()
76 {
77 return $this->userId;
78 }
79
80 /**
81 * Set name
82 *
83 * @param string $name
84 * @return UsersConfig
85 */
86 public function setName($name)
87 {
88 $this->name = $name;
89
90 return $this;
91 }
92
93 /**
94 * Get name
95 *
96 * @return string
97 */
98 public function getName()
99 {
100 return $this->name;
101 }
102
103 /**
104 * Set value
105 *
106 * @param string $value
107 * @return UsersConfig
108 */
109 public function setValue($value)
110 {
111 $this->value = $value;
112
113 return $this;
114 }
115
116 /**
117 * Get value
118 *
119 * @return string
120 */
121 public function getValue()
122 {
123 return $this->value;
124 }
125}
diff --git a/src/Wallabag/CoreBundle/Repository/EntriesRepository.php b/src/Wallabag/CoreBundle/Repository/EntriesRepository.php
new file mode 100644
index 00000000..5a71b9ef
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Repository/EntriesRepository.php
@@ -0,0 +1,79 @@
1<?php
2
3namespace Wallabag\CoreBundle\Repository;
4
5use Doctrine\ORM\Query;
6use Doctrine\ORM\EntityRepository;
7use Doctrine\ORM\Tools\Pagination\Paginator;
8
9class EntriesRepository extends EntityRepository
10{
11 /**
12 * Retrieves unread entries for a user
13 *
14 * @param $userId
15 * @param $firstResult
16 * @param int $maxResults
17 * @return Paginator
18 */
19 public function findUnreadByUser($userId, $firstResult, $maxResults = 12)
20 {
21 $qb = $this->createQueryBuilder('e')
22 ->select('e')
23 ->setFirstResult($firstResult)
24 ->setMaxResults($maxResults)
25 ->where('e.isRead = 0')
26 ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
27 ->getQuery();
28
29 $paginator = new Paginator($qb);
30
31 return $paginator;
32 }
33
34 /**
35 * Retrieves read entries for a user
36 *
37 * @param $userId
38 * @param $firstResult
39 * @param int $maxResults
40 * @return Paginator
41 */
42 public function findArchiveByUser($userId, $firstResult, $maxResults = 12)
43 {
44 $qb = $this->createQueryBuilder('e')
45 ->select('e')
46 ->setFirstResult($firstResult)
47 ->setMaxResults($maxResults)
48 ->where('e.isRead = 1')
49 ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
50 ->getQuery();
51
52 $paginator = new Paginator($qb);
53
54 return $paginator;
55 }
56
57 /**
58 * Retrieves starred entries for a user
59 *
60 * @param $userId
61 * @param $firstResult
62 * @param int $maxResults
63 * @return Paginator
64 */
65 public function findStarredByUser($userId, $firstResult, $maxResults = 12)
66 {
67 $qb = $this->createQueryBuilder('e')
68 ->select('e')
69 ->setFirstResult($firstResult)
70 ->setMaxResults($maxResults)
71 ->where('e.isFav = 1')
72 ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
73 ->getQuery();
74
75 $paginator = new Paginator($qb);
76
77 return $paginator;
78 }
79}
diff --git a/src/Wallabag/CoreBundle/Resources/config/routing.yml b/src/Wallabag/CoreBundle/Resources/config/routing.yml
new file mode 100644
index 00000000..327d49d8
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/config/routing.yml
@@ -0,0 +1,3 @@
1_wllbg:
2 resource: "@WallabagCoreBundle/Controller/EntryController.php"
3 type: annotation \ No newline at end of file
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.xml b/src/Wallabag/CoreBundle/Resources/config/services.xml
new file mode 100644
index 00000000..02308e6a
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/config/services.xml
@@ -0,0 +1,17 @@
1<?xml version="1.0" ?>
2
3<container xmlns="http://symfony.com/schema/dic/services"
4 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5 xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
6
7 <services>
8 <service id="wallabag_core.twig.wallabag" class="Wallabag\CoreBundle\Twig\Extension\WallabagExtension">
9 <tag name="twig.extension" />
10 </service>
11 </services>
12
13
14
15</container>
16
17
diff --git a/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig
new file mode 100644
index 00000000..2f8423d7
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig
@@ -0,0 +1,47 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title "Unread" %}
4
5{% block menu %}
6 {% include "WallabagCoreBundle::_menu.html.twig" %}
7{% endblock %}
8
9{% block content %}
10 {% block pager %}
11 {% if entries is not empty %}
12 <div class="results">
13 <div class="nb-results">{{ entries.count }} {% trans %}entries{% endtrans %}</div>
14 <div class="pagination">
15 {% for p in range(1, entries.count) %}
16 <li>
17 <a href="{{ path(app.request.attributes.get('_route'), {'page': p}) }}">{{ p }}</a>
18 </li>
19 {% endfor %}
20 </div>
21 </div>
22 {% endif %}
23 {% endblock %}
24
25 {% if entries is empty %}
26 <div class="messages warning"><p>{% trans %}No articles found.{% endtrans %}</p></div>
27 {% else %}
28 {% for entry in entries %}
29 <div id="entry-{{ entry.id|e }}" class="entrie">
30 <h2><a href="{{ path('view', { 'id': entry.id }) }}">{{ entry.title|raw }}</a></h2>
31 {% if entry.content| readingTime > 0 %}
32 <div class="estimatedTime"><span class="tool reading-time">{% trans %}estimated reading time :{% endtrans %} {{ entry.content| readingTime }} min</span></div>
33 {% else %}
34 <div class="estimatedTime"><span class="tool reading-time">{% trans %}estimated reading time :{% endtrans %} <small class="inferieur">&lt;</small> 1 min</span></div>
35 {% endif %}
36
37 <ul class="tools links">
38 <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>
39 <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>
40 <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>
41 <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>
42 </ul>
43 <p>{{ entry.content|striptags|slice(0, 300) }}...</p>
44 </div>
45 {% endfor %}
46 {% endif %}
47{% endblock %}
diff --git a/src/Wallabag/CoreBundle/Resources/views/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/Entry/entry.html.twig
new file mode 100644
index 00000000..78dfa7c0
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/Entry/entry.html.twig
@@ -0,0 +1,104 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{{ entry.title|raw }} ({{ entry.url | e | domainName }}){% endblock %}
4
5{% block menu %}
6 {% include "WallabagCoreBundle::_menu.html.twig" %}
7{% endblock %}
8
9{% block content %}
10 <div id="article_toolbar">
11 <ul class="links">
12 <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>
13 <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>
14 <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>
15 <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>
16 <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>
17 {% 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 %}
18 {% 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 %}
19 {% 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 %}
20 {% 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 %}
21 {# {% 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 %} #}
22 {% 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 %}
23 {% 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 %}
24 {% if export_epub %}<li><a href="?epub&amp;method=id&amp;value={{ entry.id|e }}" title="Generate ePub file">EPUB</a></li>{% endif %}
25 {% if export_mobi %}<li><a href="?mobi&amp;method=id&amp;value={{ entry.id|e }}" title="Generate Mobi file">MOBI</a></li>{% endif %}
26 {% if export_pdf %}<li><a href="?pdf&amp;method=id&amp;value={{ entry.id|e }}" title="Generate PDF file">PDF</a></li>{% endif %}
27 <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>
28 </ul>
29 </div>
30 <div id="article">
31 <header class="mbm">
32 <h1>{{ entry.title|raw }}</h1>
33 </header>
34 <aside class="tags">
35 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> #}
36 </aside>
37 <article>
38 {{ entry.content | raw }}
39 </article>
40 </div>
41 <script src="{{ asset('themes/_global/js/restoreScroll.js')}}"></script>
42 <script type="text/javascript">
43 $(document).ready(function() {
44
45 // toggle read property of current article
46 /* $('#markAsRead').click(function(){
47 $("body").css("cursor", "wait");
48 $.ajax( { url: '{{ path('archive_entry', { 'id': entry.id }) }}' }).done(
49 function( data ) {
50 if ( data == '1' ) {
51 if ( $('#markAsRead').hasClass("archive-off") ) {
52 $('#markAsRead').removeClass("archive-off");
53 $('#markAsRead').addClass("archive");
54 }
55 else {
56 $('#markAsRead').removeClass("archive");
57 $('#markAsRead').addClass("archive-off");
58 }
59 }
60 else {
61 alert('Error! Pls check if you are logged in.');
62 }
63 });
64 $("body").css("cursor", "auto");
65 });*/
66
67 // toggle favorite property of current article
68 /* $('#setFav').click(function(){
69 $("body").css("cursor", "wait");
70 $.ajax( { url: '{{ path('star_entry', { 'id': entry.id }) }}' }).done(
71 function( data ) {
72 if ( data == '1' ) {
73 if ( $('#setFav').hasClass("fav-off") ) {
74 $('#setFav').removeClass("fav-off");
75 $('#setFav').addClass("fav");
76 }
77 else {
78 $('#setFav').removeClass("fav");
79 $('#setFav').addClass("fav-off");
80 }
81 }
82 else {
83 alert('Error! Pls check if you are logged in.');
84 }
85 });
86 $("body").css("cursor", "auto");
87 });*/
88
89 $(window).scroll(function(e){
90 var scrollTop = $(window).scrollTop();
91 var docHeight = $(document).height();
92 var scrollPercent = (scrollTop) / (docHeight);
93 var scrollPercentRounded = Math.round(scrollPercent*100)/100;
94 savePercent({{ entry.id|e }}, scrollPercentRounded);
95 });
96
97 retrievePercent({{ entry.id|e }});
98
99 $(window).resize(function(){
100 retrievePercent({{ entry.id|e }});
101 });
102 });
103 </script>
104{% endblock %} \ No newline at end of file
diff --git a/src/Wallabag/CoreBundle/Resources/views/Entry/new.html.twig b/src/Wallabag/CoreBundle/Resources/views/Entry/new.html.twig
new file mode 100644
index 00000000..df6926a0
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/Entry/new.html.twig
@@ -0,0 +1,11 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{% trans %}Save new entry{% endtrans %}{% endblock %}
4
5{% block menu %}
6 {% include "WallabagCoreBundle::_menu.html.twig" %}
7{% endblock %}
8
9{% block content %}
10 {{ form(form) }}
11{% endblock %} \ No newline at end of file
diff --git a/src/Wallabag/CoreBundle/Resources/views/Static/about.html.twig b/src/Wallabag/CoreBundle/Resources/views/Static/about.html.twig
new file mode 100755
index 00000000..0585ecca
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/Static/about.html.twig
@@ -0,0 +1,51 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{% trans %}About{% endtrans %}{% endblock %}
4{% block menu %}
5{% include "WallabagCoreBundle::_menu.html.twig" %}
6{% endblock %}
7{% block content %}
8 <h2>{% trans %}About wallabag{% endtrans %}</h2>
9
10 <dl>
11 <dt>{% trans %}Project website{% endtrans %}</dt>
12 <dd><a href="https://www.wallabag.org">https://www.wallabag.org</a></dd>
13
14 <dt>{% trans %}Main developer{% endtrans %}</dt>
15 <dd><a href="mailto:nicolas@loeuillet.org">Nicolas Lœuillet</a> — <a href="http://cdetc.fr">{% trans %}website{% endtrans %}</a></dd>
16
17 <dt>{% trans %}Contributors ♥:{% endtrans %}</dt>
18 <dd><a href="https://github.com/wallabag/wallabag/graphs/contributors">{% trans %}on Github{% endtrans %}</a></dd>
19
20 <dt>{% trans %}Bug reports{% endtrans %}</dt>
21 <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>
22
23 <dt>{% trans %}License{% endtrans %}</dt>
24 <dd><a href="http://en.wikipedia.org/wiki/MIT_License">MIT</a></dd>
25
26 <dt>{% trans %}Version{% endtrans %}</dt>
27 <dd>{{ version }}</dd>
28 </dl>
29
30 <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>
31
32 <h2>{% trans %}Getting help{% endtrans %}</h2>
33
34 <dl>
35 <dt>{% trans %}Documentation{% endtrans %}</dt>
36 <dd><a href="https://doc.wallabag.org/">Online documentation</a></dd>
37
38 <dt>{% trans %}Support{% endtrans %}</dt>
39 <dd><a href="http://support.wallabag.org/">http://support.wallabag.org/</a></dd>
40 </dl>
41
42 <h2>{% trans %}Helping wallabag{% endtrans %}</h2>
43
44 <p>{% trans %}wallabag is free and opensource. You can help us:{% endtrans %}</p>
45
46 <dl>
47 <dt><a href="{{ paypal_url }}">{% trans %}via Paypal{% endtrans %}</a></dt>
48
49 <dt><a href="{{ flattr_url }}">{% trans %}via Flattr{% endtrans %}</a></dt>
50 </dl>
51{% endblock %}
diff --git a/src/Wallabag/CoreBundle/Resources/views/_bookmarklet.html.twig b/src/Wallabag/CoreBundle/Resources/views/_bookmarklet.html.twig
new file mode 100644
index 00000000..d432909a
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/_bookmarklet.html.twig
@@ -0,0 +1,3 @@
1 <script type="text/javascript">
2 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>"
3 </script> \ No newline at end of file
diff --git a/src/Wallabag/CoreBundle/Resources/views/_footer.html.twig b/src/Wallabag/CoreBundle/Resources/views/_footer.html.twig
new file mode 100644
index 00000000..c897a97e
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/_footer.html.twig
@@ -0,0 +1,3 @@
1 <footer class="w600p center mt3 mb3 smaller txtright">
2 <p>{% trans %}powered by{% endtrans %} <a href="http://wallabag.org">wallabag</a></p>
3 </footer> \ No newline at end of file
diff --git a/src/Wallabag/CoreBundle/Resources/views/_head.html.twig b/src/Wallabag/CoreBundle/Resources/views/_head.html.twig
new file mode 100755
index 00000000..7ef79a2f
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/_head.html.twig
@@ -0,0 +1,40 @@
1 <link rel="apple-touch-icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-152.png') }}" sizes="152x152">
2 <link rel="icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-152.png') }}" sizes="152x152">
3
4 <link rel="apple-touch-icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-144.png') }}" sizes="144x144">
5 <link rel="icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-144.png') }}" sizes="144x144">
6
7 <link rel="apple-touch-icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-120.png') }}" sizes="120x120">
8 <link rel="icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-120.png') }}" sizes="120x120">
9
10 <link rel="apple-touch-icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-114.png') }}" sizes="114x114">
11 <link rel="icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-114.png') }}" sizes="114x114">
12
13 <link rel="apple-touch-icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-76.png') }}" sizes="76x76">
14 <link rel="icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-76.png') }}" sizes="76x76">
15
16 <link rel="apple-touch-icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-72.png') }}" sizes="72x72">
17 <link rel="icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-72.png') }}" sizes="72x72">
18
19 <link rel="apple-touch-icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-57.png') }}" sizes="57x57">
20 <link rel="icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon-57.png') }}" sizes="57x57">
21
22 <link rel="apple-touch-icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon.png') }}">
23 <link rel="icon" type="image/png" href="{{ asset('themes/_global/img/appicon/apple-touch-icon.png') }}">
24
25 <link rel="shortcut icon" type="image/x-icon" href="{{ asset('themes/_global/img/appicon/favicon.ico') }}">
26
27 <link rel="stylesheet" href="{{ asset('themes/baggy/css/ratatouille.css') }}" media="all">
28 <link rel="stylesheet" href="{{ asset('themes/baggy/css/font.css') }}" media="all">
29 <link rel="stylesheet" href="{{ asset('themes/baggy/css/main.css') }}" media="all">
30 <link rel="stylesheet" href="{{ asset('themes/baggy/css/messages.css') }}" media="all">
31 <link rel="stylesheet" href="{{ asset('themes/baggy/css/print.css') }}" media="print">
32
33 <script src="{{ asset('themes/_global/js/jquery-2.0.3.min.js') }}"></script>
34 <script src="{{ asset('themes/_global/js/autoClose.js') }}"></script>
35 <script src="{{ asset('themes/baggy/js/jquery.cookie.js') }}"></script>
36 <script src="{{ asset('themes/baggy/js/init.js') }}"></script>
37 <script src="{{ asset('themes/_global/js/saveLink.js') }}"></script>
38 <script src="{{ asset('themes/_global/js/popupForm.js') }}"></script>
39 <script src="{{ asset('themes/baggy/js/closeMessage.js') }}"></script>
40
diff --git a/src/Wallabag/CoreBundle/Resources/views/_menu.html.twig b/src/Wallabag/CoreBundle/Resources/views/_menu.html.twig
new file mode 100644
index 00000000..d4560e84
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/_menu.html.twig
@@ -0,0 +1,15 @@
1 <button id="menu" class="icon icon-menu desktopHide"><span>Menu</span></button>
2 <ul id="links" class="links">
3 <li><a href="{{ path('unread') }}">{% trans %}unread{% endtrans %}</a></li>
4 <li><a href="{{ path('starred') }}">{% trans %}favorites{% endtrans %}</a></li>
5 <li><a href="{{ path('archive') }}"}>{% trans %}archive{% endtrans %}</a></li>
6 <li><a href="?view=tags">{% trans %}tags{% endtrans %}</a></li>
7 <li><a href="{{ path('new_entry') }}">{% trans %}save a link{% endtrans %}</a></li>
8 <li style="position: relative;"><a href="javascript: void(null);" id="search">{% trans %}search{% endtrans %}</a>
9 {% include "WallabagCoreBundle::_search_form.html.twig" %}
10 </li>
11 <li><a href="?view=config">{% trans %}config{% endtrans %}</a></li>
12 <li><a href={{ path('about') }}>{% trans %}about{% endtrans %}</a></li>
13 <li><a class="icon icon-power" href="?logout" title="{% trans %}logout{% endtrans %}">{% trans %}logout{% endtrans %}</a></li>
14 </ul>
15
diff --git a/src/Wallabag/CoreBundle/Resources/views/_messages.html.twig b/src/Wallabag/CoreBundle/Resources/views/_messages.html.twig
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/_messages.html.twig
diff --git a/src/Wallabag/CoreBundle/Resources/views/_save_form.html.twig b/src/Wallabag/CoreBundle/Resources/views/_save_form.html.twig
new file mode 100755
index 00000000..acaa5dbc
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/_save_form.html.twig
@@ -0,0 +1,10 @@
1<div id="bagit-form" class="messages info popup-form">
2 <form method="get" action="index.php" target="_blank" id="bagit-form-form">
3 <h2>{% trans %}Save a link{% endtrans %}</h2>
4 <a href="javascript: void(null);" id="bagit-form-close" class="close-button--popup close-button">&times;</a>
5 <input type="hidden" name="autoclose" value="1" />
6 <input required placeholder="example.com/article" class="addurl" id="plainurl" name="plainurl" type="url" />
7 <span id="add-link-result"></span>
8 <input type="submit" value="{% trans %}save link!"{% endtrans %} />
9 </form>
10</div>
diff --git a/src/Wallabag/CoreBundle/Resources/views/_search_form.html.twig b/src/Wallabag/CoreBundle/Resources/views/_search_form.html.twig
new file mode 100644
index 00000000..7eb1b67d
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/_search_form.html.twig
@@ -0,0 +1,9 @@
1<div id="search-form" class="messages info popup-form">
2<form method="get" action="index.php">
3 <h2>{% trans %}Search{% endtrans %}</h2>
4 <a href="javascript: void(null);" id="search-form-close" class="close-button--popup close-button">&times;</a>
5 <input type="hidden" name="view" value="search"></input>
6 <input required placeholder="{% trans %}Enter your search here{% endtrans %}" type="text" name="search" id="searchfield"><br>
7 <input id="submit-search" type="submit" value="{% trans %}Search{% endtrans %}"></input>
8</form>
9</div>
diff --git a/src/Wallabag/CoreBundle/Resources/views/_top.html.twig b/src/Wallabag/CoreBundle/Resources/views/_top.html.twig
new file mode 100755
index 00000000..34d925df
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/_top.html.twig
@@ -0,0 +1,5 @@
1 <header class="w600p center mbm">
2 <h1>
3 {% block logo %}<img width="100" height="100" src="{{ asset('themes/baggy/img/logo-w.png') }}" alt="wallabag logo" />{% endblock %}
4 </h1>
5 </header>
diff --git a/src/Wallabag/CoreBundle/Resources/views/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/layout.html.twig
new file mode 100644
index 00000000..83830a4a
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/layout.html.twig
@@ -0,0 +1,33 @@
1<!DOCTYPE html>
2<!--[if lte IE 6]><html class="no-js ie6 ie67 ie678" lang="en"><![endif]-->
3<!--[if lte IE 7]><html class="no-js ie7 ie67 ie678" lang="en"><![endif]-->
4<!--[if IE 8]><html class="no-js ie8 ie678" lang="en"><![endif]-->
5<!--[if gt IE 8]><html class="no-js" lang="en"><![endif]-->
6<html lang="en">
7<head>
8 <meta name="viewport" content="initial-scale=1.0">
9 <meta charset="utf-8">
10 <!--[if IE]>
11 <meta http-equiv="X-UA-Compatible" content="IE=10">
12 <![endif]-->
13 <title>{% block title %}{% endblock %} - wallabag</title>
14 {% include "WallabagCoreBundle::_head.html.twig" %}
15 {% include "WallabagCoreBundle::_bookmarklet.html.twig" %}
16</head>
17<body>
18{% include "WallabagCoreBundle::_top.html.twig" %}
19<div id="main">
20 {% block menu %}{% endblock %}
21 {% block precontent %}{% endblock %}
22 {% for flashMessage in app.session.flashbag.get('notice') %}
23 <div class="flash-notice">
24 {{ flashMessage }}
25 </div>
26 {% endfor %}
27 <div id="content" class="w600p center">
28 {% block content %}{% endblock %}
29 </div>
30</div>
31{% include "WallabagCoreBundle::_footer.html.twig" %}
32</body>
33</html> \ No newline at end of file
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/DefaultControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/DefaultControllerTest.php
new file mode 100644
index 00000000..af20f31f
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Tests/Controller/DefaultControllerTest.php
@@ -0,0 +1,18 @@
1<?php
2
3namespace Wallabag\CoreBundle\Tests\Controller;
4
5use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
6
7class EntryControllerTest extends WebTestCase
8{
9 public function testIndex()
10 {
11 $client = static::createClient();
12
13 $crawler = $client->request('GET', '/app/index');
14
15 $this->assertEquals(200, $client->getResponse()->getStatusCode());
16 $this->assertTrue($crawler->filter('html:contains("Homepage")')->count() > 0);
17 }
18}
diff --git a/src/Wallabag/CoreBundle/Twig/Extension/WallabagExtension.php b/src/Wallabag/CoreBundle/Twig/Extension/WallabagExtension.php
new file mode 100644
index 00000000..0b004a30
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Twig/Extension/WallabagExtension.php
@@ -0,0 +1,41 @@
1<?php
2
3namespace Wallabag\CoreBundle\Twig\Extension;
4
5class WallabagExtension extends \Twig_Extension
6{
7 public function getFilters()
8 {
9 return array(
10 new \Twig_SimpleFilter('readingTime', array($this, 'getReadingTime')),
11 new \Twig_SimpleFilter('domainName', array($this, 'getDomainName')),
12 );
13 }
14
15 /**
16 * Returns the domain name for a URL
17 *
18 * @param $url
19 * @return string
20 */
21 public static function getDomainName($url)
22 {
23 return parse_url($url, PHP_URL_HOST);
24 }
25
26 /**
27 * For a given text, we calculate reading time for an article
28 *
29 * @param $text
30 * @return float
31 */
32 public static function getReadingTime($text)
33 {
34 return floor(str_word_count(strip_tags($text)) / 200);
35 }
36
37 public function getName()
38 {
39 return 'wallabag_extension';
40 }
41} \ No newline at end of file
diff --git a/src/Wallabag/CoreBundle/WallabagCoreBundle.php b/src/Wallabag/CoreBundle/WallabagCoreBundle.php
new file mode 100644
index 00000000..f5899e39
--- /dev/null
+++ b/src/Wallabag/CoreBundle/WallabagCoreBundle.php
@@ -0,0 +1,9 @@
1<?php
2
3namespace Wallabag\CoreBundle;
4
5use Symfony\Component\HttpKernel\Bundle\Bundle;
6
7class WallabagCoreBundle extends Bundle
8{
9}