diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-07-01 09:52:38 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-07-01 09:52:38 +0200 |
commit | f808b01692a835673f328d7221ba8c212caa9b61 (patch) | |
tree | 0c3b1fc5b1ddbd7af72227303503177689e1d403 /src/Wallabag/CoreBundle/Helper | |
parent | 822c877949aff8ae57677671115f8f4fc69588d5 (diff) | |
download | wallabag-f808b01692a835673f328d7221ba8c212caa9b61.tar.gz wallabag-f808b01692a835673f328d7221ba8c212caa9b61.tar.zst wallabag-f808b01692a835673f328d7221ba8c212caa9b61.zip |
Add a real configuration for CS-Fixer
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper')
8 files changed, 60 insertions, 60 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index 51bb2ca2..ddecd6f4 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php | |||
@@ -4,12 +4,12 @@ namespace Wallabag\CoreBundle\Helper; | |||
4 | 4 | ||
5 | use Graby\Graby; | 5 | use Graby\Graby; |
6 | use Psr\Log\LoggerInterface; | 6 | use Psr\Log\LoggerInterface; |
7 | use Wallabag\CoreBundle\Entity\Entry; | ||
8 | use Wallabag\CoreBundle\Tools\Utils; | ||
9 | use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeExtensionGuesser; | 7 | use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeExtensionGuesser; |
10 | use Symfony\Component\Validator\Constraints\Locale as LocaleConstraint; | 8 | use Symfony\Component\Validator\Constraints\Locale as LocaleConstraint; |
11 | use Symfony\Component\Validator\Constraints\Url as UrlConstraint; | 9 | use Symfony\Component\Validator\Constraints\Url as UrlConstraint; |
12 | use Symfony\Component\Validator\Validator\ValidatorInterface; | 10 | use Symfony\Component\Validator\Validator\ValidatorInterface; |
11 | use Wallabag\CoreBundle\Entity\Entry; | ||
12 | use Wallabag\CoreBundle\Tools\Utils; | ||
13 | 13 | ||
14 | /** | 14 | /** |
15 | * This kind of proxy class take care of getting the content from an url | 15 | * This kind of proxy class take care of getting the content from an url |
@@ -100,7 +100,7 @@ class ContentProxy | |||
100 | 100 | ||
101 | // is it a timestamp? | 101 | // is it a timestamp? |
102 | if (filter_var($date, FILTER_VALIDATE_INT) !== false) { | 102 | if (filter_var($date, FILTER_VALIDATE_INT) !== false) { |
103 | $date = '@'.$content['date']; | 103 | $date = '@' . $content['date']; |
104 | } | 104 | } |
105 | 105 | ||
106 | try { | 106 | try { |
@@ -189,7 +189,7 @@ class ContentProxy | |||
189 | return; | 189 | return; |
190 | } | 190 | } |
191 | 191 | ||
192 | $this->logger->warning('Language validation failed. '.(string) $errors); | 192 | $this->logger->warning('Language validation failed. ' . (string) $errors); |
193 | } | 193 | } |
194 | 194 | ||
195 | /** | 195 | /** |
@@ -211,6 +211,6 @@ class ContentProxy | |||
211 | return; | 211 | return; |
212 | } | 212 | } |
213 | 213 | ||
214 | $this->logger->warning('PreviewPicture validation failed. '.(string) $errors); | 214 | $this->logger->warning('PreviewPicture validation failed. ' . (string) $errors); |
215 | } | 215 | } |
216 | } | 216 | } |
diff --git a/src/Wallabag/CoreBundle/Helper/CryptoProxy.php b/src/Wallabag/CoreBundle/Helper/CryptoProxy.php index e8b19cb9..7d8c9888 100644 --- a/src/Wallabag/CoreBundle/Helper/CryptoProxy.php +++ b/src/Wallabag/CoreBundle/Helper/CryptoProxy.php | |||
@@ -2,10 +2,10 @@ | |||
2 | 2 | ||
3 | namespace Wallabag\CoreBundle\Helper; | 3 | namespace Wallabag\CoreBundle\Helper; |
4 | 4 | ||
5 | use Psr\Log\LoggerInterface; | ||
6 | use Defuse\Crypto\Key; | ||
7 | use Defuse\Crypto\Crypto; | 5 | use Defuse\Crypto\Crypto; |
8 | use Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException; | 6 | use Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException; |
7 | use Defuse\Crypto\Key; | ||
8 | use Psr\Log\LoggerInterface; | ||
9 | 9 | ||
10 | /** | 10 | /** |
11 | * This is a proxy to crypt and decrypt password used by SiteCredential entity. | 11 | * This is a proxy to crypt and decrypt password used by SiteCredential entity. |
@@ -39,7 +39,7 @@ class CryptoProxy | |||
39 | */ | 39 | */ |
40 | public function crypt($secretValue) | 40 | public function crypt($secretValue) |
41 | { | 41 | { |
42 | $this->logger->debug('Crypto: crypting value: '.$this->mask($secretValue)); | 42 | $this->logger->debug('Crypto: crypting value: ' . $this->mask($secretValue)); |
43 | 43 | ||
44 | return Crypto::encrypt($secretValue, $this->loadKey()); | 44 | return Crypto::encrypt($secretValue, $this->loadKey()); |
45 | } | 45 | } |
@@ -53,12 +53,12 @@ class CryptoProxy | |||
53 | */ | 53 | */ |
54 | public function decrypt($cryptedValue) | 54 | public function decrypt($cryptedValue) |
55 | { | 55 | { |
56 | $this->logger->debug('Crypto: decrypting value: '.$this->mask($cryptedValue)); | 56 | $this->logger->debug('Crypto: decrypting value: ' . $this->mask($cryptedValue)); |
57 | 57 | ||
58 | try { | 58 | try { |
59 | return Crypto::decrypt($cryptedValue, $this->loadKey()); | 59 | return Crypto::decrypt($cryptedValue, $this->loadKey()); |
60 | } catch (WrongKeyOrModifiedCiphertextException $e) { | 60 | } catch (WrongKeyOrModifiedCiphertextException $e) { |
61 | throw new \RuntimeException('Decrypt fail: '.$e->getMessage()); | 61 | throw new \RuntimeException('Decrypt fail: ' . $e->getMessage()); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
@@ -81,6 +81,6 @@ class CryptoProxy | |||
81 | */ | 81 | */ |
82 | private function mask($value) | 82 | private function mask($value) |
83 | { | 83 | { |
84 | return strlen($value) > 0 ? $value[0].'*****'.$value[strlen($value) - 1] : 'Empty value'; | 84 | return strlen($value) > 0 ? $value[0] . '*****' . $value[strlen($value) - 1] : 'Empty value'; |
85 | } | 85 | } |
86 | } | 86 | } |
diff --git a/src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php b/src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php index 23e98042..9f90ee3e 100644 --- a/src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php +++ b/src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php | |||
@@ -44,7 +44,7 @@ class DetectActiveTheme implements DeviceDetectionInterface | |||
44 | { | 44 | { |
45 | $token = $this->tokenStorage->getToken(); | 45 | $token = $this->tokenStorage->getToken(); |
46 | 46 | ||
47 | if (is_null($token)) { | 47 | if (null === $token) { |
48 | return $this->defaultTheme; | 48 | return $this->defaultTheme; |
49 | } | 49 | } |
50 | 50 | ||
diff --git a/src/Wallabag/CoreBundle/Helper/DownloadImages.php b/src/Wallabag/CoreBundle/Helper/DownloadImages.php index ed888cdb..252ba57c 100644 --- a/src/Wallabag/CoreBundle/Helper/DownloadImages.php +++ b/src/Wallabag/CoreBundle/Helper/DownloadImages.php | |||
@@ -2,12 +2,12 @@ | |||
2 | 2 | ||
3 | namespace Wallabag\CoreBundle\Helper; | 3 | namespace Wallabag\CoreBundle\Helper; |
4 | 4 | ||
5 | use Psr\Log\LoggerInterface; | ||
6 | use Symfony\Component\DomCrawler\Crawler; | ||
7 | use GuzzleHttp\Client; | 5 | use GuzzleHttp\Client; |
8 | use GuzzleHttp\Message\Response; | 6 | use GuzzleHttp\Message\Response; |
9 | use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeExtensionGuesser; | 7 | use Psr\Log\LoggerInterface; |
8 | use Symfony\Component\DomCrawler\Crawler; | ||
10 | use Symfony\Component\Finder\Finder; | 9 | use Symfony\Component\Finder\Finder; |
10 | use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeExtensionGuesser; | ||
11 | 11 | ||
12 | class DownloadImages | 12 | class DownloadImages |
13 | { | 13 | { |
@@ -31,17 +31,6 @@ class DownloadImages | |||
31 | } | 31 | } |
32 | 32 | ||
33 | /** | 33 | /** |
34 | * Setup base folder where all images are going to be saved. | ||
35 | */ | ||
36 | private function setFolder() | ||
37 | { | ||
38 | // if folder doesn't exist, attempt to create one and store the folder name in property $folder | ||
39 | if (!file_exists($this->baseFolder)) { | ||
40 | mkdir($this->baseFolder, 0755, true); | ||
41 | } | ||
42 | } | ||
43 | |||
44 | /** | ||
45 | * Process the html and extract image from it, save them to local and return the updated html. | 34 | * Process the html and extract image from it, save them to local and return the updated html. |
46 | * | 35 | * |
47 | * @param int $entryId ID of the entry | 36 | * @param int $entryId ID of the entry |
@@ -97,9 +86,9 @@ class DownloadImages | |||
97 | $relativePath = $this->getRelativePath($entryId); | 86 | $relativePath = $this->getRelativePath($entryId); |
98 | } | 87 | } |
99 | 88 | ||
100 | $this->logger->debug('DownloadImages: working on image: '.$imagePath); | 89 | $this->logger->debug('DownloadImages: working on image: ' . $imagePath); |
101 | 90 | ||
102 | $folderPath = $this->baseFolder.'/'.$relativePath; | 91 | $folderPath = $this->baseFolder . '/' . $relativePath; |
103 | 92 | ||
104 | // build image path | 93 | // build image path |
105 | $absolutePath = $this->getAbsoluteLink($url, $imagePath); | 94 | $absolutePath = $this->getAbsoluteLink($url, $imagePath); |
@@ -123,7 +112,7 @@ class DownloadImages | |||
123 | } | 112 | } |
124 | 113 | ||
125 | $hashImage = hash('crc32', $absolutePath); | 114 | $hashImage = hash('crc32', $absolutePath); |
126 | $localPath = $folderPath.'/'.$hashImage.'.'.$ext; | 115 | $localPath = $folderPath . '/' . $hashImage . '.' . $ext; |
127 | 116 | ||
128 | try { | 117 | try { |
129 | $im = imagecreatefromstring($res->getBody()); | 118 | $im = imagecreatefromstring($res->getBody()); |
@@ -156,7 +145,7 @@ class DownloadImages | |||
156 | 145 | ||
157 | imagedestroy($im); | 146 | imagedestroy($im); |
158 | 147 | ||
159 | return $this->wallabagUrl.'/assets/images/'.$relativePath.'/'.$hashImage.'.'.$ext; | 148 | return $this->wallabagUrl . '/assets/images/' . $relativePath . '/' . $hashImage . '.' . $ext; |
160 | } | 149 | } |
161 | 150 | ||
162 | /** | 151 | /** |
@@ -167,7 +156,7 @@ class DownloadImages | |||
167 | public function removeImages($entryId) | 156 | public function removeImages($entryId) |
168 | { | 157 | { |
169 | $relativePath = $this->getRelativePath($entryId); | 158 | $relativePath = $this->getRelativePath($entryId); |
170 | $folderPath = $this->baseFolder.'/'.$relativePath; | 159 | $folderPath = $this->baseFolder . '/' . $relativePath; |
171 | 160 | ||
172 | $finder = new Finder(); | 161 | $finder = new Finder(); |
173 | $finder | 162 | $finder |
@@ -183,6 +172,17 @@ class DownloadImages | |||
183 | } | 172 | } |
184 | 173 | ||
185 | /** | 174 | /** |
175 | * Setup base folder where all images are going to be saved. | ||
176 | */ | ||
177 | private function setFolder() | ||
178 | { | ||
179 | // if folder doesn't exist, attempt to create one and store the folder name in property $folder | ||
180 | if (!file_exists($this->baseFolder)) { | ||
181 | mkdir($this->baseFolder, 0755, true); | ||
182 | } | ||
183 | } | ||
184 | |||
185 | /** | ||
186 | * Generate the folder where we are going to save images based on the entry url. | 186 | * Generate the folder where we are going to save images based on the entry url. |
187 | * | 187 | * |
188 | * @param int $entryId ID of the entry | 188 | * @param int $entryId ID of the entry |
@@ -192,8 +192,8 @@ class DownloadImages | |||
192 | private function getRelativePath($entryId) | 192 | private function getRelativePath($entryId) |
193 | { | 193 | { |
194 | $hashId = hash('crc32', $entryId); | 194 | $hashId = hash('crc32', $entryId); |
195 | $relativePath = $hashId[0].'/'.$hashId[1].'/'.$hashId; | 195 | $relativePath = $hashId[0] . '/' . $hashId[1] . '/' . $hashId; |
196 | $folderPath = $this->baseFolder.'/'.$relativePath; | 196 | $folderPath = $this->baseFolder . '/' . $relativePath; |
197 | 197 | ||
198 | if (!file_exists($folderPath)) { | 198 | if (!file_exists($folderPath)) { |
199 | mkdir($folderPath, 0777, true); | 199 | mkdir($folderPath, 0777, true); |
@@ -270,7 +270,7 @@ class DownloadImages | |||
270 | } | 270 | } |
271 | 271 | ||
272 | if (!in_array($ext, ['jpeg', 'jpg', 'gif', 'png'], true)) { | 272 | if (!in_array($ext, ['jpeg', 'jpg', 'gif', 'png'], true)) { |
273 | $this->logger->error('DownloadImages: Processed image with not allowed extension. Skipping: '.$imagePath); | 273 | $this->logger->error('DownloadImages: Processed image with not allowed extension. Skipping: ' . $imagePath); |
274 | 274 | ||
275 | return false; | 275 | return false; |
276 | } | 276 | } |
diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php index 3d36a4c8..cd74cc4f 100644 --- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php +++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php | |||
@@ -63,7 +63,7 @@ class EntriesExport | |||
63 | */ | 63 | */ |
64 | public function updateTitle($method) | 64 | public function updateTitle($method) |
65 | { | 65 | { |
66 | $this->title = $method.' articles'; | 66 | $this->title = $method . ' articles'; |
67 | 67 | ||
68 | if ('entry' === $method) { | 68 | if ('entry' === $method) { |
69 | $this->title = $this->entries[0]->getTitle(); | 69 | $this->title = $this->entries[0]->getTitle(); |
@@ -81,7 +81,7 @@ class EntriesExport | |||
81 | */ | 81 | */ |
82 | public function exportAs($format) | 82 | public function exportAs($format) |
83 | { | 83 | { |
84 | $functionName = 'produce'.ucfirst($format); | 84 | $functionName = 'produce' . ucfirst($format); |
85 | if (method_exists($this, $functionName)) { | 85 | if (method_exists($this, $functionName)) { |
86 | return $this->$functionName(); | 86 | return $this->$functionName(); |
87 | } | 87 | } |
@@ -106,12 +106,12 @@ class EntriesExport | |||
106 | */ | 106 | */ |
107 | $content_start = | 107 | $content_start = |
108 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" | 108 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" |
109 | ."<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:epub=\"http://www.idpf.org/2007/ops\">\n" | 109 | . "<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:epub=\"http://www.idpf.org/2007/ops\">\n" |
110 | .'<head>' | 110 | . '<head>' |
111 | ."<meta http-equiv=\"Default-Style\" content=\"text/html; charset=utf-8\" />\n" | 111 | . "<meta http-equiv=\"Default-Style\" content=\"text/html; charset=utf-8\" />\n" |
112 | ."<title>wallabag articles book</title>\n" | 112 | . "<title>wallabag articles book</title>\n" |
113 | ."</head>\n" | 113 | . "</head>\n" |
114 | ."<body>\n"; | 114 | . "<body>\n"; |
115 | 115 | ||
116 | $bookEnd = "</body>\n</html>\n"; | 116 | $bookEnd = "</body>\n</html>\n"; |
117 | 117 | ||
@@ -164,11 +164,11 @@ class EntriesExport | |||
164 | // in filenames, we limit to A-z/0-9 | 164 | // in filenames, we limit to A-z/0-9 |
165 | $filename = preg_replace('/[^A-Za-z0-9\-]/', '', $entry->getTitle()); | 165 | $filename = preg_replace('/[^A-Za-z0-9\-]/', '', $entry->getTitle()); |
166 | 166 | ||
167 | $chapter = $content_start.$entry->getContent().$bookEnd; | 167 | $chapter = $content_start . $entry->getContent() . $bookEnd; |
168 | $book->addChapter($entry->getTitle(), htmlspecialchars($filename).'.html', $chapter, true, EPub::EXTERNAL_REF_ADD); | 168 | $book->addChapter($entry->getTitle(), htmlspecialchars($filename) . '.html', $chapter, true, EPub::EXTERNAL_REF_ADD); |
169 | } | 169 | } |
170 | 170 | ||
171 | $book->addChapter('Notices', 'Cover2.html', $content_start.$this->getExportInformation('PHPePub').$bookEnd); | 171 | $book->addChapter('Notices', 'Cover2.html', $content_start . $this->getExportInformation('PHPePub') . $bookEnd); |
172 | 172 | ||
173 | return Response::create( | 173 | return Response::create( |
174 | $book->getBook(), | 174 | $book->getBook(), |
@@ -176,7 +176,7 @@ class EntriesExport | |||
176 | [ | 176 | [ |
177 | 'Content-Description' => 'File Transfer', | 177 | 'Content-Description' => 'File Transfer', |
178 | 'Content-type' => 'application/epub+zip', | 178 | 'Content-type' => 'application/epub+zip', |
179 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.epub"', | 179 | 'Content-Disposition' => 'attachment; filename="' . $this->title . '.epub"', |
180 | 'Content-Transfer-Encoding' => 'binary', | 180 | 'Content-Transfer-Encoding' => 'binary', |
181 | ] | 181 | ] |
182 | ); | 182 | ); |
@@ -228,7 +228,7 @@ class EntriesExport | |||
228 | 'Accept-Ranges' => 'bytes', | 228 | 'Accept-Ranges' => 'bytes', |
229 | 'Content-Description' => 'File Transfer', | 229 | 'Content-Description' => 'File Transfer', |
230 | 'Content-type' => 'application/x-mobipocket-ebook', | 230 | 'Content-type' => 'application/x-mobipocket-ebook', |
231 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.mobi"', | 231 | 'Content-Disposition' => 'attachment; filename="' . $this->title . '.mobi"', |
232 | 'Content-Transfer-Encoding' => 'binary', | 232 | 'Content-Transfer-Encoding' => 'binary', |
233 | ] | 233 | ] |
234 | ); | 234 | ); |
@@ -256,7 +256,7 @@ class EntriesExport | |||
256 | * Front page | 256 | * Front page |
257 | */ | 257 | */ |
258 | $pdf->AddPage(); | 258 | $pdf->AddPage(); |
259 | $intro = '<h1>'.$this->title.'</h1>'.$this->getExportInformation('tcpdf'); | 259 | $intro = '<h1>' . $this->title . '</h1>' . $this->getExportInformation('tcpdf'); |
260 | 260 | ||
261 | $pdf->writeHTMLCell(0, 0, '', '', $intro, 0, 1, 0, true, '', true); | 261 | $pdf->writeHTMLCell(0, 0, '', '', $intro, 0, 1, 0, true, '', true); |
262 | 262 | ||
@@ -269,7 +269,7 @@ class EntriesExport | |||
269 | } | 269 | } |
270 | 270 | ||
271 | $pdf->AddPage(); | 271 | $pdf->AddPage(); |
272 | $html = '<h1>'.$entry->getTitle().'</h1>'; | 272 | $html = '<h1>' . $entry->getTitle() . '</h1>'; |
273 | $html .= $entry->getContent(); | 273 | $html .= $entry->getContent(); |
274 | 274 | ||
275 | $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); | 275 | $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); |
@@ -284,7 +284,7 @@ class EntriesExport | |||
284 | [ | 284 | [ |
285 | 'Content-Description' => 'File Transfer', | 285 | 'Content-Description' => 'File Transfer', |
286 | 'Content-type' => 'application/pdf', | 286 | 'Content-type' => 'application/pdf', |
287 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.pdf"', | 287 | 'Content-Disposition' => 'attachment; filename="' . $this->title . '.pdf"', |
288 | 'Content-Transfer-Encoding' => 'binary', | 288 | 'Content-Transfer-Encoding' => 'binary', |
289 | ] | 289 | ] |
290 | ); | 290 | ); |
@@ -330,7 +330,7 @@ class EntriesExport | |||
330 | 200, | 330 | 200, |
331 | [ | 331 | [ |
332 | 'Content-type' => 'application/csv', | 332 | 'Content-type' => 'application/csv', |
333 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.csv"', | 333 | 'Content-Disposition' => 'attachment; filename="' . $this->title . '.csv"', |
334 | 'Content-Transfer-Encoding' => 'UTF-8', | 334 | 'Content-Transfer-Encoding' => 'UTF-8', |
335 | ] | 335 | ] |
336 | ); | 336 | ); |
@@ -348,7 +348,7 @@ class EntriesExport | |||
348 | 200, | 348 | 200, |
349 | [ | 349 | [ |
350 | 'Content-type' => 'application/json', | 350 | 'Content-type' => 'application/json', |
351 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.json"', | 351 | 'Content-Disposition' => 'attachment; filename="' . $this->title . '.json"', |
352 | 'Content-Transfer-Encoding' => 'UTF-8', | 352 | 'Content-Transfer-Encoding' => 'UTF-8', |
353 | ] | 353 | ] |
354 | ); | 354 | ); |
@@ -366,7 +366,7 @@ class EntriesExport | |||
366 | 200, | 366 | 200, |
367 | [ | 367 | [ |
368 | 'Content-type' => 'application/xml', | 368 | 'Content-type' => 'application/xml', |
369 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.xml"', | 369 | 'Content-Disposition' => 'attachment; filename="' . $this->title . '.xml"', |
370 | 'Content-Transfer-Encoding' => 'UTF-8', | 370 | 'Content-Transfer-Encoding' => 'UTF-8', |
371 | ] | 371 | ] |
372 | ); | 372 | ); |
@@ -382,8 +382,8 @@ class EntriesExport | |||
382 | $content = ''; | 382 | $content = ''; |
383 | $bar = str_repeat('=', 100); | 383 | $bar = str_repeat('=', 100); |
384 | foreach ($this->entries as $entry) { | 384 | foreach ($this->entries as $entry) { |
385 | $content .= "\n\n".$bar."\n\n".$entry->getTitle()."\n\n".$bar."\n\n"; | 385 | $content .= "\n\n" . $bar . "\n\n" . $entry->getTitle() . "\n\n" . $bar . "\n\n"; |
386 | $content .= trim(preg_replace('/\s+/S', ' ', strip_tags($entry->getContent())))."\n\n"; | 386 | $content .= trim(preg_replace('/\s+/S', ' ', strip_tags($entry->getContent()))) . "\n\n"; |
387 | } | 387 | } |
388 | 388 | ||
389 | return Response::create( | 389 | return Response::create( |
@@ -391,7 +391,7 @@ class EntriesExport | |||
391 | 200, | 391 | 200, |
392 | [ | 392 | [ |
393 | 'Content-type' => 'text/plain', | 393 | 'Content-type' => 'text/plain', |
394 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.txt"', | 394 | 'Content-Disposition' => 'attachment; filename="' . $this->title . '.txt"', |
395 | 'Content-Transfer-Encoding' => 'UTF-8', | 395 | 'Content-Transfer-Encoding' => 'UTF-8', |
396 | ] | 396 | ] |
397 | ); | 397 | ); |
@@ -427,7 +427,7 @@ class EntriesExport | |||
427 | $info = str_replace('%EXPORT_METHOD%', $type, $this->footerTemplate); | 427 | $info = str_replace('%EXPORT_METHOD%', $type, $this->footerTemplate); |
428 | 428 | ||
429 | if ('tcpdf' === $type) { | 429 | if ('tcpdf' === $type) { |
430 | return str_replace('%IMAGE%', '<img src="'.$this->logoPath.'" />', $info); | 430 | return str_replace('%IMAGE%', '<img src="' . $this->logoPath . '" />', $info); |
431 | } | 431 | } |
432 | 432 | ||
433 | return str_replace('%IMAGE%', '', $info); | 433 | return str_replace('%IMAGE%', '', $info); |
diff --git a/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php b/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php index 43f5b119..4602a684 100644 --- a/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php +++ b/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php | |||
@@ -41,7 +41,7 @@ class HttpClientFactory | |||
41 | */ | 41 | */ |
42 | public function buildHttpClient() | 42 | public function buildHttpClient() |
43 | { | 43 | { |
44 | $this->logger->log('debug', 'Restricted access config enabled?', array('enabled' => (int) $this->restrictedAccess)); | 44 | $this->logger->log('debug', 'Restricted access config enabled?', ['enabled' => (int) $this->restrictedAccess]); |
45 | 45 | ||
46 | if (0 === (int) $this->restrictedAccess) { | 46 | if (0 === (int) $this->restrictedAccess) { |
47 | return; | 47 | return; |
diff --git a/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php b/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php index 231a0b52..49c1ea41 100644 --- a/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php +++ b/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php | |||
@@ -4,9 +4,9 @@ namespace Wallabag\CoreBundle\Helper; | |||
4 | 4 | ||
5 | use Pagerfanta\Adapter\AdapterInterface; | 5 | use Pagerfanta\Adapter\AdapterInterface; |
6 | use Pagerfanta\Pagerfanta; | 6 | use Pagerfanta\Pagerfanta; |
7 | use Wallabag\UserBundle\Entity\User; | ||
8 | use Symfony\Component\Routing\Router; | 7 | use Symfony\Component\Routing\Router; |
9 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; | 8 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; |
9 | use Wallabag\UserBundle\Entity\User; | ||
10 | 10 | ||
11 | class PreparePagerForEntries | 11 | class PreparePagerForEntries |
12 | { | 12 | { |
diff --git a/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php b/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php index 509d0dec..63f65067 100644 --- a/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php +++ b/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php | |||
@@ -2,13 +2,13 @@ | |||
2 | 2 | ||
3 | namespace Wallabag\CoreBundle\Helper; | 3 | namespace Wallabag\CoreBundle\Helper; |
4 | 4 | ||
5 | use Psr\Log\LoggerInterface; | ||
5 | use RulerZ\RulerZ; | 6 | use RulerZ\RulerZ; |
6 | use Wallabag\CoreBundle\Entity\Entry; | 7 | use Wallabag\CoreBundle\Entity\Entry; |
7 | use Wallabag\CoreBundle\Entity\Tag; | 8 | use Wallabag\CoreBundle\Entity\Tag; |
8 | use Wallabag\CoreBundle\Repository\EntryRepository; | 9 | use Wallabag\CoreBundle\Repository\EntryRepository; |
9 | use Wallabag\CoreBundle\Repository\TagRepository; | 10 | use Wallabag\CoreBundle\Repository\TagRepository; |
10 | use Wallabag\UserBundle\Entity\User; | 11 | use Wallabag\UserBundle\Entity\User; |
11 | use Psr\Log\LoggerInterface; | ||
12 | 12 | ||
13 | class RuleBasedTagger | 13 | class RuleBasedTagger |
14 | { | 14 | { |