diff options
Diffstat (limited to 'application')
-rw-r--r-- | application/History.php | 10 | ||||
-rw-r--r-- | application/Languages.php | 6 | ||||
-rw-r--r-- | application/Thumbnailer.php | 8 | ||||
-rw-r--r-- | application/Utils.php | 2 | ||||
-rw-r--r-- | application/bookmark/Bookmark.php | 2 | ||||
-rw-r--r-- | application/bookmark/BookmarkFileService.php | 4 | ||||
-rw-r--r-- | application/bookmark/BookmarkInitializer.php | 3 | ||||
-rw-r--r-- | application/container/ContainerBuilder.php | 2 | ||||
-rw-r--r-- | application/formatter/BookmarkDefaultFormatter.php | 4 | ||||
-rw-r--r-- | application/formatter/BookmarkMarkdownFormatter.php | 2 | ||||
-rw-r--r-- | application/front/controller/admin/ConfigureController.php | 9 | ||||
-rw-r--r-- | application/front/controller/admin/ServerController.php | 4 | ||||
-rw-r--r-- | application/legacy/LegacyLinkDB.php | 2 | ||||
-rw-r--r-- | application/updater/Updater.php | 4 | ||||
-rw-r--r-- | application/updater/UpdaterUtils.php | 4 |
15 files changed, 40 insertions, 26 deletions
diff --git a/application/History.php b/application/History.php index 1be955c5..d230f39d 100644 --- a/application/History.php +++ b/application/History.php | |||
@@ -32,27 +32,27 @@ class History | |||
32 | /** | 32 | /** |
33 | * @var string Action key: a new link has been created. | 33 | * @var string Action key: a new link has been created. |
34 | */ | 34 | */ |
35 | const CREATED = 'CREATED'; | 35 | public const CREATED = 'CREATED'; |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * @var string Action key: a link has been updated. | 38 | * @var string Action key: a link has been updated. |
39 | */ | 39 | */ |
40 | const UPDATED = 'UPDATED'; | 40 | public const UPDATED = 'UPDATED'; |
41 | 41 | ||
42 | /** | 42 | /** |
43 | * @var string Action key: a link has been deleted. | 43 | * @var string Action key: a link has been deleted. |
44 | */ | 44 | */ |
45 | const DELETED = 'DELETED'; | 45 | public const DELETED = 'DELETED'; |
46 | 46 | ||
47 | /** | 47 | /** |
48 | * @var string Action key: settings have been updated. | 48 | * @var string Action key: settings have been updated. |
49 | */ | 49 | */ |
50 | const SETTINGS = 'SETTINGS'; | 50 | public const SETTINGS = 'SETTINGS'; |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * @var string Action key: a bulk import has been processed. | 53 | * @var string Action key: a bulk import has been processed. |
54 | */ | 54 | */ |
55 | const IMPORT = 'IMPORT'; | 55 | public const IMPORT = 'IMPORT'; |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * @var string History file path. | 58 | * @var string History file path. |
diff --git a/application/Languages.php b/application/Languages.php index 8d0e13c8..60e91631 100644 --- a/application/Languages.php +++ b/application/Languages.php | |||
@@ -41,7 +41,7 @@ class Languages | |||
41 | /** | 41 | /** |
42 | * Core translations domain | 42 | * Core translations domain |
43 | */ | 43 | */ |
44 | const DEFAULT_DOMAIN = 'shaarli'; | 44 | public const DEFAULT_DOMAIN = 'shaarli'; |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * @var TranslatorInterface | 47 | * @var TranslatorInterface |
@@ -122,7 +122,9 @@ class Languages | |||
122 | $translations = new Translations(); | 122 | $translations = new Translations(); |
123 | // Core translations | 123 | // Core translations |
124 | try { | 124 | try { |
125 | $translations = $translations->addFromPoFile('inc/languages/' . $this->language . '/LC_MESSAGES/shaarli.po'); | 125 | $translations = $translations->addFromPoFile( |
126 | 'inc/languages/' . $this->language . '/LC_MESSAGES/shaarli.po' | ||
127 | ); | ||
126 | $translations->setDomain('shaarli'); | 128 | $translations->setDomain('shaarli'); |
127 | $this->translator->loadTranslations($translations); | 129 | $this->translator->loadTranslations($translations); |
128 | } catch (\InvalidArgumentException $e) { | 130 | } catch (\InvalidArgumentException $e) { |
diff --git a/application/Thumbnailer.php b/application/Thumbnailer.php index 30354310..c4ff8d7a 100644 --- a/application/Thumbnailer.php +++ b/application/Thumbnailer.php | |||
@@ -13,7 +13,7 @@ use WebThumbnailer\WebThumbnailer; | |||
13 | */ | 13 | */ |
14 | class Thumbnailer | 14 | class Thumbnailer |
15 | { | 15 | { |
16 | const COMMON_MEDIA_DOMAINS = [ | 16 | protected const COMMON_MEDIA_DOMAINS = [ |
17 | 'imgur.com', | 17 | 'imgur.com', |
18 | 'flickr.com', | 18 | 'flickr.com', |
19 | 'youtube.com', | 19 | 'youtube.com', |
@@ -31,9 +31,9 @@ class Thumbnailer | |||
31 | 'deviantart.com', | 31 | 'deviantart.com', |
32 | ]; | 32 | ]; |
33 | 33 | ||
34 | const MODE_ALL = 'all'; | 34 | public const MODE_ALL = 'all'; |
35 | const MODE_COMMON = 'common'; | 35 | public const MODE_COMMON = 'common'; |
36 | const MODE_NONE = 'none'; | 36 | public const MODE_NONE = 'none'; |
37 | 37 | ||
38 | /** | 38 | /** |
39 | * @var WebThumbnailer instance. | 39 | * @var WebThumbnailer instance. |
diff --git a/application/Utils.php b/application/Utils.php index 4c2d6701..952378ab 100644 --- a/application/Utils.php +++ b/application/Utils.php | |||
@@ -382,8 +382,10 @@ function return_bytes($val) | |||
382 | switch ($last) { | 382 | switch ($last) { |
383 | case 'g': | 383 | case 'g': |
384 | $val *= 1024; | 384 | $val *= 1024; |
385 | // do no break in order 1024^2 for each unit | ||
385 | case 'm': | 386 | case 'm': |
386 | $val *= 1024; | 387 | $val *= 1024; |
388 | // do no break in order 1024^2 for each unit | ||
387 | case 'k': | 389 | case 'k': |
388 | $val *= 1024; | 390 | $val *= 1024; |
389 | } | 391 | } |
diff --git a/application/bookmark/Bookmark.php b/application/bookmark/Bookmark.php index b592722f..4238ef25 100644 --- a/application/bookmark/Bookmark.php +++ b/application/bookmark/Bookmark.php | |||
@@ -19,7 +19,7 @@ use Shaarli\Bookmark\Exception\InvalidBookmarkException; | |||
19 | class Bookmark | 19 | class Bookmark |
20 | { | 20 | { |
21 | /** @var string Date format used in string (former ID format) */ | 21 | /** @var string Date format used in string (former ID format) */ |
22 | const LINK_DATE_FORMAT = 'Ymd_His'; | 22 | public const LINK_DATE_FORMAT = 'Ymd_His'; |
23 | 23 | ||
24 | /** @var int Bookmark ID */ | 24 | /** @var int Bookmark ID */ |
25 | protected $id; | 25 | protected $id; |
diff --git a/application/bookmark/BookmarkFileService.php b/application/bookmark/BookmarkFileService.php index 66248cc2..6666a251 100644 --- a/application/bookmark/BookmarkFileService.php +++ b/application/bookmark/BookmarkFileService.php | |||
@@ -409,14 +409,14 @@ class BookmarkFileService implements BookmarkServiceInterface | |||
409 | false | 409 | false |
410 | ); | 410 | ); |
411 | $updater = new LegacyUpdater( | 411 | $updater = new LegacyUpdater( |
412 | UpdaterUtils::read_updates_file($this->conf->get('resource.updates')), | 412 | UpdaterUtils::readUpdatesFile($this->conf->get('resource.updates')), |
413 | $bookmarkDb, | 413 | $bookmarkDb, |
414 | $this->conf, | 414 | $this->conf, |
415 | true | 415 | true |
416 | ); | 416 | ); |
417 | $newUpdates = $updater->update(); | 417 | $newUpdates = $updater->update(); |
418 | if (! empty($newUpdates)) { | 418 | if (! empty($newUpdates)) { |
419 | UpdaterUtils::write_updates_file( | 419 | UpdaterUtils::writeUpdatesFile( |
420 | $this->conf->get('resource.updates'), | 420 | $this->conf->get('resource.updates'), |
421 | $updater->getDoneUpdates() | 421 | $updater->getDoneUpdates() |
422 | ); | 422 | ); |
diff --git a/application/bookmark/BookmarkInitializer.php b/application/bookmark/BookmarkInitializer.php index 2240f58c..8ab5c441 100644 --- a/application/bookmark/BookmarkInitializer.php +++ b/application/bookmark/BookmarkInitializer.php | |||
@@ -13,6 +13,9 @@ namespace Shaarli\Bookmark; | |||
13 | * To prevent data corruption, it does not overwrite existing bookmarks, | 13 | * To prevent data corruption, it does not overwrite existing bookmarks, |
14 | * even though there should not be any. | 14 | * even though there should not be any. |
15 | * | 15 | * |
16 | * We disable this because otherwise it creates indentation issues, and heredoc is not supported by PHP gettext. | ||
17 | * @phpcs:disable Generic.Files.LineLength.TooLong | ||
18 | * | ||
16 | * @package Shaarli\Bookmark | 19 | * @package Shaarli\Bookmark |
17 | */ | 20 | */ |
18 | class BookmarkInitializer | 21 | class BookmarkInitializer |
diff --git a/application/container/ContainerBuilder.php b/application/container/ContainerBuilder.php index d84418ad..f0234eca 100644 --- a/application/container/ContainerBuilder.php +++ b/application/container/ContainerBuilder.php | |||
@@ -158,7 +158,7 @@ class ContainerBuilder | |||
158 | 158 | ||
159 | $container['updater'] = function (ShaarliContainer $container): Updater { | 159 | $container['updater'] = function (ShaarliContainer $container): Updater { |
160 | return new Updater( | 160 | return new Updater( |
161 | UpdaterUtils::read_updates_file($container->conf->get('resource.updates')), | 161 | UpdaterUtils::readUpdatesFile($container->conf->get('resource.updates')), |
162 | $container->bookmarkService, | 162 | $container->bookmarkService, |
163 | $container->conf, | 163 | $container->conf, |
164 | $container->loginManager->isLoggedIn() | 164 | $container->loginManager->isLoggedIn() |
diff --git a/application/formatter/BookmarkDefaultFormatter.php b/application/formatter/BookmarkDefaultFormatter.php index 51bea0f1..7e0afafc 100644 --- a/application/formatter/BookmarkDefaultFormatter.php +++ b/application/formatter/BookmarkDefaultFormatter.php | |||
@@ -12,8 +12,8 @@ namespace Shaarli\Formatter; | |||
12 | */ | 12 | */ |
13 | class BookmarkDefaultFormatter extends BookmarkFormatter | 13 | class BookmarkDefaultFormatter extends BookmarkFormatter |
14 | { | 14 | { |
15 | const SEARCH_HIGHLIGHT_OPEN = '|@@HIGHLIGHT'; | 15 | protected const SEARCH_HIGHLIGHT_OPEN = '|@@HIGHLIGHT'; |
16 | const SEARCH_HIGHLIGHT_CLOSE = 'HIGHLIGHT@@|'; | 16 | protected const SEARCH_HIGHLIGHT_CLOSE = 'HIGHLIGHT@@|'; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * @inheritdoc | 19 | * @inheritdoc |
diff --git a/application/formatter/BookmarkMarkdownFormatter.php b/application/formatter/BookmarkMarkdownFormatter.php index 052333ca..ee4e8dca 100644 --- a/application/formatter/BookmarkMarkdownFormatter.php +++ b/application/formatter/BookmarkMarkdownFormatter.php | |||
@@ -16,7 +16,7 @@ class BookmarkMarkdownFormatter extends BookmarkDefaultFormatter | |||
16 | /** | 16 | /** |
17 | * When this tag is present in a bookmark, its description should not be processed with Markdown | 17 | * When this tag is present in a bookmark, its description should not be processed with Markdown |
18 | */ | 18 | */ |
19 | const NO_MD_TAG = 'nomarkdown'; | 19 | public const NO_MD_TAG = 'nomarkdown'; |
20 | 20 | ||
21 | /** @var \Parsedown instance */ | 21 | /** @var \Parsedown instance */ |
22 | protected $parsedown; | 22 | protected $parsedown; |
diff --git a/application/front/controller/admin/ConfigureController.php b/application/front/controller/admin/ConfigureController.php index eb26ef21..dc421661 100644 --- a/application/front/controller/admin/ConfigureController.php +++ b/application/front/controller/admin/ConfigureController.php | |||
@@ -51,7 +51,10 @@ class ConfigureController extends ShaarliAdminController | |||
51 | $this->assignView('languages', Languages::getAvailableLanguages()); | 51 | $this->assignView('languages', Languages::getAvailableLanguages()); |
52 | $this->assignView('gd_enabled', extension_loaded('gd')); | 52 | $this->assignView('gd_enabled', extension_loaded('gd')); |
53 | $this->assignView('thumbnails_mode', $this->container->conf->get('thumbnails.mode', Thumbnailer::MODE_NONE)); | 53 | $this->assignView('thumbnails_mode', $this->container->conf->get('thumbnails.mode', Thumbnailer::MODE_NONE)); |
54 | $this->assignView('pagetitle', t('Configure') . ' - ' . $this->container->conf->get('general.title', 'Shaarli')); | 54 | $this->assignView( |
55 | 'pagetitle', | ||
56 | t('Configure') . ' - ' . $this->container->conf->get('general.title', 'Shaarli') | ||
57 | ); | ||
55 | 58 | ||
56 | return $response->write($this->render(TemplatePage::CONFIGURE)); | 59 | return $response->write($this->render(TemplatePage::CONFIGURE)); |
57 | } | 60 | } |
@@ -101,7 +104,9 @@ class ConfigureController extends ShaarliAdminController | |||
101 | ) { | 104 | ) { |
102 | $this->saveWarningMessage( | 105 | $this->saveWarningMessage( |
103 | t('You have enabled or changed thumbnails mode.') . | 106 | t('You have enabled or changed thumbnails mode.') . |
104 | '<a href="' . $this->container->basePath . '/admin/thumbnails">' . t('Please synchronize them.') . '</a>' | 107 | '<a href="' . $this->container->basePath . '/admin/thumbnails">' . |
108 | t('Please synchronize them.') . | ||
109 | '</a>' | ||
105 | ); | 110 | ); |
106 | } | 111 | } |
107 | $this->container->conf->set('thumbnails.mode', $thumbnailsMode); | 112 | $this->container->conf->set('thumbnails.mode', $thumbnailsMode); |
diff --git a/application/front/controller/admin/ServerController.php b/application/front/controller/admin/ServerController.php index 80997940..575a2f9d 100644 --- a/application/front/controller/admin/ServerController.php +++ b/application/front/controller/admin/ServerController.php | |||
@@ -65,7 +65,9 @@ class ServerController extends ShaarliAdminController | |||
65 | 65 | ||
66 | $this->saveWarningMessage( | 66 | $this->saveWarningMessage( |
67 | t('Thumbnails cache has been cleared.') . ' ' . | 67 | t('Thumbnails cache has been cleared.') . ' ' . |
68 | '<a href="' . $this->container->basePath . '/admin/thumbnails">' . t('Please synchronize them.') . '</a>' | 68 | '<a href="' . $this->container->basePath . '/admin/thumbnails">' . |
69 | t('Please synchronize them.') . | ||
70 | '</a>' | ||
69 | ); | 71 | ); |
70 | } else { | 72 | } else { |
71 | $folders = [ | 73 | $folders = [ |
diff --git a/application/legacy/LegacyLinkDB.php b/application/legacy/LegacyLinkDB.php index 442b833c..d3beafe0 100644 --- a/application/legacy/LegacyLinkDB.php +++ b/application/legacy/LegacyLinkDB.php | |||
@@ -62,7 +62,7 @@ class LegacyLinkDB implements Iterator, Countable, ArrayAccess | |||
62 | private $datastore; | 62 | private $datastore; |
63 | 63 | ||
64 | // Link date storage format | 64 | // Link date storage format |
65 | const LINK_DATE_FORMAT = 'Ymd_His'; | 65 | public const LINK_DATE_FORMAT = 'Ymd_His'; |
66 | 66 | ||
67 | // List of bookmarks (associative array) | 67 | // List of bookmarks (associative array) |
68 | // - key: link date (e.g. "20110823_124546"), | 68 | // - key: link date (e.g. "20110823_124546"), |
diff --git a/application/updater/Updater.php b/application/updater/Updater.php index 3451cf36..4f557d0f 100644 --- a/application/updater/Updater.php +++ b/application/updater/Updater.php | |||
@@ -122,12 +122,12 @@ class Updater | |||
122 | 122 | ||
123 | public function readUpdates(string $updatesFilepath): array | 123 | public function readUpdates(string $updatesFilepath): array |
124 | { | 124 | { |
125 | return UpdaterUtils::read_updates_file($updatesFilepath); | 125 | return UpdaterUtils::readUpdatesFile($updatesFilepath); |
126 | } | 126 | } |
127 | 127 | ||
128 | public function writeUpdates(string $updatesFilepath, array $updates): void | 128 | public function writeUpdates(string $updatesFilepath, array $updates): void |
129 | { | 129 | { |
130 | UpdaterUtils::write_updates_file($updatesFilepath, $updates); | 130 | UpdaterUtils::writeUpdatesFile($updatesFilepath, $updates); |
131 | } | 131 | } |
132 | 132 | ||
133 | /** | 133 | /** |
diff --git a/application/updater/UpdaterUtils.php b/application/updater/UpdaterUtils.php index 908bdc39..206f826e 100644 --- a/application/updater/UpdaterUtils.php +++ b/application/updater/UpdaterUtils.php | |||
@@ -11,7 +11,7 @@ class UpdaterUtils | |||
11 | * | 11 | * |
12 | * @return array Already done update methods. | 12 | * @return array Already done update methods. |
13 | */ | 13 | */ |
14 | public static function read_updates_file($updatesFilepath) | 14 | public static function readUpdatesFile($updatesFilepath) |
15 | { | 15 | { |
16 | if (! empty($updatesFilepath) && is_file($updatesFilepath)) { | 16 | if (! empty($updatesFilepath) && is_file($updatesFilepath)) { |
17 | $content = file_get_contents($updatesFilepath); | 17 | $content = file_get_contents($updatesFilepath); |
@@ -30,7 +30,7 @@ class UpdaterUtils | |||
30 | * | 30 | * |
31 | * @throws \Exception Couldn't write version number. | 31 | * @throws \Exception Couldn't write version number. |
32 | */ | 32 | */ |
33 | public static function write_updates_file($updatesFilepath, $updates) | 33 | public static function writeUpdatesFile($updatesFilepath, $updates) |
34 | { | 34 | { |
35 | if (empty($updatesFilepath)) { | 35 | if (empty($updatesFilepath)) { |
36 | throw new \Exception('Updates file path is not set, can\'t write updates.'); | 36 | throw new \Exception('Updates file path is not set, can\'t write updates.'); |