From 1b93137e16694f52952c930848e1a7928e8a00a6 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Wed, 9 Nov 2016 18:57:02 +0100 Subject: Use web-thumbnailer to retrieve thumbnails * requires PHP 5.6 * use blazy on linklist since a lot more thumbs are retrieved * thumbnails can be disabled * thumbs size is now 120x120 * thumbs are now cropped to fit the expected size Fixes #345 #425 #487 #543 #588 #590 --- application/config/ConfigManager.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'application/config') diff --git a/application/config/ConfigManager.php b/application/config/ConfigManager.php index 82f4a368..124fedc2 100644 --- a/application/config/ConfigManager.php +++ b/application/config/ConfigManager.php @@ -319,6 +319,10 @@ class ConfigManager $this->setEmpty('general.enabled_plugins', self::$DEFAULT_PLUGINS); $this->setEmpty('general.default_note_title', 'Note: '); + $this->setEmpty('thumbnails.enabled', true); + $this->setEmpty('thumbnails.width', 120); + $this->setEmpty('thumbnails.height', 120); + $this->setEmpty('updates.check_updates', false); $this->setEmpty('updates.check_updates_branch', 'stable'); $this->setEmpty('updates.check_updates_interval', 86400); -- cgit v1.2.3 From a3724717ec37d4bd54dc117ef439c8a182157882 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Sat, 11 Nov 2017 14:00:18 +0100 Subject: ConfigManager: add a method to remove an entry --- application/config/ConfigManager.php | 50 +++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) (limited to 'application/config') diff --git a/application/config/ConfigManager.php b/application/config/ConfigManager.php index 124fedc2..faf25426 100644 --- a/application/config/ConfigManager.php +++ b/application/config/ConfigManager.php @@ -147,6 +147,33 @@ class ConfigManager } } + /** + * Remove a config element from the config file. + * + * @param string $setting Asked setting, keys separated with dots. + * @param bool $write Write the new setting in the config file, default false. + * @param bool $isLoggedIn User login state, default false. + * + * @throws \Exception Invalid + */ + public function remove($setting, $write = false, $isLoggedIn = false) + { + if (empty($setting) || ! is_string($setting)) { + throw new \Exception(t('Invalid setting key parameter. String expected, got: '). gettype($setting)); + } + + // During the ConfigIO transition, map legacy settings to the new ones. + if ($this->configIO instanceof ConfigPhp && isset(ConfigPhp::$LEGACY_KEYS_MAPPING[$setting])) { + $setting = ConfigPhp::$LEGACY_KEYS_MAPPING[$setting]; + } + + $settings = explode('.', $setting); + self::removeConfig($settings, $this->loadedConfig); + if ($write) { + $this->write($isLoggedIn); + } + } + /** * Check if a settings exists. * @@ -272,7 +299,7 @@ class ConfigManager * * @param array $settings Ordered array which contains keys to find. * @param mixed $value - * @param array $conf Loaded settings, then sub-array. + * @param array $conf Loaded settings, then sub-array. * * @return mixed Found setting or NOT_FOUND flag. */ @@ -289,6 +316,27 @@ class ConfigManager $conf[$setting] = $value; } + /** + * Recursive function which find asked setting in the loaded config and deletes it. + * + * @param array $settings Ordered array which contains keys to find. + * @param array $conf Loaded settings, then sub-array. + * + * @return mixed Found setting or NOT_FOUND flag. + */ + protected static function removeConfig($settings, &$conf) + { + if (!is_array($settings) || count($settings) == 0) { + return self::$NOT_FOUND; + } + + $setting = array_shift($settings); + if (count($settings) > 0) { + return self::removeConfig($settings, $conf[$setting]); + } + unset($conf[$setting]); + } + /** * Set a bunch of default values allowing Shaarli to start without a config file. */ -- cgit v1.2.3 From 28f26524609338316cc6e51c743058e6e8c7b12b Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Fri, 8 Jun 2018 12:50:49 +0200 Subject: Add a page to update all thumbnails through AJAX requests in both templates --- application/config/ConfigManager.php | 7 ------- 1 file changed, 7 deletions(-) (limited to 'application/config') diff --git a/application/config/ConfigManager.php b/application/config/ConfigManager.php index faf25426..96e2e912 100644 --- a/application/config/ConfigManager.php +++ b/application/config/ConfigManager.php @@ -367,10 +367,6 @@ class ConfigManager $this->setEmpty('general.enabled_plugins', self::$DEFAULT_PLUGINS); $this->setEmpty('general.default_note_title', 'Note: '); - $this->setEmpty('thumbnails.enabled', true); - $this->setEmpty('thumbnails.width', 120); - $this->setEmpty('thumbnails.height', 120); - $this->setEmpty('updates.check_updates', false); $this->setEmpty('updates.check_updates_branch', 'stable'); $this->setEmpty('updates.check_updates_interval', 86400); @@ -385,9 +381,6 @@ class ConfigManager // default state of the 'remember me' checkbox of the login form $this->setEmpty('privacy.remember_user_default', true); - $this->setEmpty('thumbnail.enable_thumbnails', true); - $this->setEmpty('thumbnail.enable_localcache', true); - $this->setEmpty('redirector.url', ''); $this->setEmpty('redirector.encode_url', true); -- cgit v1.2.3 From 7b4fea0e39be9e74e9aef13e73af9bbd2b1a6397 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Tue, 17 Jul 2018 13:13:26 +0200 Subject: Bunch of improvement for thumbnails integration: - add a default thumb size value (125x90px) - improve private vertical bar visual, especially with thumbnails - translations - add a sync thumbs button in tool and empty picwall page - fixes WT download mode in JSON config --- application/config/ConfigManager.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'application/config') diff --git a/application/config/ConfigManager.php b/application/config/ConfigManager.php index 96e2e912..32aaea48 100644 --- a/application/config/ConfigManager.php +++ b/application/config/ConfigManager.php @@ -384,6 +384,9 @@ class ConfigManager $this->setEmpty('redirector.url', ''); $this->setEmpty('redirector.encode_url', true); + $this->setEmpty('thumbnails.width', '125'); + $this->setEmpty('thumbnails.height', '90'); + $this->setEmpty('translation.language', 'auto'); $this->setEmpty('translation.mode', 'php'); $this->setEmpty('translation.extensions', []); -- cgit v1.2.3