diff --git a/composer.json b/composer.json index 4e42f2cb..b69306cf 100644 --- a/composer.json +++ b/composer.json @@ -83,6 +83,7 @@ "Shlinkio\\Shlink\\Core\\": "module/Core/src" }, "files": [ + "config/constants.php", "module/Core/functions/functions.php" ] }, diff --git a/config/autoload/delete_short_urls.global.php b/config/autoload/delete_short_urls.global.php index 986b33ac..7f64abd7 100644 --- a/config/autoload/delete_short_urls.global.php +++ b/config/autoload/delete_short_urls.global.php @@ -6,7 +6,7 @@ namespace Shlinkio\Shlink; use function Shlinkio\Shlink\Common\env; -use const Shlinkio\Shlink\Core\DEFAULT_DELETE_SHORT_URL_THRESHOLD; +use const Shlinkio\Shlink\DEFAULT_DELETE_SHORT_URL_THRESHOLD; return [ diff --git a/config/autoload/locks.global.php b/config/autoload/locks.global.php index 35f4e90c..60054147 100644 --- a/config/autoload/locks.global.php +++ b/config/autoload/locks.global.php @@ -9,7 +9,7 @@ use Symfony\Component\Lock; use function Shlinkio\Shlink\Common\env; -use const Shlinkio\Shlink\Core\LOCAL_LOCK_FACTORY; +use const Shlinkio\Shlink\LOCAL_LOCK_FACTORY; return [ diff --git a/config/autoload/url-shortener.global.php b/config/autoload/url-shortener.global.php index 5193ee1b..432c63e1 100644 --- a/config/autoload/url-shortener.global.php +++ b/config/autoload/url-shortener.global.php @@ -4,10 +4,10 @@ declare(strict_types=1); use function Shlinkio\Shlink\Common\env; -use const Shlinkio\Shlink\Core\DEFAULT_REDIRECT_CACHE_LIFETIME; -use const Shlinkio\Shlink\Core\DEFAULT_REDIRECT_STATUS_CODE; -use const Shlinkio\Shlink\Core\DEFAULT_SHORT_CODES_LENGTH; -use const Shlinkio\Shlink\Core\MIN_SHORT_CODES_LENGTH; +use const Shlinkio\Shlink\DEFAULT_REDIRECT_CACHE_LIFETIME; +use const Shlinkio\Shlink\DEFAULT_REDIRECT_STATUS_CODE; +use const Shlinkio\Shlink\DEFAULT_SHORT_CODES_LENGTH; +use const Shlinkio\Shlink\MIN_SHORT_CODES_LENGTH; return (static function (): array { $webhooks = env('VISITS_WEBHOOKS'); diff --git a/config/constants.php b/config/constants.php new file mode 100644 index 00000000..5a270e3c --- /dev/null +++ b/config/constants.php @@ -0,0 +1,16 @@ +]*>(.*?)<\/title>/i'; // Matches the value inside an html title tag diff --git a/config/container.php b/config/container.php index 7b6f0b08..56fb345d 100644 --- a/config/container.php +++ b/config/container.php @@ -5,7 +5,7 @@ declare(strict_types=1); use Laminas\ServiceManager\ServiceManager; use Symfony\Component\Lock; -use const Shlinkio\Shlink\Core\LOCAL_LOCK_FACTORY; +use const Shlinkio\Shlink\LOCAL_LOCK_FACTORY; chdir(dirname(__DIR__)); diff --git a/module/CLI/config/dependencies.config.php b/module/CLI/config/dependencies.config.php index 95ea1bbc..d89a8af2 100644 --- a/module/CLI/config/dependencies.config.php +++ b/module/CLI/config/dependencies.config.php @@ -24,7 +24,7 @@ use Symfony\Component\Console as SymfonyCli; use Symfony\Component\Lock\LockFactory; use Symfony\Component\Process\PhpExecutableFinder; -use const Shlinkio\Shlink\Core\LOCAL_LOCK_FACTORY; +use const Shlinkio\Shlink\LOCAL_LOCK_FACTORY; return [ diff --git a/module/Core/functions/functions.php b/module/Core/functions/functions.php index 9ba4bdcc..bba0c17b 100644 --- a/module/Core/functions/functions.php +++ b/module/Core/functions/functions.php @@ -6,7 +6,6 @@ namespace Shlinkio\Shlink\Core; use Cake\Chronos\Chronos; use DateTimeInterface; -use Fig\Http\Message\StatusCodeInterface; use Jaybizzle\CrawlerDetect\CrawlerDetect; use Laminas\InputFilter\InputFilter; use PUGX\Shortid\Factory as ShortIdFactory; @@ -22,15 +21,6 @@ use function str_repeat; use function str_replace; use function ucwords; -const DEFAULT_DELETE_SHORT_URL_THRESHOLD = 15; -const DEFAULT_SHORT_CODES_LENGTH = 5; -const MIN_SHORT_CODES_LENGTH = 4; -const DEFAULT_REDIRECT_STATUS_CODE = StatusCodeInterface::STATUS_FOUND; -const DEFAULT_REDIRECT_CACHE_LIFETIME = 30; -const LOCAL_LOCK_FACTORY = 'Shlinkio\Shlink\LocalLockFactory'; -const CUSTOM_SLUGS_REGEXP = '/[^\pL\pN._~]/u'; // Any unicode letter or number, plus ".", "_" and "~" chars -const TITLE_TAG_VALUE = '/