aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/Wallabag/Wallabag/Database.php1
-rw-r--r--src/WallabagBundle/Controller/DefaultController.php17
-rw-r--r--src/WallabagBundle/Controller/EntryController.php25
-rw-r--r--src/WallabagBundle/DependencyInjection/WallabagExtension.php22
-rw-r--r--src/WallabagBundle/Entity/Config.php95
-rw-r--r--src/WallabagBundle/Entity/Config.php~95
-rw-r--r--src/WallabagBundle/Entity/Entries.php215
-rw-r--r--src/WallabagBundle/Entity/Entries.php~215
-rw-r--r--src/WallabagBundle/Entity/Entry.php~74
-rw-r--r--src/WallabagBundle/Entity/Tags.php65
-rw-r--r--src/WallabagBundle/Entity/Tags.php~65
-rw-r--r--src/WallabagBundle/Entity/TagsEntries.php95
-rw-r--r--src/WallabagBundle/Entity/TagsEntries.php~95
-rw-r--r--src/WallabagBundle/Entity/Users.php155
-rw-r--r--src/WallabagBundle/Entity/Users.php~155
-rw-r--r--src/WallabagBundle/Entity/UsersConfig.php125
-rw-r--r--src/WallabagBundle/Entity/UsersConfig.php~125
-rw-r--r--src/WallabagBundle/Repository/EntriesRepository.php35
-rw-r--r--src/WallabagBundle/Resources/config/routing.yml3
-rw-r--r--src/WallabagBundle/Resources/config/services.xml12
-rw-r--r--src/WallabagBundle/Resources/views/Entry/entries.html.twig26
-rw-r--r--src/WallabagBundle/Resources/views/_bookmarklet.html.twig3
-rw-r--r--src/WallabagBundle/Resources/views/_footer.html.twig3
-rwxr-xr-xsrc/WallabagBundle/Resources/views/_head.html.twig40
-rw-r--r--src/WallabagBundle/Resources/views/_messages.html.twig0
-rwxr-xr-xsrc/WallabagBundle/Resources/views/_top.html.twig6
-rw-r--r--src/WallabagBundle/Resources/views/layout.html.twig31
-rw-r--r--src/WallabagBundle/Tests/Controller/DefaultControllerTest.php2
-rw-r--r--src/WallabagBundle/Twig/Extension/WallabagExtension.php41
29 files changed, 1823 insertions, 18 deletions
diff --git a/src/Wallabag/Wallabag/Database.php b/src/Wallabag/Wallabag/Database.php
index fa132910..47fa99aa 100755
--- a/src/Wallabag/Wallabag/Database.php
+++ b/src/Wallabag/Wallabag/Database.php
@@ -11,6 +11,7 @@
11namespace Wallabag\Wallabag; 11namespace Wallabag\Wallabag;
12 12
13use \PDO; 13use \PDO;
14use WallabagBundle\Entity;
14 15
15class Database { 16class Database {
16 17
diff --git a/src/WallabagBundle/Controller/DefaultController.php b/src/WallabagBundle/Controller/DefaultController.php
deleted file mode 100644
index 1030b7a6..00000000
--- a/src/WallabagBundle/Controller/DefaultController.php
+++ /dev/null
@@ -1,17 +0,0 @@
1<?php
2
3namespace WallabagBundle\Controller;
4
5use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7
8class DefaultController extends Controller
9{
10 /**
11 * @Route("/app/index", name="homepage")
12 */
13 public function indexAction()
14 {
15 return $this->render('default/index.html.twig');
16 }
17}
diff --git a/src/WallabagBundle/Controller/EntryController.php b/src/WallabagBundle/Controller/EntryController.php
new file mode 100644
index 00000000..0c0c1569
--- /dev/null
+++ b/src/WallabagBundle/Controller/EntryController.php
@@ -0,0 +1,25 @@
1<?php
2
3namespace WallabagBundle\Controller;
4
5use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7use WallabagBundle\Repository;
8
9class EntryController extends Controller
10{
11 /**
12 * @Route("/unread", name="unread")
13 */
14 public function unreadAction()
15 {
16 $repository = $this->getDoctrine()->getRepository('WallabagBundle:Entries');
17 $entries = $repository->findUnreadByUser(1);
18
19 return $this->render(
20 'WallabagBundle:Entry:entries.html.twig',
21 array('entries' => $entries)
22 );
23
24 }
25}
diff --git a/src/WallabagBundle/DependencyInjection/WallabagExtension.php b/src/WallabagBundle/DependencyInjection/WallabagExtension.php
new file mode 100644
index 00000000..cfdb21fc
--- /dev/null
+++ b/src/WallabagBundle/DependencyInjection/WallabagExtension.php
@@ -0,0 +1,22 @@
1<?php
2
3namespace WallabagBundle\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 WallabagExtension 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';
21 }
22}
diff --git a/src/WallabagBundle/Entity/Config.php b/src/WallabagBundle/Entity/Config.php
new file mode 100644
index 00000000..8b692cef
--- /dev/null
+++ b/src/WallabagBundle/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/WallabagBundle/Entity/Config.php~ b/src/WallabagBundle/Entity/Config.php~
new file mode 100644
index 00000000..8b692cef
--- /dev/null
+++ b/src/WallabagBundle/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/WallabagBundle/Entity/Entries.php b/src/WallabagBundle/Entity/Entries.php
new file mode 100644
index 00000000..69c6be0d
--- /dev/null
+++ b/src/WallabagBundle/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/WallabagBundle/Entity/Entries.php~ b/src/WallabagBundle/Entity/Entries.php~
new file mode 100644
index 00000000..69c6be0d
--- /dev/null
+++ b/src/WallabagBundle/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/WallabagBundle/Entity/Entry.php~ b/src/WallabagBundle/Entity/Entry.php~
new file mode 100644
index 00000000..ebcdf53a
--- /dev/null
+++ b/src/WallabagBundle/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/WallabagBundle/Entity/Tags.php b/src/WallabagBundle/Entity/Tags.php
new file mode 100644
index 00000000..c0c78ee5
--- /dev/null
+++ b/src/WallabagBundle/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/WallabagBundle/Entity/Tags.php~ b/src/WallabagBundle/Entity/Tags.php~
new file mode 100644
index 00000000..c0c78ee5
--- /dev/null
+++ b/src/WallabagBundle/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/WallabagBundle/Entity/TagsEntries.php b/src/WallabagBundle/Entity/TagsEntries.php
new file mode 100644
index 00000000..448c54fa
--- /dev/null
+++ b/src/WallabagBundle/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/WallabagBundle/Entity/TagsEntries.php~ b/src/WallabagBundle/Entity/TagsEntries.php~
new file mode 100644
index 00000000..448c54fa
--- /dev/null
+++ b/src/WallabagBundle/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/WallabagBundle/Entity/Users.php b/src/WallabagBundle/Entity/Users.php
new file mode 100644
index 00000000..a48f2240
--- /dev/null
+++ b/src/WallabagBundle/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/WallabagBundle/Entity/Users.php~ b/src/WallabagBundle/Entity/Users.php~
new file mode 100644
index 00000000..a48f2240
--- /dev/null
+++ b/src/WallabagBundle/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/WallabagBundle/Entity/UsersConfig.php b/src/WallabagBundle/Entity/UsersConfig.php
new file mode 100644
index 00000000..8af283cc
--- /dev/null
+++ b/src/WallabagBundle/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/WallabagBundle/Entity/UsersConfig.php~ b/src/WallabagBundle/Entity/UsersConfig.php~
new file mode 100644
index 00000000..8af283cc
--- /dev/null
+++ b/src/WallabagBundle/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/WallabagBundle/Repository/EntriesRepository.php b/src/WallabagBundle/Repository/EntriesRepository.php
new file mode 100644
index 00000000..4c13c9c2
--- /dev/null
+++ b/src/WallabagBundle/Repository/EntriesRepository.php
@@ -0,0 +1,35 @@
1<?php
2
3namespace WallabagBundle\Repository;
4
5use Doctrine\ORM\Query;
6use Doctrine\ORM\EntityRepository;
7
8/**
9 * EntriesRepository
10 *
11 * This class was generated by the Doctrine ORM. Add your own custom
12 * repository methods below.
13 */
14class EntriesRepository extends EntityRepository
15{
16 /* public function findUnreadByUser($userId)
17 {
18 return $this->createQueryBuilder('e')
19 ->where('e.is_read = 0')
20 ->andWhere('e.user_id = :userId')
21 ->setParameter('userId', $userId)
22 ->getQuery();
23 }*/
24 public function findUnreadByUser($userId)
25 {
26 $qb = $this->createQueryBuilder('e')
27 ->select('e')
28 ->where('e.isRead = 0')
29 ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
30 ->getQuery()
31 ->getResult(Query::HYDRATE_ARRAY);
32
33 return $qb;
34 }
35}
diff --git a/src/WallabagBundle/Resources/config/routing.yml b/src/WallabagBundle/Resources/config/routing.yml
new file mode 100644
index 00000000..ad79b1f0
--- /dev/null
+++ b/src/WallabagBundle/Resources/config/routing.yml
@@ -0,0 +1,3 @@
1_wllbg:
2 resource: "@WallabagBundle/Controller/EntryController.php"
3 type: annotation
diff --git a/src/WallabagBundle/Resources/config/services.xml b/src/WallabagBundle/Resources/config/services.xml
new file mode 100644
index 00000000..02d82643
--- /dev/null
+++ b/src/WallabagBundle/Resources/config/services.xml
@@ -0,0 +1,12 @@
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.twig.extension.wallabag_extension" class="WallabagBundle\Twig\Extension\WallabagExtension">
9 <tag name="twig.extension" />
10 </service>
11 </services>
12</container>
diff --git a/src/WallabagBundle/Resources/views/Entry/entries.html.twig b/src/WallabagBundle/Resources/views/Entry/entries.html.twig
new file mode 100644
index 00000000..f4d7a7ab
--- /dev/null
+++ b/src/WallabagBundle/Resources/views/Entry/entries.html.twig
@@ -0,0 +1,26 @@
1{% extends "WallabagBundle::layout.html.twig" %}
2
3{% block title "Unread" %}
4
5{% block content_header '' %}
6
7{% block content %}
8 {% for entry in entries %}
9 <div id="entry-{{ entry.id|e }}" class="entrie">
10 <h2><a href="index.php?view=view&amp;id={{ entry.id|e }}">{{ entry.title|raw }}</a></h2>
11 {% if entry.content| readingTime > 0 %}
12 <div class="estimatedTime"><span class="tool reading-time">{% trans %}estimated reading time :{% endtrans %} {{ entry.content| readingTime }} min</span></div>
13 {% else %}
14 <div class="estimatedTime"><span class="tool reading-time">{% trans %}estimated reading time :{% endtrans %} <small class="inferieur">&lt;</small> 1 min</span></div>
15 {% endif %}
16
17 <ul class="tools links">
18 <li><a title="{% trans %}Toggle mark as read{% endtrans %}" class="tool icon-check icon {% if entry.isRead == 0 %}archive-off{% else %}archive{% endif %}" href="./?action=toggle_archive&amp;id={{ entry.id|e }}"><span>{% trans %}Toggle mark as read{% endtrans %}</span></a></li>
19 <li><a title="{% trans %}toggle favorite{% endtrans %}" class="tool icon-star icon {% if entry.isFav == 0 %}fav-off{% else %}fav{% endif %}" href="./?action=toggle_fav&amp;id={{ entry.id|e }}"><span>{% trans %}toggle favorite{% endtrans %}</span></a></li>
20 <li><a title="{% trans %}delete{% endtrans %}" class="tool delete icon-trash icon" href="./?action=delete&amp;id={{ entry.id|e }}"><span>{% trans %}delete{% endtrans %}</span></a></li>
21 <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>
22 </ul>
23 <p>{{ entry.content|striptags|slice(0, 300) }}...</p>
24 </div>
25 {% endfor %}
26{% endblock %}
diff --git a/src/WallabagBundle/Resources/views/_bookmarklet.html.twig b/src/WallabagBundle/Resources/views/_bookmarklet.html.twig
new file mode 100644
index 00000000..d432909a
--- /dev/null
+++ b/src/WallabagBundle/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/WallabagBundle/Resources/views/_footer.html.twig b/src/WallabagBundle/Resources/views/_footer.html.twig
new file mode 100644
index 00000000..c897a97e
--- /dev/null
+++ b/src/WallabagBundle/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/WallabagBundle/Resources/views/_head.html.twig b/src/WallabagBundle/Resources/views/_head.html.twig
new file mode 100755
index 00000000..7ef79a2f
--- /dev/null
+++ b/src/WallabagBundle/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/WallabagBundle/Resources/views/_messages.html.twig b/src/WallabagBundle/Resources/views/_messages.html.twig
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/WallabagBundle/Resources/views/_messages.html.twig
diff --git a/src/WallabagBundle/Resources/views/_top.html.twig b/src/WallabagBundle/Resources/views/_top.html.twig
new file mode 100755
index 00000000..576df806
--- /dev/null
+++ b/src/WallabagBundle/Resources/views/_top.html.twig
@@ -0,0 +1,6 @@
1 <header class="w600p center mbm">
2 <h1>
3 {% block logo %}<img width="100" height="100" src="{{ asset('themes/baggy/img/logo-other_themes.png') }}" alt="wallabag logo" />{% endblock %}
4
5 </h1>
6 </header>
diff --git a/src/WallabagBundle/Resources/views/layout.html.twig b/src/WallabagBundle/Resources/views/layout.html.twig
new file mode 100644
index 00000000..4a3f0f5c
--- /dev/null
+++ b/src/WallabagBundle/Resources/views/layout.html.twig
@@ -0,0 +1,31 @@
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 "WallabagBundle::_head.html.twig" %}
15 {% include "WallabagBundle::_bookmarklet.html.twig" %}
16</head>
17<body>
18{% include "WallabagBundle::_top.html.twig" %}
19<div id="main">
20 {% block menu %}{% endblock %}
21 {% block precontent %}{% endblock %}
22 {% block messages %}
23 {% include "WallabagBundle::_messages.html.twig" %}
24 {% endblock %}
25 <div id="content" class="w600p center">
26 {% block content %}{% endblock %}
27 </div>
28</div>
29{% include "WallabagBundle::_footer.html.twig" %}
30</body>
31</html> \ No newline at end of file
diff --git a/src/WallabagBundle/Tests/Controller/DefaultControllerTest.php b/src/WallabagBundle/Tests/Controller/DefaultControllerTest.php
index e9022438..64b389bb 100644
--- a/src/WallabagBundle/Tests/Controller/DefaultControllerTest.php
+++ b/src/WallabagBundle/Tests/Controller/DefaultControllerTest.php
@@ -4,7 +4,7 @@ namespace WallabagBundle\Tests\Controller;
4 4
5use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; 5use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
6 6
7class DefaultControllerTest extends WebTestCase 7class EntryControllerTest extends WebTestCase
8{ 8{
9 public function testIndex() 9 public function testIndex()
10 { 10 {
diff --git a/src/WallabagBundle/Twig/Extension/WallabagExtension.php b/src/WallabagBundle/Twig/Extension/WallabagExtension.php
new file mode 100644
index 00000000..741fb191
--- /dev/null
+++ b/src/WallabagBundle/Twig/Extension/WallabagExtension.php
@@ -0,0 +1,41 @@
1<?php
2
3namespace WallabagBundle\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