diff --git a/composer.json b/composer.json index 5941cd8d..147c69fc 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "php-di/php-di": "^7.0.3", "berrnd/slim-blade-view": "^1.0.0", "morris/lessql": "dev-php82", - "gettext/gettext": "^4.8.10", + "gettext/gettext": "dev-4.x-fork", "eluceo/ical": "^2.2.0", "erusev/parsedown": "^1.7", "gumlet/php-image-resize": "^2.0", @@ -20,6 +20,10 @@ { "type": "vcs", "url": "https://github.com/berrnd/lessql" + }, + { + "type": "vcs", + "url": "https://github.com/berrnd/php-gettext" } ], "autoload": { diff --git a/composer.lock b/composer.lock index eb920bbb..dc2a78dd 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "728e901068c017ef990c1936652b93c6", + "content-hash": "ef8208c97da190ec7d138910f95733f2", "packages": [ { "name": "berrnd/slim-blade-view", @@ -517,16 +517,16 @@ }, { "name": "gettext/gettext", - "version": "v4.8.12", + "version": "dev-4.x-fork", "source": { "type": "git", - "url": "https://github.com/php-gettext/Gettext.git", - "reference": "11af89ee6c087db3cf09ce2111a150bca5c46e12" + "url": "https://github.com/berrnd/php-gettext.git", + "reference": "3cafd9f9e66a8673500d767cf7e8da7762f8d00d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-gettext/Gettext/zipball/11af89ee6c087db3cf09ce2111a150bca5c46e12", - "reference": "11af89ee6c087db3cf09ce2111a150bca5c46e12", + "url": "https://api.github.com/repos/berrnd/php-gettext/zipball/3cafd9f9e66a8673500d767cf7e8da7762f8d00d", + "reference": "3cafd9f9e66a8673500d767cf7e8da7762f8d00d", "shasum": "" }, "require": { @@ -547,13 +547,24 @@ "twig/extensions": "Is necessary if you want to use the Twig extractor", "twig/twig": "Is necessary if you want to use the Twig extractor" }, + "default-branch": true, "type": "library", "autoload": { "psr-4": { "Gettext\\": "src" } }, - "notification-url": "https://packagist.org/downloads/", + "autoload-dev": { + "psr-4": { + "Gettext\\Tests\\": "tests" + } + }, + "scripts": { + "test": [ + "phpunit", + "phpcs" + ] + }, "license": [ "MIT" ], @@ -568,9 +579,9 @@ "description": "PHP gettext manager", "homepage": "https://github.com/oscarotero/Gettext", "keywords": [ - "JS", "gettext", "i18n", + "js", "mo", "po", "translation" @@ -578,23 +589,9 @@ "support": { "email": "oom@oscarotero.com", "issues": "https://github.com/oscarotero/Gettext/issues", - "source": "https://github.com/php-gettext/Gettext/tree/v4.8.12" + "source": "https://github.com/berrnd/php-gettext/tree/4.x-fork" }, - "funding": [ - { - "url": "https://paypal.me/oscarotero", - "type": "custom" - }, - { - "url": "https://github.com/oscarotero", - "type": "github" - }, - { - "url": "https://www.patreon.com/misteroom", - "type": "patreon" - } - ], - "time": "2024-05-18T10:25:07+00:00" + "time": "2026-03-02T19:56:11+00:00" }, { "name": "gettext/languages", @@ -4085,6 +4082,7 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { + "gettext/gettext": 20, "morris/lessql": 20 }, "prefer-stable": false, diff --git a/helpers/extensions.php b/helpers/extensions.php index b122df9f..00095da8 100644 --- a/helpers/extensions.php +++ b/helpers/extensions.php @@ -278,17 +278,3 @@ function EmptyFolder($folderPath) } } } - -global $ERROR_REPORTING_STATE; -function ErrorReportingDisableDeprecationWarnings() -{ - global $ERROR_REPORTING_STATE; - $ERROR_REPORTING_STATE = error_reporting(); - error_reporting($ERROR_REPORTING_STATE & ~E_DEPRECATED); -} - -function ErrorReportingReset() -{ - global $ERROR_REPORTING_STATE; - error_reporting($ERROR_REPORTING_STATE); -} diff --git a/services/ApiKeyService.php b/services/ApiKeyService.php index 3e2a4753..21f95587 100644 --- a/services/ApiKeyService.php +++ b/services/ApiKeyService.php @@ -7,7 +7,7 @@ class ApiKeyService extends BaseService const API_KEY_TYPE_DEFAULT = 'default'; const API_KEY_TYPE_SPECIAL_PURPOSE_CALENDAR_ICAL = 'special-purpose-calendar-ical'; - public function CreateApiKey(string $keyType = self::API_KEY_TYPE_DEFAULT, string $description = null) + public function CreateApiKey(string $keyType = self::API_KEY_TYPE_DEFAULT, ?string $description = null) { $newApiKey = $this->GenerateApiKey(); diff --git a/services/LocalizationService.php b/services/LocalizationService.php index 0d3c81e8..21c4115f 100644 --- a/services/LocalizationService.php +++ b/services/LocalizationService.php @@ -73,9 +73,6 @@ class LocalizationService public function __n($number, $singularForm, $pluralForm, $isQu = false) { - // TODO: Upgrade to gettext/gettext >= v5.7 - ErrorReportingDisableDeprecationWarnings(); - $this->CheckAndAddMissingTranslationToPot($singularForm); if (empty($pluralForm)) @@ -91,18 +88,10 @@ class LocalizationService { return sprintf($this->Translator->ngettext($singularForm, $pluralForm, abs(floatval($number))), $number); } - - - // TODO: Upgrade to gettext/gettext >= v5.7 - ErrorReportingReset(); } public function __t($text, ...$placeholderValues) { - - // TODO: Upgrade to gettext/gettext >= v5.7 - ErrorReportingDisableDeprecationWarnings(); - $this->CheckAndAddMissingTranslationToPot($text); if (func_num_args() === 1) @@ -120,10 +109,6 @@ class LocalizationService return sprintf($this->Translator->gettext($text), array_shift($placeholderValues)); } } - - - // TODO: Upgrade to gettext/gettext >= v5.7 - ErrorReportingReset(); } public static function getInstance(string $culture) diff --git a/services/UsersService.php b/services/UsersService.php index 3b68723c..f8bcdc5b 100644 --- a/services/UsersService.php +++ b/services/UsersService.php @@ -6,7 +6,7 @@ use LessQL\Result; class UsersService extends BaseService { - public function CreateUser(string $username, ?string $firstName, ?string $lastName, string $password, string $pictureFileName = null) + public function CreateUser(string $username, ?string $firstName, ?string $lastName, string $password, ?string $pictureFileName = null) { $newUserRow = $this->getDatabase()->users()->createRow([ 'username' => $username, @@ -37,7 +37,7 @@ class UsersService extends BaseService $row->delete(); } - public function EditUser(int $userId, string $username, string $firstName, string $lastName, ?string $password, string $pictureFileName = null) + public function EditUser(int $userId, string $username, string $firstName, string $lastName, ?string $password, ?string $pictureFileName = null) { if (!$this->UserExists($userId)) {